diff --git a/assets/config/opensrp.properties b/assets/config/opensrp.properties index 8b9631c2e7..cfe2ff4d3d 100644 --- a/assets/config/opensrp.properties +++ b/assets/config/opensrp.properties @@ -17,7 +17,7 @@ report-fields-definition-path=/report-fields-definition.json report-definition-path=/report-definition.json mcts-report-definition-path=/mcts-report-definition.json mcts-report-delay-in-days=10 -mcts.poll.time.interval.in.minutes=10git +mcts.poll.time.interval.in.minutes=10 # OpenMRS configuration openmrs.url=http://localhost:8080/openmrs/ @@ -44,7 +44,7 @@ openmrs.scheduletracker.syncer.interval-min=2 couchdb.server=localhost couchdb.port=5984 couchdb.username=admin -couchdb.password=admin +couchdb.password=D3v!23 couchdb.atomfeed-db.revision-limit=2 @@ -113,12 +113,5 @@ oauth.default.callback.url=https://yourapplication.com/registered/callback #Team module settings use.opensrp.team.module=false -# S3 configuration (should be populated for deployments using S3 multimedia storage) -aws_access_key_id= -aws_secret_access_key= -aws_region= -aws_bucket= -aws_key_folder=none - # multimedia file manager (is file system by default) multimedia_file_manager=FileSystemMultimediaFileManager diff --git a/build/lib/postgresql-9.1-901.jdbc4.jar b/build/lib/postgresql-9.1-901.jdbc4.jar old mode 100755 new mode 100644 diff --git a/build/maven.properties b/build/maven.properties old mode 100755 new mode 100644 diff --git a/build/sql/tables_opensrp.sql b/build/sql/tables_opensrp.sql old mode 100755 new mode 100644 diff --git a/build/sql/tables_quartz_MYSQL.sql b/build/sql/tables_quartz_MYSQL.sql old mode 100755 new mode 100644 diff --git a/build/sql/tables_quartz_postgres.sql b/build/sql/tables_quartz_postgres.sql old mode 100755 new mode 100644 diff --git a/modules/core/persistence_postgres.xml b/modules/core/persistence_postgres.xml index 981c1b0ca7..02a752809f 100644 --- a/modules/core/persistence_postgres.xml +++ b/modules/core/persistence_postgres.xml @@ -19,8 +19,6 @@ expression="org.opensrp.service.formSubmission.ziggy.*" /> - diff --git a/opensrp-api/pom.xml b/opensrp-api/pom.xml deleted file mode 100755 index 49c9b20b76..0000000000 --- a/opensrp-api/pom.xml +++ /dev/null @@ -1,255 +0,0 @@ - - 4.0.0 - org.smartregister - - opensrp-server-api - jar - - 1.0.1 - - opensrp-server-api - OpenSRP Server Api module - http://github.com/OpenSRP/opensrp-server-api - - - ${project.basedir} - UTF-8 - 1.5.1 - - 1.0.1 - - - - - - nexus-snapshots - Nexus Snapshots Repository - https://oss.sonatype.org/content/repositories/snapshots - false - - - nexus-releases - https://oss.sonatype.org/service/local/staging/deploy/maven2 - - - - - scm:git:git@github.com:OpenSRP/opensrp-server-api.git - scm:git:git@github.com:OpenSRP/opensrp-server-api.git - https://github.com/OpenSRP/opensrp-server-api - - - - - Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0.txt - repo - Open Smart Register Platform (OpenSRP) is Licensed under the Apache License, Version 2.0 - - - - - - opensrp_developer - OpenSRP Developer - info@smartregister.org - https://groups.google.com/forum/#!forum/opensrp-dev - OpenSRP - http://smartregister.org - - developer - - Africa/Nairobi - - - - - - snapshots-repo - https://oss.sonatype.org/content/repositories/snapshots - - false - - - true - - - - - - - org.smartregister - opensrp-server-common - ${opensrp.common.version} - - - commons-lang - commons-lang - 2.5 - - - junit - junit - 4.8.2 - test - - - org.apache.commons - commons-lang3 - 3.1 - - - com.google.code.gson - gson - 2.2.4 - - - com.openpojo - openpojo - 0.8.3 - test - - - nl.jqno.equalsverifier - equalsverifier - 2.3 - test - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.7 - 1.7 - UTF-8 - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - none - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${nexus-staging-maven-plugin.version} - - - default-deploy - deploy - - deploy - - - - - nexus-snapshots - https://oss.sonatype.org/ - true - - - - org.jacoco - jacoco-maven-plugin - 0.7.9 - - ${basedir}/target/coverage-reports/jacoco-unit.exec - ${basedir}/target/coverage-reports/jacoco-unit.exec - - - - jacoco-initialize - - prepare-agent - - - - jacoco-site - test - - report - - - - - - org.eluder.coveralls - coveralls-maven-plugin - 4.0.0 - - - - - - - release - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.5.1 - - - default-deploy - deploy - - deploy - - - - - nexus-releases - https://oss.sonatype.org/ - false - true - - - - - - - diff --git a/opensrp-api/src/main/java/org/opensrp/api/contract/AuthorizationHandler.java b/opensrp-api/src/main/java/org/opensrp/api/contract/AuthorizationHandler.java deleted file mode 100644 index 334dc4f1e3..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/contract/AuthorizationHandler.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.opensrp.api.contract; - -import org.opensrp.api.domain.User; - -public interface AuthorizationHandler { - - boolean verifyAuthorization(User user, T service) throws IllegalAccessException; -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/contract/LocationManager.java b/opensrp-api/src/main/java/org/opensrp/api/contract/LocationManager.java deleted file mode 100644 index fbb6c8876d..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/contract/LocationManager.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.opensrp.api.contract; - -import org.opensrp.api.domain.Location; -import org.opensrp.api.domain.User; -import org.opensrp.api.util.LocationTree; -import org.opensrp.api.util.TreeNode; - -public interface LocationManager { - - Location getLocation(String locationId); - - TreeNode getLocationWithTree(String startinglocationId); - - LocationTree getLocationHierarchy(); - - void verifyLocationAccess(Location location, User user); -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/contract/SecurityManager.java b/opensrp-api/src/main/java/org/opensrp/api/contract/SecurityManager.java deleted file mode 100644 index 54a57e7cf1..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/contract/SecurityManager.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.opensrp.api.contract; - -import org.opensrp.api.domain.User; - -public interface SecurityManager { - - /* - * List getRoles(String username); boolean hasRole(String username); - * List getPermissions(String username); boolean - * hasPermission(String username, String permission); - */ - User login(String username, String password, AuthorizationHandler callbackHandler); - - void logout(AuthorizationHandler callbackHandler); - - User getUser(String username);//??????????????????????? - - User authenticate(String username, String password) throws IllegalAccessException; - - boolean verifyAuthorization(String username, AuthorizationHandler callbackHandler); - - boolean verifyAuthorization(User user, AuthorizationHandler callbackHandler); - - boolean hasAdminRights(String username); - - String encryptPassword(String username, String salt, String cleartextPassword); - - String encryptPassword(User user, String cleartextPassword); - - // do we really want to encrypt data across client-server. If so what would happen incase of reset of password - byte[] encryptData(byte[] data); - - byte[] decryptData(byte[] data); -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/Address.java b/opensrp-api/src/main/java/org/opensrp/api/domain/Address.java deleted file mode 100644 index 08348b1c38..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/domain/Address.java +++ /dev/null @@ -1,350 +0,0 @@ -package org.opensrp.api.domain; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.opensrp.common.AddressField; - -public class Address { - - private String addressType; - - private Date startDate; - - private Date endDate; - - private Map addressFields; - - private String latitude; - - private String longitute; - - private String postalCode; - - private String state; - - private String country; - - public Address() { - } - - public Address(String addressType, Date startDate, Date endDate, Map addressFields, String latitude, - String longitute, String postalCode, String state, String country) { - this.addressType = addressType; - this.startDate = startDate; - this.endDate = endDate; - this.addressFields = addressFields; - this.latitude = latitude; - this.longitute = longitute; - this.postalCode = postalCode; - this.state = state; - this.country = country; - } - - public String getAddressType() { - return addressType; - } - - public void setAddressType(String addressType) { - this.addressType = addressType; - } - - public Date getStartDate() { - return startDate; - } - - public void setStartDate(Date startDate) { - this.startDate = startDate; - } - - public Date getEndDate() { - return endDate; - } - - public void setEndDate(Date endDate) { - this.endDate = endDate; - } - - public Map getAddressFields() { - return addressFields; - } - - public String getAddressField(String addressField) { - for (Entry a : addressFields.entrySet()) { - if (a.getKey().equalsIgnoreCase(addressField)) { - return a.getValue(); - } - } - return null; - } - - /** - * Returns field matching the regex. Note that incase of multiple fields matching criteria - * function would return first match. The must be well formed to find out a single value - * - * @param regex - * @return - */ - public String getAddressFieldMatchingRegex(String regex) { - for (Entry a : addressFields.entrySet()) { - if (a.getKey().matches(regex)) { - return a.getValue(); - } - } - return null; - } - - public String getAddressField(AddressField addressField) { - for (Entry a : addressFields.entrySet()) { - if (a.getKey().equalsIgnoreCase(addressField.name())) { - return a.getValue(); - } - } - return null; - } - - /** - * WARNING: Overrides all existing fields - * - * @param addressFields - * @return - */ - public void setAddressFields(Map addressFields) { - this.addressFields = addressFields; - } - - public void addAddressField(String field, String value) { - if (addressFields == null) { - addressFields = new HashMap<>(); - } - addressFields.put(field, value); - } - - /** - * Add field name from a list of predefined options from enum {@link AddressField} - * - * @param field - * @param value - */ - public void addAddressField(AddressField field, String value) { - if (addressFields == null) { - addressFields = new HashMap<>(); - } - addressFields.put(field.name(), value); - } - - public void removeAddressField(AddressField field) { - for (Entry a : addressFields.entrySet()) { - if (a.getKey().equalsIgnoreCase(field.name())) { - addressFields.remove(a.getKey()); - } - } - } - - public void removeAddressField(String field) { - for (Entry a : addressFields.entrySet()) { - if (a.getKey().equalsIgnoreCase(field)) { - addressFields.remove(a.getKey()); - } - } - } - - public String getLatitude() { - return latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getLongitute() { - return longitute; - } - - public void setLongitute(String longitute) { - this.longitute = longitute; - } - - public String getPostalCode() { - return postalCode; - } - - public void setPostalCode(String postalCode) { - this.postalCode = postalCode; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - /** - * True if endDate is null or endDate is in future - * - * @return - */ - public boolean isActive() { - return endDate == null || endDate.after(new Date()); - } - - /** - * If startDate is not specified returns -1. If endDate is not specified duration is from - * startDate to current date - * - * @return - */ - private long durationInMillis() { - if (startDate == null) { - return -1; - } - if (endDate == null) { - return new Date().getTime() - startDate.getTime(); - } - - return endDate.getTime() - startDate.getTime(); - } - - /** - * If startDate is not specified returns -1. If endDate is not specified duration is from - * startDate to current date - * - * @return - */ - public int durationInDays() { - return (int) (durationInMillis() == -1 ? durationInMillis() : (durationInMillis() / (1000 * 60 * 60 * 24L))); - } - - /** - * If startDate is not specified returns -1. If endDate is not specified duration is from - * startDate to current date - * - * @return - */ - public int durationInWeeks() { - return durationInDays() == -1 ? durationInDays() : (durationInDays() / 7); - } - - /** - * If startDate is not specified returns -1. If endDate is not specified duration is from - * startDate to current date - * - * @return - */ - public int durationInMonths() { - return durationInDays() == -1 ? durationInDays() : ((int) (durationInDays() / 30)); - } - - /** - * If startDate is not specified returns -1. If endDate is not specified duration is from - * startDate to current date - * - * @return - */ - public int durationInYears() { - return durationInDays() == -1 ? durationInDays() : (durationInDays() / 365); - } - - /** - * The type address represents - * - * @param addressType - * @return - */ - public Address withAddressType(String addressType) { - this.addressType = addressType; - return this; - } - - /** - * The date when address was started or owned - * - * @param endDate - * @return - */ - public Address withStartDate(Date startDate) { - this.startDate = startDate; - return this; - } - - /** - * The date when address was outdated or abandoned - * - * @param endDate - * @return - */ - public Address withEndDate(Date endDate) { - this.endDate = endDate; - return this; - } - - /** - * WARNING: Overrides all existing fields - * - * @param addressFields - * @return - */ - public Address withAddressFields(Map addressFields) { - this.addressFields = addressFields; - return this; - } - - public Address withAddressField(String field, String value) { - if (addressFields == null) { - addressFields = new HashMap<>(); - } - addressFields.put(field, value); - return this; - } - - public Address withAddressField(AddressField field, String value) { - if (addressFields == null) { - addressFields = new HashMap<>(); - } - addressFields.put(field.name(), value); - return this; - } - - public Address withLatitude(String latitude) { - this.latitude = latitude; - return this; - } - - public Address withLongitute(String longitute) { - this.longitute = longitute; - return this; - } - - public Address withPostalCode(String postalCode) { - this.postalCode = postalCode; - return this; - } - - public Address withState(String state) { - this.state = state; - return this; - } - - public Address withCountry(String country) { - this.country = country; - return this; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/BaseDataObject.java b/opensrp-api/src/main/java/org/opensrp/api/domain/BaseDataObject.java deleted file mode 100644 index e68c30e12d..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/domain/BaseDataObject.java +++ /dev/null @@ -1,155 +0,0 @@ -package org.opensrp.api.domain; - -import java.util.Date; - -import org.apache.commons.lang3.builder.ToStringBuilder; - -/** - * The Base Object for keeping audit data for any business entity. - */ -public abstract class BaseDataObject { - - private User creator; - - private Date dateCreated; - - private User editor; - - private Date dateEdited; - - private Boolean voided = Boolean.FALSE; - - private Date dateVoided; - - private User voider; - - private String voidReason; - - public BaseDataObject() { - } - - public User getCreator() { - return creator; - } - - public void setCreator(User creator) { - this.creator = creator; - } - - public Date getDateCreated() { - return dateCreated; - } - - public void setDateCreated(Date dateCreated) { - this.dateCreated = dateCreated; - } - - /** - * The last User who edited the data - * - * @return - */ - public User getEditor() { - return editor; - } - - /** - * The last User who edited the data - */ - public void setEditor(User editor) { - this.editor = editor; - } - - /** - * The last edited date of the data - * - * @return - */ - public Date getDateEdited() { - return dateEdited; - } - - /** - * The last edited date of the data - */ - public void setDateEdited(Date dateEdited) { - this.dateEdited = dateEdited; - } - - public Boolean getVoided() { - return voided; - } - - public void setVoided(Boolean voided) { - this.voided = voided; - } - - public Date getDateVoided() { - return dateVoided; - } - - public void setDateVoided(Date dateVoided) { - this.dateVoided = dateVoided; - } - - public User getVoider() { - return voider; - } - - public void setVoider(User voider) { - this.voider = voider; - } - - public String getVoidReason() { - return voidReason; - } - - public void setVoidReason(String voidReason) { - this.voidReason = voidReason; - } - - public BaseDataObject withCreator(User creator) { - this.creator = creator; - return this; - } - - public BaseDataObject withDateCreated(Date dateCreated) { - this.dateCreated = dateCreated; - return this; - } - - public BaseDataObject withEditor(User editor) { - this.editor = editor; - return this; - } - - public BaseDataObject withDateEdited(Date dateEdited) { - this.dateEdited = dateEdited; - return this; - } - - public BaseDataObject withVoided(Boolean voided) { - this.voided = voided; - return this; - } - - public BaseDataObject withDateVoided(Date dateVoided) { - this.dateVoided = dateVoided; - return this; - } - - public BaseDataObject withVoider(User voider) { - this.voider = voider; - return this; - } - - public BaseDataObject withVoidReason(String voidReason) { - this.voidReason = voidReason; - return this; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/BaseEntity.java b/opensrp-api/src/main/java/org/opensrp/api/domain/BaseEntity.java deleted file mode 100644 index e334e13e23..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/domain/BaseEntity.java +++ /dev/null @@ -1,237 +0,0 @@ -package org.opensrp.api.domain; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.commons.lang3.builder.ToStringBuilder; - -/** - * The BaseEntity is the parent entity that contains basic information for all other business - * entities. The class generalizes the identifiers, addresses, and attributes for other entities. - * The class is the generic representation of all other business entities those have different - * business roles in system. For example: A user in system can also be data provider. The - * {@link User} would have basic data into {@link BaseEntity} and specific information in - * {@link User}. The {@link BaseEntity} would also be referred by {@link Provider} to represent and - * link roles. This helps in getting reports for any dimension for any entity into the system. - */ -public class BaseEntity extends BaseDataObject { - - private String baseEntityId; - - private Map identifiers; - - private List
addresses; - - private Map attributes; - - protected BaseEntity() { - } - - public BaseEntity(String baseEntityId) { - this.baseEntityId = baseEntityId; - } - - public BaseEntity(String baseEntityId, Map identifiers) { - this.baseEntityId = baseEntityId; - this.identifiers = identifiers; - } - - public BaseEntity(String baseEntityId, Map identifiers, Map attributes) { - this.baseEntityId = baseEntityId; - this.identifiers = identifiers; - this.attributes = attributes; - } - - public BaseEntity(String baseEntityId, Map identifiers, Map attributes, - List
addresses) { - this.baseEntityId = baseEntityId; - this.identifiers = identifiers; - this.attributes = attributes; - this.addresses = addresses; - } - - public String getBaseEntityId() { - return baseEntityId; - } - - public void setBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - } - - public List
getAddresses() { - return addresses; - } - - /** - * WARNING: Overrides all existing addresses - * - * @param addresses - * @return - */ - public void setAddresses(List
addresses) { - this.addresses = addresses; - } - - public void addAddress(Address address) { - if (addresses == null) { - addresses = new ArrayList<>(); - } - addresses.add(address); - } - - public Map getAttributes() { - return attributes; - } - - public Object getAttribute(String name) { - if (attributes == null) { - return null; - } - for (String k : attributes.keySet()) { - if (k.equalsIgnoreCase(name)) { - return attributes.get(k); - } - } - return null; - } - - /** - * WARNING: Overrides all existing attributes - * - * @param attributes - * @return - */ - public void setAttributes(Map attributes) { - this.attributes = attributes; - } - - public void addAttribute(String name, Object value) { - if (attributes == null) { - attributes = new HashMap<>(); - } - - attributes.put(name, value); - } - - public void removeAttribute(String name) { - attributes.remove(name); - } - - public Map getIdentifiers() { - return identifiers; - } - - public String getIdentifier(String identifierType) { - if (identifiers == null) { - return null; - } - for (String k : identifiers.keySet()) { - if (k.equalsIgnoreCase(identifierType)) { - return identifiers.get(k); - } - } - return null; - } - - /** - * Returns field matching the regex. Note that incase of multiple fields matching criteria - * function would return first match. The must be well formed to find out a single value - * - * @param regex - * @return - */ - public String getIdentifierMatchingRegex(String regex) { - for (Entry a : getIdentifiers().entrySet()) { - if (a.getKey().matches(regex)) { - return a.getValue(); - } - } - return null; - } - - public void setIdentifiers(Map identifiers) { - this.identifiers = identifiers; - } - - public void addIdentifier(String identifierType, String identifier) { - if (identifiers == null) { - identifiers = new HashMap<>(); - } - - identifiers.put(identifierType, identifier); - } - - public void removeIdentifier(String identifierType) { - identifiers.remove(identifierType); - } - - public BaseEntity withBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - return this; - } - - /** - * WARNING: Overrides all existing identifiers - * - * @param identifiers - * @return - */ - public BaseEntity withIdentifiers(Map identifiers) { - this.identifiers = identifiers; - return this; - } - - public BaseEntity withIdentifier(String identifierType, String identifier) { - if (identifiers == null) { - identifiers = new HashMap<>(); - } - identifiers.put(identifierType, identifier); - return this; - } - - /** - * WARNING: Overrides all existing addresses - * - * @param addresses - * @return - */ - public BaseEntity withAddresses(List
addresses) { - this.addresses = addresses; - return this; - } - - public BaseEntity withAddress(Address address) { - if (addresses == null) { - addresses = new ArrayList<>(); - } - addresses.add(address); - return this; - } - - /** - * WARNING: Overrides all existing attributes - * - * @param attributes - * @return - */ - public BaseEntity withAttributes(Map attributes) { - this.attributes = attributes; - return this; - } - - public BaseEntity withAttribute(String name, Object value) { - if (attributes == null) { - attributes = new HashMap<>(); - } - attributes.put(name, value); - return this; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/Client.java b/opensrp-api/src/main/java/org/opensrp/api/domain/Client.java deleted file mode 100644 index a6922e73fc..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/domain/Client.java +++ /dev/null @@ -1,196 +0,0 @@ -package org.opensrp.api.domain; - -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.opensrp.common.Gender; - -/** - * Client is the main beneficiary, the system facilitates to capture data for. The entity inherits - * all of the generic data from {@link BaseEntity}. - */ -public class Client extends BaseEntity { - - private String firstName; - - private String middleName; - - private String lastName; - - private Date birthdate; - - private Date deathdate; - - private Boolean birthdateApprox; - - private Boolean deathdateApprox; - - private String gender; - - protected Client() { - - } - - public Client(String baseEntityId) { - super(baseEntityId); - } - - public Client(String baseEntityId, String firstName, String middleName, String lastName, Date birthdate, Date deathdate, - Boolean birthdateApprox, Boolean deathdateApprox, String gender) { - super(baseEntityId); - this.firstName = firstName; - this.middleName = middleName; - this.lastName = lastName; - this.birthdate = birthdate; - this.deathdate = deathdate; - this.birthdateApprox = birthdateApprox; - this.deathdateApprox = deathdateApprox; - this.gender = gender; - } - - public Client(String baseEntityId, String firstName, String middleName, String lastName, Date birthdate, Date deathdate, - Boolean birthdateApprox, Boolean deathdateApprox, String gender, String identifierType, String identifier) { - super(baseEntityId); - this.firstName = firstName; - this.middleName = middleName; - this.lastName = lastName; - this.birthdate = birthdate; - this.deathdate = deathdate; - this.birthdateApprox = birthdateApprox; - this.deathdateApprox = deathdateApprox; - this.gender = gender; - addIdentifier(identifierType, identifier); - } - - public Client(String baseEntityId, String firstName, String middleName, String lastName, Date birthdate, Date deathdate, - Boolean birthdateApprox, Boolean deathdateApprox, String gender, List
addresses, - Map identifiers, Map attributes) { - super(baseEntityId); - this.firstName = firstName; - this.middleName = middleName; - this.lastName = lastName; - this.birthdate = birthdate; - this.deathdate = deathdate; - this.birthdateApprox = birthdateApprox; - this.deathdateApprox = deathdateApprox; - this.gender = gender; - setIdentifiers(identifiers); - setAddresses(addresses); - setAttributes(attributes); - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getMiddleName() { - return middleName; - } - - public void setMiddleName(String middleName) { - this.middleName = middleName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public Date getBirthdate() { - return birthdate; - } - - public void setBirthdate(Date birthdate) { - this.birthdate = birthdate; - } - - public Date getDeathdate() { - return deathdate; - } - - public void setDeathdate(Date deathdate) { - this.deathdate = deathdate; - } - - public Boolean getBirthdateApprox() { - return birthdateApprox; - } - - public void setBirthdateApprox(Boolean birthdateApprox) { - this.birthdateApprox = birthdateApprox; - } - - public Boolean getDeathdateApprox() { - return deathdateApprox; - } - - public void setDeathdateApprox(Boolean deathdateApprox) { - this.deathdateApprox = deathdateApprox; - } - - public String getGender() { - return gender; - } - - public void setGender(String gender) { - this.gender = gender; - } - - public Client withFirstName(String firstName) { - this.firstName = firstName; - return this; - } - - public Client withMiddleName(String middleName) { - this.middleName = middleName; - return this; - } - - public Client withLastName(String lastName) { - this.lastName = lastName; - return this; - } - - public Client withName(String firstName, String middleName, String lastName) { - this.firstName = firstName; - this.middleName = middleName; - this.lastName = lastName; - return this; - } - - public Client withBirthdate(Date birthdate, Boolean isApproximate) { - this.birthdate = birthdate; - this.birthdateApprox = isApproximate; - return this; - } - - public Client withDeathdate(Date deathdate, Boolean isApproximate) { - this.deathdate = deathdate; - this.deathdateApprox = isApproximate; - return this; - } - - public Client withGender(String gender) { - this.gender = gender; - return this; - } - - public Client withGender(Gender gender) { - this.gender = gender.name(); - return this; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/Event.java b/opensrp-api/src/main/java/org/opensrp/api/domain/Event.java deleted file mode 100644 index a1016d6112..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/domain/Event.java +++ /dev/null @@ -1,307 +0,0 @@ -package org.opensrp.api.domain; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.joda.time.DateTime; - -/** - * An {@link Event} is a logical happening or experience of {@link BaseEntity} with the system as - * defined by the program workflow. The difference of an {@link Event} and other activities in - * system is that the data of {@link Event} is meaningful for business clients of system and also - * the data links back with international standard dictionaries. An {@link Event} in system is - * recorded via a form filled by data {@link Provider}. The form data is represented by - * {@link FormSubmission} - */ -public class Event extends BaseDataObject { - - private Map identifiers; - - private String baseEntityId; - - private String locationId; - - private DateTime eventDate; - - private String eventType; - - private String formSubmissionId; - - private String providerId; - - private String status; - - private Map statusHistory; - - private String priority; - - private List episodeOfCare; - - private List referrals; - - private String category; - - private int duration; - - private String reason; - - private List obs; - - private String entityType; - - private Map details; - - private long version; - - private List photos; - - public Event() { - this.version = System.currentTimeMillis(); - } - - public Event(String baseEntityId, String eventType, DateTime eventDate, String entityType, String providerId, - String locationId, String formSubmissionId) { - this.baseEntityId = baseEntityId; - this.eventType = eventType; - this.eventDate = eventDate; - this.entityType = entityType; - this.providerId = providerId; - this.locationId = locationId; - this.formSubmissionId = formSubmissionId; - this.version = System.currentTimeMillis(); - } - - public List getObs() { - return obs; - } - - /** - * WARNING: Overrides all existing obs - * - * @param obs - * @return - */ - public void setObs(List obs) { - this.obs = obs; - } - - public void addObs(Obs observation) { - if (obs == null) { - obs = new ArrayList<>(); - } - - obs.add(observation); - } - - public String getBaseEntityId() { - return baseEntityId; - } - - public void setBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - } - - public Map getIdentifiers() { - if (identifiers == null) { - identifiers = new HashMap<>(); - } - return identifiers; - } - - public String getIdentifier(String identifierType) { - if (identifiers == null) { - return null; - } - for (String k : identifiers.keySet()) { - if (k.equalsIgnoreCase(identifierType)) { - return identifiers.get(k); - } - } - return null; - } - - /** - * Returns field matching the regex. Note that incase of multiple fields matching criteria - * function would return first match. The must be well formed to find out a single value - * - * @param regex - * @return - */ - public String getIdentifierMatchingRegex(String regex) { - for (Entry a : getIdentifiers().entrySet()) { - if (a.getKey().matches(regex)) { - return a.getValue(); - } - } - return null; - } - - public void setIdentifiers(Map identifiers) { - this.identifiers = identifiers; - } - - public void addIdentifier(String identifierType, String identifier) { - if (identifiers == null) { - identifiers = new HashMap<>(); - } - - identifiers.put(identifierType, identifier); - } - - public void removeIdentifier(String identifierType) { - identifiers.remove(identifierType); - } - - public String getLocationId() { - return locationId; - } - - public void setLocationId(String locationId) { - this.locationId = locationId; - } - - public DateTime getEventDate() { - return eventDate; - } - - public void setEventDate(DateTime eventDate) { - this.eventDate = eventDate; - } - - public String getEventType() { - return eventType; - } - - public void setEventType(String eventType) { - this.eventType = eventType; - } - - public String getFormSubmissionId() { - return formSubmissionId; - } - - public void setFormSubmissionId(String formSubmissionId) { - this.formSubmissionId = formSubmissionId; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public String getEntityType() { - return entityType; - } - - public void setEntityType(String entityType) { - this.entityType = entityType; - } - - public Map getDetails() { - return details; - } - - public void setDetails(Map details) { - this.details = details; - } - - public void addDetails(String key, String val) { - if (details == null) { - details = new HashMap<>(); - } - details.put(key, val); - } - - public long getVersion() { - return version; - } - - public void setVersion(long version) { - this.version = version; - } - - public Event withBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - return this; - } - - /** - * WARNING: Overrides all existing identifiers - * - * @param identifiers - * @return - */ - public Event withIdentifiers(Map identifiers) { - this.identifiers = identifiers; - return this; - } - - public Event withIdentifier(String identifierType, String identifier) { - if (identifiers == null) { - identifiers = new HashMap<>(); - } - identifiers.put(identifierType, identifier); - return this; - } - - public Event withLocationId(String locationId) { - this.locationId = locationId; - return this; - } - - public Event withEventDate(DateTime eventDate) { - this.eventDate = eventDate; - return this; - } - - public Event withEventType(String eventType) { - this.eventType = eventType; - return this; - } - - public Event withFormSubmissionId(String formSubmissionId) { - this.formSubmissionId = formSubmissionId; - return this; - } - - public Event withProviderId(String providerId) { - this.providerId = providerId; - return this; - } - - public Event withEntityType(String entityType) { - this.entityType = entityType; - return this; - } - - /** - * WARNING: Overrides all existing obs - * - * @param obs - * @return - */ - public Event withObs(List obs) { - this.obs = obs; - return this; - } - - public Event withObs(Obs observation) { - if (obs == null) { - obs = new ArrayList<>(); - } - obs.add(observation); - return this; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/Location.java b/opensrp-api/src/main/java/org/opensrp/api/domain/Location.java deleted file mode 100644 index 8c49d3a750..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/domain/Location.java +++ /dev/null @@ -1,259 +0,0 @@ -package org.opensrp.api.domain; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.lang3.builder.ToStringBuilder; - -/** - * The registered location which needs to be identified uniquely across the system - */ -public class Location extends BaseDataObject { - - private String locationId; - - private String name; - - private Address address; - - private Map identifiers; - - private Location parentLocation; - - private Set tags; - - private Map attributes; - - public Location() { - } - - public Location(String locationId, String name, Address address, Location parentLocation) { - this.locationId = locationId; - this.name = name; - this.address = address; - this.parentLocation = parentLocation; - } - - public Location(String locationId, String name, Address address, Map identifiers, - Location parentLocation, Set tags, Map attributes) { - this.locationId = locationId; - this.name = name; - this.address = address; - this.identifiers = identifiers; - this.parentLocation = parentLocation; - this.tags = tags; - this.attributes = attributes; - } - - public String getLocationId() { - return locationId; - } - - public void setLocationId(String locationId) { - this.locationId = locationId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Address getAddress() { - return address; - } - - public void setAddress(Address address) { - this.address = address; - } - - public Map getIdentifiers() { - return identifiers; - } - - public String getIdentifier(String identifierType) { - return identifiers.get(identifierType); - } - - /** - * WARNING: Overrides all existing identifiers - * - * @param identifiers - * @return - */ - public void setIdentifiers(Map identifiers) { - this.identifiers = identifiers; - } - - public void addIdentifier(String identifierType, String identifier) { - if (identifiers == null) { - identifiers = new HashMap<>(); - } - - identifiers.put(identifierType, identifier); - } - - public void removeIdentifier(String identifierType) { - identifiers.remove(identifierType); - } - - public Location getParentLocation() { - return parentLocation; - } - - public void setParentLocation(Location parentLocation) { - this.parentLocation = parentLocation; - } - - public Set getTags() { - return tags; - } - - public boolean hasTag(String tag) { - return tags.contains(tag); - } - - /** - * WARNING: Overrides all existing tags - * - * @param tags - * @return - */ - public void setTags(Set tags) { - this.tags = tags; - } - - public void addTag(String tag) { - if (tags == null) { - tags = new HashSet<>(); - } - - tags.add(tag); - } - - public boolean removeTag(String tag) { - return tags.remove(tag); - } - - public Map getAttributes() { - return attributes; - } - - public Object getAttribute(String name) { - return attributes.get(name); - } - - /** - * WARNING: Overrides all existing attributes - * - * @param attributes - * @return - */ - public void setAttributes(Map attributes) { - this.attributes = attributes; - } - - public void addAttribute(String name, Object value) { - if (attributes == null) { - attributes = new HashMap<>(); - } - - attributes.put(name, value); - } - - public void removeAttribute(String name) { - attributes.remove(name); - } - - public Location withLocationId(String locationId) { - this.locationId = locationId; - return this; - } - - public Location withName(String name) { - this.name = name; - return this; - } - - public Location withAddress(Address address) { - this.address = address; - return this; - } - - /** - * WARNING: Overrides all existing identifiers - * - * @param identifiers - * @return - * @return - */ - public Location withIdentifiers(Map identifiers) { - this.identifiers = identifiers; - return this; - } - - public Location withIdentifier(String identifierType, String identifier) { - if (identifiers == null) { - identifiers = new HashMap<>(); - } - - identifiers.put(identifierType, identifier); - return this; - } - - public Location withParentLocation(Location parentLocation) { - this.parentLocation = parentLocation; - return this; - } - - /** - * WARNING: Overrides all existing tags - * - * @param tags - * @return - * @return - */ - public Location withTags(Set tags) { - this.tags = tags; - return this; - } - - public Location withTag(String tag) { - if (tags == null) { - tags = new HashSet<>(); - } - - tags.add(tag); - return this; - } - - /** - * WARNING: Overrides all existing attributes - * - * @param attributes - * @return - * @return - */ - public Location withAttributes(Map attributes) { - this.attributes = attributes; - return this; - } - - public Location withAttribute(String name, Object value) { - if (attributes == null) { - attributes = new HashMap<>(); - } - - attributes.put(name, value); - return this; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/Obs.java b/opensrp-api/src/main/java/org/opensrp/api/domain/Obs.java deleted file mode 100644 index d797b4aadd..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/domain/Obs.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.opensrp.api.domain; - -import java.util.ArrayList; -import java.util.List; - -/** - * The observations applicable or noted for any {@link Event} by data entry person. Each obs links - * back to variable in {@link FormSubmission} represent by name in {@link FormField}. Each - * {@link Obs} instead of recording value with the text of label of question, maps each question - * with a code that links with a standard international dictionary. This helps in getting - * standardized reports and integration with different systems - */ -public class Obs { - - private String fieldType; - - private String fieldDataType; - - private String fieldCode; - - private String parentCode; - - private List values; - - private String comments; - - private String formSubmissionField; - - public Obs() { - } - - public Obs(String fieldType, String fieldDataType, String fieldCode, String parentCode, List values, - String comments, String formSubmissionField) { - this.setFieldType(fieldType); - this.fieldDataType = fieldDataType; - this.fieldCode = fieldCode; - this.parentCode = parentCode; - this.values = values; - this.comments = comments; - this.formSubmissionField = formSubmissionField; - } - - public String getFieldType() { - return fieldType; - } - - public void setFieldType(String fieldType) { - this.fieldType = fieldType; - } - - public String getFieldDataType() { - return fieldDataType; - } - - public void setFieldDataType(String fieldDataType) { - this.fieldDataType = fieldDataType; - } - - public String getFieldCode() { - return fieldCode; - } - - public void setFieldCode(String fieldCode) { - this.fieldCode = fieldCode; - } - - public String getParentCode() { - return parentCode; - } - - public void setParentCode(String parentCode) { - this.parentCode = parentCode; - } - - public Object getValue() { - if (values.size() > 1) { - throw new RuntimeException( - "Multiset values can not be handled like single valued fields. Use function getValues"); - } - if (values == null || values.size() == 0) { - return null; - } - - return values.get(0); - } - - public void setValue(Object value) { - addToValueList(value); - } - - public List getValues() { - return values; - } - - public void setValues(List values) { - this.values = values; - } - - public String getComments() { - return comments; - } - - public void setComments(String comments) { - this.comments = comments; - } - - public String getFormSubmissionField() { - return formSubmissionField; - } - - public void setFormSubmissionField(String formSubmissionField) { - this.formSubmissionField = formSubmissionField; - } - - public Obs withFieldType(String fieldType) { - this.fieldType = fieldType; - return this; - } - - public Obs withFieldDataType(String fieldDataType) { - this.fieldDataType = fieldDataType; - return this; - } - - public Obs withFieldCode(String fieldCode) { - this.fieldCode = fieldCode; - return this; - } - - public Obs withParentCode(String parentCode) { - this.parentCode = parentCode; - return this; - } - - public Obs withValue(Object value) { - return addToValueList(value); - } - - public Obs withValues(List values) { - this.values = values; - return this; - } - - public Obs addToValueList(Object value) { - if (values == null) { - values = new ArrayList<>(); - } - values.add(value); - return this; - } - - public Obs withComments(String comments) { - this.comments = comments; - return this; - } - - public Obs withFormSubmissionField(String formSubmissionField) { - this.formSubmissionField = formSubmissionField; - return this; - } -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/Photo.java b/opensrp-api/src/main/java/org/opensrp/api/domain/Photo.java deleted file mode 100644 index 86de0c3f60..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/domain/Photo.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.opensrp.api.domain; - -import org.joda.time.DateTime; - -public class Photo { - - private String contentType; - - private String language; - - private String uri; - - private int size; - - private String title; - - private String category; - - private DateTime dateCreated; - - public Photo() { - - } - - public String getContentType() { - return contentType; - } - - public void setContentType(String contentType) { - this.contentType = contentType; - } - - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public int getSize() { - return size; - } - - public void setSize(int size) { - this.size = size; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public DateTime getDateCreated() { - return dateCreated; - } - - public void setDateCreated(DateTime dateCreated) { - this.dateCreated = dateCreated; - } - -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/Provider.java b/opensrp-api/src/main/java/org/opensrp/api/domain/Provider.java deleted file mode 100644 index 9d6ebacf10..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/domain/Provider.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.opensrp.api.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; - -/** - * The person who provided data for {@link Event} - */ -public class Provider extends BaseEntity { - - private String fullName; - - protected Provider() { - - } - - public Provider(String baseEntityId) { - super(baseEntityId); - } - - public Provider(String baseEntityId, String fullName) { - super(baseEntityId); - this.setFullName(fullName); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - public String getFullName() { - return fullName; - } - - public void setFullName(String fullName) { - this.fullName = fullName; - } - -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/Time.java b/opensrp-api/src/main/java/org/opensrp/api/domain/Time.java deleted file mode 100644 index 2b5544c59e..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/domain/Time.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.opensrp.api.domain; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; - -/** - * Created by Jason Rogena (jrogena@ona.io) on 19/05/2017. - */ -public class Time { - - private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - private String time; - - private String timeZone; - - public Time(Date time, TimeZone timeZone) { - setTime(time); - setTimeZone(timeZone); - } - - public String getTime() { - return time; - } - - public void setTime(Date time) { - if (time != null) - this.time = DATE_FORMAT.format(time); - } - - public String getTimeZone() { - return timeZone; - } - - public void setTimeZone(TimeZone timeZone) { - if (timeZone != null) - this.timeZone = timeZone.getID(); - } -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/User.java b/opensrp-api/src/main/java/org/opensrp/api/domain/User.java deleted file mode 100644 index f96bcb5f09..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/domain/User.java +++ /dev/null @@ -1,257 +0,0 @@ -package org.opensrp.api.domain; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.builder.ToStringBuilder; - -/** - * The person who actually entered or modified data into system. The {@link User} before getting - * access to any service in system have to be authenticated by system. A user may also be linked - * with a {@link Provider} by {@link BaseEntity} - */ -public class User extends BaseEntity { - - private String username; - - private String password; - - private String salt; - - private String status; - - private List roles; - - private List permissions; - - private String preferredName; - - protected User() { - - } - - public User(String baseEntityId) { - super(baseEntityId); - } - - public User(String baseEntityId, String username, String password, String salt) { - super(baseEntityId); - this.username = username; - this.password = password; - this.salt = salt; - } - - public User(String baseEntityId, String username, String password, String salt, String status, List roles, - List permissions) { - super(baseEntityId); - this.username = username; - this.password = password; - this.salt = salt; - this.status = status; - this.roles = roles; - this.permissions = permissions; - } - - public User(String baseEntityId, String username, String password, String preferredName, String salt, String status, - List roles, List permissions) { - super(baseEntityId); - this.username = username; - this.password = password; - this.salt = salt; - this.status = status; - this.roles = roles; - this.permissions = permissions; - this.preferredName = preferredName; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getSalt() { - return salt; - } - - public void setSalt(String salt) { - this.salt = salt; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public List getRoles() { - return roles; - } - - /** - * WARNING: Overrides all existing roles - * - * @param roles - * @return - */ - public void setRoles(List roles) { - this.roles = roles; - } - - public void addRole(String role) { - if (roles == null) { - roles = new ArrayList<>(); - } - roles.add(role); - } - - public boolean removeRole(String role) { - return roles.remove(role); - } - - public boolean hasRole(String role) { - if (roles != null) - for (String r : roles) { - if (role.equalsIgnoreCase(r)) { - return true; - } - } - return false; - } - - public boolean isDefaultAdmin() { - if ((username.equalsIgnoreCase("admin") || username.equalsIgnoreCase("administrator")) - && (hasRole("admin") || hasRole("administrator"))) { - return true; - } - return false; - } - - public boolean hasAdminRights() { - if (isDefaultAdmin() || hasRole("admin") || hasRole("administrator")) { - return true; - } - return false; - } - - public List getPermissions() { - return permissions; - } - - /** - * WARNING: Overrides all existing permissions - * - * @param permissions - * @return - */ - public void setPermissions(List permissions) { - this.permissions = permissions; - } - - public void addPermission(String permission) { - if (permissions == null) { - permissions = new ArrayList<>(); - } - permissions.add(permission); - } - - public boolean removePermission(String permission) { - return permissions.remove(permission); - } - - public boolean hasPermission(String permission) { - if (permissions != null) - for (String p : permissions) { - if (permission.equalsIgnoreCase(p)) { - return true; - } - } - return false; - } - - public User withUsername(String username) { - this.username = username; - return this; - } - - public User withPassword(String password) { - this.password = password; - return this; - } - - public User withSalt(String salt) { - this.salt = salt; - return this; - } - - public User withStatus(String status) { - this.status = status; - return this; - } - - /** - * WARNING: Overrides all existing roles - * - * @param roles - * @return - * @return - */ - public User withRoles(List roles) { - this.roles = roles; - return this; - } - - public User withRole(String role) { - if (roles == null) { - roles = new ArrayList<>(); - } - roles.add(role); - return this; - } - - /** - * WARNING: Overrides all existing permissions - * - * @param permissions - * @return - * @return - */ - public User withPermissions(List permissions) { - this.permissions = permissions; - return this; - } - - public User withPermission(String permission) { - if (permissions == null) { - permissions = new ArrayList<>(); - } - permissions.add(permission); - return this; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - public String getPreferredName() { - return preferredName; - } - - public void setPreferredName(String preferredName) { - this.preferredName = preferredName; - } - -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/domain/domain-cd.ucls b/opensrp-api/src/main/java/org/opensrp/api/domain/domain-cd.ucls deleted file mode 100644 index 83585e92ca..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/domain/domain-cd.ucls +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-api/src/main/java/org/opensrp/api/util/EntityUtils.java b/opensrp-api/src/main/java/org/opensrp/api/util/EntityUtils.java deleted file mode 100644 index 90d0e8e56c..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/util/EntityUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.opensrp.api.util; - -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; - -import com.google.gson.Gson; - -public class EntityUtils { - - public static T fromJson(String json, Class clazz) { - return new Gson().fromJson(json, clazz); - } - - public static T fromJson(InputStream json, Class clazz) { - return new Gson().fromJson(new InputStreamReader(json), clazz); - } - - public static T fromJson(Reader json, Class clazz) { - return new Gson().fromJson(json, clazz); - } -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/util/LocationTree.java b/opensrp-api/src/main/java/org/opensrp/api/util/LocationTree.java deleted file mode 100644 index 1b84273e1d..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/util/LocationTree.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.opensrp.api.util; - -import java.util.List; -import java.util.Map; - -import org.opensrp.api.domain.Location; - -/** - * {@link LocationTree} is an specification of {@link Tree} which provides helper methods for - * creating a Tree for {@link Location}. The key is the locationId and label is name of - * {@link Location} and the data for tree node is location object itself. Each node has locationId - * if its parent location and has a {@link TreeNode} map of children of the location. This way it - * allows to create a complete tree of location starting from root nodes to the end or lowest level - * in the form of tree. A root node is one with parent location null. - */ -public class LocationTree { - - Tree locationsHierarchy; - - public LocationTree() { - this.locationsHierarchy = new Tree(); - } - - public void addLocation(Location l) { - if (!locationsHierarchy.hasNode(l.getLocationId())) { - if (l.getParentLocation() == null) { - locationsHierarchy.addNode(l.getLocationId(), l.getName(), l, null); - } else { - locationsHierarchy.addNode(l.getLocationId(), l.getName(), l, l.getParentLocation().getLocationId()); - } - } - } - - /** - * WARNING: Overrides existing locations - * - * @param locations - */ - public void buildTreeFromList(List locations) { - for (Location location : locations) { - addLocation(location); - } - } - - public Location findLocation(String locationId) { - return locationsHierarchy.getNode(locationId).getNode(); - } - - public boolean hasLocation(String locationId) { - return locationsHierarchy.hasNode(locationId); - } - - public boolean hasChildLocation(String locationId, String childLocationId) { - return locationsHierarchy.getNode(locationId).findChild(childLocationId) != null; - } - - public Map> getLocationsHierarchy() { - return locationsHierarchy.getTree(); - } -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/util/Tree.java b/opensrp-api/src/main/java/org/opensrp/api/util/Tree.java deleted file mode 100644 index 32af773ded..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/util/Tree.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.opensrp.api.util; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -public class Tree { - - Map> map; - - Map> parentChildren; - - public Map> getTree() { - return Collections.unmodifiableMap(map); - } - - public Map> getChildParent() { - return Collections.unmodifiableMap(parentChildren); - } - - public Tree() { - map = new HashMap>(); - parentChildren = new HashMap<>(); - } - - private void addToParentChildRelation(K parent, K id) { - if (parentChildren == null) { - parentChildren = new HashMap<>(); - } - - Set kids = parentChildren.get(parent); - if (kids == null) { - kids = new HashSet<>(); - } - - kids.add(id); - parentChildren.put(parent, kids); - } - - public void addNode(K id, String label, T node, K parentId) { - if (map == null) { - map = new HashMap>(); - } - - // if node exists we should break since user should write optimized code and also tree can not have duplicates - if (hasNode(id)) { - throw new IllegalArgumentException("Node with ID " + id + " already exists in tree"); - } - - TreeNode n = makeNode(id, label, node, parentId); - - if (parentId != null) { - addToParentChildRelation(parentId, id); - - TreeNode p = getNode(parentId); - - //if parent exists add to it otherwise add as root for now - if (p != null) { - p.addChild(n); - } else { - // if no parent exists add it as root node - map.put(id, n); - } - } else { - // if no parent add it as root node - map.put(id, n); - } - - Set kids = parentChildren.get(id); - // move all its child nodes preexisting - if (kids != null) { - for (K kid : kids) { - //remove node from it current position and move to parent i.e. node currently being added - TreeNode kn = removeNode(kid); - n.addChild(kn); - } - } - } - - private TreeNode makeNode(K id, String label, T node, K parentId) { - TreeNode n = getNode(id); - if (n == null) { - n = new TreeNode(id, label, node, parentId); - } - return n; - } - - public TreeNode getNode(K id) { - // Check if id is any root node - if (map.containsKey(id)) { - return map.get(id); - } - - // neither root itself nor parent of root - for (TreeNode root : map.values()) { - TreeNode n = root.findChild(id); - if (n != null) - return n; - } - return null; - } - - TreeNode removeNode(K id) { - // Check if id is any root node - if (map.containsKey(id)) { - return map.remove(id); - } - // neither root itself nor parent of root - for (TreeNode root : map.values()) { - TreeNode n = root.removeChild(id); - if (n != null) { - return n; - } - } - return null; - } - - public boolean hasNode(K id) { - return getNode(id) != null; - } -} diff --git a/opensrp-api/src/main/java/org/opensrp/api/util/TreeNode.java b/opensrp-api/src/main/java/org/opensrp/api/util/TreeNode.java deleted file mode 100644 index 891f7131eb..0000000000 --- a/opensrp-api/src/main/java/org/opensrp/api/util/TreeNode.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.opensrp.api.util; - -import java.util.HashMap; -import java.util.Map; - -public class TreeNode { - - private K id; - - private String label; - - private T node; - - private Map> children; - - private K parent; - - public TreeNode(K id, String label, T node, K parent) { - this.id = id; - this.label = label; - this.node = node; - this.parent = parent; - } - - public TreeNode(K id, String label, T node, K parent, Map> children) { - this.id = id; - this.label = label; - this.node = node; - this.parent = parent; - this.children = children; - } - - public void addChild(TreeNode node) { - if (children == null) { - children = new HashMap<>(); - } - children.put(node.getId(), node); - } - - public TreeNode findChild(K id) { - if (children != null) { - for (TreeNode child : children.values()) { - if (child.getId().equals(id)) { - return child; - } else if (child.getChildren() != null) { - TreeNode node = child.findChild(id); - if (node != null) - return node; - } - } - } - return null; - } - - public TreeNode removeChild(K id) { - if (children != null) { - for (TreeNode child : children.values()) { - if (child.getId().equals(id)) { - return children.remove(id); - } else if (child.getChildren() != null) { - TreeNode node = child.removeChild(id); - if (node != null) - return node; - } - } - } - return null; - } - - public K getId() { - return id; - } - - public String getLabel() { - return label; - } - - public T getNode() { - return node; - } - - public K getParent() { - return parent; - } - - public Map> getChildren() { - return children; - } - - void setLabel(String label) { - this.label = label; - } - - void setNode(T node) { - this.node = node; - } - - void setParent(K parent) { - this.parent = parent; - } -} diff --git a/opensrp-api/src/test/java/org/opensrp/api/domain/AddressTest.java b/opensrp-api/src/test/java/org/opensrp/api/domain/AddressTest.java deleted file mode 100755 index 91bc4ea312..0000000000 --- a/opensrp-api/src/test/java/org/opensrp/api/domain/AddressTest.java +++ /dev/null @@ -1,245 +0,0 @@ -package org.opensrp.api.domain; - -import org.joda.time.DateTime; -import org.junit.Test; -import org.opensrp.api.domain.Address; -import org.opensrp.common.AddressField; - -import com.openpojo.reflection.PojoClass; -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.rule.impl.GetterMustExistRule; -import com.openpojo.validation.rule.impl.SetterMustExistRule; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import junit.framework.Assert; - -import static org.junit.Assert.*; - -public class AddressTest { - - public static final String NO_MATCH_ADDRESS_FIELD_MESSAGE = "No match. Should return NULL value."; - - @Test - public void testAddressActivity() { - Address address = new Address(); - - assertTrue("Address should be ACTIVE when no endDate provided", address.isActive()); - - DateTime currentDate = new DateTime(); - DateTime currentDatePlusOneDay = currentDate.plusDays(1); - address.setEndDate(currentDatePlusOneDay.toDate()); - - assertTrue("Address should be ACTIVE when endDate is greater than currentDate", address.isActive()); - - - address.setEndDate(new Date()); - assertFalse("Address should be IN-ACTIVE when endDate less than current date", address.isActive()); - - } - - @Test - public void testInvalidDurationForNoStartDateTime() { - Address address = new Address(); - assertTrue("Duration of Address should be -1 for no startDate", address.durationInDays()==-1); - assertTrue("Duration of Address should be -1 for no startDate", address.durationInWeeks()==-1); - assertTrue("Duration of Address should be -1 for no startDate", address.durationInMonths()==-1); - assertTrue("Duration of Address should be -1 for no startDate", address.durationInYears()==-1); - - } - - @Test - public void testDurationIfNoEndDatePresent() { - Address address = new Address(); - address.setStartDate(new Date()); - int days = address.durationInDays(); - System.out.println(days); - boolean isLessThanADay = 0 == days; - assertTrue("Duration will be less than a day, if start date is set to current date time.", isLessThanADay); - } - - @Test - public void testDurationWithBothStartDateAndEndDate() { - DateTime currentDate = new DateTime(); - DateTime currentDatePlusOneYear = currentDate.plusYears(1); - - Address address = new Address(); - address.setStartDate(currentDate.toDate()); - address.setEndDate(currentDatePlusOneYear.toDate()); - - assertEquals(1, address.durationInYears()); - assertEquals(12, address.durationInMonths()); - assertEquals(52, address.durationInWeeks()); - assertEquals(366, address.durationInDays()); - } - - @Test - public void testAddressCreationWithConstructor(){ - Address address = new Address("Birthplace", new Date(), null, null, "2.222", "3.333", "75210", "Sindh", "Pakistan"); - - assertEquals("Address type invalid", address.getAddressType(), "Birthplace"); - assertEquals("Lat value invalid", address.getLatitude(), "2.222"); - assertEquals("Long value invalid", address.getLongitute(), "3.333"); - assertEquals("Postcode value invalid", address.getPostalCode(), "75210"); - assertEquals("State value invalid", address.getState(), "Sindh"); - assertEquals("Country value invalid", address.getCountry(), "Pakistan"); - - } - - @Test - public void testAddressCreationgWithSetter(){ - Date sd = new Date(); - Date ed = new Date(); - Address address = new Address(); - address.withAddressType("Deathplace"); - address.withCountry("Pakistan"); - address.withState("Punjab"); - address.withPostalCode("75290"); - address.withLatitude("2.222"); - address.withLongitute("3.333"); - address.withStartDate(sd); - address.withEndDate(ed); - - assertEquals("Address type invalid", address.getAddressType(), "Deathplace"); - assertEquals("Postcode value invalid", address.getPostalCode(), "75290"); - assertEquals("State value invalid", address.getState(), "Punjab"); - assertEquals("Country value invalid", address.getCountry(), "Pakistan"); - assertEquals("Lat value invalid", address.getLatitude(), "2.222"); - assertEquals("Long value invalid", address.getLongitute(), "3.333"); - assertEquals("StartDate invalid", address.getStartDate(), sd); - assertEquals("EndDate invalid", address.getStartDate(), ed); - } - - - @Test - public void testGettingAddressFiledByRegex() { - String stringVal = "areaVal"; - String integerVal = "1"; - String noRegexMatch = ""; - String allRegexMatch = "\\D*"; - Map addressFields = new HashMap<>(); - addressFields.put(AddressField.AREA.name(), stringVal); - - - Address address = new Address(); - address.setAddressFields(addressFields); - address.addAddressField(AddressField.HOUSE_NUMBER.name(), integerVal); - - - String invalidAddressValue = address.getAddressFieldMatchingRegex(noRegexMatch); - assertNull(NO_MATCH_ADDRESS_FIELD_MESSAGE, invalidAddressValue); - - String validAddressValue1 = address.getAddressFieldMatchingRegex(allRegexMatch); - assertEquals(integerVal, validAddressValue1); - - String numberAddressVAlue = address.getAddressFieldMatchingRegex(AddressField.AREA.name()); - assertEquals(stringVal, numberAddressVAlue); - - } - - @Test - public void testGettingSpecificAddressField() { - String stringVal = "areaVal"; - String noFieldMatch = ""; - String lowerCaseFieldName = "area"; - String upperCaseFieldName = "AREA"; - - Map addressFields = new HashMap<>(); - addressFields.put(AddressField.AREA.name(), stringVal); - - - Address address = new Address(); - address.setAddressFields(addressFields); - - String nullAddressValue = address.getAddressField(noFieldMatch); - assertNull(NO_MATCH_ADDRESS_FIELD_MESSAGE, nullAddressValue); - - String invalidAddressValue = address.getAddressField(AddressField.HOUSE_NUMBER); - assertNull(NO_MATCH_ADDRESS_FIELD_MESSAGE, invalidAddressValue); - - String validValueWithEnum = address.getAddressField(AddressField.AREA); - assertEquals(stringVal, validValueWithEnum); - - String validValueWithLowerCase = address.getAddressField(lowerCaseFieldName); - assertEquals(stringVal, validValueWithLowerCase); - - String validValueWithUpperCase = address.getAddressField(upperCaseFieldName); - assertEquals(stringVal, validValueWithUpperCase); - - } - - @Test - public void testRemovingAddressField() { - String stringVal = "areaVal"; - String lowerCaseFieldName = "area"; - String upperCaseFieldName = "AREA"; - - - Map addressFields = new HashMap<>(); - addressFields.put(AddressField.AREA.name(), stringVal); - Address address = new Address(); - address.setAddressFields(addressFields); - - address.removeAddressField(AddressField.HOUSE_NUMBER); - assertEquals(1, address.getAddressFields().size()); - assertNotNull(address.getAddressField(AddressField.AREA)); - - address.removeAddressField(AddressField.AREA); - assertEquals(0, address.getAddressFields().size()); - assertNull(address.getAddressField(AddressField.AREA)); - - - - address.addAddressField(AddressField.AREA, stringVal); - - address.removeAddressField(""); - assertEquals(1, address.getAddressFields().size()); - assertNotNull(address.getAddressField(AddressField.AREA)); - - address.removeAddressField(lowerCaseFieldName); - assertEquals(0, address.getAddressFields().size()); - assertNull(address.getAddressField(AddressField.AREA)); - - - - - address.addAddressField(AddressField.AREA, stringVal); - address.removeAddressField(upperCaseFieldName); - assertEquals(0, address.getAddressFields().size()); - assertNull(address.getAddressField(AddressField.AREA)); - - } - - @Test - public void testAddressField(){ - Address address = new Address(); - address.setAddressType("usual_residence"); - Assert.assertEquals("usual_residence", address.getAddressType()); - Assert.assertNotSame("usual_residence_1", address.getAddressType()); - address.withAddressField("address3", "Dambwa_Central"); - Map addressFields = new HashMap<>(); - addressFields.put("address2", "morelight c566"); - address.withAddressFields(addressFields); - address.withAddressField(AddressField.AREA, "Ares"); - Assert.assertEquals("morelight c566", address.getAddressField("address2")); - Assert.assertNotSame("morelight c5666", address.getAddressField("address2")); - } - @Test - public void shouldTestSetterAndGetter() { - PojoClass pojoClass = PojoClassFactory.getPojoClass(Address.class); - Validator pojoValidator = ValidatorBuilder.create() - .with(new SetterMustExistRule()) - .with(new GetterMustExistRule()) - .with(new GetterTester()) - .with(new SetterTester()) - .build(); - - pojoValidator.validate(pojoClass); - } -} diff --git a/opensrp-api/src/test/java/org/opensrp/api/domain/BaseEntityTest.java b/opensrp-api/src/test/java/org/opensrp/api/domain/BaseEntityTest.java deleted file mode 100755 index 156a3bdb20..0000000000 --- a/opensrp-api/src/test/java/org/opensrp/api/domain/BaseEntityTest.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.opensrp.api.domain; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import junit.framework.Assert; - -import org.junit.Test; -import org.opensrp.common.Gender; - -import com.openpojo.reflection.PojoClass; -import com.openpojo.reflection.construct.InstanceFactory; -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.affirm.Affirm; -import com.openpojo.validation.rule.impl.GetterMustExistRule; -import com.openpojo.validation.rule.impl.SetterMustExistRule; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class BaseEntityTest { - - - @Test - public void shouldTestBaseEntity(){ - BaseEntity baseEntity = new BaseEntity(); - Assert.assertNull(baseEntity.getIdentifier(null)); - Assert.assertNull(baseEntity.getAttribute(null)); - BaseEntity baseEntity1= new BaseEntity("oioi-ojhghhg-88777ddd"); - Map identifiers = new HashMap<>(); - identifiers.put("identifier", "value"); - BaseEntity baseEntity2 = new BaseEntity("oioi-ojhghhg-88777ddd", identifiers); - Map attributes = new HashMap<>(); - attributes.put("Home_Facility", "5bf3b4ca-9482-4e85-ab7a-0c44e4edb329"); - BaseEntity baseEntity3 = new BaseEntity("oioi-ojhghhg-88777ddd", identifiers, attributes); - List
addresses = new ArrayList<>(); - Address address = new Address(); - address.setAddressType("usual_residence"); - addresses.add(address); - BaseEntity baseEntity4 = new BaseEntity("oioi-ojhghhg-88777ddd", identifiers, attributes, addresses); - - baseEntity.addAttribute("CHW_Phone_Number", "0193456667"); - baseEntity.addAddress(address); - - Assert.assertEquals("0193456667", baseEntity.getAttribute("CHW_Phone_Number")); - Assert.assertNull(baseEntity.getAttribute(null)); - baseEntity.removeAttribute("CHW_Phone_Number"); - baseEntity.addIdentifier("ZEIR_ID", "101304-4"); - Assert.assertEquals("101304-4", baseEntity.getIdentifier("ZEIR_ID")); - Assert.assertEquals("101304-4", baseEntity.getIdentifierMatchingRegex("ZEIR_ID")); - baseEntity.removeIdentifier("ZEIR_ID"); - baseEntity.withBaseEntityId("fff-uuur-8utt"); - - } - - @Test - public void shouldTestIdentifier(){ - BaseEntity baseEntity = new BaseEntity(); - baseEntity.withIdentifier("Zeir", "1234"); - Assert.assertEquals("1234", baseEntity.getIdentifier("Zeir")); - Assert.assertNotSame("1234s", baseEntity.getIdentifier("Zeir")); - - Map identifiers = new HashMap<>(); - identifiers.put("ZEIR_ID", "101304-4"); - baseEntity.withIdentifiers(identifiers); - Assert.assertEquals("101304-4", baseEntity.getIdentifier("ZEIR_ID")); - Assert.assertNotSame("1234s", baseEntity.getIdentifier("ZEIR_ID")); - - } - @Test - public void shouldTestAttributeAndAttribute(){ - BaseEntity baseEntity = new BaseEntity(); - List
addresses = new ArrayList<>(); - Address address = new Address(); - address.setAddressType("usual_residence"); - addresses.add(address); - baseEntity.withAddress(address); - Assert.assertEquals(addresses, baseEntity.getAddresses()); - baseEntity.withAddresses(addresses); - BaseEntity baseEntityForAttribute = new BaseEntity(); - baseEntityForAttribute.withAttribute("CHW_Phone_Number", "n/a"); - - Assert.assertEquals("n/a", baseEntityForAttribute.getAttribute("CHW_Phone_Number")); - Assert.assertNotSame("n/aa", baseEntityForAttribute.getAttribute("CHW_Phone_Number")); - Map attributes = new HashMap<>(); - attributes.put("CHW_Phone_Number", "1234"); - baseEntityForAttribute.withAttributes(attributes); - Assert.assertEquals("1234", baseEntityForAttribute.getAttribute("CHW_Phone_Number")); - - } - @Test - public void shouldTestSetterAndGetter() { - PojoClass pojoClass = PojoClassFactory.getPojoClass(BaseEntity.class); - Validator pojoValidator = ValidatorBuilder.create() - .with(new SetterMustExistRule()) - .with(new GetterMustExistRule()) - .with(new GetterTester()) - .with(new SetterTester()) - .build(); - - pojoValidator.validate(pojoClass); - } - -} diff --git a/opensrp-api/src/test/java/org/opensrp/api/domain/ClientTest.java b/opensrp-api/src/test/java/org/opensrp/api/domain/ClientTest.java deleted file mode 100755 index 58ba4da4a6..0000000000 --- a/opensrp-api/src/test/java/org/opensrp/api/domain/ClientTest.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.opensrp.api.domain; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.Test; -import org.opensrp.common.Gender; - -import com.openpojo.reflection.PojoClass; -import com.openpojo.reflection.construct.InstanceFactory; -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.affirm.Affirm; -import com.openpojo.validation.rule.impl.GetterMustExistRule; -import com.openpojo.validation.rule.impl.SetterMustExistRule; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -import junit.framework.Assert; - -public class ClientTest { - - @Test - @SuppressWarnings("RedundantArrayCreation") - public void shouldTestConstructor() { - List
addresses = new ArrayList<>(); - Map identifiers = new HashMap<>(); - Map attributes = new HashMap<>(); - final Class clazz = Client.class; - final Object obj1 = getInstance(clazz, "ooo-02we-98","lieo","daow","sonn",new Date(),new Date(), - true, true,"Male","identifierType","identifier"); - Affirm.affirmNotNull("Should have created an object", obj1); - final Object obj3 = getInstance(clazz,"ooo-02we-98","lieo","daow","sonn",new Date(),new Date(), - true, true,"Male",addresses,identifiers,attributes); - Affirm.affirmTrue("Should have created a different object", obj1 != obj3); - Affirm.affirmNotNull("Should have created an object", obj3); - final Object obj4 = getInstance(clazz,"ooo-02we-98","lieo","daow","sonn",new Date(),new Date(), - true, true,"Male"); - Affirm.affirmNotNull("Should have created an object", obj4); - } - - @Test - public void shouldTestEvent(){ - Client Client1 = new Client(); - Client1.withFirstName("robina"); - Assert.assertEquals("robina", Client1.getFirstName()); - Assert.assertNotSame("Not Same", "robin", Client1.getFirstName()); - Client1.withMiddleName("jack"); - Assert.assertEquals("jack", Client1.getMiddleName()); - Assert.assertNotSame("Not Same", "robin", Client1.getMiddleName()); - Client1.withLastName("mona"); - Assert.assertEquals("mona", Client1.getLastName()); - Assert.assertNotSame("Not Same", "robin", Client1.getLastName()); - Client1.withName("Robin", "jack", "mon"); - - Assert.assertEquals("Robin", Client1.getFirstName()); - Assert.assertNotSame("Not Same", "robins", Client1.getFirstName()); - - Date now=new Date(); - Client1.withBirthdate(now,true); - Assert.assertEquals(now, Client1.getBirthdate()); - Date dt = new Date(); - Calendar c = Calendar.getInstance(); - c.setTime(dt); - c.add(Calendar.DATE, 1); - dt = c.getTime(); - Assert.assertNotSame("Not Same", dt, Client1.getBirthdate()); - - Client1.withDeathdate(now, true); - - Assert.assertEquals(now, Client1.getDeathdate()); - Assert.assertNotSame("Not Same", dt, Client1.getDeathdate()); - Client1.withGender("Male"); - Assert.assertEquals("Male", Client1.getGender()); - Assert.assertNotSame("FEMALE", dt, Client1.getGender()); - Client1.withGender(Gender.FEMALE); - Assert.assertEquals("FEMALE", Client1.getGender()); - Assert.assertNotSame("male", dt, Client1.getGender()); - - } - @Test - public void shouldTestSetterAndGetter() { - PojoClass pojoClass = PojoClassFactory.getPojoClass(Client.class); - Validator pojoValidator = ValidatorBuilder.create() - .with(new SetterMustExistRule()) - .with(new GetterMustExistRule()) - .with(new GetterTester()) - .with(new SetterTester()) - .build(); - - pojoValidator.validate(pojoClass); - } - private Object getInstance(final Class clazz, final Object... parameters) { - final PojoClass pojoClass = PojoClassFactory.getPojoClass(clazz); - return InstanceFactory.getInstance(pojoClass, parameters); - } - -} diff --git a/opensrp-api/src/test/java/org/opensrp/api/domain/EventTest.java b/opensrp-api/src/test/java/org/opensrp/api/domain/EventTest.java deleted file mode 100755 index 2159efa13c..0000000000 --- a/opensrp-api/src/test/java/org/opensrp/api/domain/EventTest.java +++ /dev/null @@ -1,158 +0,0 @@ -package org.opensrp.api.domain; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.joda.time.DateTime; -import org.junit.Test; - -import junit.framework.Assert; - -public class EventTest { - - @Test - public void shouldTestEvent(){ - Event firstEvent = new Event(); - firstEvent.withLocationId("locationId2"); - firstEvent.withEventDate(new DateTime()); - firstEvent.withEntityType("entityType"); - firstEvent.withFormSubmissionId("formSubmissionId"); - firstEvent.withEventType("eventType"); - firstEvent.withProviderId("providerId"); - firstEvent.withIdentifier("ff", "dd"); - firstEvent.getIdentifiers(); - firstEvent.getIdentifier(""); - firstEvent.getIdentifierMatchingRegex(""); - Event secondEvent = new Event("baseEntityId", "eventType", new DateTime(), "entityType", "providerId", "locationId", "formSubmissionId"); - firstEvent.setBaseEntityId("baseEntityId"); - Assert.assertEquals(firstEvent.getBaseEntityId(), "baseEntityId"); - firstEvent.withBaseEntityId("baseEntityId"); - firstEvent.setEntityType("entityType"); - Assert.assertEquals(firstEvent.getEntityType(), "entityType"); - DateTime now =new DateTime(); - firstEvent.setEventDate(now); - Assert.assertEquals(firstEvent.getEventDate(),now); - firstEvent.setEventType("eventType"); - Assert.assertEquals(firstEvent.getEventType(),"eventType"); - firstEvent.setProviderId("providerId"); - Assert.assertEquals(firstEvent.getProviderId(),"providerId"); - Obs obs = new Obs(); - obs.setFieldCode("1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); - obs.setFieldDataType("calculate"); - obs.setFieldType("concept"); - obs.setParentCode("783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); - obs.setFormSubmissionField("opv1_dose"); - List value = new ArrayList<>(); - value.add("1"); - obs.setValues(value); - List observations = new ArrayList<>(); - firstEvent.withObs(obs); - observations.add(obs); - firstEvent.withObs(observations); - - firstEvent.setObs(null); - firstEvent.addObs(obs); - - firstEvent.setObs(observations); - Assert.assertEquals(firstEvent.getObs(), observations); - - Map identifiers = new HashMap<>(); - identifiers.put("identifier1", "identifier"); - - firstEvent.withIdentifier("identifier2", "identifier2"); - firstEvent.setIdentifiers(identifiers); - Assert.assertEquals(firstEvent.getIdentifiers(), identifiers); - Assert.assertEquals(firstEvent.getIdentifier("identifier1"), "identifier"); - Assert.assertEquals(firstEvent.getIdentifierMatchingRegex("identifier1"), "identifier"); - firstEvent.setIdentifiers(null); - firstEvent.addIdentifier("identifierType", "identifier"); - firstEvent.removeIdentifier("identifierType"); - firstEvent.withIdentifiers(identifiers); - Assert.assertNull(firstEvent.getIdentifier("identifierType")); - firstEvent.setLocationId("locationId"); - Assert.assertEquals(firstEvent.getLocationId(), "locationId"); - firstEvent.setFormSubmissionId("formSubmissionId"); - Assert.assertEquals(firstEvent.getFormSubmissionId(), "formSubmissionId"); - firstEvent.addDetails("key1", "value1"); - - Map details = new HashMap<>(); - details.put("key", "value"); - firstEvent.setDetails(details); - Assert.assertEquals(firstEvent.getDetails(), details); - firstEvent.setVersion(0L); - Assert.assertEquals(firstEvent.getVersion(), 0l); - - } - - @Test - public void shouldTestParentClassBaseObject(){ - Event event = new Event(); - User user = new User("oooo-r34444-jgu45"); - User user1 = new User("oooo-r34444-jgu45"); - event.setCreator(user); - Assert.assertEquals(user, event.getCreator()); - Assert.assertNotSame(user1, event.getCreator()); - - user.setDateCreated(new Date()); - Assert.assertEquals(new Date(), user.getDateCreated()); - - User editor = new User("oooo-r34444-jgu45"); - editor.setEditor(editor); - user.setEditor(editor); - User editor1 = new User("oooo-r34444-jgu45"); - Assert.assertEquals(editor, user.getEditor()); - Assert.assertNotSame(editor1, user.getEditor()); - Date now =new Date(); - event.setDateEdited(now); - Assert.assertEquals(now, event.getDateEdited()); - Date dt = new Date(); - Calendar c = Calendar.getInstance(); - c.setTime(dt); - c.add(Calendar.DATE, 1); - dt = c.getTime(); - Assert.assertNotSame(dt, event.getDateEdited()); - - event.setVoided(true); - Assert.assertTrue(event.getVoided()); - Assert.assertFalse(!event.getVoided()); - - event.setDateVoided(now); - Assert.assertEquals(now, event.getDateVoided()); - - event.setVoider(user); - Assert.assertEquals(user, event.getVoider()); - Assert.assertNotSame(user1, event.getVoider()); - - event.setVoidReason("fake data"); - Assert.assertEquals("fake data", event.getVoidReason()); - Assert.assertNotSame("fakes data", event.getVoidReason()); - - event.withCreator(user); - Assert.assertEquals(user, event.getCreator()); - Assert.assertNotSame(user1, event.getCreator()); - - event.withDateCreated(new Date()); - event.withEditor(user); - Assert.assertEquals(editor, user.getEditor()); - Assert.assertNotSame(editor1, user.getEditor()); - event.withDateEdited(new Date()); - event.withVoided(true); - Assert.assertTrue(event.getVoided()); - Assert.assertFalse(!event.getVoided()); - - event.withDateVoided(new Date()); - event.withVoider(editor); - Assert.assertEquals(editor, user.getEditor()); - Assert.assertNotSame(editor1, user.getEditor()); - event.withVoidReason("fake data"); - Assert.assertEquals("fake data", event.getVoidReason()); - Assert.assertNotSame("fakes data", event.getVoidReason()); - - - } - -} diff --git a/opensrp-api/src/test/java/org/opensrp/api/domain/LocationTest.java b/opensrp-api/src/test/java/org/opensrp/api/domain/LocationTest.java deleted file mode 100755 index dc4ddc3aba..0000000000 --- a/opensrp-api/src/test/java/org/opensrp/api/domain/LocationTest.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.opensrp.api.domain; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import junit.framework.Assert; - -import org.junit.Test; - -import com.openpojo.reflection.PojoClass; -import com.openpojo.reflection.construct.InstanceFactory; -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.affirm.Affirm; -import com.openpojo.validation.rule.impl.GetterMustExistRule; -import com.openpojo.validation.rule.impl.SetterMustExistRule; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class LocationTest { - - @Test - @SuppressWarnings("RedundantArrayCreation") - public void shouldTestConstructorUsingDefaultConstructor() { - String locationId = "locationId"; - String name = "name"; - Address address = new Address(); - Location parentLocation = new Location(); - Map identifiers = new HashMap<>(); - Set tags = new HashSet<>(); - Map attributes = new HashMap<>(); - final Class clazz = Location.class; - final Object obj1 = getInstance(clazz, locationId,name,address,identifiers,parentLocation,tags,attributes); - Affirm.affirmNotNull("Should have created an object", obj1); - final Location obj2 = (Location) getInstance(clazz,locationId,name,address,identifiers,parentLocation,tags,attributes); - final Object obj3 = getInstance(clazz,locationId,name,address,parentLocation); - Affirm.affirmTrue("Should have created a different object", obj1 != obj3); - obj2.removeAttribute("name"); - obj2.setAttributes(null); - obj2.addAttribute("name", "value"); - Assert.assertEquals(obj2.getAttribute("name"), "value"); - obj2.setIdentifiers(null); - obj2.addIdentifier("identifierType", "identifier"); - Assert.assertEquals(obj2.getIdentifier("identifierType"), "identifier"); - obj2.removeIdentifier("identifierType"); - obj2.setTags(null); - obj2.addTag("tag"); - Assert.assertEquals(obj2.getTags().size(), 1); - obj2.removeTag("tag"); - obj2.withAddress(address); - obj2.withIdentifiers(identifiers); - obj2.withTags(tags); - obj2.withAttributes(attributes); - Assert.assertEquals(obj2.getAttributes(), new HashMap<>()); - - } - - @Test - public void shouldTestSetterAndGetter() { - PojoClass pojoClass = PojoClassFactory.getPojoClass(Location.class); - Validator pojoValidator = ValidatorBuilder.create() - .with(new SetterMustExistRule()) - .with(new GetterMustExistRule()) - .with(new GetterTester()) - .with(new SetterTester()) - .build(); - - pojoValidator.validate(pojoClass); - } - - private Object getInstance(final Class clazz, final Object... parameters) { - final PojoClass pojoClass = PojoClassFactory.getPojoClass(clazz); - return InstanceFactory.getInstance(pojoClass, parameters); - } - -} diff --git a/opensrp-api/src/test/java/org/opensrp/api/domain/ObsTest.java b/opensrp-api/src/test/java/org/opensrp/api/domain/ObsTest.java deleted file mode 100755 index 1eba3fad5e..0000000000 --- a/opensrp-api/src/test/java/org/opensrp/api/domain/ObsTest.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.opensrp.api.domain; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.Assert; - -import org.junit.Test; - -import com.openpojo.reflection.PojoClass; -import com.openpojo.reflection.construct.InstanceFactory; -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.affirm.Affirm; -import com.openpojo.validation.rule.impl.GetterMustExistRule; -import com.openpojo.validation.rule.impl.SetterMustExistRule; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class ObsTest { - @Test - @SuppressWarnings("RedundantArrayCreation") - public void shouldTestConstructor() { - List values = new ArrayList<>(); - final Class clazz = Obs.class; - final Object obj1 = getInstance(clazz, "concept","163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "daow","886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",values,"no comments","start"); - Affirm.affirmNotNull("Should have created an object", obj1); - Obs ob = (Obs) obj1; - Assert.assertNull(ob.getValue()); - } - - @Test(expected=Exception.class) - public void shouldReturnNullForgetValue(){ - Obs obs = new Obs(); - obs.getValue(); - } - - @Test(expected=RuntimeException.class) - public void shouldReturnRuntimeExceptionForgetValue(){ - Obs obs = new Obs(); - List values = new ArrayList<>(); - values.add(1); - values.add(2); - values.add(4); - obs.withValues(values); - obs.getValue(); - } - @Test - public void shouldTestObs(){ - Obs obs = new Obs(); - obs.withFieldType("concept"); - Assert.assertEquals("concept", obs.getFieldType()); - Assert.assertNotSame("concept1", obs.getFieldType()); - obs.withFieldCode("1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); - Assert.assertEquals("1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", obs.getFieldCode()); - Assert.assertNotSame("1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB", obs.getFieldCode()); - obs.withFieldDataType("date"); - Assert.assertEquals("date", obs.getFieldDataType()); - Assert.assertNotSame("concept", obs.getFieldDataType()); - obs.withParentCode("162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); - Assert.assertEquals("162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", obs.getParentCode()); - Assert.assertNotSame("162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAB", obs.getParentCode()); - List values = new ArrayList<>(); - values.add(1); - obs.withValues(values); - Assert.assertEquals(1,obs.getValue()); - obs.withComments("No Comments"); - obs.withFormSubmissionField("pcv1_retro"); - Assert.assertEquals("pcv1_retro", obs.getFormSubmissionField()); - Assert.assertNotSame("pcv1_retro1", obs.getFormSubmissionField()); - obs.setValue(4); - } - - @Test - public void shouldTestAddToValueList(){ - Obs obs = new Obs(); - obs.withValue(null); - Assert.assertNull(obs.getValue()); - - - } - @Test - public void shouldTestSetterAndGetter() { - PojoClass pojoClass = PojoClassFactory.getPojoClass(Obs.class); - Validator pojoValidator = ValidatorBuilder.create() - .with(new SetterMustExistRule()) - .with(new GetterMustExistRule()) - .with(new GetterTester()) - .with(new SetterTester()) - .build(); - - pojoValidator.validate(pojoClass); - } - private Object getInstance(final Class clazz, final Object... parameters) { - final PojoClass pojoClass = PojoClassFactory.getPojoClass(clazz); - return InstanceFactory.getInstance(pojoClass, parameters); - } - -} diff --git a/opensrp-api/src/test/java/org/opensrp/api/domain/PhotoTest.java b/opensrp-api/src/test/java/org/opensrp/api/domain/PhotoTest.java deleted file mode 100755 index a0340b3bf0..0000000000 --- a/opensrp-api/src/test/java/org/opensrp/api/domain/PhotoTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.opensrp.api.domain; - -import org.junit.Test; - -import com.openpojo.reflection.PojoClass; -import com.openpojo.reflection.construct.InstanceFactory; -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.affirm.Affirm; -import com.openpojo.validation.rule.impl.GetterMustExistRule; -import com.openpojo.validation.rule.impl.SetterMustExistRule; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class PhotoTest { - - @Test - @SuppressWarnings("RedundantArrayCreation") - public void shouldTestConstructorUsingDefaultConstructor() { - final Class clazz = Photo.class; - final Object obj1 = getInstance(clazz); - Affirm.affirmNotNull("Should have created an object", obj1); - - } - - @Test - public void shouldTestSetterAndGetter() { - PojoClass pojoClass = PojoClassFactory.getPojoClass(Photo.class); - Validator pojoValidator = ValidatorBuilder.create() - .with(new SetterMustExistRule()) - .with(new GetterMustExistRule()) - .with(new GetterTester()) - .with(new SetterTester()) - .build(); - - pojoValidator.validate(pojoClass); - } - - private Object getInstance(final Class clazz, final Object... parameters) { - final PojoClass pojoClass = PojoClassFactory.getPojoClass(clazz); - return InstanceFactory.getInstance(pojoClass, parameters); - } - -} diff --git a/opensrp-api/src/test/java/org/opensrp/api/domain/ProviderTest.java b/opensrp-api/src/test/java/org/opensrp/api/domain/ProviderTest.java deleted file mode 100755 index 7c7763e552..0000000000 --- a/opensrp-api/src/test/java/org/opensrp/api/domain/ProviderTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.opensrp.api.domain; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -import org.junit.Test; - -import com.openpojo.reflection.PojoClass; -import com.openpojo.reflection.construct.InstanceFactory; -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.affirm.Affirm; -import com.openpojo.validation.rule.impl.GetterMustExistRule; -import com.openpojo.validation.rule.impl.SetterMustExistRule; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class ProviderTest { - - @Test - @SuppressWarnings("RedundantArrayCreation") - public void shouldTestConstructorUsing() { - final Class clazz = Provider.class; - final Object obj1 = getInstance(clazz, "baseEntityId"); - Affirm.affirmNotNull("Should have created an object", obj1); - final Object obj3 = getInstance(clazz,"baseEntityId","fullname"); - Affirm.affirmTrue("Should have created a different object", obj1 != obj3); - } - - @Test - public void shouldTestSetterAndGetter() { - PojoClass pojoClass = PojoClassFactory.getPojoClass(Provider.class); - Validator pojoValidator = ValidatorBuilder.create() - .with(new SetterMustExistRule()) - .with(new GetterMustExistRule()) - .with(new GetterTester()) - .with(new SetterTester()) - .build(); - - pojoValidator.validate(pojoClass); - } - - private Object getInstance(final Class clazz, final Object... parameters) { - final PojoClass pojoClass = PojoClassFactory.getPojoClass(clazz); - return InstanceFactory.getInstance(pojoClass, parameters); - } - -} diff --git a/opensrp-api/src/test/java/org/opensrp/api/domain/TimeTest.java b/opensrp-api/src/test/java/org/opensrp/api/domain/TimeTest.java deleted file mode 100755 index 2118f70b58..0000000000 --- a/opensrp-api/src/test/java/org/opensrp/api/domain/TimeTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.opensrp.api.domain; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; - -import junit.framework.Assert; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -import org.junit.Test; - -import com.openpojo.reflection.PojoClass; -import com.openpojo.reflection.construct.InstanceFactory; -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.affirm.Affirm; -import com.openpojo.validation.rule.impl.GetterMustExistRule; -import com.openpojo.validation.rule.impl.SetterMustExistRule; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class TimeTest { - - private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - @Test - @SuppressWarnings("RedundantArrayCreation") - public void shouldTestConstructorUsingDefaultConstructor() { - final Class clazz = Time.class; - final Object obj1 = getInstance(clazz, new Date(),TimeZone.getTimeZone("BDT")); - Affirm.affirmNotNull("Should have created an object", obj1); - final Time time = (Time) getInstance(clazz, new Date(),TimeZone.getTimeZone("BDT")); - Assert.assertEquals(DATE_FORMAT.format(new Date()),time.getTime()); - } - - - private Object getInstance(final Class clazz, final Object... parameters) { - final PojoClass pojoClass = PojoClassFactory.getPojoClass(clazz); - return InstanceFactory.getInstance(pojoClass, parameters); - } - -} diff --git a/opensrp-api/src/test/java/org/opensrp/api/domain/UserTest.java b/opensrp-api/src/test/java/org/opensrp/api/domain/UserTest.java deleted file mode 100755 index 7a2026db4b..0000000000 --- a/opensrp-api/src/test/java/org/opensrp/api/domain/UserTest.java +++ /dev/null @@ -1,173 +0,0 @@ -package org.opensrp.api.domain; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import junit.framework.Assert; - -import org.junit.Test; - -import com.openpojo.reflection.PojoClass; -import com.openpojo.reflection.construct.InstanceFactory; -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.affirm.Affirm; -import com.openpojo.validation.rule.impl.GetterMustExistRule; -import com.openpojo.validation.rule.impl.SetterMustExistRule; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class UserTest { - - @Test - @SuppressWarnings("RedundantArrayCreation") - public void shouldTestConstructor() { - List
addresses = new ArrayList<>(); - Map identifiers = new HashMap<>(); - Map attributes = new HashMap<>(); - final Class clazz = User.class; - final Object user1 = getInstance(clazz, "ooo-02we-98","lieo","daow","sonn"); - Affirm.affirmNotNull("Should have created an object", user1); - List roles = new ArrayList<>(); - roles.add("Admin"); - List permissions = new ArrayList<>(); - permissions.add("Login"); - final Object user2 = getInstance(clazz, "ooo-02we-98","lieo","userpassword","sonn","Active",roles,permissions); - Affirm.affirmNotNull("Should have created an object", user2); - final Object user3 = getInstance(clazz, "ooo-02we-98","lieo","preferredName","password","sonn","Active",roles,permissions); - Affirm.affirmNotNull("Should have created an object", user3); - - } - @Test - public void testUserAttributes(){ - User u = new User("entity id 1"); - u.withAttribute("attr1", "strval") - .withAttribute("attr2", 2) - .withAttribute("attr3", true); - - assertEquals("strval", (String)u.getAttribute("attr1")); - assertEquals(2, (int)u.getAttribute("attr2")); - assertEquals(true, (boolean)u.getAttribute("attr3")); - assertNull(u.getAttribute("attr8")); - u.removeAttribute("attr3"); - assertNull(u.getAttribute("attr3")); - - User newUser =new User(); - List roles = new ArrayList<>(); - roles.add("Admin"); - roles.add("FWA"); - newUser.withRoles(roles); - Assert.assertEquals(roles, newUser.getRoles()); - User newUser1 =new User(); - List permissions = new ArrayList<>(); - permissions.add("Login"); - permissions.add("user creation"); - newUser1.withPermissions(permissions); - Assert.assertEquals(permissions, newUser1.getPermissions()); - u.withPassword("12345678"); - Assert.assertEquals("12345678", u.getPassword()); - Assert.assertNotSame("12345679", u.getPassword()); - u.withSalt("saltValue"); - Assert.assertEquals("saltValue", u.getSalt()); - Assert.assertNotSame("12345679", u.getSalt()); - - } - - @Test - public void shouldTestSetterAndGetter() { - PojoClass pojoClass = PojoClassFactory.getPojoClass(User.class); - Validator pojoValidator = ValidatorBuilder.create() - .with(new SetterMustExistRule()) - .with(new GetterMustExistRule()) - .with(new GetterTester()) - .with(new SetterTester()) - .build(); - - pojoValidator.validate(pojoClass); - } - - @Test - public void testUserPermissions() { - User user = new User("entity id 1") - .withUsername("username11") - .withPermission("view") - .withPermission("edit") - .withPermission("add") - .withPermission("delete"); - - assertEquals(true, user.hasPermission("view")); - assertEquals(true, user.hasPermission("edit")); - assertEquals(true, user.hasPermission("add")); - assertEquals(true, user.hasPermission("delete")); - - user.removePermission("delete"); - user.removePermission("dsfda"); - - assertEquals(false, user.hasPermission("delete")); - } - - @Test - public void testUserRole() { - User user = new User("entity id 1") - .withUsername("username11") - .withRole("r1") - .withRole("r2"); - - assertEquals(true, user.hasRole("r1")); - assertEquals(true, user.hasRole("r2")); - assertEquals(false, user.hasRole("r4")); - assertEquals(false, user.hasAdminRights()); - assertEquals(false, user.isDefaultAdmin()); - - user.addRole("admin"); - assertEquals(true, user.hasAdminRights()); - assertEquals(false, user.isDefaultAdmin()); - - user.addRole("administrator"); - assertEquals(true, user.hasAdminRights()); - assertEquals(false, user.isDefaultAdmin()); - - user.removeRole("admin"); - user.setUsername("admin"); - assertEquals(true, user.hasAdminRights()); - assertEquals(true, user.isDefaultAdmin()); - - user.removeRole("administrator"); - assertEquals(false, user.hasAdminRights()); - assertEquals(false, user.isDefaultAdmin()); - User newUser = new User(); - newUser.addRole("newRole"); - Assert.assertEquals(asList("newRole"), newUser.getRoles()); - User newUser1 = new User(); - newUser1.addPermission("Login"); - Assert.assertEquals(asList("Login"), newUser1.getPermissions()); - } - - @Test - public void testUserActiveness() { - User user = new User("entity id 1") - .withStatus("active"); - assertEquals("active", user.getStatus() ); - user.setStatus("inactive"); - assertEquals("inactive", user.getStatus()); - - } - - @Test - public void shouldAddPermission(){ - - - } - private Object getInstance(final Class clazz, final Object... parameters) { - final PojoClass pojoClass = PojoClassFactory.getPojoClass(clazz); - return InstanceFactory.getInstance(pojoClass, parameters); - } - -} diff --git a/opensrp-api/src/test/java/org/opensrp/api/util/LocationTest.java b/opensrp-api/src/test/java/org/opensrp/api/util/LocationTest.java deleted file mode 100755 index ded8c41497..0000000000 --- a/opensrp-api/src/test/java/org/opensrp/api/util/LocationTest.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.opensrp.api.util; - -import static org.junit.Assert.*; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; -import org.opensrp.api.domain.Location; -import org.opensrp.api.util.LocationTree; - -public class LocationTest { - - @Test - public void testLocations(){ - Location l = new Location() - .withLocationId("l1") - .withAttribute("l1at", "latval") - .withIdentifier("lid1", "iiii") - .withName("location1") - .withTag("HOSPITAL"); - - assertEquals("", l.getLocationId(), "l1"); - assertEquals("", l.getAttribute("l1at"), "latval"); - assertEquals("", l.getIdentifier("lid1"), "iiii"); - assertEquals("", l.getName(), "location1"); - assertTrue("", l.hasTag("HOSPITAL")); - } - - @Test - public void testLocationTree2(){ - List ll = new ArrayList(); - ll.add(new Location("1", "l1", null, null, null, null, null)); - ll.add(new Location("2", "l2", null, null, null, null, null).withParentLocation(ll.get(0))); - ll.add(new Location("3", "l3", null, null, null, null, null).withParentLocation(ll.get(0))); - ll.add(new Location("4", "l4", null, null, null, null, null).withParentLocation(ll.get(0))); - - ll.add(new Location("5", "l5", null, null, null, null, null)); - ll.add(new Location("6", "l6", null, null, null, null, null).withParentLocation(ll.get(4))); - ll.add(new Location("7", "l7", null, null, null, null, null).withParentLocation(ll.get(4))); - ll.add(new Location("8", "l8", null, null, null, null, null).withParentLocation(ll.get(4))); - - ll.add(new Location("9", "l9", null, null, null, null, null)); - ll.add(new Location("10", "l10", null, null, null, null, null).withParentLocation(ll.get(8))); - ll.add(new Location("11", "l11", null, null, null, null, null).withParentLocation(ll.get(8))); - ll.add(new Location("12", "l12", null, null, null, null, null).withParentLocation(ll.get(8))); - - ll.add(new Location("13", "l13", null, null, null, null, null).withParentLocation(ll.get(5))); - ll.add(new Location("14", "l14", null, null, null, null, null).withParentLocation(ll.get(5))); - ll.add(new Location("15", "l15", null, null, null, null, null).withParentLocation(ll.get(5))); - - ll.add(new Location("16", "l16", null, null, null, null, null).withParentLocation(ll.get(10))); - ll.add(new Location("17", "l17", null, null, null, null, null).withParentLocation(ll.get(10))); - ll.add(new Location("18", "l18", null, null, null, null, null).withParentLocation(ll.get(10))); - - ll.add(new Location("19", "l19", null, null, null, null, null).withParentLocation(ll.get(16))); - ll.add(new Location("20", "l20", null, null, null, null, null).withParentLocation(ll.get(17))); - - LocationTree ltree = new LocationTree(); - for (Location location : ll) { - ltree.addLocation(location); - } - - assertEquals("", ltree.findLocation("7"), ll.get(6)); - assertTrue("", ltree.hasLocation("7")); - assertEquals("", ltree.findLocation("7").getParentLocation(), ll.get(6).getParentLocation()); - assertTrue("", ltree.hasChildLocation("18", "20")); - } - - @Test - public void testLocationTree3(){ - List ll = new ArrayList(); - ll.add(new Location("1", "l1", null, null, null, null, null)); - ll.add(new Location("2", "l2", null, null, null, null, null).withParentLocation(ll.get(0))); - ll.add(new Location("3", "l3", null, null, null, null, null).withParentLocation(ll.get(0))); - ll.add(new Location("4", "l4", null, null, null, null, null).withParentLocation(ll.get(0))); - - ll.add(new Location("5", "l5", null, null, null, null, null)); - ll.add(new Location("6", "l6", null, null, null, null, null).withParentLocation(ll.get(4))); - ll.add(new Location("7", "l7", null, null, null, null, null).withParentLocation(ll.get(4))); - ll.add(new Location("8", "l8", null, null, null, null, null).withParentLocation(ll.get(4))); - - ll.add(new Location("9", "l9", null, null, null, null, null)); - ll.add(new Location("10", "l10", null, null, null, null, null).withParentLocation(ll.get(8))); - ll.add(new Location("11", "l11", null, null, null, null, null).withParentLocation(ll.get(8))); - ll.add(new Location("12", "l12", null, null, null, null, null).withParentLocation(ll.get(8))); - - ll.add(new Location("13", "l13", null, null, null, null, null).withParentLocation(ll.get(5))); - ll.add(new Location("14", "l14", null, null, null, null, null).withParentLocation(ll.get(5))); - ll.add(new Location("15", "l15", null, null, null, null, null).withParentLocation(ll.get(5))); - - ll.add(new Location("16", "l16", null, null, null, null, null).withParentLocation(ll.get(10))); - ll.add(new Location("17", "l17", null, null, null, null, null).withParentLocation(ll.get(10))); - ll.add(new Location("18", "l18", null, null, null, null, null).withParentLocation(ll.get(10))); - - ll.add(new Location("19", "l19", null, null, null, null, null).withParentLocation(ll.get(16))); - ll.add(new Location("20", "l20", null, null, null, null, null).withParentLocation(ll.get(17))); - - LocationTree ltree = new LocationTree(); - ltree.buildTreeFromList(ll); - - assertEquals("", ltree.findLocation("7"), ll.get(6)); - assertTrue("", ltree.hasLocation("7")); - assertEquals("", ltree.findLocation("7").getParentLocation(), ll.get(6).getParentLocation()); - assertTrue("", ltree.hasChildLocation("18", "20")); - } -} diff --git a/opensrp-api/src/test/java/org/opensrp/api/util/TreeNodeTest.java b/opensrp-api/src/test/java/org/opensrp/api/util/TreeNodeTest.java deleted file mode 100755 index 544e01cb58..0000000000 --- a/opensrp-api/src/test/java/org/opensrp/api/util/TreeNodeTest.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.opensrp.api.util; - - -import org.junit.Test; - -import java.util.HashMap; -import java.util.Map; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNull; - -public class TreeNodeTest { - int rootId = 1; - int childId = 2; - int grandChildId = 3; - - @Test - public void testChildCreationUsingConstructor() { - TreeNode childNode = new TreeNode(childId,"t1", 1, rootId); - Map> children = new HashMap<>(); - children.put(1, childNode); - - TreeNode rootNode = new TreeNode(rootId, "t2",2, null, children); - - assertEquals(childId, (int)rootNode.findChild(childId).getId()); - assertEquals(rootId, (int)rootNode.findChild(childId).getParent()); - } - - @Test - public void testAddingChild() { - - TreeNode rootNode = new TreeNode(rootId, "root",2, null); - TreeNode childNode = new TreeNode(childId,"child", 1, rootId); - rootNode.addChild(childNode); - - assertEquals(childId, (int)rootNode.findChild(childId).getId()); - assertEquals(rootId, (int)rootNode.findChild(childId).getParent()); - } - - @Test - public void findValidGrandChildren() { - TreeNode rootNode = new TreeNode(rootId, "root",1, null); - TreeNode childNode = new TreeNode(childId,"child", 2, rootId); - TreeNode grandChildNode = new TreeNode(grandChildId,"grandChild", 3, childId); - rootNode.addChild(childNode); - childNode.addChild(grandChildNode); - - assertEquals(childId, (int)rootNode.findChild(childId).getId()); - assertEquals(rootId, (int)rootNode.findChild(childId).getParent()); - - assertEquals(grandChildId, (int)rootNode.findChild(grandChildId).getId()); - assertEquals(childId, (int)rootNode.findChild(grandChildId).getParent()); - } - - @Test - public void findInvalidChildren() { - TreeNode rootNode = new TreeNode(rootId, "root",1, null); - assertNull(rootNode.getChildren()); - assertNull(rootNode.findChild(childId)); - } - - @Test - public void testRemoveValidChild() { - TreeNode rootNode = new TreeNode(rootId, "root",2, null); - TreeNode childNode = new TreeNode(childId,"child", 1, rootId); - rootNode.addChild(childNode); - - assertEquals(childId, (int)rootNode.findChild(childId).getId()); - - TreeNode removedNode = rootNode.removeChild(childId); - - assertEquals(childId, (int)removedNode.getId()); - assertNull(rootNode.findChild(childId)); - } - - @Test - public void testRemoveValidGrandChild() { - TreeNode rootNode = new TreeNode(rootId, "root",1, null); - TreeNode childNode = new TreeNode(childId,"child", 2, rootId); - TreeNode grandChildNode = new TreeNode(grandChildId,"grandChild", 3, childId); - rootNode.addChild(childNode); - childNode.addChild(grandChildNode); - - assertEquals(childId, (int)rootNode.findChild(childId).getId()); - assertEquals(grandChildId, (int)rootNode.findChild(grandChildId).getId()); - - TreeNode removedNode = rootNode.removeChild(grandChildId); - - assertEquals(grandChildId, (int)removedNode.getId()); - assertNull(rootNode.findChild(grandChildId)); - } - - @Test - public void testRemoveInvalidChild() { - TreeNode rootNode = new TreeNode(rootId, "root",1, null); - TreeNode childNode = new TreeNode(childId,"child", 2, rootId); - TreeNode grandChildNode = new TreeNode(grandChildId,"grandChild", 3, childId); - rootNode.addChild(childNode); - childNode.addChild(grandChildNode); - - assertNull(rootNode.removeChild(4)); - } -} diff --git a/opensrp-api/src/test/java/org/opensrp/api/util/TreeTest.java b/opensrp-api/src/test/java/org/opensrp/api/util/TreeTest.java deleted file mode 100755 index 3fdf96b073..0000000000 --- a/opensrp-api/src/test/java/org/opensrp/api/util/TreeTest.java +++ /dev/null @@ -1,153 +0,0 @@ -package org.opensrp.api.util; - - -import org.junit.Test; - -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNull; -import static org.junit.Assert.assertNotNull; - - -public class TreeTest { - - @Test - public void testAddingNodeWithOutParent() { - Tree tree = new Tree<>(); - tree.addNode(1, "test", 2, null); - - TreeNode node = tree.getNode(1); - - assertEquals(1, (int) node.getId()); - assertEquals("test", (String) node.getLabel()); - assertEquals(2, (int) node.getNode()); - assertNull(node.getParent()); - } - - @Test(expected = IllegalArgumentException.class) - public void testCannotReAddExistingNode() { - Tree tree = new Tree<>(); - tree.addNode(1, "test", 2, null); - tree.addNode(1, "test", 2, null); - } - - @Test - public void testAddingNodeWithValidParent() { - Tree tree = new Tree<>(); - tree.addNode(1, "test", 1, null); - tree.addNode(2, "test2", 2, 1); - - TreeNode childNode = tree.getNode(2); - - assertEquals(2, (int) childNode.getId()); - assertEquals("test2", (String) childNode.getLabel()); - assertEquals(2, (int) childNode.getNode()); - - assertNotNull(childNode.getParent()); - - int parentNodeId = childNode.getParent(); - - assertEquals(1, parentNodeId); - } - - @Test - public void testAddingNodeWithInvalidParent() { - Tree tree = new Tree<>(); - tree.addNode(2, "test2", 2, 1); - - TreeNode childNode = tree.getNode(2); - - assertEquals(2, (int) childNode.getId()); - assertEquals("test2", (String) childNode.getLabel()); - assertEquals(2, (int) childNode.getNode()); - - assertNodeIsRoot(tree, childNode); - } - - @Test - public void testAddingNodeFirstChildThenParent() { - Tree tree = new Tree<>(); - tree.addNode(2, "test2", 2, 1); - tree.addNode(3, "test3", 3, 1); - - tree.addNode(1, "test1", 1, null); - - TreeNode rootNode = tree.getNode(1); - assertNodeIsRoot(tree, rootNode); - assertNull(rootNode.getParent()); - - Map> childNodes = rootNode.getChildren(); - - assertEquals(2, (int) childNodes.get(2).getId()); - assertEquals(3, (int) childNodes.get(3).getId()); - - Map> childParentList = tree.getChildParent(); - assertEquals(2, childParentList.get(1).size()); - - } - - @Test - public void testRemoveRootNode() { - Tree tree = new Tree<>(); - tree.addNode(2, "test2", 2, null); - tree.addNode(3, "test3", 3, null); - - TreeNode nodeToRemove = tree.removeNode(2); - TreeNode nodeToRemoveSecond = tree.removeNode(3); - - assertEquals(2, (int) nodeToRemove.getId()); - assertNull(tree.getNode(2)); - - assertEquals(3, (int) nodeToRemoveSecond.getId()); - assertNull(tree.getNode(3)); - } - - @Test - public void testRemovingChildNode() { - Tree tree = new Tree<>(); - tree.addNode(2, "test2", 2, 1); - tree.addNode(3, "test3", 3, 1); - tree.addNode(1, "test1", 1, null); - - TreeNode nodeToRemove = tree.removeNode(2); - TreeNode nodeToRemoveSecond = tree.removeNode(3); - - TreeNode rootNode = tree.getNode(1); - - assertEquals(0, rootNode.getChildren().size()); - } - - @Test - public void testRemoveInvalidNode() { - Tree tree = new Tree<>(); - tree.addNode(2, "test2", 2, 1); - - TreeNode nodeToRemove = tree.removeNode(5); - assertNull(nodeToRemove); - } - - @Test(expected = UnsupportedOperationException.class) - public void testUnmodifiableMemberThroughSetter() { - Tree tree = new Tree<>(); - tree.addNode(2, "test2", 2, null); - tree.addNode(3, "test3", 3, null); - - Map> nodesMap = tree.getTree(); - Map> childParentList = tree.getChildParent(); - - assertEquals(2, (int) nodesMap.get(2).getId()); - - nodesMap.remove(2); - childParentList.put(1, new HashSet() { - }); - } - - private void assertNodeIsRoot(Tree tree, TreeNode node) { - assertEquals(1, tree.map.size()); - assertEquals((int) node.getId(), (int) tree.map.get(node.getId()).getId()); - } - -} diff --git a/opensrp-common/pom.xml b/opensrp-common/pom.xml deleted file mode 100755 index 845e77fad5..0000000000 --- a/opensrp-common/pom.xml +++ /dev/null @@ -1,332 +0,0 @@ - - - 4.0.0 - org.smartregister - - opensrp-server-common - jar - - 1.0.4-SNAPSHOT - - opensrp-server-common - OpenSRP Server common module - http://github.com/OpenSRP/opensrp-server-common - - - ${project.basedir} - 0.11 - 3.1.0.RELEASE - always - UTF-8 - 1.5.1 - - - - - nexus-snapshots - Nexus Snapshots Repository - https://oss.sonatype.org/content/repositories/snapshots - false - - - nexus-releases - https://oss.sonatype.org/service/local/staging/deploy/maven2 - - - - - scm:git:git@github.com:OpenSRP/opensrp-server-common.git - scm:git:git@github.com:OpenSRP/opensrp-server-common.git - https://github.com/OpenSRP/opensrp-server-common - - - - - Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0.txt - repo - Open Smart Register Platform (OpenSRP) is Licensed under the Apache License, Version 2.0 - - - - - - opensrp_developer - OpenSRP Developer - info@smartregister.org - https://groups.google.com/forum/#!forum/opensrp-dev - OpenSRP - http://smartregister.org - - developer - - Africa/Nairobi - - - - - - motech.opensrp - Motech Snapshots Repository - http://nexus.motechproject.org/content/repositories/opensrp-server - - true - ${opensrp.updatePolicy} - - - - motech.nexus - Motech Snapshots Repository - http://nexus.motechproject.org/content/repositories/snapshots - - true - ${opensrp.updatePolicy} - - - - motech.nexus.release - Motech Snapshots Repository - http://nexus.motechproject.org/content/repositories/releases - - - - - - org.springframework - spring-core - ${spring.version} - - - commons-logging - commons-logging - - - - - org.springframework - spring-test - ${spring.version} - test - - - commons-logging - commons-logging - - - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-aop - ${spring.version} - - - org.springframework - spring-aspects - ${spring.version} - - - org.motechproject - motech-platform-common-api - ${motech.version} - - - - junit - junit - 4.8.2 - test - - - org.mockito - mockito-all - 1.8.5 - - - org.powermock - powermock-module-junit4 - 1.4.9 - test - - - org.powermock - powermock-api-mockito - 1.4.9 - test - - - org.javassist - javassist - 3.18.1-GA - - - org.motechproject - motech-testing-utils - ${motech.version} - test - - - commons-lang - commons-lang - 2.5 - - - org.bouncycastle - bcprov-jdk15on - 1.54 - - - org.bouncycastle - bcprov-ext-jdk15on - 1.54 - - - nl.jqno.equalsverifier - equalsverifier - 2.3 - test - - - org.apache.httpcomponents - httpclient - 4.5.2 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.7 - 1.7 - UTF-8 - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${nexus-staging-maven-plugin.version} - - - default-deploy - deploy - - deploy - - - - - nexus-snapshots - https://oss.sonatype.org/ - true - - - - org.jacoco - jacoco-maven-plugin - 0.7.9 - - ${basedir}/target/coverage-reports/jacoco-unit.exec - ${basedir}/target/coverage-reports/jacoco-unit.exec - - - - jacoco-initialize - - prepare-agent - - - - jacoco-site - test - - report - - - - - - org.eluder.coveralls - coveralls-maven-plugin - 4.0.0 - - - - - - - release - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.5.1 - - - default-deploy - deploy - - deploy - - - - - nexus-releases - https://oss.sonatype.org/ - false - true - - - - - - - - diff --git a/opensrp-common/src/main/java/org/opensrp/common/AddressField.java b/opensrp-common/src/main/java/org/opensrp/common/AddressField.java deleted file mode 100644 index a684c6e629..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/AddressField.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.opensrp.common; - -public enum AddressField { - HOUSE_NUMBER, - STREET, - REGION, - LOCALITY, - SECTOR, - AREA, - MUNICIPALITY, - LANDMARK -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/AllConstants.java b/opensrp-common/src/main/java/org/opensrp/common/AllConstants.java deleted file mode 100644 index a5908e5319..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/AllConstants.java +++ /dev/null @@ -1,410 +0,0 @@ -package org.opensrp.common; - -public class AllConstants { - - public static final String OPENSRP_FORM_DATABASE_CONNECTOR = "opensrpFormDatabaseConnector"; - - public static final String OPENSRP_DATABASE_CONNECTOR = "opensrpDatabaseConnector"; - - public static final String OPENSRP_MCTS_DATABASE_CONNECTOR = "opensrpMCTSDatabaseConnector"; - - public static final String SPACE = " "; - - public static final String BOOLEAN_TRUE_VALUE = "true"; - - public static final String BOOLEAN_FALSE_VALUE = "false"; - - public static final String AUTO_CLOSE_PNC_CLOSE_REASON = "Auto Close PNC"; - - public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; - - public static final String EMPTY_STRING = ""; - - public static final String OPENSRP_ERRORTRACE_DATABASE = "opensrpErrorTraceDatabaseConnector"; - - public static final int CLIENTS_FETCH_BATCH_SIZE = 100; - - public static class BaseEntity { - - public static final String BASE_ENTITY_ID = "baseEntityId"; - - public static final String ADDRESS_TYPE = "addressType"; - - public static final String START_DATE = "startDate"; - - public static final String END_DATE = "endDate"; - - public static final String LATITUDE = "latitude"; - - public static final String LONGITUTE = "longitute"; - - public static final String GEOPOINT = "geopoint"; - - public static final String POSTAL_CODE = "postalCode"; - - public static final String SUB_TOWN = "subTown"; - - public static final String TOWN = "town"; - - public static final String SUB_DISTRICT = "subDistrict"; - - public static final String COUNTY_DISTRICT = "countyDistrict"; - - public static final String CITY_VILLAGE = "cityVillage"; - - public static final String STATE_PROVINCE = "stateProvince"; - - public static final String COUNTRY = "country"; - - public static final String LAST_UPDATE = "lastEdited"; - - public static final String SERVER_VERSIOIN = "serverVersion"; - - public static final String MOTHERS_INDENTIFIER = "mother"; - - } - - public static class Client extends BaseEntity { - - public static final String FIRST_NAME = "firstName"; - - public static final String MIDDLE_NAME = "middleName"; - - public static final String LAST_NAME = "lastName"; - - public static final String BIRTH_DATE = "birthdate"; - - public static final String DEATH_DATE = "deathdate"; - - public static final String BIRTH_DATE_APPROX = "birthdateApprox"; - - public static final String DEATH_DATE_APPROX = "deathdateApprox"; - - public static final String GENDER = "gender"; - - public static final String ZEIR_ID = "zeir_id"; - - public static final String CLIENTTYPE = "clientType"; - - public static final String PROVIDERID = "providerId"; - - public static final String PAGENUMBER = "currentPageNumber"; - - public static final String PAGESIZE = "paginationCount"; - - public static final String ORDERBYFIELDNAAME = "orderByFieldName"; - - public static final String DEFAULTORDERBYFIELD = "date_created"; - - public static final String ORDERBYTYPE = "orderByType"; - - public static final String DEFAULTORDERBYTYPE = "desc"; - - public static final String SEARCHTEXT = "searchText"; - - public static final String LOCATION = "location"; - - public static final String HOUSEHOLD = "ec_household"; - - public static final String HOUSEHOLDMEMEBR = "householdMember"; - - public static final String CHILD = "ec_child"; - - public static final String ANC = "ec_woman"; - - public static final String OPENMRS_UUID_IDENTIFIER_TYPE = "OPENMRS_UUID"; - } - - public static class Event { - - public static final String FORM_SUBMISSION_ID = "formSubmissionId"; - - public static final String EVENT_TYPE = "eventType"; - - public static final String EVENT_ID = "eventId"; - - public static final String LOCATION_ID = "locationId"; - - public static final String EVENT_DATE = "eventDate"; - - public static final String PROVIDER_ID = "providerId"; - - public static final String ENTITY_TYPE = "entityType"; - - public static final String OPENMRS_UUID_IDENTIFIER_TYPE = "OPENMRS_UUID"; - - public static final String TEAM = "team"; - - public static final String TEAM_ID = "teamId"; - - public static final String MVACC_DATE_FORMAT = "dd-MM-yyyy HH:mm"; - - public static final String MVACC_UUID_IDENTIFIER_TYPE = "MVACC_UUID"; - - public static final String BIRTH_REGISTRATION = "Birth Registration"; - - public static final String SETTING_CONFIGURATIONS = "settingConfigurations"; - - } - - public static class Stock { - - public static final String IDENTIFIER = "identifier"; - - public static final String VACCINE_TYPE_ID = "vaccine_type_id"; - - public static final String TRANSACTION_TYPE = "transaction_type"; - - public static final String PROVIDERID = "providerid"; - - public static final String VALUE = "value"; - - public static final String DATE_CREATED = "date_created"; - - public static final String TO_FROM = "to_from"; - - public static final String DATE_UPDATED = "date_updated"; - - public static final String TIMESTAMP = "timeStamp"; - - public static final String TYPE = "type"; - - } - - public static class Action { - - public static final String TIMESTAMP = "timeStamp"; - - } - - public static class Form { - - public static final String ENTITY_ID = "entityId"; - - public static final String ANM_ID = "anmId"; - - public static final String FORM_NAME = "formName"; - - public static final String INSTANCE_ID = "instanceId"; - - public static final String CLIENT_VERSION = "clientVersion"; - - public static final String SERVER_VERSION = "serverVersion"; - } - - public static class HTTP { - - public static final String ACCESS_CONTROL_ALLOW_ORIGIN_HEADER = "Access-Control-Allow-Origin"; - - public static final String WWW_AUTHENTICATE_HEADER = "www-authenticate"; - } - - public static class OpenSRPEvent { - - public static final String OPENSRP_DATABASE_CONNECTOR = "opensrpDatabaseConnector"; - - public static final String OPENSRP_MCTS_DATABASE_CONNECTOR = "opensrpMCTSDatabaseConnector"; - - public static final String SPACE = " "; - - public static final String BOOLEAN_TRUE_VALUE = "true"; - - public static final String BOOLEAN_FALSE_VALUE = "false"; - - public static final String AUTO_CLOSE_PNC_CLOSE_REASON = "Auto Close PNC"; - - public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; - - public static final String EMPTY_STRING = ""; - - public static final String OPENSRP_ERRORTRACE_DATABASE = "opensrpErrorTraceDatabaseConnector"; - - public static final String FORM_SUBMISSION = "FORM_SUBMISSION"; - - public static class BaseEntity { - - public static final String BASE_ENTITY_ID = "baseEntityId"; - - public static final String ADDRESS_TYPE = "addressType"; - - public static final String START_DATE = "startDate"; - - public static final String END_DATE = "endDate"; - - public static final String LATITUDE = "latitude"; - - public static final String LONGITUTE = "longitute"; - - public static final String GEOPOINT = "geopoint"; - - public static final String POSTAL_CODE = "postalCode"; - - public static final String SUB_TOWN = "subTown"; - - public static final String TOWN = "town"; - - public static final String SUB_DISTRICT = "subDistrict"; - - public static final String COUNTY_DISTRICT = "countyDistrict"; - - public static final String CITY_VILLAGE = "cityVillage"; - - public static final String STATE_PROVINCE = "stateProvince"; - - public static final String COUNTRY = "country"; - - public static final String LAST_UPDATE = "lastEdited"; - - public static final String SERVER_VERSIOIN = "serverVersion"; - - } - - public static class Client extends BaseEntity { - - public static final String FIRST_NAME = "firstName"; - - public static final String MIDDLE_NAME = "middleName"; - - public static final String LAST_NAME = "lastName"; - - public static final String BIRTH_DATE = "birthdate"; - - public static final String DEATH_DATE = "deathdate"; - - public static final String BIRTH_DATE_APPROX = "birthdateApprox"; - - public static final String DEATH_DATE_APPROX = "deathdateApprox"; - - public static final String GENDER = "gender"; - - public static final String ZEIR_ID = "zeir_id"; - } - - public static class Event { - - public static final String FORM_SUBMISSION_ID = "formSubmissionId"; - - public static final String EVENT_TYPE = "eventType"; - - public static final String EVENT_ID = "eventId"; - - public static final String LOCATION_ID = "locationId"; - - public static final String EVENT_DATE = "eventDate"; - - public static final String PROVIDER_ID = "providerId"; - - public static final String ENTITY_TYPE = "entityType"; - - } - - public static class Action { - - public static final String TIMESTAMP = "timeStamp"; - - } - - public static class Form { - - public static final String ENTITY_ID = "entityId"; - - public static final String ANM_ID = "anmId"; - - public static final String FORM_NAME = "formName"; - - public static final String INSTANCE_ID = "instanceId"; - - public static final String CLIENT_VERSION = "clientVersion"; - - public static final String SERVER_VERSION = "serverVersion"; - } - - public static class HTTP { - - public static final String ACCESS_CONTROL_ALLOW_ORIGIN_HEADER = "Access-Control-Allow-Origin"; - - public static final String WWW_AUTHENTICATE_HEADER = "www-authenticate"; - } - - } - - public enum Config { - FORM_ENTITY_PARSER_LAST_SYNCED_FORM_SUBMISSION, FORM_ENTITY_PARSER_LAST_MIGRATED_FORM_SUBMISSION, // Used when executing data migrations - EVENTS_PARSER_LAST_PROCESSED_EVENT // Used to track last time events processed - } - - public static final String FORM_SCHEDULE_SUBJECT = "FORM-SCHEDULE"; - - public static final String EVENTS_SCHEDULE_SUBJECT = "EVENTS-SCHEDULE"; - - public static class Report { - - public static final String FORM_SUBMISSION_ID = "formSubmissionId"; - - public static final String REPORT_TYPE = "reportType"; - - public static final String REPORT_ID = "reportId"; - - public static final String LOCATION_ID = "locationId"; - - public static final String REPORT_DATE = "reportDate"; - - public static final String PROVIDER_ID = "providerId"; - - public static final int FIRST_REPORT_MONTH_OF_YEAR = 3; - - public static final int REPORTING_MONTH_START_DAY = 26; - - public static final int REPORTING_MONTH_END_DAY = 25; - - public static final double LOW_BIRTH_WEIGHT_THRESHOLD = 2.5; - - public static final int INFANT_MORTALITY_THRESHOLD_IN_YEARS = 1; - - public static final int CHILD_MORTALITY_THRESHOLD_IN_YEARS = 5; - - public static final int CHILD_EARLY_NEONATAL_MORTALITY_THRESHOLD_IN_DAYS = 7; - - public static final int CHILD_NEONATAL_MORTALITY_THRESHOLD_IN_DAYS = 28; - - public static final int CHILD_DIARRHEA_THRESHOLD_IN_YEARS = 5; - } - - public static class ReportDataParameters { - - public static final String ANM_IDENTIFIER = "anmIdentifier"; - - public static final String SERVICE_PROVIDED_DATA_TYPE = "serviceProvided"; - - public static final String ANM_REPORT_DATA_TYPE = "anmReportData"; - - public static final String SERVICE_PROVIDER_TYPE = "serviceProviderType"; - - public static final String EXTERNAL_ID = "externalId"; - - public static final String INDICATOR = "indicator"; - - public static final String SERVICE_PROVIDED_DATE = "date"; - - public static final String DRISTHI_ENTITY_ID = "dristhiEntityId"; - - public static final String VILLAGE = "village"; - - public static final String SUB_CENTER = "subCenter"; - - public static final String PHC = "phc"; - - public static final String QUANTITY = "quantity"; - - public static final String SERVICE_PROVIDER_ANM = "ANM"; - } - - public static class DHIS2Constants { - - public static final String DHIS2_TRACK_DATA_SYNCER_SUBJECT = "DHIS2 TRACK DATA SYNCER"; - - public static final String DHIS2_TRACK_DATA_SYNCER_VERSION_MARKER = "DHIS2 TRACK DATA SYNCER VERSION MARKER"; - - public static final String DHIS2_TRACK_DATA_SYNCER_VERSION_MARKER_EVENT = "DHIS2 TRACK DATA SYNCER VERSION MARKER EVENT"; - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/FormEntityConstants.java b/opensrp-common/src/main/java/org/opensrp/common/FormEntityConstants.java deleted file mode 100644 index 846472b0af..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/FormEntityConstants.java +++ /dev/null @@ -1,79 +0,0 @@ - -package org.opensrp.common; - -import java.text.SimpleDateFormat; - -/** - * Mappings in OpenSRP for OpenMRS entities and properties - */ -public class FormEntityConstants { - - public static final SimpleDateFormat FORM_DATE = new SimpleDateFormat("yyyy-MM-dd"); - - public enum FieldType { - concept, - person, - person_address, - person_attribute, - person_identifier, - } - - public enum FieldDataType { - - } - - public interface FormEntity { - - public String entity(); - - public String entityId(); - - } - - public enum Person implements FormEntity { - first_name, - middle_name, - last_name, - gender, - birthdate, - birthdate_estimated, - dead, - deathdate, - deathdate_estimated; - - public String entity() { - return "person"; - } - - public String entityId() { - return this.name(); - } - } - - public enum PersonAddress implements FormEntity { - ; - - public String entity() { - return "person_address"; - } - - public String entityId() { - return this.name(); - } - } - - public enum Encounter implements FormEntity { - encounter_date, - location_id, - encounter_start, - encounter_end; - - public String entity() { - return "encounter"; - } - - public String entityId() { - return this.name(); - } - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/Gender.java b/opensrp-common/src/main/java/org/opensrp/common/Gender.java deleted file mode 100644 index c85b7a0d91..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/Gender.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.opensrp.common; - -/** Gender or Sex */ -public enum Gender { - MALE, - FEMALE, - /** Male-to-Female */ - MTF, - /** Female-to-Male */ - FTM, - /** Unknown or Unspecified Gender */ - UNKNOWN -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/audit/AuditMessage.java b/opensrp-common/src/main/java/org/opensrp/common/audit/AuditMessage.java deleted file mode 100644 index e47e1b6be2..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/audit/AuditMessage.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.opensrp.common.audit; - -import java.util.Map; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.joda.time.DateTime; - -public final class AuditMessage implements Comparable { - - private final DateTime time; - - private final long messageIndex; - - private final AuditMessageType type; - - private final Map extraData; - - public AuditMessage(DateTime time, long messageIndex, AuditMessageType type, Map data) { - this.time = time; - this.messageIndex = messageIndex; - this.type = type; - this.extraData = data; - } - - public AuditMessageType type() { - return type; - } - - public long index() { - return messageIndex; - } - - public Map data() { - return extraData; - } - - public DateTime time() { - return time; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - AuditMessage that = (AuditMessage) o; - - return messageIndex == that.messageIndex; - } - - @Override - public int hashCode() { - return (int) (messageIndex ^ (messageIndex >>> 32)); - } - - @Override - public int compareTo(AuditMessage other) { - return Long.valueOf(messageIndex - other.messageIndex).intValue(); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/audit/AuditMessageType.java b/opensrp-common/src/main/java/org/opensrp/common/audit/AuditMessageType.java deleted file mode 100644 index 59fb085c42..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/audit/AuditMessageType.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.opensrp.common.audit; - -import java.util.Arrays; -import java.util.List; - -public enum AuditMessageType { - NORMAL("data"), - FORM_SUBMISSION("formId", "formType", "formData"), - SMS("recipient", "message", "smsIsSent"),; - - private final List supportedFields; - - AuditMessageType(String... supportedFields) { - this.supportedFields = Arrays.asList(supportedFields); - } - - public boolean supports(String key) { - return supportedFields.contains(key); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/audit/Auditor.java b/opensrp-common/src/main/java/org/opensrp/common/audit/Auditor.java deleted file mode 100644 index 584107ffc0..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/audit/Auditor.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.opensrp.common.audit; - -import static java.util.Collections.binarySearch; -import static org.opensrp.common.audit.AuditMessageType.NORMAL; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.locks.ReentrantLock; - -import org.joda.time.DateTime; -import org.motechproject.util.DateUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - -@Scope("singleton") -@Component -public class Auditor { - - private List messages; - - private final int numberOfAuditMessagesToHoldOnTo; - - private static long messageIndex = DateTime.now().getMillis(); - - private static ReentrantLock lock = new ReentrantLock(); - - private static Logger logger = LoggerFactory.getLogger(Auditor.class.toString()); - - @Autowired - public Auditor(@Value("#{opensrp['number.of.audit.messages']}") int numberOfAuditMessagesToHoldOnTo) { - this.messages = new ArrayList<>(); - this.numberOfAuditMessagesToHoldOnTo = numberOfAuditMessagesToHoldOnTo; - } - - public AuditMessageBuilder audit(AuditMessageType type) { - return new AuditMessageBuilder(this, type); - } - - public List messagesSince(long messageIndex) { - if (messageIndex <= 0) { - return messages; - } - - int index = binarySearch(messages, new AuditMessage(DateUtil.now(), messageIndex, NORMAL, null)); - int position = Math.abs(index + 1); - - if (position >= messages.size()) { - return Collections.emptyList(); - } - - return messages.subList(position, messages.size()); - } - - private void prune() { - if (messages.size() > numberOfAuditMessagesToHoldOnTo) { - messages.remove(0); - } - } - - private void createAuditMessage(AuditMessageType messageType, Map data) { - lock.lock(); - try { - AuditMessage auditMessage = new AuditMessage(DateUtil.now(), messageIndex, messageType, data); - messages.add(auditMessage); - messageIndex++; - logger.debug(MessageFormat.format("Added message: {0}", auditMessage)); - prune(); - } - finally { - lock.unlock(); - } - } - - public static class AuditMessageBuilder { - - private final Auditor auditor; - - private final AuditMessageType type; - - private Map extraData; - - public AuditMessageBuilder(Auditor auditor, AuditMessageType type) { - this.auditor = auditor; - this.type = type; - this.extraData = new HashMap<>(); - } - - public AuditMessageBuilder with(String key, String value) { - if (!type.supports(key)) { - throw new ForbiddenFieldInAuditMessage(type, key, value); - } - extraData.put(key, value); - return this; - } - - public void done() { - auditor.createAuditMessage(type, extraData); - } - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/audit/ForbiddenFieldInAuditMessage.java b/opensrp-common/src/main/java/org/opensrp/common/audit/ForbiddenFieldInAuditMessage.java deleted file mode 100644 index 635fa1c715..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/audit/ForbiddenFieldInAuditMessage.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.opensrp.common.audit; - -import static java.text.MessageFormat.format; - -public class ForbiddenFieldInAuditMessage extends RuntimeException { - - public ForbiddenFieldInAuditMessage(AuditMessageType type, String key, String value) { - super(format("Not allowed to add field: {0} => {1} for audit message of type: {2}", key, value, type)); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/domain/ANMIndicatorSummary.java b/opensrp-common/src/main/java/org/opensrp/common/domain/ANMIndicatorSummary.java deleted file mode 100644 index f3dfa42f1a..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/domain/ANMIndicatorSummary.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.opensrp.common.domain; - -import java.util.List; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class ANMIndicatorSummary { - - @JsonProperty - private final String indicator; - - @JsonProperty - private final String annualTarget; - - @JsonProperty - private final List monthlySummaries; - - public ANMIndicatorSummary(String indicator, String annualTarget, List monthlySummaries) { - this.indicator = indicator; - this.annualTarget = annualTarget; - this.monthlySummaries = monthlySummaries; - } - - public List monthlySummaries() { - return monthlySummaries; - } - - public String annualTarget() { - return annualTarget; - } - - public String indicator() { - return indicator; - } - - @Override - final public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - final public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/domain/ANMReport.java b/opensrp-common/src/main/java/org/opensrp/common/domain/ANMReport.java deleted file mode 100644 index 41bad42965..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/domain/ANMReport.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.opensrp.common.domain; - -import java.util.List; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -import net.jcip.annotations.Immutable; - -@Immutable -public class ANMReport { - - @JsonProperty - private List summaries; - - @JsonProperty - private String anmIdentifier; - - public ANMReport() { - } - - public ANMReport(String anmIdentifier, List summaries) { - this.anmIdentifier = anmIdentifier; - this.summaries = summaries; - } - - public List summaries() { - return summaries; - } - - public String anmIdentifier() { - return anmIdentifier; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/domain/Caste.java b/opensrp-common/src/main/java/org/opensrp/common/domain/Caste.java deleted file mode 100644 index 925c810869..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/domain/Caste.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.opensrp.common.domain; - -import static org.apache.commons.lang.StringUtils.equalsIgnoreCase; - -public enum Caste { - SC("sc", Indicator.FP_OCP_SC), - ST("st", Indicator.FP_OCP_ST), - OTHERS("c_others", Indicator.FP_OCP_CASTE_OTHERS), - NOT_SPECIFIED("", null); - - private String name; - - private Indicator indicator; - - private Caste(String name, Indicator indicator) { - this.name = name; - this.indicator = indicator; - } - - public static Caste from(String name) { - Caste[] castes = values(); - for (Caste caste : castes) { - if (equalsIgnoreCase(caste.name, name)) { - return caste; - } - } - return NOT_SPECIFIED; - } - - public Indicator indicator() { - return indicator; - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/domain/EconomicStatus.java b/opensrp-common/src/main/java/org/opensrp/common/domain/EconomicStatus.java deleted file mode 100644 index 7b879257b0..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/domain/EconomicStatus.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.opensrp.common.domain; - -import static org.apache.commons.lang.StringUtils.equalsIgnoreCase; - -public enum EconomicStatus { - BPL("bpl", Indicator.FP_FEMALE_STERILIZATION_BPL), - APL("apl", Indicator.FP_FEMALE_STERILIZATION_APL), - NOT_SPECIFIED("", null); - - private String name; - - private Indicator indicator; - - private EconomicStatus(String name, Indicator indicator) { - this.name = name; - this.indicator = indicator; - } - - public static EconomicStatus from(String name) { - EconomicStatus[] economicStatusValues = values(); - for (EconomicStatus economicStatus : economicStatusValues) { - if (equalsIgnoreCase(economicStatus.name, name)) { - return economicStatus; - } - } - return NOT_SPECIFIED; - } - - public Indicator indicator() { - return indicator; - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/domain/Indicator.java b/opensrp-common/src/main/java/org/opensrp/common/domain/Indicator.java deleted file mode 100644 index fc6005196d..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/domain/Indicator.java +++ /dev/null @@ -1,238 +0,0 @@ -package org.opensrp.common.domain; - -import static org.apache.commons.lang.StringUtils.equalsIgnoreCase; - -public enum Indicator { - //FP Indicators - FP_OCP("OCP"), - FP_IUD("IUD"), - FP_MALE_STERILIZATION("MALE_STERILIZATION"), - FP_FEMALE_STERILIZATION("FEMALE_STERILIZATION"), - FP_CONDOM("CONDOM"), - FP_DMPA("DMPA"), - FP_OCP_ST("OCP_ST"), - FP_OCP_SC("OCP_SC"), - FP_OCP_CASTE_OTHERS("OCP_C_OTHERS"), - FP_TRADITIONAL_METHOD("FP_TRADITIONAL"), - FP_LAM("LAM"), - FP_FEMALE_STERILIZATION_APL("FS_APL"), - FP_FEMALE_STERILIZATION_BPL("FS_BPL"), - CONDOM_QTY("CONDOM_QTY"), - - //ANC Indicators - ANC("ANC"), - ANC_BEFORE_12_WEEKS("ANC_LT_12"), - ANC_AFTER_12_WEEKS("ANC_GT_12"), - ANC4("ANC4"), - TT1("TT1"), - TT2("TT2"), - TTB("TTB"), - SUB_TT("SUB_TT"), - - MTP_LESS_THAN_12_WEEKS("MTP_LT_12"), - MTP_GREATER_THAN_12_WEEKS("MTP_GT_12"), - SPONTANEOUS_ABORTION("SPONTANEOUS_ABORTION"), - - MOTHER_MORTALITY("MM"), - MMA("MMA"), - MMD("MMD"), - MMP("MMP"), - - //Delivery Outcome Indicators - LIVE_BIRTH("LIVE_BIRTH"), - STILL_BIRTH("STILL_BIRTH"), - DELIVERY("DELIVERY"), - INSTITUTIONAL_DELIVERY("INSTITUTIONAL_DELIVERY"), - D_HOM("D_HOM"), - D_SC("D_SC"), - D_PHC("D_PHC"), - D_CHC("D_CHC"), - D_SDH("D_SDH"), - D_DH("D_DH"), - D_PRI("D_PRI"), - CESAREAN("CESAREAN"), - CESAREAN_PRIVATE_FACILITY("CESAREAN_PRI"), - CESAREAN_GOVERNMENT_FACILITY("CESAREAN_GOV"), - - //PNC Indicators - PNC3("PNC3"), - - //Child Birth Indicators - LBW("LBW"), - BF_POST_BIRTH("BF_POST_BIRTH"), - WEIGHED_AT_BIRTH("WEIGHED_AT_BIRTH"), - INFANT_REGISTRATION("INFANT_REG"), - MALE_LIVE_BIRTH("M_LIVE_BIRTH"), - FEMALE_LIVE_BIRTH("F_LIVE_BIRTH"), - - CHILD_DIARRHEA("CHILD_DIARRHEA"), - - //Child Immunization Indicators - DPT("DPT"), - PENTAVALENT3_OR_OPV3("PENTAVALENT3_OPV3"), - DPT_BOOSTER_OR_OPV_BOOSTER("DPTB_OPVB"), - DPT_BOOSTER2("DPT_BOOSTER_2"), - HEP("HEP"), - OPV("OPV"), - MEASLES("MEASLES"), - BCG("BCG"), - PENT1("PENT1"), - PENT2("PENT2"), - PENT3("PENT3"), - MMR("MMR"), - JE("JE"), - OPV3("OPV3"), - OPV_BOOSTER("OPV_BOOSTER"), - DPT_BOOSTER1("DPT_BOOSTER_1"), - - //Vitamin A Indicators - VIT_A_1("VIT_A_1"), - VIT_A_1_FOR_FEMALE_CHILD("F_VIT_A_1"), - VIT_A_1_FOR_MALE_CHILD("M_VIT_A_1"), - VIT_A_2("VIT_A_2"), - VIT_A_2_FOR_FEMALE_CHILD("F_VIT_A_2"), - VIT_A_2_FOR_MALE_CHILD("M_VIT_A_2"), - VIT_A_5_FOR_FEMALE_CHILD("F_VIT_A_5"), - VIT_A_5_FOR_MALE_CHILD("M_VIT_A_5"), - VIT_A_9_FOR_FEMALE_CHILD("F_VIT_A_9"), - VIT_A_9_FOR_MALE_CHILD("M_VIT_A_9"), - VIT_A_FOR_FEMALE("F_VIT_A"), - VIT_A_FOR_MALE("M_VIT_A"), - - //Child Mortality Indicators - NM("NM"), - LNM("LNM"), - ENM("ENM"), - INFANT_MORTALITY("IM"), - CHILD_MORTALITY_DUE_TO_DIARRHEA("CMD"), - CHILD_MORTALITY("UFM"), - - //Infant Balance - INFANT_BALANCE_TOTAL("IBT"), - INFANT_BALANCE_ON_HAND("IB_OH"), - INFANT_LEFT("INFANT_LEFT"), - INFANT_BALANCE_TURNING_ONE_YEAR("IB_1Y"), - INFANT_BALANCE_OA_CHILDREN("IB_OA"), - INFANT_BALANCE_BALANCE("IB_BAL"), - INFANT_BALANCE_LESS_THAN_ONE_YEAR("IB_LT_1Y"), - INFANT_BALANCE_LESS_THAN_FIVE_YEAR("IB_LT_5Y"), - - //NRHM Indicators - NRHM_JSY_REG("NRHM_JSY_REG"), - NRHM_ANC3("NRHM_ANC3"), - NRHM_SBA("NRHM_SBA"), - NRHM_NON_SBA("NRHM_NON_SBA"), - NRHM_HB_LEVEL("NRHM_HB_LEVEL"), - NRHM_PNC24("NRHM_PNC24"), - NRHM_SC_DEL("NRHM_SC_DEL"), - NRHM_48HRS("NRHM_48HRS"), - NRHM_PNC_V_2D("NRHM_PNC_V_2D"), - NRHM_PNC_V_14D("NRHM_PNC_V_14D"), - NRHM_HYPERTENSION("NRHM_HYPERTENSION"), - NRHM_LIVE_BIRTH("NRHM_LIVE_BIRTH"), - NRHM_STILL_BIRTH("NRHM_STILL_BIRTH"), - NRHM_ANC("NRHM_ANC"), - NRHM_ANC_LT_12("NRHM_ANC_LT_12"), - NRHM_TT1("NRHM_TT1"), - NRHM_SUB_TT("NRHM_SUB_TT"), - NRHM_BF_POST_BIRTH("NRHM_BF_POST_BIRTH"), - NRHM_SPONTANEOUS_ABORTION("NRHM_SPONTANEOUS_ABORTION"), - - //NRHM Child Immunization Indicators - NRHM_BCG_1YR("NRHM_BCG_1YR"), - NRHM_PENT_1_1YR("NRHM_PENT_1_1YR"), - NRHM_PENT_2_1YR("NRHM_PENT_2_1YR"), - NRHM_PENT_3_1YR("NRHM_PENT_3_1YR"), - NRHM_OPV_0_1YR("NRHM_OPV_0_1YR"), - NRHM_OPV_1_1YR("NRHM_OPV_1_1YR"), - NRHM_OPV_2_1YR("NRHM_OPV_2_1YR"), - NRHM_OPV_3_1YR("NRHM_OPV_3_1YR"), - NRHM_HEPB_0_1YR("NRHM_HEPB_0_1YR"), - NRHM_MEASLES_1YR("NRHM_MEASLES_1YR"), - NRHM_MEASLES_BOOSTER_1YR("NRHM_MEASLES_BOOSTER_1YR"), - NRHM_M_ALL_VAC("NRHM_M_ALL_VAC"), - NRHM_F_ALL_VAC("NRHM_F_ALL_VAC"), - NRHM_ALL_VAC("NRHM_ALL_VAC"), - NRHM_DPT("NRHM_DPT"), - NRHM_OPV("NRHM_OPV"), - NRHM_M_ALL_VACC_2Y("NRHM_M_ALL_VACC_2Y"), - NRHM_F_ALL_VACC_2Y("NRHM_F_ALL_VACC_2Y"), - NRHM_ALL_VACC_2Y("NRHM_ALL_VACC_2Y"), - NRHM_MMR("NRHM_MMR"), - - NRHM_IMMUNIZATION_DEATH("NRHM_IMMUNIZATION_DEATH"), - NRHM_VIT_A_1("NRHM_VIT_A_1"), - NRHM_VIT_A_5_3YR("NRHM_VIT_A_5_3YR"), - NRHM_VIT_A_9_3YR("NRHM_VIT_A_9_3YR"), - NRHM_DPTBOOSTER_2_5YR("NRHM_DPTBOOSTER_2_5YR"), - - //Economic status indicators - ANCS_AND_PNCS_WITH_BPL("ANCS_AND_PNCS_WITH_BPL"), - - //Family planning Indicators - NRHM_IUDREM("NRHM_IUDREM"), - NRHM_OCP_STRIPS("NRHM_OCP_STRIPS"), - NRHM_CENTCHROMAN_PILLS("NRHM_CENTCHROMAN_PILLS"), - NRHM_ECP("NRHM_ECP"), - - //FP complication Indicators - NRHM_M_S_COMP("NRHM_M_S_COMP"), - NRHM_F_S_COMP("NRHM_F_S_COMP"), - NRHM_S_COMP("NRHM_S_COMP"), - - //FP failure Indicators - NRHM_M_S_FAILURE("NRHM_M_S_FAILURE"), - NRHM_F_S_FAILURE("NRHM_F_S_FAILURE"), - NRHM_S_FAILURE("NRHM_S_FAILURE"), - - //FP Death Indicators - NRHM_M_S_DEATH("NRHM_M_S_DEATH"), - NRHM_F_S_DEATH("NRHM_F_S_DEATH"), - NRHM_S_DEATH("NRHM_S_DEATH"), - - NRHM_IFA_100("NRHM_IFA_100"), - - //Child disease Indicators - NRHM_MEASLES("NRHM_MEASLES"), - NRHM_DIARRHEA_DEHYDRATION("NRHM_DIARRHEA_DEHYDRATION"), - NRHM_MALARIA("NRHM_MALARIA"), - - //Infant Death Indicators - NRHM_ID_24HRS("NRHM_ID_24HRS"), - NRHM_ID_SEPSIS("NRHM_ID_SEPSIS"), - NRHM_ID_ASPHYXIA("NRHM_ID_ASPHYXIA"), - NRHM_ID_LBW("NRHM_ID_LBW"), - NRHM_ID_PNEUMONIA("NRHM_ID_PNEUMONIA"), - NRHM_ID_DIARRHEA("NRHM_ID_DIARRHEA"), - NRHM_ID_FEVER_RELATED("NRHM_ID_FEVER_RELATED"), - NRHM_ID_MEASLES("NRHM_ID_MEASLES"), - NRHM_ID_OTHERS("NRHM_ID_OTHERS"), - - // Maternal Death Indicators - NRHM_MD_ABORTION("NRHM_MD_ABORTION"), - NRHM_MD_LABOR("NRHM_MD_LABOR"), - NRHM_MD_FITS("NRHM_MD_FITS"), - NRHM_MD_BLEEDING("NRHM_MD_BLEEDING"), - NRHM_MD_H_FEVER("NRHM_MD_H_FEVER"), - NRHM_MD_OTHER("NRHM_MD_OTHER"); - - private String value; - - Indicator(String value) { - this.value = value; - } - - public String value() { - return value; - } - - public static Indicator from(String name) { - Indicator[] indicators = values(); - for (Indicator indicator : indicators) { - if (equalsIgnoreCase(indicator.value(), name)) { - return indicator; - } - } - return null; - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/domain/Location.java b/opensrp-common/src/main/java/org/opensrp/common/domain/Location.java deleted file mode 100644 index c0b0d43953..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/domain/Location.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.opensrp.common.domain; - -public class Location { - - private final String village; - - private final String subCenter; - - private final String phc; - - public Location(String village, String subCenter, String phc) { - this.village = village; - this.subCenter = subCenter; - this.phc = phc; - } - - public String village() { - return village; - } - - public String subCenter() { - return subCenter; - } - - public String phc() { - return phc; - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/domain/MonthSummary.java b/opensrp-common/src/main/java/org/opensrp/common/domain/MonthSummary.java deleted file mode 100644 index b1b2158b75..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/domain/MonthSummary.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.opensrp.common.domain; - -import java.util.List; - -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public final class MonthSummary { - - @JsonProperty - private final String month; - - @JsonProperty - private final String year; - - @JsonProperty - private final String currentProgress; - - @JsonProperty - private final String aggregatedProgress; - - @JsonProperty - private final List externalIDs; - - public MonthSummary(String month, String year, String currentProgress, String aggregatedProgress, - List externalIDs) { - this.month = month; - this.year = year; - this.currentProgress = currentProgress; - this.aggregatedProgress = aggregatedProgress; - this.externalIDs = externalIDs; - } - - public String month() { - return month; - } - - public String year() { - return year; - } - - public String currentProgress() { - return currentProgress; - } - - public String aggregatedProgress() { - return aggregatedProgress; - } - - public List externalIDs() { - return externalIDs; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (!(o instanceof MonthSummary)) - return false; - - MonthSummary that = (MonthSummary) o; - - if (aggregatedProgress != null ? !aggregatedProgress.equals(that.aggregatedProgress) - : that.aggregatedProgress != null) - return false; - if (currentProgress != null ? !currentProgress.equals(that.currentProgress) : that.currentProgress != null) - return false; - if (externalIDs != null ? !externalIDs.equals(that.externalIDs) : that.externalIDs != null) - return false; - if (month != null ? !month.equals(that.month) : that.month != null) - return false; - if (year != null ? !year.equals(that.year) : that.year != null) - return false; - - return true; - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/domain/ReportDataDeleteRequest.java b/opensrp-common/src/main/java/org/opensrp/common/domain/ReportDataDeleteRequest.java deleted file mode 100644 index ddf28641be..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/domain/ReportDataDeleteRequest.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.opensrp.common.domain; - -import static org.opensrp.common.AllConstants.ReportDataParameters.ANM_REPORT_DATA_TYPE; -import static org.opensrp.common.AllConstants.ReportDataParameters.SERVICE_PROVIDED_DATA_TYPE; - -import java.io.Serializable; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.http.annotation.Immutable; -import org.codehaus.jackson.annotate.JsonProperty; - -@Immutable -public class ReportDataDeleteRequest implements Serializable { - - @JsonProperty - private String type; - - @JsonProperty - private String dristhiEntityId; - - public ReportDataDeleteRequest() { - } - - public ReportDataDeleteRequest(String type) { - this.type = type; - } - - private static ReportDataDeleteRequest buildReportDataRequest(String type, String dristhiEntityId) { - return new ReportDataDeleteRequest().withType(type).withDristhiEntityId(dristhiEntityId); - } - - public static ReportDataDeleteRequest serviceProvidedDataDeleteRequest(String dristhiEntityId) { - return buildReportDataRequest(SERVICE_PROVIDED_DATA_TYPE, dristhiEntityId); - } - - public static ReportDataDeleteRequest anmReportDataDeleteRequest(String dristhiEntityId) { - return buildReportDataRequest(ANM_REPORT_DATA_TYPE, dristhiEntityId); - } - - public String type() { - return this.type; - } - - public String dristhiEntityId() { - return this.dristhiEntityId; - } - - public ReportDataDeleteRequest withType(String type) { - this.type = type; - return this; - } - - public ReportDataDeleteRequest withDristhiEntityId(String dristhiEntityId) { - this.dristhiEntityId = dristhiEntityId; - return this; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - @Override - public final boolean equals(Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/domain/ReportDataUpdateRequest.java b/opensrp-common/src/main/java/org/opensrp/common/domain/ReportDataUpdateRequest.java deleted file mode 100644 index 0a22e210b4..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/domain/ReportDataUpdateRequest.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.opensrp.common.domain; - -import java.io.Serializable; -import java.util.List; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.http.annotation.Immutable; -import org.codehaus.jackson.annotate.JsonProperty; - -@Immutable -public class ReportDataUpdateRequest implements Serializable { - - @JsonProperty - private String startDate; - - @JsonProperty - private String endDate; - - @JsonProperty - private String indicator; - - @JsonProperty - private String type; - - @JsonProperty - private List reportingData; - - public ReportDataUpdateRequest() { - } - - public ReportDataUpdateRequest(String type) { - this.type = type; - } - - public static ReportDataUpdateRequest buildReportDataRequest(String type, Indicator indicator, - String reportingMonthStartDate, String reportingMonthEndDate, List serviceProvidedData) { - return new ReportDataUpdateRequest().withType(type).withReportingData(serviceProvidedData) - .withStartDate(reportingMonthStartDate).withEndDate(reportingMonthEndDate).withIndicator(indicator.value()); - } - - public String indicator() { - return this.indicator; - } - - public String startDate() { - return this.startDate; - } - - public String endDate() { - return this.endDate; - } - - public String type() { - return this.type; - } - - public List reportingData() { - return this.reportingData; - } - - public ReportDataUpdateRequest withIndicator(String indicator) { - this.indicator = indicator; - return this; - } - - public ReportDataUpdateRequest withStartDate(String startDate) { - this.startDate = startDate; - return this; - } - - public ReportDataUpdateRequest withType(String type) { - this.type = type; - return this; - } - - public ReportDataUpdateRequest withEndDate(String endDate) { - this.endDate = endDate; - return this; - } - - public ReportDataUpdateRequest withReportingData(List reportingData) { - this.reportingData = reportingData; - return this; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - @Override - public final boolean equals(Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/domain/ReportMonth.java b/opensrp-common/src/main/java/org/opensrp/common/domain/ReportMonth.java deleted file mode 100644 index 03deff0c48..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/domain/ReportMonth.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.opensrp.common.domain; - -import static org.opensrp.common.AllConstants.Report.FIRST_REPORT_MONTH_OF_YEAR; -import static org.opensrp.common.AllConstants.Report.REPORTING_MONTH_END_DAY; -import static org.opensrp.common.AllConstants.Report.REPORTING_MONTH_START_DAY; - -import java.util.Date; - -import org.joda.time.LocalDate; -import org.opensrp.common.util.DateUtil; -import org.springframework.stereotype.Component; - -@Component -public class ReportMonth { - - private static final int JANUARY = 1; - - private static final int DECEMBER = 12; - - public Date startDateOfReportingYear() { - int reportingYear = reportingYear(); - return new LocalDate().withDayOfMonth(REPORTING_MONTH_START_DAY).withMonthOfYear(FIRST_REPORT_MONTH_OF_YEAR) - .withYear(reportingYear).toDate(); - } - - public int reportingYear() { - LocalDate now = DateUtil.today(); - LocalDate beginningOfReportingYear = DateUtil.today().withMonthOfYear(FIRST_REPORT_MONTH_OF_YEAR) - .withDayOfMonth(REPORTING_MONTH_START_DAY); - return now.isBefore(beginningOfReportingYear) ? previousYear(now) : now.getYear(); - } - - public LocalDate startDateOfNextReportingMonth(LocalDate date) { - if (date.getDayOfMonth() < REPORTING_MONTH_START_DAY) { - return new LocalDate(date.getYear(), date.getMonthOfYear(), REPORTING_MONTH_START_DAY); - } - if (date.getMonthOfYear() == DECEMBER) { - return new LocalDate(date.plusYears(1).getYear(), JANUARY, REPORTING_MONTH_START_DAY); - } - return new LocalDate(date.getYear(), date.plusMonths(1).getMonthOfYear(), REPORTING_MONTH_START_DAY); - } - - public LocalDate endDateOfReportingMonthGivenStartDate(LocalDate startDate) { - return startDate.plusMonths(1).minusDays(1); - } - - public LocalDate startOfCurrentReportMonth(LocalDate date) { - if (date.getDayOfMonth() >= REPORTING_MONTH_START_DAY) { - return new LocalDate(date.getYear(), date.getMonthOfYear(), REPORTING_MONTH_START_DAY); - } - if (date.getMonthOfYear() == JANUARY) { - return new LocalDate(previousYear(date), DECEMBER, REPORTING_MONTH_START_DAY); - } - return new LocalDate(date.getYear(), previousMonth(date), REPORTING_MONTH_START_DAY); - } - - public LocalDate endOfCurrentReportMonth(LocalDate date) { - if (date.getDayOfMonth() > REPORTING_MONTH_END_DAY) { - if (date.getMonthOfYear() == DECEMBER) { - return new LocalDate(nextYear(date), JANUARY, REPORTING_MONTH_END_DAY); - } else { - return new LocalDate(date.getYear(), nextMonth(date), REPORTING_MONTH_END_DAY); - } - } else { - return new LocalDate(date.getYear(), date.getMonthOfYear(), REPORTING_MONTH_END_DAY); - } - } - - public boolean isDateWithinCurrentReportMonth(LocalDate lastReportedDate) { - return areDatesBelongToSameReportingMonth(lastReportedDate, DateUtil.today()); - } - - private int previousMonth(LocalDate today) { - return today.getMonthOfYear() - 1; - } - - private int nextMonth(LocalDate today) { - return today.getMonthOfYear() + 1; - } - - private int previousYear(LocalDate today) { - return today.getYear() - 1; - } - - private int nextYear(LocalDate today) { - return today.getYear() + 1; - } - - public int reportingMonth(LocalDate date) { - return endOfCurrentReportMonth(date).getMonthOfYear(); - } - - public int reportingYear(LocalDate date) { - return endOfCurrentReportMonth(date).getYear(); - } - - public boolean areDatesBelongToSameReportingMonth(LocalDate date, LocalDate anotherDate) { - return !(date.isBefore(startOfCurrentReportMonth(anotherDate)) - || date.isAfter(endOfCurrentReportMonth(anotherDate))); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/domain/ReportingData.java b/opensrp-common/src/main/java/org/opensrp/common/domain/ReportingData.java deleted file mode 100644 index 18987d301c..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/domain/ReportingData.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.opensrp.common.domain; - -import static org.apache.commons.lang.StringUtils.isBlank; -import static org.opensrp.common.AllConstants.ReportDataParameters.ANM_IDENTIFIER; -import static org.opensrp.common.AllConstants.ReportDataParameters.ANM_REPORT_DATA_TYPE; -import static org.opensrp.common.AllConstants.ReportDataParameters.DRISTHI_ENTITY_ID; -import static org.opensrp.common.AllConstants.ReportDataParameters.EXTERNAL_ID; -import static org.opensrp.common.AllConstants.ReportDataParameters.INDICATOR; -import static org.opensrp.common.AllConstants.ReportDataParameters.PHC; -import static org.opensrp.common.AllConstants.ReportDataParameters.QUANTITY; -import static org.opensrp.common.AllConstants.ReportDataParameters.SERVICE_PROVIDED_DATA_TYPE; -import static org.opensrp.common.AllConstants.ReportDataParameters.SERVICE_PROVIDED_DATE; -import static org.opensrp.common.AllConstants.ReportDataParameters.SERVICE_PROVIDER_ANM; -import static org.opensrp.common.AllConstants.ReportDataParameters.SERVICE_PROVIDER_TYPE; -import static org.opensrp.common.AllConstants.ReportDataParameters.SUB_CENTER; -import static org.opensrp.common.AllConstants.ReportDataParameters.VILLAGE; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.http.annotation.Immutable; -import org.codehaus.jackson.annotate.JsonProperty; - -@Immutable -public class ReportingData implements Serializable { - - private static final long serialVersionUID = 454645765753L; - - @JsonProperty - private String type; - - @JsonProperty - private Map data; - - public static ReportingData serviceProvidedData(String anmIdentifier, String externalId, Indicator indicator, - String date, Location location, String dristhiEntityId) { - return new ReportingData(SERVICE_PROVIDED_DATA_TYPE).with(ANM_IDENTIFIER, anmIdentifier) - .with(INDICATOR, indicator.value()).with(EXTERNAL_ID, externalId).with(VILLAGE, location.village()) - .with(SUB_CENTER, location.subCenter()).with(PHC, location.phc()).with(SERVICE_PROVIDED_DATE, date) - .with(DRISTHI_ENTITY_ID, dristhiEntityId).with(SERVICE_PROVIDER_TYPE, SERVICE_PROVIDER_ANM); - } - - public static ReportingData anmReportData(String anmIdentifier, String externalId, Indicator indicator, String date) { - return new ReportingData(ANM_REPORT_DATA_TYPE).with(ANM_IDENTIFIER, anmIdentifier).with(INDICATOR, indicator.value()) - .with(EXTERNAL_ID, externalId).with(SERVICE_PROVIDED_DATE, date); - } - - private ReportingData() { - } - - public ReportingData(String type) { - this.type = type; - data = new HashMap<>(); - } - - public ReportingData(String type, Map data) { - this.type = type; - this.data = data; - } - - public ReportingData with(String key, String value) { - data.put(key, value); - return this; - } - - public ReportingData withQuantity(String quantity) { - data.put(QUANTITY, quantity); - return this; - } - - public String get(String key) { - return data.get(key); - } - - public String type() { - return type; - } - - public ArrayList getMissingReportDataForANMReport() { - ArrayList missingData = new ArrayList(); - addToMissingDataIfFieldValueIsMissing(ANM_IDENTIFIER, missingData); - addToMissingDataIfFieldValueIsMissing(EXTERNAL_ID, missingData); - addToMissingDataIfFieldValueIsMissing(INDICATOR, missingData); - addToMissingDataIfFieldValueIsMissing(SERVICE_PROVIDED_DATE, missingData); - return missingData; - } - - public ArrayList getMissingReportDataForServiceProvided() { - ArrayList missingData = new ArrayList(); - addToMissingDataIfFieldValueIsMissing(ANM_IDENTIFIER, missingData); - addToMissingDataIfFieldValueIsMissing(SERVICE_PROVIDER_TYPE, missingData); - addToMissingDataIfFieldValueIsMissing(EXTERNAL_ID, missingData); - addToMissingDataIfFieldValueIsMissing(INDICATOR, missingData); - addToMissingDataIfFieldValueIsMissing(SERVICE_PROVIDED_DATE, missingData); - addToMissingDataIfFieldValueIsMissing(VILLAGE, missingData); - addToMissingDataIfFieldValueIsMissing(SUB_CENTER, missingData); - addToMissingDataIfFieldValueIsMissing(PHC, missingData); - addToMissingDataIfFieldValueIsMissing(DRISTHI_ENTITY_ID, missingData); - return missingData; - } - - private void addToMissingDataIfFieldValueIsMissing(String fieldName, ArrayList missingData) { - if (isBlank(get(fieldName))) { - missingData.add(fieldName); - } - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - @Override - public final boolean equals(Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/domain/UserDetail.java b/opensrp-common/src/main/java/org/opensrp/common/domain/UserDetail.java deleted file mode 100644 index 0279490f5e..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/domain/UserDetail.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.opensrp.common.domain; - -import java.io.Serializable; -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class UserDetail implements Serializable { - - @JsonProperty - private String userName; - - @JsonProperty - private List roles; - - private String preferredName; - - public UserDetail(String userName, List roles) { - this.userName = userName; - this.roles = roles; - } - - public String getUserName() { - return userName; - } - - public List getRoles() { - return roles; - } - - public String getPreferredName() { - return preferredName; - } - - public void setPreferredName(String preferredName) { - this.preferredName = preferredName; - } - -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/monitor/Metric.java b/opensrp-common/src/main/java/org/opensrp/common/monitor/Metric.java deleted file mode 100644 index e7c032e86e..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/monitor/Metric.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.opensrp.common.monitor; - -public enum Metric { - REPORTING_ANM_REPORTS_CACHE_TIME, - REPORTING_ANM_REPORTS_INSERT_TIME, - REPORTING_SERVICE_PROVIDED_CACHE_TIME, - REPORTING_SERVICE_PROVIDED_INSERT_TIME, -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/monitor/Monitor.java b/opensrp-common/src/main/java/org/opensrp/common/monitor/Monitor.java deleted file mode 100644 index 4ee64d64a0..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/monitor/Monitor.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.opensrp.common.monitor; - -import org.motechproject.util.DateUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -@Component -public class Monitor { - - public static final String LOGGER_NAME = "DRISHTI_MONITOR"; - - private static Logger logger = LoggerFactory.getLogger(LOGGER_NAME); - - public Probe start(Metric metric) { - return new Probe(metric); - } - - public void end(Probe probe) { - addObservationFor(probe.metric(), probe.value()); - } - - public void addObservationFor(Metric metric, long value) { - logger.info(metric.name() + " " + value + " " + DateUtil.now().getMillis()); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/monitor/Probe.java b/opensrp-common/src/main/java/org/opensrp/common/monitor/Probe.java deleted file mode 100644 index 6dc1586a2b..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/monitor/Probe.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.opensrp.common.monitor; - -public class Probe { - - private Metric metric; - - private long startTime; - - public Probe(Metric metric) { - this.metric = metric; - this.startTime = System.nanoTime(); - } - - public long value() { - return System.nanoTime() - startTime; - } - - public Metric metric() { - return metric; - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/ANMIndicatorSummaryFactory.java b/opensrp-common/src/main/java/org/opensrp/common/util/ANMIndicatorSummaryFactory.java deleted file mode 100644 index bc912c6e59..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/ANMIndicatorSummaryFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.opensrp.common.util; - -import static java.util.Arrays.asList; - -import org.opensrp.common.domain.ANMIndicatorSummary; -import org.opensrp.common.domain.MonthSummary; - -//TODO: Document this class purpose and work methodology. -public class ANMIndicatorSummaryFactory { - - public static ANMIndicatorSummary createSummaryForIUD() { - return new ANMIndicatorSummary("IUD", "40", - asList(new MonthSummary("4", "2012", "2", "2", asList("CASE 1", "CASE 2")), - new MonthSummary("5", "2012", "2", "4", asList("CASE 3", "CASE 4")))); - } - - public static ANMIndicatorSummary createSummaryForIUD(String annualTarget) { - return new ANMIndicatorSummary("IUD", annualTarget, - asList(new MonthSummary("4", "2012", "2", "2", asList("CASE 1", "CASE 2")), - new MonthSummary("5", "2012", "2", "4", asList("CASE 3", "CASE 4")))); - } - - public static ANMIndicatorSummary createSummaryForANC() { - return new ANMIndicatorSummary("ANC", "30", - asList(new MonthSummary("6", "2012", "2", "2", asList("CASE 5", "CASE 6")))); - } - - public static ANMIndicatorSummary createSummaryForCondom() { - return new ANMIndicatorSummary("CONDOM", "20", asList(new MonthSummary("3", "2013", "2", "2", asList("CASE 7")))); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/CustomCertificateSSLSocketFactory.java b/opensrp-common/src/main/java/org/opensrp/common/util/CustomCertificateSSLSocketFactory.java deleted file mode 100644 index 4e12116d22..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/CustomCertificateSSLSocketFactory.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.opensrp.common.util; - -import java.io.IOException; -import java.net.Socket; -import java.net.UnknownHostException; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; - -import org.apache.http.conn.ssl.SSLSocketFactory; - -/** - * Creates an insecure SSL socket that trusts any certificate. - */ -public class CustomCertificateSSLSocketFactory extends SSLSocketFactory { - - SSLContext sslContext = SSLContext.getInstance("TLS"); - - public CustomCertificateSSLSocketFactory(KeyStore truststore) - throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException { - super(truststore); - - System.setProperty("disable_bad_sslciphers", "yes"); - System.setProperty("jsse.enableSNIExtension", "true"); - - TrustManager tm = new X509TrustManager() { - - public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { - } - - public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { - } - - public X509Certificate[] getAcceptedIssuers() { - return null; - } - }; - - sslContext.init(null, new TrustManager[] { tm }, null); - } - - @Override - public Socket createSocket(Socket socket, String host, int port, boolean autoClose) - throws IOException, UnknownHostException { - return sslContext.getSocketFactory().createSocket(socket, host, port, autoClose); - } - - @Override - public Socket createSocket() throws IOException { - return sslContext.getSocketFactory().createSocket(); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/DateTimeUtil.java b/opensrp-common/src/main/java/org/opensrp/common/util/DateTimeUtil.java deleted file mode 100644 index 60bc340aeb..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/DateTimeUtil.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.opensrp.common.util; - -import org.joda.time.LocalDateTime; - -public class DateTimeUtil { - - private DateTimeUtil() { - - } - - private static DateTimeUtility dateUtility = new RealDateTime(); - - public static void fakeIt(LocalDateTime fakeDateTime) { - dateUtility = new MockDateTime(fakeDateTime); - } - - public static LocalDateTime now() { - return dateUtility.now(); - } -} - -interface DateTimeUtility { - - LocalDateTime now(); -} - -class RealDateTime implements DateTimeUtility { - - @Override - public LocalDateTime now() { - return LocalDateTime.now(); - } -} - -class MockDateTime implements DateTimeUtility { - - private LocalDateTime fakeDateTime; - - MockDateTime(LocalDateTime fakeDateTime) { - this.fakeDateTime = fakeDateTime; - } - - @Override - public LocalDateTime now() { - return fakeDateTime; - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/DateUtil.java b/opensrp-common/src/main/java/org/opensrp/common/util/DateUtil.java deleted file mode 100644 index 7ee232280e..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/DateUtil.java +++ /dev/null @@ -1,155 +0,0 @@ -package org.opensrp.common.util; - -import static org.motechproject.util.DateUtil.inRange; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.concurrent.TimeUnit; - -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.joda.time.LocalTime; -import org.joda.time.Period; - -public class DateUtil { - - private static DateUtility dateUtility = new RealDate(); - - public static DateFormat yyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); - - public static DateFormat yyyyMMddHHmmss = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - public static DateFormat yyyyMMddTHHmmssSSSZ = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); - - public static void fakeIt(LocalDate fakeDayAsToday) { - dateUtility = new MockDate(fakeDayAsToday); - } - - public static LocalDate today() { - return dateUtility.today(); - } - - public static long millis() { - return dateUtility.millis(); - } - - private DateUtil() { - - } - - public static boolean isDateWithinGivenPeriodBeforeToday(LocalDate referenceDateForSchedule, Period period) { - return inRange(toTime(referenceDateForSchedule), toTime(today().minus(period)), toTime(today())); - } - - private static DateTime toTime(LocalDate referenceDateForSchedule) { - return referenceDateForSchedule.toDateTime(new LocalTime(0, 0)); - } - - public static long dateDiff(String day) { - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); - Date today = Calendar.getInstance().getTime(); - long days = 0; - try { - Date previousDay = format.parse(day.toString()); - String todayDate = format.format(today); - Date today_date = format.parse(todayDate); - long diff = today_date.getTime() - previousDay.getTime(); - days = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS); - } - catch (ParseException e) { - - e.printStackTrace(); - } - return days; - } - - /** - * Parses dates of following formats - yyyy-MM-dd - yyyy-MM-dd HH:mm:ss - - * yyyy-MM-dd'T'HH:mm:ss.SSSZ - * - * @return - * @throws ParseException - */ - public static DateTime parseDate(String date) throws ParseException { - - try { - return new DateTime(yyyyMMddTHHmmssSSSZ.parse(date).getTime()); - } - catch (ParseException e) {} - try { - return new DateTime(yyyyMMddHHmmss.parse(date).getTime()); - } - catch (ParseException e) {} - - return new DateTime(yyyyMMdd.parse(date).getTime()); - } - - public static String getTodayAsString() { - Calendar now = Calendar.getInstance(); - return yyyyMMdd.format(now.getTime()); - } - - public static LocalDate tryParse(String value, LocalDate defaultValue) { - try { - return LocalDate.parse(value); - } - catch (Exception e) { - return defaultValue; - } - } - - public static Date getDateFromString(String dateString) { - Date parsed = null; - try { - if (dateString != null && !dateString.equals("null") && dateString.length() > 0) { - parsed = yyyyMMddTHHmmssSSSZ.parse(dateString.trim()); - } - } - catch (ParseException e) { - e.printStackTrace(); - } - return parsed; - } -} - -interface DateUtility { - - LocalDate today(); - - long millis(); -} - -class RealDate implements DateUtility { - - @Override - public LocalDate today() { - return LocalDate.now(); - } - - @Override - public long millis() { - return DateTime.now().getMillis(); - } -} - -class MockDate implements DateUtility { - - private DateTime fakeDay; - - MockDate(LocalDate fakeDay) { - this.fakeDay = fakeDay.toDateTimeAtStartOfDay(); - } - - @Override - public LocalDate today() { - return fakeDay.toLocalDate(); - } - - @Override - public long millis() { - return fakeDay.getMillis(); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/DoubleUtil.java b/opensrp-common/src/main/java/org/opensrp/common/util/DoubleUtil.java deleted file mode 100644 index 54aadb6ac0..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/DoubleUtil.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.opensrp.common.util; - -public class DoubleUtil { - - private DoubleUtil() { - - } - - public static double tryParse(String value, double defaultValue) { - try { - return Double.parseDouble(value); - } - catch (Exception e) { - return defaultValue; - } - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/EasyMap.java b/opensrp-common/src/main/java/org/opensrp/common/util/EasyMap.java deleted file mode 100644 index 732a719fd6..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/EasyMap.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.opensrp.common.util; - -import java.util.HashMap; -import java.util.Map; - -public class EasyMap { - - private Map map; - - public EasyMap() { - this.map = new HashMap<>(); - } - - public static Map mapOf(Key key, Value value) { - HashMap normalMap = new HashMap<>(); - normalMap.put(key, value); - return normalMap; - } - - public static EasyMap create(Key key, Value value) { - EasyMap easyMap = new EasyMap<>(); - return easyMap.put(key, value); - } - - public EasyMap put(KeyType key, ValueType value) { - map.put(key, value); - return this; - } - - public EasyMap putAll(Map map) { - this.map.putAll(map); - return this; - } - - public Map map() { - return map; - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/HostNameSetter.java b/opensrp-common/src/main/java/org/opensrp/common/util/HostNameSetter.java deleted file mode 100644 index c10e257905..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/HostNameSetter.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.opensrp.common.util; - -import java.lang.ref.WeakReference; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.concurrent.atomic.AtomicReference; - -import javax.net.ssl.SSLSocket; - -public class HostNameSetter { - - private static final AtomicReference CURRENT = new AtomicReference<>(); - - private final WeakReference cls; - - private final WeakReference setter; - - private HostNameSetter(Class clazz, Method setter) { - this.cls = new WeakReference<>(clazz); - this.setter = setter == null ? null : new WeakReference<>(setter); - } - - private static Method init(Class cls) { - Method s = null; - try { - s = cls.getMethod("setHost", String.class); - } - catch (Exception e) { - initFail(e); - } - CURRENT.set(new HostNameSetter(cls, s)); - return s; - } - - private static void initFail(Exception e) { - e.printStackTrace(); - } - - private Method reuse(Class cls) { - final boolean wrongClass = this.cls.get() != cls; - if (wrongClass) { - return init(cls); - } - - final boolean setterNotSupported = this.setter == null; - if (setterNotSupported) { - return null; - } - - final Method s = setter.get(); - final boolean setterLost = s == null; - return setterLost ? init(cls) : s; - } - - /** - * Invokes the {@code #setName(String)} method if one is present. - * - * @param hostname the name to set - * @param sslsock the socket - */ - public static void setServerNameIndication(String hostname, SSLSocket sslsock) { - final Class cls = sslsock.getClass(); - final HostNameSetter current = CURRENT.get(); - final Method setter = (current == null) ? init(cls) : current.reuse(cls); - if (setter != null) { - try { - setter.invoke(sslsock, hostname); - } - catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException e) { - setServerNameIndicationFail(e); - } - } - } - - private static void setServerNameIndicationFail(Exception e) { - e.printStackTrace(); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/HttpAgent.java b/opensrp-common/src/main/java/org/opensrp/common/util/HttpAgent.java deleted file mode 100644 index 80f04998e0..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/HttpAgent.java +++ /dev/null @@ -1,133 +0,0 @@ -package org.opensrp.common.util; - -import java.io.InputStream; -import java.security.KeyStore; -import java.security.Security; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.io.IOUtils; -import org.apache.http.NameValuePair; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.conn.ClientConnectionManager; -import org.apache.http.conn.scheme.PlainSocketFactory; -import org.apache.http.conn.scheme.Scheme; -import org.apache.http.conn.scheme.SchemeRegistry; -import org.apache.http.conn.scheme.SocketFactory; -import org.apache.http.conn.ssl.SSLSocketFactory; -import org.apache.http.conn.ssl.X509HostnameVerifier; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; -import org.apache.http.message.BasicNameValuePair; -import org.apache.http.params.BasicHttpParams; -import org.apache.http.params.CoreConnectionPNames; -import org.apache.http.params.HttpConnectionParams; -import org.apache.http.protocol.HTTP; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.springframework.stereotype.Component; - -//TODO: Find difference between this and HttpUtil class. -@Component -public class HttpAgent { - - private final DefaultHttpClient httpClient; - - public HttpAgent() { - BasicHttpParams basicHttpParams = new BasicHttpParams(); - HttpConnectionParams.setConnectionTimeout(basicHttpParams, 30000); - HttpConnectionParams.setSoTimeout(basicHttpParams, 60000); - - SchemeRegistry registry = new SchemeRegistry(); - registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); - registry.register(new Scheme("https", sslSocketFactoryWithDrishtiCertificate(), 443)); - - ClientConnectionManager connectionManager = new ThreadSafeClientConnManager(basicHttpParams, registry); - httpClient = new DefaultHttpClient(connectionManager, basicHttpParams); - } - - public HttpResponse post(String url, String data, String contentType) { - HttpPost request = new HttpPost(url); - try { - request.setHeader(HTTP.CONTENT_TYPE, contentType); - StringEntity entity = new StringEntity(data); - entity.setContentEncoding(contentType); - request.setEntity(entity); - org.apache.http.HttpResponse response = httpClient.execute(request); - return new HttpResponse(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK, - IOUtils.toString(response.getEntity().getContent())); - } - catch (Exception e) { - throw new RuntimeException(e); - } - } - - public HttpResponse put(String url, Map formParams) { - HttpPut request = new HttpPut(url); - try { - List urlParameters = new ArrayList<>(); - for (String param : formParams.keySet()) { - urlParameters.add(new BasicNameValuePair(param, formParams.get(param))); - } - request.setEntity(new UrlEncodedFormEntity(urlParameters)); - org.apache.http.HttpResponse response = httpClient.execute(request); - return new HttpResponse(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK, - IOUtils.toString(response.getEntity().getContent())); - } - catch (Exception e) { - throw new RuntimeException(e); - } - } - - public HttpResponse get(String url) { - HttpGet request = new HttpGet(url); - try { - org.apache.http.HttpResponse response = httpClient.execute(request); - return new HttpResponse(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK, - IOUtils.toString(response.getEntity().getContent())); - } - catch (Exception e) { - throw new RuntimeException(e); - } - } - - public HttpResponse getWithSocketTimeout(String url) { - HttpGet request = new HttpGet(url); - try { - httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 0); - org.apache.http.HttpResponse response = httpClient.execute(request); - return new HttpResponse(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK, - IOUtils.toString(response.getEntity().getContent())); - } - catch (Exception e) { - throw new RuntimeException(e); - } - } - - private SocketFactory sslSocketFactoryWithDrishtiCertificate() { - try { - Security.addProvider(new BouncyCastleProvider()); - KeyStore trustedKeystore = KeyStore.getInstance("BKS"); - InputStream inputStream = this.getClass().getResourceAsStream("/drishti_client.keystore"); - try { - trustedKeystore.load(inputStream, "phone red pen".toCharArray()); - } - finally { - inputStream.close(); - } - - SSLSocketFactory socketFactory = new SSLSocketFactory(trustedKeystore); - final X509HostnameVerifier oldVerifier = SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER; - socketFactory.setHostnameVerifier(oldVerifier); - return socketFactory; - } - catch (Exception e) { - throw new AssertionError(e); - } - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/HttpResponse.java b/opensrp-common/src/main/java/org/opensrp/common/util/HttpResponse.java deleted file mode 100644 index bc2d62f547..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/HttpResponse.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.opensrp.common.util; - -public class HttpResponse { - - private final boolean isSuccess; - - private final String body; - - private Integer statusCode; - - public HttpResponse(boolean isSuccess, String body) { - this.isSuccess = isSuccess; - this.body = body; - } - - public HttpResponse(boolean isSuccess, int statusCode, String body) { - this.isSuccess = isSuccess; - this.body = body; - this.statusCode = statusCode; - } - - public boolean isSuccess() { - return isSuccess; - } - - public String body() { - return body; - } - - public Integer statusCode() { - return statusCode; - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/HttpUtil.java b/opensrp-common/src/main/java/org/opensrp/common/util/HttpUtil.java deleted file mode 100644 index 9492b84e5d..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/HttpUtil.java +++ /dev/null @@ -1,182 +0,0 @@ -package org.opensrp.common.util; - -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.client.methods.HttpRequestBase; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.DefaultRedirectStrategy; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.protocol.HTTP; -import org.springframework.stereotype.Component; - -@Component -public class HttpUtil { - - private HttpUtil() { - - } - - public enum AuthType { - BASIC, - TOKEN, - NONE - } - - private static CloseableHttpClient init(String host) { - try { - - HttpClientBuilder clientBuilder = HttpClientBuilder.create(); - ServerNameIndicationSSLContext ctx = new ServerNameIndicationSSLContext(host, 443); - clientBuilder.setSSLContext(ctx); - clientBuilder.setRedirectStrategy(new DefaultRedirectStrategy()); - return clientBuilder.build(); - - } - catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - public static HttpResponse post(String url, String payload, String data, String username, String password) { - return post(url, payload, data, "application/json", AuthType.BASIC, username + ":" + password); - } - - public static HttpResponse post(String url, String payload, String data) { - return post(url, payload, data, "application/json", AuthType.NONE, ""); - } - - public static HttpResponse postWithToken(String url, String payload, String data, String token) { - return post(url, payload, data, "application/json", AuthType.TOKEN, token); - } - - public static HttpResponse post(String url, String payload, String data, String contentType, AuthType authType, - String authString) { - try { - HttpPost request = (HttpPost) makeConnection(url, payload, RequestMethod.POST, authType, authString); - request.setHeader(HTTP.CONTENT_TYPE, contentType); - StringEntity entity = new StringEntity(data == null ? "" : data); - System.out.println(data); - entity.setContentEncoding(contentType); - request.setEntity(entity); - CloseableHttpClient httpClient = init(request.getURI().getHost()); - org.apache.http.HttpResponse response = httpClient.execute(request); - return createCustomResponseFrom(response); - } - catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - public static HttpResponse get(String url, String payload, String username, String password) { - return get(url, payload, AuthType.BASIC, username + ":" + password); - } - - public static HttpResponse delete(String url, String payload, String username, String password) { - return delete(url, payload, AuthType.BASIC, username + ":" + password); - } - - public static HttpResponse get(String url, String payload) { - return get(url, payload, AuthType.NONE, ""); - } - - public static HttpResponse getWithToken(String url, String payload, String token) { - return get(url, payload, AuthType.BASIC, token); - } - - public static HttpResponse get(String url, String payload, AuthType authType, String authString) { - try { - HttpGet request = (HttpGet) makeConnection(url, payload, RequestMethod.GET, authType, authString); - CloseableHttpClient httpClient = init(request.getURI().getHost()); - org.apache.http.HttpResponse response = httpClient.execute(request); - return createCustomResponseFrom(response); - } - catch (Exception e) { - throw new RuntimeException(e); - } - } - - public static HttpResponse delete(String url, String payload, AuthType authType, String authString) { - try { - HttpDelete request = (HttpDelete) makeConnection(url, payload, RequestMethod.DELETE, authType, authString); - CloseableHttpClient httpClient = init(request.getURI().getHost()); - org.apache.http.HttpResponse response = httpClient.execute(request); - return createCustomResponseFrom(response); - } - catch (Exception e) { - throw new RuntimeException(e); - } - } - - static HttpResponse createCustomResponseFrom(org.apache.http.HttpResponse response) throws IOException { - int statusCode = response.getStatusLine().getStatusCode(); - String entity = ""; - if (response.getEntity() != null) { - entity = IOUtils.toString(response.getEntity().getContent()); - } - - return new HttpResponse(checkSuccessBasedOnHttpCode(statusCode), statusCode, entity); - } - - static boolean checkSuccessBasedOnHttpCode(int httpCode) { - if (httpCode >= 400 && httpCode <= 599) { - return false; - } else { - return true; - } - } - - public static HttpRequestBase makeConnection(String baseUrl, String payload, RequestMethod method, AuthType authType, - String authString) throws URISyntaxException { - String charset = "UTF-8"; - String url = baseUrl; - if (url.endsWith("/")) { - url = url.substring(0, url.lastIndexOf("/")); - } - url = (url + (StringUtils.isBlank(payload) ? "" : ("?" + payload))).replaceAll(" ", "%20"); - URI urlo = new URI(url); - - HttpRequestBase requestBase = null; - if (method.equals(RequestMethod.GET)) { - requestBase = new HttpGet(urlo); - } else if (method.equals(RequestMethod.POST)) { - requestBase = new HttpPost(urlo); - } else if (method.equals(RequestMethod.PUT)) { - requestBase = new HttpPut(urlo); - } else if (method.equals(RequestMethod.DELETE)) { - requestBase = new HttpDelete(urlo); - } - requestBase.setURI(urlo); - requestBase.addHeader("Accept-Charset", charset); - - if (authType.name().equalsIgnoreCase("basic")) { - String encoded = authString.matches(".+:.+") ? new String(Base64.encodeBase64(authString.getBytes())) - : authString; - requestBase.addHeader("Authorization", "Basic " + encoded); - } else if (authType.name().equalsIgnoreCase("token")) { - requestBase.addHeader("Authorization", "Token " + authString); - } - - System.out.println(url); - return requestBase; - } - - public static String removeEndingSlash(String str) { - return str.endsWith("/") ? str.substring(0, str.lastIndexOf("/")) : str; - } - - public static String removeTrailingSlash(String str) { - return str.startsWith("/") ? str.substring(1) : str; - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/IntegerUtil.java b/opensrp-common/src/main/java/org/opensrp/common/util/IntegerUtil.java deleted file mode 100644 index b90044fe88..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/IntegerUtil.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.opensrp.common.util; - -import static java.lang.Integer.parseInt; - -public class IntegerUtil { - - private IntegerUtil() { - } - - public static int tryParse(String value, int defaultValue) { - try { - return parseInt(value); - } - catch (NumberFormatException e) { - return defaultValue; - } - } - - public static boolean isInteger(String value) { - try { - Integer.parseInt(value); - return true; - } - catch (NumberFormatException e) { - return false; - } - } - - public static String parseValidIntegersAndDefaultInvalidOnesToEmptyString(String value) { - return !isInteger(value) ? "" : String.valueOf(tryParse(value, 0)); - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/OpenMRSCrossVariables.java b/opensrp-common/src/main/java/org/opensrp/common/util/OpenMRSCrossVariables.java deleted file mode 100644 index 5895d4da70..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/OpenMRSCrossVariables.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.opensrp.common.util; - -public enum OpenMRSCrossVariables { - - TEAM_MEMBER_URL { - - public String makeVariable(String openMRSVersion) { - if (openMRSVersion.startsWith("1")) { - return "ws/rest/v1/teammodule/member"; - } else { - return "ws/rest/v1/team/teammember"; - } - } - }, - - LOCATIONS_JSON_KEY { - - public String makeVariable(String openMRSVersion) { - if (openMRSVersion.startsWith("1")) { - return "location"; - } else { - return "locations"; - } - } - }; - - public abstract String makeVariable(String openMRSVersion); - -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/RequestMethod.java b/opensrp-common/src/main/java/org/opensrp/common/util/RequestMethod.java deleted file mode 100644 index 8c22ae2d3a..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/RequestMethod.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.opensrp.common.util; - -public enum RequestMethod { - POST, - GET, - PUT, - DELETE -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/SecureSocketFactory.java b/opensrp-common/src/main/java/org/opensrp/common/util/SecureSocketFactory.java deleted file mode 100644 index b596fa2397..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/SecureSocketFactory.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.opensrp.common.util; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.Socket; -import java.net.UnknownHostException; -import java.util.LinkedList; -import java.util.List; - -import javax.net.ssl.SSLSocket; -import javax.net.ssl.SSLSocketFactory; - -public class SecureSocketFactory extends SSLSocketFactory { - - private final SSLSocketFactory delegate; - - public SecureSocketFactory(SSLSocketFactory delegate) { - - this.delegate = delegate; - } - - @Override - public String[] getDefaultCipherSuites() { - - return this.delegate.getDefaultCipherSuites(); - } - - @Override - public String[] getSupportedCipherSuites() { - - return this.delegate.getSupportedCipherSuites(); - } - - @Override - public Socket createSocket(String arg0, int arg1) throws IOException, UnknownHostException { - Socket socket = this.delegate.createSocket(arg0, arg1); - return handleSocket(socket); - } - - private Socket handleSocket(Socket socket) { - List limited = new LinkedList(); - for (String suite : ((SSLSocket) socket).getEnabledCipherSuites()) { - if (!suite.contains("_ECDHE_") && !suite.contains("_DH_") && !suite.contains("_DHE_")) { - limited.add(suite); - } - } - ((SSLSocket) socket).setEnabledCipherSuites(limited.toArray(new String[limited.size()])); - return socket; - } - - @Override - public Socket createSocket(InetAddress arg0, int arg1) throws IOException { - Socket socket = this.delegate.createSocket(arg0, arg1); - return handleSocket(socket); - } - - @Override - public Socket createSocket(Socket arg0, String arg1, int arg2, boolean arg3) throws IOException { - Socket socket = this.delegate.createSocket(arg0, arg1, arg2, arg3); - return handleSocket(socket); - } - - @Override - public Socket createSocket(String arg0, int arg1, InetAddress arg2, int arg3) throws IOException, UnknownHostException { - Socket socket = this.delegate.createSocket(arg0, arg1, arg2, arg3); - return handleSocket(socket); - } - - @Override - public Socket createSocket(InetAddress arg0, int arg1, InetAddress arg2, int arg3) throws IOException { - Socket socket = this.delegate.createSocket(arg0, arg1, arg2, arg3); - return handleSocket(socket); - } - -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/ServerNameIndicationSSLContext.java b/opensrp-common/src/main/java/org/opensrp/common/util/ServerNameIndicationSSLContext.java deleted file mode 100644 index 95509f888d..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/ServerNameIndicationSSLContext.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.opensrp.common.util; - -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.List; - -import javax.net.ssl.SNIHostName; -import javax.net.ssl.SNIServerName; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLParameters; - -public class ServerNameIndicationSSLContext extends SSLContext { - - private String hostname; - - public ServerNameIndicationSSLContext(String hostname, int port) { - super(new ServerNameIndicationSSLContextSpi(hostname, port), null, "Default"); - this.hostname = hostname; - } - - public SSLParameters getParametersForSNI() { - SSLParameters params = null; - try { - params = SSLContext.getDefault().getDefaultSSLParameters(); - } - catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } - - List sNIServerNameList = new ArrayList(); - sNIServerNameList.add(new SNIHostName(hostname)); - params.setServerNames(sNIServerNameList); - params.setEndpointIdentificationAlgorithm("HTTPS"); - return params; - } - -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/ServerNameIndicationSSLContextSpi.java b/opensrp-common/src/main/java/org/opensrp/common/util/ServerNameIndicationSSLContextSpi.java deleted file mode 100644 index b91330ed45..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/ServerNameIndicationSSLContextSpi.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.opensrp.common.util; - -import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; - -import javax.net.ssl.KeyManager; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLContextSpi; -import javax.net.ssl.SSLEngine; -import javax.net.ssl.SSLServerSocketFactory; -import javax.net.ssl.SSLSessionContext; -import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.TrustManager; - -public class ServerNameIndicationSSLContextSpi extends SSLContextSpi { - - private final String hostname; - - private final int port; - - public ServerNameIndicationSSLContextSpi(String hostname, int port) { - this.hostname = hostname; - this.port = port; - } - - @Override - protected void engineInit(KeyManager[] keyManagers, TrustManager[] trustManagers, SecureRandom secureRandom) { - - } - - @Override - protected SSLSocketFactory engineGetSocketFactory() { - try { - return SSLContext.getDefault().getSocketFactory(); - } - catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } - return null; - } - - @Override - protected SSLServerSocketFactory engineGetServerSocketFactory() { - try { - return SSLContext.getDefault().getServerSocketFactory(); - } - catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } - return null; - } - - @Override - protected SSLEngine engineCreateSSLEngine() { - try { - return SSLContext.getDefault().createSSLEngine(hostname, port); - } - catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } - return null; - } - - @Override - protected SSLEngine engineCreateSSLEngine(String host, int port) { - try { - return SSLContext.getDefault().createSSLEngine(host, port); - } - catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } - return null; - } - - @Override - protected SSLSessionContext engineGetServerSessionContext() { - return null; - } - - @Override - protected SSLSessionContext engineGetClientSessionContext() { - return null; - } -} diff --git a/opensrp-common/src/main/java/org/opensrp/common/util/TestLoggerAppender.java b/opensrp-common/src/main/java/org/opensrp/common/util/TestLoggerAppender.java deleted file mode 100644 index 887c321f4d..0000000000 --- a/opensrp-common/src/main/java/org/opensrp/common/util/TestLoggerAppender.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.opensrp.common.util; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.log4j.AppenderSkeleton; -import org.apache.log4j.spi.LoggingEvent; - -public class TestLoggerAppender extends AppenderSkeleton { - - private final List log = new ArrayList(); - - @Override - public boolean requiresLayout() { - return false; - } - - @Override - protected void append(final LoggingEvent loggingEvent) { - log.add(loggingEvent); - } - - @Override - public void close() { - - } - - public List getLog() { - return new ArrayList(log); - } -} diff --git a/opensrp-common/src/main/resources/applicationContext-opensrp-common.xml b/opensrp-common/src/main/resources/applicationContext-opensrp-common.xml deleted file mode 100755 index 14d8aa100d..0000000000 --- a/opensrp-common/src/main/resources/applicationContext-opensrp-common.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/opensrp-common/src/test/java/org/opensrp/common/audit/AuditMessageTest.java b/opensrp-common/src/test/java/org/opensrp/common/audit/AuditMessageTest.java deleted file mode 100644 index 6aa934cf9b..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/audit/AuditMessageTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.opensrp.common.audit; - -import static junit.framework.Assert.assertEquals; - -import java.util.HashMap; -import java.util.Map; - -import org.joda.time.DateTime; -import org.junit.Test; -import org.opensrp.common.util.ComparableVerifier; - -import nl.jqno.equalsverifier.EqualsVerifier; - -public class AuditMessageTest { - - @Test - public void constructorTest() { - DateTime dateTime = new DateTime(2020, 12, 12, 12, 12, 12); - long messageIndex = 200l; - AuditMessageType messageType = AuditMessageType.NORMAL; - Map extraData = new HashMap<>(); - extraData.put("a", "1"); - extraData.put("b", "2"); - - AuditMessage auditMessage = new AuditMessage(dateTime, messageIndex, messageType, extraData); - - assertEquals(dateTime, auditMessage.time()); - assertEquals(messageIndex, auditMessage.index()); - assertEquals(messageType, auditMessage.type()); - assertEquals(extraData, auditMessage.data()); - } - - @Test - public void equalsContract() { - EqualsVerifier.forClass(AuditMessage.class).usingGetClass().withOnlyTheseFields("messageIndex").verify(); - } - - @Test - public void testComparableContract() { - AuditMessage one = new AuditMessage(null, 123l, null, null); - AuditMessage two = new AuditMessage(null, 300l, null, null); - AuditMessage third = new AuditMessage(null, 321l, null, null); - - new ComparableVerifier<>(AuditMessage.class, one, two, third).verify(); - - } - -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/audit/AuditMessageTypeTest.java b/opensrp-common/src/test/java/org/opensrp/common/audit/AuditMessageTypeTest.java deleted file mode 100644 index 7d3d57fcd0..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/audit/AuditMessageTypeTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.opensrp.common.audit; - -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; -import static org.opensrp.common.audit.AuditMessageType.NORMAL; -import static org.opensrp.common.audit.AuditMessageType.SMS; - -import org.junit.Test; - -public class AuditMessageTypeTest { - - @Test - public void shouldKnowWhichFieldsAreSupportedByAGivenTypeOfMessage() { - assertThat(SMS.supports("message"), is(true)); - assertThat(SMS.supports("someRandomField"), is(false)); - - assertThat(NORMAL.supports("data"), is(true)); - assertThat(NORMAL.supports("someOtherField"), is(false)); - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/audit/AuditorTest.java b/opensrp-common/src/test/java/org/opensrp/common/audit/AuditorTest.java deleted file mode 100644 index ad823188d0..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/audit/AuditorTest.java +++ /dev/null @@ -1,188 +0,0 @@ -package org.opensrp.common.audit; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.opensrp.common.audit.AuditMessageType.NORMAL; - -import java.util.ArrayList; -import java.util.List; - -import org.hamcrest.Matcher; -import org.joda.time.DateTime; -import org.junit.Test; -import org.motechproject.testing.utils.BaseUnitTest; - -public class AuditorTest extends BaseUnitTest { - - @Test - public void shouldHaveOnlyAsManyMessagesAsTheSizeOfTheAuditorLog() { - Auditor auditor = new Auditor(2); - audit(auditor, "Message 1"); - audit(auditor, "Message 2"); - audit(auditor, "Message 3"); - - assertThat(auditor.messagesSince(0).size(), is(2)); - } - - @Test - public void shouldKeepOnlyTheNewestMessagesWhenRemovingMessagesWhichOverflow() { - Auditor auditor = new Auditor(2); - audit(auditor, "Message 1"); - audit(auditor, "Message 2"); - audit(auditor, "Message 3"); - - List messages = auditor.messagesSince(0); - assertData(messages.get(0), is("Message 2")); - assertData(messages.get(1), is("Message 3")); - } - - @Test - public void shouldGiveAllMessageWhenMessageIndexBeingSearchedForIsZeroOrNegative() { - Auditor auditor = new Auditor(3); - audit(auditor, "Message 1"); - audit(auditor, "Message 2"); - audit(auditor, "Message 3"); - audit(auditor, "Message 4"); - audit(auditor, "Message 5"); - - List messages = auditor.messagesSince(0); - assertThat(messages.size(), is(3)); - assertData(messages.get(0), is("Message 3")); - assertData(messages.get(1), is("Message 4")); - assertData(messages.get(2), is("Message 5")); - - messages = auditor.messagesSince(-10); - assertThat(messages.size(), is(3)); - assertData(messages.get(0), is("Message 3")); - assertData(messages.get(1), is("Message 4")); - assertData(messages.get(2), is("Message 5")); - } - - @Test - public void shouldBeAbleToFindMessagesSubmittedSinceAGivenIndex() throws Exception { - Auditor auditor = new Auditor(3); - audit(auditor, "Message 1"); - audit(auditor, "Message 2"); - audit(auditor, "Message 3"); - - long messageIndexOfLastMessage = auditor.messagesSince(0).get(2).index(); - - audit(auditor, "Message 4"); - audit(auditor, "Message 5"); - - List newMessages = auditor.messagesSince(messageIndexOfLastMessage); - assertThat(newMessages.size(), is(2)); - assertData(newMessages.get(0), is("Message 4")); - assertData(newMessages.get(1), is("Message 5")); - } - - @Test - public void shouldBeAbleToSearchForMessagesByIndexEvenIfThereHaveBeenManyMessagesInBetween() { - Auditor auditor = new Auditor(3); - audit(auditor, "Message 1"); - - long messageIndexOfLastMessage = auditor.messagesSince(0).get(0).index(); - - audit(auditor, "Message 2"); - audit(auditor, "Message 3"); - audit(auditor, "Message 4"); - audit(auditor, "Message 5"); - audit(auditor, "Message 6"); - audit(auditor, "Message 7"); - - List messages = auditor.messagesSince(messageIndexOfLastMessage); - assertThat(messages.size(), is(3)); - assertData(messages.get(0), is("Message 5")); - assertData(messages.get(1), is("Message 6")); - assertData(messages.get(2), is("Message 7")); - } - - @Test - public void shouldNotFindAnyMessagesIfAllMessagesHaveAlreadyBeenSeen() { - Auditor auditor = new Auditor(3); - audit(auditor, "Message 1"); - audit(auditor, "Message 2"); - audit(auditor, "Message 3"); - - long messageIndexOfLastMessage = auditor.messagesSince(0).get(2).index(); - - List newMessages = auditor.messagesSince(messageIndexOfLastMessage); - assertThat(newMessages.size(), is(0)); - } - - @Test - public void shouldNotFindAnyMessagesWhenAWrongMessageIndexIfProvided() { - Auditor auditor = new Auditor(3); - audit(auditor, "Message 1"); - audit(auditor, "Message 2"); - audit(auditor, "Message 3"); - - long messageIndexOfLastMessage = auditor.messagesSince(0).get(2).index(); - - List newMessages = auditor.messagesSince(messageIndexOfLastMessage + 10); - assertThat(newMessages.size(), is(0)); - } - - @Test - public void shouldNotAllowTwoMessagesToHaveTheSameIndexEvenIfTheyAreAddedInTheSameMillisecond() { - DateTime timeNow = DateTime.now(); - - Auditor auditor = new Auditor(3); - - mockCurrentDate(timeNow); - audit(auditor, "Message 1 - Same timestamp as Messages 2 and 3"); - audit(auditor, "Message 2 - Same timestamp as Messages 1 and 3"); - audit(auditor, "Message 3 - Same timestamp as Messages 1 and 2"); - - resetDateTimeSource(); - - long messageIndexOfLastMessage = auditor.messagesSince(0).get(2).index(); - - List newMessages = auditor.messagesSince(messageIndexOfLastMessage); - assertThat(newMessages.size(), is(0)); - } - - @Test(expected = ForbiddenFieldInAuditMessage.class) - public void shouldNotAllowAddingOfFieldsWhichAreNotSupportedByTheAuditMessageTypeUsed() { - Auditor auditor = new Auditor(3); - auditor.audit(NORMAL).with("SOMETHING_OTHER_THAN_data", "Message 1").done(); - } - - @Test - public void shouldCaptureAllAuditMessagesEvenIfCalledFromMultipleThreads() throws Exception { - final Auditor auditor = new Auditor(10000); - List threads = new ArrayList(); - - for (int i = 0; i < 10; i++) { - Thread thread = new Thread(new Runnable() { - - @Override - public void run() { - for (int i = 0; i < 1000; i++) { - auditor.audit(NORMAL).with("data", "abc + " + i + " " + Thread.currentThread().getId()).done(); - } - } - }); - threads.add(thread); - } - - for (int i = 0; i < 10; i++) { - threads.get(i).start(); - } - - for (int i = 0; i < 10; i++) { - threads.get(i).join(); - } - - assertEquals(10000, auditor.messagesSince(0).size()); - } - - private void assertData(AuditMessage message, Matcher expectedDataMatcher) { - assertThat(message.data().get("data"), expectedDataMatcher); - } - - private void audit(Auditor auditor, String value) { - auditor.audit(NORMAL).with("data", value).done(); - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/domain/ANMIndicatorSummaryTest.java b/opensrp-common/src/test/java/org/opensrp/common/domain/ANMIndicatorSummaryTest.java deleted file mode 100644 index 7ed5707e68..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/domain/ANMIndicatorSummaryTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.opensrp.common.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; - -import nl.jqno.equalsverifier.EqualsVerifier; - -/** - * Created by real on 10/07/17. - */ -public class ANMIndicatorSummaryTest { - - @Test - public void testMonthlySummaries() { - List externalIDs = new ArrayList<>(); - externalIDs.add("1"); - MonthSummary monthSummary, monthSummary2; - monthSummary = new MonthSummary("July", "2017", "73%", "47%", externalIDs); - List monthSummaryList = new ArrayList<>(); - monthSummaryList.add(monthSummary); - ANMIndicatorSummary anmIndicatorSummary = new ANMIndicatorSummary("11", "11111", monthSummaryList); - assertEquals(monthSummaryList, anmIndicatorSummary.monthlySummaries()); - - assertTrue(anmIndicatorSummary.toString().contains("indicator=11")); - assertFalse(anmIndicatorSummary.toString().contains("annualTarget=2222")); - - assertEquals("11111", anmIndicatorSummary.annualTarget()); - assertNotSame("11112", anmIndicatorSummary.annualTarget()); - - assertEquals("11", anmIndicatorSummary.indicator()); - assertNotSame("12", anmIndicatorSummary.indicator()); - - monthSummary2 = new MonthSummary("august", "2015", "63%", "74%", externalIDs); - List monthSummaryList2 = new ArrayList<>(); - monthSummaryList2.add(monthSummary2); - ANMIndicatorSummary anmIndicatorSummary2 = new ANMIndicatorSummary("11", "11111", monthSummaryList); - assertNotSame(monthSummaryList2, anmIndicatorSummary2.monthlySummaries()); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(ANMIndicatorSummary.class).verify(); - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/domain/ANMReportTest.java b/opensrp-common/src/test/java/org/opensrp/common/domain/ANMReportTest.java deleted file mode 100644 index a00a5e1255..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/domain/ANMReportTest.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.opensrp.common.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; - -import nl.jqno.equalsverifier.EqualsVerifier; - -/** - * Created by real on 10/07/17. - */ -public class ANMReportTest { - - @Test - public void testConstructorsAndGetters() { - - List externalIDs = new ArrayList<>(); - externalIDs.add("1"); - MonthSummary monthSummary, monthSummary2; - monthSummary = new MonthSummary("July", "2017", "73%", "47%", externalIDs); - List monthSummaryList = new ArrayList<>(); - monthSummaryList.add(monthSummary); - - ANMIndicatorSummary anmIndicatorSummary, anmIndicatorSummary2; - anmIndicatorSummary = new ANMIndicatorSummary("11", "1111", monthSummaryList); - anmIndicatorSummary2 = new ANMIndicatorSummary("22", "2222", monthSummaryList); - - List summuriesList = new ArrayList<>(); - summuriesList.add(anmIndicatorSummary); - - List summuriesList2 = new ArrayList<>(); - summuriesList.add(anmIndicatorSummary2); - - ANMReport anmReport = new ANMReport("1234", summuriesList); - assertEquals(summuriesList, anmReport.summaries()); - assertNotSame(summuriesList2, anmReport.summaries()); - - assertEquals("1234", anmReport.anmIdentifier()); - assertNotSame("4321", anmReport.anmIdentifier()); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(ANMReport.class).verify(); - } - - @Test - public void testToString() { - ANMReport anmReport = new ANMReport(); - assertNotSame("", anmReport.toString()); - - List externalIDs = new ArrayList<>(); - externalIDs.add("1"); - MonthSummary monthSummary, monthSummary2; - monthSummary = new MonthSummary("July", "2017", "73%", "47%", externalIDs); - List monthSummaryList = new ArrayList<>(); - monthSummaryList.add(monthSummary); - ANMIndicatorSummary anmIndicatorSummary, anmIndicatorSummary2; - anmIndicatorSummary = new ANMIndicatorSummary("11", "1111", monthSummaryList); - List summuriesList = new ArrayList<>(); - summuriesList.add(anmIndicatorSummary); - ANMReport anmReport2 = new ANMReport("1234", summuriesList); - assertEquals("1234", anmReport2.anmIdentifier().toString()); - - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/domain/LocationTest.java b/opensrp-common/src/test/java/org/opensrp/common/domain/LocationTest.java deleted file mode 100644 index babd933827..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/domain/LocationTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.opensrp.common.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; - -import org.junit.Test; - -/** - * Created by real on 11/07/17. - */ -public class LocationTest { - - @Test - public void testConstructorAndGetters() { - Location location = new Location("Nandanpur", "gangapur", "house"); - assertEquals("Nandanpur", location.village()); - assertNotSame("PalerHut", location.village()); - - assertEquals("gangapur", location.subCenter()); - assertNotSame("postOffice", location.subCenter()); - - assertEquals("house", location.phc()); - assertNotSame("PalerHut", location.phc()); - - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/domain/MonthSummeryTest.java b/opensrp-common/src/test/java/org/opensrp/common/domain/MonthSummeryTest.java deleted file mode 100644 index 4a9d278c6b..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/domain/MonthSummeryTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.opensrp.common.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; - -import nl.jqno.equalsverifier.EqualsVerifier; - -public class MonthSummeryTest { - - @Test - public void testForConstructorAndGettersOfMonthSummery() { - List externalIDs = new ArrayList<>(); - externalIDs.add("hi"); - externalIDs.add("hello"); - MonthSummary monthSummary, monthSummary2, monthSummary3; - monthSummary = new MonthSummary("July", "2017", "73%", "47%", externalIDs); - monthSummary2 = new MonthSummary("august", "2018", "63%", "37%", externalIDs); - monthSummary3 = monthSummary; - - assertEquals("July", monthSummary.month()); - assertNotSame("June", monthSummary.month()); - - assertEquals("2017", monthSummary.year()); - assertNotSame("2018", monthSummary.year()); - - assertEquals("73%", monthSummary.currentProgress()); - assertNotSame("83%", monthSummary.currentProgress()); - - assertEquals("47%", monthSummary.aggregatedProgress()); - assertNotSame("74%", monthSummary.aggregatedProgress()); - - assertEquals(externalIDs, monthSummary.externalIDs()); - assertNotSame("hi", monthSummary.externalIDs().get(1)); - - assertEquals(monthSummary.toString(), monthSummary3.toString()); - assertNotSame(monthSummary.toString(), monthSummary2.toString()); - - } - - @Test - public void equalsContract() { - EqualsVerifier.forClass(MonthSummary.class).verify(); - } - -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/domain/ReportDataDeleteRequestTest.java b/opensrp-common/src/test/java/org/opensrp/common/domain/ReportDataDeleteRequestTest.java deleted file mode 100644 index d5454a4922..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/domain/ReportDataDeleteRequestTest.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.opensrp.common.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -import nl.jqno.equalsverifier.EqualsVerifier; - -/** - * Created by real on 11/07/17. - */ -public class ReportDataDeleteRequestTest { - - @Test - public void testConstructorNGetters() { - ReportDataDeleteRequest reportDataDeleteRequest1, reportDataDeleteRequest2, reportDataDeleteRequest3; - reportDataDeleteRequest1 = new ReportDataDeleteRequest(); - reportDataDeleteRequest2 = new ReportDataDeleteRequest(); - - reportDataDeleteRequest1.withType("java"); - assertEquals("java", reportDataDeleteRequest1.type()); - assertNotSame("c++", reportDataDeleteRequest1.type()); - - reportDataDeleteRequest2.withDristhiEntityId("1234"); - assertEquals("1234", reportDataDeleteRequest2.dristhiEntityId()); - assertNotSame("4321", reportDataDeleteRequest2.dristhiEntityId()); - - reportDataDeleteRequest3 = new ReportDataDeleteRequest("python"); - assertEquals("python", reportDataDeleteRequest3.type()); - assertNotSame("c++", reportDataDeleteRequest3.type()); - } - - @Test - public void equalsContract() { - EqualsVerifier.forClass(ReportDataDeleteRequest.class).verify(); - } - - @Test - public void testToStringOfReportDataDeleteRequest() { - ReportDataDeleteRequest reportDataDeleteRequest = new ReportDataDeleteRequest("java"); - assertTrue(reportDataDeleteRequest.toString().contains("java")); - assertFalse(reportDataDeleteRequest.toString().contains("c++")); - } - - @Test - public void testServiceProvidedDataDeleteRequest() { - ReportDataDeleteRequest reportDataDeleteRequest = ReportDataDeleteRequest.serviceProvidedDataDeleteRequest("abc"); - assertEquals("serviceProvided", reportDataDeleteRequest.type()); - assertNotSame("provider", reportDataDeleteRequest.type()); - assertEquals("abc", reportDataDeleteRequest.dristhiEntityId()); - assertNotSame("cba", reportDataDeleteRequest.dristhiEntityId()); - } - - @Test - public void testAnmReportDataDeleteRequest() { - ReportDataDeleteRequest reportDataDeleteRequest = ReportDataDeleteRequest.anmReportDataDeleteRequest("abc"); - assertEquals("anmReportData", reportDataDeleteRequest.type()); - assertNotSame("provider", reportDataDeleteRequest.type()); - assertEquals("abc", reportDataDeleteRequest.dristhiEntityId()); - assertNotSame("cba", reportDataDeleteRequest.dristhiEntityId()); - } - -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/domain/ReportDataUpdateRequestTest.java b/opensrp-common/src/test/java/org/opensrp/common/domain/ReportDataUpdateRequestTest.java deleted file mode 100644 index 7211a25c09..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/domain/ReportDataUpdateRequestTest.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.opensrp.common.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; - -import nl.jqno.equalsverifier.EqualsVerifier; - -/** - * Created by real on 11/07/17. - */ -public class ReportDataUpdateRequestTest { - - @Test - public void testConstructorNGettersOfReportDataUpdateRequest() { - ReportDataUpdateRequest reportDataUpdateRequest, reportDataUpdateRequest2, reportDataUpdateRequest3; - reportDataUpdateRequest = new ReportDataUpdateRequest(); - - reportDataUpdateRequest.withIndicator("gogo"); - assertEquals("gogo", reportDataUpdateRequest.indicator()); - assertNotSame("nono", reportDataUpdateRequest.indicator()); - - reportDataUpdateRequest.withStartDate("2017-07-11"); - assertEquals("2017-07-11", reportDataUpdateRequest.startDate()); - assertNotSame("nono", reportDataUpdateRequest.startDate()); - - reportDataUpdateRequest.withEndDate("2017-12-11"); - assertEquals("2017-12-11", reportDataUpdateRequest.endDate()); - assertNotSame("nono", reportDataUpdateRequest.endDate()); - - reportDataUpdateRequest.withType("easy"); - assertEquals("easy", reportDataUpdateRequest.type()); - assertNotSame("nono", reportDataUpdateRequest.type()); - - List reportingDataList = new ArrayList<>(); - ReportingData reportingData1 = new ReportingData("report"); - reportingDataList.add(reportingData1); - reportDataUpdateRequest.withReportingData(reportingDataList); - assertTrue(reportDataUpdateRequest.reportingData().get(0).toString().contains("type=report")); - assertFalse(reportDataUpdateRequest.reportingData().get(0).toString().contains("no report")); - - reportDataUpdateRequest2 = new ReportDataUpdateRequest("new report"); - assertEquals("new report", reportDataUpdateRequest2.type()); - assertNotSame("no report found", reportDataUpdateRequest2.type()); - System.out.println(reportDataUpdateRequest2.toString()); - assertTrue(reportDataUpdateRequest2.toString().contains("type=new report")); - assertFalse(reportDataUpdateRequest2.toString().contains("type=null")); - - reportDataUpdateRequest3 = ReportDataUpdateRequest.buildReportDataRequest("file", Indicator.ANC, "2017-07-11", - "2017-12-11", reportingDataList); - assertEquals("ANC", reportDataUpdateRequest3.indicator()); - assertNotSame("PNC", reportDataUpdateRequest3.indicator()); - } - - @Test - public void equalsContract() { - EqualsVerifier.forClass(ReportDataUpdateRequest.class).verify(); - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/domain/ReportMonthTest.java b/opensrp-common/src/test/java/org/opensrp/common/domain/ReportMonthTest.java deleted file mode 100644 index 18696c8eb2..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/domain/ReportMonthTest.java +++ /dev/null @@ -1,142 +0,0 @@ -package org.opensrp.common.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertTrue; - -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.joda.time.LocalDate; -import org.junit.Ignore; -import org.junit.Test; -import org.opensrp.common.util.DateUtil; - -public class ReportMonthTest { - - private final ReportMonth reportMonth = new ReportMonth(); - - @Test - public void shouldCalculateStartOfCurrentReportMonth() throws Exception { - assertEquals(LocalDate.parse("2011-11-26"), reportMonth.startOfCurrentReportMonth(LocalDate.parse("2011-11-28"))); - assertEquals(LocalDate.parse("2011-12-26"), reportMonth.startOfCurrentReportMonth(LocalDate.parse("2011-12-26"))); - assertEquals(LocalDate.parse("2011-12-26"), reportMonth.startOfCurrentReportMonth(LocalDate.parse("2011-12-27"))); - assertEquals(LocalDate.parse("2011-12-26"), reportMonth.startOfCurrentReportMonth(LocalDate.parse("2012-01-01"))); - - assertEquals(LocalDate.parse("2012-01-26"), reportMonth.startOfCurrentReportMonth(LocalDate.parse("2012-01-26"))); - assertEquals(LocalDate.parse("2012-01-26"), reportMonth.startOfCurrentReportMonth(LocalDate.parse("2012-01-27"))); - - assertEquals(LocalDate.parse("2012-01-26"), reportMonth.startOfCurrentReportMonth(LocalDate.parse("2012-02-01"))); - assertEquals(LocalDate.parse("2012-03-26"), reportMonth.startOfCurrentReportMonth(LocalDate.parse("2012-03-31"))); - - assertEquals(LocalDate.parse("2012-01-26"), reportMonth.startOfCurrentReportMonth(LocalDate.parse("2012-02-25"))); - - assertEquals(LocalDate.parse("2012-02-26"), reportMonth.startOfCurrentReportMonth(LocalDate.parse("2012-02-26"))); - assertEquals(LocalDate.parse("2012-02-26"), reportMonth.startOfCurrentReportMonth(LocalDate.parse("2012-02-27"))); - } - - @Test - public void shouldCalculateStartOfNextReportMonth() throws Exception { - assertEquals(LocalDate.parse("2012-01-26"), - reportMonth.startDateOfNextReportingMonth(LocalDate.parse("2012-01-01"))); - assertEquals(LocalDate.parse("2012-02-26"), - reportMonth.startDateOfNextReportingMonth(LocalDate.parse("2012-01-26"))); - assertEquals(LocalDate.parse("2012-02-26"), - reportMonth.startDateOfNextReportingMonth(LocalDate.parse("2012-01-27"))); - - assertEquals(LocalDate.parse("2011-12-26"), - reportMonth.startDateOfNextReportingMonth(LocalDate.parse("2011-11-28"))); - - assertEquals(LocalDate.parse("2011-12-26"), - reportMonth.startDateOfNextReportingMonth(LocalDate.parse("2011-12-25"))); - assertEquals(LocalDate.parse("2012-01-26"), - reportMonth.startDateOfNextReportingMonth(LocalDate.parse("2011-12-26"))); - assertEquals(LocalDate.parse("2012-01-26"), - reportMonth.startDateOfNextReportingMonth(LocalDate.parse("2011-12-27"))); - } - - @Test - public void shouldCalculateEndDateOfReportMonth() throws Exception { - assertEquals(LocalDate.parse("2012-02-25"), - reportMonth.endDateOfReportingMonthGivenStartDate(LocalDate.parse("2012-01-26"))); - assertEquals(LocalDate.parse("2012-12-25"), - reportMonth.endDateOfReportingMonthGivenStartDate(LocalDate.parse("2012-11-26"))); - assertEquals(LocalDate.parse("2013-01-25"), - reportMonth.endDateOfReportingMonthGivenStartDate(LocalDate.parse("2012-12-26"))); - } - - @Test - public void shouldCalculateEndDateOfCurrentReportMonth() throws Exception { - assertEquals(LocalDate.parse("2013-01-25"), reportMonth.endOfCurrentReportMonth(LocalDate.parse("2012-12-26"))); - assertEquals(LocalDate.parse("2013-01-25"), reportMonth.endOfCurrentReportMonth(LocalDate.parse("2012-12-30"))); - - assertEquals(LocalDate.parse("2013-01-25"), reportMonth.endOfCurrentReportMonth(LocalDate.parse("2013-01-01"))); - - assertEquals(LocalDate.parse("2013-02-25"), reportMonth.endOfCurrentReportMonth(LocalDate.parse("2013-01-26"))); - assertEquals(LocalDate.parse("2013-01-25"), reportMonth.endOfCurrentReportMonth(LocalDate.parse("2013-01-25"))); - } - - @Test - public void shouldCheckWhetherTheDateIsWithInTheReportingMonth() throws Exception { - DateUtil.fakeIt(LocalDate.parse("2013-01-26")); - assertTrue(reportMonth.isDateWithinCurrentReportMonth(LocalDate.parse("2013-01-26"))); - assertTrue(reportMonth.isDateWithinCurrentReportMonth(LocalDate.parse("2013-02-01"))); - assertTrue(reportMonth.isDateWithinCurrentReportMonth(LocalDate.parse("2013-02-25"))); - assertFalse(reportMonth.isDateWithinCurrentReportMonth(LocalDate.parse("2013-01-25"))); - assertFalse(reportMonth.isDateWithinCurrentReportMonth(LocalDate.parse("2013-02-26"))); - - DateUtil.fakeIt(LocalDate.parse("2012-12-26")); - assertTrue(reportMonth.isDateWithinCurrentReportMonth(LocalDate.parse("2013-01-01"))); - assertTrue(reportMonth.isDateWithinCurrentReportMonth(LocalDate.parse("2013-01-25"))); - } - - @Test - public void shouldCheckWhetherBothTheDatesAreWithinSameReportingMonth() { - assertTrue( - reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2013-01-26"), LocalDate.parse("2013-01-26"))); - assertTrue( - reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2013-02-01"), LocalDate.parse("2013-02-15"))); - assertTrue( - reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2013-02-01"), LocalDate.parse("2013-02-25"))); - assertTrue( - reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2013-02-25"), LocalDate.parse("2013-02-25"))); - assertTrue( - reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2012-12-26"), LocalDate.parse("2013-01-01"))); - assertTrue( - reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2012-12-26"), LocalDate.parse("2013-01-25"))); - - assertFalse( - reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2013-01-25"), LocalDate.parse("2013-01-26"))); - assertFalse( - reportMonth.areDatesBelongToSameReportingMonth(LocalDate.parse("2013-01-26"), LocalDate.parse("2013-02-26"))); - } - - @Test - public void testStartDateOfReportingYear() { - ReportMonth reportMonth2 = new ReportMonth(); - Date date = reportMonth2.startDateOfReportingYear(); - LocalDate localDate = LocalDate.parse(new SimpleDateFormat("yyyy-MM-dd").format(date)); - System.out.println(localDate); - //assertEquals("2017-03-26", localDate.toString()); - assertNotSame("2017-07-26", localDate.toString()); - } - - @Ignore - @Test - public void testReportingMonth() { - int currentMonth = reportMonth.reportingMonth(new LocalDate()); - int expectedMonth = new LocalDate().getMonthOfYear(); - assertEquals(expectedMonth, currentMonth); - assertNotSame(9, currentMonth); - } - - @Test - public void testReportingYear() { - int currentYear = reportMonth.reportingYear(new LocalDate()); - int expectedYear = new LocalDate().getYear(); - assertEquals(expectedYear, currentYear); - assertNotSame(2016, currentYear); - } - -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/domain/ReportingDataTest.java b/opensrp-common/src/test/java/org/opensrp/common/domain/ReportingDataTest.java deleted file mode 100644 index 2f68ba6358..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/domain/ReportingDataTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.opensrp.common.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; - -import nl.jqno.equalsverifier.EqualsVerifier; - -/** - * Created by real on 12/07/17. - */ -public class ReportingDataTest { - - @Test - public void testConstructorNGettersOfReportingData() { - Map data = new HashMap<>(); - data.put("quantity", "open"); - ReportingData reportingData1, reportingData2, reportingData3, reportingData4, reportingData5; - reportingData1 = new ReportingData("new data"); - - assertEquals("new data", reportingData1.type()); - assertNotSame("no data", reportingData1.type()); - - reportingData3 = ReportingData.anmReportData("anmIdentifier", "", Indicator.ANC, ""); - ArrayList missingList = reportingData3.getMissingReportDataForANMReport(); - ArrayList missingListExpected = new ArrayList(); - missingListExpected.add("externalId"); - missingListExpected.add("date"); - assertTrue(missingList.equals(missingListExpected)); - missingListExpected.add("anmIdentifier"); - assertFalse(missingList.equals(missingListExpected)); - - Location location = new Location("Nandanpur", "gangapur", "house"); - reportingData4 = ReportingData.serviceProvidedData("anmIdentifier", "externalId", Indicator.ANC4, "date", location, - ""); - ArrayList missingReportDataForServiceProvidedList = reportingData4.getMissingReportDataForServiceProvided(); - ArrayList expectedMissingReportDataForServiceProvidedList = new ArrayList(); - expectedMissingReportDataForServiceProvidedList.add("dristhiEntityId"); - assertTrue(missingReportDataForServiceProvidedList.equals(expectedMissingReportDataForServiceProvidedList)); - expectedMissingReportDataForServiceProvidedList.add("anmIdentifier"); - assertFalse(missingReportDataForServiceProvidedList.equals(expectedMissingReportDataForServiceProvidedList)); - - reportingData2 = new ReportingData("anc report", data); - assertTrue(reportingData2.toString().contains("type=anc")); - assertFalse(reportingData2.toString().contains("type-anc4")); - - reportingData2.withQuantity("better"); - System.out.println(reportingData2.toString()); - assertTrue(reportingData2.toString().contains("quantity=better")); - assertFalse(reportingData2.toString().contains("quantity=close")); - } - - @Test - public void equalsContract() { - EqualsVerifier.forClass(ReportingData.class).verify(); - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/domain/UserDetailTest.java b/opensrp-common/src/test/java/org/opensrp/common/domain/UserDetailTest.java deleted file mode 100644 index ea209fe20f..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/domain/UserDetailTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.opensrp.common.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; - -/** - * Created by real on 12/07/17. - */ -public class UserDetailTest { - - @Test - public void testConstructorNGetters() { - List rolesList = new ArrayList<>(); - rolesList.add("TLI"); - rolesList.add("FD"); - UserDetail userDetail = new UserDetail("real", rolesList); - userDetail.setPreferredName("preferredName"); - assertEquals("real", userDetail.getUserName()); - assertNotSame("peal", userDetail.getUserName()); - assertEquals("TLI", userDetail.getRoles().get(0)); - assertNotSame("TLI", userDetail.getRoles().get(1)); - assertEquals("preferredName", userDetail.getPreferredName()); - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/monitor/MonitorTest.java b/opensrp-common/src/test/java/org/opensrp/common/monitor/MonitorTest.java deleted file mode 100644 index d3ba4dc8ce..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/monitor/MonitorTest.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.opensrp.common.monitor; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.log4j.AppenderSkeleton; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.apache.log4j.spi.LoggingEvent; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.BDDMockito; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({ Probe.class }) -public class MonitorTest { - - @Before - public void setUp() { - PowerMockito.mockStatic(System.class); - } - - @Test - public void probeTest() { - BDDMockito.given(System.nanoTime()).willReturn(100l, 150l); - Monitor monitor = new Monitor(); - Probe probe = monitor.start(Metric.REPORTING_ANM_REPORTS_CACHE_TIME); - long value = probe.value(); - assertEquals(50, value); - } - - @Test - public void monitorLoggingTest() { - final TestAppender appender = new TestAppender(); - final Logger logger = Logger.getLogger(Monitor.LOGGER_NAME); - logger.addAppender(appender); - try { - BDDMockito.given(System.nanoTime()).willReturn(100l, 150l); - Monitor monitor = new Monitor(); - Probe probe = monitor.start(Metric.REPORTING_ANM_REPORTS_CACHE_TIME); - monitor.end(probe); - } - finally { - logger.removeAppender(appender); - } - - final List log = appender.getLog(); - final LoggingEvent firstLogEntry = log.get(0); - assertEquals(firstLogEntry.getLevel(), Level.INFO); - assertTrue(firstLogEntry.getRenderedMessage().contains("50")); - assertTrue(firstLogEntry.getRenderedMessage().contains(Metric.REPORTING_ANM_REPORTS_CACHE_TIME.name())); - } -} - -class TestAppender extends AppenderSkeleton { - - private final List log = new ArrayList(); - - @Override - public boolean requiresLayout() { - return false; - } - - @Override - protected void append(final LoggingEvent loggingEvent) { - log.add(loggingEvent); - } - - @Override - public void close() { - } - - public List getLog() { - return new ArrayList(log); - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/util/ComparableTester.java b/opensrp-common/src/test/java/org/opensrp/common/util/ComparableTester.java deleted file mode 100644 index 4aadae42ff..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/util/ComparableTester.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.opensrp.common.util; - -import static java.lang.Integer.signum; -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * This is a utility class to easily test compare method. - * - * @see Source - */ -public class ComparableTester { - - /** - * ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that - * x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.) - * - * @param - * @param o1 - * @param o2 - */ - public static void assertComparisonReversal(Comparable o1, Comparable o2) { - assertTrue("Comparison reversal should apply: sgn(o1.compareTo(o2)) == -sgn(o2.compareTo(o1)). ", - signum(o1.compareTo((T) o2)) == -signum(o2.compareTo((T) o1))); - } - - /** - * comparator should be consistent with equals if and only if e1.compareTo(e2) == 0 has the same - * boolean value as e1.equals(e2) for every e1 and e2 of class C - * - * @param o1 - * @param o2 - */ - public static void assertConsistencyWithEqual(Comparable o1, Comparable o2) { - assertEquals("o1 and o2 should be equal. Before testing comparison. ", o1, o2); - - assertTrue("since o1 and o2 are equals, o1.compareTo(o2) should return zero!", o1.compareTo((T) o2) == 0); - } - - /** - * e.compareTo(null) should throw a NullPointerException - * - * @param o1 - */ - - public static void assertNullPointerException(Comparable o1) { - try { - o1.compareTo(null); - } - catch (Exception e) { - if (!NullPointerException.class.isInstance(e)) { - throw e; - } - } - } - - /** - * (o3.compareTo(o2)>0 && o2.compareTo(o1)>0) implies o3.compareTo(o1)>0. - * - * @param o1 - * @param o2 - * @param o3 - */ - public static void assertTransitivity(Comparable o1, Comparable o2, Comparable o3) { - assertTrue( - "(" + o3 + ".compareTo(" + o2 + ") > 0) && (" + o2 + ".compareTo(" + o1 + ") > 0 ) && ( " + o3 + ".compareTo(" - + o1 + ") > 0 )", - (o3.compareTo((T) o2) > 0) && (o2.compareTo((T) o1) > 0) && (o3.compareTo((T) o1) > 0)); - } - - /** - * ensure that twinO1.compareTo(twinO2)==0 implies that sgn(twinO1.compareTo(differentO3)) == - * sgn(twinO2.compareTo(differentO3)), for all z. - * - * @param twinO1 - * @param twinO2 - * @param differentO3 - */ - public static void assertConsistency(Comparable twinO1, Comparable twinO2, Comparable differentO3) { - assertTrue((twinO1.compareTo((T) twinO2) == 0) - && (signum(twinO1.compareTo((T) differentO3)) == signum(twinO2.compareTo((T) differentO3)))); - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/util/ComparableVerifier.java b/opensrp-common/src/test/java/org/opensrp/common/util/ComparableVerifier.java deleted file mode 100644 index 513b0ddeff..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/util/ComparableVerifier.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.opensrp.common.util; - -public class ComparableVerifier { - - Class classToTest; - - Comparable smallOne; - - Comparable mediumOne; - - Comparable biggestOne; - - public ComparableVerifier(Class classToTest, Comparable smallOne, Comparable mediumOne, - Comparable biggestOne) { - this.classToTest = classToTest; - this.smallOne = smallOne; - this.mediumOne = mediumOne; - this.biggestOne = biggestOne; - } - - public boolean verify() { - testComparisonConsistency(); - testComparisonConsistencyWithEqual(); - testComparisonNullPointerException(); - testComparisonReversal(); - testComparisonTransitivity(); - return false; - } - - private void testComparisonReversal() { - ComparableTester.assertComparisonReversal(smallOne, smallOne); - ComparableTester.assertComparisonReversal(smallOne, mediumOne); - ComparableTester.assertComparisonReversal(smallOne, mediumOne); - } - - private void testComparisonConsistencyWithEqual() { - Comparable sameAsOne = smallOne; - ComparableTester.assertConsistencyWithEqual(smallOne, sameAsOne); - } - - private void testComparisonNullPointerException() { - ComparableTester.assertNullPointerException(smallOne); - } - - private void testComparisonTransitivity() { - ComparableTester.assertTransitivity(smallOne, mediumOne, biggestOne); - } - - private void testComparisonConsistency() { - Comparable sameAsOne = smallOne; - ComparableTester.assertConsistency(smallOne, sameAsOne, mediumOne); - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/util/DateTimeUtilTest.java b/opensrp-common/src/test/java/org/opensrp/common/util/DateTimeUtilTest.java deleted file mode 100644 index 277aca835d..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/util/DateTimeUtilTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.opensrp.common.util; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertTrue; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Modifier; - -import org.joda.time.LocalDateTime; -import org.junit.Test; - -public class DateTimeUtilTest { - - @Test - public void testConstructorIsPrivate() - throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { - Constructor constructor = DateTimeUtil.class.getDeclaredConstructor(); - assertTrue(Modifier.isPrivate(constructor.getModifiers())); - constructor.setAccessible(true); - constructor.newInstance(); - } - - @Test - public void nowTestOfMockDateTime() throws Exception { - LocalDateTime localDateTime = DateTimeUtil.now(); - MockDateTime mockDateTime = new MockDateTime(localDateTime); - assertEquals(localDateTime, mockDateTime.now()); - - RealDateTime realDateTime = new RealDateTime(); - assertNotSame(localDateTime, realDateTime.now()); - - DateTimeUtil.fakeIt(localDateTime); - } - -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/util/DateUtilTest.java b/opensrp-common/src/test/java/org/opensrp/common/util/DateUtilTest.java deleted file mode 100644 index c8b9547500..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/util/DateUtilTest.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.opensrp.common.util; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertTrue; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Modifier; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; - -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.joda.time.Period; -import org.junit.Test; - -public class DateUtilTest { - - DateUtil dateUtil; - - @Test - public void testConstructorIsPrivate() - throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { - Constructor constructor = DateUtil.class.getDeclaredConstructor(); - assertTrue(Modifier.isPrivate(constructor.getModifiers())); - constructor.setAccessible(true); - constructor.newInstance(); - } - - @Test - public void testMillis() throws Exception { - LocalDate today = LocalDate.now(); - long expected = today.toDate().getTime(); - long localDate = DateUtil.millis(); - assertNotSame(expected, localDate); - } - - @Test - public void testMillisFromMockDate() throws Exception { - LocalDate today = LocalDate.now(); - long expectedTime = today.toDate().getTime(); - MockDate mockDate = new MockDate(today); - long localDate = mockDate.millis(); - - assertEquals(expectedTime, localDate); - } - - @Test - public void testIsDateWithinGivenPeriodBeforeToday() throws Exception { - LocalDate referenceDateForSchedule = LocalDate.parse("2017-05-27"); - Period period = Period.days(3); - assertEquals(false, DateUtil.isDateWithinGivenPeriodBeforeToday(referenceDateForSchedule, period)); - } - - @Test - public void testParseDate() throws Exception { - String yyyyMMdd = "2017-05-30"; - String yyyyMMddHHmmss = "2012-07-10 14:58:00"; - String yyyyMMddTHHmmssSSSZ = "2017-06-01T14:29:27.845+0000"; - - assertEquals(yyyyMMdd, DateUtil.yyyyMMdd.format(DateUtil.parseDate(yyyyMMdd).toDate())); - assertEquals(yyyyMMddHHmmss, DateUtil.yyyyMMddHHmmss.format(DateUtil.parseDate(yyyyMMddHHmmss).toDate())); - - DateTime dateInSystemTimeZone = DateUtil.parseDate(yyyyMMddTHHmmssSSSZ); - DateUtil.yyyyMMddTHHmmssSSSZ.setTimeZone(TimeZone.getTimeZone("GMT")); - assertEquals(yyyyMMddTHHmmssSSSZ, DateUtil.yyyyMMddTHHmmssSSSZ.format(dateInSystemTimeZone.toDate())); - - } - - @Test(expected = ParseException.class) - public void testParseInvalidDate() throws Exception { - String invalidDate = "dfasfasdfas"; - DateUtil.parseDate(invalidDate); - } - - @Test - public void testGetTodayAsString() throws Exception { - LocalDate today = LocalDate.now(); - String formattedDate = today.toString("yyyy-MM-dd"); - assertEquals(formattedDate, DateUtil.getTodayAsString()); - } - - @Test - public void testTryParse() { - String value = "1994-04-03"; - LocalDate tested = LocalDate.parse(value); - LocalDate defaultvalue = LocalDate.now(); - assertEquals(tested, DateUtil.tryParse(value, defaultvalue)); - assertNotSame(tested, DateUtil.tryParse("x", defaultvalue)); - } - - @Test - public void testGetDateFromString() throws Exception { - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); - String dateString = "2017-05-30T14:19:01.232+0600"; - String temp = formatter.format(new Date()); - Date date = null; - date = formatter.parse(dateString); - assertEquals(date, DateUtil.getDateFromString(dateString)); - - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/util/DoubleUtilTest.java b/opensrp-common/src/test/java/org/opensrp/common/util/DoubleUtilTest.java deleted file mode 100644 index 7c7c4ca09d..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/util/DoubleUtilTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.opensrp.common.util; - -import static org.junit.Assert.assertTrue; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Modifier; - -import org.junit.Assert; -import org.junit.Test; - -public class DoubleUtilTest { - - @Test - public void testConstructorIsPrivate() - throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { - Constructor constructor = DoubleUtil.class.getDeclaredConstructor(); - assertTrue(Modifier.isPrivate(constructor.getModifiers())); - constructor.setAccessible(true); - constructor.newInstance(); - } - - @Test - public void shouldParseIntSafely() throws Exception { - Assert.assertEquals(0.1D, DoubleUtil.tryParse("", 0.1D), 0D); - Assert.assertEquals(2.0D, DoubleUtil.tryParse(null, 2.0D), 0D); - Assert.assertEquals(0D, DoubleUtil.tryParse("0", 1.1D), 0D); - Assert.assertEquals(3D, DoubleUtil.tryParse("3", 3.2D), 0D); - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/util/EasyMapTest.java b/opensrp-common/src/test/java/org/opensrp/common/util/EasyMapTest.java deleted file mode 100644 index c71c04cf1b..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/util/EasyMapTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.opensrp.common.util; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.Map; -import java.util.TreeMap; - -import org.junit.Test; - -public class EasyMapTest { - - @Test - public void basicTest() { - EasyMap easyMap = new EasyMap<>(); - - assertTrue(easyMap.map().isEmpty()); - assertNull(easyMap.map().get(1)); - - easyMap.put("a", 1); - - assertEquals(1, (int) easyMap.map().get("a")); - - Map map = new TreeMap<>(); - map.put("b", 2); - map.put("c", 3); - map.put("d", 4); - - easyMap.putAll(map); - - assertEquals(2, (int) easyMap.map().get("b")); - assertEquals(3, (int) easyMap.map().get("c")); - - } - - @Test - public void constructorTestForMapOfMethod() { - Map easyMap = EasyMap.mapOf("a", 1); - assertEquals(1, easyMap.size()); - assertEquals(1, (int) easyMap.get("a")); - assertNull(easyMap.get("s")); - } - - @Test - public void constructorTestForCreateMethod() { - EasyMap easyMap2 = EasyMap.create("b", 2); - assertEquals(1, easyMap2.map().size()); - assertEquals(2, (int) easyMap2.map().get("b")); - assertNull(easyMap2.map().get("s")); - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/util/HttpResponseTest.java b/opensrp-common/src/test/java/org/opensrp/common/util/HttpResponseTest.java deleted file mode 100644 index c939473659..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/util/HttpResponseTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.opensrp.common.util; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -public class HttpResponseTest { - - @Test - public void isSuccessTest() throws Exception { - boolean isSuccess = true; - String body = "hi"; - HttpResponse httpResponse = new HttpResponse(isSuccess, body); - assertEquals(true, httpResponse.isSuccess()); - } - - @Test - public void bodyTest() throws Exception { - boolean isSuccess = true; - String body = "hi"; - HttpResponse httpResponse = new HttpResponse(isSuccess, body); - assertEquals("hi", httpResponse.body()); - } - - @Test - public void statusCode() throws Exception { - boolean isSuccess = true; - String body = "hi"; - Integer statusCode = 11111; - HttpResponse httpResponse = new HttpResponse(isSuccess, 11111, body); - assertEquals(statusCode, httpResponse.statusCode()); - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/util/HttpUtilIntegrationTest.java b/opensrp-common/src/test/java/org/opensrp/common/util/HttpUtilIntegrationTest.java deleted file mode 100644 index 2f4f823282..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/util/HttpUtilIntegrationTest.java +++ /dev/null @@ -1,323 +0,0 @@ -package org.opensrp.common.util; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; -import static org.opensrp.common.util.HttpUtil.checkSuccessBasedOnHttpCode; -import static org.opensrp.common.util.HttpUtil.delete; -import static org.opensrp.common.util.HttpUtil.get; -import static org.opensrp.common.util.HttpUtil.getWithToken; -import static org.opensrp.common.util.HttpUtil.makeConnection; -import static org.opensrp.common.util.HttpUtil.post; -import static org.opensrp.common.util.HttpUtil.postWithToken; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Modifier; -import java.net.URISyntaxException; - -import org.apache.commons.codec.binary.Base64; -import org.apache.http.Header; -import org.apache.http.client.methods.HttpRequestBase; -import org.junit.Assert; -import org.junit.Test; - - -public class HttpUtilIntegrationTest { - - @Test - public void testConstructorIsPrivate() - throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { - Constructor constructor = HttpUtil.class.getDeclaredConstructor(); - Assert.assertTrue(Modifier.isPrivate(constructor.getModifiers())); - constructor.setAccessible(true); - constructor.newInstance(); - } - - @Test - public void testRemovingTrailingSlashes() { - String inputStringWithOneSlash = "/inputString"; - String expectedOutputStringForOneSlash = "inputString"; - - String outputStringForOneSlash = HttpUtil.removeTrailingSlash(inputStringWithOneSlash); - - assertEquals(expectedOutputStringForOneSlash, outputStringForOneSlash); - } - - @Test - public void testRemoveEndingSlashes() { - String inputStringWithOneSlash = "inputString/"; - String expectedOutputStringForOneSlash = "inputString"; - - String outputStringForOneSlash = HttpUtil.removeEndingSlash(inputStringWithOneSlash); - - assertEquals(expectedOutputStringForOneSlash, outputStringForOneSlash); - } - - @Test(expected = URISyntaxException.class) - public void testMakeConnectionThorowsUriSyntaxException() throws URISyntaxException { - String invalidUrl = "http://invalidURL^$&%$&^"; - makeConnection(invalidUrl, "", RequestMethod.DELETE, HttpUtil.AuthType.BASIC, ""); - } - - @Test - public void testMakingConnectionWithTrailingSlashes() throws URISyntaxException { - String url = "www.google.com/"; - String expectedUrl = "www.google.com"; - String payLoad = ""; - RequestMethod method = RequestMethod.GET; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - HttpRequestBase requestBase = makeConnection(url, payLoad, method, authType, ""); - - assertEquals(expectedUrl, requestBase.getURI().toString()); - assertEquals(method.name(), requestBase.getMethod()); - } - - @Test - public void testMakingValidConnectionWithoutPayload() throws URISyntaxException { - String url = "www.google.com"; - String payLoad = ""; - RequestMethod method = RequestMethod.GET; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - - HttpRequestBase requestBase = makeConnection(url, payLoad, method, authType, ""); - - assertEquals(url, requestBase.getURI().toString()); - assertEquals(method.name(), requestBase.getMethod()); - } - - @Test - public void testMakingConnectionWithPayload() throws URISyntaxException { - String url = "www.google.com"; - String payLoad = "payload"; - String expectedUrl = url + "?" + payLoad; - RequestMethod method = RequestMethod.GET; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - - HttpRequestBase requestBase = makeConnection(url, payLoad, method, authType, ""); - - assertEquals(expectedUrl, requestBase.getURI().toString()); - assertEquals(method.name(), requestBase.getMethod()); - } - - @Test - public void testMakingConnectionWithPostMethod() throws URISyntaxException { - String url = "www.google.com"; - String payLoad = "payload"; - String expectedUrl = url + "?" + payLoad; - RequestMethod method = RequestMethod.POST; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - - HttpRequestBase requestBase = makeConnection(url, payLoad, method, authType, ""); - - assertEquals(expectedUrl, requestBase.getURI().toString()); - assertEquals(method.name(), requestBase.getMethod()); - } - - @Test - public void testMakingConnectionWithDeleteMethod() throws URISyntaxException { - String url = "www.google.com"; - String payLoad = "payload"; - String expectedUrl = url + "?" + payLoad; - RequestMethod method = RequestMethod.DELETE; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - - HttpRequestBase requestBase = makeConnection(url, payLoad, method, authType, ""); - - assertEquals(expectedUrl, requestBase.getURI().toString()); - assertEquals(method.name(), requestBase.getMethod()); - } - - @Test - public void testMakingConnectionWithPutMethod() throws URISyntaxException { - String url = "www.google.com"; - String payLoad = "payload"; - String expectedUrl = url + "?" + payLoad; - RequestMethod method = RequestMethod.PUT; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - - HttpRequestBase requestBase = makeConnection(url, payLoad, method, authType, ""); - - assertEquals(expectedUrl, requestBase.getURI().toString()); - assertEquals(method.name(), requestBase.getMethod()); - } - - @Test(expected = NullPointerException.class) - public void testMakingConnectionWithNullMethod() throws URISyntaxException { - String url = "www.google.com"; - String payLoad = "payload"; - String expectedUrl = url + "?" + payLoad; - RequestMethod method = null; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - - HttpRequestBase requestBase = makeConnection(url, payLoad, method, authType, ""); - - assertEquals(expectedUrl, requestBase.getURI().toString()); - assertEquals(method.name(), requestBase.getMethod()); - } - - @Test - public void testMakingConnectionWithBasicAuthType() throws URISyntaxException { - String url = "www.google.com"; - RequestMethod method = RequestMethod.PUT; - HttpUtil.AuthType authType = HttpUtil.AuthType.BASIC; - String authString = "userName:pass"; - String expectedAuthString = "Basic " + new String(Base64.encodeBase64(authString.getBytes())); - - HttpRequestBase requestBase = makeConnection(url, "", method, authType, authString); - Header[] headers = requestBase.getHeaders("Authorization"); - String outputAuthString = headers[0].getValue(); - - assertEquals(url, requestBase.getURI().toString()); - assertEquals(method.name(), requestBase.getMethod()); - assertEquals(expectedAuthString, outputAuthString); - } - - @Test - public void testMakingConnectionWithToken() throws URISyntaxException { - String url = "www.google.com"; - RequestMethod method = RequestMethod.PUT; - HttpUtil.AuthType authType = HttpUtil.AuthType.TOKEN; - String authString = "userName:pass"; - String expectedAuthString = "Token " + authString; - - HttpRequestBase requestBase = makeConnection(url, "", method, authType, authString); - Header[] headers = requestBase.getHeaders("Authorization"); - String outputAuthString = headers[0].getValue(); - - assertEquals(url, requestBase.getURI().toString()); - assertEquals(method.name(), requestBase.getMethod()); - assertEquals(expectedAuthString, outputAuthString); - } - - @Test - public void testSuccessfulDeleteMethod() { - String url = "http://httpbin.org/delete"; - String payLoad = "payload"; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - - HttpResponse response = delete(url, payLoad, authType, ""); - - assertEquals(200, response.statusCode().intValue()); - assertTrue(response.isSuccess()); - } - - @Test - public void testUnsuccessfulDeleteMethod() { - String url = "http://httpbin.org"; - String payLoad = "payload"; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - - HttpResponse response = delete(url, payLoad, authType, ""); - - assertEquals(405, response.statusCode().intValue()); - assertFalse(response.isSuccess()); - } - - @Test(expected = RuntimeException.class) - public void testDeleteMethodForException() { - delete(null, null, "", null); - } - - @Test - public void testSuccessfulGetMethod() { - String url = "http://httpbin.org/get"; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - - HttpResponse response = get(url, "", authType, ""); - assertEquals(200, response.statusCode().intValue()); - assertTrue(response.isSuccess()); - - HttpResponse response2 = get(url, ""); - assertEquals(200, response.statusCode().intValue()); - assertTrue(response.isSuccess()); - - HttpResponse response3 = getWithToken(url, "", ""); - assertEquals(200, response.statusCode().intValue()); - assertTrue(response.isSuccess()); - } - - @Test - public void testSuccessfulGetMethodWithNoContent() { - String url = "http://httpstat.us/204"; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - - HttpResponse response = get(url, "", authType, ""); - - assertEquals(204, response.statusCode().intValue()); - assertTrue(response.isSuccess()); - } - - @Test - public void testUnsuccessfulGetMethod() { - String url = "http://httpbin.org/delete"; - String payLoad = "payload"; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - - HttpResponse response = get(url, payLoad, authType, ""); - - assertEquals(405, response.statusCode().intValue()); - assertFalse(response.isSuccess()); - } - - @Test(expected = RuntimeException.class) - public void testGetMethodForException() { - get(null, null, "", null); - } - - @Test - public void testSuccessfulPostMethod() { - String url = "http://httpbin.org/post"; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - - HttpResponse response = post(url, "", "", "text", authType, ""); - - assertEquals(200, response.statusCode().intValue()); - assertTrue(response.isSuccess()); - - HttpResponse response2 = post(url, "", ""); - assertEquals(200, response.statusCode().intValue()); - assertTrue(response.isSuccess()); - } - - @Test - public void testPostWithToken() { - String url = "http://httpbin.org/post"; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - - HttpResponse response = postWithToken(url, "", "", ""); - assertEquals(200, response.statusCode().intValue()); - assertTrue(response.isSuccess()); - } - - @Test - public void testSuccessfulPostMethodWithNoContent() { - String url = "http://httpstat.us/204"; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - - HttpResponse response = post(url, "", "", "", authType, ""); - - assertEquals(204, response.statusCode().intValue()); - assertTrue(response.isSuccess()); - } - - @Test - public void testUnsuccessfulPostMethod() { - String url = "http://httpbin.org/get"; - String payLoad = "payload"; - HttpUtil.AuthType authType = HttpUtil.AuthType.NONE; - - HttpResponse response = post(url, "", "", "", authType, ""); - - assertEquals(405, response.statusCode().intValue()); - assertFalse(response.isSuccess()); - } - - @Test - public void testCheckHttpCallSuccessBasedOnReturnCode() { - assertTrue(checkSuccessBasedOnHttpCode(200)); - assertTrue(checkSuccessBasedOnHttpCode(303)); - assertFalse(checkSuccessBasedOnHttpCode(404)); - assertFalse(checkSuccessBasedOnHttpCode(505)); - } -} diff --git a/opensrp-common/src/test/java/org/opensrp/common/util/IntegerUtilTest.java b/opensrp-common/src/test/java/org/opensrp/common/util/IntegerUtilTest.java deleted file mode 100644 index a9074209db..0000000000 --- a/opensrp-common/src/test/java/org/opensrp/common/util/IntegerUtilTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.opensrp.common.util; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Modifier; - -import org.junit.Test; - -public class IntegerUtilTest { - - IntegerUtil integerUtil; - - @Test - public void shouldParseIntSafely() throws Exception { - assertEquals(0, integerUtil.tryParse("", 0)); - assertEquals(2, integerUtil.tryParse(null, 2)); - assertEquals(0, integerUtil.tryParse("0", 1)); - assertEquals(3, integerUtil.tryParse("3", 3)); - } - - @Test - public void testConstructorIsPrivate() - throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { - Constructor constructor = IntegerUtil.class.getDeclaredConstructor(); - assertTrue(Modifier.isPrivate(constructor.getModifiers())); - constructor.setAccessible(true); - constructor.newInstance(); - } - - @Test - public void isIntegerTestForValidInteger() throws Exception { - assertTrue(integerUtil.isInteger("2")); - } - - @Test - public void isIntegerTestForInvalidInteger() throws Exception { - assertFalse(integerUtil.isInteger("hi")); - } - - @Test - public void forValidIntergers() throws Exception { - String x = integerUtil.parseValidIntegersAndDefaultInvalidOnesToEmptyString("hi"); - assertEquals("", x); - } - - @Test - public void forInvalidIntegers() throws Exception { - String y = integerUtil.parseValidIntegersAndDefaultInvalidOnesToEmptyString("9"); - assertEquals("9", y); - - } - -} diff --git a/opensrp-connector/pom.xml b/opensrp-connector/pom.xml index 24e91ec689..f795e66ed4 100755 --- a/opensrp-connector/pom.xml +++ b/opensrp-connector/pom.xml @@ -7,7 +7,7 @@ opensrp-server-connector jar - 1.0.6-SNAPSHOT + 1.0.6KIP-SNAPSHOT opensrp-server-connector OpenSRP Server Connector module @@ -186,7 +186,7 @@ opensrp-server-connector - configs/assets/schedules + ../assets/schedules schedules diff --git a/opensrp-core/jacoco.exec b/opensrp-core/jacoco.exec deleted file mode 100755 index 77a3138dc2..0000000000 Binary files a/opensrp-core/jacoco.exec and /dev/null differ diff --git a/opensrp-core/pom.xml b/opensrp-core/pom.xml deleted file mode 100755 index 209ceb4195..0000000000 --- a/opensrp-core/pom.xml +++ /dev/null @@ -1,703 +0,0 @@ - - 4.0.0 - org.smartregister - - opensrp-server-core - jar - 1.3.9-SNAPSHOT - opensrp-server-core - OpenSRP Server Core module - http://github.com/OpenSRP/opensrp-server-core - - - ${project.basedir} - 0.11 - 3.1.0.RELEASE - 5.1.36 - always - UTF-8 - 1.5.1 - - 1.0.4-SNAPSHOT - 1.0.1 - 1.0.1 - 1.0.1 - 2.8.6 - - - - - - nexus-snapshots - Nexus Snapshots Repository - https://oss.sonatype.org/content/repositories/snapshots - false - - - nexus-releases - https://oss.sonatype.org/service/local/staging/deploy/maven2 - - - - - scm:git:git@github.com:OpenSRP/opensrp-server-core.git - scm:git:git@github.com:OpenSRP/opensrp-server-core.git - https://github.com/OpenSRP/opensrp-server-core - - - - - Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0.txt - repo - Open Smart Register Platform (OpenSRP) is Licensed under the Apache License, Version 2.0 - - - - - - opensrp_developer - OpenSRP Developer - info@smartregister.org - https://groups.google.com/forum/#!forum/opensrp-dev - OpenSRP - http://smartregister.org - - developer - - Africa/Nairobi - - - - - - snapshots-repo - https://oss.sonatype.org/content/repositories/snapshots - - false - - - true - - - - motech.opensrp - Motech Snapshots Repository - http://nexus.motechproject.org/content/repositories/opensrp-server - - true - ${opensrp.updatePolicy} - - - - motech.nexus - Motech Snapshots Repository - http://nexus.motechproject.org/content/repositories/snapshots - - true - ${opensrp.updatePolicy} - - - - motech.nexus.release - Motech Snapshots Repository - http://nexus.motechproject.org/content/repositories/releases - - - - - - - motech-platform-server-api - org.motechproject - ${motech.version} - - - com.github.ldriscoll - ektorplucene - 0.2.0 - - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} - - - - - com.amazonaws - aws-java-sdk - 1.11.659 - - - - motech-sms-api - org.motechproject - ${motech.version} - - - motech-sms-http - org.motechproject - ${motech.version} - - - org.springframework - spring-core - ${spring.version} - - - commons-logging - commons-logging - - - - - org.springframework - spring-test - ${spring.version} - test - - - commons-logging - commons-logging - - - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-aop - ${spring.version} - - - org.springframework - spring-aspects - ${spring.version} - - - org.springframework - spring-jdbc - ${spring.version} - - - org.smartregister - opensrp-server-api - ${opensrp.api.version} - - - org.smartregister - opensrp-server-common - ${opensrp.common.version} - - - org.smartregister - opensrp-server-form - ${opensrp.form.version} - - - org.smartregister - opensrp-server-interface - ${opensrp.interface.version} - - - org.motechproject - motech-scheduletracking-api - ${motech.version} - - - commons-lang - commons-lang - 2.5 - - - org.quartz-scheduler - quartz - 2.1.5 - - - junit - junit - 4.12 - test - - - org.mockito - mockito-all - 1.10.19 - - - org.powermock - powermock-module-junit4 - 1.7.0 - test - - - org.powermock - powermock-api-mockito - 1.7.0 - test - - - org.motechproject - motech-testing-utils - ${motech.version} - test - - - org.apache.poi - poi - 3.13 - - - ch.maxant - rules - 2.1.0 - - - org.apache.httpcomponents - httpclient - 4.5.2 - - - org.apache.commons - commons-dbcp2 - 2.1 - - - - org.springframework.data - spring-data-jpa - 1.1.0.RELEASE - - - nl.jqno.equalsverifier - equalsverifier - 2.3 - test - - - com.openpojo - openpojo - 0.8.6 - - - - org.hibernate - hibernate-entitymanager - 4.2.8.Final - - - - org.springframework - spring-orm - ${spring.version} - - - - org.mybatis - mybatis - 3.4.6 - - - org.mybatis - mybatis-spring - 1.3.2 - - - org.jacoco - org.jacoco.agent - 0.7.9 - test - runtime - - - - org.apache.tomcat - tomcat-jdbc - 7.0.85 - - - - - org.postgresql - postgresql - 42.2.1.jre7 - - - - - - - ../assets/config - - - ../assets/schedules - schedules - - - ../build - true - - maven.properties - - - - ../modules/core/ziggy - ziggy - - - ../modules/core/queries - queries - - - src/main/java/org/opensrp/repository/postgres/mapper/xml - org/opensrp/repository/postgres/mapper/xml - - - src/main/java/org/opensrp/repository/postgres/mapper/custom/xml - org/opensrp/repository/postgres/mapper/custom/xml - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.7 - 1.7 - UTF-8 - - - - org.apache.maven.plugins - maven-resources-plugin - 2.5 - - UTF-8 - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.3 - - - **/*.properties - - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - none - - - - - - org.codehaus.mojo - properties-maven-plugin - 1.0.0 - - - initialize - - read-project-properties - - - - ../build/maven.properties - ../assets/config/opensrp.properties - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.20 - - true - - **/it/** - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${nexus-staging-maven-plugin.version} - - - default-deploy - deploy - - deploy - - - - - nexus-snapshots - https://oss.sonatype.org/ - true - - - - org.jacoco - jacoco-maven-plugin - 0.7.9 - - ${basedir}/target/coverage-reports/jacoco-unit.exec - ${basedir}/target/coverage-reports/jacoco-unit.exec - - - - jacoco-initialize - - prepare-agent - - - - jacoco-site - test - - report - - - - - - org.eluder.coveralls - coveralls-maven-plugin - 4.0.0 - - - - - - - skip-integration-tests - - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.9 - - - - integration-test - verify - - - -XX:MaxPermSize=1024M - - **/it/** - - true - - - - - - - - - integration-tests - - true - - - - - - - org.codehaus.mojo - sql-maven-plugin - 1.5 - - - - mysql - mysql-connector-java - ${mysql.connector.version} - - - - - ${jdbc.driverClassName} - ${jdbc.url-wo-db} - ${jdbc.username} - ${jdbc.password} - ${maven.test.skip} - - - - - - drop-create-relational-db - pre-integration-test - - execute - - - ${jdbc.url-wo-db} - ${jdbc.username} - ${jdbc.password} - true - - drop database if exists ${db.quartz}; - create - database ${db.quartz}; - - abort - - - - - create-quartz-tables - pre-integration-test - - execute - - - ${jdbc.url-wo-db}/${db.quartz} - ${jdbc.username} - ${jdbc.password} - true - - configs/build/sql/tables_quartz_${jdbc.backend}.sql - - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.9 - - - - integration-test - verify - - - -XX:MaxPermSize=1024M - - **/it/** - - true - - - - - - - - - - couchdb - - - opensrp.database.type - couchdb - - - - couchDb - - - - postgres - - true - - opensrp.database.type - postgres - - - - postgres - - - - release - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.5.1 - - - default-deploy - deploy - - deploy - - - - - nexus-releases - https://oss.sonatype.org/ - false - true - - - - - - - diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Action.java b/opensrp-core/src/main/java/org/opensrp/domain/Action.java deleted file mode 100644 index 889a6a6998..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Action.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.opensrp.domain; - -/** - * Created by samuelgithengi on 4/29/19. - */ -public class Action { - - private String identifier; - - private int prefix; - - private String title; - - private String description; - - private String code; - - private ExecutionPeriod timingPeriod; - - private String reason; - - private String goalId; - - private SubjectConcept subjectCodableConcept; - - private String taskTemplate; - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public int getPrefix() { - return prefix; - } - - public void setPrefix(int prefix) { - this.prefix = prefix; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public ExecutionPeriod getTimingPeriod() { - return timingPeriod; - } - - public void setTimingPeriod(ExecutionPeriod timingPeriod) { - this.timingPeriod = timingPeriod; - } - - public String getReason() { - return reason; - } - - public void setReason(String reason) { - this.reason = reason; - } - - public String getGoalId() { - return goalId; - } - - public void setGoalId(String goalId) { - this.goalId = goalId; - } - - public SubjectConcept getSubjectCodableConcept() { - return subjectCodableConcept; - } - - public void setSubjectCodableConcept(SubjectConcept subjectCodableConcept) { - this.subjectCodableConcept = subjectCodableConcept; - } - - public String getTaskTemplate() { - return taskTemplate; - } - - public void setTaskTemplate(String taskTemplate) { - this.taskTemplate = taskTemplate; - } - - static class SubjectConcept { - private String text; - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Address.java b/opensrp-core/src/main/java/org/opensrp/domain/Address.java deleted file mode 100644 index 7cb8ff30c3..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Address.java +++ /dev/null @@ -1,466 +0,0 @@ -package org.opensrp.domain; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; -import org.joda.time.DateTime; -import org.joda.time.Days; -import org.joda.time.Months; -import org.joda.time.Weeks; -import org.joda.time.Years; -import org.opensrp.common.AddressField; - -public class Address { - - @JsonProperty - private Boolean preferred; - - @JsonProperty - private String addressType; - - @JsonProperty - private DateTime startDate; - - @JsonProperty - private DateTime endDate; - - @JsonProperty - private Map addressFields; - - @JsonProperty - private String latitude; - - @JsonProperty - private String longitude; - - @JsonProperty - private String geopoint; - - @JsonProperty - private String postalCode; - - @JsonProperty - private String subTown; - - @JsonProperty - private String town; - - @JsonProperty - private String subDistrict; - - @JsonProperty - private String countyDistrict; - - @JsonProperty - private String cityVillage; - - @JsonProperty - private String stateProvince; - - @JsonProperty - private String country; - - public Address() { - } - - public Address(String addressType, DateTime startDate, DateTime endDate, Map addressFields, - String latitude, String longitude, String postalCode, String stateProvince, String country) { - this.addressType = addressType; - this.startDate = startDate; - this.endDate = endDate; - this.addressFields = addressFields; - this.latitude = latitude; - this.longitude = longitude; - this.postalCode = postalCode; - this.stateProvince = stateProvince; - this.country = country; - } - - public String getAddressType() { - return addressType; - } - - public void setAddressType(String addressType) { - this.addressType = addressType; - } - - public DateTime getStartDate() { - return startDate; - } - - public void setStartDate(DateTime startDate) { - this.startDate = startDate; - } - - public DateTime getEndDate() { - return endDate; - } - - public void setEndDate(DateTime endDate) { - this.endDate = endDate; - } - - public Map getAddressFields() { - return addressFields; - } - - public String getAddressField(String addressField) { - return addressFields.get(addressField); - } - - public String getAddressField(AddressField addressField) { - return addressFields.get(addressField.name()); - } - - /** - * TODO: functionality if multiple entry matches single regex Returns field matching the regex. - * Note that incase of multiple fields matching criteria function would return first match. The - * must be well formed to find out a single value - * - * @param regex - * @return - */ - public String getAddressFieldMatchingRegex(String regex) { - for (Entry a : addressFields.entrySet()) { - if (a.getKey().matches(regex)) { - return a.getValue(); - } - } - return null; - } - - /** - * WARNING: Overrides all existing fields - * - * @param addressFields - * @return - */ - public void setAddressFields(Map addressFields) { - this.addressFields = addressFields; - } - - public void addAddressField(String field, String value) { - if (addressFields == null) { - addressFields = new HashMap<>(); - } - addressFields.put(field, value); - } - - /** - * Add field name from a list of predefined options from enum {@link AddressField} - * - * @param field - * @param value - */ - public void addAddressField(AddressField field, String value) { - if (addressFields == null) { - addressFields = new HashMap<>(); - } - addressFields.put(field.name(), value); - } - - public void removeAddressField(AddressField field) { - addressFields.remove(field.name()); - } - - public void removeAddressField(String field) { - addressFields.remove(field); - } - - public String getLatitude() { - return latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getLongitude() { - return longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public String getGeopoint() { - return geopoint; - } - - public void setGeopoint(String geopoint) { - this.geopoint = geopoint; - } - - public String getPostalCode() { - return postalCode; - } - - public void setPostalCode(String postalCode) { - this.postalCode = postalCode; - } - - public String getSubTown() { - return subTown; - } - - public void setSubTown(String subTown) { - this.subTown = subTown; - } - - public String getTown() { - return town; - } - - public void setTown(String town) { - this.town = town; - } - - public String getSubDistrict() { - return subDistrict; - } - - public void setSubDistrict(String subDistrict) { - this.subDistrict = subDistrict; - } - - public String getCountyDistrict() { - return countyDistrict; - } - - public void setCountyDistrict(String countyDistrict) { - this.countyDistrict = countyDistrict; - } - - public String getCityVillage() { - return cityVillage; - } - - public void setCityVillage(String cityVillage) { - this.cityVillage = cityVillage; - } - - public String getStateProvince() { - return stateProvince; - } - - public void setStateProvince(String stateProvince) { - this.stateProvince = stateProvince; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - /** - * True if endDate is null or endDate is in future - * - * @return - */ - @JsonIgnore - public boolean isActive() { - return endDate == null || endDate.isAfter(DateTime.now()); - } - - /** - * If startDate is not specified returns -1. If endDate is not specified duration is from - * startDate to current date - * - * @return - */ - private long durationInMillis() { - if (startDate == null) { - return -1; - } - - return getCurrentEndDate().getMillis() - startDate.getMillis(); - } - - /** - * If startDate is not specified returns -1. If endDate is not specified duration is from - * startDate to current date - * - * @return - */ - public int durationInDays() { - return (int) (durationInMillis() == -1 ? durationInMillis() - : Days.daysBetween(startDate.withTimeAtStartOfDay(), getCurrentEndDate().withTimeAtStartOfDay()).getDays()); - } - - /** - * If startDate is not specified returns -1. If endDate is not specified duration is from - * startDate to current date - * - * @return - */ - public int durationInWeeks() { - return durationInDays() == -1 ? durationInDays() - : Weeks.weeksBetween(startDate.withTimeAtStartOfDay(), getCurrentEndDate().withTimeAtStartOfDay()) - .getWeeks(); - } - - /** - * If startDate is not specified returns -1. If endDate is not specified duration is from - * startDate to current date - * - * @return - */ - public int durationInMonths() { - return durationInDays() == -1 ? durationInDays() - : Months.monthsBetween(startDate.withTimeAtStartOfDay(), getCurrentEndDate().withTimeAtStartOfDay()) - .getMonths(); - } - - /** - * If startDate is not specified returns -1. If endDate is not specified duration is from - * startDate to current date - * - * @return - */ - public int durationInYears() { - return durationInDays() == -1 ? durationInDays() - : Years.yearsBetween(startDate.withTimeAtStartOfDay(), getCurrentEndDate().withTimeAtStartOfDay()) - .getYears(); - } - - private DateTime getCurrentEndDate() { - if (endDate == null) { - return DateTime.now(); - } - return endDate; - } - - /** - * The type address represents - * - * @param addressType - * @return - */ - public Address withAddressType(String addressType) { - this.addressType = addressType; - return this; - } - - /** - * The date when address was started or owned - * - * @param endDate - * @return - */ - public Address withStartDate(DateTime startDate) { - this.startDate = startDate; - return this; - } - - /** - * The date when address was outdated or abandoned - * - * @param endDate - * @return - */ - public Address withEndDate(DateTime endDate) { - this.endDate = endDate; - return this; - } - - /** - * WARNING: Overrides all existing fields - * - * @param addressFields - * @return - */ - public Address withAddressFields(Map addressFields) { - this.addressFields = addressFields; - return this; - } - - public Address withAddressField(String field, String value) { - if (addressFields == null) { - addressFields = new HashMap<>(); - } - addressFields.put(field, value); - return this; - } - - public Address withAddressField(AddressField field, String value) { - if (addressFields == null) { - addressFields = new HashMap<>(); - } - addressFields.put(field.name(), value); - return this; - } - - public Address withLatitude(String latitude) { - this.latitude = latitude; - return this; - } - - public Address withLongitude(String longitude) { - this.longitude = longitude; - return this; - } - - public Address withGeopoint(String geopoint) { - this.geopoint = geopoint; - return this; - } - - public Address withPostalCode(String postalCode) { - this.postalCode = postalCode; - return this; - } - - public Address withTown(String town) { - this.town = town; - return this; - } - - public Address withSubDistrict(String subDistrict) { - this.subDistrict = subDistrict; - return this; - } - - public Address withCountyDistrict(String countyDistrict) { - this.countyDistrict = countyDistrict; - return this; - } - - public Address withCityVillage(String cityVillage) { - this.cityVillage = cityVillage; - return this; - } - - public Address withStateProvince(String stateProvince) { - this.stateProvince = stateProvince; - return this; - } - - public Address withCountry(String country) { - this.country = country; - return this; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/AppStateToken.java b/opensrp-core/src/main/java/org/opensrp/domain/AppStateToken.java deleted file mode 100644 index 16c4df1af7..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/AppStateToken.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.opensrp.domain; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; -import org.joda.time.LocalDate; -import org.motechproject.model.MotechBaseDataObject; - -@TypeDiscriminator("doc.type === 'AppStateToken'") -public class AppStateToken extends MotechBaseDataObject { - - @JsonProperty - private String name; - - @JsonProperty - private Object value; - - @JsonProperty - private long lastEditDate; - - @JsonProperty - private String description; - - protected AppStateToken() { - } - - public AppStateToken(String name, Object value, long lastEditDate) { - this.name = name; - this.value = value; - this.lastEditDate = lastEditDate; - } - - public AppStateToken(String name, Object value, long lastEditDate, String description) { - this.name = name; - this.value = value; - this.lastEditDate = lastEditDate; - this.description = description; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Object getValue() { - return value; - } - - public long longValue() { - return Long.parseLong(value.toString()); - } - - public int intValue() { - return Integer.parseInt(value.toString()); - } - - public float floatValue() { - return Float.parseFloat(value.toString()); - } - - public double doubleValue() { - return Double.parseDouble(value.toString()); - } - - public String stringValue() { - return value.toString(); - } - - public LocalDate datetimeValue() { - return LocalDate.parse(value.toString()); - } - - public boolean booleanValue() { - return Boolean.parseBoolean(value.toString()); - } - - public void setValue(Object value) { - this.value = value; - } - - public long getLastEditDate() { - return lastEditDate; - } - - public void setLastEditDate(long lastEditDate) { - this.lastEditDate = lastEditDate; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "id", "revision"); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "id", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/AssignedLocations.java b/opensrp-core/src/main/java/org/opensrp/domain/AssignedLocations.java deleted file mode 100644 index c334012194..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/AssignedLocations.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * - */ -package org.opensrp.domain; - -import java.util.Date; - -/** - * @author Samuel Githengi created on 09/10/19 - */ -public class AssignedLocations { - - private String organizationId; - - private String jurisdictionId; - - private String planId; - - private Date fromDate; - - private Date toDate; - - public AssignedLocations(String jurisdictionId, String planId) { - setJurisdictionId(jurisdictionId); - setPlanId(planId); - } - - public AssignedLocations() {//Default constructor, needed by mybatis - } - - public String getOrganizationId() { - return organizationId; - } - - public void setOrganizationId(String organizationId) { - this.organizationId = organizationId; - } - - public String getJurisdictionId() { - return jurisdictionId; - } - - public void setJurisdictionId(String jurisdictionId) { - this.jurisdictionId = jurisdictionId; - } - - public String getPlanId() { - return planId; - } - - public void setPlanId(String planId) { - this.planId = planId; - } - - public Date getFromDate() { - return fromDate; - } - - public void setFromDate(Date fromDate) { - this.fromDate = fromDate; - } - - public Date getToDate() { - return toDate; - } - - public void setToDate(Date toDate) { - this.toDate = toDate; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/BaseDataObject.java b/opensrp-core/src/main/java/org/opensrp/domain/BaseDataObject.java deleted file mode 100644 index 4ece8d48b5..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/BaseDataObject.java +++ /dev/null @@ -1,189 +0,0 @@ -package org.opensrp.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; -import org.joda.time.DateTime; -import org.motechproject.model.MotechBaseDataObject; - -public abstract class BaseDataObject extends MotechBaseDataObject { - - @JsonProperty - private User creator; - - @JsonProperty - private DateTime dateCreated; - - @JsonProperty - private User editor; - - @JsonProperty - private DateTime dateEdited; - - @JsonProperty - private Boolean voided; - - @JsonProperty - private DateTime dateVoided; - - @JsonProperty - private User voider; - - @JsonProperty - private String voidReason; - - @JsonProperty - private Long serverVersion = System.currentTimeMillis(); - - @JsonProperty - private Integer clientApplicationVersion; - - @JsonProperty - private Integer clientDatabaseVersion; - - public BaseDataObject() { - } - - public User getCreator() { - return creator; - } - - public void setCreator(User creator) { - this.creator = creator; - } - - public DateTime getDateCreated() { - return dateCreated; - } - - public void setDateCreated(DateTime dateCreated) { - this.dateCreated = dateCreated; - } - - public User getEditor() { - return editor; - } - - public void setEditor(User editor) { - this.editor = editor; - } - - public DateTime getDateEdited() { - return dateEdited; - } - - public void setDateEdited(DateTime dateEdited) { - this.dateEdited = dateEdited; - } - - public Boolean getVoided() { - return voided; - } - - public void setVoided(Boolean voided) { - this.voided = voided; - } - - public DateTime getDateVoided() { - return dateVoided; - } - - public void setDateVoided(DateTime dateVoided) { - this.dateVoided = dateVoided; - } - - public User getVoider() { - return voider; - } - - public void setVoider(User voider) { - this.voider = voider; - } - - public String getVoidReason() { - return voidReason; - } - - public void setVoidReason(String voidReason) { - this.voidReason = voidReason; - } - - public Long getServerVersion() { - return serverVersion; - } - - public void setServerVersion(Long version) { - this.serverVersion = version; - } - - public BaseDataObject withCreator(User creator) { - this.creator = creator; - return this; - } - - public BaseDataObject withDateCreated(DateTime dateCreated) { - this.dateCreated = dateCreated; - return this; - } - - public BaseDataObject withEditor(User editor) { - this.editor = editor; - return this; - } - - public BaseDataObject withDateEdited(DateTime dateEdited) { - this.dateEdited = dateEdited; - return this; - } - - public BaseDataObject withVoided(Boolean voided) { - this.voided = voided; - return this; - } - - public BaseDataObject withDateVoided(DateTime dateVoided) { - this.dateVoided = dateVoided; - return this; - } - - public BaseDataObject withVoider(User voider) { - this.voider = voider; - return this; - } - - public BaseDataObject withVoidReason(String voidReason) { - this.voidReason = voidReason; - return this; - } - - public BaseDataObject withClientApplicationVersion(Integer clientApplicationVersion) { - this.clientApplicationVersion = clientApplicationVersion; - return this; - } - - public BaseDataObject withClientDatabaseVersion(Integer clientDatabaseVersion) { - this.clientDatabaseVersion = clientDatabaseVersion; - return this; - } - - public Integer getClientApplicationVersion() { - return clientApplicationVersion; - } - - public void setClientApplicationVersion(Integer clientApplicationVersion) { - this.clientApplicationVersion = clientApplicationVersion; - } - - public Integer getClientDatabaseVersion() { - return clientDatabaseVersion; - } - - public void setClientDatabaseVersion(Integer clientDatabaseVersion) { - this.clientDatabaseVersion = clientDatabaseVersion; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/BaseEntity.java b/opensrp-core/src/main/java/org/opensrp/domain/BaseEntity.java deleted file mode 100644 index 4795990222..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/BaseEntity.java +++ /dev/null @@ -1,289 +0,0 @@ -package org.opensrp.domain; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; - -@JsonIgnoreProperties(ignoreUnknown = true) -@TypeDiscriminator("doc.baseEntityId && doc.identifiers") -public class BaseEntity extends BaseDataObject { - - @JsonProperty - private String baseEntityId; - - @JsonProperty - private Map identifiers; - - @JsonProperty - private List
addresses; - - @JsonProperty - private Map attributes; - - @JsonProperty - private List contactPoints; - - @JsonProperty - private List photos; - - protected BaseEntity() { - } - - public String type() { - return type; - } - - public BaseEntity(String baseEntityId) { - this.baseEntityId = baseEntityId; - } - - public BaseEntity(String baseEntityId, Map identifiers) { - this.baseEntityId = baseEntityId; - this.identifiers = identifiers; - } - - public BaseEntity(String baseEntityId, Map identifiers, Map attributes) { - this.baseEntityId = baseEntityId; - this.identifiers = identifiers; - this.attributes = attributes; - } - - public BaseEntity(String baseEntityId, Map identifiers, Map attributes, - List
addresses) { - this.baseEntityId = baseEntityId; - this.identifiers = identifiers; - this.attributes = attributes; - this.addresses = addresses; - } - - public String getBaseEntityId() { - return baseEntityId; - } - - public void setBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - } - - public List
getAddresses() { - if (addresses == null) { - addresses = new ArrayList<>(); - } - return addresses; - } - - public Address getAddress(String addressType) { - for (Address address : getAddresses()) { - if (address.getAddressType().equalsIgnoreCase(addressType)) { - return address; - } - } - return null; - } - - public void removeAddress(String addressType) { - Address ar = null; - for (Address address : getAddresses()) { - if (address.getAddressType().equalsIgnoreCase(addressType)) { - ar = address; - } - } - if (ar != null) - getAddresses().remove(ar); - } - - /** - * WARNING: Overrides all existing addresses - * - * @param addresses - * @return - */ - public void setAddresses(List
addresses) { - this.addresses = addresses; - } - - public void addAddress(Address address) { - if (addresses == null) { - addresses = new ArrayList<>(); - } - addresses.add(address); - } - - public Map getAttributes() { - if (attributes == null) { - attributes = new HashMap<>(); - } - return attributes; - } - - public Object getAttribute(String name) { - if (attributes == null) { - return null; - } - for (String k : attributes.keySet()) { - if (k.equalsIgnoreCase(name)) { - return attributes.get(k); - } - } - return null; - } - - /** - * WARNING: Overrides all existing attributes - * - * @param attributes - * @return - */ - public void setAttributes(Map attributes) { - this.attributes = attributes; - } - - public void addAttribute(String name, Object value) { - if (attributes == null) { - attributes = new HashMap<>(); - } - - attributes.put(name, value); - } - - public void removeAttribute(String name) { - attributes.remove(name); - } - - public Map getIdentifiers() { - if (identifiers == null) { - identifiers = new HashMap<>(); - } - return identifiers; - } - - public String getIdentifier(String identifierType) { - if (identifiers == null) { - return null; - } - for (String k : identifiers.keySet()) { - if (k.equalsIgnoreCase(identifierType)) { - return identifiers.get(k); - } - } - return null; - } - - /** - * Returns field matching the regex. Note that incase of multiple fields matching criteria - * function would return first match. The must be well formed to find out a single value - * - * @param regex - * @return - */ - public String getIdentifierMatchingRegex(String regex) { - for (Entry a : getIdentifiers().entrySet()) { - if (a.getKey().matches(regex)) { - return a.getValue(); - } - } - return null; - } - - public void setIdentifiers(Map identifiers) { - this.identifiers = identifiers; - } - - public void addIdentifier(String identifierType, String identifier) { - if (identifiers == null) { - identifiers = new HashMap<>(); - } - - identifiers.put(identifierType, identifier); - } - - public void removeIdentifier(String identifierType) { - identifiers.remove(identifierType); - } - - public BaseEntity withBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - return this; - } - - /** - * WARNING: Overrides all existing identifiers - * - * @param identifiers - * @return - */ - public BaseEntity withIdentifiers(Map identifiers) { - this.identifiers = identifiers; - return this; - } - - public BaseEntity withIdentifier(String identifierType, String identifier) { - if (identifiers == null) { - identifiers = new HashMap<>(); - } - identifiers.put(identifierType, identifier); - return this; - } - - /** - * WARNING: Overrides all existing addresses - * - * @param addresses - * @return - */ - public BaseEntity withAddresses(List
addresses) { - this.addresses = addresses; - return this; - } - - public BaseEntity withAddress(Address address) { - if (addresses == null) { - addresses = new ArrayList<>(); - } - addresses.add(address); - return this; - } - - /** - * WARNING: Overrides all existing attributes - * - * @param attributes - * @return - */ - public BaseEntity withAttributes(Map attributes) { - this.attributes = attributes; - return this; - } - - public BaseEntity withAttribute(String name, Object value) { - if (attributes == null) { - attributes = new HashMap<>(); - } - attributes.put(name, value); - return this; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Camp.java b/opensrp-core/src/main/java/org/opensrp/domain/Camp.java deleted file mode 100644 index 0ecbe13331..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Camp.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.opensrp.domain; - -import java.util.Date; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; -import org.motechproject.model.MotechBaseDataObject; - -@TypeDiscriminator("doc.type == 'Camp'") -public class Camp extends MotechBaseDataObject { - - /** - * - */ - private static final long serialVersionUID = 1L; - - @JsonProperty - private String providerName; - - @JsonProperty - private String date; - - @JsonProperty - private String campName; - - @JsonProperty - private String centerName; - - @JsonProperty - private boolean status; - - @JsonProperty - private long timestamp; - - @JsonProperty - private String created_by; - - @JsonProperty - private Date created_date; - - public String getProviderName() { - return providerName; - } - - public void setProviderName(String providerName) { - this.providerName = providerName; - } - - public String getDate() { - return date; - } - - public void setDate(String date) { - this.date = date; - } - - public String getCampName() { - return campName; - } - - public void setCampName(String campName) { - this.campName = campName; - } - - public boolean isStatus() { - return status; - } - - public void setStatus(boolean status) { - this.status = status; - } - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public String getCreatedBy() { - return created_by; - } - - public void setCreatedBy(String created_by) { - this.created_by = created_by; - } - - public Date getCreatedDate() { - return created_date; - } - - public void setCreatedDate(Date created_date) { - this.created_date = created_date; - } - - public String getCenterName() { - return centerName; - } - - public void setCenterName(String centerName) { - this.centerName = centerName; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Campaign.java b/opensrp-core/src/main/java/org/opensrp/domain/Campaign.java deleted file mode 100644 index 76614544f0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Campaign.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.domain; - -import org.joda.time.DateTime; -import org.opensrp.domain.Task.TaskStatus; - -public class Campaign { - - private String identifier; - - private String title; - - private String description; - - private TaskStatus status; - - private ExecutionPeriod executionPeriod; - - private DateTime authoredOn; - - private DateTime lastModified; - - private String owner; - - private long serverVersion; - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public TaskStatus getStatus() { - return status; - } - - public void setStatus(TaskStatus status) { - this.status = status; - } - - public ExecutionPeriod getExecutionPeriod() { - return executionPeriod; - } - - public void setExecutionPeriod(ExecutionPeriod executionPeriod) { - this.executionPeriod = executionPeriod; - } - - public DateTime getAuthoredOn() { - return authoredOn; - } - - public void setAuthoredOn(DateTime authoredOn) { - this.authoredOn = authoredOn; - } - - public DateTime getLastModified() { - return lastModified; - } - - public void setLastModified(DateTime lastModified) { - this.lastModified = lastModified; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public long getServerVersion() { - return serverVersion; - } - - public void setServerVersion(long serverVersion) { - this.serverVersion = serverVersion; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Client.java b/opensrp-core/src/main/java/org/opensrp/domain/Client.java deleted file mode 100644 index 19c1438c69..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Client.java +++ /dev/null @@ -1,322 +0,0 @@ -package org.opensrp.domain; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; -import org.joda.time.DateTime; -import org.opensrp.common.Gender; - -@TypeDiscriminator("doc.type == 'Client'") -public class Client extends BaseEntity { - - @JsonProperty - private String firstName; - - @JsonProperty - private String middleName; - - @JsonProperty - private String lastName; - - @JsonProperty - private DateTime birthdate; - - @JsonProperty - private DateTime deathdate; - - @JsonProperty - private Boolean birthdateApprox; - - @JsonProperty - private Boolean deathdateApprox; - - @JsonProperty - private String gender; - - @JsonProperty - private String clientType; - - @JsonProperty - private Map> relationships; - - protected Client() { - - } - - public Client(String baseEntityId) { - super(baseEntityId); - } - - public Client(String baseEntityId, String firstName, String middleName, String lastName, DateTime birthdate, - DateTime deathdate, Boolean birthdateApprox, Boolean deathdateApprox, String gender) { - super(baseEntityId); - setFirstName(firstName); - setMiddleName(middleName); - setLastName(lastName); - setBirthdate(birthdate); - setDeathdate(deathdate); - setBirthdateApprox(birthdateApprox); - setDeathdateApprox(deathdateApprox); - setGender(gender); - } - - public Client(String baseEntityId, String firstName, String middleName, String lastName, DateTime birthdate, - DateTime deathdate, Boolean birthdateApprox, Boolean deathdateApprox, String gender, String identifierType, - String identifier) { - super(baseEntityId); - setFirstName(firstName); - setMiddleName(middleName); - setLastName(lastName); - setBirthdate(birthdate); - setDeathdate(deathdate); - setBirthdateApprox(birthdateApprox); - setDeathdateApprox(deathdateApprox); - setGender(gender); - addIdentifier(identifierType, identifier); - } - - public Client(String baseEntityId, String firstName, String middleName, String lastName, DateTime birthdate, - DateTime deathdate, Boolean birthdateApprox, Boolean deathdateApprox, String gender, List
addresses, - Map identifiers, Map attributes) { - super(baseEntityId); - this.firstName = firstName; - this.middleName = middleName; - this.lastName = lastName; - this.birthdate = birthdate; - this.deathdate = deathdate; - this.birthdateApprox = birthdateApprox; - this.deathdateApprox = deathdateApprox; - this.gender = gender; - setIdentifiers(identifiers); - setAddresses(addresses); - setAttributes(attributes); - } - - public Client(String baseEntityId, String firstName, String middleName, String lastName, DateTime birthdate, - DateTime deathdate, Boolean birthdateApprox, Boolean deathdateApprox, String gender, String clientType) { - this(baseEntityId, firstName, middleName, lastName, birthdate, deathdate, birthdateApprox, deathdateApprox, gender); - setClientType(clientType); - } - - public Client(String baseEntityId, String firstName, String middleName, String lastName, DateTime birthdate, - DateTime deathdate, Boolean birthdateApprox, Boolean deathdateApprox, String gender, String identifierType, - String identifier, String clientType) { - this(baseEntityId, firstName, middleName, lastName, birthdate, deathdate, birthdateApprox, deathdateApprox, gender, - identifierType, identifier); - setClientType(clientType); - } - - public Client(String baseEntityId, String firstName, String middleName, String lastName, DateTime birthdate, - DateTime deathdate, Boolean birthdateApprox, Boolean deathdateApprox, String gender, List
addresses, - Map identifiers, Map attributes, String clientType) { - this(baseEntityId, firstName, middleName, lastName, birthdate, deathdate, birthdateApprox, deathdateApprox, gender, - addresses, identifiers, attributes); - setClientType(clientType); - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getMiddleName() { - return middleName; - } - - public void setMiddleName(String middleName) { - this.middleName = middleName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String fullName() { - String n = ""; - if (StringUtils.isNotBlank(firstName)) { - n += firstName; - } - if (StringUtils.isNotBlank(middleName)) { - n += " " + middleName; - } - if (StringUtils.isNotBlank(lastName)) { - n += " " + lastName; - } - return n.trim(); - } - - public DateTime getBirthdate() { - return birthdate; - } - - public void setBirthdate(DateTime birthdate) { - this.birthdate = birthdate; - } - - public DateTime getDeathdate() { - return deathdate; - } - - public void setDeathdate(DateTime deathdate) { - this.deathdate = deathdate; - } - - public Boolean getBirthdateApprox() { - return birthdateApprox; - } - - public void setBirthdateApprox(Boolean birthdateApprox) { - this.birthdateApprox = birthdateApprox; - } - - public Boolean getDeathdateApprox() { - return deathdateApprox; - } - - public void setDeathdateApprox(Boolean deathdateApprox) { - this.deathdateApprox = deathdateApprox; - } - - public String getGender() { - return gender; - } - - public void setGender(String gender) { - this.gender = gender; - } - - public String getClientType() { - return clientType; - } - - public void setClientType(String clientType) { - this.clientType = clientType; - } - - public Map> getRelationships() { - return relationships; - } - - public void setRelationships(Map> relationships) { - this.relationships = relationships; - } - - public Client withFirstName(String firstName) { - this.firstName = firstName; - return this; - } - - public Client withMiddleName(String middleName) { - this.middleName = middleName; - return this; - } - - public Client withLastName(String lastName) { - this.lastName = lastName; - return this; - } - - public Client withName(String firstName, String middleName, String lastName) { - this.firstName = firstName; - this.middleName = middleName; - this.lastName = lastName; - return this; - } - - public Client withBirthdate(DateTime birthdate, Boolean isApproximate) { - this.birthdate = birthdate; - this.birthdateApprox = isApproximate; - return this; - } - - public Client withDeathdate(DateTime deathdate, Boolean isApproximate) { - this.deathdate = deathdate; - this.deathdateApprox = isApproximate; - return this; - } - - public Client withGender(String gender) { - this.gender = gender; - return this; - } - - public Client withGender(Gender gender) { - this.gender = gender.name(); - return this; - } - - /** - * Overrides the existing data - */ - public Client withRelationships(Map> relationships) { - this.relationships = relationships; - return this; - } - - public List findRelatives(String relationshipType) { - if (relationships == null) { - relationships = new HashMap<>(); - } - - return relationships.get(relationshipType); - } - - public void addRelationship(String relationType, String relativeEntityId) { - if (relationships == null) { - relationships = new HashMap<>(); - } - - List relatives = findRelatives(relationType); - if (relatives == null) { - relatives = new ArrayList<>(); - } - relatives.add(relativeEntityId); - relationships.put(relationType, relatives); - } - - public List getRelationships(String relativeEntityId) { - List relations = new ArrayList(); - for (Entry> rl : relationships.entrySet()) { - List relativeEntityIdList = rl.getValue(); - for (String entityId : relativeEntityIdList) { - if (entityId.equalsIgnoreCase(relativeEntityId)) { - relations.add(rl.getKey()); - break; - } - } - } - return relations; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "id", "revision"); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "id", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Code.java b/opensrp-core/src/main/java/org/opensrp/domain/Code.java deleted file mode 100644 index 3d6b60adec..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Code.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * - */ -package org.opensrp.domain; - -import java.io.Serializable; - -/** - * @author Samuel Githengi created on 09/12/19 - */ -public class Code implements Serializable { - - private static final long serialVersionUID = 4580804190266539302L; - - private String system; - - private String code; - - private String display; - - public String getSystem() { - return system; - } - - public void setSystem(String system) { - this.system = system; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getDisplay() { - return display; - } - - public void setDisplay(String display) { - this.display = display; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/CodeSystem.java b/opensrp-core/src/main/java/org/opensrp/domain/CodeSystem.java deleted file mode 100644 index 51b7af0890..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/CodeSystem.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - */ -package org.opensrp.domain; - -import java.io.Serializable; -import java.util.List; - -/** - * @author Samuel Githengi created on 08/30/19 - */ -public class CodeSystem implements Serializable { - - private static final long serialVersionUID = -2587903025581183298L; - - private List coding; - - public List getCoding() { - return coding; - } - - public void setCoding(List coding) { - this.coding = coding; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/ContactPoint.java b/opensrp-core/src/main/java/org/opensrp/domain/ContactPoint.java deleted file mode 100644 index ad99a5e89e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/ContactPoint.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.opensrp.domain; - -import org.joda.time.DateTime; - -public class ContactPoint { - - private String type; - - private String use; - - private String number; - - private int preference; - - private DateTime startDate; - - private DateTime endDate; - - public ContactPoint() { - - } - - public ContactPoint(String type, String use, String number, int preference, DateTime startDate, DateTime endDate) { - this.type = type; - this.use = use; - this.number = number; - this.preference = preference; - this.startDate = startDate; - this.endDate = endDate; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getUse() { - return use; - } - - public void setUse(String use) { - this.use = use; - } - - public String getNumber() { - return number; - } - - public void setNumber(String number) { - this.number = number; - } - - public int getPreference() { - return preference; - } - - public void setPreference(int preference) { - this.preference = preference; - } - - public DateTime getStartDate() { - return startDate; - } - - public void setStartDate(DateTime startDate) { - this.startDate = startDate; - } - - public DateTime getEndDate() { - return endDate; - } - - public void setEndDate(DateTime endDate) { - this.endDate = endDate; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/DHIS2Marker.java b/opensrp-core/src/main/java/org/opensrp/domain/DHIS2Marker.java deleted file mode 100644 index 57606f059c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/DHIS2Marker.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.opensrp.domain; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; -import org.motechproject.model.MotechBaseDataObject; -import org.springframework.stereotype.Service; - -@Service -@TypeDiscriminator("doc.type == 'DHIS2Marker'") -public class DHIS2Marker extends MotechBaseDataObject { - - /** - * - */ - private static final long serialVersionUID = 1L; - - @JsonProperty - private String name; - - @JsonProperty - private Long value; - - public DHIS2Marker() { - - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Long getValue() { - return value; - } - - public void setValue(Long value) { - this.value = value; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "id", "revision"); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "id", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/ErrorTrace.java b/opensrp-core/src/main/java/org/opensrp/domain/ErrorTrace.java deleted file mode 100644 index ab1ae7766f..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/ErrorTrace.java +++ /dev/null @@ -1,177 +0,0 @@ -package org.opensrp.domain; - -import java.util.Date; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; -import org.joda.time.DateTime; -import org.motechproject.model.MotechBaseDataObject; - -/** - * @author muhammad.ahmed@ihsinformatics.com Created on May 25, 2015 - */ -@TypeDiscriminator("doc.type == 'ErrorTrace'") -public class ErrorTrace extends MotechBaseDataObject { - - /* - * @JsonProperty private String id; - */ - @JsonProperty - private DateTime dateOccurred; - - @JsonProperty - private String errorType; - - @JsonProperty - private String occurredAt; - - @JsonProperty - private String stackTrace; - - @JsonProperty - private String status; // solved , unsolved , closed ,failed - // acknowledged, - - @JsonProperty - private String recordId; - - @JsonProperty - private Date dateClosed; - - @JsonProperty - private String documentType; - - @JsonProperty - private String retryUrl; - - // dateoccured , dateclosed , errortype =name, documenttype , submiturl - - public ErrorTrace() { - // TODO Auto-generated constructor stub - } - - /** - * - * - */ - public ErrorTrace(DateTime dateOccurred, String errorType, String occuredAt, String stackTrace, String status, - String documentType) { - this.dateOccurred = dateOccurred; - // this.id=id; - this.documentType = documentType; - this.errorType = errorType; - this.occurredAt = occuredAt; - this.stackTrace = stackTrace; - this.status = status; - - } - - public ErrorTrace(String recordId, DateTime date, String name, String occuredAt, String stackTrace, String status) { - this.dateOccurred = date; - this.recordId = recordId; - this.errorType = name; - this.occurredAt = occuredAt; - this.stackTrace = stackTrace; - this.status = status; - - } - - public DateTime getDateOccurred() { - return dateOccurred; - } - - public void setDateOccurred(DateTime dateOccurred) { - this.dateOccurred = dateOccurred; - } - - public String getErrorType() { - return errorType; - } - - public void setErrorType(String errorType) { - this.errorType = errorType; - } - - public Date getDateClosed() { - return dateClosed; - } - - public void setDateClosed(Date dateClosed) { - this.dateClosed = dateClosed; - } - - public String getDocumentType() { - return documentType; - } - - public void setDocumentType(String documentType) { - this.documentType = documentType; - } - - public String getRetryUrl() { - return retryUrl; - } - - public void setRetryUrl(String retryUrl) { - this.retryUrl = retryUrl; - } - - public String getRecordId() { - - return recordId; - } - - public void setRecordId(String recordId) { - this.recordId = recordId; - } - - public DateTime getDate() { - return dateOccurred; - } - - public void setDate(DateTime date) { - this.dateOccurred = date; - } - - public String getOccurredAt() { - return occurredAt; - } - - public void setOccurredAt(String occurredAt) { - this.occurredAt = occurredAt; - } - - public String getStackTrace() { - return stackTrace; - } - - public void setStackTrace(String stackTrace) { - this.stackTrace = stackTrace; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "id", "revision"); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "id", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/ErrorTraceForm.java b/opensrp-core/src/main/java/org/opensrp/domain/ErrorTraceForm.java deleted file mode 100644 index 684d4d4e10..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/ErrorTraceForm.java +++ /dev/null @@ -1,45 +0,0 @@ - -package org.opensrp.domain; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author muhammad.ahmed@ihsinformatics.com this is wrapper class .this class is mainly used for - * adding status Options to the code. developer can add other possible status for errorlog. - */ -public class ErrorTraceForm { - - private ErrorTrace errorTrace; - - private List statusOptions = new ArrayList(); - - public ErrorTraceForm() { - if (null == statusOptions) { - - statusOptions = new ArrayList(); - } - statusOptions.add("solved"); - statusOptions.add("unsolved"); - statusOptions.add("failed"); - statusOptions.add("closed"); - statusOptions.add("acknowledged"); - } - - public ErrorTrace getErrorTrace() { - return errorTrace; - } - - public void setErrorTrace(ErrorTrace errorTrace) { - this.errorTrace = errorTrace; - } - - public List getStatusOptions() { - return statusOptions; - } - - public void setStatusOptions(List statusOptions) { - this.statusOptions = statusOptions; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Event.java b/opensrp-core/src/main/java/org/opensrp/domain/Event.java deleted file mode 100644 index d3b565451e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Event.java +++ /dev/null @@ -1,417 +0,0 @@ -package org.opensrp.domain; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; -import org.joda.time.DateTime; - -@JsonIgnoreProperties(ignoreUnknown = true) -@TypeDiscriminator("doc.type == 'Event'") -public class Event extends BaseDataObject { - - @JsonProperty - private Map identifiers; - - @JsonProperty - private String baseEntityId; - - @JsonProperty - private String locationId; - - @JsonProperty - private DateTime eventDate; - - @JsonProperty - private String eventType; - - @JsonProperty - private String formSubmissionId; - - @JsonProperty - private String providerId; - - @JsonProperty - private String status; - - @JsonProperty - private Map statusHistory; - - @JsonProperty - private String priority; - - @JsonProperty - private List episodeOfCare; - - @JsonProperty - private List referrals; - - @JsonProperty - private String category; - - @JsonProperty - private int duration; - - @JsonProperty - private String reason; - - @JsonProperty - private List obs; - - @JsonProperty - private String entityType; - - @JsonProperty - private Map details; - - @JsonProperty - private long version; - - @JsonProperty - private List photos; - - @JsonProperty - private String teamId; - - @JsonProperty - private String team; - - @JsonProperty - private String childLocationId; - - public Event() { - this.version = System.currentTimeMillis(); - } - - public Event(String baseEntityId, String eventType, DateTime eventDate, String entityType, String providerId, - String locationId, String formSubmissionId) { - this.baseEntityId = baseEntityId; - this.eventType = eventType; - this.eventDate = eventDate; - this.entityType = entityType; - this.providerId = providerId; - this.locationId = locationId; - this.formSubmissionId = formSubmissionId; - this.version = System.currentTimeMillis(); - } - - public Event(String baseEntityId, String eventType, DateTime eventDate, String entityType, String providerId, - String locationId, String formSubmissionId, String teamId, String team) { - this(baseEntityId, eventType, eventDate, entityType, providerId, locationId, formSubmissionId); - setTeamId(teamId); - setTeam(team); - } - - public Event(String baseEntityId, String eventType, DateTime eventDate, String entityType, String providerId, - String locationId, String formSubmissionId, String teamId, String team, Integer clientApplicationVersion, - Integer clientDatabaseVersion) { - this(baseEntityId, eventType, eventDate, entityType, providerId, locationId, formSubmissionId, teamId, team); - setClientApplicationVersion(clientApplicationVersion); - setClientDatabaseVersion(clientDatabaseVersion); - } - - public Event(String baseEntityId, String eventType, DateTime eventDate, String entityType, String providerId, - String locationId, String formSubmissionId, String teamId, String team, String childLocationId, - Integer clientApplicationVersion, Integer clientDatabaseVersion) { - - this(baseEntityId, eventType, eventDate, entityType, providerId, locationId, formSubmissionId, teamId, team, clientApplicationVersion, clientDatabaseVersion); - setChildLocationId(childLocationId); - } - - public String getChildLocationId() { - return childLocationId; - } - - public void setChildLocationId(String childLocationId) { - this.childLocationId = childLocationId; - } - - public List getObs() { - if (obs == null) { - obs = new ArrayList<>(); - } - return obs; - } - - public Obs getObs(String parent, String concept) { - if (obs == null) { - obs = new ArrayList<>(); - } - for (Obs o : obs) { - // parent is blank OR matches with obs parent - if ((StringUtils.isBlank(parent) - || (StringUtils.isNotBlank(o.getParentCode()) && parent.equalsIgnoreCase(o.getParentCode()))) - && o.getFieldCode().equalsIgnoreCase(concept)) { - return o; //TODO handle duplicates - } - } - return null; - } - - /** - * WARNING: Overrides all existing obs - * - * @param obs - * @return - */ - public void setObs(List obs) { - this.obs = obs; - } - - public void addObs(Obs observation) { - if (obs == null) { - obs = new ArrayList<>(); - } - - obs.add(observation); - } - - public String getBaseEntityId() { - return baseEntityId; - } - - public void setBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - } - - public Map getIdentifiers() { - if (identifiers == null) { - identifiers = new HashMap<>(); - } - return identifiers; - } - - public String getIdentifier(String identifierType) { - if (identifiers == null) { - return null; - } - for (String k : identifiers.keySet()) { - if (k.equalsIgnoreCase(identifierType)) { - return identifiers.get(k); - } - } - return null; - } - - /** - * Returns field matching the regex. Note that incase of multiple fields matching criteria - * function would return first match. The must be well formed to find out a single value - * - * @param regex - * @return - */ - public String getIdentifierMatchingRegex(String regex) { - for (Entry a : getIdentifiers().entrySet()) { - if (a.getKey().matches(regex)) { - return a.getValue(); - } - } - return null; - } - - public void setIdentifiers(Map identifiers) { - this.identifiers = identifiers; - } - - public void addIdentifier(String identifierType, String identifier) { - if (identifiers == null) { - identifiers = new HashMap<>(); - } - - identifiers.put(identifierType, identifier); - } - - public void removeIdentifier(String identifierType) { - identifiers.remove(identifierType); - } - - public String getLocationId() { - return locationId; - } - - public void setLocationId(String locationId) { - this.locationId = locationId; - } - - public DateTime getEventDate() { - return eventDate; - } - - public void setEventDate(DateTime eventDate) { - this.eventDate = eventDate; - } - - public String getEventType() { - return eventType; - } - - public void setEventType(String eventType) { - this.eventType = eventType; - } - - public String getFormSubmissionId() { - return formSubmissionId; - } - - public void setFormSubmissionId(String formSubmissionId) { - this.formSubmissionId = formSubmissionId; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public String getEntityType() { - return entityType; - } - - public void setEntityType(String entityType) { - this.entityType = entityType; - } - - public Map getDetails() { - return details; - } - - public void setDetails(Map details) { - this.details = details; - } - - public void addDetails(String key, String val) { - if (details == null) { - details = new HashMap<>(); - } - details.put(key, val); - } - - public long getVersion() { - return version; - } - - public void setVersion(long version) { - this.version = version; - } - - public String getTeamId() { - return teamId; - } - - public void setTeamId(String teamId) { - this.teamId = teamId; - } - - public String getTeam() { - return team; - } - - public void setTeam(String team) { - this.team = team; - } - - public Event withBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - return this; - } - - /** - * WARNING: Overrides all existing identifiers - * - * @param identifiers - * @return - */ - public Event withIdentifiers(Map identifiers) { - this.identifiers = identifiers; - return this; - } - - public Event withIdentifier(String identifierType, String identifier) { - if (identifiers == null) { - identifiers = new HashMap<>(); - } - identifiers.put(identifierType, identifier); - return this; - } - - public Event withLocationId(String locationId) { - this.locationId = locationId; - return this; - } - - public Event withEventDate(DateTime eventDate) { - this.eventDate = eventDate; - return this; - } - - public Event withEventType(String eventType) { - this.eventType = eventType; - return this; - } - - public Event withFormSubmissionId(String formSubmissionId) { - this.formSubmissionId = formSubmissionId; - return this; - } - - public Event withProviderId(String providerId) { - this.providerId = providerId; - return this; - } - - public Event withEntityType(String entityType) { - this.entityType = entityType; - return this; - } - - public Event withChildLocationId(String childLocationId) { - setChildLocationId(childLocationId); - return this; - } - - /** - * WARNING: Overrides all existing obs - * - * @param obs - * @return - */ - public Event withObs(List obs) { - this.obs = obs; - return this; - } - - public Event withObs(Obs observation) { - if (obs == null) { - obs = new ArrayList<>(); - } - obs.add(observation); - return this; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "id", "revision"); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "id", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/ExecutionPeriod.java b/opensrp-core/src/main/java/org/opensrp/domain/ExecutionPeriod.java deleted file mode 100644 index 1e435d2cce..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/ExecutionPeriod.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.opensrp.domain; - -import org.joda.time.LocalDate; - -public class ExecutionPeriod { - private LocalDate start; - - private LocalDate end; - - public LocalDate getStart() { - return start; - } - - public void setStart(LocalDate start) { - this.start = start; - } - - public LocalDate getEnd() { - return end; - } - - public void setEnd(LocalDate end) { - this.end = end; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Form.java b/opensrp-core/src/main/java/org/opensrp/domain/Form.java deleted file mode 100644 index b6449eceb0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Form.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.opensrp.domain; - -import java.util.List; - -import org.codehaus.jackson.map.annotate.JsonSerialize; - -@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT) -public class Form { - - private String bind_type; - - private String default_bind_path; - - private List fields; - - private List sub_forms; - - public Form() { - } - - public Form(String bind_type, String default_bind_path, List fields, List sub_forms) { - this.bind_type = bind_type; - this.default_bind_path = default_bind_path; - this.fields = fields; - this.sub_forms = sub_forms; - } - - public String getBind_type() { - return bind_type; - } - - public void setBind_type(String bind_type) { - this.bind_type = bind_type; - } - - public String getDefault_bind_path() { - return default_bind_path; - } - - public void setDefault_bind_path(String default_bind_path) { - this.default_bind_path = default_bind_path; - } - - public List getFields() { - return fields; - } - - public void setFields(List fields) { - this.fields = fields; - } - - public List getSub_forms() { - return sub_forms; - } - - public void setSub_forms(List sub_forms) { - this.sub_forms = sub_forms; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/FormDefinition.java b/opensrp-core/src/main/java/org/opensrp/domain/FormDefinition.java deleted file mode 100644 index 54d2352d7a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/FormDefinition.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.opensrp.domain; - -import org.codehaus.jackson.map.annotate.JsonSerialize; - -@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT) -public class FormDefinition { - - private String form_data_definition_version = "1"; - - private Form form; - - public String getForm_data_definition_version() { - return form_data_definition_version; - } - - public void setForm_data_definition_version(String form_data_definition_version) { - this.form_data_definition_version = form_data_definition_version; - } - - public Form getForm() { - return form; - } - - public void setForm(Form form) { - this.form = form; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/FormField.java b/opensrp-core/src/main/java/org/opensrp/domain/FormField.java deleted file mode 100644 index 041386db73..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/FormField.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.opensrp.domain; - -import org.codehaus.jackson.map.annotate.JsonSerialize; - -@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT) -public class FormField { - - private String name; - - private String bind; - - private boolean shouldLoadValue; - - public FormField() { - } - - public FormField(String name, String bind) { - this.name = name; - - this.bind = bind; - } - - public String name() { - return name; - } - - public String bind() { - return bind; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getBind() { - return bind; - } - - public void setBind(String bind) { - this.bind = bind; - } - - public boolean isShouldLoadValue() { - return shouldLoadValue; - } - - public void setShouldLoadValue(boolean shouldLoadValue) { - this.shouldLoadValue = shouldLoadValue; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Geometry.java b/opensrp-core/src/main/java/org/opensrp/domain/Geometry.java deleted file mode 100644 index b9019400fb..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Geometry.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.opensrp.domain; - -import com.google.gson.JsonArray; -import com.google.gson.annotations.SerializedName; - -public class Geometry { - - public enum GeometryType { - @SerializedName("Point") - POINT, - @SerializedName("Polygon") - POLYGON, - @SerializedName("MultiPolygon") - MULTI_POLYGON - }; - - private GeometryType type; - - private JsonArray coordinates; - - public GeometryType getType() { - return type; - } - - public void setType(GeometryType type) { - this.type = type; - } - - public JsonArray getCoordinates() { - return coordinates; - } - - public void setCoordinates(JsonArray coordinates) { - this.coordinates = coordinates; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Goal.java b/opensrp-core/src/main/java/org/opensrp/domain/Goal.java deleted file mode 100644 index 190f4fd20c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Goal.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.opensrp.domain; - -import com.google.gson.annotations.SerializedName; - -import java.util.List; - -/** - * Created by samuelgithengi on 4/29/19. - */ -public class Goal { - - private String id; - - private String description; - - private String priority; - - @SerializedName("target") - private List targets; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getPriority() { - return priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public List getTargets() { - return targets; - } - - public void setTargets(List targets) { - this.targets = targets; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Hia2Indicator.java b/opensrp-core/src/main/java/org/opensrp/domain/Hia2Indicator.java deleted file mode 100644 index 05c86fce78..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Hia2Indicator.java +++ /dev/null @@ -1,136 +0,0 @@ -package org.opensrp.domain; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class Hia2Indicator { - - @JsonProperty - private String indicatorCode; - - @JsonProperty - private String label; - - @JsonProperty - private String dhisId; - - @JsonProperty - private String description; - - @JsonProperty - private String category; - - @JsonProperty - private String value; - - @JsonProperty - private String providerId; - - @JsonProperty - private String updatedAt; - - public Hia2Indicator() { - - } - - public Hia2Indicator(String indicatorCode, String label, String dhisId, String description, String category, - String value, String providerId, String updatedAt) { - this.indicatorCode = indicatorCode; - this.label = label; - this.dhisId = dhisId; - this.description = description; - this.category = category; - this.value = value; - this.providerId = providerId; - this.updatedAt = updatedAt; - - } - - public Hia2Indicator(String indicatorCode, String dhisId, String value) { - this.indicatorCode = indicatorCode; - this.dhisId = dhisId; - this.value = value; - } - - public String getIndicatorCode() { - return indicatorCode; - } - - public void setIndicatorCode(String indicatorCode) { - this.indicatorCode = indicatorCode; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public String getDhisId() { - return dhisId; - } - - public void setDhisId(String dhisId) { - this.dhisId = dhisId; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public String getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(String updatedAt) { - this.updatedAt = updatedAt; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "id", "revision"); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "id", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Location.java b/opensrp-core/src/main/java/org/opensrp/domain/Location.java deleted file mode 100644 index 2696077095..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Location.java +++ /dev/null @@ -1,279 +0,0 @@ -package org.opensrp.domain; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; - -@TypeDiscriminator("doc.type == 'Location'") -public class Location extends BaseDataObject { - - @JsonProperty - private String locationId; - - @JsonProperty - private String name; - - @JsonProperty - private Address address; - - @JsonProperty - private Map identifiers; - - @JsonProperty - private Location parentLocation; - - @JsonProperty - private Set tags; - - @JsonProperty - private Map attributes; - - public Location() { - } - - public Location(String locationId, String name, Address address, Location parentLocation) { - this.locationId = locationId; - this.name = name; - this.address = address; - this.parentLocation = parentLocation; - } - - public Location(String locationId, String name, Address address, Map identifiers, - Location parentLocation, Set tags, Map attributes) { - this.locationId = locationId; - this.name = name; - this.address = address; - this.identifiers = identifiers; - this.parentLocation = parentLocation; - this.tags = tags; - this.attributes = attributes; - } - - public String getLocationId() { - return locationId; - } - - public void setLocationId(String locationId) { - this.locationId = locationId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Address getAddress() { - return address; - } - - public void setAddress(Address address) { - this.address = address; - } - - public Map getIdentifiers() { - return identifiers; - } - - public String getIdentifier(String identifierType) { - return identifiers.get(identifierType); - } - - /** - * WARNING: Overrides all existing identifiers - * - * @param identifiers - * @return - */ - public void setIdentifiers(Map identifiers) { - this.identifiers = identifiers; - } - - public void addIdentifier(String identifierType, String identifier) { - if (identifiers == null) { - identifiers = new HashMap<>(); - } - - identifiers.put(identifierType, identifier); - } - - public void removeIdentifier(String identifierType) { - identifiers.remove(identifierType); - } - - public Location getParentLocation() { - return parentLocation; - } - - public void setParentLocation(Location parentLocation) { - this.parentLocation = parentLocation; - } - - public Set getTags() { - return tags; - } - - public boolean hasTag(String tag) { - return tags.contains(tag); - } - - /** - * WARNING: Overrides all existing tags - * - * @param tags - * @return - */ - public void setTags(Set tags) { - this.tags = tags; - } - - public void addTag(String tag) { - if (tags == null) { - tags = new HashSet<>(); - } - - tags.add(tag); - } - - public boolean removeTag(String tag) { - return tags.remove(tag); - } - - public Map getAttributes() { - return attributes; - } - - public Object getAttribute(String name) { - return attributes.get(name); - } - - /** - * WARNING: Overrides all existing attributes - * - * @param attributes - * @return - */ - public void setAttributes(Map attributes) { - this.attributes = attributes; - } - - public void addAttribute(String name, Object value) { - if (attributes == null) { - attributes = new HashMap<>(); - } - - attributes.put(name, value); - } - - public void removeAttribute(String name) { - attributes.remove(name); - } - - public Location withLocationId(String locationId) { - this.locationId = locationId; - return this; - } - - public Location withName(String name) { - this.name = name; - return this; - } - - public Location withAddress(Address address) { - this.address = address; - return this; - } - - /** - * WARNING: Overrides all existing identifiers - * - * @param identifiers - * @return - * @return - */ - public Location withIdentifiers(Map identifiers) { - this.identifiers = identifiers; - return this; - } - - public Location withIdentifier(String identifierType, String identifier) { - if (identifiers == null) { - identifiers = new HashMap<>(); - } - - identifiers.put(identifierType, identifier); - return this; - } - - public Location withParentLocation(Location parentLocation) { - this.parentLocation = parentLocation; - return this; - } - - /** - * WARNING: Overrides all existing tags - * - * @param tags - * @return - * @return - */ - public Location withTags(Set tags) { - this.tags = tags; - return this; - } - - public Location withTag(String tag) { - if (tags == null) { - tags = new HashSet<>(); - } - - tags.add(tag); - return this; - } - - /** - * WARNING: Overrides all existing attributes - * - * @param attributes - * @return - * @return - */ - public Location withAttributes(Map attributes) { - this.attributes = attributes; - return this; - } - - public Location withAttribute(String name, Object value) { - if (attributes == null) { - attributes = new HashMap<>(); - } - - attributes.put(name, value); - return this; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "id", "revision"); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "id", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/LocationDetail.java b/opensrp-core/src/main/java/org/opensrp/domain/LocationDetail.java deleted file mode 100644 index 550da8984a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/LocationDetail.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.opensrp.domain; - -import java.io.Serializable; - -public class LocationDetail implements Serializable { - private static final long serialVersionUID = 7360003982578282029L; - - private String identifier; - - private String name; - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/LocationProperty.java b/opensrp-core/src/main/java/org/opensrp/domain/LocationProperty.java deleted file mode 100644 index fe35093032..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/LocationProperty.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.opensrp.domain; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import com.google.gson.annotations.SerializedName; - -public class LocationProperty { - - public enum PropertyStatus { - @SerializedName("Active") - ACTIVE, - @SerializedName("Inactive") - INACTIVE, - @SerializedName("Pending Review") - PENDING_REVIEW; - - }; - - private String uid; - - private String code; - - private String type; - - private PropertyStatus status; - - private String parentId; - - private String name; - - private int geographicLevel; - - private Date effectiveStartDate; - - private Date effectiveEndDate; - - private int version; - - private transient Map customProperties = new HashMap<>(); - - public String getUid() { - return uid; - } - - public void setUid(String uid) { - this.uid = uid; - } - - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public PropertyStatus getStatus() { - return status; - } - - public void setStatus(PropertyStatus status) { - this.status = status; - } - - public String getParentId() { - return parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getGeographicLevel() { - return geographicLevel; - } - - public void setGeographicLevel(int geographicLevel) { - this.geographicLevel = geographicLevel; - } - - public Date getEffectiveStartDate() { - return effectiveStartDate; - } - - public void setEffectiveStartDate(Date effectiveStartDate) { - this.effectiveStartDate = effectiveStartDate; - } - - public Date getEffectiveEndDate() { - return effectiveEndDate; - } - - public void setEffectiveEndDate(Date effectiveEndDate) { - this.effectiveEndDate = effectiveEndDate; - } - - public int getVersion() { - return version; - } - - public void setVersion(int version) { - this.version = version; - } - - public Map getCustomProperties() { - return customProperties; - } - - public void setCustomProperties(Map customProperties) { - this.customProperties = customProperties; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Multimedia.java b/opensrp-core/src/main/java/org/opensrp/domain/Multimedia.java deleted file mode 100644 index 4d2b1199c2..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Multimedia.java +++ /dev/null @@ -1,120 +0,0 @@ -package org.opensrp.domain; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; -import org.motechproject.model.MotechBaseDataObject; - -@TypeDiscriminator("doc.type == 'Multimedia'") -public class Multimedia extends MotechBaseDataObject { - - @JsonProperty - private String caseId; - - @JsonProperty - private String providerId; - - @JsonProperty - private String contentType; - - @JsonProperty - private String filePath; - - @JsonProperty - private String fileCategory; - - public Multimedia() { - - } - - public Multimedia(String caseId, String providerId, String contentType, String filePath, String fileCategory) { - this.caseId = caseId; - this.providerId = providerId; - this.contentType = contentType; - this.filePath = filePath; - this.fileCategory = fileCategory; - } - - public Multimedia withCaseId(String caseId) { - this.caseId = caseId; - return this; - } - - public Multimedia withProviderId(String providerId) { - this.providerId = providerId; - return this; - } - - public Multimedia withContentType(String contentType) { - this.contentType = contentType; - return this; - } - - public Multimedia withFilePath(String filePath) { - this.filePath = filePath; - return this; - } - - public Multimedia withFileCategory(String fileCategory) { - this.fileCategory = fileCategory; - return this; - } - - public String getCaseId() { - return caseId; - } - - public String getProviderId() { - return providerId; - } - - public String getContentType() { - return contentType; - } - - public String getFilePath() { - return filePath; - } - - public String getFileCategory() { - return fileCategory; - } - - public void setCaseId(String caseId) { - this.caseId = caseId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public void setContentType(String contentType) { - this.contentType = contentType; - } - - public void setFilePath(String filePath) { - this.filePath = filePath; - } - - public void setFileCategory(String fileCategory) { - this.fileCategory = fileCategory; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "id", "revision"); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "id", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Note.java b/opensrp-core/src/main/java/org/opensrp/domain/Note.java deleted file mode 100644 index 84a01d8600..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Note.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.opensrp.domain; - -import org.joda.time.DateTime; - -public class Note { - - private String authorString; - - private DateTime time; - - private String text; - - public String getAuthorString() { - return authorString; - } - - public void setAuthorString(String authorString) { - this.authorString = authorString; - } - - public DateTime getTime() { - return time; - } - - public void setTime(DateTime time) { - this.time = time; - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Obs.java b/opensrp-core/src/main/java/org/opensrp/domain/Obs.java deleted file mode 100644 index 47894fb8f3..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Obs.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.opensrp.domain; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; -import org.joda.time.DateTime; - -public class Obs { - - @JsonProperty - private String fieldType; - - @JsonProperty - private String fieldDataType; - - @JsonProperty - private String fieldCode; - - @JsonProperty - private String parentCode; - - @JsonProperty - private List values; - - //hold unique values here - Set set = new HashSet(); - - @JsonProperty - private String comments; - - @JsonProperty - private String formSubmissionField; - - @JsonProperty - private DateTime effectiveDatetime; - - @JsonProperty - private List humanReadableValues; - - public Obs() { - } - - public Obs(String fieldType, String fieldDataType, String fieldCode, String parentCode, List values, - List humanReadableValues, String comments, String formSubmissionField) { - this.setFieldType(fieldType); - this.fieldDataType = fieldDataType; - this.fieldCode = fieldCode; - this.parentCode = parentCode; - this.values = values; - this.humanReadableValues = humanReadableValues; - this.comments = comments; - this.formSubmissionField = formSubmissionField; - } - - public Obs(String fieldType, String fieldDataType, String fieldCode, String parentCode, Object value, String comments, - String formSubmissionField) { - this.setFieldType(fieldType); - this.fieldDataType = fieldDataType; - this.fieldCode = fieldCode; - this.parentCode = parentCode; - addToValueList(value); - this.comments = comments; - this.formSubmissionField = formSubmissionField; - } - - public String getFieldType() { - return fieldType; - } - - public void setFieldType(String fieldType) { - this.fieldType = fieldType; - } - - public String getFieldDataType() { - return fieldDataType; - } - - public void setFieldDataType(String fieldDataType) { - this.fieldDataType = fieldDataType; - } - - public String getFieldCode() { - return fieldCode; - } - - public void setFieldCode(String fieldCode) { - this.fieldCode = fieldCode; - } - - public String getParentCode() { - return parentCode; - } - - public void setParentCode(String parentCode) { - this.parentCode = parentCode; - } - - @JsonIgnore - public Object getValue() { - - if (values == null || values.size() == 0) { - return null; - } - - if (values.size() > 1) { - throw new RuntimeException( - "Multiset values can not be handled like single valued fields. Use function getValues"); - } - - return values.get(0); - } - - @JsonIgnore - public void setValue(Object value) { - addToValueList(value); - } - - public List getHumanReadableValues() { - return humanReadableValues; - } - - public void setHumanReadableValues(List humanReadableValues) { - this.humanReadableValues = humanReadableValues; - } - - public List getValues() { - return values; - } - - public void setValues(List values) { - this.values = values; - } - - public String getComments() { - return comments; - } - - public void setComments(String comments) { - this.comments = comments; - } - - public String getFormSubmissionField() { - return formSubmissionField; - } - - public void setFormSubmissionField(String formSubmissionField) { - this.formSubmissionField = formSubmissionField; - } - - public DateTime getEffectiveDatetime() { - return effectiveDatetime; - } - - public void setEffectiveDatetime(DateTime effectiveDatetime) { - this.effectiveDatetime = effectiveDatetime; - } - - public Obs withFieldType(String fieldType) { - this.fieldType = fieldType; - return this; - } - - public Obs withFieldDataType(String fieldDataType) { - this.fieldDataType = fieldDataType; - return this; - } - - public Obs withFieldCode(String fieldCode) { - this.fieldCode = fieldCode; - return this; - } - - public Obs withParentCode(String parentCode) { - this.parentCode = parentCode; - return this; - } - - public Obs withValue(Object value) { - return addToValueList(value); - } - - public Obs withValues(List values) { - this.values = values; - return this; - } - - @SuppressWarnings("unchecked") - public Obs addToValueList(Object value) { - if (value == null) { - return this; - } - if (values == null) { - values = new ArrayList<>(); - } - //make the object a bit more linear. If value is a list, the values json object will be an array with arrays inside - - if (value instanceof List) { - set.addAll((Collection) value); - - } else { - set.add(value.toString()); - } - values.clear(); - values.addAll(set); - return this; - } - - public Obs withComments(String comments) { - this.comments = comments; - return this; - } - - public Obs withFormSubmissionField(String formSubmissionField) { - this.formSubmissionField = formSubmissionField; - return this; - } - - public Obs withEffectiveDatetime(DateTime effectiveDatetime) { - this.effectiveDatetime = effectiveDatetime; - return this; - - } - - public Obs withHumanReadableValues(List humanReadableValues) { - this.humanReadableValues = humanReadableValues; - return this; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "set"); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "set"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Organization.java b/opensrp-core/src/main/java/org/opensrp/domain/Organization.java deleted file mode 100644 index 52b1c785e1..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Organization.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - */ -package org.opensrp.domain; - -import java.io.Serializable; -import java.util.Set; - -/** - * @author Samuel Githengi created on 08/30/19 - */ -public class Organization implements Serializable { - - private static final long serialVersionUID = -9204925528493297488L; - - private Long id; - - private String identifier; - - private boolean active; - - private String name; - - private Long partOf; - - public CodeSystem type; - - private Set assignedLocations; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public boolean isActive() { - return active; - } - - public void setActive(boolean active) { - this.active = active; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Long getPartOf() { - return partOf; - } - - public void setPartOf(Long partOf) { - this.partOf = partOf; - } - - public CodeSystem getType() { - return type; - } - - public void setType(CodeSystem type) { - this.type = type; - } - - public Set getAssignedLocations() { - return assignedLocations; - } - - public void setAssignedLocations(Set assignedLocations) { - this.assignedLocations = assignedLocations; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Photo.java b/opensrp-core/src/main/java/org/opensrp/domain/Photo.java deleted file mode 100644 index b8de3e81e3..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Photo.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.opensrp.domain; - -import org.joda.time.DateTime; - -public class Photo { - - private String contentType; - - private String language; - - private String uri; - - private int size; - - private String title; - - private String category; - - private DateTime dateCreated; - - public Photo() { - - } - - public String getContentType() { - return contentType; - } - - public void setContentType(String contentType) { - this.contentType = contentType; - } - - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public int getSize() { - return size; - } - - public void setSize(int size) { - this.size = size; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getCategory() { - return category; - } - - public void setCategory(String category) { - this.category = category; - } - - public DateTime getDateCreated() { - return dateCreated; - } - - public void setDateCreated(DateTime dateCreated) { - this.dateCreated = dateCreated; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/PhysicalLocation.java b/opensrp-core/src/main/java/org/opensrp/domain/PhysicalLocation.java deleted file mode 100644 index 49a8a4e68c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/PhysicalLocation.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.opensrp.domain; - -public class PhysicalLocation { - - private String type; - - private String id; - - private Geometry geometry; - - private LocationProperty properties; - - private Long serverVersion; - - private transient boolean isJurisdiction; - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Geometry getGeometry() { - return geometry; - } - - public void setGeometry(Geometry geometry) { - this.geometry = geometry; - } - - public LocationProperty getProperties() { - return properties; - } - - public void setProperties(LocationProperty properties) { - this.properties = properties; - } - - public Long getServerVersion() { - return serverVersion; - } - - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - - public boolean isJurisdiction() { - return isJurisdiction; - } - - public void setJurisdiction(boolean isJurisdiction) { - this.isJurisdiction = isJurisdiction; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/PlanDefinition.java b/opensrp-core/src/main/java/org/opensrp/domain/PlanDefinition.java deleted file mode 100644 index 7e8d649eca..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/PlanDefinition.java +++ /dev/null @@ -1,173 +0,0 @@ -package org.opensrp.domain; - -import com.google.gson.annotations.SerializedName; -import org.codehaus.jackson.annotate.JsonProperty; -import org.joda.time.LocalDate; -import org.opensrp.domain.postgres.Jurisdiction; - -import java.util.List; - -/** - * Created by samuelgithengi on 4/29/19. - */ -public class PlanDefinition { - - @JsonProperty - private String identifier; - - @JsonProperty - private String version; - - @JsonProperty - private String name; - - @JsonProperty - private String title; - - @JsonProperty - private String status; - - @JsonProperty - private LocalDate date; - - @JsonProperty - private ExecutionPeriod effectivePeriod; - - @JsonProperty - private List useContext; - - @JsonProperty - private List jurisdiction; - - private Long serverVersion; - - @JsonProperty - @SerializedName("goal") - private List goals; - - @JsonProperty - @SerializedName("action") - private List actions; - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public LocalDate getDate() { - return date; - } - - public void setDate(LocalDate date) { - this.date = date; - } - - public ExecutionPeriod getEffectivePeriod() { - return effectivePeriod; - } - - public void setEffectivePeriod(ExecutionPeriod effectivePeriod) { - this.effectivePeriod = effectivePeriod; - } - - public List getUseContext() { - return useContext; - } - - public void setUseContext(List useContext) { - this.useContext = useContext; - } - - public List getJurisdiction() { - return jurisdiction; - } - - public void setJurisdiction(List jurisdiction) { - this.jurisdiction = jurisdiction; - } - - public List getGoals() { - return goals; - } - - public void setGoals(List goals) { - this.goals = goals; - } - - public List getActions() { - return actions; - } - - public void setActions(List actions) { - this.actions = actions; - } - - public Long getServerVersion() { - return serverVersion; - } - - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - - static class UseContext { - private String code; - - private String valueCodableConcept; - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getValueCodableConcept() { - return valueCodableConcept; - } - - public void setValueCodableConcept(String valueCodableConcept) { - this.valueCodableConcept = valueCodableConcept; - } - } -} - - - - diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Practitioner.java b/opensrp-core/src/main/java/org/opensrp/domain/Practitioner.java deleted file mode 100644 index 6d5fe994ae..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Practitioner.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.opensrp.domain; - -import java.io.Serializable; -import java.util.Date; - -public class Practitioner implements Serializable { - - private static final long serialVersionUID = -8367551045898354954L; - - private String identifier; - - private Boolean active; - - private String name; - - private String userId; - - private String username; - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public Boolean getActive() { - return active; - } - - public void setActive(Boolean active) { - this.active = active; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/PractitionerRole.java b/opensrp-core/src/main/java/org/opensrp/domain/PractitionerRole.java deleted file mode 100644 index b81bd52052..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/PractitionerRole.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.opensrp.domain; - -import com.google.gson.annotations.SerializedName; -import org.codehaus.jackson.annotate.JsonProperty; - -import java.io.Serializable; - -public class PractitionerRole implements Serializable { - - private static final long serialVersionUID = -2472589757270251270L; - @JsonProperty - private String identifier; - - @JsonProperty - private Boolean active; - - @JsonProperty - @SerializedName("organization") - private String organizationIdentifier; - - @JsonProperty - @SerializedName("practitioner") - private String practitionerIdentifier; - - @JsonProperty - private PractitionerRoleCode code; - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public Boolean getActive() { - return active; - } - - public void setActive(Boolean active) { - this.active = active; - } - - public String getOrganizationIdentifier() { - return organizationIdentifier; - } - - public void setOrganizationIdentifier(String organizationIdentifier) { - this.organizationIdentifier = organizationIdentifier; - } - - public String getPractitionerIdentifier() { - return practitionerIdentifier; - } - - public void setPractitionerIdentifier(String practitionerIdentifier) { - this.practitionerIdentifier = practitionerIdentifier; - } - - public PractitionerRoleCode getCode() { - return code; - } - - public void setCode(PractitionerRoleCode code) { - this.code = code; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/PractitionerRoleCode.java b/opensrp-core/src/main/java/org/opensrp/domain/PractitionerRoleCode.java deleted file mode 100644 index f91b765c1a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/PractitionerRoleCode.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.opensrp.domain; - -import java.io.Serializable; - -public class PractitionerRoleCode implements Serializable { - - private static final long serialVersionUID = 5814439241291810987L; - private String text; - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Provider.java b/opensrp-core/src/main/java/org/opensrp/domain/Provider.java deleted file mode 100644 index 8f3628151c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Provider.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.opensrp.domain; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.ektorp.support.TypeDiscriminator; - -@TypeDiscriminator("doc.type == 'Provider'") -public class Provider extends BaseEntity { - - private String fullName; - - protected Provider() { - - } - - public Provider(String baseEntityId) { - super(baseEntityId); - } - - public Provider(String baseEntityId, String fullName) { - super(baseEntityId); - this.setFullName(fullName); - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "id", "revision"); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "id", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - public String getFullName() { - return fullName; - } - - public void setFullName(String fullName) { - this.fullName = fullName; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/RapidProContact.java b/opensrp-core/src/main/java/org/opensrp/domain/RapidProContact.java deleted file mode 100644 index 3fe8251c30..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/RapidProContact.java +++ /dev/null @@ -1,231 +0,0 @@ -package org.opensrp.domain; - -import org.joda.time.DateTime; - -public class RapidProContact implements Comparable { - - private String motherFirstName; - - private String motherSecondName; - - private String motherZeirID; - - private String motherTel; - - private String homeFacility; - - private String residentialArea; - - private String homeAddress; - - private String landMark; - - private String birthDate; - - private String dateJoined; - - private Long serverVersion; - - private String childName; - - private String zeirID; - - private String mvaccUuid; - - private String baseEntityId; - - private String c2dob; - - private String c2zeir; - - private String c2name; - - private String c3dob; - - private String c3zeir; - - private String c3name; - - private DateTime dateCreated; - - public String getMotherFirstName() { - return motherFirstName; - } - - public void setMotherFirstName(String motherFirstName) { - this.motherFirstName = motherFirstName; - } - - public String getMotherSecondName() { - return motherSecondName; - } - - public void setMotherSecondName(String motherSecondName) { - this.motherSecondName = motherSecondName; - } - - public String getMotherZeirID() { - return motherZeirID; - } - - public void setMotherZeirID(String motherZeirID) { - this.motherZeirID = motherZeirID; - } - - public String getMotherTel() { - return motherTel; - } - - public void setMotherTel(String motherTel) { - this.motherTel = motherTel; - } - - public String getHomeFacility() { - return homeFacility; - } - - public void setHomeFacility(String homeFacility) { - this.homeFacility = homeFacility; - } - - public String getResidentialArea() { - return residentialArea; - } - - public void setResidentialArea(String residentialArea) { - this.residentialArea = residentialArea; - } - - public String getHomeAddress() { - return homeAddress; - } - - public void setHomeAddress(String homeAddress) { - this.homeAddress = homeAddress; - } - - public String getLandMark() { - return landMark; - } - - public void setLandMark(String landMark) { - this.landMark = landMark; - } - - public String getBirthDate() { - return birthDate; - } - - public void setBirthDate(String birthDate) { - this.birthDate = birthDate; - } - - public String getDateJoined() { - return dateJoined; - } - - public void setDateJoined(String dateJoined) { - this.dateJoined = dateJoined; - } - - public Long getServerVersion() { - return serverVersion; - } - - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - - public String getChildName() { - return childName; - } - - public void setChildName(String childName) { - this.childName = childName; - } - - public String getMvaccUuid() { - return mvaccUuid; - } - - public void setMvaccUuid(String mvaccUuid) { - this.mvaccUuid = mvaccUuid; - } - - public String getBaseEntityId() { - return baseEntityId; - } - - public void setBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - } - - public String getC2dob() { - return c2dob; - } - - public void setC2dob(String c2dob) { - this.c2dob = c2dob; - } - - public String getC2name() { - return c2name; - } - - public void setC2name(String c2name) { - this.c2name = c2name; - } - - public String getC3dob() { - return c3dob; - } - - public void setC3dob(String c3dob) { - this.c3dob = c3dob; - } - - public String getC3name() { - return c3name; - } - - public void setC3name(String c3name) { - this.c3name = c3name; - } - - public DateTime getDateCreated() { - return dateCreated; - } - - public void setDateCreated(DateTime dateCreated) { - this.dateCreated = dateCreated; - } - - public String getZeirID() { - return zeirID; - } - - public void setZeirID(String zeirID) { - this.zeirID = zeirID; - } - - public String getC2zeir() { - return c2zeir; - } - - public void setC2zeir(String c2zeir) { - this.c2zeir = c2zeir; - } - - public String getC3zeir() { - return c3zeir; - } - - public void setC3zeir(String c3zeir) { - this.c3zeir = c3zeir; - } - - @Override - public int compareTo(Client client) { - return getDateCreated().compareTo(client.getDateCreated()); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Report.java b/opensrp-core/src/main/java/org/opensrp/domain/Report.java deleted file mode 100644 index bc6fef7574..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Report.java +++ /dev/null @@ -1,147 +0,0 @@ -package org.opensrp.domain; - -import java.util.List; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; -import org.joda.time.DateTime; - -@TypeDiscriminator("doc.type == 'Report'") -public class Report extends BaseEntity { - - @JsonProperty - private String locationId; - - @JsonProperty - private DateTime reportDate; - - @JsonProperty - private String reportType; - - @JsonProperty - private String formSubmissionId; - - @JsonProperty - private String providerId; - - @JsonProperty - private String status; - - @JsonProperty - private long version; - - @JsonProperty - private int duration; - - @JsonProperty - private List hia2Indicators; - - public Report() { - this.version = System.currentTimeMillis(); - } - - public Report(String baseEntityId, String locationId, DateTime reportDate, String reportType, String formSubmissionId, - String providerId, String status, long version, int duration, List hia2Indicators) { - super(baseEntityId); - this.locationId = locationId; - this.reportDate = reportDate; - this.reportType = reportType; - this.formSubmissionId = formSubmissionId; - this.providerId = providerId; - this.status = status; - this.version = version; - this.duration = duration; - this.hia2Indicators = hia2Indicators; - } - - public String getLocationId() { - return locationId; - } - - public void setLocationId(String locationId) { - this.locationId = locationId; - } - - public DateTime getReportDate() { - return reportDate; - } - - public void setReportDate(DateTime reportDate) { - this.reportDate = reportDate; - } - - public String getReportType() { - return reportType; - } - - public void setReportType(String reportType) { - this.reportType = reportType; - } - - public String getFormSubmissionId() { - return formSubmissionId; - } - - public void setFormSubmissionId(String formSubmissionId) { - this.formSubmissionId = formSubmissionId; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public long getVersion() { - return version; - } - - public void setVersion(long version) { - this.version = version; - } - - public int getDuration() { - return duration; - } - - public void setDuration(int duration) { - this.duration = duration; - } - - public List getHia2Indicators() { - return hia2Indicators; - } - - public void setHia2Indicators(List hia2Indicators) { - this.hia2Indicators = hia2Indicators; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "id", "revision"); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "id", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Search.java b/opensrp-core/src/main/java/org/opensrp/domain/Search.java deleted file mode 100644 index 4072389e1e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Search.java +++ /dev/null @@ -1,254 +0,0 @@ -package org.opensrp.domain; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; -import org.joda.time.DateTime; -import org.opensrp.common.Gender; - -@TypeDiscriminator("doc.type == 'Client'") -public class Search extends BaseEntity { - - @JsonProperty - private String firstName; - - @JsonProperty - private String middleName; - - @JsonProperty - private String lastName; - - @JsonProperty - private DateTime birthdate; - - @JsonProperty - private Boolean birthdateApprox; - - @JsonProperty - private String gender; - - @JsonProperty - private Map> relationships; - - protected Search() { - - } - - public Search(String baseEntityId) { - super(baseEntityId); - } - - public Search(String baseEntityId, String firstName, String middleName, String lastName, DateTime birthdate, - Boolean birthdateApprox, String gender) { - super(baseEntityId); - this.firstName = firstName; - this.middleName = middleName; - this.lastName = lastName; - this.birthdate = birthdate; - this.birthdateApprox = birthdateApprox; - this.gender = gender; - } - - public Search(String baseEntityId, String firstName, String middleName, String lastName, DateTime birthdate, - Boolean birthdateApprox, String gender, String identifierType, String identifier) { - super(baseEntityId); - this.firstName = firstName; - this.middleName = middleName; - this.lastName = lastName; - this.birthdate = birthdate; - this.birthdateApprox = birthdateApprox; - this.gender = gender; - addIdentifier(identifierType, identifier); - } - - public Search(String baseEntityId, String firstName, String middleName, String lastName, DateTime birthdate, - Boolean birthdateApprox, String gender, List
addresses, Map identifiers, - Map attributes) { - super(baseEntityId); - this.firstName = firstName; - this.middleName = middleName; - this.lastName = lastName; - this.birthdate = birthdate; - this.birthdateApprox = birthdateApprox; - this.gender = gender; - setIdentifiers(identifiers); - setAddresses(addresses); - setAttributes(attributes); - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getMiddleName() { - return middleName; - } - - public void setMiddleName(String middleName) { - this.middleName = middleName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String fullName() { - String n = ""; - if (StringUtils.isNotBlank(firstName)) { - n += firstName; - } - if (StringUtils.isNotBlank(middleName)) { - n += " " + middleName; - } - if (StringUtils.isNotBlank(lastName)) { - n += " " + lastName; - } - return n.trim(); - } - - public DateTime getBirthdate() { - return birthdate; - } - - public void setBirthdate(DateTime birthdate) { - this.birthdate = birthdate; - } - - public Boolean getBirthdateApprox() { - return birthdateApprox; - } - - public void setBirthdateApprox(Boolean birthdateApprox) { - this.birthdateApprox = birthdateApprox; - } - - public String getGender() { - return gender; - } - - public void setGender(String gender) { - this.gender = gender; - } - - public Map> getRelationships() { - return relationships; - } - - public void setRelationships(Map> relationships) { - this.relationships = relationships; - } - - public Search withFirstName(String firstName) { - this.firstName = firstName; - return this; - } - - public Search withMiddleName(String middleName) { - this.middleName = middleName; - return this; - } - - public Search withLastName(String lastName) { - this.lastName = lastName; - return this; - } - - public Search withName(String firstName, String middleName, String lastName) { - this.firstName = firstName; - this.middleName = middleName; - this.lastName = lastName; - return this; - } - - public Search withBirthdate(DateTime birthdate, Boolean isApproximate) { - this.birthdate = birthdate; - this.birthdateApprox = isApproximate; - return this; - } - - public Search withGender(String gender) { - this.gender = gender; - return this; - } - - public Search withGender(Gender gender) { - this.gender = gender.name(); - return this; - } - - /** - * Overrides the existing data - */ - public Search withRelationships(Map> relationships) { - this.relationships = relationships; - return this; - } - - public List findRelatives(String relationshipType) { - if (relationships == null) { - relationships = new HashMap<>(); - } - - return relationships.get(relationshipType); - } - - public void addRelationship(String relationType, String relativeEntityId) { - if (relationships == null) { - relationships = new HashMap<>(); - } - - List relatives = findRelatives(relationType); - if (relatives == null) { - relatives = new ArrayList<>(); - } - relatives.add(relativeEntityId); - relationships.put(relationType, relatives); - } - - public List getRelationships(String relativeEntityId) { - List relations = new ArrayList(); - for (Entry> rl : relationships.entrySet()) { - List relativeEntityIdList = rl.getValue(); - for (String entityId : relativeEntityIdList) { - if (entityId.equalsIgnoreCase(relativeEntityId)) { - relations.add(rl.getKey()); - break; - } - } - } - return relations; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "id", "revision"); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "id", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Stock.java b/opensrp-core/src/main/java/org/opensrp/domain/Stock.java deleted file mode 100644 index 026443ed53..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Stock.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.opensrp.domain; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; - -@JsonIgnoreProperties(ignoreUnknown = true) -@TypeDiscriminator("doc.type == 'Stock'") -public class Stock extends BaseDataObject { - - @JsonProperty - private Long identifier; - - @JsonProperty - private String vaccine_type_id; - - @JsonProperty - private String transaction_type; - - @JsonProperty - private String providerid; - - @JsonProperty - private int value; - - @JsonProperty - private Long date_created; - - @JsonProperty - private String to_from; - - @JsonProperty - private Long date_updated; - - @JsonProperty - private long version; - - public Stock() { - this.version = System.currentTimeMillis(); - } - - public Stock(Long identifier, String vaccine_type_id, String transaction_type, String providerid, int value, - Long date_created, String to_from, Long date_updated, long version) { - this.identifier = identifier; - this.vaccine_type_id = vaccine_type_id; - this.transaction_type = transaction_type; - this.providerid = providerid; - this.value = value; - this.date_created = date_created; - this.to_from = to_from; - this.date_updated = date_updated; - this.version = version; - } - - public Long getIdentifier() { - return identifier; - } - - public void setIdentifier(Long identifier) { - this.identifier = identifier; - } - - public String getVaccine_type_id() { - return vaccine_type_id; - } - - public void setVaccine_type_id(String vaccine_type_id) { - this.vaccine_type_id = vaccine_type_id; - } - - public String getTransaction_type() { - return transaction_type; - } - - public void setTransaction_type(String transaction_type) { - this.transaction_type = transaction_type; - } - - public String getProviderid() { - return providerid; - } - - public void setProviderid(String providerid) { - this.providerid = providerid; - } - - public int getValue() { - return value; - } - - public void setValue(int value) { - this.value = value; - } - - public Long getDate_created() { - return date_created; - } - - public void setDate_created(Long date_created) { - this.date_created = date_created; - } - - public String getTo_from() { - return to_from; - } - - public void setTo_from(String to_from) { - this.to_from = to_from; - } - - public Long getDate_updated() { - return date_updated; - } - - public void setDate_updated(Long date_updated) { - this.date_updated = date_updated; - } - - public long getVersion() { - return version; - } - - public void setVersion(long version) { - this.version = version; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "id", "revision"); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "id", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/StructureDetails.java b/opensrp-core/src/main/java/org/opensrp/domain/StructureDetails.java deleted file mode 100644 index 5e2b2bcf7d..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/StructureDetails.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.opensrp.domain; - -import java.util.HashSet; -import java.util.Set; - -public class StructureDetails { - - private String structureId; - - private String structureParentId; - - private String structureType; - - private String familyId; - - private Set familyMembers = new HashSet<>(); - - public StructureDetails(String structureId, String structureParentId, String structureType) { - super(); - this.structureId = structureId; - this.structureParentId = structureParentId; - this.structureType = structureType; - } - - public String getStructureId() { - return structureId; - } - - public void setStructureId(String structureId) { - this.structureId = structureId; - } - - public String getStructureParentId() { - return structureParentId; - } - - public void setStructureParentId(String structureParentId) { - this.structureParentId = structureParentId; - } - - public String getStructureType() { - return structureType; - } - - public void setStructureType(String structureType) { - this.structureType = structureType; - } - - public String getFamilyId() { - return familyId; - } - - public void setFamilyId(String familyId) { - this.familyId = familyId; - } - - public Set getFamilyMembers() { - return familyMembers; - } - - public void setFamilyMembers(Set familyMembers) { - this.familyMembers = familyMembers; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof StructureDetails)) - return false; - StructureDetails other = (StructureDetails) obj; - return structureId.equals(other.getStructureId()); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/SubFormDefinition.java b/opensrp-core/src/main/java/org/opensrp/domain/SubFormDefinition.java deleted file mode 100644 index 8a66217a33..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/SubFormDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.opensrp.domain; - -import java.util.List; - -public class SubFormDefinition { - - private String name; - - private String bind_type; - - private String default_bind_path; - - private List fields; - - //private List> instances; - - public SubFormDefinition() { - // this.instances = new ArrayList<>(); - this.name = ""; - } - - public SubFormDefinition(String name, List fields) { - // this.instances = instances; - this.fields = fields; - this.name = name; - } - - public String name() { - return name; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getBind_type() { - return bind_type; - } - - public void setBind_type(String bind_type) { - this.bind_type = bind_type; - } - - public String getDefault_bind_path() { - return default_bind_path; - } - - public void setDefault_bind_path(String default_bind_path) { - this.default_bind_path = default_bind_path; - } - - public List getFields() { - return fields; - } - - public void setFields(List fields) { - this.fields = fields; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Target.java b/opensrp-core/src/main/java/org/opensrp/domain/Target.java deleted file mode 100644 index 032dac325a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Target.java +++ /dev/null @@ -1,139 +0,0 @@ -package org.opensrp.domain; - -import org.joda.time.LocalDate; - -/** - * Created by samuelgithengi on 4/29/19. - */ -public class Target { - - private String measure; - - private Detail detail; - - private LocalDate due; - - public String getMeasure() { - return measure; - } - - public void setMeasure(String measure) { - this.measure = measure; - } - - public LocalDate getDue() { - return due; - } - - public void setDue(LocalDate due) { - this.due = due; - } - - public Detail getDetail() { - return detail; - } - - public void setDetail(Detail detail) { - this.detail = detail; - } - - static class Detail { - private Measure detailQuantity; - - private MeasureRange detailRange; - - private DetailCodableConcept detailCodableConcept; - - public Measure getDetailQuantity() { - return detailQuantity; - } - - public void setDetailQuantity(Measure detailQuantity) { - this.detailQuantity = detailQuantity; - } - - public MeasureRange getDetailRange() { - return detailRange; - } - - public void setDetailRange(MeasureRange detailRange) { - this.detailRange = detailRange; - } - - public DetailCodableConcept getDetailCodableConcept() { - return detailCodableConcept; - } - - public void setDetailCodableConcept(DetailCodableConcept detailCodableConcept) { - this.detailCodableConcept = detailCodableConcept; - } - } - - static class Measure { - private float value; - - private String comparator; - - private String unit; - - public float getValue() { - return value; - } - - public void setValue(float value) { - this.value = value; - } - - public String getComparator() { - return comparator; - } - - public void setComparator(String comparator) { - this.comparator = comparator; - } - - public String getUnit() { - return unit; - } - - public void setUnit(String unit) { - this.unit = unit; - } - } - - static class MeasureRange { - private Measure high; - - private Measure low; - - public Measure getHigh() { - return high; - } - - public void setHigh(Measure high) { - this.high = high; - } - - public Measure getLow() { - return low; - } - - public void setLow(Measure low) { - this.low = low; - } - } - - static class DetailCodableConcept { - private String text; - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - } -} - - diff --git a/opensrp-core/src/main/java/org/opensrp/domain/Task.java b/opensrp-core/src/main/java/org/opensrp/domain/Task.java deleted file mode 100644 index 8fd160a2ce..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/Task.java +++ /dev/null @@ -1,224 +0,0 @@ -package org.opensrp.domain; - -import java.util.List; - -import org.joda.time.DateTime; - -import com.google.gson.annotations.SerializedName; - -public class Task { - - public enum TaskStatus { - @SerializedName("Draft") - DRAFT, @SerializedName("Ready") - READY, @SerializedName("Cancelled") - CANCELLED, @SerializedName("In Progress") - IN_PROGRESS, @SerializedName("Completed") - COMPLETED, @SerializedName("Failed") - FAILED, @SerializedName("Archived") - ARCHIVED - } - - private String identifier; - - private String planIdentifier; - - private String groupIdentifier; - - private TaskStatus status; - - private String businessStatus; - - private int priority; - - private String code; - - private String description; - - private String focus; - - @SerializedName("for") - private String forEntity; - - private DateTime executionStartDate; - - private DateTime executionEndDate; - - private DateTime authoredOn; - - private DateTime lastModified; - - private String owner; - - @SerializedName("note") - private List notes; - - private Long serverVersion; - - private String reasonReference; - - private String location; - - private String requester; - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public String getPlanIdentifier() { - return planIdentifier; - } - - public void setPlanIdentifier(String planIdentifier) { - this.planIdentifier = planIdentifier; - } - - public String getGroupIdentifier() { - return groupIdentifier; - } - - public void setGroupIdentifier(String groupIdentifier) { - this.groupIdentifier = groupIdentifier; - } - - public TaskStatus getStatus() { - return status; - } - - public void setStatus(TaskStatus status) { - this.status = status; - } - - public String getBusinessStatus() { - return businessStatus; - } - - public void setBusinessStatus(String businessStatus) { - this.businessStatus = businessStatus; - } - - public int getPriority() { - return priority; - } - - public void setPriority(int priority) { - this.priority = priority; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getFocus() { - return focus; - } - - public void setFocus(String focus) { - this.focus = focus; - } - - public String getForEntity() { - return forEntity; - } - - public void setForEntity(String forEntity) { - this.forEntity = forEntity; - } - - public DateTime getExecutionStartDate() { - return executionStartDate; - } - - public void setExecutionStartDate(DateTime executionStartDate) { - this.executionStartDate = executionStartDate; - } - - public DateTime getExecutionEndDate() { - return executionEndDate; - } - - public void setExecutionEndDate(DateTime executionEndDate) { - this.executionEndDate = executionEndDate; - } - - public DateTime getAuthoredOn() { - return authoredOn; - } - - public void setAuthoredOn(DateTime authoredOn) { - this.authoredOn = authoredOn; - } - - public DateTime getLastModified() { - return lastModified; - } - - public void setLastModified(DateTime lastModified) { - this.lastModified = lastModified; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public List getNotes() { - return notes; - } - - public void setNotes(List notes) { - this.notes = notes; - } - - public Long getServerVersion() { - return serverVersion; - } - - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - - public String getReasonReference() { - return reasonReference; - } - - public void setReasonReference(String reasonReference) { - this.reasonReference = reasonReference; - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } - - public String getRequester() { - return requester; - } - - public void setRequester(String requester) { - this.requester = requester; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/TaskUpdate.java b/opensrp-core/src/main/java/org/opensrp/domain/TaskUpdate.java deleted file mode 100644 index 68004520d0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/TaskUpdate.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.opensrp.domain; - -import com.google.gson.annotations.SerializedName; - -public class TaskUpdate { - - @SerializedName("identifier") - private String identifier; - - @SerializedName("status") - private String status; - - @SerializedName("businessStatus") - private String businessStatus; - - @SerializedName("serverVersion") - private Long serverVersion; - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getBusinessStatus() { - return businessStatus; - } - - public void setBusinessStatus(String businessStatus) { - this.businessStatus = businessStatus; - } - - public Long getServerVersion() { - return serverVersion; - } - - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/UniqueId.java b/opensrp-core/src/main/java/org/opensrp/domain/UniqueId.java deleted file mode 100644 index 2a154c9a2e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/UniqueId.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.opensrp.domain; - -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; - -@Entity -@Table(name = "unique_ids") -public class UniqueId { - - public static final String tbName = "unique_ids"; - - public static final String COL_OPENMRSID = "openmrs_id"; - - public static final String COL_STATUS = "status"; - - public static final String COL_USEDBY = "used_by"; - - public static final String COL_LOCATION = "location"; - - public static final String COL_CREATED_AT = "created_at"; - - public static final String COL_UPDATED_AT = "updated_at"; - - public static String STATUS_USED = "used"; - - public static String STATUS_NOT_USED = "not_used"; - - @Id - @GeneratedValue - @Column(name = "_id") - private Long id; - - @Column(name = COL_OPENMRSID) - private String openmrsId; - - @Column(name = COL_STATUS) - private String status; - - @Column(name = COL_USEDBY) - private String usedBy; - - @Column(name = COL_LOCATION) - private String location; - - @Column(name = COL_CREATED_AT, columnDefinition = "DATETIME") - @Temporal(TemporalType.TIMESTAMP) - private Date createdAt; - - @Column(name = COL_UPDATED_AT, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") - @Temporal(TemporalType.TIMESTAMP) - private Date updatedAt; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getOpenmrsId() { - return openmrsId; - } - - public void setOpenmrsId(String openmrsId) { - this.openmrsId = openmrsId; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getUsedBy() { - return usedBy; - } - - public void setUsedBy(String usedBy) { - this.usedBy = usedBy; - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } - - public Date getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - public Date getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(Date updatedAt) { - this.updatedAt = updatedAt; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/User.java b/opensrp-core/src/main/java/org/opensrp/domain/User.java deleted file mode 100644 index 4d3aa0ebb7..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/User.java +++ /dev/null @@ -1,259 +0,0 @@ -package org.opensrp.domain; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; - -@TypeDiscriminator("doc.type == 'User'") -public class User extends BaseEntity { - - @JsonProperty - private String username; - - @JsonProperty - private String password; - - @JsonProperty - private String salt; - - @JsonProperty - private String status; - - @JsonProperty - private List roles; - - @JsonProperty - private List permissions; - - protected User() { - - } - - public User(String baseEntityId) { - super(baseEntityId); - } - - public User(String baseEntityId, String username, String password, String salt) { - super(baseEntityId); - this.username = username; - this.password = password; - this.salt = salt; - } - - public User(String baseEntityId, String username, String password, String salt, String status, List roles, - List permissions) { - super(baseEntityId); - this.username = username; - this.password = password; - this.salt = salt; - this.status = status; - this.roles = roles; - this.permissions = permissions; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getSalt() { - return salt; - } - - public void setSalt(String salt) { - this.salt = salt; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public List getRoles() { - return roles; - } - - /** - * WARNING: Overrides all existing roles - * - * @param roles - * @return - */ - public void setRoles(List roles) { - this.roles = roles; - } - - @JsonIgnore - public void addRole(String role) { - if (roles == null) { - roles = new ArrayList<>(); - } - roles.add(role); - } - - @JsonIgnore - public boolean removeRole(String role) { - return roles.remove(role); - } - - @JsonIgnore - public boolean hasRole(String role) { - if (roles != null) - for (String r : roles) { - if (role.equalsIgnoreCase(r)) { - return true; - } - } - return false; - } - - @JsonIgnore - public boolean isDefaultAdmin() { - if ((username.equalsIgnoreCase("admin") || username.equalsIgnoreCase("administrator")) - && (hasRole("admin") || hasRole("administrator"))) { - return true; - } - return false; - } - - @JsonIgnore - public boolean hasAdminRights() { - if (isDefaultAdmin() || hasRole("admin") || hasRole("administrator")) { - return true; - } - return false; - } - - public List getPermissions() { - return permissions; - } - - /** - * WARNING: Overrides all existing permissions - * - * @param permissions - * @return - */ - public void setPermissions(List permissions) { - this.permissions = permissions; - } - - @JsonIgnore - public void addPermission(String permission) { - if (permissions == null) { - permissions = new ArrayList<>(); - } - permissions.add(permission); - } - - public boolean removePermission(String permission) { - return permissions.remove(permission); - } - - @JsonIgnore - public boolean hasPermission(String permission) { - if (permissions != null) - for (String p : permissions) { - if (permission.equalsIgnoreCase(p)) { - return true; - } - } - return false; - } - - public User withUsername(String username) { - this.username = username; - return this; - } - - public User withPassword(String password) { - this.password = password; - return this; - } - - public User withSalt(String salt) { - this.salt = salt; - return this; - } - - public User withStatus(String status) { - this.status = status; - return this; - } - - /** - * WARNING: Overrides all existing roles - * - * @param roles - * @return - * @return - */ - public User withRoles(List roles) { - this.roles = roles; - return this; - } - - public User withRole(String role) { - if (roles == null) { - roles = new ArrayList<>(); - } - roles.add(role); - return this; - } - - /** - * WARNING: Overrides all existing permissions - * - * @param permissions - * @return - * @return - */ - public User withPermissions(List permissions) { - this.permissions = permissions; - return this; - } - - public User withPermission(String permission) { - if (permissions == null) { - permissions = new ArrayList<>(); - } - permissions.add(permission); - return this; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "id", "revision"); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "id", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Action.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Action.java deleted file mode 100644 index a71e50d659..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Action.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.opensrp.domain.postgres; - -public class Action { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.action.id - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.action.json - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - private Object json; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.action.id - * - * @return the value of core.action.id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.action.id - * - * @param id the value for core.action.id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.action.json - * - * @return the value of core.action.json - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public Object getJson() { - return json; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.action.json - * - * @param json the value for core.action.json - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void setJson(Object json) { - this.json = json; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ActionExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/ActionExample.java deleted file mode 100644 index 0c32a4f727..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ActionExample.java +++ /dev/null @@ -1,459 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class ActionExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public ActionExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List jsonCriteria; - - protected List allCriteria; - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - jsonCriteria = new ArrayList(); - } - - public List getJsonCriteria() { - return jsonCriteria; - } - - protected void addJsonCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value, "org.opensrp.repository.postgres.handler.ActionTypeHandler")); - allCriteria = null; - } - - protected void addJsonCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - jsonCriteria.add( - new Criterion(condition, value1, value2, "org.opensrp.repository.postgres.handler.ActionTypeHandler")); - allCriteria = null; - } - - public boolean isValid() { - return criteria.size() > 0 || jsonCriteria.size() > 0; - } - - public List getAllCriteria() { - if (allCriteria == null) { - allCriteria = new ArrayList(); - allCriteria.addAll(criteria); - allCriteria.addAll(jsonCriteria); - } - return allCriteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - allCriteria = null; - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andJsonIsNull() { - addCriterion("json is null"); - return (Criteria) this; - } - - public Criteria andJsonIsNotNull() { - addCriterion("json is not null"); - return (Criteria) this; - } - - public Criteria andJsonEqualTo(Object value) { - addJsonCriterion("json =", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotEqualTo(Object value) { - addJsonCriterion("json <>", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThan(Object value) { - addJsonCriterion("json >", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThanOrEqualTo(Object value) { - addJsonCriterion("json >=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThan(Object value) { - addJsonCriterion("json <", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThanOrEqualTo(Object value) { - addJsonCriterion("json <=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonIn(List values) { - addJsonCriterion("json in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotIn(List values) { - addJsonCriterion("json not in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonBetween(Object value1, Object value2) { - addJsonCriterion("json between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotBetween(Object value1, Object value2) { - addJsonCriterion("json not between", value1, value2, "json"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.action - * - * @mbg.generated do_not_delete_during_merge Fri Mar 09 15:24:01 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ActionMetadata.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/ActionMetadata.java deleted file mode 100644 index 1b1cc34257..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ActionMetadata.java +++ /dev/null @@ -1,274 +0,0 @@ -package org.opensrp.domain.postgres; - -public class ActionMetadata { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.action_metadata.id - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.action_metadata.action_id - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - private Long actionId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.action_metadata.document_id - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - private String documentId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.action_metadata.base_entity_id - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - private String baseEntityId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.action_metadata.server_version - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - private Long serverVersion; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.action_metadata.provider_id - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - private String providerId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.action_metadata.location_id - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - private String locationId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.action_metadata.team - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - private String team; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.action_metadata.team_id - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - private String teamId; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.action_metadata.id - * - * @return the value of core.action_metadata.id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.action_metadata.id - * - * @param id the value for core.action_metadata.id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.action_metadata.action_id - * - * @return the value of core.action_metadata.action_id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public Long getActionId() { - return actionId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.action_metadata.action_id - * - * @param actionId the value for core.action_metadata.action_id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void setActionId(Long actionId) { - this.actionId = actionId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.action_metadata.document_id - * - * @return the value of core.action_metadata.document_id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public String getDocumentId() { - return documentId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.action_metadata.document_id - * - * @param documentId the value for core.action_metadata.document_id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void setDocumentId(String documentId) { - this.documentId = documentId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.action_metadata.base_entity_id - * - * @return the value of core.action_metadata.base_entity_id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public String getBaseEntityId() { - return baseEntityId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.action_metadata.base_entity_id - * - * @param baseEntityId the value for core.action_metadata.base_entity_id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void setBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.action_metadata.server_version - * - * @return the value of core.action_metadata.server_version - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public Long getServerVersion() { - return serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.action_metadata.server_version - * - * @param serverVersion the value for core.action_metadata.server_version - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.action_metadata.provider_id - * - * @return the value of core.action_metadata.provider_id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public String getProviderId() { - return providerId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.action_metadata.provider_id - * - * @param providerId the value for core.action_metadata.provider_id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.action_metadata.location_id - * - * @return the value of core.action_metadata.location_id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public String getLocationId() { - return locationId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.action_metadata.location_id - * - * @param locationId the value for core.action_metadata.location_id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void setLocationId(String locationId) { - this.locationId = locationId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.action_metadata.team - * - * @return the value of core.action_metadata.team - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public String getTeam() { - return team; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.action_metadata.team - * - * @param team the value for core.action_metadata.team - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void setTeam(String team) { - this.team = team; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.action_metadata.team_id - * - * @return the value of core.action_metadata.team_id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public String getTeamId() { - return teamId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.action_metadata.team_id - * - * @param teamId the value for core.action_metadata.team_id - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void setTeamId(String teamId) { - this.teamId = teamId; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ActionMetadataExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/ActionMetadataExample.java deleted file mode 100644 index cb272dafcd..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ActionMetadataExample.java +++ /dev/null @@ -1,905 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class ActionMetadataExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public ActionMetadataExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andActionIdIsNull() { - addCriterion("action_id is null"); - return (Criteria) this; - } - - public Criteria andActionIdIsNotNull() { - addCriterion("action_id is not null"); - return (Criteria) this; - } - - public Criteria andActionIdEqualTo(Long value) { - addCriterion("action_id =", value, "actionId"); - return (Criteria) this; - } - - public Criteria andActionIdNotEqualTo(Long value) { - addCriterion("action_id <>", value, "actionId"); - return (Criteria) this; - } - - public Criteria andActionIdGreaterThan(Long value) { - addCriterion("action_id >", value, "actionId"); - return (Criteria) this; - } - - public Criteria andActionIdGreaterThanOrEqualTo(Long value) { - addCriterion("action_id >=", value, "actionId"); - return (Criteria) this; - } - - public Criteria andActionIdLessThan(Long value) { - addCriterion("action_id <", value, "actionId"); - return (Criteria) this; - } - - public Criteria andActionIdLessThanOrEqualTo(Long value) { - addCriterion("action_id <=", value, "actionId"); - return (Criteria) this; - } - - public Criteria andActionIdIn(List values) { - addCriterion("action_id in", values, "actionId"); - return (Criteria) this; - } - - public Criteria andActionIdNotIn(List values) { - addCriterion("action_id not in", values, "actionId"); - return (Criteria) this; - } - - public Criteria andActionIdBetween(Long value1, Long value2) { - addCriterion("action_id between", value1, value2, "actionId"); - return (Criteria) this; - } - - public Criteria andActionIdNotBetween(Long value1, Long value2) { - addCriterion("action_id not between", value1, value2, "actionId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNull() { - addCriterion("document_id is null"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNotNull() { - addCriterion("document_id is not null"); - return (Criteria) this; - } - - public Criteria andDocumentIdEqualTo(String value) { - addCriterion("document_id =", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotEqualTo(String value) { - addCriterion("document_id <>", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThan(String value) { - addCriterion("document_id >", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThanOrEqualTo(String value) { - addCriterion("document_id >=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThan(String value) { - addCriterion("document_id <", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThanOrEqualTo(String value) { - addCriterion("document_id <=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLike(String value) { - addCriterion("document_id like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotLike(String value) { - addCriterion("document_id not like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIn(List values) { - addCriterion("document_id in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotIn(List values) { - addCriterion("document_id not in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdBetween(String value1, String value2) { - addCriterion("document_id between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotBetween(String value1, String value2) { - addCriterion("document_id not between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdIsNull() { - addCriterion("base_entity_id is null"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdIsNotNull() { - addCriterion("base_entity_id is not null"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdEqualTo(String value) { - addCriterion("base_entity_id =", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotEqualTo(String value) { - addCriterion("base_entity_id <>", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdGreaterThan(String value) { - addCriterion("base_entity_id >", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdGreaterThanOrEqualTo(String value) { - addCriterion("base_entity_id >=", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdLessThan(String value) { - addCriterion("base_entity_id <", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdLessThanOrEqualTo(String value) { - addCriterion("base_entity_id <=", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdLike(String value) { - addCriterion("base_entity_id like", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotLike(String value) { - addCriterion("base_entity_id not like", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdIn(List values) { - addCriterion("base_entity_id in", values, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotIn(List values) { - addCriterion("base_entity_id not in", values, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdBetween(String value1, String value2) { - addCriterion("base_entity_id between", value1, value2, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotBetween(String value1, String value2) { - addCriterion("base_entity_id not between", value1, value2, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNull() { - addCriterion("server_version is null"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNotNull() { - addCriterion("server_version is not null"); - return (Criteria) this; - } - - public Criteria andServerVersionEqualTo(Long value) { - addCriterion("server_version =", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotEqualTo(Long value) { - addCriterion("server_version <>", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThan(Long value) { - addCriterion("server_version >", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThanOrEqualTo(Long value) { - addCriterion("server_version >=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThan(Long value) { - addCriterion("server_version <", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThanOrEqualTo(Long value) { - addCriterion("server_version <=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionIn(List values) { - addCriterion("server_version in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotIn(List values) { - addCriterion("server_version not in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionBetween(Long value1, Long value2) { - addCriterion("server_version between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotBetween(Long value1, Long value2) { - addCriterion("server_version not between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andProviderIdIsNull() { - addCriterion("provider_id is null"); - return (Criteria) this; - } - - public Criteria andProviderIdIsNotNull() { - addCriterion("provider_id is not null"); - return (Criteria) this; - } - - public Criteria andProviderIdEqualTo(String value) { - addCriterion("provider_id =", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotEqualTo(String value) { - addCriterion("provider_id <>", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdGreaterThan(String value) { - addCriterion("provider_id >", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdGreaterThanOrEqualTo(String value) { - addCriterion("provider_id >=", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLessThan(String value) { - addCriterion("provider_id <", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLessThanOrEqualTo(String value) { - addCriterion("provider_id <=", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLike(String value) { - addCriterion("provider_id like", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotLike(String value) { - addCriterion("provider_id not like", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdIn(List values) { - addCriterion("provider_id in", values, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotIn(List values) { - addCriterion("provider_id not in", values, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdBetween(String value1, String value2) { - addCriterion("provider_id between", value1, value2, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotBetween(String value1, String value2) { - addCriterion("provider_id not between", value1, value2, "providerId"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNull() { - addCriterion("location_id is null"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNotNull() { - addCriterion("location_id is not null"); - return (Criteria) this; - } - - public Criteria andLocationIdEqualTo(String value) { - addCriterion("location_id =", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotEqualTo(String value) { - addCriterion("location_id <>", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThan(String value) { - addCriterion("location_id >", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThanOrEqualTo(String value) { - addCriterion("location_id >=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThan(String value) { - addCriterion("location_id <", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThanOrEqualTo(String value) { - addCriterion("location_id <=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLike(String value) { - addCriterion("location_id like", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotLike(String value) { - addCriterion("location_id not like", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdIn(List values) { - addCriterion("location_id in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotIn(List values) { - addCriterion("location_id not in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdBetween(String value1, String value2) { - addCriterion("location_id between", value1, value2, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotBetween(String value1, String value2) { - addCriterion("location_id not between", value1, value2, "locationId"); - return (Criteria) this; - } - - public Criteria andTeamIsNull() { - addCriterion("team is null"); - return (Criteria) this; - } - - public Criteria andTeamIsNotNull() { - addCriterion("team is not null"); - return (Criteria) this; - } - - public Criteria andTeamEqualTo(String value) { - addCriterion("team =", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotEqualTo(String value) { - addCriterion("team <>", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamGreaterThan(String value) { - addCriterion("team >", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamGreaterThanOrEqualTo(String value) { - addCriterion("team >=", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLessThan(String value) { - addCriterion("team <", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLessThanOrEqualTo(String value) { - addCriterion("team <=", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLike(String value) { - addCriterion("team like", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotLike(String value) { - addCriterion("team not like", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamIn(List values) { - addCriterion("team in", values, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotIn(List values) { - addCriterion("team not in", values, "team"); - return (Criteria) this; - } - - public Criteria andTeamBetween(String value1, String value2) { - addCriterion("team between", value1, value2, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotBetween(String value1, String value2) { - addCriterion("team not between", value1, value2, "team"); - return (Criteria) this; - } - - public Criteria andTeamIdIsNull() { - addCriterion("team_id is null"); - return (Criteria) this; - } - - public Criteria andTeamIdIsNotNull() { - addCriterion("team_id is not null"); - return (Criteria) this; - } - - public Criteria andTeamIdEqualTo(String value) { - addCriterion("team_id =", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotEqualTo(String value) { - addCriterion("team_id <>", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdGreaterThan(String value) { - addCriterion("team_id >", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdGreaterThanOrEqualTo(String value) { - addCriterion("team_id >=", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLessThan(String value) { - addCriterion("team_id <", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLessThanOrEqualTo(String value) { - addCriterion("team_id <=", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLike(String value) { - addCriterion("team_id like", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotLike(String value) { - addCriterion("team_id not like", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdIn(List values) { - addCriterion("team_id in", values, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotIn(List values) { - addCriterion("team_id not in", values, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdBetween(String value1, String value2) { - addCriterion("team_id between", value1, value2, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotBetween(String value1, String value2) { - addCriterion("team_id not between", value1, value2, "teamId"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.action_metadata - * - * @mbg.generated do_not_delete_during_merge Fri Mar 09 15:24:01 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Alert.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Alert.java deleted file mode 100644 index 4d0c1ab390..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Alert.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.opensrp.domain.postgres; - -public class Alert { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.alert.id - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.alert.json - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - private Object json; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.alert.id - * - * @return the value of core.alert.id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.alert.id - * - * @param id the value for core.alert.id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.alert.json - * - * @return the value of core.alert.json - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public Object getJson() { - return json; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.alert.json - * - * @param json the value for core.alert.json - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setJson(Object json) { - this.json = json; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/AlertExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/AlertExample.java deleted file mode 100644 index b40a5bf529..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/AlertExample.java +++ /dev/null @@ -1,459 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class AlertExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public AlertExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List jsonCriteria; - - protected List allCriteria; - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - jsonCriteria = new ArrayList(); - } - - public List getJsonCriteria() { - return jsonCriteria; - } - - protected void addJsonCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value, "org.opensrp.repository.postgres.handler.AlertTypeHandler")); - allCriteria = null; - } - - protected void addJsonCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - jsonCriteria.add( - new Criterion(condition, value1, value2, "org.opensrp.repository.postgres.handler.AlertTypeHandler")); - allCriteria = null; - } - - public boolean isValid() { - return criteria.size() > 0 || jsonCriteria.size() > 0; - } - - public List getAllCriteria() { - if (allCriteria == null) { - allCriteria = new ArrayList(); - allCriteria.addAll(criteria); - allCriteria.addAll(jsonCriteria); - } - return allCriteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - allCriteria = null; - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andJsonIsNull() { - addCriterion("json is null"); - return (Criteria) this; - } - - public Criteria andJsonIsNotNull() { - addCriterion("json is not null"); - return (Criteria) this; - } - - public Criteria andJsonEqualTo(Object value) { - addJsonCriterion("json =", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotEqualTo(Object value) { - addJsonCriterion("json <>", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThan(Object value) { - addJsonCriterion("json >", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThanOrEqualTo(Object value) { - addJsonCriterion("json >=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThan(Object value) { - addJsonCriterion("json <", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThanOrEqualTo(Object value) { - addJsonCriterion("json <=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonIn(List values) { - addJsonCriterion("json in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotIn(List values) { - addJsonCriterion("json not in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonBetween(Object value1, Object value2) { - addJsonCriterion("json between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotBetween(Object value1, Object value2) { - addJsonCriterion("json not between", value1, value2, "json"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.alert - * - * @mbg.generated do_not_delete_during_merge Fri Mar 09 15:24:01 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/AlertMetadata.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/AlertMetadata.java deleted file mode 100644 index 33bb1bd7ab..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/AlertMetadata.java +++ /dev/null @@ -1,334 +0,0 @@ -package org.opensrp.domain.postgres; - -public class AlertMetadata { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.alert_metadata.id - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.alert_metadata.alert_id - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - private Long alertId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.alert_metadata.document_id - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - private String documentId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.alert_metadata.base_entity_id - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - private String baseEntityId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.alert_metadata.server_version - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - private Long serverVersion; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.alert_metadata.provider_id - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - private String providerId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.alert_metadata.location_id - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - private String locationId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.alert_metadata.team - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - private String team; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.alert_metadata.team_id - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - private String teamId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.alert_metadata.is_active - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - private Boolean isActive; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.alert_metadata.trigger_name - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - private String triggerName; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.alert_metadata.id - * - * @return the value of core.alert_metadata.id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.alert_metadata.id - * - * @param id the value for core.alert_metadata.id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.alert_metadata.alert_id - * - * @return the value of core.alert_metadata.alert_id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public Long getAlertId() { - return alertId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.alert_metadata.alert_id - * - * @param alertId the value for core.alert_metadata.alert_id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setAlertId(Long alertId) { - this.alertId = alertId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.alert_metadata.document_id - * - * @return the value of core.alert_metadata.document_id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public String getDocumentId() { - return documentId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.alert_metadata.document_id - * - * @param documentId the value for core.alert_metadata.document_id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setDocumentId(String documentId) { - this.documentId = documentId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.alert_metadata.base_entity_id - * - * @return the value of core.alert_metadata.base_entity_id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public String getBaseEntityId() { - return baseEntityId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.alert_metadata.base_entity_id - * - * @param baseEntityId the value for core.alert_metadata.base_entity_id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.alert_metadata.server_version - * - * @return the value of core.alert_metadata.server_version - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public Long getServerVersion() { - return serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.alert_metadata.server_version - * - * @param serverVersion the value for core.alert_metadata.server_version - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.alert_metadata.provider_id - * - * @return the value of core.alert_metadata.provider_id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public String getProviderId() { - return providerId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.alert_metadata.provider_id - * - * @param providerId the value for core.alert_metadata.provider_id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.alert_metadata.location_id - * - * @return the value of core.alert_metadata.location_id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public String getLocationId() { - return locationId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.alert_metadata.location_id - * - * @param locationId the value for core.alert_metadata.location_id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setLocationId(String locationId) { - this.locationId = locationId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.alert_metadata.team - * - * @return the value of core.alert_metadata.team - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public String getTeam() { - return team; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.alert_metadata.team - * - * @param team the value for core.alert_metadata.team - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setTeam(String team) { - this.team = team; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.alert_metadata.team_id - * - * @return the value of core.alert_metadata.team_id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public String getTeamId() { - return teamId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.alert_metadata.team_id - * - * @param teamId the value for core.alert_metadata.team_id - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setTeamId(String teamId) { - this.teamId = teamId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.alert_metadata.is_active - * - * @return the value of core.alert_metadata.is_active - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public Boolean getIsActive() { - return isActive; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.alert_metadata.is_active - * - * @param isActive the value for core.alert_metadata.is_active - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setIsActive(Boolean isActive) { - this.isActive = isActive; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.alert_metadata.trigger_name - * - * @return the value of core.alert_metadata.trigger_name - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public String getTriggerName() { - return triggerName; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.alert_metadata.trigger_name - * - * @param triggerName the value for core.alert_metadata.trigger_name - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setTriggerName(String triggerName) { - this.triggerName = triggerName; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/AlertMetadataExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/AlertMetadataExample.java deleted file mode 100644 index 0f1245662c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/AlertMetadataExample.java +++ /dev/null @@ -1,1035 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class AlertMetadataExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public AlertMetadataExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andAlertIdIsNull() { - addCriterion("alert_id is null"); - return (Criteria) this; - } - - public Criteria andAlertIdIsNotNull() { - addCriterion("alert_id is not null"); - return (Criteria) this; - } - - public Criteria andAlertIdEqualTo(Long value) { - addCriterion("alert_id =", value, "alertId"); - return (Criteria) this; - } - - public Criteria andAlertIdNotEqualTo(Long value) { - addCriterion("alert_id <>", value, "alertId"); - return (Criteria) this; - } - - public Criteria andAlertIdGreaterThan(Long value) { - addCriterion("alert_id >", value, "alertId"); - return (Criteria) this; - } - - public Criteria andAlertIdGreaterThanOrEqualTo(Long value) { - addCriterion("alert_id >=", value, "alertId"); - return (Criteria) this; - } - - public Criteria andAlertIdLessThan(Long value) { - addCriterion("alert_id <", value, "alertId"); - return (Criteria) this; - } - - public Criteria andAlertIdLessThanOrEqualTo(Long value) { - addCriterion("alert_id <=", value, "alertId"); - return (Criteria) this; - } - - public Criteria andAlertIdIn(List values) { - addCriterion("alert_id in", values, "alertId"); - return (Criteria) this; - } - - public Criteria andAlertIdNotIn(List values) { - addCriterion("alert_id not in", values, "alertId"); - return (Criteria) this; - } - - public Criteria andAlertIdBetween(Long value1, Long value2) { - addCriterion("alert_id between", value1, value2, "alertId"); - return (Criteria) this; - } - - public Criteria andAlertIdNotBetween(Long value1, Long value2) { - addCriterion("alert_id not between", value1, value2, "alertId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNull() { - addCriterion("document_id is null"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNotNull() { - addCriterion("document_id is not null"); - return (Criteria) this; - } - - public Criteria andDocumentIdEqualTo(String value) { - addCriterion("document_id =", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotEqualTo(String value) { - addCriterion("document_id <>", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThan(String value) { - addCriterion("document_id >", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThanOrEqualTo(String value) { - addCriterion("document_id >=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThan(String value) { - addCriterion("document_id <", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThanOrEqualTo(String value) { - addCriterion("document_id <=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLike(String value) { - addCriterion("document_id like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotLike(String value) { - addCriterion("document_id not like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIn(List values) { - addCriterion("document_id in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotIn(List values) { - addCriterion("document_id not in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdBetween(String value1, String value2) { - addCriterion("document_id between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotBetween(String value1, String value2) { - addCriterion("document_id not between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdIsNull() { - addCriterion("base_entity_id is null"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdIsNotNull() { - addCriterion("base_entity_id is not null"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdEqualTo(String value) { - addCriterion("base_entity_id =", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotEqualTo(String value) { - addCriterion("base_entity_id <>", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdGreaterThan(String value) { - addCriterion("base_entity_id >", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdGreaterThanOrEqualTo(String value) { - addCriterion("base_entity_id >=", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdLessThan(String value) { - addCriterion("base_entity_id <", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdLessThanOrEqualTo(String value) { - addCriterion("base_entity_id <=", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdLike(String value) { - addCriterion("base_entity_id like", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotLike(String value) { - addCriterion("base_entity_id not like", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdIn(List values) { - addCriterion("base_entity_id in", values, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotIn(List values) { - addCriterion("base_entity_id not in", values, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdBetween(String value1, String value2) { - addCriterion("base_entity_id between", value1, value2, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotBetween(String value1, String value2) { - addCriterion("base_entity_id not between", value1, value2, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNull() { - addCriterion("server_version is null"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNotNull() { - addCriterion("server_version is not null"); - return (Criteria) this; - } - - public Criteria andServerVersionEqualTo(Long value) { - addCriterion("server_version =", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotEqualTo(Long value) { - addCriterion("server_version <>", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThan(Long value) { - addCriterion("server_version >", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThanOrEqualTo(Long value) { - addCriterion("server_version >=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThan(Long value) { - addCriterion("server_version <", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThanOrEqualTo(Long value) { - addCriterion("server_version <=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionIn(List values) { - addCriterion("server_version in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotIn(List values) { - addCriterion("server_version not in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionBetween(Long value1, Long value2) { - addCriterion("server_version between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotBetween(Long value1, Long value2) { - addCriterion("server_version not between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andProviderIdIsNull() { - addCriterion("provider_id is null"); - return (Criteria) this; - } - - public Criteria andProviderIdIsNotNull() { - addCriterion("provider_id is not null"); - return (Criteria) this; - } - - public Criteria andProviderIdEqualTo(String value) { - addCriterion("provider_id =", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotEqualTo(String value) { - addCriterion("provider_id <>", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdGreaterThan(String value) { - addCriterion("provider_id >", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdGreaterThanOrEqualTo(String value) { - addCriterion("provider_id >=", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLessThan(String value) { - addCriterion("provider_id <", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLessThanOrEqualTo(String value) { - addCriterion("provider_id <=", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLike(String value) { - addCriterion("provider_id like", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotLike(String value) { - addCriterion("provider_id not like", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdIn(List values) { - addCriterion("provider_id in", values, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotIn(List values) { - addCriterion("provider_id not in", values, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdBetween(String value1, String value2) { - addCriterion("provider_id between", value1, value2, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotBetween(String value1, String value2) { - addCriterion("provider_id not between", value1, value2, "providerId"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNull() { - addCriterion("location_id is null"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNotNull() { - addCriterion("location_id is not null"); - return (Criteria) this; - } - - public Criteria andLocationIdEqualTo(String value) { - addCriterion("location_id =", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotEqualTo(String value) { - addCriterion("location_id <>", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThan(String value) { - addCriterion("location_id >", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThanOrEqualTo(String value) { - addCriterion("location_id >=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThan(String value) { - addCriterion("location_id <", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThanOrEqualTo(String value) { - addCriterion("location_id <=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLike(String value) { - addCriterion("location_id like", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotLike(String value) { - addCriterion("location_id not like", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdIn(List values) { - addCriterion("location_id in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotIn(List values) { - addCriterion("location_id not in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdBetween(String value1, String value2) { - addCriterion("location_id between", value1, value2, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotBetween(String value1, String value2) { - addCriterion("location_id not between", value1, value2, "locationId"); - return (Criteria) this; - } - - public Criteria andTeamIsNull() { - addCriterion("team is null"); - return (Criteria) this; - } - - public Criteria andTeamIsNotNull() { - addCriterion("team is not null"); - return (Criteria) this; - } - - public Criteria andTeamEqualTo(String value) { - addCriterion("team =", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotEqualTo(String value) { - addCriterion("team <>", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamGreaterThan(String value) { - addCriterion("team >", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamGreaterThanOrEqualTo(String value) { - addCriterion("team >=", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLessThan(String value) { - addCriterion("team <", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLessThanOrEqualTo(String value) { - addCriterion("team <=", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLike(String value) { - addCriterion("team like", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotLike(String value) { - addCriterion("team not like", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamIn(List values) { - addCriterion("team in", values, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotIn(List values) { - addCriterion("team not in", values, "team"); - return (Criteria) this; - } - - public Criteria andTeamBetween(String value1, String value2) { - addCriterion("team between", value1, value2, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotBetween(String value1, String value2) { - addCriterion("team not between", value1, value2, "team"); - return (Criteria) this; - } - - public Criteria andTeamIdIsNull() { - addCriterion("team_id is null"); - return (Criteria) this; - } - - public Criteria andTeamIdIsNotNull() { - addCriterion("team_id is not null"); - return (Criteria) this; - } - - public Criteria andTeamIdEqualTo(String value) { - addCriterion("team_id =", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotEqualTo(String value) { - addCriterion("team_id <>", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdGreaterThan(String value) { - addCriterion("team_id >", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdGreaterThanOrEqualTo(String value) { - addCriterion("team_id >=", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLessThan(String value) { - addCriterion("team_id <", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLessThanOrEqualTo(String value) { - addCriterion("team_id <=", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLike(String value) { - addCriterion("team_id like", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotLike(String value) { - addCriterion("team_id not like", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdIn(List values) { - addCriterion("team_id in", values, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotIn(List values) { - addCriterion("team_id not in", values, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdBetween(String value1, String value2) { - addCriterion("team_id between", value1, value2, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotBetween(String value1, String value2) { - addCriterion("team_id not between", value1, value2, "teamId"); - return (Criteria) this; - } - - public Criteria andIsActiveIsNull() { - addCriterion("is_active is null"); - return (Criteria) this; - } - - public Criteria andIsActiveIsNotNull() { - addCriterion("is_active is not null"); - return (Criteria) this; - } - - public Criteria andIsActiveEqualTo(Boolean value) { - addCriterion("is_active =", value, "isActive"); - return (Criteria) this; - } - - public Criteria andIsActiveNotEqualTo(Boolean value) { - addCriterion("is_active <>", value, "isActive"); - return (Criteria) this; - } - - public Criteria andIsActiveGreaterThan(Boolean value) { - addCriterion("is_active >", value, "isActive"); - return (Criteria) this; - } - - public Criteria andIsActiveGreaterThanOrEqualTo(Boolean value) { - addCriterion("is_active >=", value, "isActive"); - return (Criteria) this; - } - - public Criteria andIsActiveLessThan(Boolean value) { - addCriterion("is_active <", value, "isActive"); - return (Criteria) this; - } - - public Criteria andIsActiveLessThanOrEqualTo(Boolean value) { - addCriterion("is_active <=", value, "isActive"); - return (Criteria) this; - } - - public Criteria andIsActiveIn(List values) { - addCriterion("is_active in", values, "isActive"); - return (Criteria) this; - } - - public Criteria andIsActiveNotIn(List values) { - addCriterion("is_active not in", values, "isActive"); - return (Criteria) this; - } - - public Criteria andIsActiveBetween(Boolean value1, Boolean value2) { - addCriterion("is_active between", value1, value2, "isActive"); - return (Criteria) this; - } - - public Criteria andIsActiveNotBetween(Boolean value1, Boolean value2) { - addCriterion("is_active not between", value1, value2, "isActive"); - return (Criteria) this; - } - - public Criteria andTriggerNameIsNull() { - addCriterion("trigger_name is null"); - return (Criteria) this; - } - - public Criteria andTriggerNameIsNotNull() { - addCriterion("trigger_name is not null"); - return (Criteria) this; - } - - public Criteria andTriggerNameEqualTo(String value) { - addCriterion("trigger_name =", value, "triggerName"); - return (Criteria) this; - } - - public Criteria andTriggerNameNotEqualTo(String value) { - addCriterion("trigger_name <>", value, "triggerName"); - return (Criteria) this; - } - - public Criteria andTriggerNameGreaterThan(String value) { - addCriterion("trigger_name >", value, "triggerName"); - return (Criteria) this; - } - - public Criteria andTriggerNameGreaterThanOrEqualTo(String value) { - addCriterion("trigger_name >=", value, "triggerName"); - return (Criteria) this; - } - - public Criteria andTriggerNameLessThan(String value) { - addCriterion("trigger_name <", value, "triggerName"); - return (Criteria) this; - } - - public Criteria andTriggerNameLessThanOrEqualTo(String value) { - addCriterion("trigger_name <=", value, "triggerName"); - return (Criteria) this; - } - - public Criteria andTriggerNameLike(String value) { - addCriterion("trigger_name like", value, "triggerName"); - return (Criteria) this; - } - - public Criteria andTriggerNameNotLike(String value) { - addCriterion("trigger_name not like", value, "triggerName"); - return (Criteria) this; - } - - public Criteria andTriggerNameIn(List values) { - addCriterion("trigger_name in", values, "triggerName"); - return (Criteria) this; - } - - public Criteria andTriggerNameNotIn(List values) { - addCriterion("trigger_name not in", values, "triggerName"); - return (Criteria) this; - } - - public Criteria andTriggerNameBetween(String value1, String value2) { - addCriterion("trigger_name between", value1, value2, "triggerName"); - return (Criteria) this; - } - - public Criteria andTriggerNameNotBetween(String value1, String value2) { - addCriterion("trigger_name not between", value1, value2, "triggerName"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.alert_metadata - * - * @mbg.generated do_not_delete_during_merge Fri Mar 09 15:24:01 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/AppStateToken.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/AppStateToken.java deleted file mode 100644 index 0fd6fbbee0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/AppStateToken.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.opensrp.domain.postgres; - -public class AppStateToken { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.app_state_token.id - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.app_state_token.name - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - private String name; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.app_state_token.description - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - private String description; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.app_state_token.value - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - private String value; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.app_state_token.last_edited_date - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - private Long lastEditedDate; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.app_state_token.id - * - * @return the value of core.app_state_token.id - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.app_state_token.id - * - * @param id the value for core.app_state_token.id - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.app_state_token.name - * - * @return the value of core.app_state_token.name - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public String getName() { - return name; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.app_state_token.name - * - * @param name the value for core.app_state_token.name - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public void setName(String name) { - this.name = name; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.app_state_token.description - * - * @return the value of core.app_state_token.description - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public String getDescription() { - return description; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.app_state_token.description - * - * @param description the value for core.app_state_token.description - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.app_state_token.value - * - * @return the value of core.app_state_token.value - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public String getValue() { - return value; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.app_state_token.value - * - * @param value the value for core.app_state_token.value - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public void setValue(String value) { - this.value = value; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.app_state_token.last_edited_date - * - * @return the value of core.app_state_token.last_edited_date - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public Long getLastEditedDate() { - return lastEditedDate; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.app_state_token.last_edited_date - * - * @param lastEditedDate the value for core.app_state_token.last_edited_date - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public void setLastEditedDate(Long lastEditedDate) { - this.lastEditedDate = lastEditedDate; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/AppStateTokenExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/AppStateTokenExample.java deleted file mode 100644 index a5383b1a34..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/AppStateTokenExample.java +++ /dev/null @@ -1,635 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class AppStateTokenExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public AppStateTokenExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andNameIsNull() { - addCriterion("name is null"); - return (Criteria) this; - } - - public Criteria andNameIsNotNull() { - addCriterion("name is not null"); - return (Criteria) this; - } - - public Criteria andNameEqualTo(String value) { - addCriterion("name =", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotEqualTo(String value) { - addCriterion("name <>", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThan(String value) { - addCriterion("name >", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThanOrEqualTo(String value) { - addCriterion("name >=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThan(String value) { - addCriterion("name <", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThanOrEqualTo(String value) { - addCriterion("name <=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLike(String value) { - addCriterion("name like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotLike(String value) { - addCriterion("name not like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameIn(List values) { - addCriterion("name in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameNotIn(List values) { - addCriterion("name not in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameBetween(String value1, String value2) { - addCriterion("name between", value1, value2, "name"); - return (Criteria) this; - } - - public Criteria andNameNotBetween(String value1, String value2) { - addCriterion("name not between", value1, value2, "name"); - return (Criteria) this; - } - - public Criteria andDescriptionIsNull() { - addCriterion("description is null"); - return (Criteria) this; - } - - public Criteria andDescriptionIsNotNull() { - addCriterion("description is not null"); - return (Criteria) this; - } - - public Criteria andDescriptionEqualTo(String value) { - addCriterion("description =", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotEqualTo(String value) { - addCriterion("description <>", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThan(String value) { - addCriterion("description >", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionGreaterThanOrEqualTo(String value) { - addCriterion("description >=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThan(String value) { - addCriterion("description <", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLessThanOrEqualTo(String value) { - addCriterion("description <=", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionLike(String value) { - addCriterion("description like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotLike(String value) { - addCriterion("description not like", value, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionIn(List values) { - addCriterion("description in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotIn(List values) { - addCriterion("description not in", values, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionBetween(String value1, String value2) { - addCriterion("description between", value1, value2, "description"); - return (Criteria) this; - } - - public Criteria andDescriptionNotBetween(String value1, String value2) { - addCriterion("description not between", value1, value2, "description"); - return (Criteria) this; - } - - public Criteria andValueIsNull() { - addCriterion("value is null"); - return (Criteria) this; - } - - public Criteria andValueIsNotNull() { - addCriterion("value is not null"); - return (Criteria) this; - } - - public Criteria andValueEqualTo(String value) { - addCriterion("value =", value, "value"); - return (Criteria) this; - } - - public Criteria andValueNotEqualTo(String value) { - addCriterion("value <>", value, "value"); - return (Criteria) this; - } - - public Criteria andValueGreaterThan(String value) { - addCriterion("value >", value, "value"); - return (Criteria) this; - } - - public Criteria andValueGreaterThanOrEqualTo(String value) { - addCriterion("value >=", value, "value"); - return (Criteria) this; - } - - public Criteria andValueLessThan(String value) { - addCriterion("value <", value, "value"); - return (Criteria) this; - } - - public Criteria andValueLessThanOrEqualTo(String value) { - addCriterion("value <=", value, "value"); - return (Criteria) this; - } - - public Criteria andValueLike(String value) { - addCriterion("value like", value, "value"); - return (Criteria) this; - } - - public Criteria andValueNotLike(String value) { - addCriterion("value not like", value, "value"); - return (Criteria) this; - } - - public Criteria andValueIn(List values) { - addCriterion("value in", values, "value"); - return (Criteria) this; - } - - public Criteria andValueNotIn(List values) { - addCriterion("value not in", values, "value"); - return (Criteria) this; - } - - public Criteria andValueBetween(String value1, String value2) { - addCriterion("value between", value1, value2, "value"); - return (Criteria) this; - } - - public Criteria andValueNotBetween(String value1, String value2) { - addCriterion("value not between", value1, value2, "value"); - return (Criteria) this; - } - - public Criteria andLastEditedDateIsNull() { - addCriterion("last_edited_date is null"); - return (Criteria) this; - } - - public Criteria andLastEditedDateIsNotNull() { - addCriterion("last_edited_date is not null"); - return (Criteria) this; - } - - public Criteria andLastEditedDateEqualTo(Long value) { - addCriterion("last_edited_date =", value, "lastEditedDate"); - return (Criteria) this; - } - - public Criteria andLastEditedDateNotEqualTo(Long value) { - addCriterion("last_edited_date <>", value, "lastEditedDate"); - return (Criteria) this; - } - - public Criteria andLastEditedDateGreaterThan(Long value) { - addCriterion("last_edited_date >", value, "lastEditedDate"); - return (Criteria) this; - } - - public Criteria andLastEditedDateGreaterThanOrEqualTo(Long value) { - addCriterion("last_edited_date >=", value, "lastEditedDate"); - return (Criteria) this; - } - - public Criteria andLastEditedDateLessThan(Long value) { - addCriterion("last_edited_date <", value, "lastEditedDate"); - return (Criteria) this; - } - - public Criteria andLastEditedDateLessThanOrEqualTo(Long value) { - addCriterion("last_edited_date <=", value, "lastEditedDate"); - return (Criteria) this; - } - - public Criteria andLastEditedDateIn(List values) { - addCriterion("last_edited_date in", values, "lastEditedDate"); - return (Criteria) this; - } - - public Criteria andLastEditedDateNotIn(List values) { - addCriterion("last_edited_date not in", values, "lastEditedDate"); - return (Criteria) this; - } - - public Criteria andLastEditedDateBetween(Long value1, Long value2) { - addCriterion("last_edited_date between", value1, value2, "lastEditedDate"); - return (Criteria) this; - } - - public Criteria andLastEditedDateNotBetween(Long value1, Long value2) { - addCriterion("last_edited_date not between", value1, value2, "lastEditedDate"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.app_state_token - * - * @mbg.generated do_not_delete_during_merge Fri Mar 09 18:03:53 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Campaign.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Campaign.java deleted file mode 100644 index c79c7e05fc..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Campaign.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.opensrp.domain.postgres; - -public class Campaign { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.campaign.id - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - private Long id; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.campaign.json - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - private Object json; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.campaign.id - * @return the value of core.campaign.id - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.campaign.id - * @param id the value for core.campaign.id - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.campaign.json - * @return the value of core.campaign.json - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public Object getJson() { - return json; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.campaign.json - * @param json the value for core.campaign.json - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void setJson(Object json) { - this.json = json; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/CampaignExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/CampaignExample.java deleted file mode 100644 index 738d3e3f0b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/CampaignExample.java +++ /dev/null @@ -1,414 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class CampaignExample { - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - protected String orderByClause; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - protected boolean distinct; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public CampaignExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - protected List jsonCriteria; - protected List allCriteria; - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - jsonCriteria = new ArrayList(); - } - - public List getJsonCriteria() { - return jsonCriteria; - } - - protected void addJsonCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - jsonCriteria.add( - new Criterion(condition, value, "org.opensrp.repository.postgres.handler.CampaignTypeHandler")); - allCriteria = null; - } - - protected void addJsonCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value1, value2, - "org.opensrp.repository.postgres.handler.CampaignTypeHandler")); - allCriteria = null; - } - - public boolean isValid() { - return criteria.size() > 0 || jsonCriteria.size() > 0; - } - - public List getAllCriteria() { - if (allCriteria == null) { - allCriteria = new ArrayList(); - allCriteria.addAll(criteria); - allCriteria.addAll(jsonCriteria); - } - return allCriteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new IllegalArgumentException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - allCriteria = null; - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andJsonIsNull() { - addCriterion("json is null"); - return (Criteria) this; - } - - public Criteria andJsonIsNotNull() { - addCriterion("json is not null"); - return (Criteria) this; - } - - public Criteria andJsonEqualTo(Object value) { - addJsonCriterion("json =", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotEqualTo(Object value) { - addJsonCriterion("json <>", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThan(Object value) { - addJsonCriterion("json >", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThanOrEqualTo(Object value) { - addJsonCriterion("json >=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThan(Object value) { - addJsonCriterion("json <", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThanOrEqualTo(Object value) { - addJsonCriterion("json <=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonIn(List values) { - addJsonCriterion("json in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotIn(List values) { - addJsonCriterion("json not in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonBetween(Object value1, Object value2) { - addJsonCriterion("json between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotBetween(Object value1, Object value2) { - addJsonCriterion("json not between", value1, value2, "json"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public static class Criterion { - private String condition; - private Object value; - private Object secondValue; - private boolean noValue; - private boolean singleValue; - private boolean betweenValue; - private boolean listValue; - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.campaign - * - * @mbg.generated do_not_delete_during_merge Fri Nov 09 11:35:21 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/CampaignMetadata.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/CampaignMetadata.java deleted file mode 100644 index 8c2fae001a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/CampaignMetadata.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.opensrp.domain.postgres; - -public class CampaignMetadata { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.campaign_metadata.id - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - private Long id; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.campaign_metadata.campaign_id - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - private Long campaignId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.campaign_metadata.identifier - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - private String identifier; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.campaign_metadata.server_version - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - private Long serverVersion; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.campaign_metadata.id - * @return the value of core.campaign_metadata.id - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.campaign_metadata.id - * @param id the value for core.campaign_metadata.id - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.campaign_metadata.campaign_id - * @return the value of core.campaign_metadata.campaign_id - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public Long getCampaignId() { - return campaignId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.campaign_metadata.campaign_id - * @param campaignId the value for core.campaign_metadata.campaign_id - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void setCampaignId(Long campaignId) { - this.campaignId = campaignId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.campaign_metadata.identifier - * @return the value of core.campaign_metadata.identifier - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public String getIdentifier() { - return identifier; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.campaign_metadata.identifier - * @param identifier the value for core.campaign_metadata.identifier - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.campaign_metadata.server_version - * @return the value of core.campaign_metadata.server_version - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public Long getServerVersion() { - return serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.campaign_metadata.server_version - * @param serverVersion the value for core.campaign_metadata.server_version - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/CampaignMetadataExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/CampaignMetadataExample.java deleted file mode 100644 index ecef716be5..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/CampaignMetadataExample.java +++ /dev/null @@ -1,511 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class CampaignMetadataExample { - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - protected String orderByClause; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - protected boolean distinct; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public CampaignMetadataExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new IllegalArgumentException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andCampaignIdIsNull() { - addCriterion("campaign_id is null"); - return (Criteria) this; - } - - public Criteria andCampaignIdIsNotNull() { - addCriterion("campaign_id is not null"); - return (Criteria) this; - } - - public Criteria andCampaignIdEqualTo(Long value) { - addCriterion("campaign_id =", value, "campaignId"); - return (Criteria) this; - } - - public Criteria andCampaignIdNotEqualTo(Long value) { - addCriterion("campaign_id <>", value, "campaignId"); - return (Criteria) this; - } - - public Criteria andCampaignIdGreaterThan(Long value) { - addCriterion("campaign_id >", value, "campaignId"); - return (Criteria) this; - } - - public Criteria andCampaignIdGreaterThanOrEqualTo(Long value) { - addCriterion("campaign_id >=", value, "campaignId"); - return (Criteria) this; - } - - public Criteria andCampaignIdLessThan(Long value) { - addCriterion("campaign_id <", value, "campaignId"); - return (Criteria) this; - } - - public Criteria andCampaignIdLessThanOrEqualTo(Long value) { - addCriterion("campaign_id <=", value, "campaignId"); - return (Criteria) this; - } - - public Criteria andCampaignIdIn(List values) { - addCriterion("campaign_id in", values, "campaignId"); - return (Criteria) this; - } - - public Criteria andCampaignIdNotIn(List values) { - addCriterion("campaign_id not in", values, "campaignId"); - return (Criteria) this; - } - - public Criteria andCampaignIdBetween(Long value1, Long value2) { - addCriterion("campaign_id between", value1, value2, "campaignId"); - return (Criteria) this; - } - - public Criteria andCampaignIdNotBetween(Long value1, Long value2) { - addCriterion("campaign_id not between", value1, value2, "campaignId"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNull() { - addCriterion("identifier is null"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNotNull() { - addCriterion("identifier is not null"); - return (Criteria) this; - } - - public Criteria andIdentifierEqualTo(String value) { - addCriterion("identifier =", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotEqualTo(String value) { - addCriterion("identifier <>", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThan(String value) { - addCriterion("identifier >", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThanOrEqualTo(String value) { - addCriterion("identifier >=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThan(String value) { - addCriterion("identifier <", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThanOrEqualTo(String value) { - addCriterion("identifier <=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLike(String value) { - addCriterion("identifier like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotLike(String value) { - addCriterion("identifier not like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierIn(List values) { - addCriterion("identifier in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotIn(List values) { - addCriterion("identifier not in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierBetween(String value1, String value2) { - addCriterion("identifier between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotBetween(String value1, String value2) { - addCriterion("identifier not between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNull() { - addCriterion("server_version is null"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNotNull() { - addCriterion("server_version is not null"); - return (Criteria) this; - } - - public Criteria andServerVersionEqualTo(Long value) { - addCriterion("server_version =", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotEqualTo(Long value) { - addCriterion("server_version <>", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThan(Long value) { - addCriterion("server_version >", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThanOrEqualTo(Long value) { - addCriterion("server_version >=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThan(Long value) { - addCriterion("server_version <", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThanOrEqualTo(Long value) { - addCriterion("server_version <=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionIn(List values) { - addCriterion("server_version in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotIn(List values) { - addCriterion("server_version not in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionBetween(Long value1, Long value2) { - addCriterion("server_version between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotBetween(Long value1, Long value2) { - addCriterion("server_version not between", value1, value2, "serverVersion"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public static class Criterion { - private String condition; - private Object value; - private Object secondValue; - private boolean noValue; - private boolean singleValue; - private boolean betweenValue; - private boolean listValue; - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.campaign_metadata - * - * @mbg.generated do_not_delete_during_merge Fri Nov 09 11:35:21 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Client.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Client.java deleted file mode 100644 index cfd4e9de59..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Client.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.Date; - -public class Client { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.client.id - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.client.json - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - private Object json; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.client.date_deleted - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - private Date dateDeleted; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.client.id - * - * @return the value of core.client.id - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.client.id - * - * @param id the value for core.client.id - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.client.json - * - * @return the value of core.client.json - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public Object getJson() { - return json; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.client.json - * - * @param json the value for core.client.json - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public void setJson(Object json) { - this.json = json; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.client.date_deleted - * - * @return the value of core.client.date_deleted - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public Date getDateDeleted() { - return dateDeleted; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.client.date_deleted - * - * @param dateDeleted the value for core.client.date_deleted - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public void setDateDeleted(Date dateDeleted) { - this.dateDeleted = dateDeleted; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ClientExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/ClientExample.java deleted file mode 100644 index e716767066..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ClientExample.java +++ /dev/null @@ -1,520 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class ClientExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public ClientExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List jsonCriteria; - - protected List allCriteria; - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - jsonCriteria = new ArrayList(); - } - - public List getJsonCriteria() { - return jsonCriteria; - } - - protected void addJsonCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value, "org.opensrp.repository.postgres.handler.ClientTypeHandler")); - allCriteria = null; - } - - protected void addJsonCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - jsonCriteria.add( - new Criterion(condition, value1, value2, "org.opensrp.repository.postgres.handler.ClientTypeHandler")); - allCriteria = null; - } - - public boolean isValid() { - return criteria.size() > 0 || jsonCriteria.size() > 0; - } - - public List getAllCriteria() { - if (allCriteria == null) { - allCriteria = new ArrayList(); - allCriteria.addAll(criteria); - allCriteria.addAll(jsonCriteria); - } - return allCriteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - allCriteria = null; - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andJsonIsNull() { - addCriterion("json is null"); - return (Criteria) this; - } - - public Criteria andJsonIsNotNull() { - addCriterion("json is not null"); - return (Criteria) this; - } - - public Criteria andJsonEqualTo(Object value) { - addJsonCriterion("json =", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotEqualTo(Object value) { - addJsonCriterion("json <>", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThan(Object value) { - addJsonCriterion("json >", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThanOrEqualTo(Object value) { - addJsonCriterion("json >=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThan(Object value) { - addJsonCriterion("json <", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThanOrEqualTo(Object value) { - addJsonCriterion("json <=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonIn(List values) { - addJsonCriterion("json in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotIn(List values) { - addJsonCriterion("json not in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonBetween(Object value1, Object value2) { - addJsonCriterion("json between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotBetween(Object value1, Object value2) { - addJsonCriterion("json not between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andDateDeletedIsNull() { - addCriterion("date_deleted is null"); - return (Criteria) this; - } - - public Criteria andDateDeletedIsNotNull() { - addCriterion("date_deleted is not null"); - return (Criteria) this; - } - - public Criteria andDateDeletedEqualTo(Date value) { - addCriterion("date_deleted =", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotEqualTo(Date value) { - addCriterion("date_deleted <>", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedGreaterThan(Date value) { - addCriterion("date_deleted >", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedGreaterThanOrEqualTo(Date value) { - addCriterion("date_deleted >=", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedLessThan(Date value) { - addCriterion("date_deleted <", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedLessThanOrEqualTo(Date value) { - addCriterion("date_deleted <=", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedIn(List values) { - addCriterion("date_deleted in", values, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotIn(List values) { - addCriterion("date_deleted not in", values, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedBetween(Date value1, Date value2) { - addCriterion("date_deleted between", value1, value2, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotBetween(Date value1, Date value2) { - addCriterion("date_deleted not between", value1, value2, "dateDeleted"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.client - * - * @mbg.generated do_not_delete_during_merge Wed Mar 07 18:26:22 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ClientMetadata.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/ClientMetadata.java deleted file mode 100644 index 6b1778ee14..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ClientMetadata.java +++ /dev/null @@ -1,329 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.Date; - -public class ClientMetadata { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.client_metadata.id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - private Long id; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.client_metadata.client_id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - private Long clientId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.client_metadata.document_id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - private String documentId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.client_metadata.base_entity_id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - private String baseEntityId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.client_metadata.relational_id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - private String relationalId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.client_metadata.server_version - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - private Long serverVersion; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.client_metadata.openmrs_uuid - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - private String openmrsUuid; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.client_metadata.unique_id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - private String uniqueId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.client_metadata.first_name - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - private String firstName; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.client_metadata.middle_name - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - private String middleName; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.client_metadata.last_name - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - private String lastName; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.client_metadata.birth_date - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - private Date birthDate; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.client_metadata.date_deleted - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - private Date dateDeleted; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.client_metadata.residence - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - private String residence; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.client_metadata.id - * @return the value of core.client_metadata.id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.client_metadata.id - * @param id the value for core.client_metadata.id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.client_metadata.client_id - * @return the value of core.client_metadata.client_id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public Long getClientId() { - return clientId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.client_metadata.client_id - * @param clientId the value for core.client_metadata.client_id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setClientId(Long clientId) { - this.clientId = clientId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.client_metadata.document_id - * @return the value of core.client_metadata.document_id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public String getDocumentId() { - return documentId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.client_metadata.document_id - * @param documentId the value for core.client_metadata.document_id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setDocumentId(String documentId) { - this.documentId = documentId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.client_metadata.base_entity_id - * @return the value of core.client_metadata.base_entity_id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public String getBaseEntityId() { - return baseEntityId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.client_metadata.base_entity_id - * @param baseEntityId the value for core.client_metadata.base_entity_id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.client_metadata.relational_id - * @return the value of core.client_metadata.relational_id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public String getRelationalId() { - return relationalId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.client_metadata.relational_id - * @param relationalId the value for core.client_metadata.relational_id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setRelationalId(String relationalId) { - this.relationalId = relationalId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.client_metadata.server_version - * @return the value of core.client_metadata.server_version - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public Long getServerVersion() { - return serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.client_metadata.server_version - * @param serverVersion the value for core.client_metadata.server_version - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.client_metadata.openmrs_uuid - * @return the value of core.client_metadata.openmrs_uuid - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public String getOpenmrsUuid() { - return openmrsUuid; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.client_metadata.openmrs_uuid - * @param openmrsUuid the value for core.client_metadata.openmrs_uuid - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setOpenmrsUuid(String openmrsUuid) { - this.openmrsUuid = openmrsUuid; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.client_metadata.unique_id - * @return the value of core.client_metadata.unique_id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public String getUniqueId() { - return uniqueId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.client_metadata.unique_id - * @param uniqueId the value for core.client_metadata.unique_id - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.client_metadata.first_name - * @return the value of core.client_metadata.first_name - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public String getFirstName() { - return firstName; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.client_metadata.first_name - * @param firstName the value for core.client_metadata.first_name - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.client_metadata.middle_name - * @return the value of core.client_metadata.middle_name - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public String getMiddleName() { - return middleName; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.client_metadata.middle_name - * @param middleName the value for core.client_metadata.middle_name - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setMiddleName(String middleName) { - this.middleName = middleName; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.client_metadata.last_name - * @return the value of core.client_metadata.last_name - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public String getLastName() { - return lastName; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.client_metadata.last_name - * @param lastName the value for core.client_metadata.last_name - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setLastName(String lastName) { - this.lastName = lastName; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.client_metadata.birth_date - * @return the value of core.client_metadata.birth_date - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public Date getBirthDate() { - return birthDate; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.client_metadata.birth_date - * @param birthDate the value for core.client_metadata.birth_date - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setBirthDate(Date birthDate) { - this.birthDate = birthDate; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.client_metadata.date_deleted - * @return the value of core.client_metadata.date_deleted - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public Date getDateDeleted() { - return dateDeleted; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.client_metadata.date_deleted - * @param dateDeleted the value for core.client_metadata.date_deleted - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setDateDeleted(Date dateDeleted) { - this.dateDeleted = dateDeleted; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.client_metadata.residence - * @return the value of core.client_metadata.residence - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public String getResidence() { - return residence; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.client_metadata.residence - * @param residence the value for core.client_metadata.residence - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setResidence(String residence) { - this.residence = residence; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ClientMetadataExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/ClientMetadataExample.java deleted file mode 100644 index 5521e893dd..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ClientMetadataExample.java +++ /dev/null @@ -1,1220 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -public class ClientMetadataExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - protected String orderByClause; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - protected boolean distinct; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public ClientMetadataExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - protected void addCriterionForJDBCDate(String condition, Date value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - addCriterion(condition, new java.sql.Date(value.getTime()), property); - } - - protected void addCriterionForJDBCDate(String condition, List values, String property) { - if (values == null || values.size() == 0) { - throw new RuntimeException("Value list for " + property + " cannot be null or empty"); - } - List dateList = new ArrayList(); - Iterator iter = values.iterator(); - while (iter.hasNext()) { - dateList.add(new java.sql.Date(iter.next().getTime())); - } - addCriterion(condition, dateList, property); - } - - protected void addCriterionForJDBCDate(String condition, Date value1, Date value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - addCriterion(condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andClientIdIsNull() { - addCriterion("client_id is null"); - return (Criteria) this; - } - - public Criteria andClientIdIsNotNull() { - addCriterion("client_id is not null"); - return (Criteria) this; - } - - public Criteria andClientIdEqualTo(Long value) { - addCriterion("client_id =", value, "clientId"); - return (Criteria) this; - } - - public Criteria andClientIdNotEqualTo(Long value) { - addCriterion("client_id <>", value, "clientId"); - return (Criteria) this; - } - - public Criteria andClientIdGreaterThan(Long value) { - addCriterion("client_id >", value, "clientId"); - return (Criteria) this; - } - - public Criteria andClientIdGreaterThanOrEqualTo(Long value) { - addCriterion("client_id >=", value, "clientId"); - return (Criteria) this; - } - - public Criteria andClientIdLessThan(Long value) { - addCriterion("client_id <", value, "clientId"); - return (Criteria) this; - } - - public Criteria andClientIdLessThanOrEqualTo(Long value) { - addCriterion("client_id <=", value, "clientId"); - return (Criteria) this; - } - - public Criteria andClientIdIn(List values) { - addCriterion("client_id in", values, "clientId"); - return (Criteria) this; - } - - public Criteria andClientIdNotIn(List values) { - addCriterion("client_id not in", values, "clientId"); - return (Criteria) this; - } - - public Criteria andClientIdBetween(Long value1, Long value2) { - addCriterion("client_id between", value1, value2, "clientId"); - return (Criteria) this; - } - - public Criteria andClientIdNotBetween(Long value1, Long value2) { - addCriterion("client_id not between", value1, value2, "clientId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNull() { - addCriterion("document_id is null"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNotNull() { - addCriterion("document_id is not null"); - return (Criteria) this; - } - - public Criteria andDocumentIdEqualTo(String value) { - addCriterion("document_id =", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotEqualTo(String value) { - addCriterion("document_id <>", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThan(String value) { - addCriterion("document_id >", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThanOrEqualTo(String value) { - addCriterion("document_id >=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThan(String value) { - addCriterion("document_id <", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThanOrEqualTo(String value) { - addCriterion("document_id <=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLike(String value) { - addCriterion("document_id like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotLike(String value) { - addCriterion("document_id not like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIn(List values) { - addCriterion("document_id in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotIn(List values) { - addCriterion("document_id not in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdBetween(String value1, String value2) { - addCriterion("document_id between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotBetween(String value1, String value2) { - addCriterion("document_id not between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdIsNull() { - addCriterion("base_entity_id is null"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdIsNotNull() { - addCriterion("base_entity_id is not null"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdEqualTo(String value) { - addCriterion("base_entity_id =", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotEqualTo(String value) { - addCriterion("base_entity_id <>", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdGreaterThan(String value) { - addCriterion("base_entity_id >", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdGreaterThanOrEqualTo(String value) { - addCriterion("base_entity_id >=", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdLessThan(String value) { - addCriterion("base_entity_id <", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdLessThanOrEqualTo(String value) { - addCriterion("base_entity_id <=", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdLike(String value) { - addCriterion("base_entity_id like", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotLike(String value) { - addCriterion("base_entity_id not like", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdIn(List values) { - addCriterion("base_entity_id in", values, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotIn(List values) { - addCriterion("base_entity_id not in", values, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdBetween(String value1, String value2) { - addCriterion("base_entity_id between", value1, value2, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotBetween(String value1, String value2) { - addCriterion("base_entity_id not between", value1, value2, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andRelationalIdIsNull() { - addCriterion("relational_id is null"); - return (Criteria) this; - } - - public Criteria andRelationalIdIsNotNull() { - addCriterion("relational_id is not null"); - return (Criteria) this; - } - - public Criteria andRelationalIdEqualTo(String value) { - addCriterion("relational_id =", value, "relationalId"); - return (Criteria) this; - } - - public Criteria andRelationalIdNotEqualTo(String value) { - addCriterion("relational_id <>", value, "relationalId"); - return (Criteria) this; - } - - public Criteria andRelationalIdGreaterThan(String value) { - addCriterion("relational_id >", value, "relationalId"); - return (Criteria) this; - } - - public Criteria andRelationalIdGreaterThanOrEqualTo(String value) { - addCriterion("relational_id >=", value, "relationalId"); - return (Criteria) this; - } - - public Criteria andRelationalIdLessThan(String value) { - addCriterion("relational_id <", value, "relationalId"); - return (Criteria) this; - } - - public Criteria andRelationalIdLessThanOrEqualTo(String value) { - addCriterion("relational_id <=", value, "relationalId"); - return (Criteria) this; - } - - public Criteria andRelationalIdLike(String value) { - addCriterion("relational_id like", value, "relationalId"); - return (Criteria) this; - } - - public Criteria andRelationalIdNotLike(String value) { - addCriterion("relational_id not like", value, "relationalId"); - return (Criteria) this; - } - - public Criteria andRelationalIdIn(List values) { - addCriterion("relational_id in", values, "relationalId"); - return (Criteria) this; - } - - public Criteria andRelationalIdNotIn(List values) { - addCriterion("relational_id not in", values, "relationalId"); - return (Criteria) this; - } - - public Criteria andRelationalIdBetween(String value1, String value2) { - addCriterion("relational_id between", value1, value2, "relationalId"); - return (Criteria) this; - } - - public Criteria andRelationalIdNotBetween(String value1, String value2) { - addCriterion("relational_id not between", value1, value2, "relationalId"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNull() { - addCriterion("server_version is null"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNotNull() { - addCriterion("server_version is not null"); - return (Criteria) this; - } - - public Criteria andServerVersionEqualTo(Long value) { - addCriterion("server_version =", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotEqualTo(Long value) { - addCriterion("server_version <>", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThan(Long value) { - addCriterion("server_version >", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThanOrEqualTo(Long value) { - addCriterion("server_version >=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThan(Long value) { - addCriterion("server_version <", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThanOrEqualTo(Long value) { - addCriterion("server_version <=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionIn(List values) { - addCriterion("server_version in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotIn(List values) { - addCriterion("server_version not in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionBetween(Long value1, Long value2) { - addCriterion("server_version between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotBetween(Long value1, Long value2) { - addCriterion("server_version not between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidIsNull() { - addCriterion("openmrs_uuid is null"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidIsNotNull() { - addCriterion("openmrs_uuid is not null"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidEqualTo(String value) { - addCriterion("openmrs_uuid =", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidNotEqualTo(String value) { - addCriterion("openmrs_uuid <>", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidGreaterThan(String value) { - addCriterion("openmrs_uuid >", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidGreaterThanOrEqualTo(String value) { - addCriterion("openmrs_uuid >=", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidLessThan(String value) { - addCriterion("openmrs_uuid <", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidLessThanOrEqualTo(String value) { - addCriterion("openmrs_uuid <=", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidLike(String value) { - addCriterion("openmrs_uuid like", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidNotLike(String value) { - addCriterion("openmrs_uuid not like", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidIn(List values) { - addCriterion("openmrs_uuid in", values, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidNotIn(List values) { - addCriterion("openmrs_uuid not in", values, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidBetween(String value1, String value2) { - addCriterion("openmrs_uuid between", value1, value2, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidNotBetween(String value1, String value2) { - addCriterion("openmrs_uuid not between", value1, value2, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andUniqueIdIsNull() { - addCriterion("unique_id is null"); - return (Criteria) this; - } - - public Criteria andUniqueIdIsNotNull() { - addCriterion("unique_id is not null"); - return (Criteria) this; - } - - public Criteria andUniqueIdEqualTo(String value) { - addCriterion("unique_id =", value, "uniqueId"); - return (Criteria) this; - } - - public Criteria andUniqueIdNotEqualTo(String value) { - addCriterion("unique_id <>", value, "uniqueId"); - return (Criteria) this; - } - - public Criteria andUniqueIdGreaterThan(String value) { - addCriterion("unique_id >", value, "uniqueId"); - return (Criteria) this; - } - - public Criteria andUniqueIdGreaterThanOrEqualTo(String value) { - addCriterion("unique_id >=", value, "uniqueId"); - return (Criteria) this; - } - - public Criteria andUniqueIdLessThan(String value) { - addCriterion("unique_id <", value, "uniqueId"); - return (Criteria) this; - } - - public Criteria andUniqueIdLessThanOrEqualTo(String value) { - addCriterion("unique_id <=", value, "uniqueId"); - return (Criteria) this; - } - - public Criteria andUniqueIdLike(String value) { - addCriterion("unique_id like", value, "uniqueId"); - return (Criteria) this; - } - - public Criteria andUniqueIdNotLike(String value) { - addCriterion("unique_id not like", value, "uniqueId"); - return (Criteria) this; - } - - public Criteria andUniqueIdIn(List values) { - addCriterion("unique_id in", values, "uniqueId"); - return (Criteria) this; - } - - public Criteria andUniqueIdNotIn(List values) { - addCriterion("unique_id not in", values, "uniqueId"); - return (Criteria) this; - } - - public Criteria andUniqueIdBetween(String value1, String value2) { - addCriterion("unique_id between", value1, value2, "uniqueId"); - return (Criteria) this; - } - - public Criteria andUniqueIdNotBetween(String value1, String value2) { - addCriterion("unique_id not between", value1, value2, "uniqueId"); - return (Criteria) this; - } - - public Criteria andFirstNameIsNull() { - addCriterion("first_name is null"); - return (Criteria) this; - } - - public Criteria andFirstNameIsNotNull() { - addCriterion("first_name is not null"); - return (Criteria) this; - } - - public Criteria andFirstNameEqualTo(String value) { - addCriterion("first_name =", value, "firstName"); - return (Criteria) this; - } - - public Criteria andFirstNameNotEqualTo(String value) { - addCriterion("first_name <>", value, "firstName"); - return (Criteria) this; - } - - public Criteria andFirstNameGreaterThan(String value) { - addCriterion("first_name >", value, "firstName"); - return (Criteria) this; - } - - public Criteria andFirstNameGreaterThanOrEqualTo(String value) { - addCriterion("first_name >=", value, "firstName"); - return (Criteria) this; - } - - public Criteria andFirstNameLessThan(String value) { - addCriterion("first_name <", value, "firstName"); - return (Criteria) this; - } - - public Criteria andFirstNameLessThanOrEqualTo(String value) { - addCriterion("first_name <=", value, "firstName"); - return (Criteria) this; - } - - public Criteria andFirstNameLike(String value) { - addCriterion("first_name like", value, "firstName"); - return (Criteria) this; - } - - public Criteria andFirstNameNotLike(String value) { - addCriterion("first_name not like", value, "firstName"); - return (Criteria) this; - } - - public Criteria andFirstNameIn(List values) { - addCriterion("first_name in", values, "firstName"); - return (Criteria) this; - } - - public Criteria andFirstNameNotIn(List values) { - addCriterion("first_name not in", values, "firstName"); - return (Criteria) this; - } - - public Criteria andFirstNameBetween(String value1, String value2) { - addCriterion("first_name between", value1, value2, "firstName"); - return (Criteria) this; - } - - public Criteria andFirstNameNotBetween(String value1, String value2) { - addCriterion("first_name not between", value1, value2, "firstName"); - return (Criteria) this; - } - - public Criteria andMiddleNameIsNull() { - addCriterion("middle_name is null"); - return (Criteria) this; - } - - public Criteria andMiddleNameIsNotNull() { - addCriterion("middle_name is not null"); - return (Criteria) this; - } - - public Criteria andMiddleNameEqualTo(String value) { - addCriterion("middle_name =", value, "middleName"); - return (Criteria) this; - } - - public Criteria andMiddleNameNotEqualTo(String value) { - addCriterion("middle_name <>", value, "middleName"); - return (Criteria) this; - } - - public Criteria andMiddleNameGreaterThan(String value) { - addCriterion("middle_name >", value, "middleName"); - return (Criteria) this; - } - - public Criteria andMiddleNameGreaterThanOrEqualTo(String value) { - addCriterion("middle_name >=", value, "middleName"); - return (Criteria) this; - } - - public Criteria andMiddleNameLessThan(String value) { - addCriterion("middle_name <", value, "middleName"); - return (Criteria) this; - } - - public Criteria andMiddleNameLessThanOrEqualTo(String value) { - addCriterion("middle_name <=", value, "middleName"); - return (Criteria) this; - } - - public Criteria andMiddleNameLike(String value) { - addCriterion("middle_name like", value, "middleName"); - return (Criteria) this; - } - - public Criteria andMiddleNameNotLike(String value) { - addCriterion("middle_name not like", value, "middleName"); - return (Criteria) this; - } - - public Criteria andMiddleNameIn(List values) { - addCriterion("middle_name in", values, "middleName"); - return (Criteria) this; - } - - public Criteria andMiddleNameNotIn(List values) { - addCriterion("middle_name not in", values, "middleName"); - return (Criteria) this; - } - - public Criteria andMiddleNameBetween(String value1, String value2) { - addCriterion("middle_name between", value1, value2, "middleName"); - return (Criteria) this; - } - - public Criteria andMiddleNameNotBetween(String value1, String value2) { - addCriterion("middle_name not between", value1, value2, "middleName"); - return (Criteria) this; - } - - public Criteria andLastNameIsNull() { - addCriterion("last_name is null"); - return (Criteria) this; - } - - public Criteria andLastNameIsNotNull() { - addCriterion("last_name is not null"); - return (Criteria) this; - } - - public Criteria andLastNameEqualTo(String value) { - addCriterion("last_name =", value, "lastName"); - return (Criteria) this; - } - - public Criteria andLastNameNotEqualTo(String value) { - addCriterion("last_name <>", value, "lastName"); - return (Criteria) this; - } - - public Criteria andLastNameGreaterThan(String value) { - addCriterion("last_name >", value, "lastName"); - return (Criteria) this; - } - - public Criteria andLastNameGreaterThanOrEqualTo(String value) { - addCriterion("last_name >=", value, "lastName"); - return (Criteria) this; - } - - public Criteria andLastNameLessThan(String value) { - addCriterion("last_name <", value, "lastName"); - return (Criteria) this; - } - - public Criteria andLastNameLessThanOrEqualTo(String value) { - addCriterion("last_name <=", value, "lastName"); - return (Criteria) this; - } - - public Criteria andLastNameLike(String value) { - addCriterion("last_name like", value, "lastName"); - return (Criteria) this; - } - - public Criteria andLastNameNotLike(String value) { - addCriterion("last_name not like", value, "lastName"); - return (Criteria) this; - } - - public Criteria andLastNameIn(List values) { - addCriterion("last_name in", values, "lastName"); - return (Criteria) this; - } - - public Criteria andLastNameNotIn(List values) { - addCriterion("last_name not in", values, "lastName"); - return (Criteria) this; - } - - public Criteria andLastNameBetween(String value1, String value2) { - addCriterion("last_name between", value1, value2, "lastName"); - return (Criteria) this; - } - - public Criteria andLastNameNotBetween(String value1, String value2) { - addCriterion("last_name not between", value1, value2, "lastName"); - return (Criteria) this; - } - - public Criteria andBirthDateIsNull() { - addCriterion("birth_date is null"); - return (Criteria) this; - } - - public Criteria andBirthDateIsNotNull() { - addCriterion("birth_date is not null"); - return (Criteria) this; - } - - public Criteria andBirthDateEqualTo(Date value) { - addCriterionForJDBCDate("birth_date =", value, "birthDate"); - return (Criteria) this; - } - - public Criteria andBirthDateNotEqualTo(Date value) { - addCriterionForJDBCDate("birth_date <>", value, "birthDate"); - return (Criteria) this; - } - - public Criteria andBirthDateGreaterThan(Date value) { - addCriterionForJDBCDate("birth_date >", value, "birthDate"); - return (Criteria) this; - } - - public Criteria andBirthDateGreaterThanOrEqualTo(Date value) { - addCriterionForJDBCDate("birth_date >=", value, "birthDate"); - return (Criteria) this; - } - - public Criteria andBirthDateLessThan(Date value) { - addCriterionForJDBCDate("birth_date <", value, "birthDate"); - return (Criteria) this; - } - - public Criteria andBirthDateLessThanOrEqualTo(Date value) { - addCriterionForJDBCDate("birth_date <=", value, "birthDate"); - return (Criteria) this; - } - - public Criteria andBirthDateIn(List values) { - addCriterionForJDBCDate("birth_date in", values, "birthDate"); - return (Criteria) this; - } - - public Criteria andBirthDateNotIn(List values) { - addCriterionForJDBCDate("birth_date not in", values, "birthDate"); - return (Criteria) this; - } - - public Criteria andBirthDateBetween(Date value1, Date value2) { - addCriterionForJDBCDate("birth_date between", value1, value2, "birthDate"); - return (Criteria) this; - } - - public Criteria andBirthDateNotBetween(Date value1, Date value2) { - addCriterionForJDBCDate("birth_date not between", value1, value2, "birthDate"); - return (Criteria) this; - } - - public Criteria andDateDeletedIsNull() { - addCriterion("date_deleted is null"); - return (Criteria) this; - } - - public Criteria andDateDeletedIsNotNull() { - addCriterion("date_deleted is not null"); - return (Criteria) this; - } - - public Criteria andDateDeletedEqualTo(Date value) { - addCriterion("date_deleted =", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotEqualTo(Date value) { - addCriterion("date_deleted <>", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedGreaterThan(Date value) { - addCriterion("date_deleted >", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedGreaterThanOrEqualTo(Date value) { - addCriterion("date_deleted >=", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedLessThan(Date value) { - addCriterion("date_deleted <", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedLessThanOrEqualTo(Date value) { - addCriterion("date_deleted <=", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedIn(List values) { - addCriterion("date_deleted in", values, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotIn(List values) { - addCriterion("date_deleted not in", values, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedBetween(Date value1, Date value2) { - addCriterion("date_deleted between", value1, value2, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotBetween(Date value1, Date value2) { - addCriterion("date_deleted not between", value1, value2, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andResidenceIsNull() { - addCriterion("residence is null"); - return (Criteria) this; - } - - public Criteria andResidenceIsNotNull() { - addCriterion("residence is not null"); - return (Criteria) this; - } - - public Criteria andResidenceEqualTo(String value) { - addCriterion("residence =", value, "residence"); - return (Criteria) this; - } - - public Criteria andResidenceNotEqualTo(String value) { - addCriterion("residence <>", value, "residence"); - return (Criteria) this; - } - - public Criteria andResidenceGreaterThan(String value) { - addCriterion("residence >", value, "residence"); - return (Criteria) this; - } - - public Criteria andResidenceGreaterThanOrEqualTo(String value) { - addCriterion("residence >=", value, "residence"); - return (Criteria) this; - } - - public Criteria andResidenceLessThan(String value) { - addCriterion("residence <", value, "residence"); - return (Criteria) this; - } - - public Criteria andResidenceLessThanOrEqualTo(String value) { - addCriterion("residence <=", value, "residence"); - return (Criteria) this; - } - - public Criteria andResidenceLike(String value) { - addCriterion("residence like", value, "residence"); - return (Criteria) this; - } - - public Criteria andResidenceNotLike(String value) { - addCriterion("residence not like", value, "residence"); - return (Criteria) this; - } - - public Criteria andResidenceIn(List values) { - addCriterion("residence in", values, "residence"); - return (Criteria) this; - } - - public Criteria andResidenceNotIn(List values) { - addCriterion("residence not in", values, "residence"); - return (Criteria) this; - } - - public Criteria andResidenceBetween(String value1, String value2) { - addCriterion("residence between", value1, value2, "residence"); - return (Criteria) this; - } - - public Criteria andResidenceNotBetween(String value1, String value2) { - addCriterion("residence not between", value1, value2, "residence"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - public static class Criterion { - private String condition; - private Object value; - private Object secondValue; - private boolean noValue; - private boolean singleValue; - private boolean betweenValue; - private boolean listValue; - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.client_metadata - * - * @mbg.generated do_not_delete_during_merge Wed Mar 07 18:26:22 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/CustomClient.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/CustomClient.java deleted file mode 100644 index 66bb4023e6..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/CustomClient.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.Map; - -public class CustomClient extends Client { - - private Map dynamicProperties; - - public Map getDynamicProperties() { - return dynamicProperties; - } - - public void setDynamicProperties(Map dynamicProperties) { - this.dynamicProperties = dynamicProperties; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ErrorTrace.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/ErrorTrace.java deleted file mode 100644 index 0715f3cdf9..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ErrorTrace.java +++ /dev/null @@ -1,336 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.Date; - -public class ErrorTrace { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * error.error_trace.id - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * error.error_trace.document_id - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - private String documentId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * error.error_trace.date_occurred - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - private Date dateOccurred; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * error.error_trace.error_type - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - private String errorType; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * error.error_trace.occurred_at - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - private String occurredAt; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * error.error_trace.stack_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - private String stackTrace; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * error.error_trace.status - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - private String status; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * error.error_trace.record_id - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - private String recordId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * error.error_trace.date_closed - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - private Date dateClosed; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * error.error_trace.document_type - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - private String documentType; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * error.error_trace.retry_url - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - private String retryUrl; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column error.error_trace.id - * - * @return the value of error.error_trace.id - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column error.error_trace.id - * - * @param id the value for error.error_trace.id - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column error.error_trace.document_id - * - * @return the value of error.error_trace.document_id - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public String getDocumentId() { - return documentId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column error.error_trace.document_id - * - * @param documentId the value for error.error_trace.document_id - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public void setDocumentId(String documentId) { - this.documentId = documentId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column error.error_trace.date_occurred - * - * @return the value of error.error_trace.date_occurred - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public Date getDateOccurred() { - return dateOccurred; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column error.error_trace.date_occurred - * - * @param dateOccurred the value for error.error_trace.date_occurred - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public void setDateOccurred(Date dateOccurred) { - this.dateOccurred = dateOccurred; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column error.error_trace.error_type - * - * @return the value of error.error_trace.error_type - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public String getErrorType() { - return errorType; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column error.error_trace.error_type - * - * @param errorType the value for error.error_trace.error_type - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public void setErrorType(String errorType) { - this.errorType = errorType; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column error.error_trace.occurred_at - * - * @return the value of error.error_trace.occurred_at - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public String getOccurredAt() { - return occurredAt; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column error.error_trace.occurred_at - * - * @param occurredAt the value for error.error_trace.occurred_at - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public void setOccurredAt(String occurredAt) { - this.occurredAt = occurredAt; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column error.error_trace.stack_trace - * - * @return the value of error.error_trace.stack_trace - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public String getStackTrace() { - return stackTrace; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column error.error_trace.stack_trace - * - * @param stackTrace the value for error.error_trace.stack_trace - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public void setStackTrace(String stackTrace) { - this.stackTrace = stackTrace; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column error.error_trace.status - * - * @return the value of error.error_trace.status - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public String getStatus() { - return status; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column error.error_trace.status - * - * @param status the value for error.error_trace.status - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public void setStatus(String status) { - this.status = status; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column error.error_trace.record_id - * - * @return the value of error.error_trace.record_id - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public String getRecordId() { - return recordId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column error.error_trace.record_id - * - * @param recordId the value for error.error_trace.record_id - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public void setRecordId(String recordId) { - this.recordId = recordId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column error.error_trace.date_closed - * - * @return the value of error.error_trace.date_closed - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public Date getDateClosed() { - return dateClosed; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column error.error_trace.date_closed - * - * @param dateClosed the value for error.error_trace.date_closed - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public void setDateClosed(Date dateClosed) { - this.dateClosed = dateClosed; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column error.error_trace.document_type - * - * @return the value of error.error_trace.document_type - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public String getDocumentType() { - return documentType; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column error.error_trace.document_type - * - * @param documentType the value for error.error_trace.document_type - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public void setDocumentType(String documentType) { - this.documentType = documentType; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column error.error_trace.retry_url - * - * @return the value of error.error_trace.retry_url - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public String getRetryUrl() { - return retryUrl; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column error.error_trace.retry_url - * - * @param retryUrl the value for error.error_trace.retry_url - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public void setRetryUrl(String retryUrl) { - this.retryUrl = retryUrl; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ErrorTraceExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/ErrorTraceExample.java deleted file mode 100644 index 940641f12f..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ErrorTraceExample.java +++ /dev/null @@ -1,1046 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class ErrorTraceExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public ErrorTraceExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNull() { - addCriterion("document_id is null"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNotNull() { - addCriterion("document_id is not null"); - return (Criteria) this; - } - - public Criteria andDocumentIdEqualTo(String value) { - addCriterion("document_id =", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotEqualTo(String value) { - addCriterion("document_id <>", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThan(String value) { - addCriterion("document_id >", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThanOrEqualTo(String value) { - addCriterion("document_id >=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThan(String value) { - addCriterion("document_id <", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThanOrEqualTo(String value) { - addCriterion("document_id <=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLike(String value) { - addCriterion("document_id like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotLike(String value) { - addCriterion("document_id not like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIn(List values) { - addCriterion("document_id in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotIn(List values) { - addCriterion("document_id not in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdBetween(String value1, String value2) { - addCriterion("document_id between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotBetween(String value1, String value2) { - addCriterion("document_id not between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andDateOccurredIsNull() { - addCriterion("date_occurred is null"); - return (Criteria) this; - } - - public Criteria andDateOccurredIsNotNull() { - addCriterion("date_occurred is not null"); - return (Criteria) this; - } - - public Criteria andDateOccurredEqualTo(Date value) { - addCriterion("date_occurred =", value, "dateOccurred"); - return (Criteria) this; - } - - public Criteria andDateOccurredNotEqualTo(Date value) { - addCriterion("date_occurred <>", value, "dateOccurred"); - return (Criteria) this; - } - - public Criteria andDateOccurredGreaterThan(Date value) { - addCriterion("date_occurred >", value, "dateOccurred"); - return (Criteria) this; - } - - public Criteria andDateOccurredGreaterThanOrEqualTo(Date value) { - addCriterion("date_occurred >=", value, "dateOccurred"); - return (Criteria) this; - } - - public Criteria andDateOccurredLessThan(Date value) { - addCriterion("date_occurred <", value, "dateOccurred"); - return (Criteria) this; - } - - public Criteria andDateOccurredLessThanOrEqualTo(Date value) { - addCriterion("date_occurred <=", value, "dateOccurred"); - return (Criteria) this; - } - - public Criteria andDateOccurredIn(List values) { - addCriterion("date_occurred in", values, "dateOccurred"); - return (Criteria) this; - } - - public Criteria andDateOccurredNotIn(List values) { - addCriterion("date_occurred not in", values, "dateOccurred"); - return (Criteria) this; - } - - public Criteria andDateOccurredBetween(Date value1, Date value2) { - addCriterion("date_occurred between", value1, value2, "dateOccurred"); - return (Criteria) this; - } - - public Criteria andDateOccurredNotBetween(Date value1, Date value2) { - addCriterion("date_occurred not between", value1, value2, "dateOccurred"); - return (Criteria) this; - } - - public Criteria andErrorTypeIsNull() { - addCriterion("error_type is null"); - return (Criteria) this; - } - - public Criteria andErrorTypeIsNotNull() { - addCriterion("error_type is not null"); - return (Criteria) this; - } - - public Criteria andErrorTypeEqualTo(String value) { - addCriterion("error_type =", value, "errorType"); - return (Criteria) this; - } - - public Criteria andErrorTypeNotEqualTo(String value) { - addCriterion("error_type <>", value, "errorType"); - return (Criteria) this; - } - - public Criteria andErrorTypeGreaterThan(String value) { - addCriterion("error_type >", value, "errorType"); - return (Criteria) this; - } - - public Criteria andErrorTypeGreaterThanOrEqualTo(String value) { - addCriterion("error_type >=", value, "errorType"); - return (Criteria) this; - } - - public Criteria andErrorTypeLessThan(String value) { - addCriterion("error_type <", value, "errorType"); - return (Criteria) this; - } - - public Criteria andErrorTypeLessThanOrEqualTo(String value) { - addCriterion("error_type <=", value, "errorType"); - return (Criteria) this; - } - - public Criteria andErrorTypeLike(String value) { - addCriterion("error_type like", value, "errorType"); - return (Criteria) this; - } - - public Criteria andErrorTypeNotLike(String value) { - addCriterion("error_type not like", value, "errorType"); - return (Criteria) this; - } - - public Criteria andErrorTypeIn(List values) { - addCriterion("error_type in", values, "errorType"); - return (Criteria) this; - } - - public Criteria andErrorTypeNotIn(List values) { - addCriterion("error_type not in", values, "errorType"); - return (Criteria) this; - } - - public Criteria andErrorTypeBetween(String value1, String value2) { - addCriterion("error_type between", value1, value2, "errorType"); - return (Criteria) this; - } - - public Criteria andErrorTypeNotBetween(String value1, String value2) { - addCriterion("error_type not between", value1, value2, "errorType"); - return (Criteria) this; - } - - public Criteria andOccurredAtIsNull() { - addCriterion("occurred_at is null"); - return (Criteria) this; - } - - public Criteria andOccurredAtIsNotNull() { - addCriterion("occurred_at is not null"); - return (Criteria) this; - } - - public Criteria andOccurredAtEqualTo(String value) { - addCriterion("occurred_at =", value, "occurredAt"); - return (Criteria) this; - } - - public Criteria andOccurredAtNotEqualTo(String value) { - addCriterion("occurred_at <>", value, "occurredAt"); - return (Criteria) this; - } - - public Criteria andOccurredAtGreaterThan(String value) { - addCriterion("occurred_at >", value, "occurredAt"); - return (Criteria) this; - } - - public Criteria andOccurredAtGreaterThanOrEqualTo(String value) { - addCriterion("occurred_at >=", value, "occurredAt"); - return (Criteria) this; - } - - public Criteria andOccurredAtLessThan(String value) { - addCriterion("occurred_at <", value, "occurredAt"); - return (Criteria) this; - } - - public Criteria andOccurredAtLessThanOrEqualTo(String value) { - addCriterion("occurred_at <=", value, "occurredAt"); - return (Criteria) this; - } - - public Criteria andOccurredAtLike(String value) { - addCriterion("occurred_at like", value, "occurredAt"); - return (Criteria) this; - } - - public Criteria andOccurredAtNotLike(String value) { - addCriterion("occurred_at not like", value, "occurredAt"); - return (Criteria) this; - } - - public Criteria andOccurredAtIn(List values) { - addCriterion("occurred_at in", values, "occurredAt"); - return (Criteria) this; - } - - public Criteria andOccurredAtNotIn(List values) { - addCriterion("occurred_at not in", values, "occurredAt"); - return (Criteria) this; - } - - public Criteria andOccurredAtBetween(String value1, String value2) { - addCriterion("occurred_at between", value1, value2, "occurredAt"); - return (Criteria) this; - } - - public Criteria andOccurredAtNotBetween(String value1, String value2) { - addCriterion("occurred_at not between", value1, value2, "occurredAt"); - return (Criteria) this; - } - - public Criteria andStackTraceIsNull() { - addCriterion("stack_trace is null"); - return (Criteria) this; - } - - public Criteria andStackTraceIsNotNull() { - addCriterion("stack_trace is not null"); - return (Criteria) this; - } - - public Criteria andStackTraceEqualTo(String value) { - addCriterion("stack_trace =", value, "stackTrace"); - return (Criteria) this; - } - - public Criteria andStackTraceNotEqualTo(String value) { - addCriterion("stack_trace <>", value, "stackTrace"); - return (Criteria) this; - } - - public Criteria andStackTraceGreaterThan(String value) { - addCriterion("stack_trace >", value, "stackTrace"); - return (Criteria) this; - } - - public Criteria andStackTraceGreaterThanOrEqualTo(String value) { - addCriterion("stack_trace >=", value, "stackTrace"); - return (Criteria) this; - } - - public Criteria andStackTraceLessThan(String value) { - addCriterion("stack_trace <", value, "stackTrace"); - return (Criteria) this; - } - - public Criteria andStackTraceLessThanOrEqualTo(String value) { - addCriterion("stack_trace <=", value, "stackTrace"); - return (Criteria) this; - } - - public Criteria andStackTraceLike(String value) { - addCriterion("stack_trace like", value, "stackTrace"); - return (Criteria) this; - } - - public Criteria andStackTraceNotLike(String value) { - addCriterion("stack_trace not like", value, "stackTrace"); - return (Criteria) this; - } - - public Criteria andStackTraceIn(List values) { - addCriterion("stack_trace in", values, "stackTrace"); - return (Criteria) this; - } - - public Criteria andStackTraceNotIn(List values) { - addCriterion("stack_trace not in", values, "stackTrace"); - return (Criteria) this; - } - - public Criteria andStackTraceBetween(String value1, String value2) { - addCriterion("stack_trace between", value1, value2, "stackTrace"); - return (Criteria) this; - } - - public Criteria andStackTraceNotBetween(String value1, String value2) { - addCriterion("stack_trace not between", value1, value2, "stackTrace"); - return (Criteria) this; - } - - public Criteria andStatusIsNull() { - addCriterion("status is null"); - return (Criteria) this; - } - - public Criteria andStatusIsNotNull() { - addCriterion("status is not null"); - return (Criteria) this; - } - - public Criteria andStatusEqualTo(String value) { - addCriterion("status =", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotEqualTo(String value) { - addCriterion("status <>", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusGreaterThan(String value) { - addCriterion("status >", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusGreaterThanOrEqualTo(String value) { - addCriterion("status >=", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusLessThan(String value) { - addCriterion("status <", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusLessThanOrEqualTo(String value) { - addCriterion("status <=", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusLike(String value) { - addCriterion("status like", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotLike(String value) { - addCriterion("status not like", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusIn(List values) { - addCriterion("status in", values, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotIn(List values) { - addCriterion("status not in", values, "status"); - return (Criteria) this; - } - - public Criteria andStatusBetween(String value1, String value2) { - addCriterion("status between", value1, value2, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotBetween(String value1, String value2) { - addCriterion("status not between", value1, value2, "status"); - return (Criteria) this; - } - - public Criteria andRecordIdIsNull() { - addCriterion("record_id is null"); - return (Criteria) this; - } - - public Criteria andRecordIdIsNotNull() { - addCriterion("record_id is not null"); - return (Criteria) this; - } - - public Criteria andRecordIdEqualTo(String value) { - addCriterion("record_id =", value, "recordId"); - return (Criteria) this; - } - - public Criteria andRecordIdNotEqualTo(String value) { - addCriterion("record_id <>", value, "recordId"); - return (Criteria) this; - } - - public Criteria andRecordIdGreaterThan(String value) { - addCriterion("record_id >", value, "recordId"); - return (Criteria) this; - } - - public Criteria andRecordIdGreaterThanOrEqualTo(String value) { - addCriterion("record_id >=", value, "recordId"); - return (Criteria) this; - } - - public Criteria andRecordIdLessThan(String value) { - addCriterion("record_id <", value, "recordId"); - return (Criteria) this; - } - - public Criteria andRecordIdLessThanOrEqualTo(String value) { - addCriterion("record_id <=", value, "recordId"); - return (Criteria) this; - } - - public Criteria andRecordIdLike(String value) { - addCriterion("record_id like", value, "recordId"); - return (Criteria) this; - } - - public Criteria andRecordIdNotLike(String value) { - addCriterion("record_id not like", value, "recordId"); - return (Criteria) this; - } - - public Criteria andRecordIdIn(List values) { - addCriterion("record_id in", values, "recordId"); - return (Criteria) this; - } - - public Criteria andRecordIdNotIn(List values) { - addCriterion("record_id not in", values, "recordId"); - return (Criteria) this; - } - - public Criteria andRecordIdBetween(String value1, String value2) { - addCriterion("record_id between", value1, value2, "recordId"); - return (Criteria) this; - } - - public Criteria andRecordIdNotBetween(String value1, String value2) { - addCriterion("record_id not between", value1, value2, "recordId"); - return (Criteria) this; - } - - public Criteria andDateClosedIsNull() { - addCriterion("date_closed is null"); - return (Criteria) this; - } - - public Criteria andDateClosedIsNotNull() { - addCriterion("date_closed is not null"); - return (Criteria) this; - } - - public Criteria andDateClosedEqualTo(Date value) { - addCriterion("date_closed =", value, "dateClosed"); - return (Criteria) this; - } - - public Criteria andDateClosedNotEqualTo(Date value) { - addCriterion("date_closed <>", value, "dateClosed"); - return (Criteria) this; - } - - public Criteria andDateClosedGreaterThan(Date value) { - addCriterion("date_closed >", value, "dateClosed"); - return (Criteria) this; - } - - public Criteria andDateClosedGreaterThanOrEqualTo(Date value) { - addCriterion("date_closed >=", value, "dateClosed"); - return (Criteria) this; - } - - public Criteria andDateClosedLessThan(Date value) { - addCriterion("date_closed <", value, "dateClosed"); - return (Criteria) this; - } - - public Criteria andDateClosedLessThanOrEqualTo(Date value) { - addCriterion("date_closed <=", value, "dateClosed"); - return (Criteria) this; - } - - public Criteria andDateClosedIn(List values) { - addCriterion("date_closed in", values, "dateClosed"); - return (Criteria) this; - } - - public Criteria andDateClosedNotIn(List values) { - addCriterion("date_closed not in", values, "dateClosed"); - return (Criteria) this; - } - - public Criteria andDateClosedBetween(Date value1, Date value2) { - addCriterion("date_closed between", value1, value2, "dateClosed"); - return (Criteria) this; - } - - public Criteria andDateClosedNotBetween(Date value1, Date value2) { - addCriterion("date_closed not between", value1, value2, "dateClosed"); - return (Criteria) this; - } - - public Criteria andDocumentTypeIsNull() { - addCriterion("document_type is null"); - return (Criteria) this; - } - - public Criteria andDocumentTypeIsNotNull() { - addCriterion("document_type is not null"); - return (Criteria) this; - } - - public Criteria andDocumentTypeEqualTo(String value) { - addCriterion("document_type =", value, "documentType"); - return (Criteria) this; - } - - public Criteria andDocumentTypeNotEqualTo(String value) { - addCriterion("document_type <>", value, "documentType"); - return (Criteria) this; - } - - public Criteria andDocumentTypeGreaterThan(String value) { - addCriterion("document_type >", value, "documentType"); - return (Criteria) this; - } - - public Criteria andDocumentTypeGreaterThanOrEqualTo(String value) { - addCriterion("document_type >=", value, "documentType"); - return (Criteria) this; - } - - public Criteria andDocumentTypeLessThan(String value) { - addCriterion("document_type <", value, "documentType"); - return (Criteria) this; - } - - public Criteria andDocumentTypeLessThanOrEqualTo(String value) { - addCriterion("document_type <=", value, "documentType"); - return (Criteria) this; - } - - public Criteria andDocumentTypeLike(String value) { - addCriterion("document_type like", value, "documentType"); - return (Criteria) this; - } - - public Criteria andDocumentTypeNotLike(String value) { - addCriterion("document_type not like", value, "documentType"); - return (Criteria) this; - } - - public Criteria andDocumentTypeIn(List values) { - addCriterion("document_type in", values, "documentType"); - return (Criteria) this; - } - - public Criteria andDocumentTypeNotIn(List values) { - addCriterion("document_type not in", values, "documentType"); - return (Criteria) this; - } - - public Criteria andDocumentTypeBetween(String value1, String value2) { - addCriterion("document_type between", value1, value2, "documentType"); - return (Criteria) this; - } - - public Criteria andDocumentTypeNotBetween(String value1, String value2) { - addCriterion("document_type not between", value1, value2, "documentType"); - return (Criteria) this; - } - - public Criteria andRetryUrlIsNull() { - addCriterion("retry_url is null"); - return (Criteria) this; - } - - public Criteria andRetryUrlIsNotNull() { - addCriterion("retry_url is not null"); - return (Criteria) this; - } - - public Criteria andRetryUrlEqualTo(String value) { - addCriterion("retry_url =", value, "retryUrl"); - return (Criteria) this; - } - - public Criteria andRetryUrlNotEqualTo(String value) { - addCriterion("retry_url <>", value, "retryUrl"); - return (Criteria) this; - } - - public Criteria andRetryUrlGreaterThan(String value) { - addCriterion("retry_url >", value, "retryUrl"); - return (Criteria) this; - } - - public Criteria andRetryUrlGreaterThanOrEqualTo(String value) { - addCriterion("retry_url >=", value, "retryUrl"); - return (Criteria) this; - } - - public Criteria andRetryUrlLessThan(String value) { - addCriterion("retry_url <", value, "retryUrl"); - return (Criteria) this; - } - - public Criteria andRetryUrlLessThanOrEqualTo(String value) { - addCriterion("retry_url <=", value, "retryUrl"); - return (Criteria) this; - } - - public Criteria andRetryUrlLike(String value) { - addCriterion("retry_url like", value, "retryUrl"); - return (Criteria) this; - } - - public Criteria andRetryUrlNotLike(String value) { - addCriterion("retry_url not like", value, "retryUrl"); - return (Criteria) this; - } - - public Criteria andRetryUrlIn(List values) { - addCriterion("retry_url in", values, "retryUrl"); - return (Criteria) this; - } - - public Criteria andRetryUrlNotIn(List values) { - addCriterion("retry_url not in", values, "retryUrl"); - return (Criteria) this; - } - - public Criteria andRetryUrlBetween(String value1, String value2) { - addCriterion("retry_url between", value1, value2, "retryUrl"); - return (Criteria) this; - } - - public Criteria andRetryUrlNotBetween(String value1, String value2) { - addCriterion("retry_url not between", value1, value2, "retryUrl"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * error.error_trace - * - * @mbg.generated do_not_delete_during_merge Fri Mar 09 18:05:46 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Event.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Event.java deleted file mode 100644 index e84c75a033..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Event.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.Date; - -public class Event { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event.id - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event.json - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - private Object json; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event.date_deleted - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - private Date dateDeleted; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event.id - * - * @return the value of core.event.id - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event.id - * - * @param id the value for core.event.id - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event.json - * - * @return the value of core.event.json - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public Object getJson() { - return json; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event.json - * - * @param json the value for core.event.json - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public void setJson(Object json) { - this.json = json; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event.date_deleted - * - * @return the value of core.event.date_deleted - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public Date getDateDeleted() { - return dateDeleted; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event.date_deleted - * - * @param dateDeleted the value for core.event.date_deleted - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public void setDateDeleted(Date dateDeleted) { - this.dateDeleted = dateDeleted; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/EventExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/EventExample.java deleted file mode 100644 index b6106b2145..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/EventExample.java +++ /dev/null @@ -1,520 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class EventExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public EventExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List jsonCriteria; - - protected List allCriteria; - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - jsonCriteria = new ArrayList(); - } - - public List getJsonCriteria() { - return jsonCriteria; - } - - protected void addJsonCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value, "org.opensrp.repository.postgres.handler.EventTypeHandler")); - allCriteria = null; - } - - protected void addJsonCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - jsonCriteria.add( - new Criterion(condition, value1, value2, "org.opensrp.repository.postgres.handler.EventTypeHandler")); - allCriteria = null; - } - - public boolean isValid() { - return criteria.size() > 0 || jsonCriteria.size() > 0; - } - - public List getAllCriteria() { - if (allCriteria == null) { - allCriteria = new ArrayList(); - allCriteria.addAll(criteria); - allCriteria.addAll(jsonCriteria); - } - return allCriteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - allCriteria = null; - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andJsonIsNull() { - addCriterion("json is null"); - return (Criteria) this; - } - - public Criteria andJsonIsNotNull() { - addCriterion("json is not null"); - return (Criteria) this; - } - - public Criteria andJsonEqualTo(Object value) { - addJsonCriterion("json =", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotEqualTo(Object value) { - addJsonCriterion("json <>", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThan(Object value) { - addJsonCriterion("json >", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThanOrEqualTo(Object value) { - addJsonCriterion("json >=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThan(Object value) { - addJsonCriterion("json <", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThanOrEqualTo(Object value) { - addJsonCriterion("json <=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonIn(List values) { - addJsonCriterion("json in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotIn(List values) { - addJsonCriterion("json not in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonBetween(Object value1, Object value2) { - addJsonCriterion("json between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotBetween(Object value1, Object value2) { - addJsonCriterion("json not between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andDateDeletedIsNull() { - addCriterion("date_deleted is null"); - return (Criteria) this; - } - - public Criteria andDateDeletedIsNotNull() { - addCriterion("date_deleted is not null"); - return (Criteria) this; - } - - public Criteria andDateDeletedEqualTo(Date value) { - addCriterion("date_deleted =", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotEqualTo(Date value) { - addCriterion("date_deleted <>", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedGreaterThan(Date value) { - addCriterion("date_deleted >", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedGreaterThanOrEqualTo(Date value) { - addCriterion("date_deleted >=", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedLessThan(Date value) { - addCriterion("date_deleted <", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedLessThanOrEqualTo(Date value) { - addCriterion("date_deleted <=", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedIn(List values) { - addCriterion("date_deleted in", values, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotIn(List values) { - addCriterion("date_deleted not in", values, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedBetween(Date value1, Date value2) { - addCriterion("date_deleted between", value1, value2, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotBetween(Date value1, Date value2) { - addCriterion("date_deleted not between", value1, value2, "dateDeleted"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.event - * - * @mbg.generated do_not_delete_during_merge Wed Mar 07 18:26:22 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/EventMetadata.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/EventMetadata.java deleted file mode 100644 index 7fdd732101..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/EventMetadata.java +++ /dev/null @@ -1,516 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.Date; - -public class EventMetadata { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.id - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.event_id - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private Long eventId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.document_id - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private String documentId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.base_entity_id - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private String baseEntityId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.form_submission_id - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private String formSubmissionId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.server_version - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private Long serverVersion; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.openmrs_uuid - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private String openmrsUuid; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.event_type - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private String eventType; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.event_date - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private Date eventDate; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.entity_type - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private String entityType; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.provider_id - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private String providerId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.location_id - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private String locationId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.team - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private String team; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.team_id - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private String teamId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.date_created - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private Date dateCreated; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.date_edited - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private Date dateEdited; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.event_metadata.date_deleted - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - private Date dateDeleted; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.id - * - * @return the value of core.event_metadata.id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.id - * - * @param id the value for core.event_metadata.id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.event_id - * - * @return the value of core.event_metadata.event_id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public Long getEventId() { - return eventId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.event_id - * - * @param eventId the value for core.event_metadata.event_id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setEventId(Long eventId) { - this.eventId = eventId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.document_id - * - * @return the value of core.event_metadata.document_id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public String getDocumentId() { - return documentId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.document_id - * - * @param documentId the value for core.event_metadata.document_id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setDocumentId(String documentId) { - this.documentId = documentId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.base_entity_id - * - * @return the value of core.event_metadata.base_entity_id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public String getBaseEntityId() { - return baseEntityId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.base_entity_id - * - * @param baseEntityId the value for core.event_metadata.base_entity_id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.form_submission_id - * - * @return the value of core.event_metadata.form_submission_id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public String getFormSubmissionId() { - return formSubmissionId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.form_submission_id - * - * @param formSubmissionId the value for core.event_metadata.form_submission_id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setFormSubmissionId(String formSubmissionId) { - this.formSubmissionId = formSubmissionId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.server_version - * - * @return the value of core.event_metadata.server_version - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public Long getServerVersion() { - return serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.server_version - * - * @param serverVersion the value for core.event_metadata.server_version - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.openmrs_uuid - * - * @return the value of core.event_metadata.openmrs_uuid - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public String getOpenmrsUuid() { - return openmrsUuid; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.openmrs_uuid - * - * @param openmrsUuid the value for core.event_metadata.openmrs_uuid - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setOpenmrsUuid(String openmrsUuid) { - this.openmrsUuid = openmrsUuid; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.event_type - * - * @return the value of core.event_metadata.event_type - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public String getEventType() { - return eventType; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.event_type - * - * @param eventType the value for core.event_metadata.event_type - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.event_date - * - * @return the value of core.event_metadata.event_date - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public Date getEventDate() { - return eventDate; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.event_date - * - * @param eventDate the value for core.event_metadata.event_date - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setEventDate(Date eventDate) { - this.eventDate = eventDate; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.entity_type - * - * @return the value of core.event_metadata.entity_type - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public String getEntityType() { - return entityType; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.entity_type - * - * @param entityType the value for core.event_metadata.entity_type - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setEntityType(String entityType) { - this.entityType = entityType; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.provider_id - * - * @return the value of core.event_metadata.provider_id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public String getProviderId() { - return providerId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.provider_id - * - * @param providerId the value for core.event_metadata.provider_id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.location_id - * - * @return the value of core.event_metadata.location_id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public String getLocationId() { - return locationId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.location_id - * - * @param locationId the value for core.event_metadata.location_id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setLocationId(String locationId) { - this.locationId = locationId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.team - * - * @return the value of core.event_metadata.team - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public String getTeam() { - return team; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.team - * - * @param team the value for core.event_metadata.team - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setTeam(String team) { - this.team = team; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.team_id - * - * @return the value of core.event_metadata.team_id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public String getTeamId() { - return teamId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.team_id - * - * @param teamId the value for core.event_metadata.team_id - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setTeamId(String teamId) { - this.teamId = teamId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.date_created - * - * @return the value of core.event_metadata.date_created - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public Date getDateCreated() { - return dateCreated; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.date_created - * - * @param dateCreated the value for core.event_metadata.date_created - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setDateCreated(Date dateCreated) { - this.dateCreated = dateCreated; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.date_edited - * - * @return the value of core.event_metadata.date_edited - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public Date getDateEdited() { - return dateEdited; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.date_edited - * - * @param dateEdited the value for core.event_metadata.date_edited - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setDateEdited(Date dateEdited) { - this.dateEdited = dateEdited; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.event_metadata.date_deleted - * - * @return the value of core.event_metadata.date_deleted - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public Date getDateDeleted() { - return dateDeleted; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.event_metadata.date_deleted - * - * @param dateDeleted the value for core.event_metadata.date_deleted - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setDateDeleted(Date dateDeleted) { - this.dateDeleted = dateDeleted; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/EventMetadataExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/EventMetadataExample.java deleted file mode 100644 index 8f6a1fd075..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/EventMetadataExample.java +++ /dev/null @@ -1,1426 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class EventMetadataExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public EventMetadataExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andEventIdIsNull() { - addCriterion("event_id is null"); - return (Criteria) this; - } - - public Criteria andEventIdIsNotNull() { - addCriterion("event_id is not null"); - return (Criteria) this; - } - - public Criteria andEventIdEqualTo(Long value) { - addCriterion("event_id =", value, "eventId"); - return (Criteria) this; - } - - public Criteria andEventIdNotEqualTo(Long value) { - addCriterion("event_id <>", value, "eventId"); - return (Criteria) this; - } - - public Criteria andEventIdGreaterThan(Long value) { - addCriterion("event_id >", value, "eventId"); - return (Criteria) this; - } - - public Criteria andEventIdGreaterThanOrEqualTo(Long value) { - addCriterion("event_id >=", value, "eventId"); - return (Criteria) this; - } - - public Criteria andEventIdLessThan(Long value) { - addCriterion("event_id <", value, "eventId"); - return (Criteria) this; - } - - public Criteria andEventIdLessThanOrEqualTo(Long value) { - addCriterion("event_id <=", value, "eventId"); - return (Criteria) this; - } - - public Criteria andEventIdIn(List values) { - addCriterion("event_id in", values, "eventId"); - return (Criteria) this; - } - - public Criteria andEventIdNotIn(List values) { - addCriterion("event_id not in", values, "eventId"); - return (Criteria) this; - } - - public Criteria andEventIdBetween(Long value1, Long value2) { - addCriterion("event_id between", value1, value2, "eventId"); - return (Criteria) this; - } - - public Criteria andEventIdNotBetween(Long value1, Long value2) { - addCriterion("event_id not between", value1, value2, "eventId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNull() { - addCriterion("document_id is null"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNotNull() { - addCriterion("document_id is not null"); - return (Criteria) this; - } - - public Criteria andDocumentIdEqualTo(String value) { - addCriterion("document_id =", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotEqualTo(String value) { - addCriterion("document_id <>", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThan(String value) { - addCriterion("document_id >", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThanOrEqualTo(String value) { - addCriterion("document_id >=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThan(String value) { - addCriterion("document_id <", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThanOrEqualTo(String value) { - addCriterion("document_id <=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLike(String value) { - addCriterion("document_id like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotLike(String value) { - addCriterion("document_id not like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIn(List values) { - addCriterion("document_id in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotIn(List values) { - addCriterion("document_id not in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdBetween(String value1, String value2) { - addCriterion("document_id between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotBetween(String value1, String value2) { - addCriterion("document_id not between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdIsNull() { - addCriterion("base_entity_id is null"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdIsNotNull() { - addCriterion("base_entity_id is not null"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdEqualTo(String value) { - addCriterion("base_entity_id =", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotEqualTo(String value) { - addCriterion("base_entity_id <>", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdGreaterThan(String value) { - addCriterion("base_entity_id >", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdGreaterThanOrEqualTo(String value) { - addCriterion("base_entity_id >=", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdLessThan(String value) { - addCriterion("base_entity_id <", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdLessThanOrEqualTo(String value) { - addCriterion("base_entity_id <=", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdLike(String value) { - addCriterion("base_entity_id like", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotLike(String value) { - addCriterion("base_entity_id not like", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdIn(List values) { - addCriterion("base_entity_id in", values, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotIn(List values) { - addCriterion("base_entity_id not in", values, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdBetween(String value1, String value2) { - addCriterion("base_entity_id between", value1, value2, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotBetween(String value1, String value2) { - addCriterion("base_entity_id not between", value1, value2, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdIsNull() { - addCriterion("form_submission_id is null"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdIsNotNull() { - addCriterion("form_submission_id is not null"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdEqualTo(String value) { - addCriterion("form_submission_id =", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdNotEqualTo(String value) { - addCriterion("form_submission_id <>", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdGreaterThan(String value) { - addCriterion("form_submission_id >", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdGreaterThanOrEqualTo(String value) { - addCriterion("form_submission_id >=", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdLessThan(String value) { - addCriterion("form_submission_id <", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdLessThanOrEqualTo(String value) { - addCriterion("form_submission_id <=", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdLike(String value) { - addCriterion("form_submission_id like", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdNotLike(String value) { - addCriterion("form_submission_id not like", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdIn(List values) { - addCriterion("form_submission_id in", values, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdNotIn(List values) { - addCriterion("form_submission_id not in", values, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdBetween(String value1, String value2) { - addCriterion("form_submission_id between", value1, value2, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdNotBetween(String value1, String value2) { - addCriterion("form_submission_id not between", value1, value2, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNull() { - addCriterion("server_version is null"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNotNull() { - addCriterion("server_version is not null"); - return (Criteria) this; - } - - public Criteria andServerVersionEqualTo(Long value) { - addCriterion("server_version =", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotEqualTo(Long value) { - addCriterion("server_version <>", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThan(Long value) { - addCriterion("server_version >", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThanOrEqualTo(Long value) { - addCriterion("server_version >=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThan(Long value) { - addCriterion("server_version <", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThanOrEqualTo(Long value) { - addCriterion("server_version <=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionIn(List values) { - addCriterion("server_version in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotIn(List values) { - addCriterion("server_version not in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionBetween(Long value1, Long value2) { - addCriterion("server_version between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotBetween(Long value1, Long value2) { - addCriterion("server_version not between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidIsNull() { - addCriterion("openmrs_uuid is null"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidIsNotNull() { - addCriterion("openmrs_uuid is not null"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidEqualTo(String value) { - addCriterion("openmrs_uuid =", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidNotEqualTo(String value) { - addCriterion("openmrs_uuid <>", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidGreaterThan(String value) { - addCriterion("openmrs_uuid >", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidGreaterThanOrEqualTo(String value) { - addCriterion("openmrs_uuid >=", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidLessThan(String value) { - addCriterion("openmrs_uuid <", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidLessThanOrEqualTo(String value) { - addCriterion("openmrs_uuid <=", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidLike(String value) { - addCriterion("openmrs_uuid like", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidNotLike(String value) { - addCriterion("openmrs_uuid not like", value, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidIn(List values) { - addCriterion("openmrs_uuid in", values, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidNotIn(List values) { - addCriterion("openmrs_uuid not in", values, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidBetween(String value1, String value2) { - addCriterion("openmrs_uuid between", value1, value2, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andOpenmrsUuidNotBetween(String value1, String value2) { - addCriterion("openmrs_uuid not between", value1, value2, "openmrsUuid"); - return (Criteria) this; - } - - public Criteria andEventTypeIsNull() { - addCriterion("event_type is null"); - return (Criteria) this; - } - - public Criteria andEventTypeIsNotNull() { - addCriterion("event_type is not null"); - return (Criteria) this; - } - - public Criteria andEventTypeEqualTo(String value) { - addCriterion("event_type =", value, "eventType"); - return (Criteria) this; - } - - public Criteria andEventTypeNotEqualTo(String value) { - addCriterion("event_type <>", value, "eventType"); - return (Criteria) this; - } - - public Criteria andEventTypeGreaterThan(String value) { - addCriterion("event_type >", value, "eventType"); - return (Criteria) this; - } - - public Criteria andEventTypeGreaterThanOrEqualTo(String value) { - addCriterion("event_type >=", value, "eventType"); - return (Criteria) this; - } - - public Criteria andEventTypeLessThan(String value) { - addCriterion("event_type <", value, "eventType"); - return (Criteria) this; - } - - public Criteria andEventTypeLessThanOrEqualTo(String value) { - addCriterion("event_type <=", value, "eventType"); - return (Criteria) this; - } - - public Criteria andEventTypeLike(String value) { - addCriterion("event_type like", value, "eventType"); - return (Criteria) this; - } - - public Criteria andEventTypeNotLike(String value) { - addCriterion("event_type not like", value, "eventType"); - return (Criteria) this; - } - - public Criteria andEventTypeIn(List values) { - addCriterion("event_type in", values, "eventType"); - return (Criteria) this; - } - - public Criteria andEventTypeNotIn(List values) { - addCriterion("event_type not in", values, "eventType"); - return (Criteria) this; - } - - public Criteria andEventTypeBetween(String value1, String value2) { - addCriterion("event_type between", value1, value2, "eventType"); - return (Criteria) this; - } - - public Criteria andEventTypeNotBetween(String value1, String value2) { - addCriterion("event_type not between", value1, value2, "eventType"); - return (Criteria) this; - } - - public Criteria andEventDateIsNull() { - addCriterion("event_date is null"); - return (Criteria) this; - } - - public Criteria andEventDateIsNotNull() { - addCriterion("event_date is not null"); - return (Criteria) this; - } - - public Criteria andEventDateEqualTo(Date value) { - addCriterion("event_date =", value, "eventDate"); - return (Criteria) this; - } - - public Criteria andEventDateNotEqualTo(Date value) { - addCriterion("event_date <>", value, "eventDate"); - return (Criteria) this; - } - - public Criteria andEventDateGreaterThan(Date value) { - addCriterion("event_date >", value, "eventDate"); - return (Criteria) this; - } - - public Criteria andEventDateGreaterThanOrEqualTo(Date value) { - addCriterion("event_date >=", value, "eventDate"); - return (Criteria) this; - } - - public Criteria andEventDateLessThan(Date value) { - addCriterion("event_date <", value, "eventDate"); - return (Criteria) this; - } - - public Criteria andEventDateLessThanOrEqualTo(Date value) { - addCriterion("event_date <=", value, "eventDate"); - return (Criteria) this; - } - - public Criteria andEventDateIn(List values) { - addCriterion("event_date in", values, "eventDate"); - return (Criteria) this; - } - - public Criteria andEventDateNotIn(List values) { - addCriterion("event_date not in", values, "eventDate"); - return (Criteria) this; - } - - public Criteria andEventDateBetween(Date value1, Date value2) { - addCriterion("event_date between", value1, value2, "eventDate"); - return (Criteria) this; - } - - public Criteria andEventDateNotBetween(Date value1, Date value2) { - addCriterion("event_date not between", value1, value2, "eventDate"); - return (Criteria) this; - } - - public Criteria andEntityTypeIsNull() { - addCriterion("entity_type is null"); - return (Criteria) this; - } - - public Criteria andEntityTypeIsNotNull() { - addCriterion("entity_type is not null"); - return (Criteria) this; - } - - public Criteria andEntityTypeEqualTo(String value) { - addCriterion("entity_type =", value, "entityType"); - return (Criteria) this; - } - - public Criteria andEntityTypeNotEqualTo(String value) { - addCriterion("entity_type <>", value, "entityType"); - return (Criteria) this; - } - - public Criteria andEntityTypeGreaterThan(String value) { - addCriterion("entity_type >", value, "entityType"); - return (Criteria) this; - } - - public Criteria andEntityTypeGreaterThanOrEqualTo(String value) { - addCriterion("entity_type >=", value, "entityType"); - return (Criteria) this; - } - - public Criteria andEntityTypeLessThan(String value) { - addCriterion("entity_type <", value, "entityType"); - return (Criteria) this; - } - - public Criteria andEntityTypeLessThanOrEqualTo(String value) { - addCriterion("entity_type <=", value, "entityType"); - return (Criteria) this; - } - - public Criteria andEntityTypeLike(String value) { - addCriterion("entity_type like", value, "entityType"); - return (Criteria) this; - } - - public Criteria andEntityTypeNotLike(String value) { - addCriterion("entity_type not like", value, "entityType"); - return (Criteria) this; - } - - public Criteria andEntityTypeIn(List values) { - addCriterion("entity_type in", values, "entityType"); - return (Criteria) this; - } - - public Criteria andEntityTypeNotIn(List values) { - addCriterion("entity_type not in", values, "entityType"); - return (Criteria) this; - } - - public Criteria andEntityTypeBetween(String value1, String value2) { - addCriterion("entity_type between", value1, value2, "entityType"); - return (Criteria) this; - } - - public Criteria andEntityTypeNotBetween(String value1, String value2) { - addCriterion("entity_type not between", value1, value2, "entityType"); - return (Criteria) this; - } - - public Criteria andProviderIdIsNull() { - addCriterion("provider_id is null"); - return (Criteria) this; - } - - public Criteria andProviderIdIsNotNull() { - addCriterion("provider_id is not null"); - return (Criteria) this; - } - - public Criteria andProviderIdEqualTo(String value) { - addCriterion("provider_id =", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotEqualTo(String value) { - addCriterion("provider_id <>", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdGreaterThan(String value) { - addCriterion("provider_id >", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdGreaterThanOrEqualTo(String value) { - addCriterion("provider_id >=", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLessThan(String value) { - addCriterion("provider_id <", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLessThanOrEqualTo(String value) { - addCriterion("provider_id <=", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLike(String value) { - addCriterion("provider_id like", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotLike(String value) { - addCriterion("provider_id not like", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdIn(List values) { - addCriterion("provider_id in", values, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotIn(List values) { - addCriterion("provider_id not in", values, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdBetween(String value1, String value2) { - addCriterion("provider_id between", value1, value2, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotBetween(String value1, String value2) { - addCriterion("provider_id not between", value1, value2, "providerId"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNull() { - addCriterion("location_id is null"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNotNull() { - addCriterion("location_id is not null"); - return (Criteria) this; - } - - public Criteria andLocationIdEqualTo(String value) { - addCriterion("location_id =", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotEqualTo(String value) { - addCriterion("location_id <>", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThan(String value) { - addCriterion("location_id >", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThanOrEqualTo(String value) { - addCriterion("location_id >=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThan(String value) { - addCriterion("location_id <", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThanOrEqualTo(String value) { - addCriterion("location_id <=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLike(String value) { - addCriterion("location_id like", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotLike(String value) { - addCriterion("location_id not like", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdIn(List values) { - addCriterion("location_id in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotIn(List values) { - addCriterion("location_id not in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdBetween(String value1, String value2) { - addCriterion("location_id between", value1, value2, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotBetween(String value1, String value2) { - addCriterion("location_id not between", value1, value2, "locationId"); - return (Criteria) this; - } - - public Criteria andTeamIsNull() { - addCriterion("team is null"); - return (Criteria) this; - } - - public Criteria andTeamIsNotNull() { - addCriterion("team is not null"); - return (Criteria) this; - } - - public Criteria andTeamEqualTo(String value) { - addCriterion("team =", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotEqualTo(String value) { - addCriterion("team <>", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamGreaterThan(String value) { - addCriterion("team >", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamGreaterThanOrEqualTo(String value) { - addCriterion("team >=", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLessThan(String value) { - addCriterion("team <", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLessThanOrEqualTo(String value) { - addCriterion("team <=", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLike(String value) { - addCriterion("team like", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotLike(String value) { - addCriterion("team not like", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamIn(List values) { - addCriterion("team in", values, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotIn(List values) { - addCriterion("team not in", values, "team"); - return (Criteria) this; - } - - public Criteria andTeamBetween(String value1, String value2) { - addCriterion("team between", value1, value2, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotBetween(String value1, String value2) { - addCriterion("team not between", value1, value2, "team"); - return (Criteria) this; - } - - public Criteria andTeamIdIsNull() { - addCriterion("team_id is null"); - return (Criteria) this; - } - - public Criteria andTeamIdIsNotNull() { - addCriterion("team_id is not null"); - return (Criteria) this; - } - - public Criteria andTeamIdEqualTo(String value) { - addCriterion("team_id =", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotEqualTo(String value) { - addCriterion("team_id <>", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdGreaterThan(String value) { - addCriterion("team_id >", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdGreaterThanOrEqualTo(String value) { - addCriterion("team_id >=", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLessThan(String value) { - addCriterion("team_id <", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLessThanOrEqualTo(String value) { - addCriterion("team_id <=", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLike(String value) { - addCriterion("team_id like", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotLike(String value) { - addCriterion("team_id not like", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdIn(List values) { - addCriterion("team_id in", values, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotIn(List values) { - addCriterion("team_id not in", values, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdBetween(String value1, String value2) { - addCriterion("team_id between", value1, value2, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotBetween(String value1, String value2) { - addCriterion("team_id not between", value1, value2, "teamId"); - return (Criteria) this; - } - - public Criteria andDateCreatedIsNull() { - addCriterion("date_created is null"); - return (Criteria) this; - } - - public Criteria andDateCreatedIsNotNull() { - addCriterion("date_created is not null"); - return (Criteria) this; - } - - public Criteria andDateCreatedEqualTo(Date value) { - addCriterion("date_created =", value, "dateCreated"); - return (Criteria) this; - } - - public Criteria andDateCreatedNotEqualTo(Date value) { - addCriterion("date_created <>", value, "dateCreated"); - return (Criteria) this; - } - - public Criteria andDateCreatedGreaterThan(Date value) { - addCriterion("date_created >", value, "dateCreated"); - return (Criteria) this; - } - - public Criteria andDateCreatedGreaterThanOrEqualTo(Date value) { - addCriterion("date_created >=", value, "dateCreated"); - return (Criteria) this; - } - - public Criteria andDateCreatedLessThan(Date value) { - addCriterion("date_created <", value, "dateCreated"); - return (Criteria) this; - } - - public Criteria andDateCreatedLessThanOrEqualTo(Date value) { - addCriterion("date_created <=", value, "dateCreated"); - return (Criteria) this; - } - - public Criteria andDateCreatedIn(List values) { - addCriterion("date_created in", values, "dateCreated"); - return (Criteria) this; - } - - public Criteria andDateCreatedNotIn(List values) { - addCriterion("date_created not in", values, "dateCreated"); - return (Criteria) this; - } - - public Criteria andDateCreatedBetween(Date value1, Date value2) { - addCriterion("date_created between", value1, value2, "dateCreated"); - return (Criteria) this; - } - - public Criteria andDateCreatedNotBetween(Date value1, Date value2) { - addCriterion("date_created not between", value1, value2, "dateCreated"); - return (Criteria) this; - } - - public Criteria andDateEditedIsNull() { - addCriterion("date_edited is null"); - return (Criteria) this; - } - - public Criteria andDateEditedIsNotNull() { - addCriterion("date_edited is not null"); - return (Criteria) this; - } - - public Criteria andDateEditedEqualTo(Date value) { - addCriterion("date_edited =", value, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedNotEqualTo(Date value) { - addCriterion("date_edited <>", value, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedGreaterThan(Date value) { - addCriterion("date_edited >", value, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedGreaterThanOrEqualTo(Date value) { - addCriterion("date_edited >=", value, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedLessThan(Date value) { - addCriterion("date_edited <", value, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedLessThanOrEqualTo(Date value) { - addCriterion("date_edited <=", value, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedIn(List values) { - addCriterion("date_edited in", values, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedNotIn(List values) { - addCriterion("date_edited not in", values, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedBetween(Date value1, Date value2) { - addCriterion("date_edited between", value1, value2, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedNotBetween(Date value1, Date value2) { - addCriterion("date_edited not between", value1, value2, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateDeletedIsNull() { - addCriterion("date_deleted is null"); - return (Criteria) this; - } - - public Criteria andDateDeletedIsNotNull() { - addCriterion("date_deleted is not null"); - return (Criteria) this; - } - - public Criteria andDateDeletedEqualTo(Date value) { - addCriterion("date_deleted =", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotEqualTo(Date value) { - addCriterion("date_deleted <>", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedGreaterThan(Date value) { - addCriterion("date_deleted >", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedGreaterThanOrEqualTo(Date value) { - addCriterion("date_deleted >=", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedLessThan(Date value) { - addCriterion("date_deleted <", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedLessThanOrEqualTo(Date value) { - addCriterion("date_deleted <=", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedIn(List values) { - addCriterion("date_deleted in", values, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotIn(List values) { - addCriterion("date_deleted not in", values, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedBetween(Date value1, Date value2) { - addCriterion("date_deleted between", value1, value2, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotBetween(Date value1, Date value2) { - addCriterion("date_deleted not between", value1, value2, "dateDeleted"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.event_metadata - * - * @mbg.generated do_not_delete_during_merge Wed Mar 07 18:26:22 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/HouseholdClient.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/HouseholdClient.java deleted file mode 100644 index 91642fea24..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/HouseholdClient.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.opensrp.domain.postgres; - -public class HouseholdClient { - - private int memebrCount; - - private String providerId; - - private String householdHead; - - private String relationalId; - - private int totalCount; - - public int getTotalCount() { - return totalCount; - } - - public void setTotalCount(int totalCount) { - this.totalCount = totalCount; - } - - public int getMemebrCount() { - return memebrCount; - } - - public void setMemebrCount(int memebrCount) { - this.memebrCount = memebrCount; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public String getHouseholdHead() { - return householdHead; - } - - public void setHouseholdHead(String householdHead) { - this.householdHead = householdHead; - } - - public String getRelationalId() { - return relationalId; - } - - public void setRelationalId(String relationalId) { - this.relationalId = relationalId; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Jurisdiction.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Jurisdiction.java deleted file mode 100644 index 8fab0029c6..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Jurisdiction.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.opensrp.domain.postgres; - -/** - * @author Vincent Karuri - */ -public class Jurisdiction { - - private String code; - - public Jurisdiction() {} - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Location.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Location.java deleted file mode 100644 index 1df017bdf2..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Location.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.opensrp.domain.postgres; - -public class Location { - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column core.location.id - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - private Long id; - - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column core.location.json - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - private Object json; - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column core.location.id - * - * @return the value of core.location.id - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column core.location.id - * - * @param id the value for core.location.id - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column core.location.json - * - * @return the value of core.location.json - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public Object getJson() { - return json; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column core.location.json - * - * @param json the value for core.location.json - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public void setJson(Object json) { - this.json = json; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/LocationExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/LocationExample.java deleted file mode 100644 index c2fff5f3a4..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/LocationExample.java +++ /dev/null @@ -1,456 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class LocationExample { - /** - * This field was generated by MyBatis Generator. - * This field corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. - * This field corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. - * This field corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public LocationExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - protected List jsonCriteria; - - protected List allCriteria; - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - jsonCriteria = new ArrayList(); - } - - public List getJsonCriteria() { - return jsonCriteria; - } - - protected void addJsonCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value, "org.opensrp.repository.postgres.handler.LocationTypeHandler")); - allCriteria = null; - } - - protected void addJsonCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value1, value2, "org.opensrp.repository.postgres.handler.LocationTypeHandler")); - allCriteria = null; - } - - public boolean isValid() { - return criteria.size() > 0 - || jsonCriteria.size() > 0; - } - - public List getAllCriteria() { - if (allCriteria == null) { - allCriteria = new ArrayList(); - allCriteria.addAll(criteria); - allCriteria.addAll(jsonCriteria); - } - return allCriteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new IllegalArgumentException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - allCriteria = null; - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andJsonIsNull() { - addCriterion("json is null"); - return (Criteria) this; - } - - public Criteria andJsonIsNotNull() { - addCriterion("json is not null"); - return (Criteria) this; - } - - public Criteria andJsonEqualTo(Object value) { - addJsonCriterion("json =", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotEqualTo(Object value) { - addJsonCriterion("json <>", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThan(Object value) { - addJsonCriterion("json >", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThanOrEqualTo(Object value) { - addJsonCriterion("json >=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThan(Object value) { - addJsonCriterion("json <", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThanOrEqualTo(Object value) { - addJsonCriterion("json <=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonIn(List values) { - addJsonCriterion("json in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotIn(List values) { - addJsonCriterion("json not in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonBetween(Object value1, Object value2) { - addJsonCriterion("json between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotBetween(Object value1, Object value2) { - addJsonCriterion("json not between", value1, value2, "json"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.location - * - * @mbg.generated do_not_delete_during_merge Thu Nov 15 15:55:07 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public static class Criterion { - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/LocationMetadata.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/LocationMetadata.java deleted file mode 100644 index 9514779bd8..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/LocationMetadata.java +++ /dev/null @@ -1,212 +0,0 @@ -package org.opensrp.domain.postgres; - -public class LocationMetadata { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.location_metadata.id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private Long id; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.location_metadata.location_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private Long locationId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.location_metadata.geojson_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private String geojsonId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.location_metadata.type - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private String type; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.location_metadata.parent_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private String parentId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.location_metadata.uuid - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private String uuid; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.location_metadata.status - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private String status; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.location_metadata.server_version - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private Long serverVersion; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.location_metadata.name - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private String name; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.location_metadata.id - * @return the value of core.location_metadata.id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.location_metadata.id - * @param id the value for core.location_metadata.id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.location_metadata.location_id - * @return the value of core.location_metadata.location_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public Long getLocationId() { - return locationId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.location_metadata.location_id - * @param locationId the value for core.location_metadata.location_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setLocationId(Long locationId) { - this.locationId = locationId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.location_metadata.geojson_id - * @return the value of core.location_metadata.geojson_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public String getGeojsonId() { - return geojsonId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.location_metadata.geojson_id - * @param geojsonId the value for core.location_metadata.geojson_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setGeojsonId(String geojsonId) { - this.geojsonId = geojsonId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.location_metadata.type - * @return the value of core.location_metadata.type - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public String getType() { - return type; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.location_metadata.type - * @param type the value for core.location_metadata.type - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setType(String type) { - this.type = type; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.location_metadata.parent_id - * @return the value of core.location_metadata.parent_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public String getParentId() { - return parentId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.location_metadata.parent_id - * @param parentId the value for core.location_metadata.parent_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setParentId(String parentId) { - this.parentId = parentId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.location_metadata.uuid - * @return the value of core.location_metadata.uuid - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public String getUuid() { - return uuid; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.location_metadata.uuid - * @param uuid the value for core.location_metadata.uuid - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setUuid(String uuid) { - this.uuid = uuid; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.location_metadata.status - * @return the value of core.location_metadata.status - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public String getStatus() { - return status; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.location_metadata.status - * @param status the value for core.location_metadata.status - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setStatus(String status) { - this.status = status; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.location_metadata.server_version - * @return the value of core.location_metadata.server_version - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public Long getServerVersion() { - return serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.location_metadata.server_version - * @param serverVersion the value for core.location_metadata.server_version - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.location_metadata.name - * @return the value of core.location_metadata.name - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public String getName() { - return name; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.location_metadata.name - * @param name the value for core.location_metadata.name - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setName(String name) { - this.name = name; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/LocationMetadataExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/LocationMetadataExample.java deleted file mode 100644 index 88846af2b0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/LocationMetadataExample.java +++ /dev/null @@ -1,861 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class LocationMetadataExample { - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - protected String orderByClause; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - protected boolean distinct; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public LocationMetadataExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new IllegalArgumentException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNull() { - addCriterion("location_id is null"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNotNull() { - addCriterion("location_id is not null"); - return (Criteria) this; - } - - public Criteria andLocationIdEqualTo(Long value) { - addCriterion("location_id =", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotEqualTo(Long value) { - addCriterion("location_id <>", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThan(Long value) { - addCriterion("location_id >", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThanOrEqualTo(Long value) { - addCriterion("location_id >=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThan(Long value) { - addCriterion("location_id <", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThanOrEqualTo(Long value) { - addCriterion("location_id <=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdIn(List values) { - addCriterion("location_id in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotIn(List values) { - addCriterion("location_id not in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdBetween(Long value1, Long value2) { - addCriterion("location_id between", value1, value2, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotBetween(Long value1, Long value2) { - addCriterion("location_id not between", value1, value2, "locationId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdIsNull() { - addCriterion("geojson_id is null"); - return (Criteria) this; - } - - public Criteria andGeojsonIdIsNotNull() { - addCriterion("geojson_id is not null"); - return (Criteria) this; - } - - public Criteria andGeojsonIdEqualTo(String value) { - addCriterion("geojson_id =", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdNotEqualTo(String value) { - addCriterion("geojson_id <>", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdGreaterThan(String value) { - addCriterion("geojson_id >", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdGreaterThanOrEqualTo(String value) { - addCriterion("geojson_id >=", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdLessThan(String value) { - addCriterion("geojson_id <", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdLessThanOrEqualTo(String value) { - addCriterion("geojson_id <=", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdLike(String value) { - addCriterion("geojson_id like", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdNotLike(String value) { - addCriterion("geojson_id not like", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdIn(List values) { - addCriterion("geojson_id in", values, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdNotIn(List values) { - addCriterion("geojson_id not in", values, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdBetween(String value1, String value2) { - addCriterion("geojson_id between", value1, value2, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdNotBetween(String value1, String value2) { - addCriterion("geojson_id not between", value1, value2, "geojsonId"); - return (Criteria) this; - } - - public Criteria andTypeIsNull() { - addCriterion("type is null"); - return (Criteria) this; - } - - public Criteria andTypeIsNotNull() { - addCriterion("type is not null"); - return (Criteria) this; - } - - public Criteria andTypeEqualTo(String value) { - addCriterion("type =", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotEqualTo(String value) { - addCriterion("type <>", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeGreaterThan(String value) { - addCriterion("type >", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeGreaterThanOrEqualTo(String value) { - addCriterion("type >=", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeLessThan(String value) { - addCriterion("type <", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeLessThanOrEqualTo(String value) { - addCriterion("type <=", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeLike(String value) { - addCriterion("type like", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotLike(String value) { - addCriterion("type not like", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeIn(List values) { - addCriterion("type in", values, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotIn(List values) { - addCriterion("type not in", values, "type"); - return (Criteria) this; - } - - public Criteria andTypeBetween(String value1, String value2) { - addCriterion("type between", value1, value2, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotBetween(String value1, String value2) { - addCriterion("type not between", value1, value2, "type"); - return (Criteria) this; - } - - public Criteria andParentIdIsNull() { - addCriterion("parent_id is null"); - return (Criteria) this; - } - - public Criteria andParentIdIsNotNull() { - addCriterion("parent_id is not null"); - return (Criteria) this; - } - - public Criteria andParentIdEqualTo(String value) { - addCriterion("parent_id =", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdNotEqualTo(String value) { - addCriterion("parent_id <>", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdGreaterThan(String value) { - addCriterion("parent_id >", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdGreaterThanOrEqualTo(String value) { - addCriterion("parent_id >=", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdLessThan(String value) { - addCriterion("parent_id <", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdLessThanOrEqualTo(String value) { - addCriterion("parent_id <=", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdLike(String value) { - addCriterion("parent_id like", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdNotLike(String value) { - addCriterion("parent_id not like", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdIn(List values) { - addCriterion("parent_id in", values, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdNotIn(List values) { - addCriterion("parent_id not in", values, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdBetween(String value1, String value2) { - addCriterion("parent_id between", value1, value2, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdNotBetween(String value1, String value2) { - addCriterion("parent_id not between", value1, value2, "parentId"); - return (Criteria) this; - } - - public Criteria andUuidIsNull() { - addCriterion("uuid is null"); - return (Criteria) this; - } - - public Criteria andUuidIsNotNull() { - addCriterion("uuid is not null"); - return (Criteria) this; - } - - public Criteria andUuidEqualTo(String value) { - addCriterion("uuid =", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidNotEqualTo(String value) { - addCriterion("uuid <>", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidGreaterThan(String value) { - addCriterion("uuid >", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidGreaterThanOrEqualTo(String value) { - addCriterion("uuid >=", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidLessThan(String value) { - addCriterion("uuid <", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidLessThanOrEqualTo(String value) { - addCriterion("uuid <=", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidLike(String value) { - addCriterion("uuid like", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidNotLike(String value) { - addCriterion("uuid not like", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidIn(List values) { - addCriterion("uuid in", values, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidNotIn(List values) { - addCriterion("uuid not in", values, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidBetween(String value1, String value2) { - addCriterion("uuid between", value1, value2, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidNotBetween(String value1, String value2) { - addCriterion("uuid not between", value1, value2, "uuid"); - return (Criteria) this; - } - - public Criteria andStatusIsNull() { - addCriterion("status is null"); - return (Criteria) this; - } - - public Criteria andStatusIsNotNull() { - addCriterion("status is not null"); - return (Criteria) this; - } - - public Criteria andStatusEqualTo(String value) { - addCriterion("status =", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotEqualTo(String value) { - addCriterion("status <>", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusGreaterThan(String value) { - addCriterion("status >", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusGreaterThanOrEqualTo(String value) { - addCriterion("status >=", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusLessThan(String value) { - addCriterion("status <", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusLessThanOrEqualTo(String value) { - addCriterion("status <=", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusLike(String value) { - addCriterion("status like", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotLike(String value) { - addCriterion("status not like", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusIn(List values) { - addCriterion("status in", values, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotIn(List values) { - addCriterion("status not in", values, "status"); - return (Criteria) this; - } - - public Criteria andStatusBetween(String value1, String value2) { - addCriterion("status between", value1, value2, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotBetween(String value1, String value2) { - addCriterion("status not between", value1, value2, "status"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNull() { - addCriterion("server_version is null"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNotNull() { - addCriterion("server_version is not null"); - return (Criteria) this; - } - - public Criteria andServerVersionEqualTo(Long value) { - addCriterion("server_version =", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotEqualTo(Long value) { - addCriterion("server_version <>", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThan(Long value) { - addCriterion("server_version >", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThanOrEqualTo(Long value) { - addCriterion("server_version >=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThan(Long value) { - addCriterion("server_version <", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThanOrEqualTo(Long value) { - addCriterion("server_version <=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionIn(List values) { - addCriterion("server_version in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotIn(List values) { - addCriterion("server_version not in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionBetween(Long value1, Long value2) { - addCriterion("server_version between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotBetween(Long value1, Long value2) { - addCriterion("server_version not between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andNameIsNull() { - addCriterion("name is null"); - return (Criteria) this; - } - - public Criteria andNameIsNotNull() { - addCriterion("name is not null"); - return (Criteria) this; - } - - public Criteria andNameEqualTo(String value) { - addCriterion("name =", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotEqualTo(String value) { - addCriterion("name <>", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThan(String value) { - addCriterion("name >", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThanOrEqualTo(String value) { - addCriterion("name >=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThan(String value) { - addCriterion("name <", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThanOrEqualTo(String value) { - addCriterion("name <=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLike(String value) { - addCriterion("name like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotLike(String value) { - addCriterion("name not like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameIn(List values) { - addCriterion("name in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameNotIn(List values) { - addCriterion("name not in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameBetween(String value1, String value2) { - addCriterion("name between", value1, value2, "name"); - return (Criteria) this; - } - - public Criteria andNameNotBetween(String value1, String value2) { - addCriterion("name not between", value1, value2, "name"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public static class Criterion { - private String condition; - private Object value; - private Object secondValue; - private boolean noValue; - private boolean singleValue; - private boolean betweenValue; - private boolean listValue; - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.location_metadata - * - * @mbg.generated do_not_delete_during_merge Thu Nov 15 15:55:07 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/MultiMedia.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/MultiMedia.java deleted file mode 100644 index 21fc950e90..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/MultiMedia.java +++ /dev/null @@ -1,214 +0,0 @@ -package org.opensrp.domain.postgres; - -public class MultiMedia { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.multi_media.id - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.multi_media.document_id - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - private String documentId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.multi_media.case_id - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - private String caseId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.multi_media.provider_id - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - private String providerId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.multi_media.content_type - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - private String contentType; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.multi_media.file_path - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - private String filePath; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.multi_media.file_category - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - private String fileCategory; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.multi_media.id - * - * @return the value of core.multi_media.id - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.multi_media.id - * - * @param id the value for core.multi_media.id - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.multi_media.document_id - * - * @return the value of core.multi_media.document_id - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public String getDocumentId() { - return documentId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.multi_media.document_id - * - * @param documentId the value for core.multi_media.document_id - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public void setDocumentId(String documentId) { - this.documentId = documentId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.multi_media.case_id - * - * @return the value of core.multi_media.case_id - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public String getCaseId() { - return caseId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.multi_media.case_id - * - * @param caseId the value for core.multi_media.case_id - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public void setCaseId(String caseId) { - this.caseId = caseId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.multi_media.provider_id - * - * @return the value of core.multi_media.provider_id - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public String getProviderId() { - return providerId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.multi_media.provider_id - * - * @param providerId the value for core.multi_media.provider_id - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.multi_media.content_type - * - * @return the value of core.multi_media.content_type - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public String getContentType() { - return contentType; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.multi_media.content_type - * - * @param contentType the value for core.multi_media.content_type - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public void setContentType(String contentType) { - this.contentType = contentType; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.multi_media.file_path - * - * @return the value of core.multi_media.file_path - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public String getFilePath() { - return filePath; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.multi_media.file_path - * - * @param filePath the value for core.multi_media.file_path - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public void setFilePath(String filePath) { - this.filePath = filePath; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.multi_media.file_category - * - * @return the value of core.multi_media.file_category - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public String getFileCategory() { - return fileCategory; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.multi_media.file_category - * - * @param fileCategory the value for core.multi_media.file_category - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public void setFileCategory(String fileCategory) { - this.fileCategory = fileCategory; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/MultiMediaExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/MultiMediaExample.java deleted file mode 100644 index ad042d250a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/MultiMediaExample.java +++ /dev/null @@ -1,785 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class MultiMediaExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public MultiMediaExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNull() { - addCriterion("document_id is null"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNotNull() { - addCriterion("document_id is not null"); - return (Criteria) this; - } - - public Criteria andDocumentIdEqualTo(String value) { - addCriterion("document_id =", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotEqualTo(String value) { - addCriterion("document_id <>", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThan(String value) { - addCriterion("document_id >", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThanOrEqualTo(String value) { - addCriterion("document_id >=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThan(String value) { - addCriterion("document_id <", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThanOrEqualTo(String value) { - addCriterion("document_id <=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLike(String value) { - addCriterion("document_id like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotLike(String value) { - addCriterion("document_id not like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIn(List values) { - addCriterion("document_id in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotIn(List values) { - addCriterion("document_id not in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdBetween(String value1, String value2) { - addCriterion("document_id between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotBetween(String value1, String value2) { - addCriterion("document_id not between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andCaseIdIsNull() { - addCriterion("case_id is null"); - return (Criteria) this; - } - - public Criteria andCaseIdIsNotNull() { - addCriterion("case_id is not null"); - return (Criteria) this; - } - - public Criteria andCaseIdEqualTo(String value) { - addCriterion("case_id =", value, "caseId"); - return (Criteria) this; - } - - public Criteria andCaseIdNotEqualTo(String value) { - addCriterion("case_id <>", value, "caseId"); - return (Criteria) this; - } - - public Criteria andCaseIdGreaterThan(String value) { - addCriterion("case_id >", value, "caseId"); - return (Criteria) this; - } - - public Criteria andCaseIdGreaterThanOrEqualTo(String value) { - addCriterion("case_id >=", value, "caseId"); - return (Criteria) this; - } - - public Criteria andCaseIdLessThan(String value) { - addCriterion("case_id <", value, "caseId"); - return (Criteria) this; - } - - public Criteria andCaseIdLessThanOrEqualTo(String value) { - addCriterion("case_id <=", value, "caseId"); - return (Criteria) this; - } - - public Criteria andCaseIdLike(String value) { - addCriterion("case_id like", value, "caseId"); - return (Criteria) this; - } - - public Criteria andCaseIdNotLike(String value) { - addCriterion("case_id not like", value, "caseId"); - return (Criteria) this; - } - - public Criteria andCaseIdIn(List values) { - addCriterion("case_id in", values, "caseId"); - return (Criteria) this; - } - - public Criteria andCaseIdNotIn(List values) { - addCriterion("case_id not in", values, "caseId"); - return (Criteria) this; - } - - public Criteria andCaseIdBetween(String value1, String value2) { - addCriterion("case_id between", value1, value2, "caseId"); - return (Criteria) this; - } - - public Criteria andCaseIdNotBetween(String value1, String value2) { - addCriterion("case_id not between", value1, value2, "caseId"); - return (Criteria) this; - } - - public Criteria andProviderIdIsNull() { - addCriterion("provider_id is null"); - return (Criteria) this; - } - - public Criteria andProviderIdIsNotNull() { - addCriterion("provider_id is not null"); - return (Criteria) this; - } - - public Criteria andProviderIdEqualTo(String value) { - addCriterion("provider_id =", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotEqualTo(String value) { - addCriterion("provider_id <>", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdGreaterThan(String value) { - addCriterion("provider_id >", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdGreaterThanOrEqualTo(String value) { - addCriterion("provider_id >=", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLessThan(String value) { - addCriterion("provider_id <", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLessThanOrEqualTo(String value) { - addCriterion("provider_id <=", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLike(String value) { - addCriterion("provider_id like", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotLike(String value) { - addCriterion("provider_id not like", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdIn(List values) { - addCriterion("provider_id in", values, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotIn(List values) { - addCriterion("provider_id not in", values, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdBetween(String value1, String value2) { - addCriterion("provider_id between", value1, value2, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotBetween(String value1, String value2) { - addCriterion("provider_id not between", value1, value2, "providerId"); - return (Criteria) this; - } - - public Criteria andContentTypeIsNull() { - addCriterion("content_type is null"); - return (Criteria) this; - } - - public Criteria andContentTypeIsNotNull() { - addCriterion("content_type is not null"); - return (Criteria) this; - } - - public Criteria andContentTypeEqualTo(String value) { - addCriterion("content_type =", value, "contentType"); - return (Criteria) this; - } - - public Criteria andContentTypeNotEqualTo(String value) { - addCriterion("content_type <>", value, "contentType"); - return (Criteria) this; - } - - public Criteria andContentTypeGreaterThan(String value) { - addCriterion("content_type >", value, "contentType"); - return (Criteria) this; - } - - public Criteria andContentTypeGreaterThanOrEqualTo(String value) { - addCriterion("content_type >=", value, "contentType"); - return (Criteria) this; - } - - public Criteria andContentTypeLessThan(String value) { - addCriterion("content_type <", value, "contentType"); - return (Criteria) this; - } - - public Criteria andContentTypeLessThanOrEqualTo(String value) { - addCriterion("content_type <=", value, "contentType"); - return (Criteria) this; - } - - public Criteria andContentTypeLike(String value) { - addCriterion("content_type like", value, "contentType"); - return (Criteria) this; - } - - public Criteria andContentTypeNotLike(String value) { - addCriterion("content_type not like", value, "contentType"); - return (Criteria) this; - } - - public Criteria andContentTypeIn(List values) { - addCriterion("content_type in", values, "contentType"); - return (Criteria) this; - } - - public Criteria andContentTypeNotIn(List values) { - addCriterion("content_type not in", values, "contentType"); - return (Criteria) this; - } - - public Criteria andContentTypeBetween(String value1, String value2) { - addCriterion("content_type between", value1, value2, "contentType"); - return (Criteria) this; - } - - public Criteria andContentTypeNotBetween(String value1, String value2) { - addCriterion("content_type not between", value1, value2, "contentType"); - return (Criteria) this; - } - - public Criteria andFilePathIsNull() { - addCriterion("file_path is null"); - return (Criteria) this; - } - - public Criteria andFilePathIsNotNull() { - addCriterion("file_path is not null"); - return (Criteria) this; - } - - public Criteria andFilePathEqualTo(String value) { - addCriterion("file_path =", value, "filePath"); - return (Criteria) this; - } - - public Criteria andFilePathNotEqualTo(String value) { - addCriterion("file_path <>", value, "filePath"); - return (Criteria) this; - } - - public Criteria andFilePathGreaterThan(String value) { - addCriterion("file_path >", value, "filePath"); - return (Criteria) this; - } - - public Criteria andFilePathGreaterThanOrEqualTo(String value) { - addCriterion("file_path >=", value, "filePath"); - return (Criteria) this; - } - - public Criteria andFilePathLessThan(String value) { - addCriterion("file_path <", value, "filePath"); - return (Criteria) this; - } - - public Criteria andFilePathLessThanOrEqualTo(String value) { - addCriterion("file_path <=", value, "filePath"); - return (Criteria) this; - } - - public Criteria andFilePathLike(String value) { - addCriterion("file_path like", value, "filePath"); - return (Criteria) this; - } - - public Criteria andFilePathNotLike(String value) { - addCriterion("file_path not like", value, "filePath"); - return (Criteria) this; - } - - public Criteria andFilePathIn(List values) { - addCriterion("file_path in", values, "filePath"); - return (Criteria) this; - } - - public Criteria andFilePathNotIn(List values) { - addCriterion("file_path not in", values, "filePath"); - return (Criteria) this; - } - - public Criteria andFilePathBetween(String value1, String value2) { - addCriterion("file_path between", value1, value2, "filePath"); - return (Criteria) this; - } - - public Criteria andFilePathNotBetween(String value1, String value2) { - addCriterion("file_path not between", value1, value2, "filePath"); - return (Criteria) this; - } - - public Criteria andFileCategoryIsNull() { - addCriterion("file_category is null"); - return (Criteria) this; - } - - public Criteria andFileCategoryIsNotNull() { - addCriterion("file_category is not null"); - return (Criteria) this; - } - - public Criteria andFileCategoryEqualTo(String value) { - addCriterion("file_category =", value, "fileCategory"); - return (Criteria) this; - } - - public Criteria andFileCategoryNotEqualTo(String value) { - addCriterion("file_category <>", value, "fileCategory"); - return (Criteria) this; - } - - public Criteria andFileCategoryGreaterThan(String value) { - addCriterion("file_category >", value, "fileCategory"); - return (Criteria) this; - } - - public Criteria andFileCategoryGreaterThanOrEqualTo(String value) { - addCriterion("file_category >=", value, "fileCategory"); - return (Criteria) this; - } - - public Criteria andFileCategoryLessThan(String value) { - addCriterion("file_category <", value, "fileCategory"); - return (Criteria) this; - } - - public Criteria andFileCategoryLessThanOrEqualTo(String value) { - addCriterion("file_category <=", value, "fileCategory"); - return (Criteria) this; - } - - public Criteria andFileCategoryLike(String value) { - addCriterion("file_category like", value, "fileCategory"); - return (Criteria) this; - } - - public Criteria andFileCategoryNotLike(String value) { - addCriterion("file_category not like", value, "fileCategory"); - return (Criteria) this; - } - - public Criteria andFileCategoryIn(List values) { - addCriterion("file_category in", values, "fileCategory"); - return (Criteria) this; - } - - public Criteria andFileCategoryNotIn(List values) { - addCriterion("file_category not in", values, "fileCategory"); - return (Criteria) this; - } - - public Criteria andFileCategoryBetween(String value1, String value2) { - addCriterion("file_category between", value1, value2, "fileCategory"); - return (Criteria) this; - } - - public Criteria andFileCategoryNotBetween(String value1, String value2) { - addCriterion("file_category not between", value1, value2, "fileCategory"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.multi_media - * - * @mbg.generated do_not_delete_during_merge Fri Mar 09 18:03:53 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Organization.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Organization.java deleted file mode 100644 index 396edd16d9..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Organization.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.Date; - -public class Organization { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column team.organization.id - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - private Long id; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column team.organization.identifier - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - private String identifier; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column team.organization.active - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - private Boolean active; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column team.organization.name - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - private String name; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column team.organization.type - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - private Object type; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column team.organization.date_deleted - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - private Date dateDeleted; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column team.organization.parent_id - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - private Long parentId; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column team.organization.id - * @return the value of team.organization.id - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column team.organization.id - * @param id the value for team.organization.id - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column team.organization.identifier - * @return the value of team.organization.identifier - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public String getIdentifier() { - return identifier; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column team.organization.identifier - * @param identifier the value for team.organization.identifier - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column team.organization.active - * @return the value of team.organization.active - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public Boolean getActive() { - return active; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column team.organization.active - * @param active the value for team.organization.active - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public void setActive(Boolean active) { - this.active = active; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column team.organization.name - * @return the value of team.organization.name - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public String getName() { - return name; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column team.organization.name - * @param name the value for team.organization.name - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public void setName(String name) { - this.name = name; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column team.organization.type - * @return the value of team.organization.type - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public Object getType() { - return type; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column team.organization.type - * @param type the value for team.organization.type - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public void setType(Object type) { - this.type = type; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column team.organization.date_deleted - * @return the value of team.organization.date_deleted - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public Date getDateDeleted() { - return dateDeleted; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column team.organization.date_deleted - * @param dateDeleted the value for team.organization.date_deleted - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public void setDateDeleted(Date dateDeleted) { - this.dateDeleted = dateDeleted; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column team.organization.parent_id - * @return the value of team.organization.parent_id - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public Long getParentId() { - return parentId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column team.organization.parent_id - * @param parentId the value for team.organization.parent_id - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public void setParentId(Long parentId) { - this.parentId = parentId; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/OrganizationExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/OrganizationExample.java deleted file mode 100644 index 464f264610..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/OrganizationExample.java +++ /dev/null @@ -1,735 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class OrganizationExample { - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - protected String orderByClause; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - protected boolean distinct; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public OrganizationExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - protected abstract static class GeneratedCriteria { - protected List typeCriteria; - protected List allCriteria; - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - typeCriteria = new ArrayList(); - } - - public List getTypeCriteria() { - return typeCriteria; - } - - protected void addTypeCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - typeCriteria.add( - new Criterion(condition, value, "org.opensrp.repository.postgres.handler.CodeSystemTypeHandler")); - allCriteria = null; - } - - protected void addTypeCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - typeCriteria.add(new Criterion(condition, value1, value2, - "org.opensrp.repository.postgres.handler.CodeSystemTypeHandler")); - allCriteria = null; - } - - public boolean isValid() { - return criteria.size() > 0 || typeCriteria.size() > 0; - } - - public List getAllCriteria() { - if (allCriteria == null) { - allCriteria = new ArrayList(); - allCriteria.addAll(criteria); - allCriteria.addAll(typeCriteria); - } - return allCriteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new IllegalArgumentException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - allCriteria = null; - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNull() { - addCriterion("identifier is null"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNotNull() { - addCriterion("identifier is not null"); - return (Criteria) this; - } - - public Criteria andIdentifierEqualTo(String value) { - addCriterion("identifier =", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotEqualTo(String value) { - addCriterion("identifier <>", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThan(String value) { - addCriterion("identifier >", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThanOrEqualTo(String value) { - addCriterion("identifier >=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThan(String value) { - addCriterion("identifier <", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThanOrEqualTo(String value) { - addCriterion("identifier <=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLike(String value) { - addCriterion("identifier like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotLike(String value) { - addCriterion("identifier not like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierIn(List values) { - addCriterion("identifier in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotIn(List values) { - addCriterion("identifier not in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierBetween(String value1, String value2) { - addCriterion("identifier between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotBetween(String value1, String value2) { - addCriterion("identifier not between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andActiveIsNull() { - addCriterion("active is null"); - return (Criteria) this; - } - - public Criteria andActiveIsNotNull() { - addCriterion("active is not null"); - return (Criteria) this; - } - - public Criteria andActiveEqualTo(Boolean value) { - addCriterion("active =", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveNotEqualTo(Boolean value) { - addCriterion("active <>", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveGreaterThan(Boolean value) { - addCriterion("active >", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveGreaterThanOrEqualTo(Boolean value) { - addCriterion("active >=", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveLessThan(Boolean value) { - addCriterion("active <", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveLessThanOrEqualTo(Boolean value) { - addCriterion("active <=", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveIn(List values) { - addCriterion("active in", values, "active"); - return (Criteria) this; - } - - public Criteria andActiveNotIn(List values) { - addCriterion("active not in", values, "active"); - return (Criteria) this; - } - - public Criteria andActiveBetween(Boolean value1, Boolean value2) { - addCriterion("active between", value1, value2, "active"); - return (Criteria) this; - } - - public Criteria andActiveNotBetween(Boolean value1, Boolean value2) { - addCriterion("active not between", value1, value2, "active"); - return (Criteria) this; - } - - public Criteria andNameIsNull() { - addCriterion("name is null"); - return (Criteria) this; - } - - public Criteria andNameIsNotNull() { - addCriterion("name is not null"); - return (Criteria) this; - } - - public Criteria andNameEqualTo(String value) { - addCriterion("name =", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotEqualTo(String value) { - addCriterion("name <>", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThan(String value) { - addCriterion("name >", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThanOrEqualTo(String value) { - addCriterion("name >=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThan(String value) { - addCriterion("name <", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThanOrEqualTo(String value) { - addCriterion("name <=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLike(String value) { - addCriterion("name like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotLike(String value) { - addCriterion("name not like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameIn(List values) { - addCriterion("name in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameNotIn(List values) { - addCriterion("name not in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameBetween(String value1, String value2) { - addCriterion("name between", value1, value2, "name"); - return (Criteria) this; - } - - public Criteria andNameNotBetween(String value1, String value2) { - addCriterion("name not between", value1, value2, "name"); - return (Criteria) this; - } - - public Criteria andTypeIsNull() { - addCriterion("type is null"); - return (Criteria) this; - } - - public Criteria andTypeIsNotNull() { - addCriterion("type is not null"); - return (Criteria) this; - } - - public Criteria andTypeEqualTo(Object value) { - addTypeCriterion("type =", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotEqualTo(Object value) { - addTypeCriterion("type <>", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeGreaterThan(Object value) { - addTypeCriterion("type >", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeGreaterThanOrEqualTo(Object value) { - addTypeCriterion("type >=", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeLessThan(Object value) { - addTypeCriterion("type <", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeLessThanOrEqualTo(Object value) { - addTypeCriterion("type <=", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeIn(List values) { - addTypeCriterion("type in", values, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotIn(List values) { - addTypeCriterion("type not in", values, "type"); - return (Criteria) this; - } - - public Criteria andTypeBetween(Object value1, Object value2) { - addTypeCriterion("type between", value1, value2, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotBetween(Object value1, Object value2) { - addTypeCriterion("type not between", value1, value2, "type"); - return (Criteria) this; - } - - public Criteria andDateDeletedIsNull() { - addCriterion("date_deleted is null"); - return (Criteria) this; - } - - public Criteria andDateDeletedIsNotNull() { - addCriterion("date_deleted is not null"); - return (Criteria) this; - } - - public Criteria andDateDeletedEqualTo(Date value) { - addCriterion("date_deleted =", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotEqualTo(Date value) { - addCriterion("date_deleted <>", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedGreaterThan(Date value) { - addCriterion("date_deleted >", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedGreaterThanOrEqualTo(Date value) { - addCriterion("date_deleted >=", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedLessThan(Date value) { - addCriterion("date_deleted <", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedLessThanOrEqualTo(Date value) { - addCriterion("date_deleted <=", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedIn(List values) { - addCriterion("date_deleted in", values, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotIn(List values) { - addCriterion("date_deleted not in", values, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedBetween(Date value1, Date value2) { - addCriterion("date_deleted between", value1, value2, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotBetween(Date value1, Date value2) { - addCriterion("date_deleted not between", value1, value2, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andParentIdIsNull() { - addCriterion("parent_id is null"); - return (Criteria) this; - } - - public Criteria andParentIdIsNotNull() { - addCriterion("parent_id is not null"); - return (Criteria) this; - } - - public Criteria andParentIdEqualTo(Long value) { - addCriterion("parent_id =", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdNotEqualTo(Long value) { - addCriterion("parent_id <>", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdGreaterThan(Long value) { - addCriterion("parent_id >", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdGreaterThanOrEqualTo(Long value) { - addCriterion("parent_id >=", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdLessThan(Long value) { - addCriterion("parent_id <", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdLessThanOrEqualTo(Long value) { - addCriterion("parent_id <=", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdIn(List values) { - addCriterion("parent_id in", values, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdNotIn(List values) { - addCriterion("parent_id not in", values, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdBetween(Long value1, Long value2) { - addCriterion("parent_id between", value1, value2, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdNotBetween(Long value1, Long value2) { - addCriterion("parent_id not between", value1, value2, "parentId"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - public static class Criterion { - private String condition; - private Object value; - private Object secondValue; - private boolean noValue; - private boolean singleValue; - private boolean betweenValue; - private boolean listValue; - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table team.organization - * - * @mbg.generated do_not_delete_during_merge Fri Aug 30 16:07:30 EAT 2019 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/OrganizationLocation.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/OrganizationLocation.java deleted file mode 100644 index 750af2212d..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/OrganizationLocation.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.Date; - -public class OrganizationLocation { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column team.organization_location.id - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - private Long id; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column team.organization_location.organization_id - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - private Long organizationId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column team.organization_location.location_id - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - private Long locationId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column team.organization_location.plan_id - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - private Long planId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column team.organization_location.from_date - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - private Date fromDate; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column team.organization_location.to_date - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - private Date toDate; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column team.organization_location.id - * @return the value of team.organization_location.id - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column team.organization_location.id - * @param id the value for team.organization_location.id - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column team.organization_location.organization_id - * @return the value of team.organization_location.organization_id - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public Long getOrganizationId() { - return organizationId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column team.organization_location.organization_id - * @param organizationId the value for team.organization_location.organization_id - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public void setOrganizationId(Long organizationId) { - this.organizationId = organizationId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column team.organization_location.location_id - * @return the value of team.organization_location.location_id - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public Long getLocationId() { - return locationId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column team.organization_location.location_id - * @param locationId the value for team.organization_location.location_id - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public void setLocationId(Long locationId) { - this.locationId = locationId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column team.organization_location.plan_id - * @return the value of team.organization_location.plan_id - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public Long getPlanId() { - return planId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column team.organization_location.plan_id - * @param planId the value for team.organization_location.plan_id - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public void setPlanId(Long planId) { - this.planId = planId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column team.organization_location.from_date - * @return the value of team.organization_location.from_date - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public Date getFromDate() { - return fromDate; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column team.organization_location.from_date - * @param fromDate the value for team.organization_location.from_date - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public void setFromDate(Date fromDate) { - this.fromDate = fromDate; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column team.organization_location.to_date - * @return the value of team.organization_location.to_date - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public Date getToDate() { - return toDate; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column team.organization_location.to_date - * @param toDate the value for team.organization_location.to_date - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public void setToDate(Date toDate) { - this.toDate = toDate; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/OrganizationLocationExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/OrganizationLocationExample.java deleted file mode 100644 index b9349c19d5..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/OrganizationLocationExample.java +++ /dev/null @@ -1,622 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class OrganizationLocationExample { - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - protected String orderByClause; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - protected boolean distinct; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public OrganizationLocationExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new IllegalArgumentException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andOrganizationIdIsNull() { - addCriterion("organization_id is null"); - return (Criteria) this; - } - - public Criteria andOrganizationIdIsNotNull() { - addCriterion("organization_id is not null"); - return (Criteria) this; - } - - public Criteria andOrganizationIdEqualTo(Long value) { - addCriterion("organization_id =", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotEqualTo(Long value) { - addCriterion("organization_id <>", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdGreaterThan(Long value) { - addCriterion("organization_id >", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdGreaterThanOrEqualTo(Long value) { - addCriterion("organization_id >=", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLessThan(Long value) { - addCriterion("organization_id <", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLessThanOrEqualTo(Long value) { - addCriterion("organization_id <=", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdIn(List values) { - addCriterion("organization_id in", values, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotIn(List values) { - addCriterion("organization_id not in", values, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdBetween(Long value1, Long value2) { - addCriterion("organization_id between", value1, value2, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotBetween(Long value1, Long value2) { - addCriterion("organization_id not between", value1, value2, "organizationId"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNull() { - addCriterion("location_id is null"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNotNull() { - addCriterion("location_id is not null"); - return (Criteria) this; - } - - public Criteria andLocationIdEqualTo(Long value) { - addCriterion("location_id =", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotEqualTo(Long value) { - addCriterion("location_id <>", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThan(Long value) { - addCriterion("location_id >", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThanOrEqualTo(Long value) { - addCriterion("location_id >=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThan(Long value) { - addCriterion("location_id <", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThanOrEqualTo(Long value) { - addCriterion("location_id <=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdIn(List values) { - addCriterion("location_id in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotIn(List values) { - addCriterion("location_id not in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdBetween(Long value1, Long value2) { - addCriterion("location_id between", value1, value2, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotBetween(Long value1, Long value2) { - addCriterion("location_id not between", value1, value2, "locationId"); - return (Criteria) this; - } - - public Criteria andPlanIdIsNull() { - addCriterion("plan_id is null"); - return (Criteria) this; - } - - public Criteria andPlanIdIsNotNull() { - addCriterion("plan_id is not null"); - return (Criteria) this; - } - - public Criteria andPlanIdEqualTo(Long value) { - addCriterion("plan_id =", value, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdNotEqualTo(Long value) { - addCriterion("plan_id <>", value, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdGreaterThan(Long value) { - addCriterion("plan_id >", value, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdGreaterThanOrEqualTo(Long value) { - addCriterion("plan_id >=", value, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdLessThan(Long value) { - addCriterion("plan_id <", value, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdLessThanOrEqualTo(Long value) { - addCriterion("plan_id <=", value, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdIn(List values) { - addCriterion("plan_id in", values, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdNotIn(List values) { - addCriterion("plan_id not in", values, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdBetween(Long value1, Long value2) { - addCriterion("plan_id between", value1, value2, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdNotBetween(Long value1, Long value2) { - addCriterion("plan_id not between", value1, value2, "planId"); - return (Criteria) this; - } - - public Criteria andFromDateIsNull() { - addCriterion("from_date is null"); - return (Criteria) this; - } - - public Criteria andFromDateIsNotNull() { - addCriterion("from_date is not null"); - return (Criteria) this; - } - - public Criteria andFromDateEqualTo(Date value) { - addCriterion("from_date =", value, "fromDate"); - return (Criteria) this; - } - - public Criteria andFromDateNotEqualTo(Date value) { - addCriterion("from_date <>", value, "fromDate"); - return (Criteria) this; - } - - public Criteria andFromDateGreaterThan(Date value) { - addCriterion("from_date >", value, "fromDate"); - return (Criteria) this; - } - - public Criteria andFromDateGreaterThanOrEqualTo(Date value) { - addCriterion("from_date >=", value, "fromDate"); - return (Criteria) this; - } - - public Criteria andFromDateLessThan(Date value) { - addCriterion("from_date <", value, "fromDate"); - return (Criteria) this; - } - - public Criteria andFromDateLessThanOrEqualTo(Date value) { - addCriterion("from_date <=", value, "fromDate"); - return (Criteria) this; - } - - public Criteria andFromDateIn(List values) { - addCriterion("from_date in", values, "fromDate"); - return (Criteria) this; - } - - public Criteria andFromDateNotIn(List values) { - addCriterion("from_date not in", values, "fromDate"); - return (Criteria) this; - } - - public Criteria andFromDateBetween(Date value1, Date value2) { - addCriterion("from_date between", value1, value2, "fromDate"); - return (Criteria) this; - } - - public Criteria andFromDateNotBetween(Date value1, Date value2) { - addCriterion("from_date not between", value1, value2, "fromDate"); - return (Criteria) this; - } - - public Criteria andToDateIsNull() { - addCriterion("to_date is null"); - return (Criteria) this; - } - - public Criteria andToDateIsNotNull() { - addCriterion("to_date is not null"); - return (Criteria) this; - } - - public Criteria andToDateEqualTo(Date value) { - addCriterion("to_date =", value, "toDate"); - return (Criteria) this; - } - - public Criteria andToDateNotEqualTo(Date value) { - addCriterion("to_date <>", value, "toDate"); - return (Criteria) this; - } - - public Criteria andToDateGreaterThan(Date value) { - addCriterion("to_date >", value, "toDate"); - return (Criteria) this; - } - - public Criteria andToDateGreaterThanOrEqualTo(Date value) { - addCriterion("to_date >=", value, "toDate"); - return (Criteria) this; - } - - public Criteria andToDateLessThan(Date value) { - addCriterion("to_date <", value, "toDate"); - return (Criteria) this; - } - - public Criteria andToDateLessThanOrEqualTo(Date value) { - addCriterion("to_date <=", value, "toDate"); - return (Criteria) this; - } - - public Criteria andToDateIn(List values) { - addCriterion("to_date in", values, "toDate"); - return (Criteria) this; - } - - public Criteria andToDateNotIn(List values) { - addCriterion("to_date not in", values, "toDate"); - return (Criteria) this; - } - - public Criteria andToDateBetween(Date value1, Date value2) { - addCriterion("to_date between", value1, value2, "toDate"); - return (Criteria) this; - } - - public Criteria andToDateNotBetween(Date value1, Date value2) { - addCriterion("to_date not between", value1, value2, "toDate"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - public static class Criterion { - private String condition; - private Object value; - private Object secondValue; - private boolean noValue; - private boolean singleValue; - private boolean betweenValue; - private boolean listValue; - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table team.organization_location - * - * @mbg.generated do_not_delete_during_merge Fri Aug 30 16:08:23 EAT 2019 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Plan.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Plan.java deleted file mode 100644 index c8d5397911..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Plan.java +++ /dev/null @@ -1,122 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.Date; - -public class Plan { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.plan.id - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - private Long id; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.plan.identifier - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - private String identifier; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.plan.json - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - private Object json; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.plan.date_deleted - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - private Date dateDeleted; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.plan.server_version - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - private Long serverVersion; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.plan.id - * @return the value of core.plan.id - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.plan.id - * @param id the value for core.plan.id - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.plan.identifier - * @return the value of core.plan.identifier - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public String getIdentifier() { - return identifier; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.plan.identifier - * @param identifier the value for core.plan.identifier - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.plan.json - * @return the value of core.plan.json - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public Object getJson() { - return json; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.plan.json - * @param json the value for core.plan.json - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void setJson(Object json) { - this.json = json; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.plan.date_deleted - * @return the value of core.plan.date_deleted - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public Date getDateDeleted() { - return dateDeleted; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.plan.date_deleted - * @param dateDeleted the value for core.plan.date_deleted - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void setDateDeleted(Date dateDeleted) { - this.dateDeleted = dateDeleted; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.plan.server_version - * @return the value of core.plan.server_version - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public Long getServerVersion() { - return serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.plan.server_version - * @param serverVersion the value for core.plan.server_version - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/PlanExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/PlanExample.java deleted file mode 100644 index 33aaeaa17e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/PlanExample.java +++ /dev/null @@ -1,605 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class PlanExample { - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - protected String orderByClause; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - protected boolean distinct; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public PlanExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - protected abstract static class GeneratedCriteria { - protected List jsonCriteria; - protected List allCriteria; - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - jsonCriteria = new ArrayList(); - } - - public List getJsonCriteria() { - return jsonCriteria; - } - - protected void addJsonCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - jsonCriteria - .add(new Criterion(condition, value, "org.opensrp.repository.postgres.handler.PlanTypeHandler")); - allCriteria = null; - } - - protected void addJsonCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value1, value2, - "org.opensrp.repository.postgres.handler.PlanTypeHandler")); - allCriteria = null; - } - - public boolean isValid() { - return criteria.size() > 0 || jsonCriteria.size() > 0; - } - - public List getAllCriteria() { - if (allCriteria == null) { - allCriteria = new ArrayList(); - allCriteria.addAll(criteria); - allCriteria.addAll(jsonCriteria); - } - return allCriteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new IllegalArgumentException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - allCriteria = null; - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNull() { - addCriterion("identifier is null"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNotNull() { - addCriterion("identifier is not null"); - return (Criteria) this; - } - - public Criteria andIdentifierEqualTo(String value) { - addCriterion("identifier =", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotEqualTo(String value) { - addCriterion("identifier <>", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThan(String value) { - addCriterion("identifier >", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThanOrEqualTo(String value) { - addCriterion("identifier >=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThan(String value) { - addCriterion("identifier <", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThanOrEqualTo(String value) { - addCriterion("identifier <=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLike(String value) { - addCriterion("identifier like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotLike(String value) { - addCriterion("identifier not like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierIn(List values) { - addCriterion("identifier in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotIn(List values) { - addCriterion("identifier not in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierBetween(String value1, String value2) { - addCriterion("identifier between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotBetween(String value1, String value2) { - addCriterion("identifier not between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andJsonIsNull() { - addCriterion("json is null"); - return (Criteria) this; - } - - public Criteria andJsonIsNotNull() { - addCriterion("json is not null"); - return (Criteria) this; - } - - public Criteria andJsonEqualTo(Object value) { - addJsonCriterion("json =", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotEqualTo(Object value) { - addJsonCriterion("json <>", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThan(Object value) { - addJsonCriterion("json >", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThanOrEqualTo(Object value) { - addJsonCriterion("json >=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThan(Object value) { - addJsonCriterion("json <", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThanOrEqualTo(Object value) { - addJsonCriterion("json <=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonIn(List values) { - addJsonCriterion("json in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotIn(List values) { - addJsonCriterion("json not in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonBetween(Object value1, Object value2) { - addJsonCriterion("json between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotBetween(Object value1, Object value2) { - addJsonCriterion("json not between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andDateDeletedIsNull() { - addCriterion("date_deleted is null"); - return (Criteria) this; - } - - public Criteria andDateDeletedIsNotNull() { - addCriterion("date_deleted is not null"); - return (Criteria) this; - } - - public Criteria andDateDeletedEqualTo(Date value) { - addCriterion("date_deleted =", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotEqualTo(Date value) { - addCriterion("date_deleted <>", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedGreaterThan(Date value) { - addCriterion("date_deleted >", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedGreaterThanOrEqualTo(Date value) { - addCriterion("date_deleted >=", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedLessThan(Date value) { - addCriterion("date_deleted <", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedLessThanOrEqualTo(Date value) { - addCriterion("date_deleted <=", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedIn(List values) { - addCriterion("date_deleted in", values, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotIn(List values) { - addCriterion("date_deleted not in", values, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedBetween(Date value1, Date value2) { - addCriterion("date_deleted between", value1, value2, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotBetween(Date value1, Date value2) { - addCriterion("date_deleted not between", value1, value2, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNull() { - addCriterion("server_version is null"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNotNull() { - addCriterion("server_version is not null"); - return (Criteria) this; - } - - public Criteria andServerVersionEqualTo(Long value) { - addCriterion("server_version =", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotEqualTo(Long value) { - addCriterion("server_version <>", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThan(Long value) { - addCriterion("server_version >", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThanOrEqualTo(Long value) { - addCriterion("server_version >=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThan(Long value) { - addCriterion("server_version <", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThanOrEqualTo(Long value) { - addCriterion("server_version <=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionIn(List values) { - addCriterion("server_version in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotIn(List values) { - addCriterion("server_version not in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionBetween(Long value1, Long value2) { - addCriterion("server_version between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotBetween(Long value1, Long value2) { - addCriterion("server_version not between", value1, value2, "serverVersion"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public static class Criterion { - private String condition; - private Object value; - private Object secondValue; - private boolean noValue; - private boolean singleValue; - private boolean betweenValue; - private boolean listValue; - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.plan - * - * @mbg.generated do_not_delete_during_merge Fri May 10 11:11:46 EAT 2019 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/PlanMetadata.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/PlanMetadata.java deleted file mode 100644 index 608c972a25..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/PlanMetadata.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.opensrp.domain.postgres; - -public class PlanMetadata { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.plan_metadata.operational_area_id - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - private String operationalAreaId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.plan_metadata.identifier - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - private String identifier; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.plan_metadata.plan_id - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - private Long planId; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.plan_metadata.operational_area_id - * @return the value of core.plan_metadata.operational_area_id - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public String getOperationalAreaId() { - return operationalAreaId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.plan_metadata.operational_area_id - * @param operationalAreaId the value for core.plan_metadata.operational_area_id - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void setOperationalAreaId(String operationalAreaId) { - this.operationalAreaId = operationalAreaId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.plan_metadata.identifier - * @return the value of core.plan_metadata.identifier - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public String getIdentifier() { - return identifier; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.plan_metadata.identifier - * @param identifier the value for core.plan_metadata.identifier - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.plan_metadata.plan_id - * @return the value of core.plan_metadata.plan_id - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public Long getPlanId() { - return planId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.plan_metadata.plan_id - * @param planId the value for core.plan_metadata.plan_id - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void setPlanId(Long planId) { - this.planId = planId; - } - -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/PlanMetadataExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/PlanMetadataExample.java deleted file mode 100644 index d998d01328..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/PlanMetadataExample.java +++ /dev/null @@ -1,461 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class PlanMetadataExample { - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - protected String orderByClause; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - protected boolean distinct; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public PlanMetadataExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new IllegalArgumentException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andOperationalAreaIdIsNull() { - addCriterion("operational_area_id is null"); - return (Criteria) this; - } - - public Criteria andOperationalAreaIdIsNotNull() { - addCriterion("operational_area_id is not null"); - return (Criteria) this; - } - - public Criteria andOperationalAreaIdEqualTo(String value) { - addCriterion("operational_area_id =", value, "operationalAreaId"); - return (Criteria) this; - } - - public Criteria andOperationalAreaIdNotEqualTo(String value) { - addCriterion("operational_area_id <>", value, "operationalAreaId"); - return (Criteria) this; - } - - public Criteria andOperationalAreaIdGreaterThan(String value) { - addCriterion("operational_area_id >", value, "operationalAreaId"); - return (Criteria) this; - } - - public Criteria andOperationalAreaIdGreaterThanOrEqualTo(String value) { - addCriterion("operational_area_id >=", value, "operationalAreaId"); - return (Criteria) this; - } - - public Criteria andOperationalAreaIdLessThan(String value) { - addCriterion("operational_area_id <", value, "operationalAreaId"); - return (Criteria) this; - } - - public Criteria andOperationalAreaIdLessThanOrEqualTo(String value) { - addCriterion("operational_area_id <=", value, "operationalAreaId"); - return (Criteria) this; - } - - public Criteria andOperationalAreaIdLike(String value) { - addCriterion("operational_area_id like", value, "operationalAreaId"); - return (Criteria) this; - } - - public Criteria andOperationalAreaIdNotLike(String value) { - addCriterion("operational_area_id not like", value, "operationalAreaId"); - return (Criteria) this; - } - - public Criteria andOperationalAreaIdIn(List values) { - addCriterion("operational_area_id in", values, "operationalAreaId"); - return (Criteria) this; - } - - public Criteria andOperationalAreaIdNotIn(List values) { - addCriterion("operational_area_id not in", values, "operationalAreaId"); - return (Criteria) this; - } - - public Criteria andOperationalAreaIdBetween(String value1, String value2) { - addCriterion("operational_area_id between", value1, value2, "operationalAreaId"); - return (Criteria) this; - } - - public Criteria andOperationalAreaIdNotBetween(String value1, String value2) { - addCriterion("operational_area_id not between", value1, value2, "operationalAreaId"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNull() { - addCriterion("identifier is null"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNotNull() { - addCriterion("identifier is not null"); - return (Criteria) this; - } - - public Criteria andIdentifierEqualTo(String value) { - addCriterion("identifier =", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotEqualTo(String value) { - addCriterion("identifier <>", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThan(String value) { - addCriterion("identifier >", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThanOrEqualTo(String value) { - addCriterion("identifier >=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThan(String value) { - addCriterion("identifier <", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThanOrEqualTo(String value) { - addCriterion("identifier <=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLike(String value) { - addCriterion("identifier like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotLike(String value) { - addCriterion("identifier not like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierIn(List values) { - addCriterion("identifier in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotIn(List values) { - addCriterion("identifier not in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierBetween(String value1, String value2) { - addCriterion("identifier between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotBetween(String value1, String value2) { - addCriterion("identifier not between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andPlanIdIsNull() { - addCriterion("plan_id is null"); - return (Criteria) this; - } - - public Criteria andPlanIdIsNotNull() { - addCriterion("plan_id is not null"); - return (Criteria) this; - } - - public Criteria andPlanIdEqualTo(Long value) { - addCriterion("plan_id =", value, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdNotEqualTo(Long value) { - addCriterion("plan_id <>", value, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdGreaterThan(Long value) { - addCriterion("plan_id >", value, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdGreaterThanOrEqualTo(Long value) { - addCriterion("plan_id >=", value, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdLessThan(Long value) { - addCriterion("plan_id <", value, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdLessThanOrEqualTo(Long value) { - addCriterion("plan_id <=", value, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdIn(List values) { - addCriterion("plan_id in", values, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdNotIn(List values) { - addCriterion("plan_id not in", values, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdBetween(Long value1, Long value2) { - addCriterion("plan_id between", value1, value2, "planId"); - return (Criteria) this; - } - - public Criteria andPlanIdNotBetween(Long value1, Long value2) { - addCriterion("plan_id not between", value1, value2, "planId"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - public static class Criterion { - private String condition; - private Object value; - private Object secondValue; - private boolean noValue; - private boolean singleValue; - private boolean betweenValue; - private boolean listValue; - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.plan_metadata - * - * @mbg.generated do_not_delete_during_merge Fri May 10 11:11:46 EAT 2019 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Practitioner.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Practitioner.java deleted file mode 100644 index a90a678908..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Practitioner.java +++ /dev/null @@ -1,236 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.Date; - -public class Practitioner { - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column team.practitioner.id - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - private Long id; - - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column team.practitioner.identifier - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - private String identifier; - - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column team.practitioner.active - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - private Boolean active; - - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column team.practitioner.name - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - private String name; - - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column team.practitioner.user_id - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - private String userId; - - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column team.practitioner.username - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - private String username; - - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column team.practitioner.date_deleted - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - private Date dateDeleted; - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column team.practitioner.id - * - * @return the value of team.practitioner.id - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column team.practitioner.id - * - * @param id the value for team.practitioner.id - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column team.practitioner.identifier - * - * @return the value of team.practitioner.identifier - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public String getIdentifier() { - return identifier; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column team.practitioner.identifier - * - * @param identifier the value for team.practitioner.identifier - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column team.practitioner.active - * - * @return the value of team.practitioner.active - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public Boolean getActive() { - return active; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column team.practitioner.active - * - * @param active the value for team.practitioner.active - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setActive(Boolean active) { - this.active = active; - } - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column team.practitioner.name - * - * @return the value of team.practitioner.name - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public String getName() { - return name; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column team.practitioner.name - * - * @param name the value for team.practitioner.name - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setName(String name) { - this.name = name; - } - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column team.practitioner.user_id - * - * @return the value of team.practitioner.user_id - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public String getUserId() { - return userId; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column team.practitioner.user_id - * - * @param userId the value for team.practitioner.user_id - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setUserId(String userId) { - this.userId = userId; - } - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column team.practitioner.username - * - * @return the value of team.practitioner.username - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public String getUsername() { - return username; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column team.practitioner.username - * - * @param username the value for team.practitioner.username - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setUsername(String username) { - this.username = username; - } - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column team.practitioner.date_deleted - * - * @return the value of team.practitioner.date_deleted - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public Date getDateDeleted() { - return dateDeleted; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column team.practitioner.date_deleted - * - * @param dateDeleted the value for team.practitioner.date_deleted - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setDateDeleted(Date dateDeleted) { - this.dateDeleted = dateDeleted; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/PractitionerExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/PractitionerExample.java deleted file mode 100644 index 6d645a1427..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/PractitionerExample.java +++ /dev/null @@ -1,763 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class PractitionerExample { - /** - * This field was generated by MyBatis Generator. - * This field corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. - * This field corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. - * This field corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public PractitionerExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new IllegalArgumentException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNull() { - addCriterion("identifier is null"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNotNull() { - addCriterion("identifier is not null"); - return (Criteria) this; - } - - public Criteria andIdentifierEqualTo(String value) { - addCriterion("identifier =", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotEqualTo(String value) { - addCriterion("identifier <>", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThan(String value) { - addCriterion("identifier >", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThanOrEqualTo(String value) { - addCriterion("identifier >=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThan(String value) { - addCriterion("identifier <", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThanOrEqualTo(String value) { - addCriterion("identifier <=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLike(String value) { - addCriterion("identifier like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotLike(String value) { - addCriterion("identifier not like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierIn(List values) { - addCriterion("identifier in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotIn(List values) { - addCriterion("identifier not in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierBetween(String value1, String value2) { - addCriterion("identifier between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotBetween(String value1, String value2) { - addCriterion("identifier not between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andActiveIsNull() { - addCriterion("active is null"); - return (Criteria) this; - } - - public Criteria andActiveIsNotNull() { - addCriterion("active is not null"); - return (Criteria) this; - } - - public Criteria andActiveEqualTo(Boolean value) { - addCriterion("active =", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveNotEqualTo(Boolean value) { - addCriterion("active <>", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveGreaterThan(Boolean value) { - addCriterion("active >", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveGreaterThanOrEqualTo(Boolean value) { - addCriterion("active >=", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveLessThan(Boolean value) { - addCriterion("active <", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveLessThanOrEqualTo(Boolean value) { - addCriterion("active <=", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveIn(List values) { - addCriterion("active in", values, "active"); - return (Criteria) this; - } - - public Criteria andActiveNotIn(List values) { - addCriterion("active not in", values, "active"); - return (Criteria) this; - } - - public Criteria andActiveBetween(Boolean value1, Boolean value2) { - addCriterion("active between", value1, value2, "active"); - return (Criteria) this; - } - - public Criteria andActiveNotBetween(Boolean value1, Boolean value2) { - addCriterion("active not between", value1, value2, "active"); - return (Criteria) this; - } - - public Criteria andNameIsNull() { - addCriterion("name is null"); - return (Criteria) this; - } - - public Criteria andNameIsNotNull() { - addCriterion("name is not null"); - return (Criteria) this; - } - - public Criteria andNameEqualTo(String value) { - addCriterion("name =", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotEqualTo(String value) { - addCriterion("name <>", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThan(String value) { - addCriterion("name >", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThanOrEqualTo(String value) { - addCriterion("name >=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThan(String value) { - addCriterion("name <", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThanOrEqualTo(String value) { - addCriterion("name <=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLike(String value) { - addCriterion("name like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotLike(String value) { - addCriterion("name not like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameIn(List values) { - addCriterion("name in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameNotIn(List values) { - addCriterion("name not in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameBetween(String value1, String value2) { - addCriterion("name between", value1, value2, "name"); - return (Criteria) this; - } - - public Criteria andNameNotBetween(String value1, String value2) { - addCriterion("name not between", value1, value2, "name"); - return (Criteria) this; - } - - public Criteria andUserIdIsNull() { - addCriterion("user_id is null"); - return (Criteria) this; - } - - public Criteria andUserIdIsNotNull() { - addCriterion("user_id is not null"); - return (Criteria) this; - } - - public Criteria andUserIdEqualTo(String value) { - addCriterion("user_id =", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdNotEqualTo(String value) { - addCriterion("user_id <>", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdGreaterThan(String value) { - addCriterion("user_id >", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdGreaterThanOrEqualTo(String value) { - addCriterion("user_id >=", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdLessThan(String value) { - addCriterion("user_id <", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdLessThanOrEqualTo(String value) { - addCriterion("user_id <=", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdLike(String value) { - addCriterion("user_id like", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdNotLike(String value) { - addCriterion("user_id not like", value, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdIn(List values) { - addCriterion("user_id in", values, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdNotIn(List values) { - addCriterion("user_id not in", values, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdBetween(String value1, String value2) { - addCriterion("user_id between", value1, value2, "userId"); - return (Criteria) this; - } - - public Criteria andUserIdNotBetween(String value1, String value2) { - addCriterion("user_id not between", value1, value2, "userId"); - return (Criteria) this; - } - - public Criteria andUsernameIsNull() { - addCriterion("username is null"); - return (Criteria) this; - } - - public Criteria andUsernameIsNotNull() { - addCriterion("username is not null"); - return (Criteria) this; - } - - public Criteria andUsernameEqualTo(String value) { - addCriterion("username =", value, "username"); - return (Criteria) this; - } - - public Criteria andUsernameNotEqualTo(String value) { - addCriterion("username <>", value, "username"); - return (Criteria) this; - } - - public Criteria andUsernameGreaterThan(String value) { - addCriterion("username >", value, "username"); - return (Criteria) this; - } - - public Criteria andUsernameGreaterThanOrEqualTo(String value) { - addCriterion("username >=", value, "username"); - return (Criteria) this; - } - - public Criteria andUsernameLessThan(String value) { - addCriterion("username <", value, "username"); - return (Criteria) this; - } - - public Criteria andUsernameLessThanOrEqualTo(String value) { - addCriterion("username <=", value, "username"); - return (Criteria) this; - } - - public Criteria andUsernameLike(String value) { - addCriterion("username like", value, "username"); - return (Criteria) this; - } - - public Criteria andUsernameNotLike(String value) { - addCriterion("username not like", value, "username"); - return (Criteria) this; - } - - public Criteria andUsernameIn(List values) { - addCriterion("username in", values, "username"); - return (Criteria) this; - } - - public Criteria andUsernameNotIn(List values) { - addCriterion("username not in", values, "username"); - return (Criteria) this; - } - - public Criteria andUsernameBetween(String value1, String value2) { - addCriterion("username between", value1, value2, "username"); - return (Criteria) this; - } - - public Criteria andUsernameNotBetween(String value1, String value2) { - addCriterion("username not between", value1, value2, "username"); - return (Criteria) this; - } - - public Criteria andDateDeletedIsNull() { - addCriterion("date_deleted is null"); - return (Criteria) this; - } - - public Criteria andDateDeletedIsNotNull() { - addCriterion("date_deleted is not null"); - return (Criteria) this; - } - - public Criteria andDateDeletedEqualTo(Date value) { - addCriterion("date_deleted =", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotEqualTo(Date value) { - addCriterion("date_deleted <>", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedGreaterThan(Date value) { - addCriterion("date_deleted >", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedGreaterThanOrEqualTo(Date value) { - addCriterion("date_deleted >=", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedLessThan(Date value) { - addCriterion("date_deleted <", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedLessThanOrEqualTo(Date value) { - addCriterion("date_deleted <=", value, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedIn(List values) { - addCriterion("date_deleted in", values, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotIn(List values) { - addCriterion("date_deleted not in", values, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedBetween(Date value1, Date value2) { - addCriterion("date_deleted between", value1, value2, "dateDeleted"); - return (Criteria) this; - } - - public Criteria andDateDeletedNotBetween(Date value1, Date value2) { - addCriterion("date_deleted not between", value1, value2, "dateDeleted"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table team.practitioner - * - * @mbg.generated do_not_delete_during_merge Fri Aug 30 16:08:23 EAT 2019 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public static class Criterion { - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/PractitionerRole.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/PractitionerRole.java deleted file mode 100644 index b77ff9b1e8..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/PractitionerRole.java +++ /dev/null @@ -1,201 +0,0 @@ -package org.opensrp.domain.postgres; - -public class PractitionerRole { - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column team.practitioner_role.id - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - private Long id; - - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column team.practitioner_role.identifier - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - private String identifier; - - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column team.practitioner_role.active - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - private Boolean active; - - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column team.practitioner_role.organization_id - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - private Long organizationId; - - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column team.practitioner_role.practitioner_id - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - private Long practitionerId; - - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column team.practitioner_role.code - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - private String code; - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column team.practitioner_role.id - * - * @return the value of team.practitioner_role.id - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column team.practitioner_role.id - * - * @param id the value for team.practitioner_role.id - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column team.practitioner_role.identifier - * - * @return the value of team.practitioner_role.identifier - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public String getIdentifier() { - return identifier; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column team.practitioner_role.identifier - * - * @param identifier the value for team.practitioner_role.identifier - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column team.practitioner_role.active - * - * @return the value of team.practitioner_role.active - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public Boolean getActive() { - return active; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column team.practitioner_role.active - * - * @param active the value for team.practitioner_role.active - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setActive(Boolean active) { - this.active = active; - } - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column team.practitioner_role.organization_id - * - * @return the value of team.practitioner_role.organization_id - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public Long getOrganizationId() { - return organizationId; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column team.practitioner_role.organization_id - * - * @param organizationId the value for team.practitioner_role.organization_id - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setOrganizationId(Long organizationId) { - this.organizationId = organizationId; - } - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column team.practitioner_role.practitioner_id - * - * @return the value of team.practitioner_role.practitioner_id - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public Long getPractitionerId() { - return practitionerId; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column team.practitioner_role.practitioner_id - * - * @param practitionerId the value for team.practitioner_role.practitioner_id - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setPractitionerId(Long practitionerId) { - this.practitionerId = practitionerId; - } - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column team.practitioner_role.code - * - * @return the value of team.practitioner_role.code - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public String getCode() { - return code; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column team.practitioner_role.code - * - * @param code the value for team.practitioner_role.code - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setCode(String code) { - this.code = code; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/PractitionerRoleExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/PractitionerRoleExample.java deleted file mode 100644 index 62c99a839e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/PractitionerRoleExample.java +++ /dev/null @@ -1,682 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class PractitionerRoleExample { - /** - * This field was generated by MyBatis Generator. - * This field corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. - * This field corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. - * This field corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public PractitionerRoleExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new IllegalArgumentException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNull() { - addCriterion("identifier is null"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNotNull() { - addCriterion("identifier is not null"); - return (Criteria) this; - } - - public Criteria andIdentifierEqualTo(String value) { - addCriterion("identifier =", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotEqualTo(String value) { - addCriterion("identifier <>", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThan(String value) { - addCriterion("identifier >", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThanOrEqualTo(String value) { - addCriterion("identifier >=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThan(String value) { - addCriterion("identifier <", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThanOrEqualTo(String value) { - addCriterion("identifier <=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLike(String value) { - addCriterion("identifier like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotLike(String value) { - addCriterion("identifier not like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierIn(List values) { - addCriterion("identifier in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotIn(List values) { - addCriterion("identifier not in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierBetween(String value1, String value2) { - addCriterion("identifier between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotBetween(String value1, String value2) { - addCriterion("identifier not between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andActiveIsNull() { - addCriterion("active is null"); - return (Criteria) this; - } - - public Criteria andActiveIsNotNull() { - addCriterion("active is not null"); - return (Criteria) this; - } - - public Criteria andActiveEqualTo(Boolean value) { - addCriterion("active =", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveNotEqualTo(Boolean value) { - addCriterion("active <>", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveGreaterThan(Boolean value) { - addCriterion("active >", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveGreaterThanOrEqualTo(Boolean value) { - addCriterion("active >=", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveLessThan(Boolean value) { - addCriterion("active <", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveLessThanOrEqualTo(Boolean value) { - addCriterion("active <=", value, "active"); - return (Criteria) this; - } - - public Criteria andActiveIn(List values) { - addCriterion("active in", values, "active"); - return (Criteria) this; - } - - public Criteria andActiveNotIn(List values) { - addCriterion("active not in", values, "active"); - return (Criteria) this; - } - - public Criteria andActiveBetween(Boolean value1, Boolean value2) { - addCriterion("active between", value1, value2, "active"); - return (Criteria) this; - } - - public Criteria andActiveNotBetween(Boolean value1, Boolean value2) { - addCriterion("active not between", value1, value2, "active"); - return (Criteria) this; - } - - public Criteria andOrganizationIdIsNull() { - addCriterion("organization_id is null"); - return (Criteria) this; - } - - public Criteria andOrganizationIdIsNotNull() { - addCriterion("organization_id is not null"); - return (Criteria) this; - } - - public Criteria andOrganizationIdEqualTo(Long value) { - addCriterion("organization_id =", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotEqualTo(Long value) { - addCriterion("organization_id <>", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdGreaterThan(Long value) { - addCriterion("organization_id >", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdGreaterThanOrEqualTo(Long value) { - addCriterion("organization_id >=", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLessThan(Long value) { - addCriterion("organization_id <", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdLessThanOrEqualTo(Long value) { - addCriterion("organization_id <=", value, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdIn(List values) { - addCriterion("organization_id in", values, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotIn(List values) { - addCriterion("organization_id not in", values, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdBetween(Long value1, Long value2) { - addCriterion("organization_id between", value1, value2, "organizationId"); - return (Criteria) this; - } - - public Criteria andOrganizationIdNotBetween(Long value1, Long value2) { - addCriterion("organization_id not between", value1, value2, "organizationId"); - return (Criteria) this; - } - - public Criteria andPractitionerIdIsNull() { - addCriterion("practitioner_id is null"); - return (Criteria) this; - } - - public Criteria andPractitionerIdIsNotNull() { - addCriterion("practitioner_id is not null"); - return (Criteria) this; - } - - public Criteria andPractitionerIdEqualTo(Long value) { - addCriterion("practitioner_id =", value, "practitionerId"); - return (Criteria) this; - } - - public Criteria andPractitionerIdNotEqualTo(Long value) { - addCriterion("practitioner_id <>", value, "practitionerId"); - return (Criteria) this; - } - - public Criteria andPractitionerIdGreaterThan(Long value) { - addCriterion("practitioner_id >", value, "practitionerId"); - return (Criteria) this; - } - - public Criteria andPractitionerIdGreaterThanOrEqualTo(Long value) { - addCriterion("practitioner_id >=", value, "practitionerId"); - return (Criteria) this; - } - - public Criteria andPractitionerIdLessThan(Long value) { - addCriterion("practitioner_id <", value, "practitionerId"); - return (Criteria) this; - } - - public Criteria andPractitionerIdLessThanOrEqualTo(Long value) { - addCriterion("practitioner_id <=", value, "practitionerId"); - return (Criteria) this; - } - - public Criteria andPractitionerIdIn(List values) { - addCriterion("practitioner_id in", values, "practitionerId"); - return (Criteria) this; - } - - public Criteria andPractitionerIdNotIn(List values) { - addCriterion("practitioner_id not in", values, "practitionerId"); - return (Criteria) this; - } - - public Criteria andPractitionerIdBetween(Long value1, Long value2) { - addCriterion("practitioner_id between", value1, value2, "practitionerId"); - return (Criteria) this; - } - - public Criteria andPractitionerIdNotBetween(Long value1, Long value2) { - addCriterion("practitioner_id not between", value1, value2, "practitionerId"); - return (Criteria) this; - } - - public Criteria andCodeIsNull() { - addCriterion("code is null"); - return (Criteria) this; - } - - public Criteria andCodeIsNotNull() { - addCriterion("code is not null"); - return (Criteria) this; - } - - public Criteria andCodeEqualTo(String value) { - addCriterion("code =", value, "code"); - return (Criteria) this; - } - - public Criteria andCodeNotEqualTo(String value) { - addCriterion("code <>", value, "code"); - return (Criteria) this; - } - - public Criteria andCodeGreaterThan(String value) { - addCriterion("code >", value, "code"); - return (Criteria) this; - } - - public Criteria andCodeGreaterThanOrEqualTo(String value) { - addCriterion("code >=", value, "code"); - return (Criteria) this; - } - - public Criteria andCodeLessThan(String value) { - addCriterion("code <", value, "code"); - return (Criteria) this; - } - - public Criteria andCodeLessThanOrEqualTo(String value) { - addCriterion("code <=", value, "code"); - return (Criteria) this; - } - - public Criteria andCodeLike(String value) { - addCriterion("code like", value, "code"); - return (Criteria) this; - } - - public Criteria andCodeNotLike(String value) { - addCriterion("code not like", value, "code"); - return (Criteria) this; - } - - public Criteria andCodeIn(List values) { - addCriterion("code in", values, "code"); - return (Criteria) this; - } - - public Criteria andCodeNotIn(List values) { - addCriterion("code not in", values, "code"); - return (Criteria) this; - } - - public Criteria andCodeBetween(String value1, String value2) { - addCriterion("code between", value1, value2, "code"); - return (Criteria) this; - } - - public Criteria andCodeNotBetween(String value1, String value2) { - addCriterion("code not between", value1, value2, "code"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table team.practitioner_role - * - * @mbg.generated do_not_delete_during_merge Fri Aug 30 16:08:23 EAT 2019 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - public static class Criterion { - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Report.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Report.java deleted file mode 100644 index bccc7afa41..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Report.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.opensrp.domain.postgres; - -public class Report { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.report.id - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.report.json - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - private Object json; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.report.id - * - * @return the value of core.report.id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.report.id - * - * @param id the value for core.report.id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.report.json - * - * @return the value of core.report.json - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public Object getJson() { - return json; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.report.json - * - * @param json the value for core.report.json - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setJson(Object json) { - this.json = json; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ReportExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/ReportExample.java deleted file mode 100644 index 293d69a62a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ReportExample.java +++ /dev/null @@ -1,459 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class ReportExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public ReportExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List jsonCriteria; - - protected List allCriteria; - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - jsonCriteria = new ArrayList(); - } - - public List getJsonCriteria() { - return jsonCriteria; - } - - protected void addJsonCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value, "org.opensrp.repository.postgres.handler.ReportTypeHandler")); - allCriteria = null; - } - - protected void addJsonCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - jsonCriteria.add( - new Criterion(condition, value1, value2, "org.opensrp.repository.postgres.handler.ReportTypeHandler")); - allCriteria = null; - } - - public boolean isValid() { - return criteria.size() > 0 || jsonCriteria.size() > 0; - } - - public List getAllCriteria() { - if (allCriteria == null) { - allCriteria = new ArrayList(); - allCriteria.addAll(criteria); - allCriteria.addAll(jsonCriteria); - } - return allCriteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - allCriteria = null; - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andJsonIsNull() { - addCriterion("json is null"); - return (Criteria) this; - } - - public Criteria andJsonIsNotNull() { - addCriterion("json is not null"); - return (Criteria) this; - } - - public Criteria andJsonEqualTo(Object value) { - addJsonCriterion("json =", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotEqualTo(Object value) { - addJsonCriterion("json <>", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThan(Object value) { - addJsonCriterion("json >", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThanOrEqualTo(Object value) { - addJsonCriterion("json >=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThan(Object value) { - addJsonCriterion("json <", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThanOrEqualTo(Object value) { - addJsonCriterion("json <=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonIn(List values) { - addJsonCriterion("json in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotIn(List values) { - addJsonCriterion("json not in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonBetween(Object value1, Object value2) { - addJsonCriterion("json between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotBetween(Object value1, Object value2) { - addJsonCriterion("json not between", value1, value2, "json"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.report - * - * @mbg.generated do_not_delete_during_merge Wed Mar 07 18:26:22 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ReportMetadata.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/ReportMetadata.java deleted file mode 100644 index 871fb8b677..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ReportMetadata.java +++ /dev/null @@ -1,396 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.Date; - -public class ReportMetadata { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.report_metadata.id - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.report_metadata.report_id - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - private Long reportId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.report_metadata.document_id - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - private String documentId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.report_metadata.form_submission_id - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - private String formSubmissionId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.report_metadata.base_entity_id - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - private String baseEntityId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.report_metadata.server_version - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - private Long serverVersion; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.report_metadata.report_type - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - private String reportType; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.report_metadata.report_date - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - private Date reportDate; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.report_metadata.provider_id - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - private String providerId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.report_metadata.location_id - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - private String locationId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.report_metadata.team - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - private String team; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.report_metadata.team_id - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - private String teamId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.report_metadata.date_edited - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - private Date dateEdited; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.report_metadata.id - * - * @return the value of core.report_metadata.id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.report_metadata.id - * - * @param id the value for core.report_metadata.id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.report_metadata.report_id - * - * @return the value of core.report_metadata.report_id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public Long getReportId() { - return reportId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.report_metadata.report_id - * - * @param reportId the value for core.report_metadata.report_id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setReportId(Long reportId) { - this.reportId = reportId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.report_metadata.document_id - * - * @return the value of core.report_metadata.document_id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public String getDocumentId() { - return documentId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.report_metadata.document_id - * - * @param documentId the value for core.report_metadata.document_id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setDocumentId(String documentId) { - this.documentId = documentId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.report_metadata.form_submission_id - * - * @return the value of core.report_metadata.form_submission_id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public String getFormSubmissionId() { - return formSubmissionId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.report_metadata.form_submission_id - * - * @param formSubmissionId the value for core.report_metadata.form_submission_id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setFormSubmissionId(String formSubmissionId) { - this.formSubmissionId = formSubmissionId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.report_metadata.base_entity_id - * - * @return the value of core.report_metadata.base_entity_id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public String getBaseEntityId() { - return baseEntityId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.report_metadata.base_entity_id - * - * @param baseEntityId the value for core.report_metadata.base_entity_id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.report_metadata.server_version - * - * @return the value of core.report_metadata.server_version - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public Long getServerVersion() { - return serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.report_metadata.server_version - * - * @param serverVersion the value for core.report_metadata.server_version - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.report_metadata.report_type - * - * @return the value of core.report_metadata.report_type - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public String getReportType() { - return reportType; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.report_metadata.report_type - * - * @param reportType the value for core.report_metadata.report_type - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setReportType(String reportType) { - this.reportType = reportType; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.report_metadata.report_date - * - * @return the value of core.report_metadata.report_date - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public Date getReportDate() { - return reportDate; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.report_metadata.report_date - * - * @param reportDate the value for core.report_metadata.report_date - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setReportDate(Date reportDate) { - this.reportDate = reportDate; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.report_metadata.provider_id - * - * @return the value of core.report_metadata.provider_id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public String getProviderId() { - return providerId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.report_metadata.provider_id - * - * @param providerId the value for core.report_metadata.provider_id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.report_metadata.location_id - * - * @return the value of core.report_metadata.location_id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public String getLocationId() { - return locationId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.report_metadata.location_id - * - * @param locationId the value for core.report_metadata.location_id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setLocationId(String locationId) { - this.locationId = locationId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.report_metadata.team - * - * @return the value of core.report_metadata.team - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public String getTeam() { - return team; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.report_metadata.team - * - * @param team the value for core.report_metadata.team - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setTeam(String team) { - this.team = team; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.report_metadata.team_id - * - * @return the value of core.report_metadata.team_id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public String getTeamId() { - return teamId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.report_metadata.team_id - * - * @param teamId the value for core.report_metadata.team_id - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setTeamId(String teamId) { - this.teamId = teamId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.report_metadata.date_edited - * - * @return the value of core.report_metadata.date_edited - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public Date getDateEdited() { - return dateEdited; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.report_metadata.date_edited - * - * @param dateEdited the value for core.report_metadata.date_edited - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setDateEdited(Date dateEdited) { - this.dateEdited = dateEdited; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ReportMetadataExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/ReportMetadataExample.java deleted file mode 100644 index eec06f2961..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ReportMetadataExample.java +++ /dev/null @@ -1,1193 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -public class ReportMetadataExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public ReportMetadataExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - protected void addCriterionForJDBCDate(String condition, Date value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - addCriterion(condition, new java.sql.Date(value.getTime()), property); - } - - protected void addCriterionForJDBCDate(String condition, List values, String property) { - if (values == null || values.size() == 0) { - throw new RuntimeException("Value list for " + property + " cannot be null or empty"); - } - List dateList = new ArrayList(); - Iterator iter = values.iterator(); - while (iter.hasNext()) { - dateList.add(new java.sql.Date(iter.next().getTime())); - } - addCriterion(condition, dateList, property); - } - - protected void addCriterionForJDBCDate(String condition, Date value1, Date value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - addCriterion(condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andReportIdIsNull() { - addCriterion("report_id is null"); - return (Criteria) this; - } - - public Criteria andReportIdIsNotNull() { - addCriterion("report_id is not null"); - return (Criteria) this; - } - - public Criteria andReportIdEqualTo(Long value) { - addCriterion("report_id =", value, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdNotEqualTo(Long value) { - addCriterion("report_id <>", value, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdGreaterThan(Long value) { - addCriterion("report_id >", value, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdGreaterThanOrEqualTo(Long value) { - addCriterion("report_id >=", value, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdLessThan(Long value) { - addCriterion("report_id <", value, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdLessThanOrEqualTo(Long value) { - addCriterion("report_id <=", value, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdIn(List values) { - addCriterion("report_id in", values, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdNotIn(List values) { - addCriterion("report_id not in", values, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdBetween(Long value1, Long value2) { - addCriterion("report_id between", value1, value2, "reportId"); - return (Criteria) this; - } - - public Criteria andReportIdNotBetween(Long value1, Long value2) { - addCriterion("report_id not between", value1, value2, "reportId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNull() { - addCriterion("document_id is null"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNotNull() { - addCriterion("document_id is not null"); - return (Criteria) this; - } - - public Criteria andDocumentIdEqualTo(String value) { - addCriterion("document_id =", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotEqualTo(String value) { - addCriterion("document_id <>", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThan(String value) { - addCriterion("document_id >", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThanOrEqualTo(String value) { - addCriterion("document_id >=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThan(String value) { - addCriterion("document_id <", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThanOrEqualTo(String value) { - addCriterion("document_id <=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLike(String value) { - addCriterion("document_id like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotLike(String value) { - addCriterion("document_id not like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIn(List values) { - addCriterion("document_id in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotIn(List values) { - addCriterion("document_id not in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdBetween(String value1, String value2) { - addCriterion("document_id between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotBetween(String value1, String value2) { - addCriterion("document_id not between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdIsNull() { - addCriterion("form_submission_id is null"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdIsNotNull() { - addCriterion("form_submission_id is not null"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdEqualTo(String value) { - addCriterion("form_submission_id =", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdNotEqualTo(String value) { - addCriterion("form_submission_id <>", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdGreaterThan(String value) { - addCriterion("form_submission_id >", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdGreaterThanOrEqualTo(String value) { - addCriterion("form_submission_id >=", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdLessThan(String value) { - addCriterion("form_submission_id <", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdLessThanOrEqualTo(String value) { - addCriterion("form_submission_id <=", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdLike(String value) { - addCriterion("form_submission_id like", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdNotLike(String value) { - addCriterion("form_submission_id not like", value, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdIn(List values) { - addCriterion("form_submission_id in", values, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdNotIn(List values) { - addCriterion("form_submission_id not in", values, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdBetween(String value1, String value2) { - addCriterion("form_submission_id between", value1, value2, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andFormSubmissionIdNotBetween(String value1, String value2) { - addCriterion("form_submission_id not between", value1, value2, "formSubmissionId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdIsNull() { - addCriterion("base_entity_id is null"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdIsNotNull() { - addCriterion("base_entity_id is not null"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdEqualTo(String value) { - addCriterion("base_entity_id =", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotEqualTo(String value) { - addCriterion("base_entity_id <>", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdGreaterThan(String value) { - addCriterion("base_entity_id >", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdGreaterThanOrEqualTo(String value) { - addCriterion("base_entity_id >=", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdLessThan(String value) { - addCriterion("base_entity_id <", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdLessThanOrEqualTo(String value) { - addCriterion("base_entity_id <=", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdLike(String value) { - addCriterion("base_entity_id like", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotLike(String value) { - addCriterion("base_entity_id not like", value, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdIn(List values) { - addCriterion("base_entity_id in", values, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotIn(List values) { - addCriterion("base_entity_id not in", values, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdBetween(String value1, String value2) { - addCriterion("base_entity_id between", value1, value2, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andBaseEntityIdNotBetween(String value1, String value2) { - addCriterion("base_entity_id not between", value1, value2, "baseEntityId"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNull() { - addCriterion("server_version is null"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNotNull() { - addCriterion("server_version is not null"); - return (Criteria) this; - } - - public Criteria andServerVersionEqualTo(Long value) { - addCriterion("server_version =", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotEqualTo(Long value) { - addCriterion("server_version <>", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThan(Long value) { - addCriterion("server_version >", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThanOrEqualTo(Long value) { - addCriterion("server_version >=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThan(Long value) { - addCriterion("server_version <", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThanOrEqualTo(Long value) { - addCriterion("server_version <=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionIn(List values) { - addCriterion("server_version in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotIn(List values) { - addCriterion("server_version not in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionBetween(Long value1, Long value2) { - addCriterion("server_version between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotBetween(Long value1, Long value2) { - addCriterion("server_version not between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andReportTypeIsNull() { - addCriterion("report_type is null"); - return (Criteria) this; - } - - public Criteria andReportTypeIsNotNull() { - addCriterion("report_type is not null"); - return (Criteria) this; - } - - public Criteria andReportTypeEqualTo(String value) { - addCriterion("report_type =", value, "reportType"); - return (Criteria) this; - } - - public Criteria andReportTypeNotEqualTo(String value) { - addCriterion("report_type <>", value, "reportType"); - return (Criteria) this; - } - - public Criteria andReportTypeGreaterThan(String value) { - addCriterion("report_type >", value, "reportType"); - return (Criteria) this; - } - - public Criteria andReportTypeGreaterThanOrEqualTo(String value) { - addCriterion("report_type >=", value, "reportType"); - return (Criteria) this; - } - - public Criteria andReportTypeLessThan(String value) { - addCriterion("report_type <", value, "reportType"); - return (Criteria) this; - } - - public Criteria andReportTypeLessThanOrEqualTo(String value) { - addCriterion("report_type <=", value, "reportType"); - return (Criteria) this; - } - - public Criteria andReportTypeLike(String value) { - addCriterion("report_type like", value, "reportType"); - return (Criteria) this; - } - - public Criteria andReportTypeNotLike(String value) { - addCriterion("report_type not like", value, "reportType"); - return (Criteria) this; - } - - public Criteria andReportTypeIn(List values) { - addCriterion("report_type in", values, "reportType"); - return (Criteria) this; - } - - public Criteria andReportTypeNotIn(List values) { - addCriterion("report_type not in", values, "reportType"); - return (Criteria) this; - } - - public Criteria andReportTypeBetween(String value1, String value2) { - addCriterion("report_type between", value1, value2, "reportType"); - return (Criteria) this; - } - - public Criteria andReportTypeNotBetween(String value1, String value2) { - addCriterion("report_type not between", value1, value2, "reportType"); - return (Criteria) this; - } - - public Criteria andReportDateIsNull() { - addCriterion("report_date is null"); - return (Criteria) this; - } - - public Criteria andReportDateIsNotNull() { - addCriterion("report_date is not null"); - return (Criteria) this; - } - - public Criteria andReportDateEqualTo(Date value) { - addCriterionForJDBCDate("report_date =", value, "reportDate"); - return (Criteria) this; - } - - public Criteria andReportDateNotEqualTo(Date value) { - addCriterionForJDBCDate("report_date <>", value, "reportDate"); - return (Criteria) this; - } - - public Criteria andReportDateGreaterThan(Date value) { - addCriterionForJDBCDate("report_date >", value, "reportDate"); - return (Criteria) this; - } - - public Criteria andReportDateGreaterThanOrEqualTo(Date value) { - addCriterionForJDBCDate("report_date >=", value, "reportDate"); - return (Criteria) this; - } - - public Criteria andReportDateLessThan(Date value) { - addCriterionForJDBCDate("report_date <", value, "reportDate"); - return (Criteria) this; - } - - public Criteria andReportDateLessThanOrEqualTo(Date value) { - addCriterionForJDBCDate("report_date <=", value, "reportDate"); - return (Criteria) this; - } - - public Criteria andReportDateIn(List values) { - addCriterionForJDBCDate("report_date in", values, "reportDate"); - return (Criteria) this; - } - - public Criteria andReportDateNotIn(List values) { - addCriterionForJDBCDate("report_date not in", values, "reportDate"); - return (Criteria) this; - } - - public Criteria andReportDateBetween(Date value1, Date value2) { - addCriterionForJDBCDate("report_date between", value1, value2, "reportDate"); - return (Criteria) this; - } - - public Criteria andReportDateNotBetween(Date value1, Date value2) { - addCriterionForJDBCDate("report_date not between", value1, value2, "reportDate"); - return (Criteria) this; - } - - public Criteria andProviderIdIsNull() { - addCriterion("provider_id is null"); - return (Criteria) this; - } - - public Criteria andProviderIdIsNotNull() { - addCriterion("provider_id is not null"); - return (Criteria) this; - } - - public Criteria andProviderIdEqualTo(String value) { - addCriterion("provider_id =", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotEqualTo(String value) { - addCriterion("provider_id <>", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdGreaterThan(String value) { - addCriterion("provider_id >", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdGreaterThanOrEqualTo(String value) { - addCriterion("provider_id >=", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLessThan(String value) { - addCriterion("provider_id <", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLessThanOrEqualTo(String value) { - addCriterion("provider_id <=", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLike(String value) { - addCriterion("provider_id like", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotLike(String value) { - addCriterion("provider_id not like", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdIn(List values) { - addCriterion("provider_id in", values, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotIn(List values) { - addCriterion("provider_id not in", values, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdBetween(String value1, String value2) { - addCriterion("provider_id between", value1, value2, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotBetween(String value1, String value2) { - addCriterion("provider_id not between", value1, value2, "providerId"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNull() { - addCriterion("location_id is null"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNotNull() { - addCriterion("location_id is not null"); - return (Criteria) this; - } - - public Criteria andLocationIdEqualTo(String value) { - addCriterion("location_id =", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotEqualTo(String value) { - addCriterion("location_id <>", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThan(String value) { - addCriterion("location_id >", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThanOrEqualTo(String value) { - addCriterion("location_id >=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThan(String value) { - addCriterion("location_id <", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThanOrEqualTo(String value) { - addCriterion("location_id <=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLike(String value) { - addCriterion("location_id like", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotLike(String value) { - addCriterion("location_id not like", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdIn(List values) { - addCriterion("location_id in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotIn(List values) { - addCriterion("location_id not in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdBetween(String value1, String value2) { - addCriterion("location_id between", value1, value2, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotBetween(String value1, String value2) { - addCriterion("location_id not between", value1, value2, "locationId"); - return (Criteria) this; - } - - public Criteria andTeamIsNull() { - addCriterion("team is null"); - return (Criteria) this; - } - - public Criteria andTeamIsNotNull() { - addCriterion("team is not null"); - return (Criteria) this; - } - - public Criteria andTeamEqualTo(String value) { - addCriterion("team =", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotEqualTo(String value) { - addCriterion("team <>", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamGreaterThan(String value) { - addCriterion("team >", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamGreaterThanOrEqualTo(String value) { - addCriterion("team >=", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLessThan(String value) { - addCriterion("team <", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLessThanOrEqualTo(String value) { - addCriterion("team <=", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLike(String value) { - addCriterion("team like", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotLike(String value) { - addCriterion("team not like", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamIn(List values) { - addCriterion("team in", values, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotIn(List values) { - addCriterion("team not in", values, "team"); - return (Criteria) this; - } - - public Criteria andTeamBetween(String value1, String value2) { - addCriterion("team between", value1, value2, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotBetween(String value1, String value2) { - addCriterion("team not between", value1, value2, "team"); - return (Criteria) this; - } - - public Criteria andTeamIdIsNull() { - addCriterion("team_id is null"); - return (Criteria) this; - } - - public Criteria andTeamIdIsNotNull() { - addCriterion("team_id is not null"); - return (Criteria) this; - } - - public Criteria andTeamIdEqualTo(String value) { - addCriterion("team_id =", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotEqualTo(String value) { - addCriterion("team_id <>", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdGreaterThan(String value) { - addCriterion("team_id >", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdGreaterThanOrEqualTo(String value) { - addCriterion("team_id >=", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLessThan(String value) { - addCriterion("team_id <", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLessThanOrEqualTo(String value) { - addCriterion("team_id <=", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLike(String value) { - addCriterion("team_id like", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotLike(String value) { - addCriterion("team_id not like", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdIn(List values) { - addCriterion("team_id in", values, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotIn(List values) { - addCriterion("team_id not in", values, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdBetween(String value1, String value2) { - addCriterion("team_id between", value1, value2, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotBetween(String value1, String value2) { - addCriterion("team_id not between", value1, value2, "teamId"); - return (Criteria) this; - } - - public Criteria andDateEditedIsNull() { - addCriterion("date_edited is null"); - return (Criteria) this; - } - - public Criteria andDateEditedIsNotNull() { - addCriterion("date_edited is not null"); - return (Criteria) this; - } - - public Criteria andDateEditedEqualTo(Date value) { - addCriterionForJDBCDate("date_edited =", value, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedNotEqualTo(Date value) { - addCriterionForJDBCDate("date_edited <>", value, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedGreaterThan(Date value) { - addCriterionForJDBCDate("date_edited >", value, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedGreaterThanOrEqualTo(Date value) { - addCriterionForJDBCDate("date_edited >=", value, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedLessThan(Date value) { - addCriterionForJDBCDate("date_edited <", value, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedLessThanOrEqualTo(Date value) { - addCriterionForJDBCDate("date_edited <=", value, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedIn(List values) { - addCriterionForJDBCDate("date_edited in", values, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedNotIn(List values) { - addCriterionForJDBCDate("date_edited not in", values, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedBetween(Date value1, Date value2) { - addCriterionForJDBCDate("date_edited between", value1, value2, "dateEdited"); - return (Criteria) this; - } - - public Criteria andDateEditedNotBetween(Date value1, Date value2) { - addCriterionForJDBCDate("date_edited not between", value1, value2, "dateEdited"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.report_metadata - * - * @mbg.generated do_not_delete_during_merge Wed Mar 07 18:26:22 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Settings.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Settings.java deleted file mode 100644 index 931676a721..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Settings.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.opensrp.domain.postgres; - -public class Settings { - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column core.settings.id - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - private Long id; - - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column core.settings.json - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - private Object json; - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column core.settings.id - * - * @return the value of core.settings.id - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column core.settings.id - * - * @param id the value for core.settings.id - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column core.settings.json - * - * @return the value of core.settings.json - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - public Object getJson() { - return json; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column core.settings.json - * - * @param json the value for core.settings.json - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - public void setJson(Object json) { - this.json = json; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/SettingsExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/SettingsExample.java deleted file mode 100644 index 73652f6b33..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/SettingsExample.java +++ /dev/null @@ -1,456 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class SettingsExample { - /** - * This field was generated by MyBatis Generator. - * This field corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. - * This field corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. - * This field corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - public SettingsExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - protected List jsonCriteria; - - protected List allCriteria; - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - jsonCriteria = new ArrayList(); - } - - public List getJsonCriteria() { - return jsonCriteria; - } - - protected void addJsonCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value, "org.opensrp.repository.postgres.handler.SettingTypeHandler")); - allCriteria = null; - } - - protected void addJsonCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value1, value2, "org.opensrp.repository.postgres.handler.SettingTypeHandler")); - allCriteria = null; - } - - public boolean isValid() { - return criteria.size() > 0 - || jsonCriteria.size() > 0; - } - - public List getAllCriteria() { - if (allCriteria == null) { - allCriteria = new ArrayList(); - allCriteria.addAll(criteria); - allCriteria.addAll(jsonCriteria); - } - return allCriteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - allCriteria = null; - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andJsonIsNull() { - addCriterion("json is null"); - return (Criteria) this; - } - - public Criteria andJsonIsNotNull() { - addCriterion("json is not null"); - return (Criteria) this; - } - - public Criteria andJsonEqualTo(Object value) { - addJsonCriterion("json =", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotEqualTo(Object value) { - addJsonCriterion("json <>", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThan(Object value) { - addJsonCriterion("json >", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThanOrEqualTo(Object value) { - addJsonCriterion("json >=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThan(Object value) { - addJsonCriterion("json <", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThanOrEqualTo(Object value) { - addJsonCriterion("json <=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonIn(List values) { - addJsonCriterion("json in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotIn(List values) { - addJsonCriterion("json not in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonBetween(Object value1, Object value2) { - addJsonCriterion("json between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotBetween(Object value1, Object value2) { - addJsonCriterion("json not between", value1, value2, "json"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.settings - * - * @mbg.generated do_not_delete_during_merge Tue Sep 04 17:59:18 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - public static class Criterion { - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/SettingsMetadata.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/SettingsMetadata.java deleted file mode 100644 index 6a9725eb23..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/SettingsMetadata.java +++ /dev/null @@ -1,212 +0,0 @@ -package org.opensrp.domain.postgres; - -public class SettingsMetadata { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.settings_metadata.id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - private Long id; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.settings_metadata.settings_id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - private Long settingsId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.settings_metadata.document_id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - private String documentId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.settings_metadata.identifier - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - private String identifier; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.settings_metadata.server_version - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - private Long serverVersion; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.settings_metadata.team - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - private String team; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.settings_metadata.team_id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - private String teamId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.settings_metadata.provider_id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - private String providerId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.settings_metadata.location_id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - private String locationId; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.settings_metadata.id - * @return the value of core.settings_metadata.id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.settings_metadata.id - * @param id the value for core.settings_metadata.id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.settings_metadata.settings_id - * @return the value of core.settings_metadata.settings_id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public Long getSettingsId() { - return settingsId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.settings_metadata.settings_id - * @param settingsId the value for core.settings_metadata.settings_id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public void setSettingsId(Long settingsId) { - this.settingsId = settingsId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.settings_metadata.document_id - * @return the value of core.settings_metadata.document_id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public String getDocumentId() { - return documentId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.settings_metadata.document_id - * @param documentId the value for core.settings_metadata.document_id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public void setDocumentId(String documentId) { - this.documentId = documentId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.settings_metadata.identifier - * @return the value of core.settings_metadata.identifier - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public String getIdentifier() { - return identifier; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.settings_metadata.identifier - * @param identifier the value for core.settings_metadata.identifier - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.settings_metadata.server_version - * @return the value of core.settings_metadata.server_version - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public Long getServerVersion() { - return serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.settings_metadata.server_version - * @param serverVersion the value for core.settings_metadata.server_version - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.settings_metadata.team - * @return the value of core.settings_metadata.team - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public String getTeam() { - return team; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.settings_metadata.team - * @param team the value for core.settings_metadata.team - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public void setTeam(String team) { - this.team = team; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.settings_metadata.team_id - * @return the value of core.settings_metadata.team_id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public String getTeamId() { - return teamId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.settings_metadata.team_id - * @param teamId the value for core.settings_metadata.team_id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public void setTeamId(String teamId) { - this.teamId = teamId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.settings_metadata.provider_id - * @return the value of core.settings_metadata.provider_id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public String getProviderId() { - return providerId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.settings_metadata.provider_id - * @param providerId the value for core.settings_metadata.provider_id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.settings_metadata.location_id - * @return the value of core.settings_metadata.location_id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public String getLocationId() { - return locationId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.settings_metadata.location_id - * @param locationId the value for core.settings_metadata.location_id - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public void setLocationId(String locationId) { - this.locationId = locationId; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/SettingsMetadataExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/SettingsMetadataExample.java deleted file mode 100644 index 2b0bcd512b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/SettingsMetadataExample.java +++ /dev/null @@ -1,870 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class SettingsMetadataExample { - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - protected String orderByClause; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - protected boolean distinct; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public SettingsMetadataExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andSettingsIdIsNull() { - addCriterion("settings_id is null"); - return (Criteria) this; - } - - public Criteria andSettingsIdIsNotNull() { - addCriterion("settings_id is not null"); - return (Criteria) this; - } - - public Criteria andSettingsIdEqualTo(Long value) { - addCriterion("settings_id =", value, "settingsId"); - return (Criteria) this; - } - - public Criteria andSettingsIdNotEqualTo(Long value) { - addCriterion("settings_id <>", value, "settingsId"); - return (Criteria) this; - } - - public Criteria andSettingsIdGreaterThan(Long value) { - addCriterion("settings_id >", value, "settingsId"); - return (Criteria) this; - } - - public Criteria andSettingsIdGreaterThanOrEqualTo(Long value) { - addCriterion("settings_id >=", value, "settingsId"); - return (Criteria) this; - } - - public Criteria andSettingsIdLessThan(Long value) { - addCriterion("settings_id <", value, "settingsId"); - return (Criteria) this; - } - - public Criteria andSettingsIdLessThanOrEqualTo(Long value) { - addCriterion("settings_id <=", value, "settingsId"); - return (Criteria) this; - } - - public Criteria andSettingsIdIn(List values) { - addCriterion("settings_id in", values, "settingsId"); - return (Criteria) this; - } - - public Criteria andSettingsIdNotIn(List values) { - addCriterion("settings_id not in", values, "settingsId"); - return (Criteria) this; - } - - public Criteria andSettingsIdBetween(Long value1, Long value2) { - addCriterion("settings_id between", value1, value2, "settingsId"); - return (Criteria) this; - } - - public Criteria andSettingsIdNotBetween(Long value1, Long value2) { - addCriterion("settings_id not between", value1, value2, "settingsId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNull() { - addCriterion("document_id is null"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNotNull() { - addCriterion("document_id is not null"); - return (Criteria) this; - } - - public Criteria andDocumentIdEqualTo(String value) { - addCriterion("document_id =", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotEqualTo(String value) { - addCriterion("document_id <>", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThan(String value) { - addCriterion("document_id >", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThanOrEqualTo(String value) { - addCriterion("document_id >=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThan(String value) { - addCriterion("document_id <", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThanOrEqualTo(String value) { - addCriterion("document_id <=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLike(String value) { - addCriterion("document_id like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotLike(String value) { - addCriterion("document_id not like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIn(List values) { - addCriterion("document_id in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotIn(List values) { - addCriterion("document_id not in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdBetween(String value1, String value2) { - addCriterion("document_id between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotBetween(String value1, String value2) { - addCriterion("document_id not between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNull() { - addCriterion("identifier is null"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNotNull() { - addCriterion("identifier is not null"); - return (Criteria) this; - } - - public Criteria andIdentifierEqualTo(String value) { - addCriterion("identifier =", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotEqualTo(String value) { - addCriterion("identifier <>", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThan(String value) { - addCriterion("identifier >", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThanOrEqualTo(String value) { - addCriterion("identifier >=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThan(String value) { - addCriterion("identifier <", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThanOrEqualTo(String value) { - addCriterion("identifier <=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLike(String value) { - addCriterion("identifier like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotLike(String value) { - addCriterion("identifier not like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierIn(List values) { - addCriterion("identifier in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotIn(List values) { - addCriterion("identifier not in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierBetween(String value1, String value2) { - addCriterion("identifier between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotBetween(String value1, String value2) { - addCriterion("identifier not between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNull() { - addCriterion("server_version is null"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNotNull() { - addCriterion("server_version is not null"); - return (Criteria) this; - } - - public Criteria andServerVersionEqualTo(Long value) { - addCriterion("server_version =", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotEqualTo(Long value) { - addCriterion("server_version <>", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThan(Long value) { - addCriterion("server_version >", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThanOrEqualTo(Long value) { - addCriterion("server_version >=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThan(Long value) { - addCriterion("server_version <", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThanOrEqualTo(Long value) { - addCriterion("server_version <=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionIn(List values) { - addCriterion("server_version in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotIn(List values) { - addCriterion("server_version not in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionBetween(Long value1, Long value2) { - addCriterion("server_version between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotBetween(Long value1, Long value2) { - addCriterion("server_version not between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andTeamIsNull() { - addCriterion("team is null"); - return (Criteria) this; - } - - public Criteria andTeamIsNotNull() { - addCriterion("team is not null"); - return (Criteria) this; - } - - public Criteria andTeamEqualTo(String value) { - addCriterion("team =", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotEqualTo(String value) { - addCriterion("team <>", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamGreaterThan(String value) { - addCriterion("team >", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamGreaterThanOrEqualTo(String value) { - addCriterion("team >=", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLessThan(String value) { - addCriterion("team <", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLessThanOrEqualTo(String value) { - addCriterion("team <=", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLike(String value) { - addCriterion("team like", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotLike(String value) { - addCriterion("team not like", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamIn(List values) { - addCriterion("team in", values, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotIn(List values) { - addCriterion("team not in", values, "team"); - return (Criteria) this; - } - - public Criteria andTeamBetween(String value1, String value2) { - addCriterion("team between", value1, value2, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotBetween(String value1, String value2) { - addCriterion("team not between", value1, value2, "team"); - return (Criteria) this; - } - - public Criteria andTeamIdIsNull() { - addCriterion("team_id is null"); - return (Criteria) this; - } - - public Criteria andTeamIdIsNotNull() { - addCriterion("team_id is not null"); - return (Criteria) this; - } - - public Criteria andTeamIdEqualTo(String value) { - addCriterion("team_id =", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotEqualTo(String value) { - addCriterion("team_id <>", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdGreaterThan(String value) { - addCriterion("team_id >", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdGreaterThanOrEqualTo(String value) { - addCriterion("team_id >=", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLessThan(String value) { - addCriterion("team_id <", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLessThanOrEqualTo(String value) { - addCriterion("team_id <=", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLike(String value) { - addCriterion("team_id like", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotLike(String value) { - addCriterion("team_id not like", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdIn(List values) { - addCriterion("team_id in", values, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotIn(List values) { - addCriterion("team_id not in", values, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdBetween(String value1, String value2) { - addCriterion("team_id between", value1, value2, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotBetween(String value1, String value2) { - addCriterion("team_id not between", value1, value2, "teamId"); - return (Criteria) this; - } - - public Criteria andProviderIdIsNull() { - addCriterion("provider_id is null"); - return (Criteria) this; - } - - public Criteria andProviderIdIsNotNull() { - addCriterion("provider_id is not null"); - return (Criteria) this; - } - - public Criteria andProviderIdEqualTo(String value) { - addCriterion("provider_id =", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotEqualTo(String value) { - addCriterion("provider_id <>", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdGreaterThan(String value) { - addCriterion("provider_id >", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdGreaterThanOrEqualTo(String value) { - addCriterion("provider_id >=", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLessThan(String value) { - addCriterion("provider_id <", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLessThanOrEqualTo(String value) { - addCriterion("provider_id <=", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLike(String value) { - addCriterion("provider_id like", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotLike(String value) { - addCriterion("provider_id not like", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdIn(List values) { - addCriterion("provider_id in", values, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotIn(List values) { - addCriterion("provider_id not in", values, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdBetween(String value1, String value2) { - addCriterion("provider_id between", value1, value2, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotBetween(String value1, String value2) { - addCriterion("provider_id not between", value1, value2, "providerId"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNull() { - addCriterion("location_id is null"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNotNull() { - addCriterion("location_id is not null"); - return (Criteria) this; - } - - public Criteria andLocationIdEqualTo(String value) { - addCriterion("location_id =", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotEqualTo(String value) { - addCriterion("location_id <>", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThan(String value) { - addCriterion("location_id >", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThanOrEqualTo(String value) { - addCriterion("location_id >=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThan(String value) { - addCriterion("location_id <", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThanOrEqualTo(String value) { - addCriterion("location_id <=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLike(String value) { - addCriterion("location_id like", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotLike(String value) { - addCriterion("location_id not like", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdIn(List values) { - addCriterion("location_id in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotIn(List values) { - addCriterion("location_id not in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdBetween(String value1, String value2) { - addCriterion("location_id between", value1, value2, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotBetween(String value1, String value2) { - addCriterion("location_id not between", value1, value2, "locationId"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.settings_metadata - * - * @mbg.generated do_not_delete_during_merge Tue Sep 04 17:59:18 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Stock.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Stock.java deleted file mode 100644 index e2f632bf89..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Stock.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.opensrp.domain.postgres; - -public class Stock { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.stock.id - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.stock.json - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - private Object json; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.stock.id - * - * @return the value of core.stock.id - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.stock.id - * - * @param id the value for core.stock.id - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.stock.json - * - * @return the value of core.stock.json - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public Object getJson() { - return json; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.stock.json - * - * @param json the value for core.stock.json - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void setJson(Object json) { - this.json = json; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/StockExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/StockExample.java deleted file mode 100644 index 8071e0609c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/StockExample.java +++ /dev/null @@ -1,459 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class StockExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public StockExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List jsonCriteria; - - protected List allCriteria; - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - jsonCriteria = new ArrayList(); - } - - public List getJsonCriteria() { - return jsonCriteria; - } - - protected void addJsonCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value, "org.opensrp.repository.postgres.handler.StockTypeHandler")); - allCriteria = null; - } - - protected void addJsonCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - jsonCriteria.add( - new Criterion(condition, value1, value2, "org.opensrp.repository.postgres.handler.StockTypeHandler")); - allCriteria = null; - } - - public boolean isValid() { - return criteria.size() > 0 || jsonCriteria.size() > 0; - } - - public List getAllCriteria() { - if (allCriteria == null) { - allCriteria = new ArrayList(); - allCriteria.addAll(criteria); - allCriteria.addAll(jsonCriteria); - } - return allCriteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - allCriteria = null; - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andJsonIsNull() { - addCriterion("json is null"); - return (Criteria) this; - } - - public Criteria andJsonIsNotNull() { - addCriterion("json is not null"); - return (Criteria) this; - } - - public Criteria andJsonEqualTo(Object value) { - addJsonCriterion("json =", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotEqualTo(Object value) { - addJsonCriterion("json <>", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThan(Object value) { - addJsonCriterion("json >", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThanOrEqualTo(Object value) { - addJsonCriterion("json >=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThan(Object value) { - addJsonCriterion("json <", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThanOrEqualTo(Object value) { - addJsonCriterion("json <=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonIn(List values) { - addJsonCriterion("json in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotIn(List values) { - addJsonCriterion("json not in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonBetween(Object value1, Object value2) { - addJsonCriterion("json between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotBetween(Object value1, Object value2) { - addJsonCriterion("json not between", value1, value2, "json"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.stock - * - * @mbg.generated do_not_delete_during_merge Wed Mar 07 18:26:22 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/StockMetadata.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/StockMetadata.java deleted file mode 100644 index 41e3b3590d..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/StockMetadata.java +++ /dev/null @@ -1,244 +0,0 @@ -package org.opensrp.domain.postgres; - -public class StockMetadata { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.stock_metadata.id - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.stock_metadata.stock_id - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - private Long stockId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.stock_metadata.document_id - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - private String documentId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.stock_metadata.server_version - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - private Long serverVersion; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.stock_metadata.provider_id - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - private String providerId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.stock_metadata.location_id - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - private String locationId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.stock_metadata.team - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - private String team; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.stock_metadata.team_id - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - private String teamId; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.stock_metadata.id - * - * @return the value of core.stock_metadata.id - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.stock_metadata.id - * - * @param id the value for core.stock_metadata.id - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.stock_metadata.stock_id - * - * @return the value of core.stock_metadata.stock_id - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public Long getStockId() { - return stockId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.stock_metadata.stock_id - * - * @param stockId the value for core.stock_metadata.stock_id - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void setStockId(Long stockId) { - this.stockId = stockId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.stock_metadata.document_id - * - * @return the value of core.stock_metadata.document_id - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public String getDocumentId() { - return documentId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.stock_metadata.document_id - * - * @param documentId the value for core.stock_metadata.document_id - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void setDocumentId(String documentId) { - this.documentId = documentId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.stock_metadata.server_version - * - * @return the value of core.stock_metadata.server_version - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public Long getServerVersion() { - return serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.stock_metadata.server_version - * - * @param serverVersion the value for core.stock_metadata.server_version - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.stock_metadata.provider_id - * - * @return the value of core.stock_metadata.provider_id - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public String getProviderId() { - return providerId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.stock_metadata.provider_id - * - * @param providerId the value for core.stock_metadata.provider_id - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.stock_metadata.location_id - * - * @return the value of core.stock_metadata.location_id - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public String getLocationId() { - return locationId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.stock_metadata.location_id - * - * @param locationId the value for core.stock_metadata.location_id - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void setLocationId(String locationId) { - this.locationId = locationId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.stock_metadata.team - * - * @return the value of core.stock_metadata.team - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public String getTeam() { - return team; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.stock_metadata.team - * - * @param team the value for core.stock_metadata.team - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void setTeam(String team) { - this.team = team; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.stock_metadata.team_id - * - * @return the value of core.stock_metadata.team_id - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public String getTeamId() { - return teamId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.stock_metadata.team_id - * - * @param teamId the value for core.stock_metadata.team_id - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void setTeamId(String teamId) { - this.teamId = teamId; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/StockMetadataExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/StockMetadataExample.java deleted file mode 100644 index 22eb1e7a06..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/StockMetadataExample.java +++ /dev/null @@ -1,835 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class StockMetadataExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public StockMetadataExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andStockIdIsNull() { - addCriterion("stock_id is null"); - return (Criteria) this; - } - - public Criteria andStockIdIsNotNull() { - addCriterion("stock_id is not null"); - return (Criteria) this; - } - - public Criteria andStockIdEqualTo(Long value) { - addCriterion("stock_id =", value, "stockId"); - return (Criteria) this; - } - - public Criteria andStockIdNotEqualTo(Long value) { - addCriterion("stock_id <>", value, "stockId"); - return (Criteria) this; - } - - public Criteria andStockIdGreaterThan(Long value) { - addCriterion("stock_id >", value, "stockId"); - return (Criteria) this; - } - - public Criteria andStockIdGreaterThanOrEqualTo(Long value) { - addCriterion("stock_id >=", value, "stockId"); - return (Criteria) this; - } - - public Criteria andStockIdLessThan(Long value) { - addCriterion("stock_id <", value, "stockId"); - return (Criteria) this; - } - - public Criteria andStockIdLessThanOrEqualTo(Long value) { - addCriterion("stock_id <=", value, "stockId"); - return (Criteria) this; - } - - public Criteria andStockIdIn(List values) { - addCriterion("stock_id in", values, "stockId"); - return (Criteria) this; - } - - public Criteria andStockIdNotIn(List values) { - addCriterion("stock_id not in", values, "stockId"); - return (Criteria) this; - } - - public Criteria andStockIdBetween(Long value1, Long value2) { - addCriterion("stock_id between", value1, value2, "stockId"); - return (Criteria) this; - } - - public Criteria andStockIdNotBetween(Long value1, Long value2) { - addCriterion("stock_id not between", value1, value2, "stockId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNull() { - addCriterion("document_id is null"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNotNull() { - addCriterion("document_id is not null"); - return (Criteria) this; - } - - public Criteria andDocumentIdEqualTo(String value) { - addCriterion("document_id =", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotEqualTo(String value) { - addCriterion("document_id <>", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThan(String value) { - addCriterion("document_id >", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThanOrEqualTo(String value) { - addCriterion("document_id >=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThan(String value) { - addCriterion("document_id <", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThanOrEqualTo(String value) { - addCriterion("document_id <=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLike(String value) { - addCriterion("document_id like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotLike(String value) { - addCriterion("document_id not like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIn(List values) { - addCriterion("document_id in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotIn(List values) { - addCriterion("document_id not in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdBetween(String value1, String value2) { - addCriterion("document_id between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotBetween(String value1, String value2) { - addCriterion("document_id not between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNull() { - addCriterion("server_version is null"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNotNull() { - addCriterion("server_version is not null"); - return (Criteria) this; - } - - public Criteria andServerVersionEqualTo(Long value) { - addCriterion("server_version =", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotEqualTo(Long value) { - addCriterion("server_version <>", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThan(Long value) { - addCriterion("server_version >", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThanOrEqualTo(Long value) { - addCriterion("server_version >=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThan(Long value) { - addCriterion("server_version <", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThanOrEqualTo(Long value) { - addCriterion("server_version <=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionIn(List values) { - addCriterion("server_version in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotIn(List values) { - addCriterion("server_version not in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionBetween(Long value1, Long value2) { - addCriterion("server_version between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotBetween(Long value1, Long value2) { - addCriterion("server_version not between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andProviderIdIsNull() { - addCriterion("provider_id is null"); - return (Criteria) this; - } - - public Criteria andProviderIdIsNotNull() { - addCriterion("provider_id is not null"); - return (Criteria) this; - } - - public Criteria andProviderIdEqualTo(String value) { - addCriterion("provider_id =", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotEqualTo(String value) { - addCriterion("provider_id <>", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdGreaterThan(String value) { - addCriterion("provider_id >", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdGreaterThanOrEqualTo(String value) { - addCriterion("provider_id >=", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLessThan(String value) { - addCriterion("provider_id <", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLessThanOrEqualTo(String value) { - addCriterion("provider_id <=", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdLike(String value) { - addCriterion("provider_id like", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotLike(String value) { - addCriterion("provider_id not like", value, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdIn(List values) { - addCriterion("provider_id in", values, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotIn(List values) { - addCriterion("provider_id not in", values, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdBetween(String value1, String value2) { - addCriterion("provider_id between", value1, value2, "providerId"); - return (Criteria) this; - } - - public Criteria andProviderIdNotBetween(String value1, String value2) { - addCriterion("provider_id not between", value1, value2, "providerId"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNull() { - addCriterion("location_id is null"); - return (Criteria) this; - } - - public Criteria andLocationIdIsNotNull() { - addCriterion("location_id is not null"); - return (Criteria) this; - } - - public Criteria andLocationIdEqualTo(String value) { - addCriterion("location_id =", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotEqualTo(String value) { - addCriterion("location_id <>", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThan(String value) { - addCriterion("location_id >", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdGreaterThanOrEqualTo(String value) { - addCriterion("location_id >=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThan(String value) { - addCriterion("location_id <", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLessThanOrEqualTo(String value) { - addCriterion("location_id <=", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdLike(String value) { - addCriterion("location_id like", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotLike(String value) { - addCriterion("location_id not like", value, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdIn(List values) { - addCriterion("location_id in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotIn(List values) { - addCriterion("location_id not in", values, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdBetween(String value1, String value2) { - addCriterion("location_id between", value1, value2, "locationId"); - return (Criteria) this; - } - - public Criteria andLocationIdNotBetween(String value1, String value2) { - addCriterion("location_id not between", value1, value2, "locationId"); - return (Criteria) this; - } - - public Criteria andTeamIsNull() { - addCriterion("team is null"); - return (Criteria) this; - } - - public Criteria andTeamIsNotNull() { - addCriterion("team is not null"); - return (Criteria) this; - } - - public Criteria andTeamEqualTo(String value) { - addCriterion("team =", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotEqualTo(String value) { - addCriterion("team <>", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamGreaterThan(String value) { - addCriterion("team >", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamGreaterThanOrEqualTo(String value) { - addCriterion("team >=", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLessThan(String value) { - addCriterion("team <", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLessThanOrEqualTo(String value) { - addCriterion("team <=", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamLike(String value) { - addCriterion("team like", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotLike(String value) { - addCriterion("team not like", value, "team"); - return (Criteria) this; - } - - public Criteria andTeamIn(List values) { - addCriterion("team in", values, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotIn(List values) { - addCriterion("team not in", values, "team"); - return (Criteria) this; - } - - public Criteria andTeamBetween(String value1, String value2) { - addCriterion("team between", value1, value2, "team"); - return (Criteria) this; - } - - public Criteria andTeamNotBetween(String value1, String value2) { - addCriterion("team not between", value1, value2, "team"); - return (Criteria) this; - } - - public Criteria andTeamIdIsNull() { - addCriterion("team_id is null"); - return (Criteria) this; - } - - public Criteria andTeamIdIsNotNull() { - addCriterion("team_id is not null"); - return (Criteria) this; - } - - public Criteria andTeamIdEqualTo(String value) { - addCriterion("team_id =", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotEqualTo(String value) { - addCriterion("team_id <>", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdGreaterThan(String value) { - addCriterion("team_id >", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdGreaterThanOrEqualTo(String value) { - addCriterion("team_id >=", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLessThan(String value) { - addCriterion("team_id <", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLessThanOrEqualTo(String value) { - addCriterion("team_id <=", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdLike(String value) { - addCriterion("team_id like", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotLike(String value) { - addCriterion("team_id not like", value, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdIn(List values) { - addCriterion("team_id in", values, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotIn(List values) { - addCriterion("team_id not in", values, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdBetween(String value1, String value2) { - addCriterion("team_id between", value1, value2, "teamId"); - return (Criteria) this; - } - - public Criteria andTeamIdNotBetween(String value1, String value2) { - addCriterion("team_id not between", value1, value2, "teamId"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.stock_metadata - * - * @mbg.generated do_not_delete_during_merge Wed Mar 07 18:26:22 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Structure.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Structure.java deleted file mode 100644 index 74b685ecc1..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Structure.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.opensrp.domain.postgres; - -public class Structure { - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column core.structure.id - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - private Long id; - - /** - * - * This field was generated by MyBatis Generator. - * This field corresponds to the database column core.structure.json - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - private Object json; - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column core.structure.id - * - * @return the value of core.structure.id - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column core.structure.id - * - * @param id the value for core.structure.id - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. - * This method returns the value of the database column core.structure.json - * - * @return the value of core.structure.json - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public Object getJson() { - return json; - } - - /** - * This method was generated by MyBatis Generator. - * This method sets the value of the database column core.structure.json - * - * @param json the value for core.structure.json - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public void setJson(Object json) { - this.json = json; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/StructureExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/StructureExample.java deleted file mode 100644 index 4d9672f072..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/StructureExample.java +++ /dev/null @@ -1,456 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class StructureExample { - /** - * This field was generated by MyBatis Generator. - * This field corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. - * This field corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. - * This field corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public StructureExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - protected List jsonCriteria; - - protected List allCriteria; - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - jsonCriteria = new ArrayList(); - } - - public List getJsonCriteria() { - return jsonCriteria; - } - - protected void addJsonCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value, "org.opensrp.repository.postgres.handler.LocationTypeHandler")); - allCriteria = null; - } - - protected void addJsonCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value1, value2, "org.opensrp.repository.postgres.handler.LocationTypeHandler")); - allCriteria = null; - } - - public boolean isValid() { - return criteria.size() > 0 - || jsonCriteria.size() > 0; - } - - public List getAllCriteria() { - if (allCriteria == null) { - allCriteria = new ArrayList(); - allCriteria.addAll(criteria); - allCriteria.addAll(jsonCriteria); - } - return allCriteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new IllegalArgumentException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - allCriteria = null; - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andJsonIsNull() { - addCriterion("json is null"); - return (Criteria) this; - } - - public Criteria andJsonIsNotNull() { - addCriterion("json is not null"); - return (Criteria) this; - } - - public Criteria andJsonEqualTo(Object value) { - addJsonCriterion("json =", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotEqualTo(Object value) { - addJsonCriterion("json <>", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThan(Object value) { - addJsonCriterion("json >", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThanOrEqualTo(Object value) { - addJsonCriterion("json >=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThan(Object value) { - addJsonCriterion("json <", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThanOrEqualTo(Object value) { - addJsonCriterion("json <=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonIn(List values) { - addJsonCriterion("json in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotIn(List values) { - addJsonCriterion("json not in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonBetween(Object value1, Object value2) { - addJsonCriterion("json between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotBetween(Object value1, Object value2) { - addJsonCriterion("json not between", value1, value2, "json"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.structure - * - * @mbg.generated do_not_delete_during_merge Thu Nov 15 15:55:07 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - public static class Criterion { - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/StructureFamilyDetails.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/StructureFamilyDetails.java deleted file mode 100644 index 29eb7d66c0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/StructureFamilyDetails.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.opensrp.domain.postgres; - -public class StructureFamilyDetails { - - private String id; - - private String parentId; - - private String type; - - private String baseEntityId; - - private String relationalId; - - private String lastName; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getParentId() { - return parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getBaseEntityId() { - return baseEntityId; - } - - public void setBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - } - - public String getRelationalId() { - return relationalId; - } - - public void setRelationalId(String relationalId) { - this.relationalId = relationalId; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/StructureMetadata.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/StructureMetadata.java deleted file mode 100644 index 398357a20e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/StructureMetadata.java +++ /dev/null @@ -1,212 +0,0 @@ -package org.opensrp.domain.postgres; - -public class StructureMetadata { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.structure_metadata.id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private Long id; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.structure_metadata.structure_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private Long structureId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.structure_metadata.geojson_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private String geojsonId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.structure_metadata.type - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private String type; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.structure_metadata.parent_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private String parentId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.structure_metadata.uuid - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private String uuid; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.structure_metadata.status - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private String status; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.structure_metadata.server_version - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private Long serverVersion; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.structure_metadata.name - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - private String name; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.structure_metadata.id - * @return the value of core.structure_metadata.id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.structure_metadata.id - * @param id the value for core.structure_metadata.id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.structure_metadata.structure_id - * @return the value of core.structure_metadata.structure_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public Long getStructureId() { - return structureId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.structure_metadata.structure_id - * @param structureId the value for core.structure_metadata.structure_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setStructureId(Long structureId) { - this.structureId = structureId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.structure_metadata.geojson_id - * @return the value of core.structure_metadata.geojson_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public String getGeojsonId() { - return geojsonId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.structure_metadata.geojson_id - * @param geojsonId the value for core.structure_metadata.geojson_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setGeojsonId(String geojsonId) { - this.geojsonId = geojsonId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.structure_metadata.type - * @return the value of core.structure_metadata.type - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public String getType() { - return type; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.structure_metadata.type - * @param type the value for core.structure_metadata.type - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setType(String type) { - this.type = type; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.structure_metadata.parent_id - * @return the value of core.structure_metadata.parent_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public String getParentId() { - return parentId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.structure_metadata.parent_id - * @param parentId the value for core.structure_metadata.parent_id - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setParentId(String parentId) { - this.parentId = parentId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.structure_metadata.uuid - * @return the value of core.structure_metadata.uuid - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public String getUuid() { - return uuid; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.structure_metadata.uuid - * @param uuid the value for core.structure_metadata.uuid - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setUuid(String uuid) { - this.uuid = uuid; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.structure_metadata.status - * @return the value of core.structure_metadata.status - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public String getStatus() { - return status; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.structure_metadata.status - * @param status the value for core.structure_metadata.status - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setStatus(String status) { - this.status = status; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.structure_metadata.server_version - * @return the value of core.structure_metadata.server_version - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public Long getServerVersion() { - return serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.structure_metadata.server_version - * @param serverVersion the value for core.structure_metadata.server_version - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.structure_metadata.name - * @return the value of core.structure_metadata.name - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public String getName() { - return name; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.structure_metadata.name - * @param name the value for core.structure_metadata.name - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setName(String name) { - this.name = name; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/StructureMetadataExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/StructureMetadataExample.java deleted file mode 100644 index 9ce834f12e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/StructureMetadataExample.java +++ /dev/null @@ -1,861 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class StructureMetadataExample { - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - protected String orderByClause; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - protected boolean distinct; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public StructureMetadataExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new IllegalArgumentException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andStructureIdIsNull() { - addCriterion("structure_id is null"); - return (Criteria) this; - } - - public Criteria andStructureIdIsNotNull() { - addCriterion("structure_id is not null"); - return (Criteria) this; - } - - public Criteria andStructureIdEqualTo(Long value) { - addCriterion("structure_id =", value, "structureId"); - return (Criteria) this; - } - - public Criteria andStructureIdNotEqualTo(Long value) { - addCriterion("structure_id <>", value, "structureId"); - return (Criteria) this; - } - - public Criteria andStructureIdGreaterThan(Long value) { - addCriterion("structure_id >", value, "structureId"); - return (Criteria) this; - } - - public Criteria andStructureIdGreaterThanOrEqualTo(Long value) { - addCriterion("structure_id >=", value, "structureId"); - return (Criteria) this; - } - - public Criteria andStructureIdLessThan(Long value) { - addCriterion("structure_id <", value, "structureId"); - return (Criteria) this; - } - - public Criteria andStructureIdLessThanOrEqualTo(Long value) { - addCriterion("structure_id <=", value, "structureId"); - return (Criteria) this; - } - - public Criteria andStructureIdIn(List values) { - addCriterion("structure_id in", values, "structureId"); - return (Criteria) this; - } - - public Criteria andStructureIdNotIn(List values) { - addCriterion("structure_id not in", values, "structureId"); - return (Criteria) this; - } - - public Criteria andStructureIdBetween(Long value1, Long value2) { - addCriterion("structure_id between", value1, value2, "structureId"); - return (Criteria) this; - } - - public Criteria andStructureIdNotBetween(Long value1, Long value2) { - addCriterion("structure_id not between", value1, value2, "structureId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdIsNull() { - addCriterion("geojson_id is null"); - return (Criteria) this; - } - - public Criteria andGeojsonIdIsNotNull() { - addCriterion("geojson_id is not null"); - return (Criteria) this; - } - - public Criteria andGeojsonIdEqualTo(String value) { - addCriterion("geojson_id =", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdNotEqualTo(String value) { - addCriterion("geojson_id <>", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdGreaterThan(String value) { - addCriterion("geojson_id >", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdGreaterThanOrEqualTo(String value) { - addCriterion("geojson_id >=", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdLessThan(String value) { - addCriterion("geojson_id <", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdLessThanOrEqualTo(String value) { - addCriterion("geojson_id <=", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdLike(String value) { - addCriterion("geojson_id like", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdNotLike(String value) { - addCriterion("geojson_id not like", value, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdIn(List values) { - addCriterion("geojson_id in", values, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdNotIn(List values) { - addCriterion("geojson_id not in", values, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdBetween(String value1, String value2) { - addCriterion("geojson_id between", value1, value2, "geojsonId"); - return (Criteria) this; - } - - public Criteria andGeojsonIdNotBetween(String value1, String value2) { - addCriterion("geojson_id not between", value1, value2, "geojsonId"); - return (Criteria) this; - } - - public Criteria andTypeIsNull() { - addCriterion("type is null"); - return (Criteria) this; - } - - public Criteria andTypeIsNotNull() { - addCriterion("type is not null"); - return (Criteria) this; - } - - public Criteria andTypeEqualTo(String value) { - addCriterion("type =", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotEqualTo(String value) { - addCriterion("type <>", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeGreaterThan(String value) { - addCriterion("type >", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeGreaterThanOrEqualTo(String value) { - addCriterion("type >=", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeLessThan(String value) { - addCriterion("type <", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeLessThanOrEqualTo(String value) { - addCriterion("type <=", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeLike(String value) { - addCriterion("type like", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotLike(String value) { - addCriterion("type not like", value, "type"); - return (Criteria) this; - } - - public Criteria andTypeIn(List values) { - addCriterion("type in", values, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotIn(List values) { - addCriterion("type not in", values, "type"); - return (Criteria) this; - } - - public Criteria andTypeBetween(String value1, String value2) { - addCriterion("type between", value1, value2, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotBetween(String value1, String value2) { - addCriterion("type not between", value1, value2, "type"); - return (Criteria) this; - } - - public Criteria andParentIdIsNull() { - addCriterion("parent_id is null"); - return (Criteria) this; - } - - public Criteria andParentIdIsNotNull() { - addCriterion("parent_id is not null"); - return (Criteria) this; - } - - public Criteria andParentIdEqualTo(String value) { - addCriterion("parent_id =", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdNotEqualTo(String value) { - addCriterion("parent_id <>", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdGreaterThan(String value) { - addCriterion("parent_id >", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdGreaterThanOrEqualTo(String value) { - addCriterion("parent_id >=", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdLessThan(String value) { - addCriterion("parent_id <", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdLessThanOrEqualTo(String value) { - addCriterion("parent_id <=", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdLike(String value) { - addCriterion("parent_id like", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdNotLike(String value) { - addCriterion("parent_id not like", value, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdIn(List values) { - addCriterion("parent_id in", values, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdNotIn(List values) { - addCriterion("parent_id not in", values, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdBetween(String value1, String value2) { - addCriterion("parent_id between", value1, value2, "parentId"); - return (Criteria) this; - } - - public Criteria andParentIdNotBetween(String value1, String value2) { - addCriterion("parent_id not between", value1, value2, "parentId"); - return (Criteria) this; - } - - public Criteria andUuidIsNull() { - addCriterion("uuid is null"); - return (Criteria) this; - } - - public Criteria andUuidIsNotNull() { - addCriterion("uuid is not null"); - return (Criteria) this; - } - - public Criteria andUuidEqualTo(String value) { - addCriterion("uuid =", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidNotEqualTo(String value) { - addCriterion("uuid <>", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidGreaterThan(String value) { - addCriterion("uuid >", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidGreaterThanOrEqualTo(String value) { - addCriterion("uuid >=", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidLessThan(String value) { - addCriterion("uuid <", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidLessThanOrEqualTo(String value) { - addCriterion("uuid <=", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidLike(String value) { - addCriterion("uuid like", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidNotLike(String value) { - addCriterion("uuid not like", value, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidIn(List values) { - addCriterion("uuid in", values, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidNotIn(List values) { - addCriterion("uuid not in", values, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidBetween(String value1, String value2) { - addCriterion("uuid between", value1, value2, "uuid"); - return (Criteria) this; - } - - public Criteria andUuidNotBetween(String value1, String value2) { - addCriterion("uuid not between", value1, value2, "uuid"); - return (Criteria) this; - } - - public Criteria andStatusIsNull() { - addCriterion("status is null"); - return (Criteria) this; - } - - public Criteria andStatusIsNotNull() { - addCriterion("status is not null"); - return (Criteria) this; - } - - public Criteria andStatusEqualTo(String value) { - addCriterion("status =", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotEqualTo(String value) { - addCriterion("status <>", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusGreaterThan(String value) { - addCriterion("status >", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusGreaterThanOrEqualTo(String value) { - addCriterion("status >=", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusLessThan(String value) { - addCriterion("status <", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusLessThanOrEqualTo(String value) { - addCriterion("status <=", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusLike(String value) { - addCriterion("status like", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotLike(String value) { - addCriterion("status not like", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusIn(List values) { - addCriterion("status in", values, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotIn(List values) { - addCriterion("status not in", values, "status"); - return (Criteria) this; - } - - public Criteria andStatusBetween(String value1, String value2) { - addCriterion("status between", value1, value2, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotBetween(String value1, String value2) { - addCriterion("status not between", value1, value2, "status"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNull() { - addCriterion("server_version is null"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNotNull() { - addCriterion("server_version is not null"); - return (Criteria) this; - } - - public Criteria andServerVersionEqualTo(Long value) { - addCriterion("server_version =", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotEqualTo(Long value) { - addCriterion("server_version <>", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThan(Long value) { - addCriterion("server_version >", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThanOrEqualTo(Long value) { - addCriterion("server_version >=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThan(Long value) { - addCriterion("server_version <", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThanOrEqualTo(Long value) { - addCriterion("server_version <=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionIn(List values) { - addCriterion("server_version in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotIn(List values) { - addCriterion("server_version not in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionBetween(Long value1, Long value2) { - addCriterion("server_version between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotBetween(Long value1, Long value2) { - addCriterion("server_version not between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andNameIsNull() { - addCriterion("name is null"); - return (Criteria) this; - } - - public Criteria andNameIsNotNull() { - addCriterion("name is not null"); - return (Criteria) this; - } - - public Criteria andNameEqualTo(String value) { - addCriterion("name =", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotEqualTo(String value) { - addCriterion("name <>", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThan(String value) { - addCriterion("name >", value, "name"); - return (Criteria) this; - } - - public Criteria andNameGreaterThanOrEqualTo(String value) { - addCriterion("name >=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThan(String value) { - addCriterion("name <", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLessThanOrEqualTo(String value) { - addCriterion("name <=", value, "name"); - return (Criteria) this; - } - - public Criteria andNameLike(String value) { - addCriterion("name like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameNotLike(String value) { - addCriterion("name not like", value, "name"); - return (Criteria) this; - } - - public Criteria andNameIn(List values) { - addCriterion("name in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameNotIn(List values) { - addCriterion("name not in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameBetween(String value1, String value2) { - addCriterion("name between", value1, value2, "name"); - return (Criteria) this; - } - - public Criteria andNameNotBetween(String value1, String value2) { - addCriterion("name not between", value1, value2, "name"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - public static class Criterion { - private String condition; - private Object value; - private Object secondValue; - private boolean noValue; - private boolean singleValue; - private boolean betweenValue; - private boolean listValue; - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.structure_metadata - * - * @mbg.generated do_not_delete_during_merge Thu Nov 15 15:55:07 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Task.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Task.java deleted file mode 100644 index f52a55d1f0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/Task.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.opensrp.domain.postgres; - -public class Task { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.task.id - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - private Long id; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.task.json - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - private Object json; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.task.id - * @return the value of core.task.id - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.task.id - * @param id the value for core.task.id - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.task.json - * @return the value of core.task.json - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public Object getJson() { - return json; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.task.json - * @param json the value for core.task.json - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void setJson(Object json) { - this.json = json; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/TaskExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/TaskExample.java deleted file mode 100644 index 0baacba9a3..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/TaskExample.java +++ /dev/null @@ -1,414 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class TaskExample { - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - protected String orderByClause; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - protected boolean distinct; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public TaskExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - protected List jsonCriteria; - protected List allCriteria; - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - jsonCriteria = new ArrayList(); - } - - public List getJsonCriteria() { - return jsonCriteria; - } - - protected void addJsonCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - jsonCriteria - .add(new Criterion(condition, value, "org.opensrp.repository.postgres.handler.TaskTypeHandler")); - allCriteria = null; - } - - protected void addJsonCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value1, value2, - "org.opensrp.repository.postgres.handler.TaskTypeHandler")); - allCriteria = null; - } - - public boolean isValid() { - return criteria.size() > 0 || jsonCriteria.size() > 0; - } - - public List getAllCriteria() { - if (allCriteria == null) { - allCriteria = new ArrayList(); - allCriteria.addAll(criteria); - allCriteria.addAll(jsonCriteria); - } - return allCriteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new IllegalArgumentException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - allCriteria = null; - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andJsonIsNull() { - addCriterion("json is null"); - return (Criteria) this; - } - - public Criteria andJsonIsNotNull() { - addCriterion("json is not null"); - return (Criteria) this; - } - - public Criteria andJsonEqualTo(Object value) { - addJsonCriterion("json =", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotEqualTo(Object value) { - addJsonCriterion("json <>", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThan(Object value) { - addJsonCriterion("json >", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThanOrEqualTo(Object value) { - addJsonCriterion("json >=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThan(Object value) { - addJsonCriterion("json <", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThanOrEqualTo(Object value) { - addJsonCriterion("json <=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonIn(List values) { - addJsonCriterion("json in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotIn(List values) { - addJsonCriterion("json not in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonBetween(Object value1, Object value2) { - addJsonCriterion("json between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotBetween(Object value1, Object value2) { - addJsonCriterion("json not between", value1, value2, "json"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - public static class Criterion { - private String condition; - private Object value; - private Object secondValue; - private boolean noValue; - private boolean singleValue; - private boolean betweenValue; - private boolean listValue; - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.task - * - * @mbg.generated do_not_delete_during_merge Fri Nov 09 11:35:21 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/TaskMetadata.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/TaskMetadata.java deleted file mode 100644 index 640d2427db..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/TaskMetadata.java +++ /dev/null @@ -1,166 +0,0 @@ -package org.opensrp.domain.postgres; - -public class TaskMetadata { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.task_metadata.id - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - private Long id; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.task_metadata.task_id - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - private Long taskId; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.task_metadata.identifier - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - private String identifier; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.task_metadata.plan_identifier - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - private String planIdentifier; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.task_metadata.group_identifier - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - private String groupIdentifier; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.task_metadata.for_entity - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - private String forEntity; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column core.task_metadata.server_version - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - private Long serverVersion; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.task_metadata.id - * @return the value of core.task_metadata.id - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.task_metadata.id - * @param id the value for core.task_metadata.id - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.task_metadata.task_id - * @return the value of core.task_metadata.task_id - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public Long getTaskId() { - return taskId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.task_metadata.task_id - * @param taskId the value for core.task_metadata.task_id - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public void setTaskId(Long taskId) { - this.taskId = taskId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.task_metadata.identifier - * @return the value of core.task_metadata.identifier - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public String getIdentifier() { - return identifier; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.task_metadata.identifier - * @param identifier the value for core.task_metadata.identifier - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.task_metadata.plan_identifier - * @return the value of core.task_metadata.plan_identifier - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public String getPlanIdentifier() { - return planIdentifier; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.task_metadata.plan_identifier - * @param planIdentifier the value for core.task_metadata.plan_identifier - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public void setPlanIdentifier(String planIdentifier) { - this.planIdentifier = planIdentifier; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.task_metadata.group_identifier - * @return the value of core.task_metadata.group_identifier - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public String getGroupIdentifier() { - return groupIdentifier; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.task_metadata.group_identifier - * @param groupIdentifier the value for core.task_metadata.group_identifier - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public void setGroupIdentifier(String groupIdentifier) { - this.groupIdentifier = groupIdentifier; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.task_metadata.for_entity - * @return the value of core.task_metadata.for_entity - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public String getForEntity() { - return forEntity; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.task_metadata.for_entity - * @param forEntity the value for core.task_metadata.for_entity - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public void setForEntity(String forEntity) { - this.forEntity = forEntity; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database column core.task_metadata.server_version - * @return the value of core.task_metadata.server_version - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public Long getServerVersion() { - return serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database column core.task_metadata.server_version - * @param serverVersion the value for core.task_metadata.server_version - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/TaskMetadataExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/TaskMetadataExample.java deleted file mode 100644 index 738a6ae458..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/TaskMetadataExample.java +++ /dev/null @@ -1,721 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class TaskMetadataExample { - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - protected String orderByClause; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - protected boolean distinct; - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public TaskMetadataExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new IllegalArgumentException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new IllegalArgumentException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new IllegalArgumentException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andTaskIdIsNull() { - addCriterion("task_id is null"); - return (Criteria) this; - } - - public Criteria andTaskIdIsNotNull() { - addCriterion("task_id is not null"); - return (Criteria) this; - } - - public Criteria andTaskIdEqualTo(Long value) { - addCriterion("task_id =", value, "taskId"); - return (Criteria) this; - } - - public Criteria andTaskIdNotEqualTo(Long value) { - addCriterion("task_id <>", value, "taskId"); - return (Criteria) this; - } - - public Criteria andTaskIdGreaterThan(Long value) { - addCriterion("task_id >", value, "taskId"); - return (Criteria) this; - } - - public Criteria andTaskIdGreaterThanOrEqualTo(Long value) { - addCriterion("task_id >=", value, "taskId"); - return (Criteria) this; - } - - public Criteria andTaskIdLessThan(Long value) { - addCriterion("task_id <", value, "taskId"); - return (Criteria) this; - } - - public Criteria andTaskIdLessThanOrEqualTo(Long value) { - addCriterion("task_id <=", value, "taskId"); - return (Criteria) this; - } - - public Criteria andTaskIdIn(List values) { - addCriterion("task_id in", values, "taskId"); - return (Criteria) this; - } - - public Criteria andTaskIdNotIn(List values) { - addCriterion("task_id not in", values, "taskId"); - return (Criteria) this; - } - - public Criteria andTaskIdBetween(Long value1, Long value2) { - addCriterion("task_id between", value1, value2, "taskId"); - return (Criteria) this; - } - - public Criteria andTaskIdNotBetween(Long value1, Long value2) { - addCriterion("task_id not between", value1, value2, "taskId"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNull() { - addCriterion("identifier is null"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNotNull() { - addCriterion("identifier is not null"); - return (Criteria) this; - } - - public Criteria andIdentifierEqualTo(String value) { - addCriterion("identifier =", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotEqualTo(String value) { - addCriterion("identifier <>", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThan(String value) { - addCriterion("identifier >", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThanOrEqualTo(String value) { - addCriterion("identifier >=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThan(String value) { - addCriterion("identifier <", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThanOrEqualTo(String value) { - addCriterion("identifier <=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLike(String value) { - addCriterion("identifier like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotLike(String value) { - addCriterion("identifier not like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierIn(List values) { - addCriterion("identifier in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotIn(List values) { - addCriterion("identifier not in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierBetween(String value1, String value2) { - addCriterion("identifier between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotBetween(String value1, String value2) { - addCriterion("identifier not between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andPlanIdentifierIsNull() { - addCriterion("plan_identifier is null"); - return (Criteria) this; - } - - public Criteria andPlanIdentifierIsNotNull() { - addCriterion("plan_identifier is not null"); - return (Criteria) this; - } - - public Criteria andPlanIdentifierEqualTo(String value) { - addCriterion("plan_identifier =", value, "planIdentifier"); - return (Criteria) this; - } - - public Criteria andPlanIdentifierNotEqualTo(String value) { - addCriterion("plan_identifier <>", value, "planIdentifier"); - return (Criteria) this; - } - - public Criteria andPlanIdentifierGreaterThan(String value) { - addCriterion("plan_identifier >", value, "planIdentifier"); - return (Criteria) this; - } - - public Criteria andPlanIdentifierGreaterThanOrEqualTo(String value) { - addCriterion("plan_identifier >=", value, "planIdentifier"); - return (Criteria) this; - } - - public Criteria andPlanIdentifierLessThan(String value) { - addCriterion("plan_identifier <", value, "planIdentifier"); - return (Criteria) this; - } - - public Criteria andPlanIdentifierLessThanOrEqualTo(String value) { - addCriterion("plan_identifier <=", value, "planIdentifier"); - return (Criteria) this; - } - - public Criteria andPlanIdentifierLike(String value) { - addCriterion("plan_identifier like", value, "planIdentifier"); - return (Criteria) this; - } - - public Criteria andPlanIdentifierNotLike(String value) { - addCriterion("plan_identifier not like", value, "planIdentifier"); - return (Criteria) this; - } - - public Criteria andPlanIdentifierIn(List values) { - addCriterion("plan_identifier in", values, "planIdentifier"); - return (Criteria) this; - } - - public Criteria andPlanIdentifierNotIn(List values) { - addCriterion("plan_identifier not in", values, "planIdentifier"); - return (Criteria) this; - } - - public Criteria andPlanIdentifierBetween(String value1, String value2) { - addCriterion("plan_identifier between", value1, value2, "planIdentifier"); - return (Criteria) this; - } - - public Criteria andPlanIdentifierNotBetween(String value1, String value2) { - addCriterion("plan_identifier not between", value1, value2, "planIdentifier"); - return (Criteria) this; - } - - public Criteria andGroupIdentifierIsNull() { - addCriterion("group_identifier is null"); - return (Criteria) this; - } - - public Criteria andGroupIdentifierIsNotNull() { - addCriterion("group_identifier is not null"); - return (Criteria) this; - } - - public Criteria andGroupIdentifierEqualTo(String value) { - addCriterion("group_identifier =", value, "groupIdentifier"); - return (Criteria) this; - } - - public Criteria andGroupIdentifierNotEqualTo(String value) { - addCriterion("group_identifier <>", value, "groupIdentifier"); - return (Criteria) this; - } - - public Criteria andGroupIdentifierGreaterThan(String value) { - addCriterion("group_identifier >", value, "groupIdentifier"); - return (Criteria) this; - } - - public Criteria andGroupIdentifierGreaterThanOrEqualTo(String value) { - addCriterion("group_identifier >=", value, "groupIdentifier"); - return (Criteria) this; - } - - public Criteria andGroupIdentifierLessThan(String value) { - addCriterion("group_identifier <", value, "groupIdentifier"); - return (Criteria) this; - } - - public Criteria andGroupIdentifierLessThanOrEqualTo(String value) { - addCriterion("group_identifier <=", value, "groupIdentifier"); - return (Criteria) this; - } - - public Criteria andGroupIdentifierLike(String value) { - addCriterion("group_identifier like", value, "groupIdentifier"); - return (Criteria) this; - } - - public Criteria andGroupIdentifierNotLike(String value) { - addCriterion("group_identifier not like", value, "groupIdentifier"); - return (Criteria) this; - } - - public Criteria andGroupIdentifierIn(List values) { - addCriterion("group_identifier in", values, "groupIdentifier"); - return (Criteria) this; - } - - public Criteria andGroupIdentifierNotIn(List values) { - addCriterion("group_identifier not in", values, "groupIdentifier"); - return (Criteria) this; - } - - public Criteria andGroupIdentifierBetween(String value1, String value2) { - addCriterion("group_identifier between", value1, value2, "groupIdentifier"); - return (Criteria) this; - } - - public Criteria andGroupIdentifierNotBetween(String value1, String value2) { - addCriterion("group_identifier not between", value1, value2, "groupIdentifier"); - return (Criteria) this; - } - - public Criteria andForEntityIsNull() { - addCriterion("for_entity is null"); - return (Criteria) this; - } - - public Criteria andForEntityIsNotNull() { - addCriterion("for_entity is not null"); - return (Criteria) this; - } - - public Criteria andForEntityEqualTo(String value) { - addCriterion("for_entity =", value, "forEntity"); - return (Criteria) this; - } - - public Criteria andForEntityNotEqualTo(String value) { - addCriterion("for_entity <>", value, "forEntity"); - return (Criteria) this; - } - - public Criteria andForEntityGreaterThan(String value) { - addCriterion("for_entity >", value, "forEntity"); - return (Criteria) this; - } - - public Criteria andForEntityGreaterThanOrEqualTo(String value) { - addCriterion("for_entity >=", value, "forEntity"); - return (Criteria) this; - } - - public Criteria andForEntityLessThan(String value) { - addCriterion("for_entity <", value, "forEntity"); - return (Criteria) this; - } - - public Criteria andForEntityLessThanOrEqualTo(String value) { - addCriterion("for_entity <=", value, "forEntity"); - return (Criteria) this; - } - - public Criteria andForEntityLike(String value) { - addCriterion("for_entity like", value, "forEntity"); - return (Criteria) this; - } - - public Criteria andForEntityNotLike(String value) { - addCriterion("for_entity not like", value, "forEntity"); - return (Criteria) this; - } - - public Criteria andForEntityIn(List values) { - addCriterion("for_entity in", values, "forEntity"); - return (Criteria) this; - } - - public Criteria andForEntityNotIn(List values) { - addCriterion("for_entity not in", values, "forEntity"); - return (Criteria) this; - } - - public Criteria andForEntityBetween(String value1, String value2) { - addCriterion("for_entity between", value1, value2, "forEntity"); - return (Criteria) this; - } - - public Criteria andForEntityNotBetween(String value1, String value2) { - addCriterion("for_entity not between", value1, value2, "forEntity"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNull() { - addCriterion("server_version is null"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNotNull() { - addCriterion("server_version is not null"); - return (Criteria) this; - } - - public Criteria andServerVersionEqualTo(Long value) { - addCriterion("server_version =", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotEqualTo(Long value) { - addCriterion("server_version <>", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThan(Long value) { - addCriterion("server_version >", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThanOrEqualTo(Long value) { - addCriterion("server_version >=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThan(Long value) { - addCriterion("server_version <", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThanOrEqualTo(Long value) { - addCriterion("server_version <=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionIn(List values) { - addCriterion("server_version in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotIn(List values) { - addCriterion("server_version not in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionBetween(Long value1, Long value2) { - addCriterion("server_version between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotBetween(Long value1, Long value2) { - addCriterion("server_version not between", value1, value2, "serverVersion"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - public static class Criterion { - private String condition; - private Object value; - private Object secondValue; - private boolean noValue; - private boolean singleValue; - private boolean betweenValue; - private boolean listValue; - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. - * This class corresponds to the database table core.task_metadata - * - * @mbg.generated do_not_delete_during_merge Fri Nov 09 11:35:21 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ViewConfiguration.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/ViewConfiguration.java deleted file mode 100644 index de24fefe03..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ViewConfiguration.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.opensrp.domain.postgres; - -public class ViewConfiguration { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.view_configuration.id - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.view_configuration.json - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - private Object json; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.view_configuration.id - * - * @return the value of core.view_configuration.id - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.view_configuration.id - * - * @param id the value for core.view_configuration.id - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.view_configuration.json - * - * @return the value of core.view_configuration.json - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public Object getJson() { - return json; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.view_configuration.json - * - * @param json the value for core.view_configuration.json - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public void setJson(Object json) { - this.json = json; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ViewConfigurationExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/ViewConfigurationExample.java deleted file mode 100644 index b63be75ac5..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ViewConfigurationExample.java +++ /dev/null @@ -1,460 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class ViewConfigurationExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public ViewConfigurationExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List jsonCriteria; - - protected List allCriteria; - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - jsonCriteria = new ArrayList(); - } - - public List getJsonCriteria() { - return jsonCriteria; - } - - protected void addJsonCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - jsonCriteria.add( - new Criterion(condition, value, "org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler")); - allCriteria = null; - } - - protected void addJsonCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - jsonCriteria.add(new Criterion(condition, value1, value2, - "org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler")); - allCriteria = null; - } - - public boolean isValid() { - return criteria.size() > 0 || jsonCriteria.size() > 0; - } - - public List getAllCriteria() { - if (allCriteria == null) { - allCriteria = new ArrayList(); - allCriteria.addAll(criteria); - allCriteria.addAll(jsonCriteria); - } - return allCriteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - allCriteria = null; - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - allCriteria = null; - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andJsonIsNull() { - addCriterion("json is null"); - return (Criteria) this; - } - - public Criteria andJsonIsNotNull() { - addCriterion("json is not null"); - return (Criteria) this; - } - - public Criteria andJsonEqualTo(Object value) { - addJsonCriterion("json =", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotEqualTo(Object value) { - addJsonCriterion("json <>", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThan(Object value) { - addJsonCriterion("json >", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonGreaterThanOrEqualTo(Object value) { - addJsonCriterion("json >=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThan(Object value) { - addJsonCriterion("json <", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonLessThanOrEqualTo(Object value) { - addJsonCriterion("json <=", value, "json"); - return (Criteria) this; - } - - public Criteria andJsonIn(List values) { - addJsonCriterion("json in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotIn(List values) { - addJsonCriterion("json not in", values, "json"); - return (Criteria) this; - } - - public Criteria andJsonBetween(Object value1, Object value2) { - addJsonCriterion("json between", value1, value2, "json"); - return (Criteria) this; - } - - public Criteria andJsonNotBetween(Object value1, Object value2) { - addJsonCriterion("json not between", value1, value2, "json"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.view_configuration - * - * @mbg.generated do_not_delete_during_merge Mon Apr 23 10:00:13 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ViewConfigurationMetadata.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/ViewConfigurationMetadata.java deleted file mode 100644 index 8c39221d03..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ViewConfigurationMetadata.java +++ /dev/null @@ -1,155 +0,0 @@ -package org.opensrp.domain.postgres; - -public class ViewConfigurationMetadata { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.view_configuration_metadata.id - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - private Long id; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.view_configuration_metadata.view_configuration_id - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - private Long viewConfigurationId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.view_configuration_metadata.document_id - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - private String documentId; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.view_configuration_metadata.identifier - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - private String identifier; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database column - * core.view_configuration_metadata.server_version - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - private Long serverVersion; - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.view_configuration_metadata.id - * - * @return the value of core.view_configuration_metadata.id - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public Long getId() { - return id; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.view_configuration_metadata.id - * - * @param id the value for core.view_configuration_metadata.id - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public void setId(Long id) { - this.id = id; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.view_configuration_metadata.view_configuration_id - * - * @return the value of core.view_configuration_metadata.view_configuration_id - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public Long getViewConfigurationId() { - return viewConfigurationId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.view_configuration_metadata.view_configuration_id - * - * @param viewConfigurationId the value for - * core.view_configuration_metadata.view_configuration_id - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public void setViewConfigurationId(Long viewConfigurationId) { - this.viewConfigurationId = viewConfigurationId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.view_configuration_metadata.document_id - * - * @return the value of core.view_configuration_metadata.document_id - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public String getDocumentId() { - return documentId; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.view_configuration_metadata.document_id - * - * @param documentId the value for core.view_configuration_metadata.document_id - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public void setDocumentId(String documentId) { - this.documentId = documentId; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.view_configuration_metadata.identifier - * - * @return the value of core.view_configuration_metadata.identifier - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public String getIdentifier() { - return identifier; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.view_configuration_metadata.identifier - * - * @param identifier the value for core.view_configuration_metadata.identifier - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * This method was generated by MyBatis Generator. This method returns the value of the database - * column core.view_configuration_metadata.server_version - * - * @return the value of core.view_configuration_metadata.server_version - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public Long getServerVersion() { - return serverVersion; - } - - /** - * This method was generated by MyBatis Generator. This method sets the value of the database - * column core.view_configuration_metadata.server_version - * - * @param serverVersion the value for core.view_configuration_metadata.server_version - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ViewConfigurationMetadataExample.java b/opensrp-core/src/main/java/org/opensrp/domain/postgres/ViewConfigurationMetadataExample.java deleted file mode 100644 index 3af9fcd27b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/postgres/ViewConfigurationMetadataExample.java +++ /dev/null @@ -1,625 +0,0 @@ -package org.opensrp.domain.postgres; - -import java.util.ArrayList; -import java.util.List; - -public class ViewConfigurationMetadataExample { - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - protected String orderByClause; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - protected boolean distinct; - - /** - * This field was generated by MyBatis Generator. This field corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - protected List oredCriteria; - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public ViewConfigurationMetadataExample() { - oredCriteria = new ArrayList(); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public String getOrderByClause() { - return orderByClause; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public boolean isDistinct() { - return distinct; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public List getOredCriteria() { - return oredCriteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - protected abstract static class GeneratedCriteria { - - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andIdIsNull() { - addCriterion("id is null"); - return (Criteria) this; - } - - public Criteria andIdIsNotNull() { - addCriterion("id is not null"); - return (Criteria) this; - } - - public Criteria andIdEqualTo(Long value) { - addCriterion("id =", value, "id"); - return (Criteria) this; - } - - public Criteria andIdNotEqualTo(Long value) { - addCriterion("id <>", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThan(Long value) { - addCriterion("id >", value, "id"); - return (Criteria) this; - } - - public Criteria andIdGreaterThanOrEqualTo(Long value) { - addCriterion("id >=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThan(Long value) { - addCriterion("id <", value, "id"); - return (Criteria) this; - } - - public Criteria andIdLessThanOrEqualTo(Long value) { - addCriterion("id <=", value, "id"); - return (Criteria) this; - } - - public Criteria andIdIn(List values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List values) { - addCriterion("id not in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdBetween(Long value1, Long value2) { - addCriterion("id between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andIdNotBetween(Long value1, Long value2) { - addCriterion("id not between", value1, value2, "id"); - return (Criteria) this; - } - - public Criteria andViewConfigurationIdIsNull() { - addCriterion("view_configuration_id is null"); - return (Criteria) this; - } - - public Criteria andViewConfigurationIdIsNotNull() { - addCriterion("view_configuration_id is not null"); - return (Criteria) this; - } - - public Criteria andViewConfigurationIdEqualTo(Long value) { - addCriterion("view_configuration_id =", value, "viewConfigurationId"); - return (Criteria) this; - } - - public Criteria andViewConfigurationIdNotEqualTo(Long value) { - addCriterion("view_configuration_id <>", value, "viewConfigurationId"); - return (Criteria) this; - } - - public Criteria andViewConfigurationIdGreaterThan(Long value) { - addCriterion("view_configuration_id >", value, "viewConfigurationId"); - return (Criteria) this; - } - - public Criteria andViewConfigurationIdGreaterThanOrEqualTo(Long value) { - addCriterion("view_configuration_id >=", value, "viewConfigurationId"); - return (Criteria) this; - } - - public Criteria andViewConfigurationIdLessThan(Long value) { - addCriterion("view_configuration_id <", value, "viewConfigurationId"); - return (Criteria) this; - } - - public Criteria andViewConfigurationIdLessThanOrEqualTo(Long value) { - addCriterion("view_configuration_id <=", value, "viewConfigurationId"); - return (Criteria) this; - } - - public Criteria andViewConfigurationIdIn(List values) { - addCriterion("view_configuration_id in", values, "viewConfigurationId"); - return (Criteria) this; - } - - public Criteria andViewConfigurationIdNotIn(List values) { - addCriterion("view_configuration_id not in", values, "viewConfigurationId"); - return (Criteria) this; - } - - public Criteria andViewConfigurationIdBetween(Long value1, Long value2) { - addCriterion("view_configuration_id between", value1, value2, "viewConfigurationId"); - return (Criteria) this; - } - - public Criteria andViewConfigurationIdNotBetween(Long value1, Long value2) { - addCriterion("view_configuration_id not between", value1, value2, "viewConfigurationId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNull() { - addCriterion("document_id is null"); - return (Criteria) this; - } - - public Criteria andDocumentIdIsNotNull() { - addCriterion("document_id is not null"); - return (Criteria) this; - } - - public Criteria andDocumentIdEqualTo(String value) { - addCriterion("document_id =", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotEqualTo(String value) { - addCriterion("document_id <>", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThan(String value) { - addCriterion("document_id >", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdGreaterThanOrEqualTo(String value) { - addCriterion("document_id >=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThan(String value) { - addCriterion("document_id <", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLessThanOrEqualTo(String value) { - addCriterion("document_id <=", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdLike(String value) { - addCriterion("document_id like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotLike(String value) { - addCriterion("document_id not like", value, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdIn(List values) { - addCriterion("document_id in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotIn(List values) { - addCriterion("document_id not in", values, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdBetween(String value1, String value2) { - addCriterion("document_id between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andDocumentIdNotBetween(String value1, String value2) { - addCriterion("document_id not between", value1, value2, "documentId"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNull() { - addCriterion("identifier is null"); - return (Criteria) this; - } - - public Criteria andIdentifierIsNotNull() { - addCriterion("identifier is not null"); - return (Criteria) this; - } - - public Criteria andIdentifierEqualTo(String value) { - addCriterion("identifier =", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotEqualTo(String value) { - addCriterion("identifier <>", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThan(String value) { - addCriterion("identifier >", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierGreaterThanOrEqualTo(String value) { - addCriterion("identifier >=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThan(String value) { - addCriterion("identifier <", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLessThanOrEqualTo(String value) { - addCriterion("identifier <=", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierLike(String value) { - addCriterion("identifier like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotLike(String value) { - addCriterion("identifier not like", value, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierIn(List values) { - addCriterion("identifier in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotIn(List values) { - addCriterion("identifier not in", values, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierBetween(String value1, String value2) { - addCriterion("identifier between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andIdentifierNotBetween(String value1, String value2) { - addCriterion("identifier not between", value1, value2, "identifier"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNull() { - addCriterion("server_version is null"); - return (Criteria) this; - } - - public Criteria andServerVersionIsNotNull() { - addCriterion("server_version is not null"); - return (Criteria) this; - } - - public Criteria andServerVersionEqualTo(Long value) { - addCriterion("server_version =", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotEqualTo(Long value) { - addCriterion("server_version <>", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThan(Long value) { - addCriterion("server_version >", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionGreaterThanOrEqualTo(Long value) { - addCriterion("server_version >=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThan(Long value) { - addCriterion("server_version <", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionLessThanOrEqualTo(Long value) { - addCriterion("server_version <=", value, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionIn(List values) { - addCriterion("server_version in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotIn(List values) { - addCriterion("server_version not in", values, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionBetween(Long value1, Long value2) { - addCriterion("server_version between", value1, value2, "serverVersion"); - return (Criteria) this; - } - - public Criteria andServerVersionNotBetween(Long value1, Long value2) { - addCriterion("server_version not between", value1, value2, "serverVersion"); - return (Criteria) this; - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated do_not_delete_during_merge Mon Apr 23 10:29:52 EAT 2018 - */ - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } - - /** - * This class was generated by MyBatis Generator. This class corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - public static class Criterion { - - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/setting/Setting.java b/opensrp-core/src/main/java/org/opensrp/domain/setting/Setting.java deleted file mode 100644 index ad9e0383c0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/setting/Setting.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.opensrp.domain.setting; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.annotate.JsonSubTypes; -import org.codehaus.jackson.annotate.JsonSubTypes.Type; -import org.json.JSONArray; - -@JsonSubTypes({ @Type(value = SettingConfiguration.class, name = "Setting") }) -public class Setting { - - @JsonProperty - private String key; - - @JsonProperty - private String value; - - @JsonProperty - private JSONArray values; - - @JsonProperty - private String label; - - @JsonProperty - private String description; - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public String getDescription() { - return description; - } - - public JSONArray getValues() { - return values; - } - - public void setValues(JSONArray values) { - this.values = values; - } - - public void setDescription(String description) { - this.description = description; - } - - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/setting/SettingConfiguration.java b/opensrp-core/src/main/java/org/opensrp/domain/setting/SettingConfiguration.java deleted file mode 100644 index 0d2ae17e51..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/setting/SettingConfiguration.java +++ /dev/null @@ -1,125 +0,0 @@ -package org.opensrp.domain.setting; - -import java.util.List; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; -import org.opensrp.domain.BaseDataObject; - -@TypeDiscriminator("doc.type == 'SettingConfiguration'") -public class SettingConfiguration extends BaseDataObject { - - private static final long serialVersionUID = 1890883609898207738L; - - @JsonProperty - private String identifier; - - @JsonProperty - private String teamId; - - @JsonProperty - private String team; - - @JsonProperty - private String providerId; - - @JsonProperty - private String locationId; - - @JsonProperty - private String childLocationId; - - private String documentId; - - @JsonProperty - private String version; - - @JsonProperty - private List settings; - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public String getTeamId() { - return teamId; - } - - public void setTeamId(String teamId) { - this.teamId = teamId; - } - - - public String getTeam() { - return team; - } - - - public void setTeam(String team) { - this.team = team; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public String getLocationId() { - return locationId; - } - - public void setLocationId(String locationId) { - this.locationId = locationId; - } - - public String getChildLocationId() { - return childLocationId; - } - - public void setChildLocationId(String childLocationId) { - this.childLocationId = childLocationId; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public List getSettings() { - return settings; - } - - public void setSettings(List settings) { - this.settings = settings; - } - - - public String getDocumentId() { - return documentId; - } - - - public void setDocumentId(String documentId) { - this.documentId = documentId; - } - - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/BaseConfiguration.java b/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/BaseConfiguration.java deleted file mode 100644 index d11359644c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/BaseConfiguration.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.opensrp.domain.viewconfiguration; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.annotate.JsonSubTypes; -import org.codehaus.jackson.annotate.JsonSubTypes.Type; -import org.codehaus.jackson.annotate.JsonTypeInfo; -import org.codehaus.jackson.annotate.JsonTypeInfo.Id; - -@JsonTypeInfo(use = Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") -@JsonSubTypes({ @Type(value = LoginConfiguration.class, name = "Login"), - @Type(value = MainConfiguration.class, name = "Main"), - @Type(value = RegisterConfiguration.class, name = "Register") }) -public abstract class BaseConfiguration { - - @JsonProperty - private String language; - - @JsonProperty - private String applicationName; - - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } - - public String getApplicationName() { - return applicationName; - } - - public void setApplicationName(String applicationName) { - this.applicationName = applicationName; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/LoginConfiguration.java b/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/LoginConfiguration.java deleted file mode 100644 index 39e97cf433..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/LoginConfiguration.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.opensrp.domain.viewconfiguration; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class LoginConfiguration extends BaseConfiguration { - - @JsonProperty - private boolean showPasswordCheckbox; - - @JsonProperty - private String logoUrl; - - @JsonProperty - private Background background; - - public boolean getShowPasswordCheckbox() { - return showPasswordCheckbox; - } - - public void setShowPasswordCheckbox(boolean showPasswordCheckbox) { - this.showPasswordCheckbox = showPasswordCheckbox; - } - - public String getLogoUrl() { - return logoUrl; - } - - public void setLogoUrl(String logoUrl) { - this.logoUrl = logoUrl; - } - - public Background getBackground() { - return background; - } - - public void setBackground(Background background) { - this.background = background; - } - - static class Background { - - @JsonProperty - private String orientation; - - @JsonProperty - private String startColor; - - @JsonProperty - private String endColor; - - public String getOrientation() { - return orientation; - } - - public void setOrientation(String orientation) { - this.orientation = orientation; - } - - public String getStartColor() { - return startColor; - } - - public void setStartColor(String startColor) { - this.startColor = startColor; - } - - public String getEndColor() { - return endColor; - } - - public void setEndColor(String endColor) { - this.endColor = endColor; - } - - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/MainConfiguration.java b/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/MainConfiguration.java deleted file mode 100644 index 47db534c26..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/MainConfiguration.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.opensrp.domain.viewconfiguration; - -import org.codehaus.jackson.annotate.JsonProperty; - -public class MainConfiguration extends BaseConfiguration { - - @JsonProperty - private boolean enableJsonViews; - - public boolean getEnableJsonViews() { - return enableJsonViews; - } - - public void setEnableJsonViews(boolean enableJsonViews) { - this.enableJsonViews = enableJsonViews; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/RegisterConfiguration.java b/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/RegisterConfiguration.java deleted file mode 100644 index 6c4dfdef3f..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/RegisterConfiguration.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.opensrp.domain.viewconfiguration; - -import java.util.List; - -public class RegisterConfiguration extends BaseConfiguration { - - private boolean enableAdvancedSearch; - - private boolean enableSortList; - - private boolean enableFilterList; - - private String searchBarText; - - private List searchableFields; - - public boolean isEnableAdvancedSearch() { - return enableAdvancedSearch; - } - - public void setEnableAdvancedSearch(boolean enableAdvancedSearch) { - this.enableAdvancedSearch = enableAdvancedSearch; - } - - public boolean isEnableSortList() { - return enableSortList; - } - - public void setEnableSortList(boolean enableSortList) { - this.enableSortList = enableSortList; - } - - public boolean isEnableFilterList() { - return enableFilterList; - } - - public void setEnableFilterList(boolean enableFilterList) { - this.enableFilterList = enableFilterList; - } - - public String getSearchBarText() { - return searchBarText; - } - - public void setSearchBarText(String searchBarText) { - this.searchBarText = searchBarText; - } - - public List getSearchableFields() { - return searchableFields; - } - - public void setSearchableFields(List searchableFields) { - this.searchableFields = searchableFields; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/View.java b/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/View.java deleted file mode 100644 index 436837de11..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/View.java +++ /dev/null @@ -1,113 +0,0 @@ -package org.opensrp.domain.viewconfiguration; - -import org.codehaus.jackson.annotate.JsonProperty; - -/** - * @author SGithengi - */ -public class View { - - @JsonProperty - private String identifier; - - @JsonProperty - private String type; - - @JsonProperty - private String orientation; - - @JsonProperty - private String label; - - @JsonProperty - private boolean visible; - - @JsonProperty - private Residence residence; - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getOrientation() { - return orientation; - } - - public void setOrientation(String orientation) { - this.orientation = orientation; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public boolean isVisible() { - return visible; - } - - public void setVisible(boolean visible) { - this.visible = visible; - } - - public Residence getResidence() { - return residence; - } - - public void setResidence(Residence residence) { - this.residence = residence; - } - - static class Residence { - - @JsonProperty - private String parent; - - @JsonProperty - private int position; - - @JsonProperty(value = "layout_weight") - private String layoutWeight; - - public String getParent() { - return parent; - } - - public void setParent(String parent) { - this.parent = parent; - } - - public int getPosition() { - return position; - } - - public void setPosition(int position) { - this.position = position; - } - - public String getLayoutWeight() { - return layoutWeight; - } - - public void setLayoutWeight(String layoutWeight) { - this.layoutWeight = layoutWeight; - } - - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/ViewConfiguration.java b/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/ViewConfiguration.java deleted file mode 100644 index 0e6c008ab7..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/domain/viewconfiguration/ViewConfiguration.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.opensrp.domain.viewconfiguration; - -import java.util.List; -import java.util.Map; - -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; -import org.opensrp.domain.BaseDataObject; - -/** - * @author SGithengi - */ -@TypeDiscriminator("doc.type == 'ViewConfiguration'") -public class ViewConfiguration extends BaseDataObject { - - private static final long serialVersionUID = 1890883609898207737L; - - @JsonProperty - private String type; - - @JsonProperty - private String identifier; - - @JsonProperty - private BaseConfiguration metadata; - - @JsonProperty - private List views; - - @JsonProperty - private Map labels; - - @JsonProperty - private Object jsonView; - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public BaseConfiguration getMetadata() { - return metadata; - } - - public void setMetadata(BaseConfiguration metadata) { - this.metadata = metadata; - } - - public List getViews() { - return views; - } - - public void setViews(List views) { - this.views = views; - } - - public Map getLabels() { - return labels; - } - - public void setLabels(Map labels) { - this.labels = labels; - } - - public Object getJsonView() { - return jsonView; - } - - public void setJsonView(Object jsonView) { - this.jsonView = jsonView; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/exception/NullQueryValueException.java b/opensrp-core/src/main/java/org/opensrp/exception/NullQueryValueException.java deleted file mode 100644 index c17671213f..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/exception/NullQueryValueException.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.opensrp.exception; - -public class NullQueryValueException extends NullPointerException { - - public NullQueryValueException(String message) { - super(message); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/AllCamp.java b/opensrp-core/src/main/java/org/opensrp/repository/AllCamp.java deleted file mode 100644 index 1140f9c080..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/AllCamp.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.opensrp.repository; - -import java.util.List; - -import org.ektorp.CouchDbConnector; -import org.ektorp.support.View; -import org.motechproject.dao.MotechBaseRepository; -import org.motechproject.util.DateUtil; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.Camp; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllCamp extends MotechBaseRepository { - - @Autowired - public AllCamp(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db) { - super(Camp.class, db); - - } - - @View(name = "by_active", map = "function(doc) { if (doc.type === 'Camp' && doc._id && doc.status==true) { emit(doc.providerName, null); } }") - public List findAllActive() { - List camp = db.queryView(createQuery("by_active").includeDocs(true), Camp.class); - if (camp == null || camp.isEmpty()) { - return null; - } - return camp; - } - - @View(name = "by_active", map = "function(doc) { if (doc.type === 'Camp' && doc._id && doc.status==true) { emit(doc.providerName, null); } }") - public List findAllActiveByProvider(String provider) { - List camp = db.queryView(createQuery("by_active").key(provider).includeDocs(true), Camp.class); - if (camp == null || camp.isEmpty()) { - return null; - } - return camp; - } - - public void updateCamp(Camp camp) { - camp.setStatus(false); - camp.setTimestamp(DateUtil.now().getMillis()); - camp.setId(camp.getId()); - camp.setRevision(camp.getRevision()); - this.update(camp); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/AllDHIS2Marker.java b/opensrp-core/src/main/java/org/opensrp/repository/AllDHIS2Marker.java deleted file mode 100644 index fa6a12b02b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/AllDHIS2Marker.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.opensrp.repository; - -import java.util.List; - -import org.ektorp.CouchDbConnector; -import org.ektorp.support.GenerateView; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.common.AllConstants; -import org.opensrp.common.AllConstants.DHIS2Constants; -import org.opensrp.domain.DHIS2Marker; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllDHIS2Marker extends MotechBaseRepository { - - @Autowired - protected AllDHIS2Marker(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db) { - super(DHIS2Marker.class, db); - } - - @GenerateView - public List findByName(String name) { - return queryView("by_name", name); - } - - public void add() { - DHIS2Marker dHIS2MarkerEntry = new DHIS2Marker(); - dHIS2MarkerEntry.setName(DHIS2Constants.DHIS2_TRACK_DATA_SYNCER_VERSION_MARKER); - dHIS2MarkerEntry.setValue(0l); - this.add(dHIS2MarkerEntry); - } - - public void addEventMarker() { - DHIS2Marker dHIS2MarkerEntry = new DHIS2Marker(); - dHIS2MarkerEntry.setName(DHIS2Constants.DHIS2_TRACK_DATA_SYNCER_VERSION_MARKER_EVENT); - dHIS2MarkerEntry.setValue(0l); - this.add(dHIS2MarkerEntry); - } - - public void update(long ServerVersion) { - try { - DHIS2Marker lastsync = this.findByName(DHIS2Constants.DHIS2_TRACK_DATA_SYNCER_VERSION_MARKER).get(0); - lastsync.setValue(ServerVersion); - this.update(lastsync); - } - catch (Exception e) { - e.printStackTrace(); - } - } - - public void updateEventMarker(long ServerVersion) { - try { - DHIS2Marker lastsync = this.findByName(DHIS2Constants.DHIS2_TRACK_DATA_SYNCER_VERSION_MARKER_EVENT).get(0); - lastsync.setValue(ServerVersion); - this.update(lastsync); - } - catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/AppStateTokensRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/AppStateTokensRepository.java deleted file mode 100644 index 1ada1926ec..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/AppStateTokensRepository.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.opensrp.repository; - -import java.util.List; - -import org.opensrp.domain.AppStateToken; - -public interface AppStateTokensRepository extends BaseRepository { - - List findByName(String name); - - void update(AppStateToken entity); - - void add(AppStateToken entity); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/BaseEntitiesRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/BaseEntitiesRepository.java deleted file mode 100644 index 4250fedd7c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/BaseEntitiesRepository.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.opensrp.repository; - -import java.util.List; - -import org.opensrp.domain.BaseEntity; - -public interface BaseEntitiesRepository extends BaseRepository { - - BaseEntity findByBaseEntityId(String baseEntityId); - - List findAllBaseEntities(); - - List findAllByIdentifier(String identifier); - - List findAllByIdentifier(String identifierType, String identifier); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/BaseRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/BaseRepository.java deleted file mode 100644 index f063e6990b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/BaseRepository.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.opensrp.repository; - -import java.util.List; - -public interface BaseRepository { - - /** - * Get the object using identifier - * @param id identifier - * @return entity - */ - T get(String id); - - /** - * Add entity to the database - * @param entity to add - */ - void add(T entity); - - /** - * Update entity - * @param entity to update - */ - void update(T entity); - - /** - * Get's all entities on the database. By default 1000 entities will be returned - * @return - */ - List getAll(); - - /** - * Remove an object, can be actual deletion or setting a date deleted for events, clients, Plans, Organization, Practitioner - * @param entity - */ - void safeRemove(T entity); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/CampaignRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/CampaignRepository.java deleted file mode 100644 index d21e9c811b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/CampaignRepository.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.opensrp.repository; - -import java.util.List; - -import org.opensrp.domain.Campaign; - -public interface CampaignRepository extends BaseRepository{ - - public List getCampaignsByServerVersion(long serverVersion); - public List getCampaignsByIdentifiers(String identifiers); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/ClientsRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/ClientsRepository.java deleted file mode 100644 index c9facb732a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/ClientsRepository.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.opensrp.repository; - -import java.util.Calendar; -import java.util.List; - -import org.joda.time.DateTime; -import org.opensrp.domain.Client; -import org.opensrp.domain.postgres.HouseholdClient; -import org.opensrp.search.AddressSearchBean; -import org.opensrp.search.ClientSearchBean; - -public interface ClientsRepository extends BaseRepository { - - Client findByBaseEntityId(String baseEntityId); - - List findAllClients(); - - List findAllByIdentifier(String identifier); - - List findAllByIdentifier(String identifierType, String identifier); - - List findAllByAttribute(String attributeType, String attribute); - - List findAllByMatchingName(String nameMatches); - - /** - * Find a client based on the relationship id and between a range of date created dates e.g - * given mother's id get children born at a given time - * - * @param relationalId - * @param dateFrom - * @param dateTo - * @return - */ - List findByRelationshipIdAndDateCreated(String relationalId, String dateFrom, String dateTo); - - List findByRelationshipId(String relationshipType, String entityId); - - List findByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean); - - List findByDynamicQuery(String query); - - List findByCriteria(ClientSearchBean searchBean); - - List findByCriteria(AddressSearchBean addressSearchBean, DateTime lastEditFrom, DateTime lastEditTo); - - List findByRelationShip(String relationIndentier); - - List findByEmptyServerVersion(); - - List findByServerVersion(long serverVersion); - - List findByFieldValue(String field, List ids); - - List notInOpenMRSByServerVersion(long serverVersion, Calendar calendar); - - List selectMemberCountHouseholdHeadProviderByClients(String field, List ids, String clientType); - - HouseholdClient findTotalCountHouseholdByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean); - - List findMembersByRelationshipId(String relationshipId); - - List findAllClientsByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean); - - HouseholdClient findCountAllClientsByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean); - - List findHouseholdByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean); - - List findANCByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean); - - int findCountANCByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean); - - List findChildByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean); - - int findCountChildByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/ErrorTraceRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/ErrorTraceRepository.java deleted file mode 100644 index 9f6cc08e65..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/ErrorTraceRepository.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.opensrp.repository; - -import java.util.List; - -import org.ektorp.DocumentNotFoundException; -import org.opensrp.domain.ErrorTrace; - -public interface ErrorTraceRepository extends BaseRepository { - - ErrorTrace findById(String _id) throws DocumentNotFoundException; - - boolean exists(String id); - - List findAllErrors() throws DocumentNotFoundException; - - List findAllUnSolvedErrors() throws DocumentNotFoundException; - - List findAllSolvedErrors() throws DocumentNotFoundException; - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/EventsRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/EventsRepository.java deleted file mode 100644 index 74aca858fd..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/EventsRepository.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.opensrp.repository; - -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -import org.opensrp.domain.Event; -import org.opensrp.search.EventSearchBean; - -public interface EventsRepository extends BaseRepository { - - List findAllByIdentifier(String identifier); - - List findAllByIdentifier(String identifierType, String identifier); - - Event findById(String id); - - Event findByFormSubmissionId(String formSubmissionId); - - List findByBaseEntityId(String baseEntityId); - - Event findByBaseEntityAndFormSubmissionId(String baseEntityId, String formSubmissionId); - - List findByBaseEntityAndType(String baseEntityId, String eventType); - - List findEvents(EventSearchBean eventSearchBean); - - List findEventsByDynamicQuery(String query); - - List findByServerVersion(long serverVersion); - - List notInOpenMRSByServerVersion(long serverVersion, Calendar calendar); - - List notInOpenMRSByServerVersionAndType(String type, long serverVersion, Calendar calendar); - - List findByClientAndConceptAndDate(String baseEntityId, String concept, String conceptValue, String dateFrom, - String dateTo); - - List findByBaseEntityIdAndConceptParentCode(String baseEntityId, String concept, String parentCode); - - List findByConceptAndValue(String concept, String conceptValue); - - List findByEmptyServerVersion(); - - List findEvents(EventSearchBean eventSearchBean, String sortBy, String sortOrder, int limit); - - List findEventByEventTypeBetweenTwoDates(String eventType); - - List findByProvider(String provider); - - List findIdsByEventType(String eventType, Date dateDeleted); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/LocationRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/LocationRepository.java deleted file mode 100644 index f94e70e603..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/LocationRepository.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.opensrp.repository; - -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import org.opensrp.domain.LocationDetail; -import org.opensrp.domain.PhysicalLocation; -import org.opensrp.domain.StructureDetails; - -public interface LocationRepository extends BaseRepository { - - PhysicalLocation getStructure(String id, boolean returnGeometry); - - PhysicalLocation get(String id, boolean returnGeometry); - - List findLocationsByServerVersion(long serverVersion); - - List findLocationsByNames(String locationNames, long serverVersion); - - List findStructuresByParentAndServerVersion(String parentId, long serverVersion); - - List findByEmptyServerVersion(); - - List findStructuresByEmptyServerVersion(); - - List getAllStructures(); - - Collection findStructureAndFamilyDetails(double latitude, double longitude, double radius); - - /** - * This methods searches for jurisdictions using the parentId and location properties - * It returns the Geometry optionally if @param returnGeometry is set to true. - * @param returnGeometry boolean which controls if geometry is returned - * @param parentId string the parent id of the jurisdiction being searched - * @param properties map of location properties to filter with, each entry in map has property name and value - * @return jurisdictions matching the params - */ - List findLocationsByProperties(boolean returnGeometry, String parentId, - Map properties); - - /** - * This methods searches for structures using the parentId and location properties - * It returns the Geometry optionally if @param returnGeometry is set to true. - * @param returnGeometry boolean which controls if geometry is returned - * @param parentId string the parent id of the structure being searched - * @param properties map of location properties to filter with, each entry in map has property name and value - * @return structures matching the params - */ - List findStructuresByProperties(boolean returnGeometry, String parentId, - Map properties); - - /** - * This methods searches for locations using a list of provided location ids. - * It returns the Geometry optionally if @param returnGeometry is set to true. - * @param returnGeometry boolean which controls if geometry is returned - * @param ids list of location ids - * @return jurisdictions whose ids match the provided params - */ - List findLocationsByIds(boolean returnGeometry, List ids); - - /** - * This methods searches for a location and it's children using the provided location id - * It returns the Geometry optionally if @param returnGeometry is set to true. - * @param returnGeometry boolean which controls if geometry is returned - * @param id location id - * @param pageSize number of records to be returned - * @return location together with it's children whose id matches the provided param - */ - List findLocationByIdWithChildren(boolean returnGeometry, String id, int pageSize); - - - /** - * Gets the location primary key - * @param identifier of of the plan - * @param isJurisdiction whether the to search for jurisdiction or structure - * @return the numerical primary key of a jurisdiction - */ - public Long retrievePrimaryKey(String identifier, boolean isJurisdiction); - - /** - * This methods searches for locations using a list of provided location ids.It returns location whose is in the list or whose parent is in list - * It returns the Geometry optionally if @param returnGeometry is set to true. - * @param returnGeometry boolean which controls if geometry is returned - * @param ids list of location ids - * @return jurisdictions whose ids match the provided params - */ - List findLocationsByIdsOrParentIds(boolean returnGeometry, List ids); - - /** - * This method fetches all structure Ids - * @return a list of structure Ids - */ - List findAllStructureIds(); - - /** - * This method searches for location identifier and name using a plan identifier. - * - * @param planIdentifier identifier of the plan - * @return list of location details i.e. identifier and name - */ - List findLocationDetailsByPlanId(String planIdentifier); - - /** - * This method searches for jurisdictions ordered by serverVersion ascending - * - * @param returnGeometry boolean which controls if geometry is returned - * @param serverVersion - * @param limit upper limit on number of jurisdictions to fetch - * @return list of jurisdictions - */ - List findAllLocations(boolean returnGeometry, Long serverVersion, int limit); - - /** - * This method searches for structures ordered by serverVersion ascending - * - * @param returnGeometry boolean which controls if geometry is returned - * @param serverVersion - * @param limit upper limit on number of structures to fetch - * @return list of structures - */ - List findAllStructures(boolean returnGeometry, Long serverVersion, int limit); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/MultimediaRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/MultimediaRepository.java deleted file mode 100644 index a2e3ba268e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/MultimediaRepository.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.opensrp.repository; - -import java.util.List; - -import edu.umd.cs.findbugs.annotations.NonNull; -import org.opensrp.domain.Multimedia; - -public interface MultimediaRepository extends BaseRepository { - - Multimedia findByCaseId(String entityId); - - List all(String providerId); - - /** - * Returns a {@link List} of {@link Multimedia} objects that match the given parameters - * - * @param entityId The baseEntityId of the client who owns the multimedia file(s) - * @param contentType The contentType of the multimedia file(s) to be fetched - * @param fileCategory The file category of the multimedia file(s) - * - * @return A {@link List} of {@link Multimedia} objects - */ - List get(@NonNull String entityId, @NonNull String contentType, @NonNull String fileCategory); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/OrganizationRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/OrganizationRepository.java deleted file mode 100644 index 1255c1c7c2..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/OrganizationRepository.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.opensrp.repository; - -import java.util.Date; -import java.util.List; - -import org.opensrp.domain.AssignedLocations; -import org.opensrp.domain.Organization; - -/** - * Created by Samuel Githengi on 8/30/19. - */ -public interface OrganizationRepository extends BaseRepository { - - /** - * Assign jurisdiction and or plan to a organization - * - * @param organizationId the organization identifier - * @param planIdentifier - * @param jurisdictionIdentifier - * @param jurisdiction id of jurisdiction being assigned - * @param planId id of the plan being assigned - * @param fromDate with effect from - * @param toDate with effect to - */ - void assignLocationAndPlan(Long organizationId, String jurisdictionIdentifier, Long jurisdictionId, - String planIdentifier, Long planId, Date fromDate, Date toDate); - - /** - * Gets the plans and jurisdictions that an organization is assigned to an - * organization - * - * @param organizationId Id of organization - */ - List findAssignedLocations(Long organizationId); - - /** - * Gets the plans and jurisdictions that an organization is assigned to a list - * organizations - * - * @param organizationIds - * @return - */ - List findAssignedLocations(List organizationIds); - - /** - * @param id - * @return - */ - Organization getByPrimaryKey(Long id); - - /** - * Gets the plans and jurisdictions using filtered by plan identifier - * - * @param planId the Plan Id - * - * @return list of assigned locations and plans - */ - List findAssignedLocationsByPlanId(Long planId); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/PlanRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/PlanRepository.java deleted file mode 100644 index 507fe40549..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/PlanRepository.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.opensrp.repository; - -import org.opensrp.domain.PlanDefinition; - -import java.util.List; - -/** - * Created by Vincent Karuri on 06/05/2019 - */ -public interface PlanRepository extends BaseRepository { - - List getPlansByServerVersionAndOperationalAreas(Long serverVersion, List operationalAreaIds); - - /** - * This method searches for plans using a list of provided - * plan identifiers and returns a subset of fields determined by the list of provided fields - * If no plan identifier(s) are provided the method returns all available plans - * If no fields are provided the method returns all the available fields - * @param ids list of plan identifiers - * @param fields list of fields to return - * @return plan definitions whose identifiers match the provided params - */ - List getPlansByIdsReturnOptionalFields(List ids, List fields); - - - /** - * Gets the plan primary key - * @param identifier of of the plan - * @return the numerical primary key of a plan - */ - public Long retrievePrimaryKey(String identifier); - - /** Gets the plans using the plan identifiers and whose server version is greater than or equal to server version - * @param planIdentifiers the plan identifiers - * @param serverVersion - * @return plans with the identifiers and server version greater than or equal to server version param - */ - List getPlansByIdentifiersAndServerVersion(List planIdentifiers, Long serverVersion); - - /** - * This method searches for plans ordered by serverVersion ascending - * - * @param serverVersion - * @param limit upper limit on number of plans to fetch - * @return list of plan identifiers - */ - List getAllPlans(Long serverVersion, int limit); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/PractitionerRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/PractitionerRepository.java deleted file mode 100644 index 01a89a5f5a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/PractitionerRepository.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.opensrp.repository; - -import org.opensrp.domain.Practitioner; - -import java.util.List; - -public interface PractitionerRepository extends BaseRepository { - - org.opensrp.domain.postgres.Practitioner getPractitioner(String id); - - /** - * @param userId - * @return - */ - Practitioner getPractitionerByUserId(String userId); - - Practitioner getByPrimaryKey(Long id); - - List getPractitionersByOrgId(Long orgId); - - void safeRemove(String identifier); - - /** Get the practitioner using username - * @param username to get - * @return practitioner - */ - Practitioner getPractitionerByUsername(String username); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/PractitionerRoleRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/PractitionerRoleRepository.java deleted file mode 100644 index 8a438d79ec..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/PractitionerRoleRepository.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.opensrp.repository; - -import org.opensrp.domain.PractitionerRole; - -import java.util.List; - -public interface PractitionerRoleRepository extends BaseRepository { - - List getRolesForPractitioner(String practitionerIdentifier); - - List getPgRolesForPractitioner(String practitionerIdentifier); - - public org.opensrp.domain.postgres.PractitionerRole getPractitionerRole(String id); - - public List getPractitionerRole(Long organizationId, Long practitionerId); - - void safeRemove(String identifier); - - void safeRemove(Long organizationId, Long practitionerId); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/ReportsRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/ReportsRepository.java deleted file mode 100644 index af0ee496b5..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/ReportsRepository.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.opensrp.repository; - -import java.util.List; - -import org.joda.time.DateTime; -import org.opensrp.domain.Report; - -public interface ReportsRepository extends BaseRepository { - - Report findById(String id); - - List findByBaseEntityId(String baseEntityId); - - List findAllByIdentifier(String identifier); - - List findByBaseEntityAndType(String baseEntityId, String reportType); - - List findByEmptyServerVersion(); - - List findByServerVersion(long serverVersion); - - List findByBaseEntityAndFormSubmissionId(String baseEntityId, String formSubmissionId); - - List findReports(String team, String providerId, String locationId, String baseEntityId, Long serverVersion, - String sortBy, String sortOrder, int limit); - - List findReports(String baseEntityId, DateTime from, DateTime to, String reportType, String providerId, - String locationId, DateTime lastEditFrom, DateTime lastEditTo); - - List findReportsByDynamicQuery(String query); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/SearchRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/SearchRepository.java deleted file mode 100644 index 2e67678e3e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/SearchRepository.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.opensrp.repository; - -import java.util.List; - -import org.opensrp.domain.Client; -import org.opensrp.search.ClientSearchBean; - -public interface SearchRepository { - - List findByCriteria(ClientSearchBean clientSearchBean, String firstName, String middleName, String lastName, - Integer limit); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/SettingRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/SettingRepository.java deleted file mode 100644 index 46617a2ed7..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/SettingRepository.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.opensrp.repository; - -import java.util.List; - -import org.opensrp.domain.postgres.Settings; -import org.opensrp.domain.postgres.SettingsMetadata; -import org.opensrp.domain.setting.SettingConfiguration; -import org.opensrp.search.SettingSearchBean; - -public interface SettingRepository extends BaseRepository { - - List findAllSettings(); - - List findSettings(SettingSearchBean settingQueryBean); - - List findByEmptyServerVersion(); - - SettingsMetadata getSettingMetadataByDocumentId(String documentId); - - Settings getSettingById(Long id); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/StocksRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/StocksRepository.java deleted file mode 100644 index 9007d65e53..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/StocksRepository.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.opensrp.repository; - -import java.util.List; - -import org.opensrp.domain.Stock; -import org.opensrp.search.StockSearchBean; - -public interface StocksRepository extends BaseRepository { - - List findAllByProviderid(String providerid); - - public List findAllByIdentifier(String vaccine_type, String vaccine_type_id); - - public Stock findById(String id); - - public List findStocks(StockSearchBean searchBean, String sortBy, String sortOrder, int limit); - - public List findStocks(StockSearchBean searchBean); - - public List findAllStocks(); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/TaskRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/TaskRepository.java deleted file mode 100644 index 0588a39c17..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/TaskRepository.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.opensrp.repository; - -import java.util.List; - -import org.opensrp.domain.Task; - -public interface TaskRepository extends BaseRepository { - - List getTasksByPlanAndGroup(String campaign, String group, long serverVersion); - - List findByEmptyServerVersion(); - - /** - * This method fetches all task Ids - * @return a list of task ids - */ - List findAllIds(); - - /** - * This method searches for tasks ordered by serverVersion ascending - * - * @param serverVersion - * @param limit upper limit on number of tasks to fetch - * @return list of plan identifiers - */ - List getAllTasks(Long serverVersion, int limit); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/UniqueIdRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/UniqueIdRepository.java deleted file mode 100644 index 36c6cd95ca..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/UniqueIdRepository.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.opensrp.repository; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Types; -import java.util.Date; -import java.util.List; - -import org.opensrp.domain.UniqueId; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.BatchPreparedStatementSetter; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowMapper; -import org.springframework.stereotype.Repository; - -//import org.opensrp.domain.UniqueId; - -@Repository -public class UniqueIdRepository { - - @Autowired - private JdbcTemplate jdbcTemplate; - - public int save(UniqueId uniqueId) throws Exception { - String insertQuery = "insert into " + UniqueId.tbName + " (" + UniqueId.COL_LOCATION + "," + UniqueId.COL_OPENMRSID - + "," + UniqueId.COL_STATUS + "," + UniqueId.COL_USEDBY + "," + UniqueId.COL_CREATED_AT - + ") values (?, ?, ?,?,?) "; - Object[] params = new Object[] { uniqueId.getLocation(), uniqueId.getOpenmrsId(), uniqueId.getStatus(), - uniqueId.getUsedBy(), uniqueId.getCreatedAt() }; - int[] types = new int[] { Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.TIMESTAMP }; - - return jdbcTemplate.update(insertQuery, params, types); - - } - - public void executeQuery(String query) throws Exception { - jdbcTemplate.execute(query); - } - - public int checkIfExists(String query, String[] args) throws Exception { - return this.jdbcTemplate.queryForObject(query, args, Integer.class); - - } - - public void clearTable() throws Exception { - String query = "DELETE FROM " + UniqueId.tbName; - executeQuery(query); - } - - public List getNotUsedIds(int limit) { - - String query = "SELECT * FROM " + UniqueId.tbName + " WHERE " + UniqueId.COL_STATUS + " ='" - + UniqueId.STATUS_NOT_USED + "' limit " + limit; - - List ids = jdbcTemplate.query(query, new UniqueIdRowMapper()); - - return ids; - } - - public List getNotUsedIdsAsString(int limit) { - - String query = "SELECT " + UniqueId.COL_OPENMRSID + " FROM " + UniqueId.tbName + " WHERE " + UniqueId.COL_STATUS - + " ='" + UniqueId.STATUS_NOT_USED + "' limit " + limit; - - List data = jdbcTemplate.queryForList(query, String.class); - - return data; - } - - public class UniqueIdRowMapper implements RowMapper { - - public UniqueId mapRow(ResultSet rs, int rowNum) throws SQLException { - UniqueId uniqueId = new UniqueId(); - uniqueId.setCreatedAt(new Date(rs.getTimestamp(rs.findColumn(UniqueId.COL_CREATED_AT)).getTime())); - uniqueId.setOpenmrsId(rs.getString(rs.findColumn(UniqueId.COL_OPENMRSID))); - uniqueId.setLocation(rs.getString(rs.findColumn(UniqueId.COL_LOCATION))); - uniqueId.setStatus(rs.getString(rs.findColumn(UniqueId.COL_STATUS))); - uniqueId.setUsedBy(rs.getString(rs.findColumn(UniqueId.COL_USEDBY))); - return uniqueId; - } - - } - - public Integer totalUnUsedIds() { - String sql = "select count(*) from " + UniqueId.tbName + " where " + UniqueId.COL_STATUS + "='" - + UniqueId.STATUS_NOT_USED + "'"; - return jdbcTemplate.queryForInt(sql); - } - - public int[] markAsUsed(final List ids) { - - int[] updateCnt = jdbcTemplate.batchUpdate( - "update " + UniqueId.tbName + " set " + UniqueId.COL_STATUS + "= ? where " + UniqueId.COL_OPENMRSID + " = ?", - new BatchPreparedStatementSetter() { - - public void setValues(PreparedStatement ps, int i) throws SQLException { - ps.setString(1, UniqueId.STATUS_USED); - ps.setString(2, ids.get(i)); - } - - public int getBatchSize() { - return ids.size(); - } - }); - return updateCnt; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/ViewConfigurationRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/ViewConfigurationRepository.java deleted file mode 100644 index 7dcd9e2f7b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/ViewConfigurationRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.opensrp.repository; - -import java.util.List; - -import org.opensrp.domain.viewconfiguration.ViewConfiguration; - -public interface ViewConfigurationRepository extends BaseRepository { - - List findAllViewConfigurations(); - - List findViewConfigurationsByVersion(Long lastSyncedServerVersion); - - List findByEmptyServerVersion(); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllAppStateTokens.java b/opensrp-core/src/main/java/org/opensrp/repository/couch/AllAppStateTokens.java deleted file mode 100644 index 45ff52dbd5..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllAppStateTokens.java +++ /dev/null @@ -1,113 +0,0 @@ -package org.opensrp.repository.couch; - -import java.util.List; - -import org.ektorp.CouchDbConnector; -import org.ektorp.UpdateConflictException; -import org.ektorp.support.GenerateView; -import org.ektorp.util.Assert; -import org.ektorp.util.Documents; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.AppStateToken; -import org.opensrp.repository.AppStateTokensRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - -import com.mysql.jdbc.StringUtils; - -@Repository("couchAppStateTokensRepository") -@Primary -public class AllAppStateTokens extends MotechBaseRepository implements AppStateTokensRepository { - - private CouchDbConnector db; - - @Autowired - protected AllAppStateTokens(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db) { - super(AppStateToken.class, db); - this.db = db; - } - - @GenerateView - public List findByName(String name) { - return queryView("by_name", name); - } - - @GenerateView - public List findByName(CouchDbConnector db, String name) { - return db.queryView(createQuery("by_name").includeDocs(true).key(name), AppStateToken.class); - } - - /** - * @throws UpdateConflictException if there was an update conflict. - */ - public void update(AppStateToken entity) { - Assert.notNull(entity, "entity may not be null"); - db.update(entity); - } - - /** - * @throws UpdateConflictException if there was an update conflict. - */ - public void add(AppStateToken entity) { - add(db, entity); - } - - /** - * @throws UpdateConflictException if there was an update conflict. - */ - public void add(CouchDbConnector db, AppStateToken entity) { - Assert.notNull(entity, "entity may not be null"); - Assert.isTrue(Documents.isNew(entity), "entity must be new"); - db.create(entity); - } - - public AppStateToken registerAppStateToken(CouchDbConnector db, Enum tokenName, Object defaultValue, - String description, boolean suppressExceptionIfExists) { - if (tokenName == null || StringUtils.isEmptyOrWhitespaceOnly(description)) { - throw new IllegalArgumentException("Token name and description must be provided"); - } - - List atl = findByName(db, tokenName.name()); - if (atl.size() > 0) { - if (!suppressExceptionIfExists) { - throw new IllegalArgumentException("Token with given name (" + tokenName.name() + ") already exists."); - } - return atl.get(0); - } - - AppStateToken token = new AppStateToken(tokenName.name(), defaultValue, 0L, description); - add(db, token); - return token; - } - - public void updateAppStateToken(CouchDbConnector db, Enum tokenName, Object value) { - List ol = findByName(db, tokenName.name()); - if (ol.size() > 1) { - throw new IllegalStateException("System was found to have multiple token with same name (" + tokenName.name() - + "). This can lead to potential critical inconsistencies."); - } - - if (ol.size() == 0) { - throw new IllegalStateException("Property with name (" + tokenName.name() + ") not found."); - } - - AppStateToken ast = ol.get(0); - ast.setValue(value); - ast.setLastEditDate(System.currentTimeMillis()); - db.update(ast); - } - - public AppStateToken getAppStateTokenByName(CouchDbConnector db, Enum tokenName) { - List ol = findByName(db, tokenName.name()); - if (ol.size() > 1) { - throw new IllegalStateException("System was found to have multiple token with same name (" + tokenName.name() - + "). This can lead to potential critical inconsistencies."); - } - - return ol.size() == 0 ? null : ol.get(0); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllBaseEntities.java b/opensrp-core/src/main/java/org/opensrp/repository/couch/AllBaseEntities.java deleted file mode 100644 index e7d5f499e9..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllBaseEntities.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.opensrp.repository.couch; - -import java.util.List; - -import org.ektorp.ComplexKey; -import org.ektorp.CouchDbConnector; -import org.ektorp.support.GenerateView; -import org.ektorp.support.View; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.BaseEntity; -import org.opensrp.repository.BaseEntitiesRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllBaseEntities extends MotechBaseRepository implements BaseEntitiesRepository { - - @Autowired - protected AllBaseEntities(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db) { - super(BaseEntity.class, db); - } - - @GenerateView - public BaseEntity findByBaseEntityId(String baseEntityId) { - List entities = queryView("by_baseEntityId", baseEntityId); - if (entities == null || entities.isEmpty()) { - return null; - } - return entities.get(0); - } - - @View(name = "all_entities", map = "function(doc) { if (doc.baseEntityId && doc.identifiers) { emit(doc.id); } }") - public List findAllBaseEntities() { - return db.queryView(createQuery("all_entities").includeDocs(true), BaseEntity.class); - } - - @View(name = "all_entities_by_identifier", map = "function(doc) {if (doc.baseEntityId && doc.identifiers) {for(var key in doc.identifiers) {emit(doc.identifiers[key]);}}}") - public List findAllByIdentifier(String identifier) { - return db.queryView(createQuery("all_entities_by_identifier").key(identifier).includeDocs(true), BaseEntity.class); - } - - @View(name = "all_entities_by_identifier_of_type", map = "function(doc) {if (doc.baseEntityId && doc.identifiers) {for(var key in doc.identifiers) {emit([key, doc.identifiers[key]]);}}}") - public List findAllByIdentifier(String identifierType, String identifier) { - ComplexKey ckey = ComplexKey.of(identifierType, identifier); - return queryView("all_entities_by_identifier_of_type", ckey); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllClients.java b/opensrp-core/src/main/java/org/opensrp/repository/couch/AllClients.java deleted file mode 100644 index b7369482ec..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllClients.java +++ /dev/null @@ -1,266 +0,0 @@ -package org.opensrp.repository.couch; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.List; - -import org.ektorp.ComplexKey; -import org.ektorp.CouchDbConnector; -import org.ektorp.support.GenerateView; -import org.ektorp.support.View; -import org.ektorp.util.Assert; -import org.ektorp.util.Documents; -import org.joda.time.DateTime; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.Client; -import org.opensrp.domain.postgres.HouseholdClient; -import org.opensrp.repository.ClientsRepository; -import org.opensrp.repository.lucene.LuceneClientRepository; -import org.opensrp.search.AddressSearchBean; -import org.opensrp.search.ClientSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - -import com.mysql.jdbc.StringUtils; - -@Repository("couchClientsRepository") -@Primary -public class AllClients extends MotechBaseRepository implements ClientsRepository { - - private LuceneClientRepository lcr; - - @Autowired - protected AllClients(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db, LuceneClientRepository lcr) { - super(Client.class, db); - this.lcr = lcr; - } - - @GenerateView - public Client findByBaseEntityId(String baseEntityId) { - if (StringUtils.isEmptyOrWhitespaceOnly(baseEntityId)) - return null; - List clients = queryView("by_baseEntityId", baseEntityId); - if (clients == null || clients.isEmpty()) { - return null; - } - return clients.get(0); - } - - @GenerateView - public Client findByBaseEntityId(CouchDbConnector targetDb, String baseEntityId) { - if (StringUtils.isEmptyOrWhitespaceOnly(baseEntityId)) - return null; - List clients = queryView(targetDb, "by_baseEntityId", baseEntityId); - if (clients == null || clients.isEmpty()) { - return null; - } - return clients.get(0); - } - - @View(name = "all_clients", map = "function(doc) { if (doc.type === 'Client') { emit(doc.baseEntityId); } }") - public List findAllClients() { - return db.queryView(createQuery("all_clients").includeDocs(true), Client.class); - } - - @View(name = "all_clients_by_identifier", map = "function(doc) {if (doc.type === 'Client') {for(var key in doc.identifiers) {emit(doc.identifiers[key]);}}}") - public List findAllByIdentifier(String identifier) { - return db.queryView(createQuery("all_clients_by_identifier").key(identifier).includeDocs(true), Client.class); - } - - @View(name = "all_clients_by_identifier", map = "function(doc) {if (doc.type === 'Client') {for(var key in doc.identifiers) {emit(doc.identifiers[key]);}}}") - public List findAllByIdentifier(CouchDbConnector targetDb, String identifier) { - return targetDb.queryView(createQuery("all_clients_by_identifier").key(identifier).includeDocs(true), Client.class); - } - - @View(name = "all_clients_by_identifier_of_type", map = "function(doc) {if (doc.type === 'Client') {for(var key in doc.identifiers) {emit([key, doc.identifiers[key]]);}}}") - public List findAllByIdentifier(String identifierType, String identifier) { - ComplexKey ckey = ComplexKey.of(identifierType, identifier); - return db.queryView(createQuery("all_clients_by_identifier_of_type").key(ckey).includeDocs(true), Client.class); - } - - @View(name = "all_clients_by_attribute_of_type", map = "function(doc) {if (doc.type === 'Client') {for(var key in doc.attributes) {emit([key, doc.attributes[key]]);}}}") - public List findAllByAttribute(String attributeType, String attribute) { - ComplexKey ckey = ComplexKey.of(attributeType, attribute); - return db.queryView(createQuery("all_clients_by_attribute_of_type").key(ckey).includeDocs(true), Client.class); - } - - @View(name = "all_clients_by_matching_name", map = "function(doc) {if(doc.type === 'Client'){emit(doc.firstName, doc);emit(doc.lastName, doc);}}") - public List findAllByMatchingName(String nameMatches) { - return db.queryView(createQuery("all_clients_by_matching_name").startKey(nameMatches).endKey(nameMatches + "z") - .includeDocs(true), Client.class); - } - - /** - * Find a client based on the relationship id and between a range of date created dates e.g - * given mother's id get children born at a given time - * - * @param relationalId - * @param dateFrom - * @param dateTo - * @return - */ - @View(name = "client_by_relationship_id_and_date_created", map = "function(doc) { if (doc.type === 'Client' && doc.relationships) {for (var key in doc.relationships) { var entityid=doc.relationships[key][0]; emit([entityid, doc.dateCreated.substring(0,10)], null); }} }") - public List findByRelationshipIdAndDateCreated(String relationalId, String dateFrom, String dateTo) { - ComplexKey startKey = ComplexKey.of(relationalId, dateFrom); - ComplexKey endKey = ComplexKey.of(relationalId, dateTo); - List clients = db.queryView(createQuery("client_by_relationship_id_and_date_created").startKey(startKey) - .endKey(endKey).includeDocs(true), Client.class); - return clients; - } - - // @View(name = "client_by_relationship", map = "function(doc) {if (doc.type === 'Client') {for(var key in doc.relationships) {emit([key, doc.relationships[key]]);}}}") - // @View(name = "client_by_relationship", map = "function(doc) { if(doc.type == 'Client' && doc.relationships.mother[0]) {emit(null, doc._id)} }") - @View(name = "client_by_relationship", map = "function(doc) { if(doc.type === 'Client' && doc.relationships) { for (var key in doc.relationships) { var entityid = doc.relationships[key][0]; if (key === 'mother') {emit([key, entityid], doc);}}}}") - public List findByRelationshipId(String relationshipType, String entityId) { - return db.queryView(createQuery("client_by_relationship").startKey(entityId).endKey(entityId).includeDocs(true), - Client.class); - } - - // @View(name = "clients_by_relationship", map = "function(doc) {if (doc.type === 'Client' && doc.relationships.mother) {for(var key in doc.relationships) {emit(doc.relationships.mother[key]);}}}") - // public List findByRelationshipId(String identifier) { - // return db.queryView(createQuery("clients_by_relationship").key(identifier).includeDocs(true), Client.class); - // } - public List findByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - return lcr.getByCriteria(searchBean, addressSearchBean, null);//db.queryView(q.includeDocs(true), Client.class); - } - - public List findByDynamicQuery(String query) { - return lcr.getByCriteria(query);//db.queryView(q.includeDocs(true), Client.class); - } - - public List findByCriteria(ClientSearchBean searchBean) { - return lcr.getByCriteria(searchBean, new AddressSearchBean(), null); - } - - public List findByCriteria(AddressSearchBean addressSearchBean, DateTime lastEditFrom, DateTime lastEditTo) { - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setLastEditFrom(lastEditFrom); - return lcr.getByCriteria(clientSearchBean, addressSearchBean, null); - } - - public List findByRelationShip(String motherIndentier) { - return lcr.getByClientByMother("mother", motherIndentier); - } - - /** - * Query view from the specified db - * - * @param targetDb - * @param viewName - * @param key - * @return - */ - public List queryView(CouchDbConnector targetDb, String viewName, String key) { - return targetDb.queryView(createQuery(viewName).includeDocs(true).key(key), Client.class); - } - - /** - * Save client to the specified db - * - * @param targetDb - * @param client - */ - public void add(CouchDbConnector targetDb, Client client) { - Assert.isTrue(Documents.isNew(client), "entity must be new"); - targetDb.create(client); - } - - /** - * Get all clients without a server version - * - * @return - */ - @View(name = "clients_by_empty_server_version", map = "function(doc) { if ( doc.type == 'Client' && !doc.serverVersion) { emit(doc._id, doc); } }") - public List findByEmptyServerVersion() { - return db.queryView(createQuery("clients_by_empty_server_version").limit(200).includeDocs(true), Client.class); - } - - @View(name = "events_by_version", map = "function(doc) { if (doc.type === 'Client') { emit([doc.serverVersion], null); } }") - public List findByServerVersion(long serverVersion) { - ComplexKey startKey = ComplexKey.of(serverVersion + 1); - ComplexKey endKey = ComplexKey.of(System.currentTimeMillis()); - return db.queryView( - createQuery("events_by_version").startKey(startKey).endKey(endKey).limit(1000).includeDocs(true), Client.class); - } - - public List findByFieldValue(String field, List ids) { - return lcr.getByFieldValue(field, ids); - } - - @View(name = "clients_not_in_OpenMRS", map = "function(doc) { if (doc.type === 'Client' && doc.serverVersion) { var noId = true; for(var key in doc.identifiers) {if(key == 'OPENMRS_UUID' && doc.identifiers.OPENMRS_UUID !== null) {noId = false;}}if(noId){emit([doc.serverVersion], null); }} }") - public List notInOpenMRSByServerVersion(long serverVersion, Calendar calendar) { - long serverStartKey = serverVersion + 1; - long serverEndKey = calendar.getTimeInMillis(); - if (serverStartKey < serverEndKey) { - ComplexKey startKey = ComplexKey.of(serverStartKey); - ComplexKey endKey = ComplexKey.of(serverEndKey); - return db.queryView(createQuery("clients_not_in_OpenMRS").startKey(startKey).endKey(endKey).limit(1000) - .includeDocs(true), Client.class); - } - return new ArrayList<>(); - } - - @Override - public List selectMemberCountHouseholdHeadProviderByClients(String field, List ids, - String clientType) { - return null; - } - - @Override - public HouseholdClient findTotalCountHouseholdByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - - return null; - } - - @Override - public List findMembersByRelationshipId(String baseEntityId) { - - return null; - } - - @Override - public HouseholdClient findCountAllClientsByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List findAllClientsByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List findHouseholdByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List findANCByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - // TODO Auto-generated method stub - return null; - } - - @Override - public int findCountANCByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public List findChildByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - // TODO Auto-generated method stub - return null; - } - - @Override - public int findCountChildByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - // TODO Auto-generated method stub - return 0; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllErrorTrace.java b/opensrp-core/src/main/java/org/opensrp/repository/couch/AllErrorTrace.java deleted file mode 100644 index f56328d611..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllErrorTrace.java +++ /dev/null @@ -1,64 +0,0 @@ - -package org.opensrp.repository.couch; - -import java.util.List; - -import org.ektorp.CouchDbConnector; -import org.ektorp.DocumentNotFoundException; -import org.ektorp.support.View; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.ErrorTrace; -import org.opensrp.repository.ErrorTraceRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - -/** - * @author muhammad.ahmed@ihsinformatics.com Created on May 25, 2015 - */ -@Repository("couchErrorTraceRepository") -@Primary -public class AllErrorTrace extends MotechBaseRepository implements ErrorTraceRepository { - - @Autowired - protected AllErrorTrace(@Qualifier(AllConstants.OPENSRP_ERRORTRACE_DATABASE) CouchDbConnector db) { - super(ErrorTrace.class, db); - } - - //@GenerateView - public ErrorTrace findById(String _id) throws DocumentNotFoundException { - - /*db.queryView(createQuery("_id").keys(_id) - .includeDocs(true), ErrorTrace.class);*/ - ErrorTrace errors = (ErrorTrace) get(_id); - //List errors = queryView("_id", _id); - if (errors == null) { - System.out.println("Error by id : = found nothing !"); - return null; - } - System.out.println("Error by id : = " + errors); - return errors; - } - - public boolean exists(String id) { - return findById(id) != null; - } - - @View(name = "all_errors", map = "function(doc) { emit(doc.id); }") - public List findAllErrors() throws DocumentNotFoundException { - return db.queryView(createQuery("all_errors").includeDocs(true), ErrorTrace.class); - } - - @View(name = "all_unsolved_errors", map = "function(doc) { if (doc.status === 'unsolved') { emit(doc.id); } }") - public List findAllUnSolvedErrors() throws DocumentNotFoundException { - return db.queryView(createQuery("all_unsolved_errors").includeDocs(true), ErrorTrace.class); - } - - @View(name = "all_solved_errors", map = "function(doc) { if (doc.status === 'solved') { emit(doc.id); } }") - public List findAllSolvedErrors() throws DocumentNotFoundException { - return db.queryView(createQuery("all_solved_errors").includeDocs(true), ErrorTrace.class); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllEvents.java b/opensrp-core/src/main/java/org/opensrp/repository/couch/AllEvents.java deleted file mode 100644 index 695f3a53f4..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllEvents.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.opensrp.repository.couch; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; - -import org.ektorp.ComplexKey; -import org.ektorp.CouchDbConnector; -import org.ektorp.UpdateConflictException; -import org.ektorp.support.GenerateView; -import org.ektorp.support.View; -import org.ektorp.util.Assert; -import org.ektorp.util.Documents; -import org.joda.time.DateTime; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.Event; -import org.opensrp.repository.EventsRepository; -import org.opensrp.repository.lucene.LuceneEventRepository; -import org.opensrp.search.EventSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - -@Repository("couchEventsRepository") -@Primary -public class AllEvents extends MotechBaseRepository implements EventsRepository { - - private LuceneEventRepository ler; - - @Autowired - protected AllEvents(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db, LuceneEventRepository ler) { - super(Event.class, db); - this.ler = ler; - } - - @View(name = "all_events_by_identifier", map = "function(doc) {if (doc.type === 'Event') {for(var key in doc.identifiers) {emit(doc.identifiers[key]);}}}") - public List findAllByIdentifier(String identifier) { - return db.queryView(createQuery("all_events_by_identifier").key(identifier).includeDocs(true), Event.class); - } - - @View(name = "all_events_by_identifier_of_type", map = "function(doc) {if (doc.type === 'Event') {for(var key in doc.identifiers) {emit([key, doc.identifiers[key]]);}}}") - public List findAllByIdentifier(String identifierType, String identifier) { - ComplexKey ckey = ComplexKey.of(identifierType, identifier); - return db.queryView(createQuery("all_events_by_identifier_of_type").key(ckey).includeDocs(true), Event.class); - } - - public Event findById(String id) { - Event event = db.get(Event.class, id); - return event; - } - - @GenerateView - public Event findByFormSubmissionId(String formSubmissionId) { - List events = queryView("by_formSubmissionId", formSubmissionId); - if (events == null || events.isEmpty()) - return null; - else if (events.size() > 1) { - throw new IllegalStateException("Multiple events for formSubmissionId " + formSubmissionId); - } else - return events.get(0); - } - - @GenerateView - public List findByBaseEntityId(String baseEntityId) { - return queryView("by_baseEntityId", baseEntityId); - } - - @View(name = "all_events_by_base_entity_and_form_submission", map = "function(doc) { if (doc.type === 'Event'){ emit([doc.baseEntityId, doc.formSubmissionId], doc); } }") - public Event findByBaseEntityAndFormSubmissionId(String baseEntityId, String formSubmissionId) { - List events = db.queryView(createQuery("all_events_by_base_entity_and_form_submission") - .key(ComplexKey.of(baseEntityId, formSubmissionId)).includeDocs(true), - Event.class); - if (events == null || events.isEmpty()) - return null; - else if (events.size() > 1) { - throw new IllegalStateException("Multiple events for baseEntityId and formSubmissionId combination (" - + baseEntityId + "," + formSubmissionId + ")"); - } else - return events.get(0); - - } - - @View(name = "all_events_by_base_entity_and_type", map = "function(doc) { if (doc.type === 'Event'){ emit([doc.baseEntityId, doc.eventType], doc); } }") - public List findByBaseEntityAndType(String baseEntityId, String eventType) { - return db.queryView( - createQuery("all_events_by_base_entity_and_type").key(ComplexKey.of(baseEntityId, eventType)).includeDocs(true), - Event.class); - } - - @View(name = "all_events_by_base_entity_and_form_submission", map = "function(doc) { if (doc.type === 'Event'){ emit([doc.baseEntityId, doc.formSubmissionId], doc); } }") - public List findByBaseEntityAndFormSubmissionId(CouchDbConnector targetDb, String baseEntityId, - String formSubmissionId) { - return targetDb.queryView(createQuery("all_events_by_base_entity_and_form_submission") - .key(ComplexKey.of(baseEntityId, formSubmissionId)).includeDocs(true), - Event.class); - } - - public List findEvents(EventSearchBean eventSearchBean) { - return ler.getByCriteria(eventSearchBean); - } - - public List findEventsByDynamicQuery(String query) { - return ler.getByCriteria(query); - } - - /** - * Save event to the specified db - * - * @throws UpdateConflictException if there was an update conflict. - */ - public void add(CouchDbConnector targetDb, Event event) { - Assert.isTrue(Documents.isNew(event), "entity must be new"); - targetDb.create(event); - } - - @View(name = "events_by_version", map = "function(doc) { if (doc.type === 'Event') { emit([doc.serverVersion], null); } }") - public List findByServerVersion(long serverVersion) { - ComplexKey startKey = ComplexKey.of(serverVersion + 1); - ComplexKey endKey = ComplexKey.of(Long.MAX_VALUE); - return db.queryView(createQuery("events_by_version").startKey(startKey).endKey(endKey).limit(1000).includeDocs(true), - Event.class); - } - - @View(name = "events_not_in_OpenMRS", map = "function(doc) { if (doc.type === 'Event' && doc.serverVersion) { var noId = true; for(var key in doc.identifiers) {if(key == 'OPENMRS_UUID') {noId = false;}}if(noId){emit([doc.serverVersion], null); }} }") - public List notInOpenMRSByServerVersion(long serverVersion, Calendar calendar) { - long serverStartKey = serverVersion + 1; - long serverEndKey = calendar.getTimeInMillis(); - if (serverStartKey < serverEndKey) { - ComplexKey startKey = ComplexKey.of(serverStartKey); - ComplexKey endKey = ComplexKey.of(serverEndKey); - return db.queryView( - createQuery("events_not_in_OpenMRS").startKey(startKey).endKey(endKey).limit(1000).includeDocs(true), - Event.class); - } - return new ArrayList<>(); - } - - @View(name = "events_by_type_not_in_OpenMRS", map = "function(doc) { if (doc.type === 'Event' && doc.serverVersion) { var noId = true; for(var key in doc.identifiers) {if(key == 'OPENMRS_UUID') {noId = false;}}if(noId){emit([doc.eventType, doc.serverVersion], null); }} }") - public List notInOpenMRSByServerVersionAndType(String type, long serverVersion, Calendar calendar) { - long serverStartKey = serverVersion + 1; - long serverEndKey = calendar.getTimeInMillis(); - if (serverStartKey < serverEndKey) { - ComplexKey startKey = ComplexKey.of(type, serverStartKey); - ComplexKey endKey = ComplexKey.of(type, serverEndKey); - return db.queryView( - createQuery("events_by_type_not_in_OpenMRS").startKey(startKey).endKey(endKey).limit(1000).includeDocs(true), - Event.class); - } - return new ArrayList<>(); - } - - /** - * Find an event based on a concept and between a range of date created dates - * - * @param concept - * @param conceptValue - * @param dateFrom - * @param dateTo - * @return - */ - @View(name = "event_by_concept_and_date_created", map = "function(doc) {if (doc.type === 'Event' && doc.obs) {for (var obs in doc.obs) {var fieldCode = doc.obs[obs].fieldCode;var value = doc.obs[obs].values[0];emit([doc.baseEntityId,fieldCode,value,doc.dateCreated.substring(0, 10)],null);}}}") - public List findByClientAndConceptAndDate(String baseEntityId, String concept, String conceptValue, - String dateFrom, String dateTo) { - ComplexKey startKey = ComplexKey.of(baseEntityId, concept, conceptValue, dateFrom); - ComplexKey endKey = ComplexKey.of(baseEntityId, concept, conceptValue, dateTo); - List events = db.queryView( - createQuery("event_by_concept_and_date_created").startKey(startKey).endKey(endKey).includeDocs(true), - Event.class); - return events; - } - - @View(name = "event_by_concept_parent_code_and_base_entity_id", map = "function(doc) {if (doc.type === 'Event' && doc.obs) {for (var obs in doc.obs) {var fieldCode = doc.obs[obs].fieldCode;var parentCode = doc.obs[obs].parentCode;emit([doc.baseEntityId, fieldCode, parentCode], null);}}}") - public List findByBaseEntityIdAndConceptParentCode(String baseEntityId, String concept, String parentCode) { - ComplexKey startKey = ComplexKey.of(baseEntityId, concept, parentCode); - ComplexKey endKey = ComplexKey.of(baseEntityId, concept, parentCode); - List events = db.queryView(createQuery("event_by_concept_parent_code_and_base_entity_id").startKey(startKey) - .endKey(endKey).includeDocs(true), - Event.class); - return events; - } - - @View(name = "event_by_concept_and_value", map = "function(doc) {if (doc.type === 'Event' && doc.obs) {for (var obs in doc.obs) {var fieldCode = doc.obs[obs].fieldCode;var value = doc.obs[obs].values[0];emit([fieldCode,value],null);}}}") - public List findByConceptAndValue(String concept, String conceptValue) { - List events = db.queryView( - createQuery("event_by_concept_and_value").key(ComplexKey.of(concept, conceptValue)).includeDocs(true), - Event.class); - return events; - } - - @View(name = "events_by_empty_server_version", map = "function(doc) { if (doc.type == 'Event' && !doc.serverVersion) { emit(doc._id, doc); } }") - public List findByEmptyServerVersion() { - return db.queryView(createQuery("events_by_empty_server_version").limit(200).includeDocs(true), Event.class); - } - - @GenerateView - public List getAll() { - return super.getAll(); - } - - public List findEvents(EventSearchBean eventSearchBean, String sortBy, String sortOrder, int limit) { - return ler.getByCriteria(eventSearchBean, sortBy, sortOrder, limit); - } - - @View(name = "all_events_by_event_type_and_version", map = "function(doc) { if (doc.type === 'Event'){ emit([doc.eventType, doc.version], null); } }") - public List findEventByEventTypeBetweenTwoDates(String eventType) { - Calendar calendar = Calendar.getInstance(); - calendar.set(Calendar.DATE, 1); - System.err.println("calendar.getTime():" + calendar.getTime().getTime()); - ComplexKey start = ComplexKey.of(eventType, calendar.getTime().getTime()); - ComplexKey end = ComplexKey.of(eventType, System.currentTimeMillis()); - List events = db.queryView( - createQuery("all_events_by_event_type_and_version").startKey(start).endKey(end).includeDocs(true), Event.class); - - return events; - } - - @View(name = "events_by_provider_and_entity_type", map = "function(doc) { if (doc.type === 'Event' && (doc.entityType=='child' || doc.entityType=='mother')) { emit(doc.providerId, null); } }") - public List findByProvider(String provider) { - return db.queryView(createQuery("events_by_provider_and_entity_type").key(provider).includeDocs(true), Event.class); - } - - @Override - public List findIdsByEventType(String eventType, Date dateDeleted) { - return null; //TODO Should this be implemented???? - } - - public synchronized Event addEvent(CouchDbConnector targetDb, Event event) { - // Event e = find(targetDb,event); - // if(e != null){ - // throw new IllegalArgumentException("An event already exists with given list of identifiers. Consider updating data.["+e+"]"); - // } - if (event.getFormSubmissionId() != null && getByBaseEntityAndFormSubmissionId(targetDb, event.getBaseEntityId(), - event.getFormSubmissionId()) != null) { - throw new IllegalArgumentException( - "An event already exists with given baseEntity and formSubmission combination. Consider updating"); - } - - event.setDateCreated(new DateTime()); - - add(targetDb, event); - return event; - } - - public Event getByBaseEntityAndFormSubmissionId(CouchDbConnector targetDb, String baseEntityId, - String formSubmissionId) { - try { - List events = findByBaseEntityAndFormSubmissionId(targetDb, baseEntityId, formSubmissionId); - if (events.size() > 1) { - throw new IllegalArgumentException(); - } - if (events.size() == 0) { - return null; - } - return events.get(0); - } - catch (IllegalArgumentException e) { - throw new IllegalStateException("Multiple events for baseEntityId and formSubmissionId combination (" - + baseEntityId + "," + formSubmissionId + ")"); - } - catch (Exception e) { - return null; - } - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllLocations.java b/opensrp-core/src/main/java/org/opensrp/repository/couch/AllLocations.java deleted file mode 100644 index 934a3bf362..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllLocations.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.opensrp.repository.couch; - -import java.util.List; - -import org.ektorp.CouchDbConnector; -import org.ektorp.support.GenerateView; -import org.ektorp.support.View; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.Location; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllLocations extends MotechBaseRepository { - - @Autowired - protected AllLocations(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db) { - super(Location.class, db); - } - - @GenerateView - public Location findByLocationId(String locationId) { - List locations = queryView("by_locationId", locationId); - if (locations == null || locations.isEmpty()) { - return null; - } - return locations.get(0); - } - - @View(name = "all_locations", map = "function(doc) { if (doc.type === 'Location') { emit(doc.locationId); } }") - public List findAllLocations() { - return db.queryView(createQuery("all_locations").includeDocs(true), Location.class); - } - - @View(name = "all_locations_by_LocationIDs", map = "function(doc) { if (doc.type === 'Location' && doc.locationId) { emit(doc.locationId); } }") - public List findAllLocationByIds(List Ids) { - return db.queryView(createQuery("all_locations_by_LocationIDs").keys(Ids).includeDocs(true), Location.class); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllProviders.java b/opensrp-core/src/main/java/org/opensrp/repository/couch/AllProviders.java deleted file mode 100644 index fb6599d22b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllProviders.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.opensrp.repository.couch; - -import java.util.List; - -import org.ektorp.CouchDbConnector; -import org.ektorp.support.GenerateView; -import org.ektorp.support.View; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.Provider; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllProviders extends MotechBaseRepository { - - @Autowired - protected AllProviders(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db) { - super(Provider.class, db); - } - - @GenerateView - public Provider findByBaseEntityId(String baseEntityId) { - List providers = queryView("by_baseEntityId", baseEntityId); - if (providers == null || providers.isEmpty()) { - return null; - } - return providers.get(0); - } - - public boolean exists(String baseEntityId) { - return findByBaseEntityId(baseEntityId) != null; - } - - @View(name = "all_providers", map = "function(doc) { if (doc.type === 'Provider') { emit(doc.baseEntityId); } }") - public List findAllProviders() { - return db.queryView(createQuery("all_providers").includeDocs(true), Provider.class); - } - - @View(name = "all_providers_by_baseEntityIDs", map = "function(doc) { if (doc.type === 'Provider' && doc.baseEntityId) { emit(doc.baseEntityId); } }") - public List findAllProviderByIds(List Ids) { - return db.queryView(createQuery("all_providers_by_baseEntityIDs").keys(Ids).includeDocs(true), Provider.class); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllReports.java b/opensrp-core/src/main/java/org/opensrp/repository/couch/AllReports.java deleted file mode 100644 index 59e42a202b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllReports.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.opensrp.repository.couch; - -import java.util.List; - -import org.ektorp.ComplexKey; -import org.ektorp.CouchDbConnector; -import org.ektorp.support.GenerateView; -import org.ektorp.support.View; -import org.joda.time.DateTime; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.Report; -import org.opensrp.repository.ReportsRepository; -import org.opensrp.repository.lucene.LuceneReportRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - -@Repository("couchReportsRepository") -@Primary -public class AllReports extends MotechBaseRepository implements ReportsRepository { - - private LuceneReportRepository lrr; - - @Autowired - protected AllReports(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db, - LuceneReportRepository lrr) { - super(Report.class, db); - this.lrr = lrr; - } - - public Report findById(String id) { - Report report = db.get(Report.class, id); - return report; - } - - @GenerateView - public List getAll() { - return super.getAll(); - } - - @GenerateView - public List findByBaseEntityId(String baseEntityId) { - return queryView("by_baseEntityId", baseEntityId); - } - - @View(name = "all_reports_by_identifier", map = "function(doc) {if (doc.type === 'Report') {for(var key in doc.identifiers) {emit(doc.identifiers[key]);}}}") - public List findAllByIdentifier(String identifier) { - return db.queryView(createQuery("all_reports_by_identifier").key(identifier).includeDocs(true), Report.class); - } - - @View(name = "all_reports_by_base_entity_and_type", map = "function(doc) { if (doc.type === 'Report'){ emit([doc.baseEntityId, doc.reportType], doc); } }") - public List findByBaseEntityAndType(String baseEntityId, String reportType) { - return db.queryView(createQuery("all_reports_by_base_entity_and_type").key(ComplexKey.of(baseEntityId, reportType)) - .includeDocs(true), - Report.class); - } - - @View(name = "reports_by_empty_server_version", map = "function(doc) { if (doc.type == 'Report' && !doc.serverVersion) { emit(doc._id, doc); } }") - public List findByEmptyServerVersion() { - return db.queryView(createQuery("reports_by_empty_server_version").limit(200).includeDocs(true), Report.class); - } - - @View(name = "reports_by_version", map = "function(doc) { if (doc.type === 'Report') { emit([doc.serverVersion], null); } }") - public List findByServerVersion(long serverVersion) { - ComplexKey startKey = ComplexKey.of(serverVersion + 1); - ComplexKey endKey = ComplexKey.of(Long.MAX_VALUE); - return db.queryView( - createQuery("reports_by_version").startKey(startKey).endKey(endKey).limit(1000).includeDocs(true), Report.class); - } - - @View(name = "all_reports_by_base_entity_and_form_submission", map = "function(doc) { if (doc.type === 'Report'){ emit([doc.baseEntityId, doc.formSubmissionId], doc); } }") - public List findByBaseEntityAndFormSubmissionId(String baseEntityId, String formSubmissionId) { - return db.queryView(createQuery("all_reports_by_base_entity_and_form_submission") - .key(ComplexKey.of(baseEntityId, formSubmissionId)).includeDocs(true), - Report.class); - } - - public List findReports(String team, String providerId, String locationId, String baseEntityId, - Long serverVersion, String sortBy, String sortOrder, int limit) { - return lrr.getByCriteria(team, providerId, locationId, baseEntityId, serverVersion, sortBy, sortOrder, limit); - } - - public List findReports(String baseEntityId, DateTime from, DateTime to, String reportType, String providerId, - String locationId, DateTime lastEditFrom, DateTime lastEditTo) { - return lrr.getByCriteria(baseEntityId, from, to, reportType, providerId, locationId, lastEditFrom, lastEditTo); - } - - public List findReportsByDynamicQuery(String query) { - return lrr.getByCriteria(query); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllStocks.java b/opensrp-core/src/main/java/org/opensrp/repository/couch/AllStocks.java deleted file mode 100644 index d7a053ddab..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllStocks.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.opensrp.repository.couch; - -import java.util.List; - -import org.ektorp.ComplexKey; -import org.ektorp.CouchDbConnector; -import org.ektorp.UpdateConflictException; -import org.ektorp.support.View; -import org.ektorp.util.Assert; -import org.ektorp.util.Documents; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.Stock; -import org.opensrp.repository.StocksRepository; -import org.opensrp.repository.lucene.LuceneStockRepository; -import org.opensrp.search.StockSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - -@Repository("couchStocksRepository") -@Primary -public class AllStocks extends MotechBaseRepository implements StocksRepository { - - private LuceneStockRepository lsr; - - @Autowired - protected AllStocks(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db, LuceneStockRepository ler) { - super(Stock.class, db); - this.lsr = ler; - } - - @View(name = "all_stock_by_providerid", map = "function(doc) {if (doc.type === 'Stock') {for(var key in doc.providerid) {emit(doc.providerid[key]);}}}") - public List findAllByProviderid(String providerid) { - return db.queryView(createQuery("all_stock_by_providerid").key(providerid).includeDocs(true), Stock.class); - } - - @View(name = "all_stock_by_vaccine_type_id", map = "function(doc) {if (doc.type === 'Stock') {for(var key in doc.vaccine_type_id) {emit([key, doc.vaccine_type_id[key]]);}}}") - public List findAllByIdentifier(String vaccine_type, String vaccine_type_id) { - ComplexKey ckey = ComplexKey.of(vaccine_type, vaccine_type_id); - return db.queryView(createQuery("all_stock_by_vaccine_type_id").key(ckey).includeDocs(true), Stock.class); - } - - public Stock findById(String id) { - Stock stock = db.get(Stock.class, id); - return stock; - } - - public List findStocks(StockSearchBean searchBean, String sortBy, String sortOrder, int limit) { - return lsr.getByCriteria(searchBean.getIdentifier(), searchBean.getStockTypeId(), searchBean.getTransactionType(), - searchBean.getProviderId(), searchBean.getValue(), searchBean.getDateCreated(), searchBean.getToFrom(), - searchBean.getDateUpdated(), searchBean.getServerVersion(), sortBy, sortOrder, limit); - } - - public List findStocks(StockSearchBean searchBean) { - return lsr.getByCriteria(searchBean.getIdentifier(), searchBean.getStockTypeId(), searchBean.getTransactionType(), - searchBean.getProviderId(), searchBean.getValue(), searchBean.getDateCreated(), searchBean.getToFrom(), - searchBean.getDateUpdated(), searchBean.getServerVersion().toString()); - } - - @View(name = "all_stocks", map = "function(doc) { if (doc.type === 'Stock') { emit(doc.dateCreated); } }") - public List findAllStocks() { - return db.queryView(createQuery("all_stocks").includeDocs(true), Stock.class); - } - - /** - * Save stock to the specified db - * - * @throws UpdateConflictException if there was an update conflict. - */ - public void add(CouchDbConnector targetDb, Stock stock) { - Assert.isTrue(Documents.isNew(stock), "entity must be new"); - targetDb.create(stock); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllUsers.java b/opensrp-core/src/main/java/org/opensrp/repository/couch/AllUsers.java deleted file mode 100644 index 9cb59acd49..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/couch/AllUsers.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.opensrp.repository.couch; - -import java.util.List; - -import org.ektorp.CouchDbConnector; -import org.ektorp.support.GenerateView; -import org.ektorp.support.View; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.User; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllUsers extends MotechBaseRepository { - - @Autowired - protected AllUsers(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db) { - super(User.class, db); - } - - @GenerateView - public User findByBaseEntityId(String baseEntityId) { - List users = queryView("by_baseEntityId", baseEntityId); - if (users == null || users.isEmpty()) { - return null; - } - return users.get(0); - } - - public boolean exists(String caseId) { - return findByBaseEntityId(caseId) != null; - } - - @View(name = "all_users", map = "function(doc) { if (doc.type === 'User') { emit(doc.baseEntityId); } }") - public List findAllUsers() { - return db.queryView(createQuery("all_users").includeDocs(true), User.class); - } - - @View(name = "all_users_by_CaseIDs", map = "function(doc) { if (doc.type === 'User' && doc.baseEntityId) { emit(doc.baseEntityId); } }") - public List findAllByUserByIds(List Ids) { - return db.queryView(createQuery("all_users_by_CaseIDs").keys(Ids).includeDocs(true), User.class); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/couch/MultimediaRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/couch/MultimediaRepositoryImpl.java deleted file mode 100644 index 461b7bf9eb..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/couch/MultimediaRepositoryImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.opensrp.repository.couch; - -import java.util.ArrayList; -import java.util.List; - -import org.ektorp.CouchDbConnector; -import org.ektorp.support.GenerateView; -import org.ektorp.support.View; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.Multimedia; -import org.opensrp.repository.MultimediaRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - -@Repository("couchMultimediaRepository") -@Primary -public class MultimediaRepositoryImpl extends MotechBaseRepository implements MultimediaRepository { - - @Autowired - protected MultimediaRepositoryImpl(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db) { - super(Multimedia.class, db); - } - - @GenerateView - public Multimedia findByCaseId(String entityId) { - List files = queryView("by_caseId", entityId); - if (files == null || files.isEmpty()) { - return null; - } - return files.get(0); - } - - @View(name = "all_multimedia_files", map = "function(doc) { if (doc.type === 'Multimedia' && doc.providerId) { emit(doc.providerId, doc); } }") - public List all(String providerId) { - return db.queryView(createQuery("all_multimedia_files").key(providerId).includeDocs(true), Multimedia.class); - } - - @Override - public List get(String entityId, String contentType, String fileCategory) { - // todo: placeholder, not supporting couchdb queries for new api endpoints - return new ArrayList<>(); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/couch/SearchRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/couch/SearchRepositoryImpl.java deleted file mode 100644 index d8a595b37a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/couch/SearchRepositoryImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.opensrp.repository.couch; - -import java.util.List; - -import org.ektorp.CouchDbConnector; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.Client; -import org.opensrp.domain.Search; -import org.opensrp.repository.SearchRepository; -import org.opensrp.repository.lucene.LuceneSearchRepository; -import org.opensrp.search.ClientSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - -@Repository("couchSearchRepository") -@Primary -public class SearchRepositoryImpl extends MotechBaseRepository implements SearchRepository { - - private LuceneSearchRepository sr; - - @Autowired - protected SearchRepositoryImpl(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db, - LuceneSearchRepository sr) { - super(Search.class, db); - this.sr = sr; - } - - public List findByCriteria(ClientSearchBean clientSearchBean, String firstName, String middleName, - String lastName, Integer limit) { - return sr.getByCriteria(clientSearchBean, firstName, middleName, lastName, limit); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/couch/SettingRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/couch/SettingRepositoryImpl.java deleted file mode 100644 index cb8d772919..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/couch/SettingRepositoryImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.opensrp.repository.couch; - -import java.util.List; - -import org.ektorp.ComplexKey; -import org.ektorp.CouchDbConnector; -import org.ektorp.support.CouchDbRepositorySupport; -import org.ektorp.support.View; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.postgres.Settings; -import org.opensrp.domain.postgres.SettingsMetadata; -import org.opensrp.domain.setting.SettingConfiguration; -import org.opensrp.repository.SettingRepository; -import org.opensrp.search.SettingSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - -@Repository("couchSettingRepository") -@Primary -public class SettingRepositoryImpl extends CouchDbRepositorySupport implements SettingRepository { - - @Autowired - protected SettingRepositoryImpl(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db) { - super(SettingConfiguration.class, db); - initStandardDesignDocument(); - } - - @View(name = "all_settings", map = "function(doc) { if (doc.type==='Setting') { emit(doc.identifier); }}") - public List findAllSettings() { - return db.queryView(createQuery("all_settings").includeDocs(true), SettingConfiguration.class); - } - - @View(name = "settings_by_version", map = "function(doc) { if (doc.type==='Setting') { emit([doc.serverVersion], null); }}") - public List findAllSettingsByVersion(Long lastSyncedServerVersion, String teamId) { - ComplexKey startKey = ComplexKey.of(lastSyncedServerVersion); - ComplexKey endKey = ComplexKey.of(Long.MAX_VALUE); - return db.queryView(createQuery("settings_by_version").includeDocs(true).startKey(startKey).endKey(endKey), - SettingConfiguration.class); - } - - /** - * Get all Settings without a server version - * - * @return settings - */ - @View(name = "settings_by_empty_server_version", map = "function(doc) { if ( doc.type == 'Setting' && !doc.serverVersion) { emit(doc._id, doc); } }") - public List findByEmptyServerVersion() { - return db.queryView(createQuery("settings_by_empty_server_version").limit(200).includeDocs(true), - SettingConfiguration.class); - } - - @Override - public void safeRemove(SettingConfiguration entity) { - remove(entity); - } - - @Override - public Settings getSettingById(Long id) { - // TODO Auto-generated method stub - return null; - } - - @Override - public SettingsMetadata getSettingMetadataByDocumentId(String documentId) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List findSettings(SettingSearchBean settingQueryBean) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/couch/ViewConfigurationRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/couch/ViewConfigurationRepositoryImpl.java deleted file mode 100644 index 60e343faa7..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/couch/ViewConfigurationRepositoryImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.opensrp.repository.couch; - -import java.util.List; - -import org.ektorp.ComplexKey; -import org.ektorp.CouchDbConnector; -import org.ektorp.support.CouchDbRepositorySupport; -import org.ektorp.support.View; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.viewconfiguration.ViewConfiguration; -import org.opensrp.repository.ViewConfigurationRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Repository; - -@Repository("couchViewConfigurationRepository") -@Primary -public class ViewConfigurationRepositoryImpl extends CouchDbRepositorySupport implements ViewConfigurationRepository { - - @Autowired - protected ViewConfigurationRepositoryImpl(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db) { - super(ViewConfiguration.class, db); - initStandardDesignDocument(); - } - - @View(name = "all_view_configurations", map = "function(doc) { if (doc.type==='ViewConfiguration') { emit(doc.identifier); }}") - public List findAllViewConfigurations() { - return db.queryView(createQuery("all_view_configurations").includeDocs(true), ViewConfiguration.class); - } - - @View(name = "view_configurations_by_version", map = "function(doc) { if (doc.type==='ViewConfiguration') { emit([doc.serverVersion], null); }}") - public List findViewConfigurationsByVersion(Long lastSyncedServerVersion) { - ComplexKey startKey = ComplexKey.of(lastSyncedServerVersion); - ComplexKey endKey = ComplexKey.of(Long.MAX_VALUE); - return db.queryView( - createQuery("view_configurations_by_version").includeDocs(true).startKey(startKey).endKey(endKey), - ViewConfiguration.class); - } - - /** - * Get all ViewConfigurations without a server version - * - * @return view configuration - */ - @View(name = "view_configurations_by_empty_server_version", map = "function(doc) { if ( doc.type == 'ViewConfiguration' && !doc.serverVersion) { emit(doc._id, doc); } }") - public List findByEmptyServerVersion() { - return db.queryView(createQuery("view_configurations_by_empty_server_version").limit(200).includeDocs(true), - ViewConfiguration.class); - } - - @Override - public void safeRemove(ViewConfiguration entity) { - remove(entity); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/lucene/FilterType.java b/opensrp-core/src/main/java/org/opensrp/repository/lucene/FilterType.java deleted file mode 100644 index b99f76a7c0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/lucene/FilterType.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.opensrp.repository.lucene; - -public enum FilterType { - AND, - OR -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneActionRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneActionRepository.java deleted file mode 100644 index 61f1762aaf..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneActionRepository.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.opensrp.repository.lucene; - -import static org.opensrp.common.AllConstants.Event.PROVIDER_ID; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.opensrp.scheduler.Action; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.github.ldriscoll.ektorplucene.CouchDbRepositorySupportWithLucene; -import com.github.ldriscoll.ektorplucene.LuceneQuery; -import com.github.ldriscoll.ektorplucene.LuceneResult; -import com.github.ldriscoll.ektorplucene.designdocument.annotation.FullText; -import com.github.ldriscoll.ektorplucene.designdocument.annotation.Index; -import com.mysql.jdbc.StringUtils; - -@FullText({ @Index(name = "by_all_criteria", analyzer = "perfield:{baseEntityId:\"keyword\"}", index = "function(doc) {" - + "if (doc.type !== 'Action') return null;" - + "var arr1 = ['baseEntityId','providerId','actionTarget','actionType', 'isActionActive','timeStamp','version'];" - + "var ret = new Document();" + "for (var i in arr1) {" + "ret.add(doc[arr1[i]], {" + "'field': arr1[i]" + " });}" - + "return ret;}") }) -@Component -public class LuceneActionRepository extends CouchDbRepositorySupportWithLucene { - - private LuceneDbConnector ldb; - - @Autowired - protected LuceneActionRepository(LuceneDbConnector db) { - super(Action.class, db); - this.ldb = db; - initStandardDesignDocument(); - } - - /** - * @param providerId- health worker id - * @param timeStamp - * @param sortBy Prefix with / for ascending order and \ for descending order (ascending is the - * default if not specified). - * @param sortOrder either descending or ascending - * @param limit - * @param team this is a comma separated string of team members id - * @return - */ - public List getByCriteria(String team, String providerId, Long timeStamp, String sortBy, String sortOrder, - int limit) { - // create a simple query against the view/search function that we've created - LuceneQuery query = new LuceneQuery("Action", "by_all_criteria"); - - Query qf = new Query(FilterType.AND); - - if (timeStamp != null) { - qf.between(org.opensrp.common.AllConstants.Action.TIMESTAMP, timeStamp, Long.MAX_VALUE); - } - - if (team != null && !team.isEmpty()) { - //convert team string to list - String[] idsArray = org.apache.commons.lang.StringUtils.split(team, ","); - List ids = new ArrayList(Arrays.asList(idsArray)); - //include providerId records also - if (providerId != null && !ids.contains(providerId)) { - ids.add(providerId); - } - qf.inList(PROVIDER_ID, ids); - } else if ((providerId != null && !StringUtils.isEmptyOrWhitespaceOnly(providerId))) { - qf.eq(PROVIDER_ID, providerId); - } - - if (StringUtils.isEmptyOrWhitespaceOnly(qf.query())) { - throw new RuntimeException("At least one search filter must be specified"); - } - query.setQuery(qf.query()); - // stale must not be ok, as we've only just loaded the docs - query.setStaleOk(false); - query.setIncludeDocs(true); - query.setLimit(limit); - query.setSort((sortOrder.toLowerCase().contains("desc") ? "\\" : "/") + sortBy); - - try { - LuceneResult result = db.queryLucene(query); - return ldb.asList(result, Action.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneClientRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneClientRepository.java deleted file mode 100644 index 7a0747e736..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneClientRepository.java +++ /dev/null @@ -1,224 +0,0 @@ -package org.opensrp.repository.lucene; - -import static org.opensrp.common.AllConstants.BaseEntity.ADDRESS_TYPE; -import static org.opensrp.common.AllConstants.BaseEntity.BASE_ENTITY_ID; -import static org.opensrp.common.AllConstants.BaseEntity.CITY_VILLAGE; -import static org.opensrp.common.AllConstants.BaseEntity.COUNTRY; -import static org.opensrp.common.AllConstants.BaseEntity.COUNTY_DISTRICT; -import static org.opensrp.common.AllConstants.BaseEntity.LAST_UPDATE; -import static org.opensrp.common.AllConstants.BaseEntity.MOTHERS_INDENTIFIER; -import static org.opensrp.common.AllConstants.BaseEntity.STATE_PROVINCE; -import static org.opensrp.common.AllConstants.BaseEntity.SUB_DISTRICT; -import static org.opensrp.common.AllConstants.BaseEntity.SUB_TOWN; -import static org.opensrp.common.AllConstants.BaseEntity.TOWN; -import static org.opensrp.common.AllConstants.Client.BIRTH_DATE; -import static org.opensrp.common.AllConstants.Client.DEATH_DATE; -import static org.opensrp.common.AllConstants.Client.FIRST_NAME; -import static org.opensrp.common.AllConstants.Client.GENDER; -import static org.opensrp.common.AllConstants.Client.LAST_NAME; -import static org.opensrp.common.AllConstants.Client.MIDDLE_NAME; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.joda.time.DateTime; -import org.opensrp.domain.Client; -import org.opensrp.search.AddressSearchBean; -import org.opensrp.search.ClientSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.github.ldriscoll.ektorplucene.CouchDbRepositorySupportWithLucene; -import com.github.ldriscoll.ektorplucene.LuceneQuery; -import com.github.ldriscoll.ektorplucene.LuceneResult; -import com.github.ldriscoll.ektorplucene.designdocument.annotation.FullText; -import com.github.ldriscoll.ektorplucene.designdocument.annotation.Index; -import com.mysql.jdbc.StringUtils; - -@FullText({ - @Index(name = "by_all_criteria", analyzer = "perfield:{baseEntityId:\"keyword\",mother:\"keyword\"}", index = "function (doc) { if(doc.type !== 'Client') return null; var docl = new Array(); var len = doc.addresses && doc.addresses.length >0 ? doc.addresses.length : 1; for(var al = 0; al < len; al++) { var arr1 = ['firstName', 'middleName', 'lastName', 'gender']; var arr2 = ['addressType', 'country', 'stateProvince', 'cityVillage', 'countyDistrict', 'subDistrict', 'town', 'subTown']; var ret = new Document(); var baseEntityId = doc.baseEntityId;ret.add(baseEntityId, {'field': 'baseEntityId'}); for(var i in arr1) { ret.add(doc[arr1[i]], {'field' : arr1[i]}); } for(var key in doc.attributes) { ret.add(doc.attributes[key], {'field' : key}); } if (doc.relationships) { for (var key in doc.relationships) { ret.add(doc.relationships[key], { 'field': key }); }} if(doc.addresses) { var ad = doc.addresses[al]; if(ad){ for(var i in arr2) { ret.add(ad[arr2[i]], {'field' : arr2[i]}); } } } var bd = doc.birthdate.substring(0, 19); ret.add(bd, {'field' : 'birthdate','type' : 'date'}); var crd = doc.dateCreated.substring(0, 19); ret.add(crd, {'field' : 'lastEdited','type' : 'date'}); if(doc.dateEdited){ var led = doc.dateEdited.substring(0, 19); ret.add(led, {'field' : 'lastEdited','type' : 'date'}); } docl.push(ret); } return docl; }"), - @Index(name = "by_all_criteria_v2", analyzer = "perfield:{baseEntityId:\"keyword\",mother:\"keyword\"}", - // index = "function (doc) { if(doc.type !== 'Client') return null; var docl = new Array(); var len = doc.addresses ? doc.addresses.length : 1; for(var al = 0; al < len; al++) { var arr1 = ['firstName', 'middleName', 'lastName', 'gender']; var arr2 = ['addressType', 'country', 'stateProvince', 'cityVillage', 'countyDistrict', 'subDistrict', 'town', 'subTown']; var ret = new Document(); var baseEntityId = doc.baseEntityId;ret.add(baseEntityId, {'field': 'baseEntityId'}); for(var i in arr1) { ret.add(doc[arr1[i]], {'field' : arr1[i]}); } for (var key in doc.identifiers) { ret.add(doc.identifiers[key], {'field': key}); } for(var key in doc.attributes) { ret.add(doc.attributes[key], {'field' : key}); } if(doc.addresses) { var ad = doc.addresses[al]; if(ad){ for(var i in arr2) { ret.add(ad[arr2[i]], {'field' : arr2[i]}); } } } var bd = doc.birthdate.substring(0, 19); ret.add(bd, {'field' : 'birthdate','type' : 'date'}); var crd = doc.dateCreated.substring(0, 19); ret.add(crd, {'field' : 'lastEdited','type' : 'date'}); if(doc.dateEdited){ var led = doc.dateEdited.substring(0, 19); ret.add(led, {'field' : 'lastEdited','type' : 'date'}); } docl.push(ret); } return docl; }" - index = "function (doc) { if(doc.type !== 'Client') return null; var docl = new Array(); var len = doc.addresses && doc.addresses.length >0 ? doc.addresses.length : 1; for(var al = 0; al < len; al++) { var arr1 = ['firstName', 'middleName', 'lastName', 'gender']; var arr2 = ['addressType', 'country', 'stateProvince', 'cityVillage', 'countyDistrict', 'subDistrict', 'town', 'subTown']; var ret = new Document(); var baseEntityId = doc.baseEntityId;ret.add(baseEntityId, {'field': 'baseEntityId'}); for(var i in arr1) { ret.add(doc[arr1[i]], {'field' : arr1[i]}); } for(var key in doc.attributes) { ret.add(doc.attributes[key], {'field' : key}); } if (doc.relationships) {for (var key in doc.relationships) {ret.add(doc.relationships[key][0], {'field': key });}} if(doc.addresses) { var ad = doc.addresses[al]; if(ad){ for(var i in arr2) { ret.add(ad[arr2[i]], {'field' : arr2[i]}); } } } var bd = doc.birthdate.substring(0, 19); ret.add(bd, {'field' : 'birthdate','type' : 'date'}); var crd = doc.dateCreated.substring(0, 19); ret.add(crd, {'field' : 'lastEdited','type' : 'date'}); if(doc.dateEdited){ var led = doc.dateEdited.substring(0, 19); ret.add(led, {'field' : 'lastEdited','type' : 'date'}); } docl.push(ret); } return docl; }") }) -@Component -public class LuceneClientRepository extends CouchDbRepositorySupportWithLucene { - - private LuceneDbConnector ldb; - - @Autowired - protected LuceneClientRepository(LuceneDbConnector db) { - super(Client.class, db); - this.ldb = db; - initStandardDesignDocument(); - } - - public List getByCriteria(ClientSearchBean searchBean, String motherIdentifier) { - return getByCriteria(searchBean, new AddressSearchBean(), motherIdentifier); - } - - public List getByCriteria(AddressSearchBean addressSearchBean, DateTime lastEditFrom, DateTime lastEditTo, - String motherIdentifier) { - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setLastEditFrom(lastEditFrom); - clientSearchBean.setLastEditTo(lastEditTo); - return getByCriteria(clientSearchBean, addressSearchBean, motherIdentifier); - } - - public List getByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean, - String motherIdentifier) { - // create a simple query against the view/search function that we've created - LuceneQuery query = new LuceneQuery("Client", "by_all_criteria"); - - Query q = new Query(FilterType.OR); - if (!StringUtils.isEmptyOrWhitespaceOnly(searchBean.getNameLike())) { - q.like(FIRST_NAME, searchBean.getNameLike()); - q.like(MIDDLE_NAME, searchBean.getNameLike()); - q.like(LAST_NAME, searchBean.getNameLike()); - } - Query qf = new Query(FilterType.AND, q); - if (!StringUtils.isEmptyOrWhitespaceOnly(searchBean.getGender())) { - qf.eq(GENDER, searchBean.getGender()); - } - if (searchBean.getBirthdateFrom() != null && searchBean.getBirthdateTo() != null) { - qf.between(BIRTH_DATE, searchBean.getBirthdateFrom(), searchBean.getBirthdateTo()); - } - if (searchBean.getDeathdateFrom() != null && searchBean.getDeathdateTo() != null) { - qf.between(DEATH_DATE, searchBean.getDeathdateFrom(), searchBean.getDeathdateTo()); - } - if (searchBean.getLastEditFrom() != null & searchBean.getLastEditTo() != null) { - qf.between(LAST_UPDATE, searchBean.getLastEditFrom(), searchBean.getLastEditTo()); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(searchBean.getAttributeValue())) { - qf.eq(searchBean.getAttributeType(), searchBean.getAttributeValue()); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(addressSearchBean.getAddressType())) { - qf.eq(ADDRESS_TYPE, addressSearchBean.getAddressType()); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(addressSearchBean.getCountry())) { - qf.eq(COUNTRY, addressSearchBean.getCountry()); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(addressSearchBean.getStateProvince())) { - qf.eq(STATE_PROVINCE, addressSearchBean.getStateProvince()); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(addressSearchBean.getCityVillage())) { - qf.eq(CITY_VILLAGE, addressSearchBean.getCityVillage()); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(addressSearchBean.getCountyDistrict())) { - qf.eq(COUNTY_DISTRICT, addressSearchBean.getCountyDistrict()); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(addressSearchBean.getSubDistrict())) { - qf.eq(SUB_DISTRICT, addressSearchBean.getSubDistrict()); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(addressSearchBean.getSubTown())) { - qf.eq(TOWN, addressSearchBean.getTown()); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(addressSearchBean.getSubTown())) { - qf.eq(SUB_TOWN, addressSearchBean.getSubTown()); - } - if (StringUtils.isEmptyOrWhitespaceOnly(qf.query())) { - throw new RuntimeException("Atleast one search filter must be specified"); - } - query.setQuery(qf.query()); - // stale must not be ok, as we've only just loaded the docs - query.setStaleOk(false); - query.setIncludeDocs(true); - - try { - LuceneResult result = db.queryLucene(query); - return ldb.asList(result, Client.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getByCriteria(String query) { - // create a simple query against the view/search function that we've created - LuceneQuery lq = new LuceneQuery("Client", "by_all_criteria"); - - lq.setQuery(query); - // stale must not be ok, as we've only just loaded the docs - lq.setStaleOk(false); - lq.setIncludeDocs(true); - - try { - LuceneResult result = db.queryLucene(lq); - return ldb.asList(result, Client.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getByClientByMother(String field, String value) { - // create a simple query against the view/search function that we've created - if (value == null) { - return new ArrayList(); - } - LuceneQuery lq = new LuceneQuery("Client", "by_all_criteria_v2"); - Query query = new Query(FilterType.AND); - if (field.equals(MOTHERS_INDENTIFIER)) { - query.eq(field, value); - } - lq.setQuery(query.query()); - lq.setStaleOk(false); - lq.setIncludeDocs(true); - - try { - LuceneResult result = db.queryLucene(lq); - return ldb.asList(result, Client.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getByFieldValue(String field, String value) { - // create a simple query against the view/search function that we've created - if (value == null) { - return new ArrayList(); - } - LuceneQuery lq = new LuceneQuery("Client", "by_all_criteria_v2"); - Query query = new Query(FilterType.AND); - if (field.equals(BASE_ENTITY_ID)) { - query.eq(field, value); - } - lq.setQuery(query.query()); - lq.setStaleOk(false); - lq.setIncludeDocs(true); - - try { - LuceneResult result = db.queryLucene(lq); - return ldb.asList(result, Client.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getByFieldValue(String field, List ids) { - // create a simple query against the view/search function that we've created - if (ids == null || ids.isEmpty()) { - return new ArrayList(); - } - LuceneQuery lq = new LuceneQuery("Client", "by_all_criteria_v2"); - Query query = new Query(FilterType.AND); - if (field.equals(BASE_ENTITY_ID)) { - query.inList(field, ids); - } - lq.setQuery(query.query()); - lq.setLimit(ids.size()); - // stale must not be ok, as we've only just loaded the docs - lq.setStaleOk(false); - lq.setIncludeDocs(true); - - try { - LuceneResult result = db.queryLucene(lq); - return ldb.asList(result, Client.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneDbConnector.java b/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneDbConnector.java deleted file mode 100644 index 4a0c1a9305..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneDbConnector.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.opensrp.repository.lucene; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import org.codehaus.jackson.JsonProcessingException; -import org.codehaus.jackson.map.ObjectMapper; -import org.ektorp.CouchDbConnector; -import org.ektorp.impl.StdCouchDbInstance; -import org.json.JSONObject; -import org.opensrp.common.AllConstants; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -import com.github.ldriscoll.ektorplucene.LuceneAwareCouchDbConnector; -import com.github.ldriscoll.ektorplucene.LuceneResult; -import com.github.ldriscoll.ektorplucene.LuceneResult.Row; - -@Component -class LuceneDbConnector extends LuceneAwareCouchDbConnector { - - @Autowired - public LuceneDbConnector(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db, - StdCouchDbInstance dbinst) throws IOException { - super(db.getDatabaseName(), dbinst); - } - - public List asList(LuceneResult result, Class type) throws JsonProcessingException, IOException { - List ol = new ArrayList<>(); - for (Row r : result.getRows()) { - HashMap doc = r.getDoc(); - - T ro = new ObjectMapper().readValue(new JSONObject(doc).toString(), type); - ol.add(ro); - } - return ol; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneEventRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneEventRepository.java deleted file mode 100644 index dae62b10e4..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneEventRepository.java +++ /dev/null @@ -1,211 +0,0 @@ -package org.opensrp.repository.lucene; - -import static org.opensrp.common.AllConstants.BaseEntity.BASE_ENTITY_ID; -import static org.opensrp.common.AllConstants.BaseEntity.LAST_UPDATE; -import static org.opensrp.common.AllConstants.Event.ENTITY_TYPE; -import static org.opensrp.common.AllConstants.Event.EVENT_DATE; -import static org.opensrp.common.AllConstants.Event.EVENT_TYPE; -import static org.opensrp.common.AllConstants.Event.LOCATION_ID; -import static org.opensrp.common.AllConstants.Event.PROVIDER_ID; -import static org.opensrp.common.AllConstants.Event.TEAM; -import static org.opensrp.common.AllConstants.Event.TEAM_ID; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.joda.time.DateTime; -import org.opensrp.common.AllConstants.BaseEntity; -import org.opensrp.domain.Event; -import org.opensrp.search.EventSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.github.ldriscoll.ektorplucene.CouchDbRepositorySupportWithLucene; -import com.github.ldriscoll.ektorplucene.LuceneQuery; -import com.github.ldriscoll.ektorplucene.LuceneResult; -import com.github.ldriscoll.ektorplucene.designdocument.annotation.FullText; -import com.github.ldriscoll.ektorplucene.designdocument.annotation.Index; -import com.mysql.jdbc.StringUtils; - -@FullText({ - @Index(name = "by_all_criteria", analyzer = "perfield:{baseEntityId:\"keyword\",locationId:\"keyword\"}", index = "function(doc) { if(doc.type !== 'Event') return null; var arr1 = ['baseEntityId','eventType','entityType','providerId','locationId','teamId','team']; var ret = new Document(); var serverVersion = doc.serverVersion;ret.add(serverVersion, {'field': 'serverVersion'}); for (var i in arr1){ ret.add(doc[arr1[i]], {'field':arr1[i]}); } if(doc.eventDate){ var bd=doc.eventDate.substring(0,19); ret.add(bd, {'field':'eventDate','type':'date'}); } var crd = doc.dateCreated.substring(0, 19); ret.add(crd, {'field' : 'lastEdited','type' : 'date'}); if(doc.dateEdited){ var led = doc.dateEdited.substring(0, 19); ret.add(led, {'field' : 'lastEdited','type' : 'date'}); } return ret; }"), - @Index(name = "by_all_criteria_v2", analyzer = "perfield:{baseEntityId:\"keyword\",locationId:\"keyword\"}", index = "function(doc) { if(doc.type !== 'Event') return null; var arr1 = ['baseEntityId','eventType','entityType','providerId','locationId','teamId','team']; var ret = new Document(); var serverVersion = doc.serverVersion;ret.add(serverVersion, {'field': 'serverVersion'}); for (var i in arr1){ ret.add(doc[arr1[i]], {'field':arr1[i]}); } if(doc.eventDate){ var bd=doc.eventDate.substring(0,19); ret.add(bd, {'field':'eventDate','type':'date'}); } var crd = doc.dateCreated.substring(0, 19); ret.add(crd, {'field' : 'lastEdited','type' : 'date'}); if(doc.dateEdited){ var led = doc.dateEdited.substring(0, 19); ret.add(led, {'field' : 'lastEdited','type' : 'date'}); } return ret; }") }) -@Component -public class LuceneEventRepository extends CouchDbRepositorySupportWithLucene { - - private LuceneDbConnector ldb; - - @Autowired - protected LuceneEventRepository(LuceneDbConnector db) { - super(Event.class, db); - this.ldb = db; - initStandardDesignDocument(); - } - - public List getByCriteria(EventSearchBean eventSearchBean) { - // create a simple query against the view/search function that we've created - LuceneQuery query = new LuceneQuery("Event", "by_all_criteria"); - - Query qf = new Query(FilterType.AND); - addQueryParameter(qf, EVENT_DATE, eventSearchBean.getEventDateFrom(), eventSearchBean.getEventDateTo()); - addQueryParameter(qf, LAST_UPDATE, eventSearchBean.getLastEditFrom(), eventSearchBean.getLastEditTo()); - addQueryParameter(qf, BASE_ENTITY_ID, eventSearchBean.getBaseEntityId()); - addQueryParameter(qf, EVENT_TYPE, eventSearchBean.getEventType()); - addQueryParameter(qf, ENTITY_TYPE, eventSearchBean.getEntityType()); - addQueryParameter(qf, PROVIDER_ID, eventSearchBean.getProviderId()); - addQueryParameter(qf, LOCATION_ID, eventSearchBean.getLocationId()); - addQueryParameter(qf, TEAM, eventSearchBean.getTeam()); - addQueryParameter(qf, TEAM_ID, eventSearchBean.getTeamId()); - - if (StringUtils.isEmptyOrWhitespaceOnly(qf.query())) { - throw new RuntimeException("Atleast one search filter must be specified"); - } - query.setQuery(qf.query()); - // stale must not be ok, as we've only just loaded the docs - query.setStaleOk(false); - query.setIncludeDocs(true); - - try { - LuceneResult result = db.queryLucene(query); - return ldb.asList(result, Event.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - private void addQueryParameter(Query query, String parameter, String value) { - if (!StringUtils.isEmptyOrWhitespaceOnly(value)) - query.eq(parameter, value); - } - - private void addQueryParameter(Query query, String parameter, DateTime from, DateTime to) { - if (from != null && to != null) { - query.between(parameter, from, to); - } - } - - /** - * @param sortBy Prefix with / for ascending order and \ for descending order (ascending is the - * default if not specified). - * @param sortOrder either descending or ascending - * @param limit - * @return - */ - public List getByCriteria(EventSearchBean eventSearchBean, String sortBy, String sortOrder, int limit) { - // create a simple query against the view/search function that we've created - LuceneQuery query = new LuceneQuery("Event", "by_all_criteria_v2"); - - Query qf = new Query(FilterType.AND); - - if (eventSearchBean.getServerVersion() != null) { - qf.between(BaseEntity.SERVER_VERSIOIN, eventSearchBean.getServerVersion(), Long.MAX_VALUE); - } - - if (eventSearchBean.getTeam() != null && !StringUtils.isEmptyOrWhitespaceOnly(eventSearchBean.getTeam())) { - if (eventSearchBean.getTeam().contains(",")) { - String[] teamArray = org.apache.commons.lang.StringUtils.split(eventSearchBean.getTeam(), ","); - List teams = new ArrayList<>(Arrays.asList(teamArray)); - qf.inList(TEAM, teams); - } else { - qf.eq(TEAM, eventSearchBean.getTeam()); - } - } - - if (eventSearchBean.getTeamId() != null && !StringUtils.isEmptyOrWhitespaceOnly(eventSearchBean.getTeamId())) { - if (eventSearchBean.getTeamId().contains(",")) { - String[] teamArray = org.apache.commons.lang.StringUtils.split(eventSearchBean.getTeamId()); - List teams = new ArrayList<>(Arrays.asList(teamArray)); - qf.inList(TEAM_ID, teams); - } else { - qf.eq(TEAM_ID, eventSearchBean.getTeamId()); - } - } - - if ((eventSearchBean.getProviderId() != null - && !StringUtils.isEmptyOrWhitespaceOnly(eventSearchBean.getProviderId()))) { - if (eventSearchBean.getProviderId().contains(",")) { - String[] providerArray = org.apache.commons.lang.StringUtils.split(eventSearchBean.getProviderId(), ","); - List providers = new ArrayList<>(Arrays.asList(providerArray)); - qf.inList(PROVIDER_ID, providers); - } else { - qf.eq(PROVIDER_ID, eventSearchBean.getProviderId()); - } - } - - if (eventSearchBean.getLocationId() != null - || !StringUtils.isEmptyOrWhitespaceOnly(eventSearchBean.getLocationId())) { - if (eventSearchBean.getLocationId().contains(",")) { - String[] locationArray = org.apache.commons.lang.StringUtils.split(eventSearchBean.getLocationId(), ","); - List locations = new ArrayList<>(Arrays.asList(locationArray)); - qf.inList(LOCATION_ID, locations); - } else { - qf.eq(LOCATION_ID, eventSearchBean.getLocationId()); - } - } - - if (!StringUtils.isEmptyOrWhitespaceOnly(eventSearchBean.getBaseEntityId())) { - if (eventSearchBean.getBaseEntityId().contains(",")) { - Query q = new Query(FilterType.OR); - String[] idsArray = org.apache.commons.lang.StringUtils.split(eventSearchBean.getBaseEntityId(), ","); - List ids = new ArrayList(Arrays.asList(idsArray)); - q.inList(BASE_ENTITY_ID, ids); - - qf.addToQuery(q); - } else { - qf.eq(BASE_ENTITY_ID, eventSearchBean.getBaseEntityId()); - } - } - - if (eventSearchBean.getEventType() != null || !StringUtils.isEmptyOrWhitespaceOnly(eventSearchBean.getEventType())) { - if (eventSearchBean.getEventType().contains(",")) { - Query q = new Query(FilterType.OR); - String[] eventArray = org.apache.commons.lang.StringUtils.split(eventSearchBean.getEventType(), ","); - List event_types = new ArrayList<>(Arrays.asList(eventArray)); - q.inList(EVENT_TYPE, event_types); - - qf.addToQuery(q); - } else { - qf.eq(EVENT_TYPE, eventSearchBean.getEventType()); - } - } - - if (StringUtils.isEmptyOrWhitespaceOnly(qf.query())) { - throw new RuntimeException("Atleast one search filter must be specified"); - } - query.setQuery(qf.query()); - // stale must not be ok, as we've only just loaded the docs - query.setStaleOk(false); - query.setIncludeDocs(true); - query.setLimit(limit); - query.setSort((sortOrder.toLowerCase().contains("desc") ? "\\" : "/") + sortBy); - - try { - LuceneResult result = db.queryLucene(query); - return ldb.asList(result, Event.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getByCriteria(String query) { - // create a simple query against the view/search function that we've created - LuceneQuery q = new LuceneQuery("Event", "by_all_criteria"); - - q.setQuery(query); - // stale must not be ok, as we've only just loaded the docs - q.setStaleOk(false); - q.setIncludeDocs(true); - - try { - LuceneResult result = db.queryLucene(q); - return ldb.asList(result, Event.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneReportRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneReportRepository.java deleted file mode 100644 index 572b1a8ba5..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneReportRepository.java +++ /dev/null @@ -1,175 +0,0 @@ -package org.opensrp.repository.lucene; - -import static org.opensrp.common.AllConstants.BaseEntity.BASE_ENTITY_ID; -import static org.opensrp.common.AllConstants.BaseEntity.LAST_UPDATE; -import static org.opensrp.common.AllConstants.Report.LOCATION_ID; -import static org.opensrp.common.AllConstants.Report.PROVIDER_ID; -import static org.opensrp.common.AllConstants.Report.REPORT_DATE; -import static org.opensrp.common.AllConstants.Report.REPORT_TYPE; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.joda.time.DateTime; -import org.opensrp.common.AllConstants.BaseEntity; -import org.opensrp.domain.Report; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.github.ldriscoll.ektorplucene.CouchDbRepositorySupportWithLucene; -import com.github.ldriscoll.ektorplucene.LuceneQuery; -import com.github.ldriscoll.ektorplucene.LuceneResult; -import com.github.ldriscoll.ektorplucene.designdocument.annotation.FullText; -import com.github.ldriscoll.ektorplucene.designdocument.annotation.Index; -import com.mysql.jdbc.StringUtils; - -@FullText({ - @Index(name = "by_all_criteria", analyzer = "perfield:{baseEntityId:\"keyword\",locationId:\"keyword\"}", index = "function(doc) { if(doc.type !== 'Report') return null; var arr1 = ['baseEntityId','reportType','providerId','locationId']; var ret = new Document(); var serverVersion = doc.serverVersion;ret.add(serverVersion, {'field': 'serverVersion'}); for (var i in arr1){ ret.add(doc[arr1[i]], {'field':arr1[i]}); } if(doc.reportDate){ var bd=doc.reportDate.substring(0,19); ret.add(bd, {'field':'reportDate','type':'date'}); } var crd = doc.dateCreated.substring(0, 19); ret.add(crd, {'field' : 'lastEdited','type' : 'date'}); if(doc.dateEdited){ var led = doc.dateEdited.substring(0, 19); ret.add(led, {'field' : 'lastEdited','type' : 'date'}); } return ret; }"), - @Index(name = "by_all_criteria_v2", analyzer = "perfield:{baseEntityId:\"keyword\",locationId:\"keyword\"}", index = "function(doc) { if(doc.type !== 'Report') return null; var arr1 = ['baseEntityId','reportType','providerId','locationId']; var ret = new Document(); var serverVersion = doc.serverVersion;ret.add(serverVersion, {'field': 'serverVersion'}); for (var i in arr1){ ret.add(doc[arr1[i]], {'field':arr1[i]}); } if(doc.reportDate){ var bd=doc.reportDate.substring(0,19); ret.add(bd, {'field':'reportDate','type':'date'}); } var crd = doc.dateCreated.substring(0, 19); ret.add(crd, {'field' : 'lastEdited','type' : 'date'}); if(doc.dateEdited){ var led = doc.dateEdited.substring(0, 19); ret.add(led, {'field' : 'lastEdited','type' : 'date'}); } return ret; }") }) - -@Component -public class LuceneReportRepository extends CouchDbRepositorySupportWithLucene { - - private LuceneDbConnector ldb; - - @Autowired - protected LuceneReportRepository(LuceneDbConnector db) { - super(Report.class, db); - this.ldb = db; - initStandardDesignDocument(); - } - - public List getByCriteria(String baseEntityId, DateTime reportDatefrom, DateTime reportDateto, String reportType, - String providerId, String locationId, DateTime lastEditFrom, DateTime lastEditTo) { - // create a simple query against the view/search function that we've created - LuceneQuery query = new LuceneQuery("Report", "by_all_criteria"); - - Query qf = new Query(FilterType.AND); - if (reportDatefrom != null && reportDateto != null) { - qf.between(REPORT_DATE, reportDatefrom, reportDateto); - } - if (lastEditFrom != null && lastEditTo != null) { - qf.between(LAST_UPDATE, lastEditFrom, lastEditTo); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(baseEntityId)) { - qf.eq(BASE_ENTITY_ID, baseEntityId); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(reportType)) { - qf.eq(REPORT_TYPE, reportType); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(providerId)) { - qf.eq(PROVIDER_ID, providerId); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(locationId)) { - qf.eq(LOCATION_ID, locationId); - } - - if (StringUtils.isEmptyOrWhitespaceOnly(qf.query())) { - throw new RuntimeException("Atleast one search filter must be specified"); - } - query.setQuery(qf.query()); - // stale must not be ok, as we've only just loaded the docs - query.setStaleOk(false); - query.setIncludeDocs(true); - - try { - LuceneResult result = db.queryLucene(query); - return ldb.asList(result, Report.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * @param providerId- health worker id - * @param locationId - * @param baseEntityId - * @param serverVersion - * @param sortBy Prefix with / for ascending order and \ for descending order (ascending is the - * default if not specified). - * @param sortOrder either descending or ascending - * @param limit - * @param team this is a comma separated string of team members id - * @return - */ - public List getByCriteria(String team, String providerId, String locationId, String baseEntityId, - Long serverVersion, String sortBy, String sortOrder, int limit) { - // create a simple query against the view/search function that we've created - LuceneQuery query = new LuceneQuery("Report", "by_all_criteria_v2"); - - Query qf = new Query(FilterType.AND); - - if (serverVersion != null) { - qf.between(BaseEntity.SERVER_VERSIOIN, serverVersion, Long.MAX_VALUE); - } - - if (team != null && !team.isEmpty()) { - //convert team string to list - String[] idsArray = org.apache.commons.lang.StringUtils.split(team, ","); - List ids = new ArrayList(Arrays.asList(idsArray)); - //include providerId records also - if (providerId != null && !ids.contains(providerId)) { - ids.add(providerId); - } - qf.inList(PROVIDER_ID, ids); - } else if ((providerId != null && !StringUtils.isEmptyOrWhitespaceOnly(providerId))) { - qf.eq(PROVIDER_ID, providerId); - } - - if (!StringUtils.isEmptyOrWhitespaceOnly(locationId)) { - qf.eq(LOCATION_ID, locationId); - } - - if (!StringUtils.isEmptyOrWhitespaceOnly(baseEntityId)) { - if (baseEntityId.contains(",")) { - Query q = new Query(FilterType.OR); - String[] idsArray = org.apache.commons.lang.StringUtils.split(baseEntityId, ","); - List ids = new ArrayList(Arrays.asList(idsArray)); - q.inList(BASE_ENTITY_ID, ids); - - qf.addToQuery(q); - } else { - qf.eq(BASE_ENTITY_ID, baseEntityId); - } - } - - if (StringUtils.isEmptyOrWhitespaceOnly(qf.query())) { - throw new RuntimeException("Atleast one search filter must be specified"); - } - query.setQuery(qf.query()); - // stale must not be ok, as we've only just loaded the docs - query.setStaleOk(false); - query.setIncludeDocs(true); - query.setLimit(limit); - query.setSort((sortOrder.toLowerCase().contains("desc") ? "\\" : "/") + sortBy); - - try { - LuceneResult result = db.queryLucene(query); - return ldb.asList(result, Report.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getByCriteria(String query) { - // create a simple query against the view/search function that we've created - LuceneQuery q = new LuceneQuery("Report", "by_all_criteria"); - - q.setQuery(query); - // stale must not be ok, as we've only just loaded the docs - q.setStaleOk(false); - q.setIncludeDocs(true); - - try { - LuceneResult result = db.queryLucene(q); - return ldb.asList(result, Report.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneSearchRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneSearchRepository.java deleted file mode 100644 index 195a7d7b72..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneSearchRepository.java +++ /dev/null @@ -1,155 +0,0 @@ -package org.opensrp.repository.lucene; - -import static org.opensrp.common.AllConstants.BaseEntity.LAST_UPDATE; -import static org.opensrp.common.AllConstants.Client.BIRTH_DATE; -import static org.opensrp.common.AllConstants.Client.FIRST_NAME; -import static org.opensrp.common.AllConstants.Client.GENDER; -import static org.opensrp.common.AllConstants.Client.LAST_NAME; -import static org.opensrp.common.AllConstants.Client.MIDDLE_NAME; - -import java.io.IOException; -import java.util.List; -import java.util.Map; - -import org.opensrp.domain.Client; -import org.opensrp.domain.Search; -import org.opensrp.search.ClientSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.github.ldriscoll.ektorplucene.CouchDbRepositorySupportWithLucene; -import com.github.ldriscoll.ektorplucene.LuceneQuery; -import com.github.ldriscoll.ektorplucene.LuceneResult; -import com.github.ldriscoll.ektorplucene.designdocument.annotation.FullText; -import com.github.ldriscoll.ektorplucene.designdocument.annotation.Index; -import com.mysql.jdbc.StringUtils; - -@FullText({ - @Index(name = "by_all_criteria", index = "function(doc){ if(doc.type!=='Client') return null; var arr1=['firstName','middleName','lastName','gender']; var ret=new Document(); for(var i in arr1){ ret.add(doc[arr1[i]],{'field':arr1[i]}) } for (var key in doc.identifiers) { ret.add(doc.identifiers[key], {'field': key}); } for(var key in doc.attributes){ ret.add(doc.attributes[key],{'field':key}) } var bd=doc.birthdate.substring(0,19); ret.add(bd,{'field':'birthdate','type':'date'}); var crd=doc.dateCreated.substring(0,19); ret.add(crd,{'field':'lastEdited','type':'date'}); if(doc.dateEdited){ var led=doc.dateEdited.substring(0,19); ret.add(led,{'field':'lastEdited','type':'date'}) } return ret }") }) -@Component -public class LuceneSearchRepository extends CouchDbRepositorySupportWithLucene { - - private LuceneDbConnector ldb; - - @Autowired - protected LuceneSearchRepository(LuceneDbConnector db) { - super(Search.class, db); - this.ldb = db; - initStandardDesignDocument(); - } - - public List getByCriteria(ClientSearchBean clientSearchBean, String firstName, String middleName, - String lastName, Integer limit) { - // create a simple query against the view/search function that we've - // created - LuceneQuery query = new LuceneQuery("Search", "by_all_criteria"); - - Query q = new Query(FilterType.OR); - if (!StringUtils.isEmptyOrWhitespaceOnly(clientSearchBean.getNameLike())) { - q.likeWithWildCard(FIRST_NAME, clientSearchBean.getNameLike()); - q.likeWithWildCard(MIDDLE_NAME, clientSearchBean.getNameLike()); - q.likeWithWildCard(LAST_NAME, clientSearchBean.getNameLike()); - } - - Query qf = new Query(FilterType.AND, q); - if (!StringUtils.isEmptyOrWhitespaceOnly(firstName)) { - qf.likeWithWildCard(FIRST_NAME, firstName); - } - - if (!StringUtils.isEmptyOrWhitespaceOnly(middleName)) { - qf.likeWithWildCard(MIDDLE_NAME, middleName); - } - - if (!StringUtils.isEmptyOrWhitespaceOnly(lastName)) { - qf.likeWithWildCard(LAST_NAME, lastName); - } - - if (!StringUtils.isEmptyOrWhitespaceOnly(clientSearchBean.getGender())) { - qf.eq(GENDER, clientSearchBean.getGender()); - } - - if (clientSearchBean.getIdentifiers() != null && !clientSearchBean.getIdentifiers().isEmpty()) { - for (Map.Entry entry : clientSearchBean.getIdentifiers().entrySet()) { - String identifierType = entry.getKey(); - String identifierValue = entry.getValue(); - if (!StringUtils.isEmptyOrWhitespaceOnly(identifierType) - && !StringUtils.isEmptyOrWhitespaceOnly(identifierValue)) { - qf.likeWithWildCard(identifierType, identifierValue); - } - } - } - - String INACTIVE = "inactive"; - String LOST_TO_FOLLOW_UP = "lost_to_follow_up"; - Query sq = new Query(FilterType.OR); - if (clientSearchBean.getAttributes() != null && !clientSearchBean.getAttributes().isEmpty()) { - for (Map.Entry entry : clientSearchBean.getAttributes().entrySet()) { - String attributeType = entry.getKey(); - String attributeValue = entry.getValue(); - if (!StringUtils.isEmptyOrWhitespaceOnly(attributeType) - && !StringUtils.isEmptyOrWhitespaceOnly(attributeValue)) { - if (attributeType.equals(INACTIVE) || attributeType.equals(LOST_TO_FOLLOW_UP)) { - if (attributeValue.equals(Boolean.TRUE.toString())) { - sq.eq(attributeType, attributeValue); - } else if (attributeType.equals(INACTIVE) && attributeValue.equals(Boolean.FALSE.toString())) { - //ACTIVE - Query aq = new Query(FilterType.AND); - aq.notEq(INACTIVE, Boolean.TRUE.toString()); - aq.notEq(LOST_TO_FOLLOW_UP, Boolean.TRUE.toString()); - sq.addToQuery(aq); - } - } else { - qf.likeWithWildCard(attributeType, attributeValue); - } - } - } - } - - qf.addToQuery(sq); - - if (clientSearchBean.getBirthdateFrom() != null && clientSearchBean.getBirthdateTo() != null) { - qf.between(BIRTH_DATE, clientSearchBean.getBirthdateFrom(), clientSearchBean.getBirthdateTo()); - } - - if (clientSearchBean.getLastEditFrom() != null & clientSearchBean.getLastEditTo() != null) { - qf.between(LAST_UPDATE, clientSearchBean.getLastEditFrom(), clientSearchBean.getLastEditTo()); - } - - if (StringUtils.isEmptyOrWhitespaceOnly(qf.query())) { - throw new RuntimeException("Atleast one search filter must be specified"); - } - query.setQuery(qf.query()); - // stale must not be ok, as we've only just loaded the docs - query.setStaleOk(false); - query.setIncludeDocs(true); - if (limit != null && limit.intValue() > 0) { - query.setLimit(limit); - } - try { - LuceneResult result = db.queryLucene(query); - return ldb.asList(result, Client.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getByCriteria(String query) { - // create a simple query against the view/search function that we've - // created - LuceneQuery lq = new LuceneQuery("Search", "by_all_criteria"); - - lq.setQuery(query); - // stale must not be ok, as we've only just loaded the docs - lq.setStaleOk(false); - lq.setIncludeDocs(true); - - try { - LuceneResult result = db.queryLucene(lq); - return ldb.asList(result, Client.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneStockRepository.java b/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneStockRepository.java deleted file mode 100644 index ab893f0f94..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/lucene/LuceneStockRepository.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.opensrp.repository.lucene; - -import static org.opensrp.common.AllConstants.Stock.DATE_CREATED; -import static org.opensrp.common.AllConstants.Stock.DATE_UPDATED; -import static org.opensrp.common.AllConstants.Stock.IDENTIFIER; -import static org.opensrp.common.AllConstants.Stock.PROVIDERID; -import static org.opensrp.common.AllConstants.Stock.TO_FROM; -import static org.opensrp.common.AllConstants.Stock.TRANSACTION_TYPE; -import static org.opensrp.common.AllConstants.Stock.VACCINE_TYPE_ID; -import static org.opensrp.common.AllConstants.Stock.VALUE; - -import java.io.IOException; -import java.util.List; - -import org.opensrp.common.AllConstants.BaseEntity; -import org.opensrp.domain.Stock; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.github.ldriscoll.ektorplucene.CouchDbRepositorySupportWithLucene; -import com.github.ldriscoll.ektorplucene.LuceneQuery; -import com.github.ldriscoll.ektorplucene.LuceneResult; -import com.github.ldriscoll.ektorplucene.designdocument.annotation.FullText; -import com.github.ldriscoll.ektorplucene.designdocument.annotation.Index; -import com.mysql.jdbc.StringUtils; - -@FullText({ - @Index(name = "by_all_criteria", analyzer = "perfield:{identifier:\"keyword\",providerid:\"keyword\"}", index = "function(doc) { if (doc.type !== 'Stock') return null; var arr1 = ['identifier', 'vaccine_type_id', 'transaction_type', 'providerid', 'value', 'to_from', 'sync_status', 'timeStamp']; var ret = new Document(); var serverVersion = doc.serverVersion; ret.add(serverVersion, { 'field': 'serverVersion' }); for (var i in arr1) { ret.add(doc[arr1[i]], { 'field': arr1[i] }); } if (doc.date_created) { var dc = doc.date_updated; ret.add(dc, { 'field': 'dateCreated' }); } if (doc.date_updated) { var da = doc.date_updated; ret.add(da, { 'field': 'dateUpdated' }); } return ret; }"), - @Index(name = "by _all_criteria_v2", analyzer = "perfield:{baseEntityId:\"keyword\",locationId:\"keyword\"}", index = "function(doc) { if (doc.type !== 'Stock') return null; var arr1 = ['identifier', 'vaccine_type_id', 'transaction_type', 'providerid', 'value', 'to_from', 'sync_status', 'serverVersion']; var ret = new Document(); var serverVersion = doc.serverVersion; ret.add(serverVersion, { 'field': 'serverVersion' }); for (var i in arr1) { ret.add(doc[arr1[i]], { 'field': arr1[i] }); } if (doc.date_created) { var dc = doc.date_updated; ret.add(dc, { 'field': 'dateCreated' }); } if (doc.date_updated) { var da = doc.date_updated; ret.add(da, { 'field': 'dateUpdated' }); } return ret; }") }) -@Component -public class LuceneStockRepository extends CouchDbRepositorySupportWithLucene { - - private LuceneDbConnector ldb; - - @Autowired - protected LuceneStockRepository(LuceneDbConnector db) { - super(Stock.class, db); - this.ldb = db; - initStandardDesignDocument(); - } - - public List getByCriteria(String identifier, String vaccine_type_id, String transaction_type, String providerid, - String value, String date_created, String to_from, String date_updated, Long serverVersion, String sortBy, - String sortOrder, int limit) { - // create a simple query against the view/search function that we've created - LuceneQuery query = new LuceneQuery("Stock", "by_all_criteria"); - - Query qf = new Query(FilterType.AND); - if (!StringUtils.isEmptyOrWhitespaceOnly(identifier)) { - qf.eq(IDENTIFIER, identifier); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(vaccine_type_id)) { - qf.eq(VACCINE_TYPE_ID, vaccine_type_id); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(transaction_type)) { - qf.eq(TRANSACTION_TYPE, transaction_type); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(providerid)) { - qf.eq(PROVIDERID, providerid); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(value)) { - qf.eq(VALUE, value); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(date_created)) { - qf.eq(DATE_CREATED, date_created); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(to_from)) { - qf.eq(TO_FROM, to_from); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(date_updated)) { - qf.eq(DATE_UPDATED, date_updated); - } - - if (serverVersion != null) { - qf.between(BaseEntity.SERVER_VERSIOIN, serverVersion, Long.MAX_VALUE); - } - - if (StringUtils.isEmptyOrWhitespaceOnly(qf.query())) { - throw new RuntimeException("Atleast one search filter must be specified"); - } - query.setQuery(qf.query()); - // stale must not be ok, as we've only just loaded the docs - query.setStaleOk(false); - query.setLimit(limit); - query.setIncludeDocs(true); - query.setSort((sortOrder.toLowerCase().contains("desc") ? "\\" : "/") + sortBy); - - try { - LuceneResult result = db.queryLucene(query); - return ldb.asList(result, Stock.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getByCriteria(String identifier, String vaccine_type_id, String transaction_type, String providerid, - String value, String date_created, String to_from, String date_updated, String serverVersion) { - LuceneQuery query = new LuceneQuery("Stock", "by_all_criteria"); - - Query qf = new Query(FilterType.AND); - if (!StringUtils.isEmptyOrWhitespaceOnly(identifier)) { - qf.eq(IDENTIFIER, identifier); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(vaccine_type_id)) { - qf.eq(VACCINE_TYPE_ID, vaccine_type_id); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(transaction_type)) { - qf.eq(TRANSACTION_TYPE, transaction_type); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(providerid)) { - qf.eq(PROVIDERID, providerid); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(value)) { - qf.eq(VALUE, value); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(date_created)) { - qf.eq(DATE_CREATED, date_created); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(to_from)) { - qf.eq(TO_FROM, to_from); - } - if (!StringUtils.isEmptyOrWhitespaceOnly(date_updated)) { - qf.eq(DATE_UPDATED, date_updated); - } - - if (StringUtils.isEmptyOrWhitespaceOnly(qf.query())) { - throw new RuntimeException("Atleast one search filter must be specified"); - } - query.setQuery(qf.query()); - // stale must not be ok, as we've only just loaded the docs - query.setStaleOk(false); - query.setIncludeDocs(true); - - try { - LuceneResult result = db.queryLucene(query); - return ldb.asList(result, Stock.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getByCriteria(String query) { - // create a simple query against the view/search function that we've created - LuceneQuery q = new LuceneQuery("Stock", "by_all_criteria"); - - q.setQuery(query); - // stale must not be ok, as we've only just loaded the docs - q.setStaleOk(false); - q.setIncludeDocs(true); - - try { - LuceneResult result = db.queryLucene(q); - return ldb.asList(result, Stock.class); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/lucene/Query.java b/opensrp-core/src/main/java/org/opensrp/repository/lucene/Query.java deleted file mode 100644 index d5e74ac055..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/lucene/Query.java +++ /dev/null @@ -1,125 +0,0 @@ -package org.opensrp.repository.lucene; - -import java.util.Iterator; -import java.util.List; - -import org.joda.time.DateTime; - -import com.mysql.jdbc.StringUtils; - -public class Query { - - private String query = ""; - - private FilterType filterType; - - public String query() { - return query; - } - - public Query(FilterType filterType) { - this.filterType = filterType; - } - - public Query(FilterType filterType, Query from) { - this.filterType = filterType; - if (from != null && !StringUtils.isEmptyOrWhitespaceOnly(from.query)) { - this.query = "(" + from.query + ")"; - } - } - - public Query eq(String name, String value) { - addToQuery(name + ":" + value + " "); - return this; - } - - public Query notEq(String name, String value) { - addToQuery("*:* -" + name + ":" + value + " "); - return this; - } - - public Query like(String field, String value) { - addToQuery(field + ":\"" + value + "\""); - return this; - } - - public Query likeWithWildCard(String field, String value) { - addToQuery(field + ":" + value + "* "); - return this; - } - - public Query eq(String name, DateTime value) { - addToQuery(name + ":[" + value.withTimeAtStartOfDay().toString("yyyy-MM-dd'T'HH:mm:ss") + " TO " - + value.plusDays(1).withTimeAtStartOfDay().toString("yyyy-MM-dd'T'HH:mm:ss") + "] "); - return this; - } - - public Query between(String name, DateTime from, DateTime to) { - addToQuery(name + ":[" + from.toString("yyyy-MM-dd'T'HH:mm:ss") + " TO " + to.toString("yyyy-MM-dd'T'HH:mm:ss") - + "] "); - return this; - } - - public Query between(String field, Object start, Object to) { - addToQuery(field + ":[" + start + " TO " + to + "]"); - return this; - } - - //field:(value1 OR value2 OR value3) - public Query inList(String field, List ids) { - String idString = org.apache.commons.lang.StringUtils.join(ids, " OR "); - addToQuery(field + ":(" + idString + ")"); - return this; - } - - //field:("value1" OR "value2" OR "value3") - public Query likeList(String field, List ids) { - String idString = quotedJoin(ids, " OR "); - addToQuery(field + ":(" + idString + ")"); - return this; - } - - private void addToQuery(String q) { - if (!StringUtils.isEmptyOrWhitespaceOnly(query)) { - query += filterType.name() + " " + q; - } else - query += q; - } - - public void addToQuery(Query from) { - if (from != null && !StringUtils.isEmptyOrWhitespaceOnly(from.query)) { - addToQuery("(" + from.query + ")"); - } - } - - private String quotedJoin(List ids, String separator) { - Iterator iterator = ids.iterator(); - - if (iterator == null) { - return null; - } - if (!iterator.hasNext()) { - return ""; - } - String first = iterator.next(); - if (!iterator.hasNext()) { - return "\"" + first + "\""; - } - - // two or more elements - StringBuffer buf = new StringBuffer(256); // Java default is 16, probably too small - if (first != null) { - buf.append("\"" + first + "\""); - } - - while (iterator.hasNext()) { - buf.append(separator); - String s = iterator.next(); - if (s != null) { - buf.append("\"" + s + "\""); - } - } - - return buf.toString(); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/ActionRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/ActionRepositoryImpl.java deleted file mode 100644 index 246fe30896..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/ActionRepositoryImpl.java +++ /dev/null @@ -1,319 +0,0 @@ -package org.opensrp.repository.postgres; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; - -import org.apache.commons.lang3.StringUtils; -import org.joda.time.DateTime; -import org.opensrp.domain.postgres.ActionExample; -import org.opensrp.domain.postgres.ActionMetadata; -import org.opensrp.domain.postgres.ActionMetadataExample; -import org.opensrp.domain.postgres.ActionMetadataExample.Criteria; -import org.opensrp.repository.postgres.mapper.custom.CustomActionMapper; -import org.opensrp.repository.postgres.mapper.custom.CustomActionMetadataMapper; -import org.opensrp.scheduler.Action; -import org.opensrp.scheduler.repository.ActionsRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -@Repository("actionsRepositoryPostgres") -public class ActionRepositoryImpl extends BaseRepositoryImpl implements ActionsRepository { - - @Autowired - private CustomActionMapper actionMapper; - - @Autowired - private CustomActionMetadataMapper actionMetadataMapper; - - @Override - public Action get(String id) { - if (StringUtils.isBlank(id)) { - return null; - } - org.opensrp.domain.postgres.Action pgAction = actionMetadataMapper.selectByDocumentId(id); - - return convert(pgAction); - } - - @Override - public void add(Action entity) { - if (entity == null || entity.baseEntityId() == null) { - return; - } - - if (retrievePrimaryKey(entity) != null) { //Event already added - return; - } - - if (entity.getId() == null) - entity.setId(UUID.randomUUID().toString()); - - setRevision(entity); - - org.opensrp.domain.postgres.Action pgAction = convert(entity, null); - if (pgAction == null) { - return; - } - - int rowsAffected = actionMapper.insertSelectiveAndSetId(pgAction); - if (rowsAffected < 1 || pgAction.getId() == null) { - return; - } - - ActionMetadata actionMetadata = createMetadata(entity, pgAction.getId()); - if (actionMetadata != null) { - actionMetadataMapper.insertSelective(actionMetadata); - } - - } - - @Override - public void update(Action entity) { - if (entity == null || entity.baseEntityId() == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { // Action not added - return; - } - - setRevision(entity); - org.opensrp.domain.postgres.Action pgAction = convert(entity, id); - if (pgAction == null) { - return; - } - - ActionMetadata actionMetadata = createMetadata(entity, id); - if (actionMetadata == null) { - return; - } - - int rowsAffected = actionMapper.updateByPrimaryKey(pgAction); - if (rowsAffected < 1) { - return; - } - - ActionMetadataExample actionMetadataExample = new ActionMetadataExample(); - actionMetadataExample.createCriteria().andActionIdEqualTo(id); - actionMetadata.setId(actionMetadataMapper.selectByExample(actionMetadataExample).get(0).getId()); - actionMetadataMapper.updateByPrimaryKey(actionMetadata); - - } - - @Override - public List getAll() { - List actions = actionMetadataMapper.selectMany(new ActionMetadataExample(), 0, - DEFAULT_FETCH_SIZE); - return convert(actions); - } - - @Override - public void safeRemove(Action entity) { - if (entity == null || entity.baseEntityId() == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { - return; - } - - ActionMetadataExample actionMetadataExample = new ActionMetadataExample(); - actionMetadataExample.createCriteria().andActionIdEqualTo(id); - int rowsAffected = actionMetadataMapper.deleteByExample(actionMetadataExample); - if (rowsAffected < 1) { - return; - } - - actionMapper.deleteByPrimaryKey(id); - - } - - @Override - public List findByProviderIdAndTimeStamp(String providerId, long timeStamp) { - ActionMetadataExample example = new ActionMetadataExample(); - example.createCriteria().andProviderIdEqualTo(providerId).andServerVersionGreaterThanOrEqualTo(timeStamp + 1); - return convert(actionMetadataMapper.selectMany(example, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findAlertByANMIdEntityIdScheduleName(String providerId, String baseEntityId, String scheduleName) { - ActionMetadataExample example = new ActionMetadataExample(); - example.createCriteria().andProviderIdEqualTo(providerId).andBaseEntityIdEqualTo(baseEntityId); - return convert(actionMetadataMapper.selectManyBySchedule(example, scheduleName, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findByCaseIdScheduleAndTimeStamp(String baseEntityId, String schedule, DateTime start, - DateTime end) { - if (start == null || end == null) - throw new IllegalArgumentException("start and/or end date is null"); - ActionMetadataExample example = new ActionMetadataExample(); - example.createCriteria().andBaseEntityIdEqualTo(baseEntityId).andServerVersionBetween(start.getMillis(), - end.getMillis() + 1); - return convert(actionMetadataMapper.selectManyBySchedule(example, schedule, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findByCaseIdAndTimeStamp(String baseEntityId, long timeStamp) { - ActionMetadataExample example = new ActionMetadataExample(); - example.createCriteria().andBaseEntityIdEqualTo(baseEntityId).andServerVersionGreaterThanOrEqualTo(timeStamp); - return convert(actionMetadataMapper.selectMany(example, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public void deleteAllByTarget(String target) { - List idsToDelete = actionMapper.selectIdsByTarget(target); - ActionMetadataExample metadataExample = new ActionMetadataExample(); - metadataExample.createCriteria().andActionIdIn(idsToDelete); - actionMetadataMapper.deleteByExample(metadataExample); - ActionExample example = new ActionExample(); - example.createCriteria().andIdIn(idsToDelete); - actionMapper.deleteByExample(example); - - } - - @Override - public void markAllAsInActiveFor(String baseEntityId) { - ActionMetadataExample metadataExample = new ActionMetadataExample(); - metadataExample.createCriteria().andBaseEntityIdEqualTo(baseEntityId); - List actions = convert(actionMetadataMapper.selectMany(metadataExample, 0, DEFAULT_FETCH_SIZE)); - for (Action action : actions) { - action.markAsInActive(); - update(action); - } - } - - @Override - public void addOrUpdateAlert(Action alertAction) { - if (alertAction == null || alertAction.baseEntityId() == null) { - return; - } - - Long id = retrievePrimaryKey(alertAction); - if (id == null) { - add(alertAction); - } else - update(alertAction); - - } - - @Override - public void markAlertAsInactiveFor(String providerId, String baseEntityId, String scheduleName) { - ActionMetadataExample metadataExample = new ActionMetadataExample(); - metadataExample.createCriteria().andBaseEntityIdEqualTo(baseEntityId); - Long actionsSize = actionMetadataMapper.countByExample(metadataExample); - List actions = convert(actionMetadataMapper.selectMany(metadataExample, 0, actionsSize.intValue())); - for (Action action : actions) { - action.markAsInActive(); - update(action); - } - - } - - @Override - public List findByCriteria(String team, String providerId, long timeStamp, String sortBy, String sortOrder, - int limit) { - ActionMetadataExample metadataExample = new ActionMetadataExample(); - Criteria criteria = metadataExample.createCriteria().andServerVersionGreaterThanOrEqualTo(timeStamp); - - if (team != null && !team.isEmpty()) { - String[] idsArray = org.apache.commons.lang.StringUtils.split(team, ","); - List ids = new ArrayList(Arrays.asList(idsArray)); - //include providerId records also - if (providerId != null && !ids.contains(providerId)) { - ids.add(providerId); - } - criteria.andProviderIdIn(ids); - } else if (StringUtils.isNotEmpty(providerId)) { - criteria.andProviderIdEqualTo(providerId); - } - metadataExample.setOrderByClause(getOrderByClause(sortBy, sortOrder)); - - if (!criteria.isValid()) { - throw new IllegalArgumentException("Atleast one search filter must be specified"); - } else - return convert(actionMetadataMapper.selectMany(metadataExample, 0, limit)); - } - - @Override - public List findAllActionNotExpired() { - return convert(actionMapper.selectNotExpired(0, DEFAULT_FETCH_SIZE)); - } - - //private methods - private Action convert(org.opensrp.domain.postgres.Action action) { - if (action == null || action.getJson() == null || !(action.getJson() instanceof Action)) { - return null; - } - return (Action) action.getJson(); - } - - private org.opensrp.domain.postgres.Action convert(Action entity, Long primaryKey) { - if (entity == null) { - return null; - } - - org.opensrp.domain.postgres.Action pgAction = new org.opensrp.domain.postgres.Action(); - pgAction.setId(primaryKey); - pgAction.setJson(entity); - - return pgAction; - } - - private List convert(List actions) { - if (actions == null || actions.isEmpty()) { - return new ArrayList<>(); - } - - List convertedActions = new ArrayList<>(); - for (org.opensrp.domain.postgres.Action action : actions) { - Action convertedAction = convert(action); - if (convertedAction != null) { - convertedActions.add(convertedAction); - } - } - - return convertedActions; - } - - protected Long retrievePrimaryKey(Action entity) { - if (entity == null || entity.getId() == null) { - return null; - } - String documentId = entity.getId(); - - ActionMetadataExample actionMetadataExample = new ActionMetadataExample(); - actionMetadataExample.createCriteria().andDocumentIdEqualTo(documentId); - - org.opensrp.domain.postgres.Action pgAction = actionMetadataMapper.selectByDocumentId(documentId); - if (pgAction == null) { - return null; - } - return pgAction.getId(); - } - - private ActionMetadata createMetadata(Action entity, Long primaryKey) { - ActionMetadata actionMetadata = new ActionMetadata(); - actionMetadata.setActionId(primaryKey); - actionMetadata.setDocumentId(entity.getId()); - actionMetadata.setBaseEntityId(entity.baseEntityId()); - actionMetadata.setServerVersion(entity.getTimeStamp()); - actionMetadata.setProviderId(entity.providerId()); - - //TODO implement review if in future to support Location, Team and TeamId - return actionMetadata; - } - - @Override - protected Object getUniqueField(Action t) { - if (t == null) { - return null; - } - return t.getId(); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/AlertsRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/AlertsRepositoryImpl.java deleted file mode 100644 index bf51ef3b1e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/AlertsRepositoryImpl.java +++ /dev/null @@ -1,327 +0,0 @@ -package org.opensrp.repository.postgres; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.apache.commons.lang3.StringUtils; -import org.joda.time.DateTime; -import org.opensrp.domain.postgres.AlertMetadata; -import org.opensrp.domain.postgres.AlertMetadataExample; -import org.opensrp.dto.AlertStatus; -import org.opensrp.repository.postgres.mapper.custom.CustomAlertMapper; -import org.opensrp.repository.postgres.mapper.custom.CustomAlertMetadataMapper; -import org.opensrp.scheduler.Alert; -import org.opensrp.scheduler.Alert.AlertType; -import org.opensrp.scheduler.Alert.TriggerType; -import org.opensrp.scheduler.repository.AlertsRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -@Repository("alertsRepositoryPostgres") -public class AlertsRepositoryImpl extends BaseRepositoryImpl implements AlertsRepository { - - @Autowired - private CustomAlertMapper alertMapper; - - @Autowired - private CustomAlertMetadataMapper alertMetadataMapper; - - @Override - public Alert get(String id) { - if (StringUtils.isBlank(id)) { - return null; - } - org.opensrp.domain.postgres.Alert pgAlert = alertMetadataMapper.selectByDocumentId(id); - - return convert(pgAlert); - } - - @Override - public void add(Alert entity) { - - if (entity == null || entity.entityId() == null) { - return; - } - - if (retrievePrimaryKey(entity) != null) { //Event already added - return; - } - - if (entity.getId() == null) - entity.setId(UUID.randomUUID().toString()); - - setRevision(entity); - org.opensrp.domain.postgres.Alert pgAlert = convert(entity, null); - if (pgAlert == null) { - return; - } - - int rowsAffected = alertMapper.insertSelectiveAndSetId(pgAlert); - if (rowsAffected < 1 || pgAlert.getId() == null) { - return; - } - - AlertMetadata eventMetadata = createMetadata(entity, pgAlert.getId()); - if (eventMetadata != null) { - alertMetadataMapper.insertSelective(eventMetadata); - } - - } - - @Override - public void update(Alert entity) { - if (entity == null || entity.entityId() == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { // Alert not added - return; - } - - setRevision(entity); - org.opensrp.domain.postgres.Alert pgAlert = convert(entity, id); - if (pgAlert == null) { - return; - } - - AlertMetadata alertMetadata = createMetadata(entity, id); - if (alertMetadata == null) { - return; - } - - int rowsAffected = alertMapper.updateByPrimaryKey(pgAlert); - if (rowsAffected < 1) { - return; - } - - AlertMetadataExample alertMetadataExample = new AlertMetadataExample(); - alertMetadataExample.createCriteria().andAlertIdEqualTo(id); - alertMetadata.setId(alertMetadataMapper.selectByExample(alertMetadataExample).get(0).getId()); - alertMetadataMapper.updateByPrimaryKey(alertMetadata); - - } - - @Override - public List getAll() { - List actions = alertMetadataMapper.selectMany(new AlertMetadataExample(), 0, - DEFAULT_FETCH_SIZE); - return convert(actions); - } - - @Override - public void safeRemove(Alert entity) { - if (entity == null || entity.entityId() == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { - return; - } - - AlertMetadataExample alertMetadataExample = new AlertMetadataExample(); - alertMetadataExample.createCriteria().andAlertIdEqualTo(id); - int rowsAffected = alertMetadataMapper.deleteByExample(alertMetadataExample); - if (rowsAffected < 1) { - return; - } - - alertMapper.deleteByPrimaryKey(id); - - } - - @Override - public List findByProviderAndTimestamp(String provider, long timeStamp) { - AlertMetadataExample alertMetadataExample = new AlertMetadataExample(); - alertMetadataExample.createCriteria().andProviderIdEqualTo(provider) - .andServerVersionGreaterThanOrEqualTo(timeStamp + 1); - return convert(alertMetadataMapper.selectMany(alertMetadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findActiveByProviderAndTimestamp(String provider, long timeStamp) { - AlertMetadataExample alertMetadataExample = new AlertMetadataExample(); - alertMetadataExample.createCriteria().andProviderIdEqualTo(provider) - .andServerVersionGreaterThanOrEqualTo(timeStamp + 1).andIsActiveEqualTo(true); - return convert(alertMetadataMapper.selectMany(alertMetadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findAlertByProviderEntityIdTriggerName(String provider, String entityId, String triggerName) { - AlertMetadataExample alertMetadataExample = new AlertMetadataExample(); - alertMetadataExample.createCriteria().andProviderIdEqualTo(provider).andBaseEntityIdEqualTo(entityId) - .andTriggerNameEqualTo(triggerName); - return convert(alertMetadataMapper.selectMany(alertMetadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findActiveAlertByProviderEntityIdTriggerName(String provider, String entityId, String triggerName) { - AlertMetadataExample alertMetadataExample = new AlertMetadataExample(); - alertMetadataExample.createCriteria().andProviderIdEqualTo(provider).andBaseEntityIdEqualTo(entityId) - .andTriggerNameEqualTo(triggerName).andIsActiveEqualTo(true); - return convert(alertMetadataMapper.selectMany(alertMetadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findActiveAlertByEntityIdTriggerName(String entityId, String triggerName) { - AlertMetadataExample alertMetadataExample = new AlertMetadataExample(); - alertMetadataExample.createCriteria().andBaseEntityIdEqualTo(entityId).andTriggerNameEqualTo(triggerName) - .andIsActiveEqualTo(true); - return convert(alertMetadataMapper.selectMany(alertMetadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findActiveAlertByEntityId(String entityId) { - AlertMetadataExample alertMetadataExample = new AlertMetadataExample(); - alertMetadataExample.createCriteria().andBaseEntityIdEqualTo(entityId).andIsActiveEqualTo(true); - return convert(alertMetadataMapper.selectMany(alertMetadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findByEntityIdTriggerAndTimeStamp(String entityId, String trigger, DateTime start, DateTime end) { - AlertMetadataExample alertMetadataExample = new AlertMetadataExample(); - alertMetadataExample.createCriteria().andBaseEntityIdEqualTo(entityId).andTriggerNameEqualTo(trigger) - .andServerVersionBetween(start.getMillis() + 1, end.getMillis()); - return convert(alertMetadataMapper.selectMany(alertMetadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public void markAllAsClosedFor(String entityId, String reasonForClose) { - List alerts = findActiveAlertByEntityId(entityId); - for (Alert alert : alerts) { - alert.markAlertAsClosed(reasonForClose); - update(alert); - } - } - - @Override - public void markAlertAsClosedFor(String providerId, String entityId, String triggerName, String reasonForClose) { - List alerts = findActiveAlertByProviderEntityIdTriggerName(providerId, entityId, triggerName); - for (Alert alert : alerts) { - alert.markAlertAsClosed(reasonForClose); - update(alert); - } - } - - @Override - public void markAlertAsCompleteFor(String providerId, String entityId, String triggerName, String completionDate) { - List alerts = findActiveAlertByProviderEntityIdTriggerName(providerId, entityId, triggerName); - for (Alert alert : alerts) { - alert.markAlertAsComplete(completionDate); - update(alert); - } - - } - - @Override - public void markAlertAsCompleteFor(String entityId, String triggerName, String completionDate) { - List alerts = findActiveAlertByEntityIdTriggerName(entityId, triggerName); - for (Alert alert : alerts) { - alert.markAlertAsComplete(completionDate); - update(alert); - } - } - - @Override - public void addOrUpdateScheduleNotificationAlert(String beneficiaryType, String entityId, String providerId, - String triggerName, String triggerCode, AlertStatus alertStatus, DateTime startDate, DateTime expiryDate) { - List existingAlerts = findActiveAlertByProviderEntityIdTriggerName(providerId, entityId, triggerName); - if (existingAlerts.isEmpty()) { - add(new Alert(providerId, entityId, beneficiaryType, AlertType.notification, TriggerType.schedule, triggerName, - triggerCode, startDate, expiryDate, alertStatus, null)); - } else { - Alert al = existingAlerts.get(0); - // if visit code is same then update otherwise add another record - if (StringUtils.isNotBlank(al.triggerCode()) && StringUtils.isNotBlank(triggerCode) - && al.triggerCode().equalsIgnoreCase(triggerCode)) { - al.setAlertStatus(alertStatus.name()); - al.setStartDate(startDate.toString()); - al.setExpiryDate(expiryDate.toString()); - al.details().put(alertStatus.name() + ":start", startDate.toString()); - al.details().put(alertStatus.name() + ":end", expiryDate.toString()); - - update(al); - } else { - add(new Alert(providerId, entityId, beneficiaryType, AlertType.notification, TriggerType.schedule, - triggerName, triggerCode, startDate, expiryDate, alertStatus, null)); - } - } - - } - - @Override - protected Long retrievePrimaryKey(Alert alert) { - if (alert == null || alert.getId() == null) { - return null; - } - String documentId = alert.getId(); - - AlertMetadataExample alertMetadataExample = new AlertMetadataExample(); - alertMetadataExample.createCriteria().andDocumentIdEqualTo(documentId); - - org.opensrp.domain.postgres.Alert pgAlert = alertMetadataMapper.selectByDocumentId(documentId); - if (pgAlert == null) { - return null; - } - return pgAlert.getId(); - } - - @Override - protected Object getUniqueField(Alert alert) { - if (alert == null) { - return null; - } - return alert.getId(); - } - - //private methods - private Alert convert(org.opensrp.domain.postgres.Alert pgAlert) { - if (pgAlert == null || pgAlert.getJson() == null || !(pgAlert.getJson() instanceof Alert)) { - return null; - } - return (Alert) pgAlert.getJson(); - } - - private org.opensrp.domain.postgres.Alert convert(Alert entity, Long primaryKey) { - if (entity == null) { - return null; - } - - org.opensrp.domain.postgres.Alert pgAlert = new org.opensrp.domain.postgres.Alert(); - pgAlert.setId(primaryKey); - pgAlert.setJson(entity); - - return pgAlert; - } - - private List convert(List alerts) { - if (alerts == null || alerts.isEmpty()) { - return new ArrayList<>(); - } - - List convertedAlerts = new ArrayList<>(); - for (org.opensrp.domain.postgres.Alert alert : alerts) { - Alert convertedAlert = convert(alert); - if (convertedAlert != null) { - convertedAlerts.add(convertedAlert); - } - } - - return convertedAlerts; - } - - private AlertMetadata createMetadata(Alert entity, Long id) { - AlertMetadata metadata = new AlertMetadata(); - metadata.setAlertId(id); - metadata.setDocumentId(entity.getId()); - metadata.setBaseEntityId(entity.entityId()); - metadata.setProviderId(entity.providerId()); - metadata.setServerVersion(entity.timestamp()); - metadata.setIsActive(entity.getIsActive()); - metadata.setTriggerName(entity.triggerName()); - return metadata; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/AppStateTokensRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/AppStateTokensRepositoryImpl.java deleted file mode 100644 index e3d5771521..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/AppStateTokensRepositoryImpl.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.opensrp.repository.postgres; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; -import org.opensrp.domain.AppStateToken; -import org.opensrp.domain.postgres.AppStateTokenExample; -import org.opensrp.repository.AppStateTokensRepository; -import org.opensrp.repository.postgres.mapper.AppStateTokenMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -@Repository("appStateTokensRepositoryPostgres") -public class AppStateTokensRepositoryImpl implements AppStateTokensRepository { - - @Autowired - private AppStateTokenMapper mapper; - - @Override - public AppStateToken get(String id) { - if (StringUtils.isBlank(id)) { - return null; - } - org.opensrp.domain.postgres.AppStateToken token = mapper.selectByPrimaryKey(Long.valueOf(id)); - return getDomainEntity(token); - } - - @Override - public List getAll() { - List tokens = mapper.selectByExample(new AppStateTokenExample()); - List appStateTokens = new ArrayList(); - for (org.opensrp.domain.postgres.AppStateToken token : tokens) { - appStateTokens.add(getDomainEntity(token)); - } - return appStateTokens; - } - - @Override - public void safeRemove(AppStateToken entity) { - AppStateTokenExample example = new AppStateTokenExample(); - example.createCriteria().andNameEqualTo(entity.getName()); - mapper.deleteByExample(example); - } - - @Override - public List findByName(String name) { - AppStateTokenExample example = new AppStateTokenExample(); - example.createCriteria().andNameEqualTo(name); - List tokens = mapper.selectByExample(example); - List appStateTokens = new ArrayList(); - for (org.opensrp.domain.postgres.AppStateToken token : tokens) { - appStateTokens.add(getDomainEntity(token)); - } - return appStateTokens; - } - - @Override - public void update(AppStateToken entity) { - AppStateTokenExample example = new AppStateTokenExample(); - example.createCriteria().andNameEqualTo(entity.getName()); - List tokens = mapper.selectByExample(example); - if (tokens != null && !tokens.isEmpty()) { - org.opensrp.domain.postgres.AppStateToken token = tokens.get(0); - mapper.updateByPrimaryKey(getPostgresEntity(token, entity)); - } - } - - @Override - public void add(AppStateToken entity) { - mapper.insertSelective(getPostgresEntity(entity)); - } - - private AppStateToken getDomainEntity(org.opensrp.domain.postgres.AppStateToken token) { - return token == null ? null - : new AppStateToken(token.getName(), token.getValue(), token.getLastEditedDate(), token.getDescription()); - } - - private org.opensrp.domain.postgres.AppStateToken getPostgresEntity(AppStateToken entity) { - return getPostgresEntity(new org.opensrp.domain.postgres.AppStateToken(), entity); - } - - private org.opensrp.domain.postgres.AppStateToken getPostgresEntity(org.opensrp.domain.postgres.AppStateToken token, - AppStateToken entity) { - if (entity == null) - return null; - token.setDescription(entity.getDescription()); - token.setName(entity.getName()); - token.setLastEditedDate(entity.getLastEditDate()); - token.setValue(entity.getValue().toString()); - return token; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/BaseRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/BaseRepositoryImpl.java deleted file mode 100644 index 319d5143db..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/BaseRepositoryImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.opensrp.repository.postgres; - -import org.motechproject.model.MotechBaseDataObject; -import org.opensrp.common.AllConstants.BaseEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public abstract class BaseRepositoryImpl { - - public static int DEFAULT_FETCH_SIZE = 1000; - - public static int FETCH_SIZE_LIMIT = 5000; - - public static String REVISION_PREFIX = "v"; - - public static String SERVER_VERSION = "server_version"; - - public static String ASCENDING = "asc"; - - protected static Logger logger = LoggerFactory.getLogger(BaseRepositoryImpl.class.toString()); - - protected abstract Object retrievePrimaryKey(T t); - - protected abstract Object getUniqueField(T t); - - protected String getOrderByClause(String sortBy, String sortOrder) { - String orderByClause = sortBy == null || sortBy == BaseEntity.SERVER_VERSIOIN ? SERVER_VERSION : sortBy; - orderByClause += " " + ((sortOrder == null || !sortOrder.toLowerCase().matches("(asc)|(desc)")) ? "asc" : sortOrder); - return orderByClause; - } - - protected void setRevision(MotechBaseDataObject entity) { - if (entity.isNew()) - entity.setRevision(REVISION_PREFIX + 1); - else if (entity.getRevision().startsWith(REVISION_PREFIX)) - entity.setRevision( - REVISION_PREFIX + (Integer.parseInt(entity.getRevision().substring(REVISION_PREFIX.length())) + 1)); - else { - String[] revision = entity.getRevision().split("-"); - entity.setRevision((Integer.parseInt(revision[0]) + 1) + "-" + revision[1]); - } - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/CampaignRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/CampaignRepositoryImpl.java deleted file mode 100644 index d99c3ad444..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/CampaignRepositoryImpl.java +++ /dev/null @@ -1,212 +0,0 @@ -package org.opensrp.repository.postgres; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; -import org.opensrp.domain.Campaign; -import org.opensrp.domain.postgres.CampaignMetadata; -import org.opensrp.domain.postgres.CampaignMetadataExample; -import org.opensrp.repository.CampaignRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomCampaignMapper; -import org.opensrp.repository.postgres.mapper.custom.CustomCampaignMetadataMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Repository -public class CampaignRepositoryImpl extends BaseRepositoryImpl implements CampaignRepository { - - @Autowired - private CustomCampaignMapper campaignMapper; - - @Autowired - private CustomCampaignMetadataMapper campaignMetadataMapper; - - @Override - public Campaign get(String id) { - if (StringUtils.isBlank(id)) { - return null; - } - - org.opensrp.domain.postgres.Campaign pgCampaign = campaignMetadataMapper.selectByIdentifier(id); - if (pgCampaign == null) { - return null; - } - return convert(pgCampaign); - } - - @Override - @Transactional - public void add(Campaign entity) { - if (getUniqueField(entity) == null) { - return; - } - - if (retrievePrimaryKey(entity) != null) { // Campaign already added - return; - } - - org.opensrp.domain.postgres.Campaign pgCampaign = convert(entity, null); - if (pgCampaign == null) { - return; - } - - int rowsAffected = campaignMapper.insertSelectiveAndSetId(pgCampaign); - if (rowsAffected < 1 || pgCampaign.getId() == null) { - return; - } - - CampaignMetadata campaignMetadata = createMetadata(entity, pgCampaign.getId()); - - campaignMetadataMapper.insertSelective(campaignMetadata); - - } - - @Override - @Transactional - public void update(Campaign entity) { - if (getUniqueField(entity) == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { // Campaign does not exist - return; - } - - org.opensrp.domain.postgres.Campaign pgCampaign = convert(entity, id); - if (pgCampaign == null) { - return; - } - CampaignMetadata campaignMetadata = createMetadata(entity, pgCampaign.getId()); - - int rowsAffected = campaignMapper.updateByPrimaryKey(pgCampaign); - if (rowsAffected < 1) { - return; - } - - CampaignMetadataExample campaignMetadataExample = new CampaignMetadataExample(); - campaignMetadataExample.createCriteria().andCampaignIdEqualTo(id); - campaignMetadata.setId(campaignMetadataMapper.selectByExample(campaignMetadataExample).get(0).getId()); - campaignMetadataMapper.updateByPrimaryKey(campaignMetadata); - - } - - @Override - public List getAll() { - List campaigns = campaignMetadataMapper - .selectMany(new CampaignMetadataExample(), 0, DEFAULT_FETCH_SIZE); - return convert(campaigns); - } - - @Override - public List getCampaignsByServerVersion(long serverVersion) { - CampaignMetadataExample campaignMetadataExample = new CampaignMetadataExample(); - campaignMetadataExample.createCriteria().andServerVersionGreaterThanOrEqualTo(serverVersion); - List campaigns = campaignMetadataMapper - .selectMany(campaignMetadataExample, 0, DEFAULT_FETCH_SIZE); - return convert(campaigns); - } - - @Override - public List getCampaignsByIdentifiers(String identifiers) { - CampaignMetadataExample campaignMetadataExample = new CampaignMetadataExample(); - campaignMetadataExample.createCriteria().andIdentifierIn(Arrays.asList(org.apache.commons.lang.StringUtils.split(identifiers,","))); - List campaigns = campaignMetadataMapper - .selectMany(campaignMetadataExample, 0, DEFAULT_FETCH_SIZE); - return convert(campaigns); - } - - @Override - @Transactional - public void safeRemove(Campaign entity) { - if (entity == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { - return; - } - - CampaignMetadataExample campaignMetadataExample = new CampaignMetadataExample(); - campaignMetadataExample.createCriteria().andCampaignIdEqualTo(id); - int rowsAffected = campaignMetadataMapper.deleteByExample(campaignMetadataExample); - if (rowsAffected < 1) { - return; - } - - campaignMapper.deleteByPrimaryKey(id); - - } - - @Override - protected Long retrievePrimaryKey(Campaign campaign) { - Object uniqueId = getUniqueField(campaign); - if (uniqueId == null) { - return null; - } - - String identifier = uniqueId.toString(); - - org.opensrp.domain.postgres.Campaign pgCampaign = campaignMetadataMapper.selectByIdentifier(identifier); - if (pgCampaign == null) { - return null; - } - return pgCampaign.getId(); - } - - @Override - protected Object getUniqueField(Campaign campaign) { - if (campaign == null) { - return null; - } - return campaign.getIdentifier(); - } - - private Campaign convert(org.opensrp.domain.postgres.Campaign pgCampaign) { - if (pgCampaign == null || pgCampaign.getJson() == null || !(pgCampaign.getJson() instanceof Campaign)) { - return null; - } - return (Campaign) pgCampaign.getJson(); - } - - private org.opensrp.domain.postgres.Campaign convert(Campaign campaign, Long primaryKey) { - if (campaign == null) { - return null; - } - - org.opensrp.domain.postgres.Campaign pgCampaign = new org.opensrp.domain.postgres.Campaign(); - pgCampaign.setId(primaryKey); - pgCampaign.setJson(campaign); - - return pgCampaign; - } - - private List convert(List campaigns) { - if (campaigns == null || campaigns.isEmpty()) { - return new ArrayList<>(); - } - - List convertedCampaigns = new ArrayList<>(); - for (org.opensrp.domain.postgres.Campaign campaign : campaigns) { - Campaign convertedCampaign = convert(campaign); - if (convertedCampaign != null) { - convertedCampaigns.add(convertedCampaign); - } - } - - return convertedCampaigns; - } - - private CampaignMetadata createMetadata(Campaign entity, Long id) { - CampaignMetadata campaignMetadata = new CampaignMetadata(); - campaignMetadata.setCampaignId(id); - campaignMetadata.setIdentifier(entity.getIdentifier()); - campaignMetadata.setServerVersion(entity.getServerVersion()); - return campaignMetadata; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/ClientsRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/ClientsRepositoryImpl.java deleted file mode 100644 index a4cdf79bd6..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/ClientsRepositoryImpl.java +++ /dev/null @@ -1,537 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.opensrp.common.AllConstants.BaseEntity.BASE_ENTITY_ID; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.apache.commons.lang3.StringUtils; -import org.joda.time.DateTime; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.Client; -import org.opensrp.domain.postgres.ClientMetadata; -import org.opensrp.domain.postgres.ClientMetadataExample; -import org.opensrp.domain.postgres.CustomClient; -import org.opensrp.domain.postgres.HouseholdClient; -import org.opensrp.repository.ClientsRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomClientMapper; -import org.opensrp.repository.postgres.mapper.custom.CustomClientMetadataMapper; -import org.opensrp.search.AddressSearchBean; -import org.opensrp.search.ClientSearchBean; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -@Repository("clientsRepositoryPostgres") -public class ClientsRepositoryImpl extends BaseRepositoryImpl implements ClientsRepository { - - private static Logger logger = LoggerFactory.getLogger(ClientsRepository.class.toString()); - - public static String RESIDENCE = "residence"; - - @Autowired - private CustomClientMetadataMapper clientMetadataMapper; - - @Autowired - private CustomClientMapper clientMapper; - - @Override - public Client get(String id) { - if (StringUtils.isBlank(id)) { - return null; - } - - org.opensrp.domain.postgres.Client pgClient = clientMetadataMapper.selectByDocumentId(id); - if (pgClient == null) { - return null; - } - return convert(pgClient); - } - - @Override - public void add(Client entity) { - if (entity == null || entity.getBaseEntityId() == null) { - return; - } - - if (retrievePrimaryKey(entity) != null) { // Client already added - return; - } - - if (entity.getId() == null) - entity.setId(UUID.randomUUID().toString()); - - setRevision(entity); - - org.opensrp.domain.postgres.Client pgClient = convert(entity, null); - if (pgClient == null) { - return; - } - - int rowsAffected = clientMapper.insertSelectiveAndSetId(pgClient); - if (rowsAffected < 1 || pgClient.getId() == null) { - return; - } - - ClientMetadata clientMetadata = createMetadata(entity, pgClient.getId()); - if (clientMetadata != null) { - clientMetadataMapper.insertSelective(clientMetadata); - } - } - - @Override - public void update(Client entity) { - if (entity == null || entity.getBaseEntityId() == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { // Client not added - return; - } - - setRevision(entity); - - org.opensrp.domain.postgres.Client pgClient = convert(entity, id); - if (pgClient == null) { - return; - } - - ClientMetadata clientMetadata = createMetadata(entity, id); - if (clientMetadata == null) { - return; - } - - int rowsAffected = clientMapper.updateByPrimaryKey(pgClient); - if (rowsAffected < 1) { - return; - } - - ClientMetadataExample clientMetadataExample = new ClientMetadataExample(); - clientMetadataExample.createCriteria().andClientIdEqualTo(id).andDateDeletedIsNull(); - clientMetadata.setId(clientMetadataMapper.selectByExample(clientMetadataExample).get(0).getId()); - clientMetadataMapper.updateByPrimaryKey(clientMetadata); - } - - @Override - public List getAll() { - ClientMetadataExample clientMetadataExample = new ClientMetadataExample(); - clientMetadataExample.createCriteria().andDateDeletedIsNull(); - List clients = clientMetadataMapper.selectMany(clientMetadataExample, 0, - DEFAULT_FETCH_SIZE); - return convert(clients); - } - - @Override - public void safeRemove(Client entity) { - if (entity == null || entity.getBaseEntityId() == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { - return; - } - - Date dateDeleted = entity.getDateVoided() == null ? new Date() : entity.getDateVoided().toDate(); - ClientMetadata clientMetadata = new ClientMetadata(); - clientMetadata.setDateDeleted(dateDeleted); - - ClientMetadataExample clientMetadataExample = new ClientMetadataExample(); - clientMetadataExample.createCriteria().andClientIdEqualTo(id).andDateDeletedIsNull(); - - int rowsAffected = clientMetadataMapper.updateByExampleSelective(clientMetadata, clientMetadataExample); - if (rowsAffected < 1) { - return; - } - - org.opensrp.domain.postgres.Client pgClient = new org.opensrp.domain.postgres.Client(); - pgClient.setId(id); - pgClient.setDateDeleted(dateDeleted); - clientMapper.updateByPrimaryKeySelective(pgClient); - } - - @Override - public Client findByBaseEntityId(String baseEntityId) { - if (StringUtils.isBlank(baseEntityId)) { - return null; - } - org.opensrp.domain.postgres.Client pgClient = clientMetadataMapper.selectOne(baseEntityId); - return convert(pgClient); - } - - @Override - public List findAllClients() { - return getAll(); - } - - @Override - public List findAllByIdentifier(String identifier) { - List clients = clientMapper.selectByIdentifier(identifier); - return convert(clients); - } - - @Override - public List findAllByIdentifier(String identifierType, String identifier) { - List clients = clientMapper.selectByIdentifierOfType(identifierType, identifier); - return convert(clients); - } - - @Override - public List findAllByAttribute(String attributeType, String attribute) { - List clients = clientMapper.selectByAttributeOfType(attributeType, attribute); - return convert(clients); - } - - @Override - public List findAllByMatchingName(String nameMatches) { - List clients = clientMetadataMapper.selectByName(nameMatches, 0, - DEFAULT_FETCH_SIZE); - return convert(clients); - } - - @Override - public List findByRelationshipIdAndDateCreated(String relationalId, String dateFrom, String dateTo) { - List clients = clientMapper.selectByRelationshipIdAndDateCreated(relationalId, - new DateTime(dateFrom).toDate(), new DateTime(dateTo).toDate()); - return convert(clients); - } - - public List findByRelationshipId(String relationshipType, String entityId) { - List clients = clientMapper.selectByRelationshipIdOfType(relationshipType, - entityId); - return convert(clients); - } - - @Override - public List findByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - - int pageSize = searchBean.getPageSize(); - if (pageSize == 0) { - pageSize = DEFAULT_FETCH_SIZE; - } - - int offset = searchBean.getPageNumber() * pageSize; - return convert(clientMetadataMapper.selectBySearchBean(searchBean, addressSearchBean, offset, pageSize)); - } - - @Override - public List findByDynamicQuery(String query) { - throw new IllegalArgumentException("Method not supported"); - } - - @Override - public List findByCriteria(ClientSearchBean searchBean) { - return findByCriteria(searchBean, new AddressSearchBean()); - } - - @Override - public List findByCriteria(AddressSearchBean addressSearchBean, DateTime lastEditFrom, DateTime lastEditTo) { - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setLastEditFrom(lastEditFrom); - clientSearchBean.setLastEditTo(lastEditTo); - return findByCriteria(clientSearchBean, addressSearchBean); - } - - @Override - public List findByRelationShip(String relationIndentier) { - List clients = clientMapper.selectByRelationShip(relationIndentier); - return convert(clients); - } - - @Override - public List findByEmptyServerVersion() { - ClientMetadataExample clientMetadataExample = new ClientMetadataExample(); - clientMetadataExample.createCriteria().andServerVersionIsNull().andDateDeletedIsNull(); - clientMetadataExample.setOrderByClause("client_id ASC"); - - List clients = clientMetadataMapper.selectMany(clientMetadataExample, 0, - DEFAULT_FETCH_SIZE); - return convert(clients); - } - - @Override - public List findByServerVersion(long serverVersion) { - ClientMetadataExample clientMetadataExample = new ClientMetadataExample(); - clientMetadataExample.createCriteria().andServerVersionGreaterThanOrEqualTo(serverVersion + 1) - .andDateDeletedIsNull(); - clientMetadataExample.setOrderByClause("server_version ASC"); - - List clients = clientMetadataMapper.selectMany(clientMetadataExample, 0, - DEFAULT_FETCH_SIZE); - return convert(clients); - } - - @Override - public List findByFieldValue(String field, List ids) { - if (field.equals(BASE_ENTITY_ID) && ids != null && !ids.isEmpty()) { - ClientMetadataExample clientMetadataExample = new ClientMetadataExample(); - clientMetadataExample.createCriteria().andBaseEntityIdIn(ids).andDateDeletedIsNull(); - List clients = clientMetadataMapper.selectMany(clientMetadataExample, 0, - DEFAULT_FETCH_SIZE); - return convert(clients); - } - return new ArrayList<>(); - } - - @Override - public List notInOpenMRSByServerVersion(long serverVersion, Calendar calendar) { - long serverStartKey = serverVersion + 1; - long serverEndKey = calendar.getTimeInMillis(); - if (serverStartKey < serverEndKey) { - ClientMetadataExample clientMetadataExample = new ClientMetadataExample(); - clientMetadataExample.createCriteria().andOpenmrsUuidIsNull() - .andServerVersionBetween(serverStartKey, serverEndKey).andDateDeletedIsNull(); - - List clients = clientMetadataMapper.selectMany(clientMetadataExample, 0, - DEFAULT_FETCH_SIZE); - return convert(clients); - } - return new ArrayList<>(); - } - - // Private Methods - protected List convert(List clients) { - if (clients == null || clients.isEmpty()) { - return new ArrayList<>(); - } - - List convertedClients = new ArrayList<>(); - for (org.opensrp.domain.postgres.Client client : clients) { - Client convertedClient = convert(client); - if (convertedClient != null) { - convertedClients.add(convertedClient); - } - } - - return convertedClients; - } - - private Client convert(org.opensrp.domain.postgres.Client client) { - if (client == null || client.getJson() == null || !(client.getJson() instanceof Client)) { - return null; - } - return (Client) client.getJson(); - } - - private org.opensrp.domain.postgres.Client convert(Client client, Long primaryKey) { - if (client == null) { - return null; - } - - org.opensrp.domain.postgres.Client pgClient = new org.opensrp.domain.postgres.Client(); - pgClient.setId(primaryKey); - pgClient.setJson(client); - - return pgClient; - } - - private ClientMetadata createMetadata(Client client, Long clientId) { - try { - ClientMetadata clientMetadata = new ClientMetadata(); - clientMetadata.setDocumentId(client.getId()); - clientMetadata.setBaseEntityId(client.getBaseEntityId()); - if (client.getBirthdate() != null) { - clientMetadata.setBirthDate(client.getBirthdate().toDate()); - } - clientMetadata.setClientId(clientId); - clientMetadata.setFirstName(client.getFirstName()); - clientMetadata.setMiddleName(client.getMiddleName()); - clientMetadata.setLastName(client.getLastName()); - - String relationalId = null; - Map> relationShips = client.getRelationships(); - if (relationShips != null && !relationShips.isEmpty()) { - for (Map.Entry> maEntry : relationShips.entrySet()) { - List values = maEntry.getValue(); - if (values != null && !values.isEmpty()) { - relationalId = values.get(0); - break; - } - } - } - clientMetadata.setRelationalId(relationalId); - - String uniqueId = null; - String openmrsUUID = null; - Map identifiers = client.getIdentifiers(); - if (identifiers != null && !identifiers.isEmpty()) { - for (Map.Entry entry : identifiers.entrySet()) { - String value = entry.getValue(); - if (StringUtils.isNotBlank(value)) { - if (AllConstants.Client.OPENMRS_UUID_IDENTIFIER_TYPE.equalsIgnoreCase(entry.getKey())) { - openmrsUUID = value; - } else { - uniqueId = value; - } - } - } - } - - clientMetadata.setUniqueId(uniqueId); - clientMetadata.setOpenmrsUuid(openmrsUUID); - clientMetadata.setServerVersion(client.getServerVersion()); - if (client.getDateVoided() != null) - clientMetadata.setDateDeleted(client.getDateVoided().toDate()); - Object residence = client.getAttribute(RESIDENCE); - if (residence != null) - clientMetadata.setResidence(residence.toString()); - return clientMetadata; - } - catch (Exception e) { - logger.error(e.getMessage(), e); - return null; - } - } - - @Override - protected Long retrievePrimaryKey(Client t) { - Object uniqueId = getUniqueField(t); - if (uniqueId == null) { - return null; - } - - String baseEntityId = uniqueId.toString(); - - ClientMetadataExample clientMetadataExample = new ClientMetadataExample(); - clientMetadataExample.createCriteria().andBaseEntityIdEqualTo(baseEntityId).andDateDeletedIsNull(); - - org.opensrp.domain.postgres.Client pgClient = clientMetadataMapper.selectOne(baseEntityId); - if (pgClient == null) { - return null; - } - return pgClient.getId(); - } - - @Override - protected Object getUniqueField(Client t) { - if (t == null) { - return null; - } - return t.getBaseEntityId(); - } - - @Override - public List selectMemberCountHouseholdHeadProviderByClients(String field, List ids, - String clientType) { - ClientMetadataExample clientMetadataExample = new ClientMetadataExample(); - clientMetadataExample.createCriteria().andRelationalIdIn(ids); - return clientMetadataMapper.selectMemberCountHouseholdHeadProviderByClients(clientMetadataExample, clientType); - } - - @Override - public HouseholdClient findTotalCountHouseholdByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - - return clientMetadataMapper.selectHouseholdCountBySearchBean(searchBean, addressSearchBean); - } - - @Override - public List findMembersByRelationshipId(String baseEntityId) { - - List members = new ArrayList(); - if (!StringUtils.isBlank(baseEntityId)) { - members = clientMetadataMapper.selectMembersByRelationshipId(baseEntityId); - } - return customClientConvert(members); - } - - @Override - public List findAllClientsByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - int pageSize = searchBean.getPageSize(); - if (pageSize == 0) { - pageSize = DEFAULT_FETCH_SIZE; - } - - int offset = searchBean.getPageNumber() * pageSize; - - List clients = clientMetadataMapper.selectAllClientsBySearchBean(searchBean, addressSearchBean, - offset, pageSize); - return customClientConvert(clients); - } - - private Client customClientConvert(CustomClient customClient) { - - if (customClient == null || customClient.getJson() == null || !(customClient.getJson() instanceof Client)) { - return null; - } - - Client cl = (Client) customClient.getJson(); - cl.addAttribute("dynamicProperties", customClient.getDynamicProperties()); - return cl; - } - - protected List customClientConvert(List clients) { - if (clients == null || clients.isEmpty()) { - return new ArrayList<>(); - } - - List convertedClients = new ArrayList<>(); - for (CustomClient client : clients) { - Client convertedClient = customClientConvert(client); - if (convertedClient != null) { - convertedClients.add(convertedClient); - } - } - - return convertedClients; - } - - @Override - public HouseholdClient findCountAllClientsByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - - return clientMetadataMapper.selectCountAllClientsBySearchBean(searchBean, addressSearchBean); - } - - @Override - public List findHouseholdByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - Map pageSizeAndOffset = getPageSizeAndOffset(searchBean); - return customClientConvert(clientMetadataMapper.selectHouseholdBySearchBean(searchBean, addressSearchBean, - pageSizeAndOffset.get("offset"), pageSizeAndOffset.get("pageSize"))); - } - - @Override - public List findANCByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - Map pageSizeAndOffset = getPageSizeAndOffset(searchBean); - List clients = clientMetadataMapper.selectANCBySearchBean(searchBean, addressSearchBean, - pageSizeAndOffset.get("offset"), pageSizeAndOffset.get("pageSize")); - return customClientConvert(clients); - } - - @Override - public int findCountANCByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - return clientMetadataMapper.selectCountANCBySearchBean(searchBean, addressSearchBean); - } - - @Override - public List findChildByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - Map pageSizeAndOffset = getPageSizeAndOffset(searchBean); - List clients = clientMetadataMapper.selectChildBySearchBean(searchBean, addressSearchBean, - pageSizeAndOffset.get("offset"), pageSizeAndOffset.get("pageSize")); - return customClientConvert(clients); - } - - @Override - public int findCountChildByCriteria(ClientSearchBean searchBean, AddressSearchBean addressSearchBean) { - return clientMetadataMapper.selectCountChildBySearchBean(searchBean, addressSearchBean); - } - - private Map getPageSizeAndOffset(ClientSearchBean searchBean) { - Map pageSizeAndOffset = new HashMap<>(); - int pageSize = searchBean.getPageSize(); - if (pageSize == 0) { - pageSize = DEFAULT_FETCH_SIZE; - } - - int offset = searchBean.getPageNumber() * pageSize; - pageSizeAndOffset.put("pageSize", pageSize); - pageSizeAndOffset.put("offset", offset); - return pageSizeAndOffset; - - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/ErrorTraceRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/ErrorTraceRepositoryImpl.java deleted file mode 100644 index e39b35f537..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/ErrorTraceRepositoryImpl.java +++ /dev/null @@ -1,194 +0,0 @@ -package org.opensrp.repository.postgres; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.ektorp.DocumentNotFoundException; -import org.joda.time.DateTime; -import org.opensrp.domain.ErrorTrace; -import org.opensrp.domain.postgres.ErrorTraceExample; -import org.opensrp.repository.ErrorTraceRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomErrorTraceMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -@Repository("errorRepositoryPostgres") -public class ErrorTraceRepositoryImpl extends BaseRepositoryImpl implements ErrorTraceRepository { - - public final static String SOLVED = "solved"; - - public final static String UNSOLVED = "unsolved"; - - @Autowired - private CustomErrorTraceMapper errorTraceMapper; - - @Override - public ErrorTrace get(String id) { - ErrorTraceExample example = new ErrorTraceExample(); - example.createCriteria().andDocumentIdEqualTo(id); - List errors = errorTraceMapper.selectByExample(example); - if (!errors.isEmpty()) - return convert(errors.get(0)); - else - return null; - } - - @Override - public void add(ErrorTrace entity) { - if (entity == null || entity.getStackTrace() == null) { - return; - } - - if (retrievePrimaryKey(entity) != null) { //ErrorTrace already added - return; - } - - if (entity.getId() == null) - entity.setId(UUID.randomUUID().toString()); - setRevision(entity); - - org.opensrp.domain.postgres.ErrorTrace pgErrorTrace = convert(entity, null); - if (pgErrorTrace == null) { - return; - } - - errorTraceMapper.insertSelective(pgErrorTrace); - - } - - @Override - public void update(ErrorTrace entity) { - if (getUniqueField(entity) == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - - if (id == null) { //ErrorTrace doesn't not exist - return; - } - setRevision(entity); - - org.opensrp.domain.postgres.ErrorTrace pgErrorTrace = convert(entity, id); - errorTraceMapper.updateByPrimaryKey(pgErrorTrace); - } - - @Override - public List getAll() { - return convert(errorTraceMapper.selectMany(new ErrorTraceExample(), 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public void safeRemove(ErrorTrace entity) { - if (getUniqueField(entity) == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { - return; - } - - errorTraceMapper.deleteByPrimaryKey(id); - - } - - @Override - public ErrorTrace findById(String _id) throws DocumentNotFoundException { - return get(_id); - } - - @Override - public boolean exists(String id) { - return get(id) != null; - } - - @Override - public List findAllErrors() throws DocumentNotFoundException { - return getAll(); - } - - @Override - public List findAllUnSolvedErrors() throws DocumentNotFoundException { - ErrorTraceExample example = new ErrorTraceExample(); - example.createCriteria().andStatusEqualTo(UNSOLVED); - example.or(example.createCriteria().andStatusIsNull()); - example.or(example.createCriteria().andStatusEqualTo("")); - return convert(errorTraceMapper.selectMany(example, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findAllSolvedErrors() throws DocumentNotFoundException { - ErrorTraceExample example = new ErrorTraceExample(); - example.createCriteria().andStatusEqualTo(SOLVED); - return convert(errorTraceMapper.selectMany(example, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - protected Long retrievePrimaryKey(ErrorTrace errorTrace) { - if (getUniqueField(errorTrace) == null) { - return null; - } - String documentId = errorTrace.getId(); - - ErrorTraceExample example = new ErrorTraceExample(); - example.createCriteria().andDocumentIdEqualTo(documentId); - List errors = errorTraceMapper.selectByExample(example); - return errors.isEmpty() ? null : errors.get(0).getId(); - } - - @Override - protected Object getUniqueField(ErrorTrace errorTrace) { - return errorTrace == null || errorTrace.getId() == null ? null : errorTrace.getId(); - } - - //private Methods - private ErrorTrace convert(org.opensrp.domain.postgres.ErrorTrace pgEntity) { - ErrorTrace entity = new ErrorTrace(); - entity.setId(pgEntity.getDocumentId()); - if (pgEntity.getDateOccurred() != null) - entity.setDateOccurred(new DateTime(pgEntity.getDateOccurred())); - entity.setErrorType(pgEntity.getErrorType()); - entity.setOccurredAt(pgEntity.getOccurredAt()); - entity.setStackTrace(pgEntity.getStackTrace()); - entity.setStatus(pgEntity.getStatus()); - entity.setDateClosed(pgEntity.getDateClosed()); - entity.setDocumentType(pgEntity.getDocumentType()); - entity.setRecordId(pgEntity.getRecordId()); - entity.setRetryUrl(pgEntity.getRetryUrl()); - return entity; - } - - private org.opensrp.domain.postgres.ErrorTrace convert(ErrorTrace entity, Long id) { - org.opensrp.domain.postgres.ErrorTrace pgEntity = new org.opensrp.domain.postgres.ErrorTrace(); - pgEntity.setId(id); - pgEntity.setDocumentId(entity.getId()); - if (entity.getDateOccurred() != null) - pgEntity.setDateOccurred(entity.getDateOccurred().toDate()); - pgEntity.setErrorType(entity.getErrorType()); - pgEntity.setOccurredAt(entity.getOccurredAt()); - pgEntity.setStackTrace(entity.getStackTrace()); - pgEntity.setStatus(entity.getStatus()); - pgEntity.setDateClosed(entity.getDateClosed()); - pgEntity.setDocumentType(entity.getDocumentType()); - pgEntity.setRecordId(entity.getRecordId()); - pgEntity.setRetryUrl(entity.getRetryUrl()); - return pgEntity; - } - - private List convert(List pgErrors) { - if (pgErrors == null || pgErrors.isEmpty()) { - return new ArrayList<>(); - } - List errorTraces = new ArrayList<>(); - for (org.opensrp.domain.postgres.ErrorTrace pgError : pgErrors) { - ErrorTrace error = convert(pgError); - if (error != null) { - errorTraces.add(error); - } - } - - return errorTraces; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/EventsRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/EventsRepositoryImpl.java deleted file mode 100644 index df79b7b800..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/EventsRepositoryImpl.java +++ /dev/null @@ -1,503 +0,0 @@ -package org.opensrp.repository.postgres; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import org.apache.commons.lang3.StringUtils; -import org.joda.time.DateTime; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.Event; -import org.opensrp.domain.postgres.EventMetadata; -import org.opensrp.domain.postgres.EventMetadataExample; -import org.opensrp.domain.postgres.EventMetadataExample.Criteria; -import org.opensrp.repository.EventsRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomEventMapper; -import org.opensrp.repository.postgres.mapper.custom.CustomEventMetadataMapper; -import org.opensrp.search.EventSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -@Repository("eventsRepositoryPostgres") -public class EventsRepositoryImpl extends BaseRepositoryImpl implements EventsRepository { - - @Autowired - private CustomEventMapper eventMapper; - - @Autowired - private CustomEventMetadataMapper eventMetadataMapper; - - @Override - public Event get(String id) { - if (StringUtils.isBlank(id)) { - return null; - } - org.opensrp.domain.postgres.Event pgEvent = eventMetadataMapper.selectByDocumentId(id); - - return convert(pgEvent); - } - - @Override - public void add(Event entity) { - if (entity == null || entity.getBaseEntityId() == null) { - return; - } - - if (retrievePrimaryKey(entity) != null) { // Event already added - return; - } - - if (entity.getId() == null) - entity.setId(UUID.randomUUID().toString()); - setRevision(entity); - - org.opensrp.domain.postgres.Event pgEvent = convert(entity, null); - if (pgEvent == null) { - return; - } - - int rowsAffected = eventMapper.insertSelectiveAndSetId(pgEvent); - if (rowsAffected < 1 || pgEvent.getId() == null) { - return; - } - - EventMetadata eventMetadata = createMetadata(entity, pgEvent.getId()); - if (eventMetadata != null) { - eventMetadataMapper.insertSelective(eventMetadata); - } - - } - - @Override - public void update(Event entity) { - if (entity == null || entity.getBaseEntityId() == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { // Event not added - return; - } - - setRevision(entity); - - org.opensrp.domain.postgres.Event pgEvent = convert(entity, id); - if (pgEvent == null) { - return; - } - - EventMetadata eventMetadata = createMetadata(entity, id); - if (eventMetadata == null) { - return; - } - - int rowsAffected = eventMapper.updateByPrimaryKey(pgEvent); - if (rowsAffected < 1) { - return; - } - - EventMetadataExample eventMetadataExample = new EventMetadataExample(); - eventMetadataExample.createCriteria().andEventIdEqualTo(id).andDateDeletedIsNull(); - eventMetadata.setId(eventMetadataMapper.selectByExample(eventMetadataExample).get(0).getId()); - eventMetadataMapper.updateByPrimaryKey(eventMetadata); - - } - - @Override - public List getAll() { - EventMetadataExample eventMetadataExample = new EventMetadataExample(); - eventMetadataExample.createCriteria().andDateDeletedIsNull(); - List events = eventMetadataMapper - .selectManyWithRowBounds(eventMetadataExample, 0, DEFAULT_FETCH_SIZE); - return convert(events); - } - - @Override - public void safeRemove(Event entity) { - if (entity == null || entity.getBaseEntityId() == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { - return; - } - - Date dateDeleted = entity.getDateVoided() == null ? new Date() : entity.getDateVoided().toDate(); - EventMetadata eventMetadata = new EventMetadata(); - eventMetadata.setDateDeleted(dateDeleted); - - EventMetadataExample eventMetadataExample = new EventMetadataExample(); - eventMetadataExample.createCriteria().andEventIdEqualTo(id).andDateDeletedIsNull(); - int rowsAffected = eventMetadataMapper.updateByExampleSelective(eventMetadata, eventMetadataExample); - if (rowsAffected < 1) { - return; - } - - org.opensrp.domain.postgres.Event pgEvent = new org.opensrp.domain.postgres.Event(); - pgEvent.setId(id); - pgEvent.setDateDeleted(dateDeleted); - eventMapper.updateByPrimaryKeySelective(pgEvent); - - } - - @Override - public List findAllByIdentifier(String identifier) { - List events = eventMapper.selectByIdentifier(identifier); - return convert(events); - } - - @Override - public List findAllByIdentifier(String identifierType, String identifier) { - List events = eventMapper.selectByIdentifierOfType(identifierType, - identifier); - return convert(events); - } - - @Override - public Event findById(String id) { - return get(id); - } - - @Override - public Event findByFormSubmissionId(String formSubmissionId) { - if (StringUtils.isBlank(formSubmissionId)) { - return null; - } - EventMetadataExample example = new EventMetadataExample(); - example.createCriteria().andFormSubmissionIdEqualTo(formSubmissionId).andDateDeletedIsNull(); - List events = eventMetadataMapper.selectMany(example); - if (events.size() > 1) { - throw new IllegalStateException("Multiple events for formSubmissionId " + formSubmissionId); - } else if (!events.isEmpty()) - return convert(events.get(0)); - else - return null; - } - - @Override - public List findByBaseEntityId(String baseEntityId) { - EventMetadataExample example = new EventMetadataExample(); - example.createCriteria().andBaseEntityIdEqualTo(baseEntityId).andDateDeletedIsNull(); - return convert(eventMetadataMapper.selectMany(example)); - } - - @Override - public Event findByBaseEntityAndFormSubmissionId(String baseEntityId, String formSubmissionId) { - EventMetadataExample example = new EventMetadataExample(); - example.createCriteria().andBaseEntityIdEqualTo(baseEntityId).andFormSubmissionIdEqualTo(formSubmissionId) - .andDateDeletedIsNull(); - List events = eventMetadataMapper.selectMany(example); - if (events.size() > 1) { - throw new IllegalStateException("Multiple events for baseEntityId and formSubmissionId combination (" - + baseEntityId + "," + formSubmissionId + ")"); - } else if (!events.isEmpty()) - return convert(events.get(0)); - else - return null; - } - - @Override - public List findByBaseEntityAndType(String baseEntityId, String eventType) { - EventMetadataExample example = new EventMetadataExample(); - example.createCriteria().andBaseEntityIdEqualTo(baseEntityId).andEventTypeEqualTo(eventType) - .andDateDeletedIsNull(); - return convert(eventMetadataMapper.selectMany(example)); - } - - @Override - public List findEvents(EventSearchBean eventSearchBean) { - EventMetadataExample example = new EventMetadataExample(); - Criteria criteria = example.createCriteria(); - if (StringUtils.isNotEmpty(eventSearchBean.getBaseEntityId())) - criteria.andBaseEntityIdEqualTo(eventSearchBean.getBaseEntityId()); - if (eventSearchBean.getEventDateFrom() != null && eventSearchBean.getEventDateTo() != null) - criteria.andEventDateBetween(eventSearchBean.getEventDateFrom().toDate(), - eventSearchBean.getEventDateTo().toDate()); - if (StringUtils.isNotEmpty(eventSearchBean.getEventType())) - criteria.andEventTypeEqualTo(eventSearchBean.getEventType()); - if (StringUtils.isNotEmpty(eventSearchBean.getEntityType())) - criteria.andEntityTypeEqualTo(eventSearchBean.getEntityType()); - if (StringUtils.isNotEmpty(eventSearchBean.getProviderId())) - criteria.andProviderIdEqualTo(eventSearchBean.getProviderId()); - if (StringUtils.isNotEmpty(eventSearchBean.getLocationId())) - criteria.andLocationIdEqualTo(eventSearchBean.getLocationId()); - if (eventSearchBean.getLastEditFrom() != null && eventSearchBean.getLastEditTo() != null) - criteria.andDateEditedBetween(eventSearchBean.getLastEditFrom().toDate(), - eventSearchBean.getLastEditTo().toDate()); - if (StringUtils.isNotEmpty(eventSearchBean.getTeam())) - criteria.andTeamEqualTo(eventSearchBean.getTeam()); - if (StringUtils.isNotEmpty(eventSearchBean.getTeamId())) - criteria.andTeamIdEqualTo(eventSearchBean.getTeamId()); - if (!criteria.isValid()) - throw new IllegalArgumentException("Atleast one search filter must be specified"); - criteria.andDateDeletedIsNull(); - return convert(eventMetadataMapper.selectManyWithRowBounds(example, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findEventsByDynamicQuery(String query) { - throw new IllegalArgumentException("Dynamic query feature not supported"); - } - - @Override - public List findByServerVersion(long serverVersion) { - EventMetadataExample example = new EventMetadataExample(); - example.createCriteria().andServerVersionGreaterThanOrEqualTo(serverVersion + 1).andDateDeletedIsNull(); - return convert(eventMetadataMapper.selectManyWithRowBounds(example, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List notInOpenMRSByServerVersion(long serverVersion, Calendar calendar) { - return convert(eventMetadataMapper.selectNotInOpenMRSByServerVersion(serverVersion, calendar.getTimeInMillis(), - DEFAULT_FETCH_SIZE)); - } - - @Override - public List notInOpenMRSByServerVersionAndType(String type, long serverVersion, Calendar calendar) { - return convert(eventMetadataMapper.selectNotInOpenMRSByServerVersionAndType(type, serverVersion, - calendar.getTimeInMillis(), DEFAULT_FETCH_SIZE)); - } - - @Override - public List findByClientAndConceptAndDate(String baseEntityId, String concept, String conceptValue, - String dateFrom, String dateTo) { - if (StringUtils.isBlank(baseEntityId) && StringUtils.isBlank(concept) && StringUtils.isBlank(conceptValue)) - return new ArrayList(); - Date from = null; - Date to = null; - if (StringUtils.isNotEmpty(dateFrom)) - from = new DateTime(dateFrom).toDate(); - if (StringUtils.isNotEmpty(dateTo)) - to = new DateTime(dateTo).toDate(); - return convert(eventMapper.selectByBaseEntityIdConceptAndDate(baseEntityId, concept, conceptValue, from, to)); - } - - @Override - public List findByBaseEntityIdAndConceptParentCode(String baseEntityId, String concept, String parentCode) { - if (StringUtils.isBlank(baseEntityId) && StringUtils.isBlank(concept) && StringUtils.isBlank(parentCode)) - return new ArrayList(); - return convert(eventMapper.selectByBaseEntityIdAndConceptParentCode(baseEntityId, concept, parentCode)); - } - - @Override - public List findByConceptAndValue(String concept, String conceptValue) { - if (StringUtils.isBlank(concept) && StringUtils.isBlank(conceptValue)) - return new ArrayList(); - return convert(eventMapper.selectByConceptAndValue(concept, conceptValue)); - } - - @Override - public List findByEmptyServerVersion() { - EventMetadataExample example = new EventMetadataExample(); - example.createCriteria().andDateDeletedIsNull().andServerVersionIsNull(); - example.or(example.createCriteria().andDateDeletedIsNull().andServerVersionEqualTo(0l)); - return convert(eventMetadataMapper.selectManyWithRowBounds(example, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findEvents(EventSearchBean eventSearchBean, String sortBy, String sortOrder, int limit) { - EventMetadataExample example = new EventMetadataExample(); - Criteria criteria = example.createCriteria(); - - if (StringUtils.isNotEmpty(eventSearchBean.getTeam())) { - if (eventSearchBean.getTeam().contains(",")) { - String[] teamsArray = org.apache.commons.lang.StringUtils.split(eventSearchBean.getTeam(), ","); - criteria.andTeamIn(Arrays.asList(teamsArray)); - } else { - criteria.andTeamEqualTo(eventSearchBean.getTeam()); - } - } - - if (StringUtils.isNotEmpty(eventSearchBean.getTeamId())) { - if (eventSearchBean.getTeamId().contains(",")) { - String[] teamsArray = org.apache.commons.lang.StringUtils.split(eventSearchBean.getTeamId(), ","); - criteria.andTeamIdIn(Arrays.asList(teamsArray)); - } else { - criteria.andTeamIdEqualTo(eventSearchBean.getTeamId()); - } - } - - if (StringUtils.isNotEmpty(eventSearchBean.getProviderId())) { - if (eventSearchBean.getProviderId().contains(",")) { - String[] providersArray = org.apache.commons.lang.StringUtils.split(eventSearchBean.getProviderId(), - ","); - criteria.andProviderIdIn(Arrays.asList(providersArray)); - } else { - criteria.andProviderIdEqualTo(eventSearchBean.getProviderId()); - } - } - if (StringUtils.isNotEmpty(eventSearchBean.getLocationId())) { - if (eventSearchBean.getLocationId().contains(",")) { - String[] locationArray = org.apache.commons.lang.StringUtils.split(eventSearchBean.getLocationId(), - ","); - criteria.andLocationIdIn(Arrays.asList(locationArray)); - } else { - criteria.andLocationIdEqualTo(eventSearchBean.getLocationId()); - } - } - if (StringUtils.isNotEmpty(eventSearchBean.getBaseEntityId())) { - if (eventSearchBean.getBaseEntityId().contains(",")) { - String[] idsArray = org.apache.commons.lang.StringUtils.split(eventSearchBean.getBaseEntityId(), ","); - criteria.andBaseEntityIdIn(Arrays.asList(idsArray)); - } else { - criteria.andBaseEntityIdEqualTo(eventSearchBean.getBaseEntityId()); - } - } - if (eventSearchBean.getServerVersion() != null) - criteria.andServerVersionGreaterThanOrEqualTo(eventSearchBean.getServerVersion()); - - if (StringUtils.isNotEmpty(eventSearchBean.getEventType())) - criteria.andEventTypeEqualTo(eventSearchBean.getEventType()); - - if (!criteria.isValid()) - throw new IllegalArgumentException("Atleast one search filter must be specified"); - - criteria.andDateDeletedIsNull(); - example.setOrderByClause(getOrderByClause(sortBy, sortOrder)); - return convert(eventMetadataMapper.selectManyWithRowBounds(example, 0, limit)); - } - - /** - * Compatibility method inherited from couch to fetch events of a given type - * within the current month - * - * @param eventType the type of event to query - * @return list of events of given type within the current month - */ - @Override - public List findEventByEventTypeBetweenTwoDates(String eventType) { - Calendar calendar = Calendar.getInstance(); - calendar.set(Calendar.DATE, 1); - calendar.set(Calendar.HOUR, 0); - calendar.set(Calendar.MINUTE, 0); - calendar.set(Calendar.MILLISECOND, 0); - EventMetadataExample example = new EventMetadataExample(); - example.createCriteria().andEventTypeEqualTo(eventType) - .andServerVersionBetween(calendar.getTimeInMillis(), System.currentTimeMillis()).andDateDeletedIsNull(); - return convert(eventMetadataMapper.selectManyWithRowBounds(example, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findByProvider(String provider) { - EventMetadataExample example = new EventMetadataExample(); - example.createCriteria().andProviderIdEqualTo(provider); - return convert(eventMetadataMapper.selectManyWithRowBounds(example, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findIdsByEventType(String eventType, Date dateDeleted) { - EventMetadataExample example = new EventMetadataExample(); - Criteria criteria = example.createCriteria(); - - if (!StringUtils.isBlank(eventType)) { - criteria.andEventTypeEqualTo(eventType); - } - - if (dateDeleted != null) { - criteria.andDateDeletedGreaterThanOrEqualTo(dateDeleted); - } else { - criteria.andDateDeletedIsNull(); - } - - return eventMetadataMapper.selectManyIds(example); - } - - @Override - protected Long retrievePrimaryKey(Event t) { - Object uniqueId = getUniqueField(t); - if (uniqueId == null) { - return null; - } - - String documentId = uniqueId.toString(); - - EventMetadataExample eventMetadataExample = new EventMetadataExample(); - eventMetadataExample.createCriteria().andDocumentIdEqualTo(documentId); - - org.opensrp.domain.postgres.Event pgClient = eventMetadataMapper.selectByDocumentId(documentId); - if (pgClient == null) { - return null; - } - return pgClient.getId(); - } - - @Override - protected Object getUniqueField(Event t) { - if (t == null) { - return null; - } - return t.getId(); - } - - // Private Methods - private Event convert(org.opensrp.domain.postgres.Event event) { - if (event == null || event.getJson() == null || !(event.getJson() instanceof Event)) { - return null; - } - return (Event) event.getJson(); - } - - private org.opensrp.domain.postgres.Event convert(Event event, Long primaryKey) { - if (event == null) { - return null; - } - - org.opensrp.domain.postgres.Event pgEvent = new org.opensrp.domain.postgres.Event(); - pgEvent.setId(primaryKey); - pgEvent.setJson(event); - - return pgEvent; - } - - private List convert(List events) { - if (events == null || events.isEmpty()) { - return new ArrayList<>(); - } - - List convertedEvents = new ArrayList<>(); - for (org.opensrp.domain.postgres.Event event : events) { - Event convertedEvent = convert(event); - if (convertedEvent != null) { - convertedEvents.add(convertedEvent); - } - } - - return convertedEvents; - } - - private EventMetadata createMetadata(Event event, Long eventId) { - try { - EventMetadata eventMetadata = new EventMetadata(); - eventMetadata.setBaseEntityId(event.getBaseEntityId()); - eventMetadata.setEventId(eventId); - eventMetadata.setDocumentId(event.getId()); - eventMetadata.setBaseEntityId(event.getBaseEntityId()); - eventMetadata.setFormSubmissionId(event.getFormSubmissionId()); - eventMetadata.setOpenmrsUuid(event.getIdentifier(AllConstants.Client.OPENMRS_UUID_IDENTIFIER_TYPE)); - eventMetadata.setEventType(event.getEventType()); - if (event.getEventDate() != null) - eventMetadata.setEventDate(event.getEventDate().toDate()); - eventMetadata.setEntityType(event.getEntityType()); - eventMetadata.setProviderId(event.getProviderId()); - eventMetadata.setLocationId(event.getLocationId()); - eventMetadata.setTeam(event.getTeam()); - eventMetadata.setTeamId(event.getTeamId()); - eventMetadata.setServerVersion(event.getServerVersion()); - if (event.getDateCreated() != null) - eventMetadata.setDateCreated(event.getDateCreated().toDate()); - if (event.getDateEdited() != null) - eventMetadata.setDateEdited(event.getDateEdited().toDate()); - if (event.getDateVoided() != null) - eventMetadata.setDateDeleted(event.getDateVoided().toDate()); - return eventMetadata; - } catch (Exception e) { - logger.error(e.getMessage(), e); - return null; - } - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/LocationRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/LocationRepositoryImpl.java deleted file mode 100644 index 6cfc3ec3f2..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/LocationRepositoryImpl.java +++ /dev/null @@ -1,561 +0,0 @@ -package org.opensrp.repository.postgres; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.StringUtils; -import org.opensrp.domain.LocationDetail; -import org.opensrp.domain.PhysicalLocation; -import org.opensrp.domain.StructureDetails; -import org.opensrp.domain.postgres.Location; -import org.opensrp.domain.postgres.LocationMetadata; -import org.opensrp.domain.postgres.LocationMetadataExample; -import org.opensrp.domain.postgres.Structure; -import org.opensrp.domain.postgres.StructureFamilyDetails; -import org.opensrp.domain.postgres.StructureMetadata; -import org.opensrp.domain.postgres.StructureMetadataExample; -import org.opensrp.repository.LocationRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomLocationMapper; -import org.opensrp.repository.postgres.mapper.custom.CustomLocationMetadataMapper; -import org.opensrp.repository.postgres.mapper.custom.CustomStructureMapper; -import org.opensrp.repository.postgres.mapper.custom.CustomStructureMetadataMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Repository -public class LocationRepositoryImpl extends BaseRepositoryImpl implements LocationRepository { - - @Autowired - private CustomLocationMapper locationMapper; - - @Autowired - private CustomLocationMetadataMapper locationMetadataMapper; - - @Autowired - private CustomStructureMapper structureMapper; - - @Autowired - private CustomStructureMetadataMapper structureMetadataMapper; - - @Override - public PhysicalLocation get(String id) { - return convert(locationMetadataMapper.findById(id, true)); - } - - @Override - public PhysicalLocation get(String id, boolean returnGeography) { - return convert(locationMetadataMapper.findById(id, returnGeography)); - } - - @Override - public PhysicalLocation getStructure(String id, boolean returnGeography) { - return convert(structureMetadataMapper.findById(id, returnGeography)); - } - - @Override - @Transactional - public void add(PhysicalLocation entity) { - if (getUniqueField(entity) == null) { - return; - } - - if (retrievePrimaryKey(entity) != null) { // PhysicalLocation already added - return; - } - - if (entity.isJurisdiction()) - addLocation(entity); - else - addStructure(entity); - - } - - private void addLocation(PhysicalLocation entity) { - - Location pgLocation = convert(entity, null); - if (pgLocation == null) { - return; - } - - int rowsAffected = locationMapper.insertSelectiveAndSetId(pgLocation); - if (rowsAffected < 1 || pgLocation.getId() == null) { - return; - } - - LocationMetadata locationMetadata = createMetadata(entity, pgLocation.getId()); - - locationMetadataMapper.insertSelective(locationMetadata); - - } - - private void addStructure(PhysicalLocation entity) { - - Structure pgStructure = convertStructure(entity, null); - if (pgStructure == null) { - return; - } - - int rowsAffected = structureMapper.insertSelectiveAndSetId(pgStructure); - if (rowsAffected < 1 || pgStructure.getId() == null) { - return; - } - - StructureMetadata structureMetadata = createStructureMetadata(entity, pgStructure.getId()); - - structureMetadataMapper.insertSelective(structureMetadata); - - } - - @Override - @Transactional - public void update(PhysicalLocation entity) { - if (getUniqueField(entity) == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { // PhysicalLocation does not exist - return; - } - if (entity.isJurisdiction()) - updateLocation(entity, id); - else - updateStructure(entity, id); - - } - - private void updateLocation(PhysicalLocation entity, Long id) { - Location pgLocation = convert(entity, id); - if (pgLocation == null) { - return; - } - LocationMetadata locationMetadata = createMetadata(entity, pgLocation.getId()); - - int rowsAffected = locationMapper.updateByPrimaryKey(pgLocation); - if (rowsAffected < 1) { - return; - } - - LocationMetadataExample locationMetadataExample = new LocationMetadataExample(); - locationMetadataExample.createCriteria().andLocationIdEqualTo(id); - locationMetadata.setId(locationMetadataMapper.selectByExample(locationMetadataExample).get(0).getId()); - locationMetadataMapper.updateByPrimaryKey(locationMetadata); - } - - private void updateStructure(PhysicalLocation entity, Long id) { - Structure pgStructure = convertStructure(entity, id); - if (pgStructure == null) { - return; - } - StructureMetadata structureMetadata = createStructureMetadata(entity, pgStructure.getId()); - - int rowsAffected = structureMapper.updateByPrimaryKey(pgStructure); - if (rowsAffected < 1) { - return; - } - - StructureMetadataExample structureMetadataExample = new StructureMetadataExample(); - structureMetadataExample.createCriteria().andStructureIdEqualTo(id); - structureMetadata.setId(structureMetadataMapper.selectByExample(structureMetadataExample).get(0).getId()); - structureMetadataMapper.updateByPrimaryKey(structureMetadata); - } - - @Override - public List getAll() { - List locations = locationMetadataMapper.selectMany(new LocationMetadataExample(), 0, - DEFAULT_FETCH_SIZE); - return convert(locations); - } - - @Override - public List getAllStructures() { - List structures = structureMetadataMapper.selectMany(new StructureMetadataExample(), 0, - DEFAULT_FETCH_SIZE); - return convertStructures(structures); - } - - @Override - @Transactional - public void safeRemove(PhysicalLocation entity) { - if (entity == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { - return; - } - - if (entity.isJurisdiction()) { - LocationMetadataExample locationMetadataExample = new LocationMetadataExample(); - locationMetadataExample.createCriteria().andLocationIdEqualTo(id); - int rowsAffected = locationMetadataMapper.deleteByExample(locationMetadataExample); - if (rowsAffected < 1) { - return; - } - - locationMapper.deleteByPrimaryKey(id); - } else { - StructureMetadataExample structureMetadataExample = new StructureMetadataExample(); - structureMetadataExample.createCriteria().andStructureIdEqualTo(id); - int rowsAffected = structureMetadataMapper.deleteByExample(structureMetadataExample); - if (rowsAffected < 1) { - return; - } - - structureMapper.deleteByPrimaryKey(id); - } - - } - - @Override - public List findLocationsByServerVersion(long serverVersion) { - LocationMetadataExample locationMetadataExample = new LocationMetadataExample(); - locationMetadataExample.createCriteria().andServerVersionGreaterThanOrEqualTo(serverVersion); - locationMetadataExample.setOrderByClause(getOrderByClause(SERVER_VERSION, ASCENDING)); - List locations = locationMetadataMapper.selectMany(locationMetadataExample, 0, DEFAULT_FETCH_SIZE); - return convert(locations); - } - - @Override - public List findLocationsByNames(String locationNames, long serverVersion) { - LocationMetadataExample locationMetadataExample = new LocationMetadataExample(); - locationMetadataExample.createCriteria() - .andNameIn(Arrays.asList(org.apache.commons.lang.StringUtils.split(locationNames, ","))) - .andServerVersionGreaterThanOrEqualTo(serverVersion); - locationMetadataExample.setOrderByClause(getOrderByClause(SERVER_VERSION, ASCENDING)); - List locations = locationMetadataMapper.selectMany(locationMetadataExample, 0, DEFAULT_FETCH_SIZE); - return convert(locations); - } - - @Override - public List findStructuresByParentAndServerVersion(String parentIds, long serverVersion) { - StructureMetadataExample structureMetadataExample = new StructureMetadataExample(); - structureMetadataExample.createCriteria() - .andParentIdIn(Arrays.asList(org.apache.commons.lang.StringUtils.split(parentIds, ","))) - .andServerVersionGreaterThanOrEqualTo(serverVersion); - structureMetadataExample.setOrderByClause(getOrderByClause(SERVER_VERSION, ASCENDING)); - List locations = structureMetadataMapper.selectMany(structureMetadataExample, 0, DEFAULT_FETCH_SIZE); - return convertStructures(locations); - } - - @Override - public List findByEmptyServerVersion() { - LocationMetadataExample locationMetadataExample = new LocationMetadataExample(); - locationMetadataExample.createCriteria().andServerVersionEqualTo(0l); - locationMetadataExample.or(locationMetadataExample.createCriteria().andServerVersionIsNull()); - List locations = locationMetadataMapper.selectMany(locationMetadataExample, 0, DEFAULT_FETCH_SIZE); - return convert(locations); - } - - @Override - public List findStructuresByEmptyServerVersion() { - StructureMetadataExample structureMetadataExample = new StructureMetadataExample(); - structureMetadataExample.createCriteria().andServerVersionEqualTo(0l); - structureMetadataExample.or(structureMetadataExample.createCriteria().andServerVersionIsNull()); - List locations = structureMetadataMapper.selectMany(structureMetadataExample, 0, DEFAULT_FETCH_SIZE); - return convertStructures(locations); - } - - @Override - public Collection findStructureAndFamilyDetails(double latitude, double longitude, - double radius) { - List pgList = structureMapper.selectStructureAndFamilyWithinRadius(latitude, longitude, - radius); - Map structureDetails = new HashMap<>(); - for (StructureFamilyDetails detail : pgList) { - StructureDetails structure; - if (!structureDetails.containsKey(detail.getId())) { - structure = new StructureDetails(detail.getId(), detail.getParentId(), detail.getType()); - - structureDetails.put(detail.getId(), structure); - } else { - structure = structureDetails.get(detail.getId()); - } - if (StringUtils.isNotBlank(detail.getBaseEntityId())) { - if ("Family".equalsIgnoreCase(detail.getLastName())) - structure.setFamilyId(detail.getBaseEntityId()); - else - structure.getFamilyMembers().add(detail.getBaseEntityId()); - } - } - return structureDetails.values(); - } - - /** - * {@inheritDoc} - */ - @Override - public List findLocationsByProperties(boolean returnGeometry, String parentId, - Map properties) { - LocationMetadataExample locationMetadataExample = new LocationMetadataExample(); - if (StringUtils.isNotBlank(parentId)) { - locationMetadataExample.createCriteria().andParentIdEqualTo(parentId); - } - List locations = locationMetadataMapper.selectManyByProperties(locationMetadataExample, properties, - returnGeometry, 0, DEFAULT_FETCH_SIZE); - return convert(locations); - } - - /** - * {@inheritDoc} - */ - @Override - public List findStructuresByProperties(boolean returnGeometry, String parentId, - Map properties) { - StructureMetadataExample structureMetadataExample = new StructureMetadataExample(); - if (StringUtils.isNotBlank(parentId)) { - structureMetadataExample.createCriteria().andParentIdEqualTo(parentId); - } - List locations = structureMetadataMapper.selectManyByProperties(structureMetadataExample, properties, - returnGeometry, 0, DEFAULT_FETCH_SIZE); - return convert(locations); - } - - /** - * {@inheritDoc} - */ - @Override - public List findLocationsByIds(boolean returnGeometry, List ids) { - LocationMetadataExample locationMetadataExample = new LocationMetadataExample(); - if (ids == null || ids.isEmpty()) { - return null; - } - - locationMetadataExample.createCriteria().andGeojsonIdIn(ids); - - List locations = locationMetadataMapper.selectManyWithOptionalGeometry(locationMetadataExample, returnGeometry, 0, - DEFAULT_FETCH_SIZE); - return convert(locations); - } - - - /** - * {@inheritDoc} - */ - @Override - public List findLocationsByIdsOrParentIds(boolean returnGeometry, List ids) { - LocationMetadataExample locationMetadataExample = new LocationMetadataExample(); - if (ids == null || ids.isEmpty()) { - return null; - } - - locationMetadataExample.createCriteria().andGeojsonIdIn(ids); - - locationMetadataExample.or(locationMetadataExample.createCriteria().andParentIdIn(ids)); - List locations = locationMetadataMapper.selectManyWithOptionalGeometry(locationMetadataExample, returnGeometry, 0, - DEFAULT_FETCH_SIZE); - return convert(locations); - } - - @Override - public List findAllStructureIds() { - StructureMetadataExample structureMetadataExample = new StructureMetadataExample(); - return structureMetadataMapper.selectManyIds(structureMetadataExample); - } - - /** - * - * {@inheritDoc} - */ - @Override - public List findLocationDetailsByPlanId(String planIdentifier) { - - LocationMetadataExample locationMetadataExample = new LocationMetadataExample(); - return locationMetadataMapper.selectDetailsByPlanId(locationMetadataExample, planIdentifier); - } - - /** - * {@inheritDoc} - */ - @Override - public List findLocationByIdWithChildren(boolean returnGeometry, String id, int pageSize) { - LocationMetadataExample locationMetadataExample = new LocationMetadataExample(); - if (id == null) { - return null; - } - - int limit = Math.abs(pageSize); - limit = limit < FETCH_SIZE_LIMIT ? limit : FETCH_SIZE_LIMIT; - List locations = locationMetadataMapper.selectWithChildren(locationMetadataExample, returnGeometry, - id, 0, limit); - return convert(locations); - } - - /** - * {@inheritDoc} - */ - @Override - public List findAllLocations(boolean returnGeometry, Long serverVersion, int limit) { - LocationMetadataExample locationMetadataExample = new LocationMetadataExample(); - locationMetadataExample.createCriteria().andServerVersionGreaterThanOrEqualTo(serverVersion); - locationMetadataExample.setOrderByClause(getOrderByClause(SERVER_VERSION, ASCENDING)); - - List locations = locationMetadataMapper.selectManyWithOptionalGeometry(locationMetadataExample, returnGeometry, 0, limit); - return convert(locations); - } - - /** - * {@inheritDoc} - */ - @Override - public List findAllStructures(boolean returnGeometry, Long serverVersion, int limit) { - StructureMetadataExample structureMetadataExample = new StructureMetadataExample(); - structureMetadataExample.createCriteria().andServerVersionGreaterThanOrEqualTo(serverVersion); - structureMetadataExample.setOrderByClause(getOrderByClause(SERVER_VERSION, ASCENDING)); - - List locations = structureMetadataMapper.selectManyByProperties(structureMetadataExample, null, returnGeometry, 0, limit); - return convert(locations); - } - - @Override - protected Long retrievePrimaryKey(PhysicalLocation entity) { - Object uniqueId = getUniqueField(entity); - if (uniqueId == null) { - return null; - } - - String identifier = uniqueId.toString(); - - return retrievePrimaryKey(identifier, entity.isJurisdiction()); - } - - @Override - public Long retrievePrimaryKey(String identifier, boolean isJurisdiction) { - - if (isJurisdiction) { - Location pgEntity = locationMetadataMapper.findById(identifier, true); - if (pgEntity == null) { - return null; - } - return pgEntity.getId(); - } else { - Structure pgEntity = structureMetadataMapper.findById(identifier, true); - if (pgEntity == null) { - return null; - } - return pgEntity.getId(); - } - } - - @Override - protected Object getUniqueField(PhysicalLocation entity) { - if (entity == null) { - return null; - } - return entity.getId(); - } - - private PhysicalLocation convert(Location entity) { - if (entity == null || entity.getJson() == null || !(entity.getJson() instanceof PhysicalLocation)) { - return null; - } - - PhysicalLocation location = (PhysicalLocation) entity.getJson(); - location.setJurisdiction(true); - return location; - } - - private PhysicalLocation convert(Structure entity) { - if (entity == null || entity.getJson() == null || !(entity.getJson() instanceof PhysicalLocation)) { - return null; - } - return (PhysicalLocation) entity.getJson(); - } - - private List convert(List locations) { - if (locations == null || locations.isEmpty()) { - return new ArrayList<>(); - } - - List convertedLocations = new ArrayList<>(); - for (Location location : locations) { - PhysicalLocation convertedLocation = convert(location); - if (convertedLocation != null) { - convertedLocations.add(convertedLocation); - } - } - - return convertedLocations; - } - - private List convertStructures(List structures) { - if (structures == null || structures.isEmpty()) { - return new ArrayList<>(); - } - - List convertedStructures = new ArrayList<>(); - for (Structure structure : structures) { - PhysicalLocation convertedStructure = convert(structure); - if (convertedStructure != null) { - convertedStructures.add(convertedStructure); - } - } - - return convertedStructures; - } - - private Location convert(PhysicalLocation physicalLocation, Long primaryKey) { - if (physicalLocation == null) { - return null; - } - - Location pgLocation = new Location(); - pgLocation.setId(primaryKey); - pgLocation.setJson(physicalLocation); - - return pgLocation; - } - - private Structure convertStructure(PhysicalLocation physicalLocation, Long primaryKey) { - if (physicalLocation == null) { - return null; - } - - Structure pgStructure = new Structure(); - pgStructure.setId(primaryKey); - pgStructure.setJson(physicalLocation); - - return pgStructure; - } - - private LocationMetadata createMetadata(PhysicalLocation entity, Long id) { - LocationMetadata locationMetadata = new LocationMetadata(); - locationMetadata.setLocationId(id); - locationMetadata.setGeojsonId(entity.getId()); - if (entity.getProperties() != null) { - locationMetadata.setParentId(entity.getProperties().getParentId()); - locationMetadata.setUuid(entity.getProperties().getUid()); - locationMetadata.setType(entity.getProperties().getType()); - locationMetadata.setName(entity.getProperties().getName()); - if (entity.getProperties().getStatus() != null) { - locationMetadata.setStatus(entity.getProperties().getStatus().name()); - } - } - locationMetadata.setServerVersion(entity.getServerVersion()); - return locationMetadata; - } - - private StructureMetadata createStructureMetadata(PhysicalLocation entity, Long id) { - StructureMetadata structureMetadata = new StructureMetadata(); - structureMetadata.setStructureId(id); - structureMetadata.setGeojsonId(entity.getId()); - if (entity.getProperties() != null) { - structureMetadata.setParentId(entity.getProperties().getParentId()); - structureMetadata.setUuid(entity.getProperties().getUid()); - structureMetadata.setType(entity.getProperties().getType()); - structureMetadata.setName(entity.getProperties().getName()); - if (entity.getProperties().getStatus() != null) { - structureMetadata.setStatus(entity.getProperties().getStatus().name()); - } - } - structureMetadata.setServerVersion(entity.getServerVersion()); - return structureMetadata; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/MultimediaRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/MultimediaRepositoryImpl.java deleted file mode 100644 index b4cd17ab37..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/MultimediaRepositoryImpl.java +++ /dev/null @@ -1,187 +0,0 @@ -package org.opensrp.repository.postgres; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.opensrp.domain.Multimedia; -import org.opensrp.domain.postgres.MultiMedia; -import org.opensrp.domain.postgres.MultiMediaExample; -import org.opensrp.repository.MultimediaRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomMultiMediaMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -import static org.opensrp.service.MultimediaService.MULTI_VERSION; - -@Repository("multimediaRepositoryPostgres") -public class MultimediaRepositoryImpl extends BaseRepositoryImpl implements MultimediaRepository { - - @Autowired - private CustomMultiMediaMapper multiMediaMapper; - - @Override - public Multimedia get(String id) { - MultiMediaExample example = new MultiMediaExample(); - example.createCriteria().andDocumentIdEqualTo(id); - List files = multiMediaMapper.selectByExample(example); - return files.isEmpty() ? null : convert(files.get(0)); - } - - /** - *{@inheritDoc} - */ - @Override - public List get(String entityId, String contentType, String fileCategory) { - MultiMediaExample example = new MultiMediaExample(); - example.createCriteria().andCaseIdEqualTo(entityId).andContentTypeEqualTo(contentType).andFileCategoryEqualTo(fileCategory); - List files = multiMediaMapper.selectByExample(example); - return convert(files); - } - - @Override - public void add(Multimedia entity) { - if (entity == null || entity.getCaseId() == null) { - return; - } - - if (retrievePrimaryKey(entity) != null) { //Multimedia already added - return; - } - - if (entity.getId() == null) - entity.setId(UUID.randomUUID().toString()); - setRevision(entity); - - MultiMedia pgMultiMedia = convert(entity, null); - if (pgMultiMedia == null) { - return; - } - - multiMediaMapper.insertSelective(pgMultiMedia); - - } - - @Override - public void update(Multimedia entity) { - if (entity == null || entity.getId() == null || entity.getCaseId() == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - - if (id == null) { //Multimedia doesn't not exist - return; - } - setRevision(entity); - - MultiMedia pgEntity = convert(entity, id); - multiMediaMapper.updateByPrimaryKey(pgEntity); - - } - - @Override - public List getAll() { - return convert(multiMediaMapper.selectMany(new MultiMediaExample(), 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public void safeRemove(Multimedia entity) { - if (entity == null || entity.getCaseId() == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { - return; - } - - multiMediaMapper.deleteByPrimaryKey(id); - - } - - /** - * Returns the first Multimedia object that matches the entityId passed - * and excluding all MULTI_VERSION category files - * - * @param entityId The baseEntityId of the client who owns the multimedia file(s) - * - * @return A {@link Multimedia} object - */ - @Override - public Multimedia findByCaseId(String entityId) { - MultiMediaExample example = new MultiMediaExample(); - example.createCriteria().andCaseIdEqualTo(entityId).andFileCategoryNotEqualTo(MULTI_VERSION); - List multiMediaFiles = multiMediaMapper.selectByExample(example); - return multiMediaFiles.isEmpty() ? null : convert(multiMediaFiles.get(0)); - } - - @Override - public List all(String providerId) { - MultiMediaExample example = new MultiMediaExample(); - example.createCriteria().andProviderIdEqualTo(providerId); - List multiMediaFiles = multiMediaMapper.selectByExample(example); - return convert(multiMediaFiles); - } - - @Override - protected Long retrievePrimaryKey(Multimedia multimedia) { - if (multimedia == null || multimedia.getId() == null) { - return null; - } - String documentId = multimedia.getId(); - - MultiMediaExample example = new MultiMediaExample(); - example.createCriteria().andDocumentIdEqualTo(documentId); - List files = multiMediaMapper.selectByExample(example); - return files.isEmpty() ? null : files.get(0).getId(); - } - - @Override - protected Object getUniqueField(Multimedia multiMedia) { - return multiMedia == null ? multiMedia : multiMedia.getId(); - } - - //private Methods - private Multimedia convert(MultiMedia pgMultiMedia) { - Multimedia multimedia = new Multimedia(); - multimedia.setId(pgMultiMedia.getDocumentId()); - multimedia.setCaseId(pgMultiMedia.getCaseId()); - multimedia.setProviderId(pgMultiMedia.getProviderId()); - multimedia.setContentType(pgMultiMedia.getContentType()); - multimedia.setFilePath(pgMultiMedia.getFilePath()); - multimedia.setFileCategory(pgMultiMedia.getFileCategory()); - return multimedia; - } - - private MultiMedia convert(Multimedia entity, Long primaryKey) { - if (entity == null) { - return null; - } - MultiMedia pgMultiMedia = new MultiMedia(); - pgMultiMedia.setId(primaryKey); - pgMultiMedia.setDocumentId(entity.getId()); - pgMultiMedia.setCaseId(entity.getCaseId()); - pgMultiMedia.setProviderId(entity.getProviderId()); - pgMultiMedia.setContentType(entity.getContentType()); - pgMultiMedia.setFilePath(entity.getFilePath()); - pgMultiMedia.setFileCategory(entity.getFileCategory()); - return pgMultiMedia; - } - - private List convert(List multiMediaFiles) { - if (multiMediaFiles == null || multiMediaFiles.isEmpty()) { - return new ArrayList<>(); - } - List convertedList = new ArrayList<>(); - for (MultiMedia pgMultiMedia : multiMediaFiles) { - Multimedia multimedia = convert(pgMultiMedia); - if (multimedia != null) { - convertedList.add(multimedia); - } - } - - return convertedList; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/OrganizationRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/OrganizationRepositoryImpl.java deleted file mode 100644 index 54aafa7e56..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/OrganizationRepositoryImpl.java +++ /dev/null @@ -1,269 +0,0 @@ -package org.opensrp.repository.postgres; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; -import org.joda.time.LocalDate; -import org.opensrp.domain.AssignedLocations; -import org.opensrp.domain.CodeSystem; -import org.opensrp.domain.Organization; -import org.opensrp.domain.postgres.OrganizationExample; -import org.opensrp.domain.postgres.OrganizationLocation; -import org.opensrp.domain.postgres.OrganizationLocationExample; -import org.opensrp.repository.OrganizationRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomOrganizationLocationMapper; -import org.opensrp.repository.postgres.mapper.custom.CustomOrganizationMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -/** - * Created by Samuel Githengi on 8/30/19. - */ -@Repository -public class OrganizationRepositoryImpl extends BaseRepositoryImpl implements OrganizationRepository { - - @Autowired - private CustomOrganizationMapper organizationMapper; - - @Autowired - private CustomOrganizationLocationMapper organizationLocationMapper; - - @Override - public Organization get(String id) { - return convert(findOrganizationByIdentifier(id)); - } - - @Override - public Organization getByPrimaryKey(Long id) { - if (id == null) { - return null; - } - OrganizationExample example = new OrganizationExample(); - example.createCriteria().andIdEqualTo(id).andDateDeletedIsNull(); - List organizations = organizationMapper.selectByExample(example); - return organizations.isEmpty() ? null : convert(organizations.get(0)); - } - - @Override - public void add(Organization entity) { - if (getUniqueField(entity) == null) { - return; - } - - if (retrievePrimaryKey(entity) != null) { // Organization already added - return; - } - - org.opensrp.domain.postgres.Organization pgOrganization = convert(entity, null); - if (pgOrganization == null) { - return; - } - - organizationMapper.insertSelective(pgOrganization); - } - - @Override - public void update(Organization entity) { - if (getUniqueField(entity) == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { // Organization does not exist - return; - } - - org.opensrp.domain.postgres.Organization pgOrganization = convert(entity, id); - if (pgOrganization == null) { - return; - } - - organizationMapper.updateByPrimaryKeySelective(pgOrganization); - - } - - @Override - public List getAll() { - OrganizationExample example = new OrganizationExample(); - example.createCriteria().andDateDeletedIsNull(); - List organizations = organizationMapper.selectMany(example, 0, - DEFAULT_FETCH_SIZE); - return convert(organizations); - } - - @Override - public void safeRemove(Organization entity) { - if (getUniqueField(entity) == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { // Organization does not exist - return; - } - - org.opensrp.domain.postgres.Organization pgOrganization = convert(entity, id); - if (pgOrganization == null) { - return; - } - pgOrganization.setDateDeleted(new Date()); - - organizationMapper.updateByPrimaryKeySelective(pgOrganization); - - } - - @Override - public void assignLocationAndPlan(Long organizationId, String jurisdictionIdentifier, Long jurisdictionId, - String planIdentifier, Long planId, Date fromDate, Date toDate) { - List assignedLocations = getAssignedLocations(organizationId); - for (OrganizationLocation organizationLocation : assignedLocations) { - if (isExistingAssignment(jurisdictionId, planId, organizationLocation)) { - organizationLocation.setFromDate(fromDate); - organizationLocation.setToDate(toDate); - OrganizationLocationExample example = new OrganizationLocationExample(); - example.createCriteria().andIdEqualTo(organizationLocation.getId()); - organizationLocationMapper.updateByExample(organizationLocation, example); - return; - } - } - insertOrganizationLocation(organizationId, jurisdictionId, planId, fromDate, toDate); - - } - - private List getAssignedLocations(Long organizationId) { - OrganizationLocationExample example = new OrganizationLocationExample(); - Date currentDate = new LocalDate().toDate(); - example.createCriteria().andOrganizationIdEqualTo(organizationId).andFromDateLessThanOrEqualTo(currentDate); - return organizationLocationMapper.selectByExampleAndDateTo(example.getOredCriteria(), - example.getOrderByClause(), currentDate); - } - - private boolean isExistingAssignment(Long jurisdictionId, Long planId, OrganizationLocation organizationLocation) { - if (jurisdictionId != null && planId != null) { - return jurisdictionId.equals(organizationLocation.getLocationId()) - && planId.equals(organizationLocation.getPlanId()); - } else if (jurisdictionId == null && planId != null) { - return planId.equals(organizationLocation.getPlanId()) && organizationLocation.getLocationId() == null; - } else if (jurisdictionId != null && planId == null) { - return jurisdictionId.equals(organizationLocation.getLocationId()) - && organizationLocation.getPlanId() == null; - } else { - return false; - } - } - - private void insertOrganizationLocation(Long organizationId, Long jurisdictionId, Long planId, Date fromDate, - Date toDate) { - OrganizationLocation organizationLocation = new OrganizationLocation(); - organizationLocation.setOrganizationId(organizationId); - organizationLocation.setLocationId(jurisdictionId); - organizationLocation.setPlanId(planId); - organizationLocation.setFromDate(fromDate); - organizationLocation.setToDate(toDate); - organizationLocationMapper.insertSelective(organizationLocation); - } - - @Override - public List findAssignedLocations(Long organizationId) { - Date currentDate = new LocalDate().toDate(); - OrganizationLocationExample example = new OrganizationLocationExample(); - example.createCriteria().andOrganizationIdEqualTo(organizationId).andFromDateLessThanOrEqualTo(currentDate); - return organizationLocationMapper.findAssignedlocationsAndPlans(example.getOredCriteria(), - example.getOrderByClause(), currentDate); - } - - @Override - public List findAssignedLocations(List organizationIds) { - Date currentDate = new LocalDate().toDate(); - OrganizationLocationExample example = new OrganizationLocationExample(); - example.createCriteria().andOrganizationIdIn(organizationIds).andFromDateLessThanOrEqualTo(currentDate); - return organizationLocationMapper.findAssignedlocationsAndPlans(example.getOredCriteria(), - example.getOrderByClause(), currentDate); - } - - @Override - public List findAssignedLocationsByPlanId(Long planId) { - Date currentDate = new LocalDate().toDate(); - OrganizationLocationExample example = new OrganizationLocationExample(); - example.createCriteria().andPlanIdEqualTo(planId).andFromDateLessThanOrEqualTo(currentDate); - return organizationLocationMapper.findAssignedlocationsAndPlans(example.getOredCriteria(), - example.getOrderByClause(), currentDate); - } - - @Override - protected Long retrievePrimaryKey(Organization organization) { - String identifier = getUniqueField(organization); - if (identifier == null) { - return null; - } - - org.opensrp.domain.postgres.Organization pgEntity = findOrganizationByIdentifier(identifier); - if (pgEntity == null) { - return null; - } - return pgEntity.getId(); - } - - @Override - protected String getUniqueField(Organization organization) { - return organization.getIdentifier(); - } - - /** - * Get an Organization using an organization identifier - * - * @param identifier - * @return the organization - */ - private org.opensrp.domain.postgres.Organization findOrganizationByIdentifier(String identifier) { - if (StringUtils.isBlank(identifier)) { - return null; - } - OrganizationExample example = new OrganizationExample(); - example.createCriteria().andIdentifierEqualTo(identifier).andDateDeletedIsNull(); - List organizations = organizationMapper.selectByExample(example); - return organizations.isEmpty() ? null : organizations.get(0); - } - - private Organization convert(org.opensrp.domain.postgres.Organization pgEntity) { - if (pgEntity == null) { - return null; - } - Organization organization = new Organization(); - organization.setIdentifier(pgEntity.getIdentifier()); - organization.setActive(pgEntity.getActive()); - organization.setName(pgEntity.getName()); - organization.setId(pgEntity.getId()); - organization.setPartOf(pgEntity.getParentId()); - if (pgEntity.getType() instanceof CodeSystem) { - organization.setType((CodeSystem) pgEntity.getType()); - } - - return organization; - } - - private List convert(List pgEntities) { - List organizations = new ArrayList<>(); - for (org.opensrp.domain.postgres.Organization pgEntity : pgEntities) { - organizations.add(convert(pgEntity)); - } - return organizations; - } - - private org.opensrp.domain.postgres.Organization convert(Organization organization, Long id) { - if (organization == null) { - return null; - } - org.opensrp.domain.postgres.Organization pgOrganization = new org.opensrp.domain.postgres.Organization(); - pgOrganization.setId(id); - pgOrganization.setIdentifier(organization.getIdentifier()); - pgOrganization.setActive(organization.isActive()); - pgOrganization.setName(organization.getName()); - pgOrganization.setType(organization.getType()); - pgOrganization.setParentId(organization.getPartOf()); - return pgOrganization; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/PlanRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/PlanRepositoryImpl.java deleted file mode 100644 index a1e8230e01..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/PlanRepositoryImpl.java +++ /dev/null @@ -1,273 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.opensrp.util.Utils.isEmptyList; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.apache.commons.lang.StringUtils; -import org.opensrp.domain.PlanDefinition; -import org.opensrp.domain.postgres.Jurisdiction; -import org.opensrp.domain.postgres.Plan; -import org.opensrp.domain.postgres.PlanExample; -import org.opensrp.domain.postgres.PlanMetadata; -import org.opensrp.domain.postgres.PlanMetadataExample; -import org.opensrp.repository.PlanRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomPlanMapper; -import org.opensrp.repository.postgres.mapper.custom.CustomPlanMetadataMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -/** - * Created by Vincent Karuri on 02/05/2019 - */ - -@Repository -public class PlanRepositoryImpl extends BaseRepositoryImpl implements PlanRepository { - - @Autowired - private CustomPlanMapper planMapper; - - @Autowired - private CustomPlanMetadataMapper planMetadataMapper; - - @Override - public PlanDefinition get(String id) { - if (StringUtils.isBlank(id)) { - return null; - } - - PlanExample planExample = new PlanExample(); - planExample.createCriteria().andIdentifierEqualTo(id).andDateDeletedIsNull(); - - List pgPlan = planMapper.selectByExample(planExample); - List plan = convert(pgPlan); - - return isEmptyList(plan) ? null : plan.get(0); - } - - @Override - public void add(PlanDefinition plan) { - if (getUniqueField(plan) == null) { - return; - } - - Long id=retrievePrimaryKey(plan); - if (id != null) { - return; // plan already added - } - - Plan pgPlan = convert(plan,id); - if (pgPlan == null) { - return; - } - - int rowsAffected = planMapper.insertSelectiveAndSetId(pgPlan); - if (rowsAffected < 1) { - return; - } - insertPlanMetadata(plan,pgPlan.getId()); - } - - @Override - public void update(PlanDefinition plan) { - // todo: should we update deleted plans? - if (getUniqueField(plan) == null) { - return; - } - - Long id = retrievePrimaryKey(plan); - if (id == null) { - return; // plan does not exist - } - - Plan pgPlan = convert(plan,id); - if (pgPlan == null) { - return; - } - - int rowsAffected = planMapper.updateByPrimaryKey(pgPlan); - if (rowsAffected < 1) { - return; - } - - updatePlanMetadata(plan,pgPlan.getId()); - } - - @Override - public List getAll() { - PlanExample planExample = new PlanExample(); - planExample.createCriteria().andDateDeletedIsNull(); - List plans = planMapper.selectMany(planExample,0, DEFAULT_FETCH_SIZE); - return convert(plans); - } - - @Override - public void safeRemove(PlanDefinition plan) { - if (plan == null) { - return; - } - - Long id = retrievePrimaryKey(plan); - if (id == null) { - return; - } - - Plan pgPlan = convert(plan,id); - pgPlan.setDateDeleted(new Date()); - planMapper.updateByPrimaryKey(pgPlan); - } - - public List getPlansByServerVersionAndOperationalAreas(Long serverVersion, List operationalAreaIds) { - PlanExample planExample = new PlanExample(); - planExample.createCriteria().andServerVersionGreaterThanOrEqualTo(serverVersion).andDateDeletedIsNull(); - List plans = planMetadataMapper.selectMany(planExample, operationalAreaIds, 0, DEFAULT_FETCH_SIZE); - - return convert(plans); - } - - - /** - * {@inheritDoc} - */ - @Override - public List getPlansByIdentifiersAndServerVersion(List planIdentifiers,Long serverVersion ) { - PlanExample planExample = new PlanExample(); - planExample.createCriteria().andIdentifierIn(planIdentifiers).andServerVersionGreaterThanOrEqualTo(serverVersion); - List plans = planMapper.selectMany(planExample, 0, DEFAULT_FETCH_SIZE); - - return convert(plans); - } - - /** - * {@inheritDoc} - */ - @Override - public List getAllPlans(Long serverVersion, int limit) { - PlanExample planExample = new PlanExample(); - planExample.createCriteria().andServerVersionGreaterThanOrEqualTo(serverVersion).andDateDeletedIsNull(); - planExample.setOrderByClause(getOrderByClause(SERVER_VERSION, ASCENDING)); - - List plans = planMapper.selectMany(planExample, 0, limit); - - return convert(plans); - } - - /** - * {@inheritDoc} - */ - @Override - public List getPlansByIdsReturnOptionalFields(List ids, List fields) { - PlanExample planExample = new PlanExample(); - if (ids != null && !ids.isEmpty()) { - planExample.createCriteria().andIdentifierIn(ids); - } - List optionalFields = fields != null && fields.size() > 0 ? fields : null; - List plans = planMapper.selectManyReturnOptionalFields(planExample, optionalFields, 0, DEFAULT_FETCH_SIZE); - - return convert(plans); - } - - @Override - public Long retrievePrimaryKey(String identifier) { - if (StringUtils.isBlank(identifier)) { - return null; - } - PlanExample example = new PlanExample(); - example.createCriteria().andIdentifierEqualTo(identifier); - List pgEntity = planMapper.selectByExample(example); - - return pgEntity.isEmpty() ? null : pgEntity.get(0).getId(); - } - - @Override - protected Long retrievePrimaryKey(PlanDefinition plan) { - Object uniqueId = getUniqueField(plan); - if (uniqueId == null) { - return null; - } - - return retrievePrimaryKey(uniqueId.toString()); - } - - @Override - protected Object getUniqueField(PlanDefinition plan) { - return plan == null ? null : plan.getIdentifier(); - } - - private PlanDefinition convert(Plan pgPlan) { - if (pgPlan == null || pgPlan.getJson() == null || !(pgPlan.getJson() instanceof PlanDefinition)) { - return null; - } - return (PlanDefinition) pgPlan.getJson(); - } - - private Plan convert(PlanDefinition plan, Long id) { - if (plan == null) { - return null; - } - Plan pgPlan = new Plan(); - pgPlan.setIdentifier(plan.getIdentifier()); - pgPlan.setJson(plan); - pgPlan.setServerVersion(plan.getServerVersion()); - pgPlan.setId(id); - return pgPlan; - } - - private List convert(List pgPlans) { - List plans = new ArrayList<>(); - if (isEmptyList(pgPlans)) { - return plans; - } - for(Plan pgPlan : pgPlans) { - plans.add(convert(pgPlan)); - } - return plans; - } - - private void insertPlanMetadata(PlanDefinition plan, Long id) { - if (isEmptyList(plan.getJurisdiction())) { - return; - } - for (Jurisdiction jurisdiction : plan.getJurisdiction()) { - insert(jurisdiction, plan,id); - } - } - - private void insert(Jurisdiction jurisdiction, PlanDefinition plan, Long id) { - PlanMetadata planMetadata = new PlanMetadata(); - planMetadata.setOperationalAreaId(jurisdiction.getCode()); - planMetadata.setIdentifier(plan.getIdentifier()); - planMetadata.setPlanId(id); - planMetadataMapper.insert(planMetadata); - } - - private void updatePlanMetadata(PlanDefinition plan, Long id) { - Set operationalAreas = new HashSet<>(); - if (retrievePrimaryKey(plan) != null) { - for (Jurisdiction jurisdiction : plan.getJurisdiction()) { - PlanMetadataExample planMetadataExample = new PlanMetadataExample(); - planMetadataExample.createCriteria().andOperationalAreaIdEqualTo(jurisdiction.getCode()).andPlanIdEqualTo(id); - if (planMetadataMapper.selectByExample(planMetadataExample).size() == 0) { - insert(jurisdiction, plan,id); - } - operationalAreas.add(jurisdiction.getCode()); - } - } - - // soft delete operational areas that no longer exist in the plan - PlanMetadataExample planMetadataExample = new PlanMetadataExample(); - planMetadataExample.createCriteria().andPlanIdEqualTo(id); - List pgPlans = planMetadataMapper.selectByExample(planMetadataExample); - for (PlanMetadata metadata : pgPlans) { - if (!operationalAreas.contains(metadata.getOperationalAreaId())) { - PlanMetadataExample metadataExample = new PlanMetadataExample(); - metadataExample.createCriteria().andPlanIdEqualTo(metadata.getPlanId()).andOperationalAreaIdEqualTo(metadata.getOperationalAreaId()); - planMetadataMapper.deleteByExample(metadataExample); - } - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/PractitionerRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/PractitionerRepositoryImpl.java deleted file mode 100644 index e089c281a8..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/PractitionerRepositoryImpl.java +++ /dev/null @@ -1,244 +0,0 @@ -package org.opensrp.repository.postgres; - -import org.apache.commons.lang3.StringUtils; -import org.opensrp.domain.Practitioner; -import org.opensrp.domain.postgres.PractitionerExample; -import org.opensrp.repository.PractitionerRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomPractitionerMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import static org.opensrp.util.Utils.isEmptyList; - -@Repository -public class PractitionerRepositoryImpl extends BaseRepositoryImpl implements PractitionerRepository { - - @Autowired - private CustomPractitionerMapper practitionerMapper; - - @Override - public Practitioner get(String id) { - if (StringUtils.isBlank(id)) { - return null; - } - - Practitioner practitioner = convert(getPractitioner(id)); - return practitioner; - } - - @Override - public Practitioner getByPrimaryKey(Long id) { - if (id == null) { - return null; - } - PractitionerExample example = new PractitionerExample(); - example.createCriteria().andIdEqualTo(id).andDateDeletedIsNull(); - List practitioners = practitionerMapper.selectByExample(example); - return practitioners.isEmpty() ? null : convert(practitioners.get(0)); - } - - @Override - public List getPractitionersByOrgId(Long orgId) { - if (orgId == null) { - return new ArrayList<>(); - } - PractitionerExample practitionerExample = new PractitionerExample(); - practitionerExample.createCriteria().andDateDeletedIsNull(); - List pgPractitionerList = practitionerMapper.selectManyByOrgId(practitionerExample, - orgId,0, DEFAULT_FETCH_SIZE); - return convert(pgPractitionerList); - } - - @Override - public org.opensrp.domain.postgres.Practitioner getPractitioner(String id) { - if (StringUtils.isBlank(id)) { - return null; - } - - PractitionerExample practitionerExample = new PractitionerExample(); - practitionerExample.createCriteria().andIdentifierEqualTo(id).andDateDeletedIsNull(); - - List practitionerList = practitionerMapper.selectByExample(practitionerExample); - - return isEmptyList(practitionerList) ? null : practitionerList.get(0); - - } - - @Override - public void add(Practitioner practitioner) { - if (practitioner == null) { - return; - } - if (getUniqueField(practitioner) == null) { - return; - } - - if (retrievePrimaryKey(practitioner) != null) { - return; // practitioner already added - } - - if (getPractitionerByUserId(practitioner.getUserId()) != null) { - return; // practitioner with this user id already added - } - - org.opensrp.domain.postgres.Practitioner pgPractitioner = convert(practitioner); - - practitionerMapper.insertSelective(pgPractitioner); - - } - - @Override - public void update(Practitioner practitioner) { - if (practitioner == null) { - return; - } - if (getUniqueField(practitioner) == null) { - return; - } - - Long id = retrievePrimaryKey(practitioner); - if ( id == null) { - return; // practitioner does not exist - } - - org.opensrp.domain.postgres.Practitioner pgPractitioner = convert(practitioner); - - pgPractitioner.setId(id); - practitionerMapper.updateByPrimaryKey(pgPractitioner); - } - - @Override - public List getAll() { - PractitionerExample practitionerExample = new PractitionerExample(); - practitionerExample.createCriteria().andDateDeletedIsNull(); - List pgPractitionerList = practitionerMapper.selectMany(practitionerExample, 0, - DEFAULT_FETCH_SIZE); - return convert(pgPractitionerList); - } - - @Override - public void safeRemove(Practitioner practitioner) { - if (practitioner == null) { - return; - } - - Long id = retrievePrimaryKey(practitioner); - if (id == null) { - return; - } - - org.opensrp.domain.postgres.Practitioner pgPractitioner = convert(practitioner); - pgPractitioner.setId(id); - pgPractitioner.setDateDeleted(new Date()); - practitionerMapper.updateByPrimaryKey(pgPractitioner); - } - - @Override - public void safeRemove(String identifier) { - - org.opensrp.domain.postgres.Practitioner pgPractitioner = getPractitioner(identifier); - - if (pgPractitioner == null) { - return; - } - - pgPractitioner.setDateDeleted(new Date()); - practitionerMapper.updateByPrimaryKey(pgPractitioner); - } - - @Override - public Practitioner getPractitionerByUserId(String userId) { - if (StringUtils.isBlank(userId)) { - return null; - } - - PractitionerExample practitionerExample = new PractitionerExample(); - practitionerExample.createCriteria().andUserIdEqualTo(userId).andDateDeletedIsNull(); - - List practitionerList = practitionerMapper.selectByExample(practitionerExample); - - return isEmptyList(practitionerList) ? null : convert(practitionerList.get(0)); - - } - - - @Override - /** - * {@inheritDoc} - */ - public Practitioner getPractitionerByUsername(String username) { - if (StringUtils.isBlank(username)) { - return null; - } - - PractitionerExample practitionerExample = new PractitionerExample(); - practitionerExample.createCriteria().andUsernameEqualTo(username).andDateDeletedIsNull(); - - List practitionerList = practitionerMapper.selectByExample(practitionerExample); - - return isEmptyList(practitionerList) ? null : convert(practitionerList.get(0)); - - } - - @Override - protected Long retrievePrimaryKey(Practitioner practitioner) { - Object uniqueId = getUniqueField(practitioner); - if (uniqueId == null) { - return null; - } - - String identifier = uniqueId.toString(); - org.opensrp.domain.postgres.Practitioner pgPractitioner = getPractitioner(identifier); - - return pgPractitioner == null ? null : pgPractitioner.getId(); - } - - @Override - protected Object getUniqueField(Practitioner practitioner) { - return practitioner == null ? null : practitioner.getIdentifier(); - } - - private Practitioner convert(org.opensrp.domain.postgres.Practitioner pgPractitioner) { - if (pgPractitioner == null) { - return null; - } - Practitioner practitioner = new Practitioner(); - practitioner.setIdentifier(pgPractitioner.getIdentifier()); - practitioner.setActive(pgPractitioner.getActive()); - practitioner.setName(pgPractitioner.getName()); - practitioner.setUserId(pgPractitioner.getUserId()); - practitioner.setUsername(pgPractitioner.getUsername()); - - return practitioner; - } - - private org.opensrp.domain.postgres.Practitioner convert(Practitioner practitioner) { - if (practitioner == null) { - return null; - } - org.opensrp.domain.postgres.Practitioner pgPractitioner = new org.opensrp.domain.postgres.Practitioner(); - pgPractitioner.setIdentifier(practitioner.getIdentifier()); - pgPractitioner.setActive(practitioner.getActive()); - pgPractitioner.setName(practitioner.getName()); - pgPractitioner.setUserId(practitioner.getUserId()); - pgPractitioner.setUsername(practitioner.getUsername()); - - return pgPractitioner; - } - - private List convert(List pgPractitioners) { - List practitioners = new ArrayList<>(); - if (isEmptyList(pgPractitioners)) { - return practitioners; - } - for(org.opensrp.domain.postgres.Practitioner pgPractitioner : pgPractitioners) { - practitioners.add(convert(pgPractitioner)); - } - return practitioners; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/PractitionerRoleRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/PractitionerRoleRepositoryImpl.java deleted file mode 100644 index 25f295a980..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/PractitionerRoleRepositoryImpl.java +++ /dev/null @@ -1,268 +0,0 @@ -package org.opensrp.repository.postgres; - -import org.apache.commons.lang3.StringUtils; -import org.opensrp.domain.Organization; -import org.opensrp.domain.PractitionerRole; -import org.opensrp.domain.PractitionerRoleCode; -import org.opensrp.domain.postgres.Practitioner; -import org.opensrp.domain.postgres.PractitionerRoleExample; -import org.opensrp.repository.OrganizationRepository; -import org.opensrp.repository.PractitionerRoleRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomPractitionerRoleMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -import java.util.ArrayList; -import java.util.List; - -import static org.opensrp.util.Utils.isEmptyList; - -@Repository -public class PractitionerRoleRepositoryImpl extends BaseRepositoryImpl implements PractitionerRoleRepository { - - @Autowired - private CustomPractitionerRoleMapper practitionerRoleMapper; - - @Autowired - private PractitionerRepositoryImpl practitionerRepository; - - @Autowired - private OrganizationRepository organizationRepository; - - @Override - public PractitionerRole get(String id) { - if (StringUtils.isBlank(id)) { - return null; - } - - PractitionerRole practitionerRole = convert(getPractitionerRole(id)); - return practitionerRole; - } - - @Override - public org.opensrp.domain.postgres.PractitionerRole getPractitionerRole(String id) { - if (StringUtils.isBlank(id)) { - return null; - } - - PractitionerRoleExample practitionerRoleExample = new PractitionerRoleExample(); - practitionerRoleExample.createCriteria().andIdentifierEqualTo(id); - - List practitionerRoleList = practitionerRoleMapper.selectByExample(practitionerRoleExample); - - return isEmptyList(practitionerRoleList) ? null : practitionerRoleList.get(0); - } - - @Override - public List getPractitionerRole(Long organizationId, Long practitionerId) { - if (organizationId == null || practitionerId == null) { - return null; - } - - PractitionerRoleExample practitionerRoleExample = new PractitionerRoleExample(); - practitionerRoleExample.createCriteria().andOrganizationIdEqualTo(organizationId).andPractitionerIdEqualTo(practitionerId); - - List practitionerRoleList = practitionerRoleMapper.selectByExample(practitionerRoleExample); - - return isEmptyList(practitionerRoleList) ? null : practitionerRoleList; - } - - @Override - public void add(PractitionerRole practitionerRole) { - if (practitionerRole == null) { - return; - } - if (getUniqueField(practitionerRole) == null) { - return; - } - - if (retrievePrimaryKey(practitionerRole) != null) { - return; // practitionerRole already added - } - - org.opensrp.domain.postgres.PractitionerRole pgPractitionerRole = convert(practitionerRole); - practitionerRoleMapper.insertSelective(pgPractitionerRole); - } - - @Override - public void update(PractitionerRole practitionerRole) { - if (practitionerRole == null) { - return; - } - if (getUniqueField(practitionerRole) == null) { - return; - } - - Long id = retrievePrimaryKey(practitionerRole); - if ( id == null) { - return; // practitionerRole does not exist - } - - org.opensrp.domain.postgres.PractitionerRole pgPractitionerRole = convert(practitionerRole); - pgPractitionerRole.setId(id); - practitionerRoleMapper.updateByPrimaryKey(pgPractitionerRole); - } - - @Override - public List getAll() { - PractitionerRoleExample practitionerRoleExample = new PractitionerRoleExample(); - List pgPractitionerRoleList = practitionerRoleMapper.selectMany(practitionerRoleExample, 0, - DEFAULT_FETCH_SIZE); - return convert(pgPractitionerRoleList); - } - - @Override - public void safeRemove(PractitionerRole practitionerRole) { - if (practitionerRole == null) { - return; - } - - Long id = retrievePrimaryKey(practitionerRole); - if (id == null) { - return; - } - - - org.opensrp.domain.postgres.PractitionerRole pgPractitionerRole = convert(practitionerRole); - pgPractitionerRole.setId(id); - - practitionerRoleMapper.deleteByPrimaryKey(pgPractitionerRole.getId()); - } - - @Override - public void safeRemove(String identifier) { - - org.opensrp.domain.postgres.PractitionerRole pgPractitionerRole = getPractitionerRole(identifier); - - if (pgPractitionerRole == null) { - return; - } - - practitionerRoleMapper.deleteByPrimaryKey(pgPractitionerRole.getId()); - - } - - @Override - public void safeRemove(Long organizationId, Long practitionerId) { - - List pgPractitionerRoles = getPractitionerRole(organizationId, practitionerId); - - if (pgPractitionerRoles == null || pgPractitionerRoles.isEmpty()) { - return; - } - - for (org.opensrp.domain.postgres.PractitionerRole pgPractitionerRole: pgPractitionerRoles ) { - practitionerRoleMapper.deleteByPrimaryKey(pgPractitionerRole.getId()); - } - - } - - @Override - protected Long retrievePrimaryKey(PractitionerRole practitionerRole) { - Object uniqueId = getUniqueField(practitionerRole); - if (uniqueId == null) { - return null; - } - - String identifier = uniqueId.toString(); - org.opensrp.domain.postgres.PractitionerRole pgPractitionerRole = getPractitionerRole(identifier); - - return pgPractitionerRole == null ? null : pgPractitionerRole.getId(); - } - - @Override - protected Object getUniqueField(PractitionerRole practitionerRole) { - return practitionerRole == null ? null : practitionerRole.getIdentifier(); - } - - @Override - public List getRolesForPractitioner(String practitionerIdentifier) { - - return convert(getPgRolesForPractitioner(practitionerIdentifier)); - } - - @Override - public List getPgRolesForPractitioner(String practitionerIdentifier) { - if (StringUtils.isBlank(practitionerIdentifier)) { - return null; - } - - Practitioner practitioner = practitionerRepository.getPractitioner(practitionerIdentifier); - - if (practitioner == null || practitioner.getId() == null) { - return null; - } - - PractitionerRoleExample practitionerRoleExample = new PractitionerRoleExample(); - practitionerRoleExample.createCriteria().andPractitionerIdEqualTo(practitioner.getId()); - - List pgPractitionerRoles = practitionerRoleMapper.selectMany(practitionerRoleExample, 0, DEFAULT_FETCH_SIZE); - return pgPractitionerRoles; - } - - private PractitionerRole convert(org.opensrp.domain.postgres.PractitionerRole pgPractitionerRole) { - if (pgPractitionerRole == null) { - return null; - } - org.opensrp.domain.Practitioner pgPractitioner = practitionerRepository.getByPrimaryKey(pgPractitionerRole.getPractitionerId()); - if (pgPractitioner == null) { - return null; // practitioner already deleted - } - - Organization pgOrganinization = organizationRepository.getByPrimaryKey(pgPractitionerRole.getOrganizationId()); - if (pgOrganinization == null) { - return null; // organization already deleted - } - PractitionerRole practitionerRole = new PractitionerRole(); - practitionerRole.setIdentifier(pgPractitionerRole.getIdentifier()); - practitionerRole.setActive(pgPractitionerRole.getActive()); - practitionerRole.setOrganizationIdentifier(pgOrganinization.getIdentifier()); - practitionerRole.setPractitionerIdentifier(pgPractitioner.getIdentifier()); - PractitionerRoleCode code = new PractitionerRoleCode(); - code.setText(pgPractitionerRole.getCode()); - practitionerRole.setCode(code); - - return practitionerRole; - } - - private org.opensrp.domain.postgres.PractitionerRole convert(PractitionerRole practitionerRole) { - if (practitionerRole == null) { - return null; - } - - org.opensrp.domain.postgres.PractitionerRole pgPractitionerRole = new org.opensrp.domain.postgres.PractitionerRole(); - pgPractitionerRole.setIdentifier(practitionerRole.getIdentifier()); - pgPractitionerRole.setActive(practitionerRole.getActive()); - Long organizationId = getOrganizationId(practitionerRole.getOrganizationIdentifier()); - pgPractitionerRole.setOrganizationId(organizationId); - Long practitionerId = getPractitionerId(practitionerRole.getPractitionerIdentifier()); - pgPractitionerRole.setPractitionerId(practitionerId); - if(practitionerRole.getCode()!=null) - pgPractitionerRole.setCode(practitionerRole.getCode().getText()); - - return pgPractitionerRole; - } - - private List convert(List pgPractitionerRoles) { - List practitionerRoles = new ArrayList<>(); - if (isEmptyList(pgPractitionerRoles)) { - return practitionerRoles; - } - for(org.opensrp.domain.postgres.PractitionerRole pgPractitionerRole : pgPractitionerRoles) { - practitionerRoles.add(convert(pgPractitionerRole)); - } - return practitionerRoles; - } - - private Long getPractitionerId (String practitionerIdentifier) { - Practitioner practitioner = practitionerRepository.getPractitioner(practitionerIdentifier); - Long practitionerId = practitioner != null ? practitioner.getId() : null; - return practitionerId; - } - - private Long getOrganizationId (String organizationIdentifier) { - Organization organization = organizationRepository.get(organizationIdentifier); - Long practitionerId = organization != null ? organization.getId() : null; - return practitionerId; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/ReportsRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/ReportsRepositoryImpl.java deleted file mode 100644 index 765a784e2d..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/ReportsRepositoryImpl.java +++ /dev/null @@ -1,313 +0,0 @@ -package org.opensrp.repository.postgres; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; - -import org.apache.commons.lang3.StringUtils; -import org.joda.time.DateTime; -import org.opensrp.domain.Report; -import org.opensrp.domain.postgres.ReportMetadata; -import org.opensrp.domain.postgres.ReportMetadataExample; -import org.opensrp.domain.postgres.ReportMetadataExample.Criteria; -import org.opensrp.repository.ReportsRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomReportMapper; -import org.opensrp.repository.postgres.mapper.custom.CustomReportMetadataMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -@Repository("reportsRepositoryPostgres") -public class ReportsRepositoryImpl extends BaseRepositoryImpl implements ReportsRepository { - - @Autowired - private CustomReportMapper reportMapper; - - @Autowired - private CustomReportMetadataMapper reportMetadataMapper; - - @Override - public Report get(String id) { - if (StringUtils.isBlank(id)) { - return null; - } - org.opensrp.domain.postgres.Report pgReport = reportMetadataMapper.selectByDocumentId(id); - - return convert(pgReport); - } - - @Override - public void add(Report entity) { - if (entity == null) { - return; - } - - if (retrievePrimaryKey(entity) != null) { //Report already added - return; - } - - if (entity.getId() == null) - entity.setId(UUID.randomUUID().toString()); - setRevision(entity); - - org.opensrp.domain.postgres.Report pgReport = convert(entity, null); - if (pgReport == null) { - return; - } - - int rowsAffected = reportMapper.insertSelectiveAndSetId(pgReport); - logger.info("rowsAffected, pgReport.getId():" + rowsAffected + "," + pgReport.getId()); - if (rowsAffected < 1 || pgReport.getId() == null) { - return; - } - - ReportMetadata reportMetadata = createMetadata(entity, pgReport.getId()); - if (reportMetadata != null) { - reportMetadataMapper.insertSelective(reportMetadata); - } - - } - - @Override - public void update(Report entity) { - if (entity == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { // Report not added - return; - } - - setRevision(entity); - org.opensrp.domain.postgres.Report pgReport = convert(entity, id); - if (pgReport == null) { - return; - } - - ReportMetadata reportMetadata = createMetadata(entity, id); - if (reportMetadata == null) { - return; - } - - int rowsAffected = reportMapper.updateByPrimaryKey(pgReport); - if (rowsAffected < 1) { - return; - } - - ReportMetadataExample reportMetadataExample = new ReportMetadataExample(); - reportMetadataExample.createCriteria().andReportIdEqualTo(id); - reportMetadata.setId(reportMetadataMapper.selectByExample(reportMetadataExample).get(0).getId()); - reportMetadataMapper.updateByPrimaryKey(reportMetadata); - - } - - @Override - public List getAll() { - List reports = reportMetadataMapper.selectMany(new ReportMetadataExample(), 0, - DEFAULT_FETCH_SIZE); - return convert(reports); - } - - @Override - public void safeRemove(Report entity) { - if (entity == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { - return; - } - - ReportMetadataExample reportMetadataExample = new ReportMetadataExample(); - reportMetadataExample.createCriteria().andReportIdEqualTo(id); - int rowsAffected = reportMetadataMapper.deleteByExample(reportMetadataExample); - if (rowsAffected < 1) { - return; - } - - reportMapper.deleteByPrimaryKey(id); - - } - - @Override - public Report findById(String id) { - return get(id); - } - - @Override - public List findByBaseEntityId(String baseEntityId) { - ReportMetadataExample reportMetadataExample = new ReportMetadataExample(); - reportMetadataExample.createCriteria().andBaseEntityIdEqualTo(baseEntityId); - return convert(reportMetadataMapper.selectMany(reportMetadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findAllByIdentifier(String identifier) { - return convert(reportMapper.selectByIdentifier(identifier, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findByBaseEntityAndType(String baseEntityId, String reportType) { - ReportMetadataExample reportMetadataExample = new ReportMetadataExample(); - reportMetadataExample.createCriteria().andBaseEntityIdEqualTo(baseEntityId).andReportTypeEqualTo(reportType); - return convert(reportMetadataMapper.selectMany(reportMetadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findByEmptyServerVersion() { - ReportMetadataExample reportMetadataExample = new ReportMetadataExample(); - reportMetadataExample.createCriteria().andServerVersionIsNull(); - reportMetadataExample.or(reportMetadataExample.createCriteria().andServerVersionEqualTo(0l)); - return convert(reportMetadataMapper.selectMany(reportMetadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findByServerVersion(long serverVersion) { - ReportMetadataExample reportMetadataExample = new ReportMetadataExample(); - reportMetadataExample.createCriteria().andServerVersionGreaterThanOrEqualTo(serverVersion + 1); - return convert(reportMetadataMapper.selectMany(reportMetadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findByBaseEntityAndFormSubmissionId(String baseEntityId, String formSubmissionId) { - ReportMetadataExample reportMetadataExample = new ReportMetadataExample(); - reportMetadataExample.createCriteria().andBaseEntityIdEqualTo(baseEntityId) - .andFormSubmissionIdEqualTo(formSubmissionId); - return convert(reportMetadataMapper.selectMany(reportMetadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findReports(String team, String providerId, String locationId, String baseEntityId, - Long serverVersion, String sortBy, String sortOrder, int limit) { - ReportMetadataExample reportMetadataExample = new ReportMetadataExample(); - Criteria criteria = reportMetadataExample.createCriteria(); - if (team != null && !team.isEmpty()) { - String[] idsArray = org.apache.commons.lang.StringUtils.split(team, ","); - List ids = new ArrayList(Arrays.asList(idsArray)); - if (providerId != null && !ids.contains(providerId)) { - ids.add(providerId); - } - criteria.andProviderIdIn(ids); - } else if ((providerId != null && StringUtils.isNotEmpty(providerId))) { - criteria.andProviderIdEqualTo(providerId); - } - if (StringUtils.isNotBlank(locationId)) - criteria.andLocationIdEqualTo(locationId); - if (StringUtils.isNotBlank(baseEntityId)) - criteria.andBaseEntityIdEqualTo(baseEntityId); - if (serverVersion != null) - criteria.andServerVersionGreaterThanOrEqualTo(serverVersion); - reportMetadataExample.setOrderByClause(getOrderByClause(sortBy, sortOrder)); - if (!criteria.isValid()) { - throw new IllegalArgumentException("Atleast one search filter must be specified"); - } else - return convert(reportMetadataMapper.selectMany(reportMetadataExample, 0, limit)); - } - - @Override - public List findReports(String baseEntityId, DateTime from, DateTime to, String reportType, String providerId, - String locationId, DateTime lastEditFrom, DateTime lastEditTo) { - ReportMetadataExample reportMetadataExample = new ReportMetadataExample(); - Criteria criteria = reportMetadataExample.createCriteria(); - if (StringUtils.isNotBlank(baseEntityId)) - criteria.andBaseEntityIdEqualTo(baseEntityId); - if (StringUtils.isNotBlank(locationId)) - criteria.andReportTypeEqualTo(reportType); - if (StringUtils.isNotBlank(providerId)) - criteria.andProviderIdEqualTo(providerId); - if (StringUtils.isNotBlank(locationId)) - criteria.andLocationIdEqualTo(locationId); - if (from != null || to != null) - criteria.andReportDateBetween(from.toDate(), to.toDate()); - if (lastEditFrom != null || lastEditTo != null) - criteria.andDateEditedBetween(lastEditFrom.toDate(), lastEditTo.toDate()); - if (!criteria.isValid()) - throw new IllegalArgumentException("Atleast one search filter must be specified"); - else - return convert(reportMetadataMapper.selectMany(reportMetadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findReportsByDynamicQuery(String query) { - throw new IllegalArgumentException("Method not supported"); - } - - @Override - protected Long retrievePrimaryKey(Report entity) { - if (entity == null || entity.getId() == null) { - return null; - } - String documentId = entity.getId(); - - ReportMetadataExample reportMetadataExample = new ReportMetadataExample(); - reportMetadataExample.createCriteria().andDocumentIdEqualTo(documentId); - - org.opensrp.domain.postgres.Report pgReport = reportMetadataMapper.selectByDocumentId(documentId); - if (pgReport == null) { - return null; - } - return pgReport.getId(); - } - - @Override - protected Object getUniqueField(Report report) { - return report == null ? null : report.getId(); - } - - //private Methods - private Report convert(org.opensrp.domain.postgres.Report pgReport) { - if (pgReport == null || pgReport.getJson() == null || !(pgReport.getJson() instanceof Report)) { - return null; - } - return (Report) pgReport.getJson(); - } - - private org.opensrp.domain.postgres.Report convert(Report entity, Long primaryKey) { - if (entity == null) { - return null; - } - - org.opensrp.domain.postgres.Report pgReport = new org.opensrp.domain.postgres.Report(); - pgReport.setId(primaryKey); - pgReport.setJson(entity); - - return pgReport; - } - - private List convert(List reports) { - if (reports == null || reports.isEmpty()) { - return new ArrayList<>(); - } - - List convertedReports = new ArrayList<>(); - for (org.opensrp.domain.postgres.Report event : reports) { - Report convertedReport = convert(event); - if (convertedReport != null) { - convertedReports.add(convertedReport); - } - } - return convertedReports; - } - - private ReportMetadata createMetadata(Report entity, Long id) { - ReportMetadata reportMetadata = new ReportMetadata(); - reportMetadata.setReportId(id); - reportMetadata.setDocumentId(entity.getId()); - reportMetadata.setBaseEntityId(entity.getBaseEntityId()); - reportMetadata.setFormSubmissionId(entity.getFormSubmissionId()); - reportMetadata.setReportType(entity.getReportType()); - if (entity.getReportDate() != null) { - reportMetadata.setReportDate(entity.getReportDate().toDate()); - } - reportMetadata.setServerVersion(entity.getServerVersion()); - reportMetadata.setProviderId(entity.getProviderId()); - reportMetadata.setLocationId(entity.getLocationId()); - if (entity.getDateEdited() != null) { - reportMetadata.setDateEdited(entity.getDateEdited().toDate()); - } - return reportMetadata; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/SearchRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/SearchRepositoryImpl.java deleted file mode 100644 index 718d9e7c9e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/SearchRepositoryImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.opensrp.repository.postgres; - -import java.util.List; - -import org.opensrp.domain.Client; -import org.opensrp.repository.SearchRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomClientMetadataMapper; -import org.opensrp.search.AddressSearchBean; -import org.opensrp.search.ClientSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -@Repository("searchRepositoryPostgres") -public class SearchRepositoryImpl implements SearchRepository { - - @Autowired - private CustomClientMetadataMapper clientMetadataMapper; - - @Autowired - private ClientsRepositoryImpl clientsRepository; - - @Override - public List findByCriteria(ClientSearchBean clientSearchBean, String firstName, String middleName, - String lastName, Integer limit) { - clientSearchBean.setFirstName(firstName); - clientSearchBean.setMiddleName(middleName); - clientSearchBean.setLastName(lastName); - List clients = clientMetadataMapper.selectBySearchBean(clientSearchBean, - new AddressSearchBean(), 0, limit == null ? BaseRepositoryImpl.DEFAULT_FETCH_SIZE : limit); - return clientsRepository.convert(clients); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/SettingRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/SettingRepositoryImpl.java deleted file mode 100644 index 297923936b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/SettingRepositoryImpl.java +++ /dev/null @@ -1,287 +0,0 @@ - -package org.opensrp.repository.postgres; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.apache.commons.lang3.StringUtils; -import org.opensrp.domain.postgres.Settings; -import org.opensrp.domain.postgres.SettingsMetadata; -import org.opensrp.domain.postgres.SettingsMetadataExample; -import org.opensrp.domain.setting.SettingConfiguration; -import org.opensrp.repository.SettingRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomSettingMapper; -import org.opensrp.repository.postgres.mapper.custom.CustomSettingMetadataMapper; -import org.opensrp.search.SettingSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -@Repository("settingRepositoryPostgres") -public class SettingRepositoryImpl extends BaseRepositoryImpl implements SettingRepository { - - @Autowired - private CustomSettingMapper settingMapper; - - @Autowired - private CustomSettingMetadataMapper settingMetadataMapper; - - @Override - public SettingConfiguration get(String id) { - - if (StringUtils.isBlank(id)) { - return null; - } - Settings setting = settingMetadataMapper.selectByDocumentId(id); - - return convert(setting); - } - - @Override - public void update(SettingConfiguration entity) { - if (entity == null || entity.getId() == null || entity.getIdentifier() == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - - if (id == null) { // Setting not exists - return; - } - - setRevision(entity); - - Settings pgSetting = convert(entity, id); - - if (pgSetting == null) { - return; - } - - SettingsMetadata metadata = createMetadata(entity, id); - if (metadata == null) { - return; - } - - int rowsAffected = settingMapper.updateByPrimaryKey(pgSetting); - if (rowsAffected < 1) { - return; - } - - SettingsMetadataExample metadataExample = new SettingsMetadataExample(); - metadataExample.createCriteria().andSettingsIdEqualTo(id); - metadata.setId(settingMetadataMapper.selectByExample(metadataExample).get(0).getId()); - settingMetadataMapper.updateByPrimaryKey(metadata); - - } - - @Override - public List getAll() { - return convert(settingMetadataMapper.selectMany(new SettingsMetadataExample(), 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public void safeRemove(SettingConfiguration entity) { - if (entity == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { - return; - } - - SettingsMetadataExample metadataExample = new SettingsMetadataExample(); - metadataExample.createCriteria().andSettingsIdEqualTo(id); - int rowsAffected = settingMetadataMapper.deleteByExample(metadataExample); - if (rowsAffected < 1) { - return; - } - - settingMapper.deleteByPrimaryKey(id); - - } - - @Override - public List findAllSettings() { - return getAll(); - } - - @Override - public List findSettings(SettingSearchBean settingQueryBean) { - - SettingsMetadataExample metadataExample = new SettingsMetadataExample(); - SettingsMetadataExample.Criteria criteria = metadataExample.createCriteria(); - - if (StringUtils.isNotEmpty(settingQueryBean.getProviderId())) { - criteria.andProviderIdEqualTo(settingQueryBean.getProviderId()); - } - if (StringUtils.isNotEmpty(settingQueryBean.getLocationId())) { - criteria.andLocationIdEqualTo(settingQueryBean.getLocationId()); - } - if (StringUtils.isNotEmpty(settingQueryBean.getTeam())) { - criteria.andTeamEqualTo(settingQueryBean.getTeam()); - } - if (StringUtils.isNotEmpty(settingQueryBean.getTeamId())) { - criteria.andTeamIdEqualTo(settingQueryBean.getTeamId()); - } - if (settingQueryBean.getServerVersion() != null) { - criteria.andServerVersionGreaterThanOrEqualTo(settingQueryBean.getServerVersion()); - } - - metadataExample.or(metadataExample.createCriteria().andTeamIdIsNull().andTeamIsNull().andProviderIdIsNull() - .andLocationIdIsNull().andServerVersionGreaterThanOrEqualTo(settingQueryBean.getServerVersion())); - - if (!criteria.isValid()) { - throw new IllegalArgumentException("Atleast one search filter must be specified"); - } - - return convert(settingMetadataMapper.selectMany(metadataExample, 0, DEFAULT_FETCH_SIZE)); - - } - - @Override - public List findByEmptyServerVersion() { - SettingsMetadataExample metadataExample = new SettingsMetadataExample(); - metadataExample.createCriteria().andServerVersionIsNull(); - metadataExample.or(metadataExample.createCriteria().andServerVersionEqualTo(0l)); - return convert(settingMetadataMapper.selectMany(metadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - protected Long retrievePrimaryKey(SettingConfiguration settingConfiguration) { - Object uniqueId = getUniqueField(settingConfiguration); - if (uniqueId == null) { - return null; - } - - String documentId = uniqueId.toString(); - - SettingsMetadataExample metadataExample = new SettingsMetadataExample(); - metadataExample.createCriteria().andDocumentIdEqualTo(documentId); - - Settings pgSetting = settingMetadataMapper.selectByDocumentId(documentId); - - if (pgSetting == null) { - return null; - } - return pgSetting.getId(); - } - - @Override - protected Object getUniqueField(SettingConfiguration settingConfiguration) { - if (settingConfiguration == null) { - return null; - } - return settingConfiguration.getId(); - } - - private Settings convert(SettingConfiguration entity, Long id) { - if (entity == null) { - return null; - } - - Settings pgSetting = new Settings(); - pgSetting.setId(id); - pgSetting.setJson(entity); - - return pgSetting; - } - - private List convert(List settings) { - if (settings == null || settings.isEmpty()) { - return new ArrayList<>(); - } - - List settingValues = new ArrayList<>(); - for (Settings setting : settings) { - SettingConfiguration convertedSetting = convert(setting); - if (convertedSetting != null) { - settingValues.add(convertedSetting); - } - } - return settingValues; - } - - private SettingConfiguration convert(Settings setting) { - if (setting == null || setting.getJson() == null) { - return null; - } - return (SettingConfiguration) setting.getJson(); - } - - private SettingsMetadata createMetadata(SettingConfiguration entity, Long id) { - - try { - - SettingsMetadata metadata = new SettingsMetadata(); - metadata.setSettingsId(id); - metadata.setDocumentId(entity.getId() != null ? entity.getId() : UUID.randomUUID().toString()); - metadata.setIdentifier(entity.getIdentifier()); - metadata.setProviderId(entity.getProviderId()); - metadata.setLocationId(entity.getLocationId()); - metadata.setTeam(entity.getTeam()); - metadata.setTeamId(entity.getTeamId()); - metadata.setServerVersion(entity.getServerVersion()); - - return metadata; - } - catch (Exception e) { - logger.error(e.getMessage(), e); - return null; - } - } - - @Override - public void add(SettingConfiguration entity) { - - if (entity == null || entity.getSettings() == null || entity.getIdentifier() == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - - if (id != null) { // Setting already exists - return; - } - - if (entity.getId() == null) { - entity.setId(UUID.randomUUID().toString()); - } - - setRevision(entity); - - Settings settings = convert(entity, id); - if (settings == null) { - return; - } - - int rowsAffected = settingMapper.insertSelectiveAndSetId(settings); - if (rowsAffected < 1 || settings.getId() == null) { - return; - } - - SettingsMetadata settingsMetadata = createMetadata(entity, settings.getId()); - if (settingsMetadata != null) { - settingMetadataMapper.insertSelective(settingsMetadata); - } - - } - - @Override - public SettingsMetadata getSettingMetadataByDocumentId(String documentId) { - SettingsMetadataExample example = new SettingsMetadataExample(); - example.createCriteria().andDocumentIdEqualTo(documentId); - - List settingsMetadata = settingMetadataMapper.selectByExample(example); - - return !settingsMetadata.isEmpty() ? settingsMetadata.get(0) : null; - - } - - @Override - public Settings getSettingById(Long id) { - - return settingMapper.selectByPrimaryKey(id); - - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/StocksRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/StocksRepositoryImpl.java deleted file mode 100644 index 1177ccd474..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/StocksRepositoryImpl.java +++ /dev/null @@ -1,241 +0,0 @@ -package org.opensrp.repository.postgres; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.apache.commons.lang3.StringUtils; -import org.opensrp.domain.Stock; -import org.opensrp.domain.postgres.StockMetadata; -import org.opensrp.domain.postgres.StockMetadataExample; -import org.opensrp.repository.StocksRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomStockMapper; -import org.opensrp.repository.postgres.mapper.custom.CustomStockMetadataMapper; -import org.opensrp.search.StockSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -@Repository("stocksRepositoryPostgres") -public class StocksRepositoryImpl extends BaseRepositoryImpl implements StocksRepository { - - @Autowired - private CustomStockMapper stockMapper; - - @Autowired - private CustomStockMetadataMapper stockMetadataMapper; - - @Override - public Stock get(String id) { - if (StringUtils.isBlank(id)) { - return null; - } - org.opensrp.domain.postgres.Stock pgStock = stockMetadataMapper.selectByDocumentId(id); - - return convert(pgStock); - } - - @Override - public void add(Stock entity) { - if (entity == null) { - return; - } - - if (retrievePrimaryKey(entity) != null) { //Stock already added - return; - } - - if (entity.getId() == null) - entity.setId(UUID.randomUUID().toString()); - setRevision(entity); - - org.opensrp.domain.postgres.Stock pgStock = convert(entity, null); - if (pgStock == null) { - return; - } - - int rowsAffected = stockMapper.insertSelectiveAndSetId(pgStock); - - if (rowsAffected < 1 || pgStock.getId() == null) { - return; - } - - StockMetadata stockMetadata = createMetadata(entity, pgStock.getId()); - if (stockMetadata != null) { - stockMetadataMapper.insertSelective(stockMetadata); - } - - } - - @Override - public void update(Stock entity) { - if (entity == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { // Stock not added - return; - } - - setRevision(entity); - org.opensrp.domain.postgres.Stock pgStock = convert(entity, id); - if (pgStock == null) { - return; - } - - StockMetadata stockMetadata = createMetadata(entity, id); - if (stockMetadata == null) { - return; - } - - int rowsAffected = stockMapper.updateByPrimaryKey(pgStock); - if (rowsAffected < 1) { - return; - } - - StockMetadataExample stockMetadataExample = new StockMetadataExample(); - stockMetadataExample.createCriteria().andStockIdEqualTo(id); - stockMetadata.setId(stockMetadataMapper.selectByExample(stockMetadataExample).get(0).getId()); - stockMetadataMapper.updateByPrimaryKey(stockMetadata); - - } - - @Override - public List getAll() { - List stocks = stockMetadataMapper.selectMany(new StockMetadataExample(), 0, - DEFAULT_FETCH_SIZE); - return convert(stocks); - } - - @Override - public void safeRemove(Stock entity) { - if (entity == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { - return; - } - - StockMetadataExample stockMetadataExample = new StockMetadataExample(); - stockMetadataExample.createCriteria().andStockIdEqualTo(id); - int rowsAffected = stockMetadataMapper.deleteByExample(stockMetadataExample); - if (rowsAffected < 1) { - return; - } - - stockMapper.deleteByPrimaryKey(id); - - } - - @Override - public List findAllByProviderid(String providerid) { - StockMetadataExample stockMetadataExample = new StockMetadataExample(); - stockMetadataExample.createCriteria().andProviderIdEqualTo(providerid); - return convert(stockMetadataMapper.selectMany(stockMetadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - /** - * implements the method equivalent in couch repository that return stocks matching stock type - * id - * - * @param stockType the stock type - * @param stockTypeId the stock type id - * @return list of stock of a particluar stock type id - */ - @Override - public List findAllByIdentifier(String stockType, String stockTypeId) { - return convert(stockMetadataMapper.selectByIdentifier(stockTypeId, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public Stock findById(String id) { - return get(id); - } - - @Override - public List findStocks(StockSearchBean searchBean, String sortBy, String sortOrder, int limit) { - String orderByClause = getOrderByClause(sortBy, sortOrder); - return convert(stockMetadataMapper.selectManyBySearchBean(searchBean, orderByClause, 0, limit)); - - } - - @Override - public List findStocks(StockSearchBean searchBean) { - return findStocks(searchBean, null, null, DEFAULT_FETCH_SIZE); - } - - @Override - public List findAllStocks() { - return getAll(); - } - - @Override - protected Long retrievePrimaryKey(Stock entity) { - if (entity == null || entity.getId() == null) { - return null; - } - String documentId = entity.getId(); - - StockMetadataExample stockMetadataExample = new StockMetadataExample(); - stockMetadataExample.createCriteria().andDocumentIdEqualTo(documentId); - - org.opensrp.domain.postgres.Stock pgStock = stockMetadataMapper.selectByDocumentId(documentId); - if (pgStock == null) { - return null; - } - return pgStock.getId(); - } - - @Override - protected Object getUniqueField(Stock entity) { - return entity == null ? null : entity.getId(); - } - - //private methods - private Stock convert(org.opensrp.domain.postgres.Stock pgStock) { - if (pgStock == null || pgStock.getJson() == null || !(pgStock.getJson() instanceof Stock)) { - return null; - } - return (Stock) pgStock.getJson(); - } - - private org.opensrp.domain.postgres.Stock convert(Stock entity, Long id) { - if (entity == null) { - return null; - } - - org.opensrp.domain.postgres.Stock pgReport = new org.opensrp.domain.postgres.Stock(); - pgReport.setId(id); - pgReport.setJson(entity); - - return pgReport; - } - - private List convert(List stocks) { - if (stocks == null || stocks.isEmpty()) { - return new ArrayList<>(); - } - - List convertedStocks = new ArrayList<>(); - for (org.opensrp.domain.postgres.Stock stock : stocks) { - Stock convertedStock = convert(stock); - if (convertedStock != null) { - convertedStocks.add(convertedStock); - } - } - return convertedStocks; - } - - private StockMetadata createMetadata(Stock entity, Long id) { - StockMetadata metadata = new StockMetadata(); - metadata.setStockId(id); - metadata.setDocumentId(entity.getId()); - metadata.setProviderId(entity.getProviderid()); - //metadata.setLocationId(entity.get); - metadata.setServerVersion(entity.getServerVersion()); - return metadata; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/TaskRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/TaskRepositoryImpl.java deleted file mode 100644 index 248f92617c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/TaskRepositoryImpl.java +++ /dev/null @@ -1,239 +0,0 @@ -package org.opensrp.repository.postgres; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; -import org.opensrp.domain.Task; -import org.opensrp.domain.postgres.TaskMetadata; -import org.opensrp.domain.postgres.TaskMetadataExample; -import org.opensrp.repository.TaskRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomTaskMapper; -import org.opensrp.repository.postgres.mapper.custom.CustomTaskMetadataMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Repository -public class TaskRepositoryImpl extends BaseRepositoryImpl implements TaskRepository { - - @Autowired - private CustomTaskMapper taskMapper; - - @Autowired - private CustomTaskMetadataMapper taskMetadataMapper; - - @Override - public Task get(String id) { - if (StringUtils.isBlank(id)) { - return null; - } - - org.opensrp.domain.postgres.Task pgTask = taskMetadataMapper.selectByIdentifier(id); - if (pgTask == null) { - return null; - } - return convert(pgTask); - } - - @Override - @Transactional - public void add(Task entity) { - if (getUniqueField(entity) == null) { - return; - } - - if (retrievePrimaryKey(entity) != null) { // Task already added - return; - } - - org.opensrp.domain.postgres.Task pgTask = convert(entity, null); - if (pgTask == null) { - return; - } - - int rowsAffected = taskMapper.insertSelectiveAndSetId(pgTask); - if (rowsAffected < 1 || pgTask.getId() == null) { - return; - } - - TaskMetadata taskMetadata = createMetadata(entity, pgTask.getId()); - - taskMetadataMapper.insertSelective(taskMetadata); - - } - - @Override - @Transactional - public void update(Task entity) { - if (getUniqueField(entity) == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { // Task does not exist - return; - } - - org.opensrp.domain.postgres.Task pgTask = convert(entity, id); - if (pgTask == null) { - return; - } - TaskMetadata taskMetadata = createMetadata(entity, pgTask.getId()); - - int rowsAffected = taskMapper.updateByPrimaryKey(pgTask); - if (rowsAffected < 1) { - return; - } - - TaskMetadataExample taskMetadataExample = new TaskMetadataExample(); - taskMetadataExample.createCriteria().andTaskIdEqualTo(id); - taskMetadata.setId(taskMetadataMapper.selectByExample(taskMetadataExample).get(0).getId()); - taskMetadataMapper.updateByPrimaryKey(taskMetadata); - - } - - @Override - public List getAll() { - List tasks = taskMetadataMapper.selectMany(new TaskMetadataExample(), 0, - DEFAULT_FETCH_SIZE); - return convert(tasks); - } - - @Override - public List getTasksByPlanAndGroup(String plan, String group, long serverVersion) { - List campaigns = Arrays.asList(org.apache.commons.lang.StringUtils.split(plan, ",")); - List groups = Arrays.asList(org.apache.commons.lang.StringUtils.split(group, ",")); - TaskMetadataExample taskMetadataExample = new TaskMetadataExample(); - taskMetadataExample.createCriteria().andPlanIdentifierIn(campaigns).andGroupIdentifierIn(groups) - .andServerVersionGreaterThanOrEqualTo(serverVersion); - taskMetadataExample.setOrderByClause(getOrderByClause(SERVER_VERSION, ASCENDING)); - List tasks = taskMetadataMapper.selectMany(taskMetadataExample, 0, - DEFAULT_FETCH_SIZE); - return convert(tasks); - } - - @Override - public List findByEmptyServerVersion() { - TaskMetadataExample taskMetadataExample = new TaskMetadataExample(); - taskMetadataExample.createCriteria().andServerVersionIsNull(); - taskMetadataExample.or(taskMetadataExample.createCriteria().andServerVersionEqualTo(0l)); - List tasks = taskMetadataMapper.selectMany(taskMetadataExample, 0, - DEFAULT_FETCH_SIZE); - return convert(tasks); - } - - @Override - public List findAllIds() { - TaskMetadataExample taskMetadataExample = new TaskMetadataExample(); - return taskMetadataMapper.selectManyIds(taskMetadataExample); - } - - /** - * {@inheritDoc} - */ - @Override - public List getAllTasks(Long serverVersion, int limit) { - TaskMetadataExample taskMetadataExample = new TaskMetadataExample(); - taskMetadataExample.createCriteria().andServerVersionGreaterThanOrEqualTo(serverVersion); - taskMetadataExample.setOrderByClause(getOrderByClause(SERVER_VERSION, ASCENDING)); - - List tasks = taskMetadataMapper.selectMany(taskMetadataExample, 0, - limit); - return convert(tasks); - } - - @Override - @Transactional - public void safeRemove(Task entity) { - if (entity == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { - return; - } - - TaskMetadataExample taskMetadataExample = new TaskMetadataExample(); - taskMetadataExample.createCriteria().andTaskIdEqualTo(id); - int rowsAffected = taskMetadataMapper.deleteByExample(taskMetadataExample); - if (rowsAffected < 1) { - return; - } - - taskMapper.deleteByPrimaryKey(id); - - } - - @Override - protected Long retrievePrimaryKey(Task task) { - Object uniqueId = getUniqueField(task); - if (uniqueId == null) { - return null; - } - - String identifier = uniqueId.toString(); - - org.opensrp.domain.postgres.Task pgTask = taskMetadataMapper.selectByIdentifier(identifier); - if (pgTask == null) { - return null; - } - return pgTask.getId(); - } - - @Override - protected Object getUniqueField(Task task) { - if (task == null) { - return null; - } - return task.getIdentifier(); - } - - private Task convert(org.opensrp.domain.postgres.Task pgTask) { - if (pgTask == null || pgTask.getJson() == null || !(pgTask.getJson() instanceof Task)) { - return null; - } - return (Task) pgTask.getJson(); - } - - private org.opensrp.domain.postgres.Task convert(Task task, Long primaryKey) { - if (task == null) { - return null; - } - - org.opensrp.domain.postgres.Task pgTask = new org.opensrp.domain.postgres.Task(); - pgTask.setId(primaryKey); - pgTask.setJson(task); - - return pgTask; - } - - private List convert(List tasks) { - if (tasks == null || tasks.isEmpty()) { - return new ArrayList<>(); - } - - List convertedTasks = new ArrayList<>(); - for (org.opensrp.domain.postgres.Task task : tasks) { - Task convertedTask = convert(task); - if (convertedTask != null) { - convertedTasks.add(convertedTask); - } - } - - return convertedTasks; - } - - private TaskMetadata createMetadata(Task entity, Long id) { - TaskMetadata taskMetadata = new TaskMetadata(); - taskMetadata.setTaskId(id); - taskMetadata.setIdentifier(entity.getIdentifier()); - taskMetadata.setPlanIdentifier(entity.getPlanIdentifier()); - taskMetadata.setGroupIdentifier(entity.getGroupIdentifier()); - taskMetadata.setForEntity(entity.getForEntity()); - taskMetadata.setServerVersion(entity.getServerVersion()); - return taskMetadata; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/ViewConfigurationRepositoryImpl.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/ViewConfigurationRepositoryImpl.java deleted file mode 100644 index bc1fa166a2..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/ViewConfigurationRepositoryImpl.java +++ /dev/null @@ -1,213 +0,0 @@ -package org.opensrp.repository.postgres; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.opensrp.domain.postgres.ViewConfigurationMetadata; -import org.opensrp.domain.postgres.ViewConfigurationMetadataExample; -import org.opensrp.domain.viewconfiguration.ViewConfiguration; -import org.opensrp.repository.ViewConfigurationRepository; -import org.opensrp.repository.postgres.mapper.custom.CustomViewConfigurationMapper; -import org.opensrp.repository.postgres.mapper.custom.CustomViewConfigurationMetadataMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -@Repository("viewConfigurationRepositoryPostgres") -public class ViewConfigurationRepositoryImpl extends BaseRepositoryImpl implements ViewConfigurationRepository { - - @Autowired - private CustomViewConfigurationMapper viewConfigurationMapper; - - @Autowired - private CustomViewConfigurationMetadataMapper viewConfigurationMetadataMapper; - - @Override - public ViewConfiguration get(String id) { - return convert(viewConfigurationMetadataMapper.selectByDocumentId(id)); - } - - @Override - public void add(ViewConfiguration entity) { - if (entity == null || entity.getIdentifier() == null) { - return; - } - - if (retrievePrimaryKey(entity) != null) { //ViewConfiguration already added - return; - } - - if (entity.getId() == null) - entity.setId(UUID.randomUUID().toString()); - setRevision(entity); - - org.opensrp.domain.postgres.ViewConfiguration pgViewConfiguration = convert(entity, null); - if (pgViewConfiguration == null) { - return; - } - - int rowsAffected = viewConfigurationMapper.insertSelectiveAndSetId(pgViewConfiguration); - if (rowsAffected < 1 || pgViewConfiguration.getId() == null) { - return; - } - - ViewConfigurationMetadata metadata = createMetadata(entity, pgViewConfiguration.getId()); - if (metadata != null) { - viewConfigurationMetadataMapper.insertSelective(metadata); - } - } - - @Override - public void update(ViewConfiguration entity) { - if (entity == null || entity.getId() == null || entity.getIdentifier() == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - - if (id == null) { //ViewConfiguration not exists - return; - } - - setRevision(entity); - - org.opensrp.domain.postgres.ViewConfiguration pgViewConfiguration = convert(entity, id); - - if (pgViewConfiguration == null) { - return; - } - - ViewConfigurationMetadata metadata = createMetadata(entity, id); - if (metadata == null) { - return; - } - - int rowsAffected = viewConfigurationMapper.updateByPrimaryKey(pgViewConfiguration); - if (rowsAffected < 1) { - return; - } - - ViewConfigurationMetadataExample metadataExample = new ViewConfigurationMetadataExample(); - metadataExample.createCriteria().andViewConfigurationIdEqualTo(id); - metadata.setId(viewConfigurationMetadataMapper.selectByExample(metadataExample).get(0).getId()); - viewConfigurationMetadataMapper.updateByPrimaryKey(metadata); - - } - - @Override - public List getAll() { - return convert( - viewConfigurationMetadataMapper.selectMany(new ViewConfigurationMetadataExample(), 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public void safeRemove(ViewConfiguration entity) { - if (entity == null) { - return; - } - - Long id = retrievePrimaryKey(entity); - if (id == null) { - return; - } - - ViewConfigurationMetadataExample metadataExample = new ViewConfigurationMetadataExample(); - metadataExample.createCriteria().andViewConfigurationIdEqualTo(id); - int rowsAffected = viewConfigurationMetadataMapper.deleteByExample(metadataExample); - if (rowsAffected < 1) { - return; - } - - viewConfigurationMapper.deleteByPrimaryKey(id); - - } - - @Override - public List findAllViewConfigurations() { - return getAll(); - } - - @Override - public List findViewConfigurationsByVersion(Long lastSyncedServerVersion) { - ViewConfigurationMetadataExample metadataExample = new ViewConfigurationMetadataExample(); - metadataExample.createCriteria().andServerVersionGreaterThanOrEqualTo(lastSyncedServerVersion); - return convert(viewConfigurationMetadataMapper.selectMany(metadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - public List findByEmptyServerVersion() { - ViewConfigurationMetadataExample metadataExample = new ViewConfigurationMetadataExample(); - metadataExample.createCriteria().andServerVersionIsNull(); - metadataExample.or(metadataExample.createCriteria().andServerVersionEqualTo(0l)); - return convert(viewConfigurationMetadataMapper.selectMany(metadataExample, 0, DEFAULT_FETCH_SIZE)); - } - - @Override - protected Long retrievePrimaryKey(ViewConfiguration viewConfiguration) { - if (getUniqueField(viewConfiguration) == null) { - return null; - } - String documentId = viewConfiguration.getId(); - - ViewConfigurationMetadataExample metadataExample = new ViewConfigurationMetadataExample(); - metadataExample.createCriteria().andDocumentIdEqualTo(documentId); - - org.opensrp.domain.postgres.ViewConfiguration pgViewConfiguration = viewConfigurationMetadataMapper - .selectByDocumentId(documentId); - if (pgViewConfiguration == null) { - return null; - } - return pgViewConfiguration.getId(); - } - - @Override - protected Object getUniqueField(ViewConfiguration viewConfiguration) { - return viewConfiguration == null ? null : viewConfiguration.getId(); - } - - //private Methods - private ViewConfiguration convert(org.opensrp.domain.postgres.ViewConfiguration viewConfiguration) { - if (viewConfiguration == null || viewConfiguration.getJson() == null - || !(viewConfiguration.getJson() instanceof ViewConfiguration)) { - return null; - } - return (ViewConfiguration) viewConfiguration.getJson(); - } - - private org.opensrp.domain.postgres.ViewConfiguration convert(ViewConfiguration entity, Long id) { - if (entity == null) { - return null; - } - - org.opensrp.domain.postgres.ViewConfiguration pgViewConfiguration = new org.opensrp.domain.postgres.ViewConfiguration(); - pgViewConfiguration.setId(id); - pgViewConfiguration.setJson(entity); - - return pgViewConfiguration; - } - - private List convert(List views) { - if (views == null || views.isEmpty()) { - return new ArrayList<>(); - } - - List viewConfigurations = new ArrayList<>(); - for (org.opensrp.domain.postgres.ViewConfiguration view : views) { - ViewConfiguration convertedView = convert(view); - if (convertedView != null) { - viewConfigurations.add(convertedView); - } - } - return viewConfigurations; - } - - private ViewConfigurationMetadata createMetadata(ViewConfiguration entity, Long id) { - ViewConfigurationMetadata metadata = new ViewConfigurationMetadata(); - metadata.setViewConfigurationId(id); - metadata.setDocumentId(entity.getId()); - metadata.setIdentifier(entity.getIdentifier()); - metadata.setServerVersion(entity.getServerVersion()); - return metadata; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/ActionTypeHandler.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/ActionTypeHandler.java deleted file mode 100644 index cd26b8fa24..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/ActionTypeHandler.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.opensrp.repository.postgres.handler; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.commons.lang3.StringUtils; -import org.apache.ibatis.type.JdbcType; -import org.apache.ibatis.type.TypeHandler; -import org.opensrp.scheduler.Action; -import org.postgresql.util.PGobject; - -public class ActionTypeHandler extends BaseTypeHandler implements TypeHandler { - - @Override - public void setParameter(PreparedStatement ps, int i, Action parameter, JdbcType jdbcType) throws SQLException { - try { - if (parameter != null) { - String jsonString = mapper.writeValueAsString(parameter); - PGobject jsonObject = new PGobject(); - jsonObject.setType("jsonb"); - jsonObject.setValue(jsonString); - ps.setObject(i, jsonObject); - } - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Action getResult(ResultSet rs, String columnName) throws SQLException { - try { - String jsonString = rs.getString(columnName); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Action.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Action getResult(ResultSet rs, int columnIndex) throws SQLException { - try { - String jsonString = rs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Action.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Action getResult(CallableStatement cs, int columnIndex) throws SQLException { - try { - String jsonString = cs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Action.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/AlertTypeHandler.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/AlertTypeHandler.java deleted file mode 100644 index 576827b18b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/AlertTypeHandler.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.opensrp.repository.postgres.handler; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.commons.lang3.StringUtils; -import org.apache.ibatis.type.JdbcType; -import org.apache.ibatis.type.TypeHandler; -import org.opensrp.scheduler.Alert; -import org.postgresql.util.PGobject; - -public class AlertTypeHandler extends BaseTypeHandler implements TypeHandler { - - @Override - public void setParameter(PreparedStatement ps, int i, Alert parameter, JdbcType jdbcType) throws SQLException { - try { - if (parameter != null) { - String jsonString = mapper.writeValueAsString(parameter); - PGobject jsonObject = new PGobject(); - jsonObject.setType("jsonb"); - jsonObject.setValue(jsonString); - ps.setObject(i, jsonObject); - } - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Alert getResult(ResultSet rs, String columnName) throws SQLException { - try { - String jsonString = rs.getString(columnName); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Alert.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Alert getResult(ResultSet rs, int columnIndex) throws SQLException { - try { - String jsonString = rs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Alert.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Alert getResult(CallableStatement cs, int columnIndex) throws SQLException { - try { - String jsonString = cs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Alert.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/BaseTypeHandler.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/BaseTypeHandler.java deleted file mode 100644 index 4c5f016729..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/BaseTypeHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.opensrp.repository.postgres.handler; - -import org.codehaus.jackson.Version; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.module.SimpleModule; -import org.ektorp.impl.StdObjectMapperFactory; -import org.joda.time.DateTime; -import org.opensrp.util.DateTimeDeserializer; - -public class BaseTypeHandler { - - public static final ObjectMapper mapper = new StdObjectMapperFactory().createObjectMapper();; - - protected BaseTypeHandler() { - SimpleModule dateTimeModule = new SimpleModule("DateTimeModule", new Version(0, 0, 0, null)); - dateTimeModule.addDeserializer(DateTime.class, new DateTimeDeserializer()); - mapper.registerModule(dateTimeModule); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/CampaignTypeHandler.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/CampaignTypeHandler.java deleted file mode 100644 index 2c43853cd7..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/CampaignTypeHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.opensrp.repository.postgres.handler; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.commons.lang3.StringUtils; -import org.apache.ibatis.type.JdbcType; -import org.apache.ibatis.type.TypeHandler; -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.opensrp.domain.Campaign; -import org.opensrp.util.DateTypeConverter; -import org.opensrp.util.TaskDateTimeTypeConverter; -import org.postgresql.util.PGobject; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public class CampaignTypeHandler extends BaseTypeHandler implements TypeHandler { - - private static Gson gson = new GsonBuilder().registerTypeAdapter(DateTime.class, new TaskDateTimeTypeConverter()) - .registerTypeAdapter(LocalDate.class, new DateTypeConverter()).create(); - - @Override - public void setParameter(PreparedStatement ps, int i, Campaign parameter, JdbcType jdbcType) throws SQLException { - try { - if (parameter != null) { - String jsonString = gson.toJson(parameter); - PGobject jsonObject = new PGobject(); - jsonObject.setType("jsonb"); - jsonObject.setValue(jsonString); - ps.setObject(i, jsonObject); - } - } catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Campaign getResult(ResultSet rs, String columnName) throws SQLException { - return getResult(rs.getString(columnName)); - } - - @Override - public Campaign getResult(ResultSet rs, int columnIndex) throws SQLException { - return getResult(rs.getString(columnIndex)); - } - - @Override - public Campaign getResult(CallableStatement cs, int columnIndex) throws SQLException { - return getResult(cs.getString(columnIndex)); - } - - private Campaign getResult(String jsonString) throws SQLException { - try { - if (StringUtils.isBlank(jsonString)) { - return null; - } - return gson.fromJson(jsonString, Campaign.class); - } catch (Exception e) { - throw new SQLException(e); - } - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/ClientTypeHandler.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/ClientTypeHandler.java deleted file mode 100644 index 8d2eb52e79..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/ClientTypeHandler.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.opensrp.repository.postgres.handler; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.commons.lang3.StringUtils; -import org.apache.ibatis.type.JdbcType; -import org.apache.ibatis.type.TypeHandler; -import org.opensrp.domain.Client; -import org.postgresql.util.PGobject; - -public class ClientTypeHandler extends BaseTypeHandler implements TypeHandler { - - @Override - public void setParameter(PreparedStatement ps, int i, Client parameter, JdbcType jdbcType) throws SQLException { - try { - if (parameter != null) { - String jsonString = mapper.writeValueAsString(parameter); - PGobject jsonObject = new PGobject(); - jsonObject.setType("jsonb"); - jsonObject.setValue(jsonString); - ps.setObject(i, jsonObject); - } - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Client getResult(ResultSet rs, String columnName) throws SQLException { - try { - String jsonString = rs.getString(columnName); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Client.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Client getResult(ResultSet rs, int columnIndex) throws SQLException { - try { - String jsonString = rs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Client.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Client getResult(CallableStatement cs, int columnIndex) throws SQLException { - try { - String jsonString = cs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Client.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/CodeSystemTypeHandler.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/CodeSystemTypeHandler.java deleted file mode 100644 index b2a3d50265..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/CodeSystemTypeHandler.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * - */ -package org.opensrp.repository.postgres.handler; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.commons.lang3.StringUtils; -import org.apache.ibatis.type.JdbcType; -import org.apache.ibatis.type.TypeHandler; -import org.opensrp.domain.CodeSystem; -import org.postgresql.util.PGobject; - -/** - * @author Samuel Githengi created on 08/30/19 - */ -public class CodeSystemTypeHandler extends BaseTypeHandler implements TypeHandler { - - @Override - public void setParameter(PreparedStatement ps, int i, CodeSystem parameter, JdbcType jdbcType) - throws SQLException { - try { - if (parameter != null) { - String jsonString = mapper.writeValueAsString(parameter); - PGobject jsonObject = new PGobject(); - jsonObject.setType("jsonb"); - jsonObject.setValue(jsonString); - ps.setObject(i, jsonObject); - } - } catch (Exception e) { - throw new SQLException(e); - } - - } - - @Override - public CodeSystem getResult(ResultSet rs, String columnName) throws SQLException { - try { - String jsonString = rs.getString(columnName); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, CodeSystem.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public CodeSystem getResult(ResultSet rs, int columnIndex) throws SQLException { - try { - String jsonString = rs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, CodeSystem.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public CodeSystem getResult(CallableStatement cs, int columnIndex) throws SQLException { - try { - String jsonString = cs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, CodeSystem.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/DateTimeTypeHandler.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/DateTimeTypeHandler.java deleted file mode 100644 index 8dd579bf20..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/DateTimeTypeHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.opensrp.repository.postgres.handler; - -import java.sql.CallableStatement; -import java.sql.Date; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; - -import org.apache.ibatis.type.JdbcType; -import org.apache.ibatis.type.TypeHandler; -import org.joda.time.DateTime; - -public class DateTimeTypeHandler implements TypeHandler { - - @Override - public void setParameter(PreparedStatement ps, int i, DateTime parameter, JdbcType jdbcType) throws SQLException { - if (parameter != null) { - if (parameter.toLocalTime().toString().equals("00:00:00.000")) - ps.setDate(i, new Date(parameter.getMillis())); - else - ps.setTimestamp(i, new Timestamp(parameter.getMillis())); - } else { - ps.setDate(i, null); - } - } - - @Override - public DateTime getResult(ResultSet resultSet, String columnName) throws SQLException { - Timestamp timestamp = resultSet.getTimestamp(columnName); - if (timestamp != null) { - return new DateTime(timestamp.getTime()); - } else { - return null; - } - } - - @Override - public DateTime getResult(ResultSet resultSet, int columnIndex) throws SQLException { - Timestamp timestamp = resultSet.getTimestamp(columnIndex); - if (timestamp != null) { - return new DateTime(timestamp.getTime()); - } else { - return null; - } - } - - @Override - public DateTime getResult(CallableStatement cs, int columnIndex) throws SQLException { - Timestamp timestamp = cs.getTimestamp(columnIndex); - if (timestamp != null) { - return new DateTime(timestamp.getTime()); - } else { - return null; - } - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/EventTypeHandler.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/EventTypeHandler.java deleted file mode 100644 index 88dc6ac010..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/EventTypeHandler.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.opensrp.repository.postgres.handler; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.commons.lang3.StringUtils; -import org.apache.ibatis.type.JdbcType; -import org.apache.ibatis.type.TypeHandler; -import org.opensrp.domain.Event; -import org.postgresql.util.PGobject; - -public class EventTypeHandler extends BaseTypeHandler implements TypeHandler { - - @Override - public void setParameter(PreparedStatement ps, int i, Event parameter, JdbcType jdbcType) throws SQLException { - try { - if (parameter != null) { - String jsonString = mapper.writeValueAsString(parameter); - PGobject jsonObject = new PGobject(); - jsonObject.setType("jsonb"); - jsonObject.setValue(jsonString); - ps.setObject(i, jsonObject); - } - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Event getResult(ResultSet rs, String columnName) throws SQLException { - try { - String jsonString = rs.getString(columnName); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Event.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Event getResult(ResultSet rs, int columnIndex) throws SQLException { - try { - String jsonString = rs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Event.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Event getResult(CallableStatement cs, int columnIndex) throws SQLException { - try { - String jsonString = cs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Event.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/LocationTypeHandler.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/LocationTypeHandler.java deleted file mode 100644 index 03572cea02..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/LocationTypeHandler.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.opensrp.repository.postgres.handler; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.commons.lang3.StringUtils; -import org.apache.ibatis.type.JdbcType; -import org.apache.ibatis.type.TypeHandler; -import org.opensrp.domain.LocationProperty; -import org.opensrp.domain.PhysicalLocation; -import org.opensrp.util.PropertiesConverter; -import org.postgresql.util.PGobject; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public class LocationTypeHandler extends BaseTypeHandler implements TypeHandler { - - private static Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HHmm") - .registerTypeAdapter(LocationProperty.class, new PropertiesConverter()).create(); - - @Override - public void setParameter(PreparedStatement ps, int i, PhysicalLocation parameter, JdbcType jdbcType) - throws SQLException { - try { - if (parameter != null) { - String jsonString = gson.toJson(parameter); - PGobject jsonObject = new PGobject(); - jsonObject.setType("jsonb"); - jsonObject.setValue(jsonString); - ps.setObject(i, jsonObject); - } - } catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public PhysicalLocation getResult(ResultSet rs, String columnName) throws SQLException { - return getResult(rs.getString(columnName)); - } - - @Override - public PhysicalLocation getResult(ResultSet rs, int columnIndex) throws SQLException { - return getResult(rs.getString(columnIndex)); - } - - @Override - public PhysicalLocation getResult(CallableStatement cs, int columnIndex) throws SQLException { - return getResult(cs.getString(columnIndex)); - } - - private PhysicalLocation getResult(String jsonString) throws SQLException { - try { - if (StringUtils.isBlank(jsonString)) { - return null; - } - return gson.fromJson(jsonString, PhysicalLocation.class); - } catch (Exception e) { - throw new SQLException(e); - } - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/PlanTypeHandler.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/PlanTypeHandler.java deleted file mode 100644 index 466b845cf3..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/PlanTypeHandler.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.opensrp.repository.postgres.handler; - -import org.apache.commons.lang3.StringUtils; -import org.apache.ibatis.type.JdbcType; -import org.apache.ibatis.type.TypeHandler; -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.opensrp.domain.PlanDefinition; -import org.opensrp.util.DateTypeConverter; -import org.opensrp.util.TaskDateTimeTypeConverter; -import org.postgresql.util.PGobject; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -/** - * Created by Vincent Karuri on 03/05/2019 - */ -public class PlanTypeHandler extends BaseTypeHandler implements TypeHandler { - - public Gson gson = new GsonBuilder().registerTypeAdapter(DateTime.class, new TaskDateTimeTypeConverter()) - .registerTypeAdapter(LocalDate.class, new DateTypeConverter()).create(); - - @Override - public void setParameter(PreparedStatement ps, int i, PlanDefinition parameter, JdbcType jdbcType) throws SQLException { - try { - if (parameter != null) { - String jsonString = gson.toJson(parameter); - PGobject jsonObject = new PGobject(); - jsonObject.setType("jsonb"); - jsonObject.setValue(jsonString); - ps.setObject(i, jsonObject); - } - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public PlanDefinition getResult(ResultSet rs, String columnName) throws SQLException { - try { - String jsonString = rs.getString(columnName); - if (StringUtils.isBlank(jsonString)) { - return null; - } - PlanDefinition result = gson.fromJson(jsonString, PlanDefinition.class); - return result; - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public PlanDefinition getResult(ResultSet rs, int columnIndex) throws SQLException { - try { - String jsonString = rs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - PlanDefinition result = gson.fromJson(jsonString, PlanDefinition.class); - return result; - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public PlanDefinition getResult(CallableStatement cs, int columnIndex) throws SQLException { - try { - String jsonString = cs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - PlanDefinition result = gson.fromJson(jsonString, PlanDefinition.class); - return result; - } - catch (Exception e) { - throw new SQLException(e); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/ReportTypeHandler.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/ReportTypeHandler.java deleted file mode 100644 index c4077d1a65..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/ReportTypeHandler.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.opensrp.repository.postgres.handler; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.commons.lang3.StringUtils; -import org.apache.ibatis.type.JdbcType; -import org.apache.ibatis.type.TypeHandler; -import org.opensrp.domain.Report; -import org.postgresql.util.PGobject; - -public class ReportTypeHandler extends BaseTypeHandler implements TypeHandler { - - @Override - public void setParameter(PreparedStatement ps, int i, Report parameter, JdbcType jdbcType) throws SQLException { - try { - if (parameter != null) { - String jsonString = mapper.writeValueAsString(parameter); - PGobject jsonObject = new PGobject(); - jsonObject.setType("jsonb"); - jsonObject.setValue(jsonString); - ps.setObject(i, jsonObject); - } - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Report getResult(ResultSet rs, String columnName) throws SQLException { - try { - String jsonString = rs.getString(columnName); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Report.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Report getResult(ResultSet rs, int columnIndex) throws SQLException { - try { - String jsonString = rs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Report.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Report getResult(CallableStatement cs, int columnIndex) throws SQLException { - try { - String jsonString = cs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Report.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/SettingTypeHandler.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/SettingTypeHandler.java deleted file mode 100644 index 2e944fb13c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/SettingTypeHandler.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.opensrp.repository.postgres.handler; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.commons.lang3.StringUtils; -import org.apache.ibatis.type.JdbcType; -import org.apache.ibatis.type.TypeHandler; -import org.codehaus.jackson.Version; -import org.codehaus.jackson.map.module.SimpleModule; -import org.json.JSONArray; -import org.opensrp.domain.setting.SettingConfiguration; -import org.opensrp.util.JsonArrayDeserializer; -import org.opensrp.util.JsonArraySerializer; -import org.postgresql.util.PGobject; - -public class SettingTypeHandler extends BaseTypeHandler implements TypeHandler { - - public SettingTypeHandler() { - super(); - SimpleModule jsonArrayDeserializerModule = new SimpleModule("JsonArrayDeserializerModule", new Version(0, 0, 0, null)); - jsonArrayDeserializerModule.addDeserializer(JSONArray.class, new JsonArrayDeserializer()); - mapper.registerModule(jsonArrayDeserializerModule); - - SimpleModule jsonArraySerializerModule = new SimpleModule("JsonArraySerializerModule", new Version(0, 0, 0, null)); - jsonArraySerializerModule.addSerializer(JSONArray.class, new JsonArraySerializer()); - mapper.registerModule(jsonArraySerializerModule); - } - - @Override - public void setParameter(PreparedStatement ps, int i, SettingConfiguration parameter, JdbcType jdbcType) throws SQLException { - try { - if (parameter != null) { - String jsonString = mapper.writeValueAsString(parameter); - PGobject jsonObject = new PGobject(); - jsonObject.setType("jsonb"); - jsonObject.setValue(jsonString); - ps.setObject(i, jsonObject); - } - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public SettingConfiguration getResult(ResultSet rs, String columnName) throws SQLException { - try { - String jsonString = rs.getString(columnName); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, SettingConfiguration.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public SettingConfiguration getResult(ResultSet rs, int columnIndex) throws SQLException { - try { - String jsonString = rs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, SettingConfiguration.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public SettingConfiguration getResult(CallableStatement cs, int columnIndex) throws SQLException { - try { - String jsonString = cs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, SettingConfiguration.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/StockTypeHandler.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/StockTypeHandler.java deleted file mode 100644 index aa76691c18..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/StockTypeHandler.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.opensrp.repository.postgres.handler; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.commons.lang3.StringUtils; -import org.apache.ibatis.type.JdbcType; -import org.apache.ibatis.type.TypeHandler; -import org.opensrp.domain.Stock; -import org.postgresql.util.PGobject; - -public class StockTypeHandler extends BaseTypeHandler implements TypeHandler { - - @Override - public void setParameter(PreparedStatement ps, int i, Stock parameter, JdbcType jdbcType) throws SQLException { - try { - if (parameter != null) { - String jsonString = mapper.writeValueAsString(parameter); - PGobject jsonObject = new PGobject(); - jsonObject.setType("jsonb"); - jsonObject.setValue(jsonString); - ps.setObject(i, jsonObject); - } - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Stock getResult(ResultSet rs, String columnName) throws SQLException { - try { - String jsonString = rs.getString(columnName); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Stock.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Stock getResult(ResultSet rs, int columnIndex) throws SQLException { - try { - String jsonString = rs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Stock.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Stock getResult(CallableStatement cs, int columnIndex) throws SQLException { - try { - String jsonString = cs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, Stock.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/TaskTypeHandler.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/TaskTypeHandler.java deleted file mode 100644 index c489486979..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/TaskTypeHandler.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.opensrp.repository.postgres.handler; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.commons.lang3.StringUtils; -import org.apache.ibatis.type.JdbcType; -import org.apache.ibatis.type.TypeHandler; -import org.joda.time.DateTime; -import org.opensrp.domain.Task; -import org.opensrp.util.DateTimeTypeConverter; -import org.postgresql.util.PGobject; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public class TaskTypeHandler extends BaseTypeHandler implements TypeHandler { - - private static Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") - .registerTypeAdapter(DateTime.class, new DateTimeTypeConverter()).create(); - - @Override - public void setParameter(PreparedStatement ps, int i, Task parameter, JdbcType jdbcType) throws SQLException { - try { - if (parameter != null) { - String jsonString = gson.toJson(parameter); - PGobject jsonObject = new PGobject(); - jsonObject.setType("jsonb"); - jsonObject.setValue(jsonString); - ps.setObject(i, jsonObject); - } - } catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public Task getResult(ResultSet rs, String columnName) throws SQLException { - return getResult(rs.getString(columnName)); - } - - @Override - public Task getResult(ResultSet rs, int columnIndex) throws SQLException { - return getResult(rs.getString(columnIndex)); - } - - @Override - public Task getResult(CallableStatement cs, int columnIndex) throws SQLException { - return getResult(cs.getString(columnIndex)); - } - - private Task getResult(String jsonString) throws SQLException { - try { - if (StringUtils.isBlank(jsonString)) { - return null; - } - return gson.fromJson(jsonString, Task.class); - } catch (Exception e) { - throw new SQLException(e); - } - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/ViewConfigurationTypeHandler.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/ViewConfigurationTypeHandler.java deleted file mode 100644 index 89d395af3f..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/handler/ViewConfigurationTypeHandler.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.opensrp.repository.postgres.handler; - -import java.sql.CallableStatement; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.apache.commons.lang3.StringUtils; -import org.apache.ibatis.type.JdbcType; -import org.apache.ibatis.type.TypeHandler; -import org.opensrp.domain.viewconfiguration.ViewConfiguration; -import org.postgresql.util.PGobject; - -public class ViewConfigurationTypeHandler extends BaseTypeHandler implements TypeHandler { - - @Override - public void setParameter(PreparedStatement ps, int i, ViewConfiguration parameter, JdbcType jdbcType) - throws SQLException { - try { - if (parameter != null) { - String jsonString = mapper.writeValueAsString(parameter); - PGobject jsonObject = new PGobject(); - jsonObject.setType("jsonb"); - jsonObject.setValue(jsonString); - ps.setObject(i, jsonObject); - } - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public ViewConfiguration getResult(ResultSet rs, String columnName) throws SQLException { - try { - String jsonString = rs.getString(columnName); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, ViewConfiguration.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public ViewConfiguration getResult(ResultSet rs, int columnIndex) throws SQLException { - try { - String jsonString = rs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, ViewConfiguration.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } - - @Override - public ViewConfiguration getResult(CallableStatement cs, int columnIndex) throws SQLException { - try { - String jsonString = cs.getString(columnIndex); - if (StringUtils.isBlank(jsonString)) { - return null; - } - return mapper.readValue(jsonString, ViewConfiguration.class); - } - catch (Exception e) { - throw new SQLException(e); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ActionMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ActionMapper.java deleted file mode 100644 index cd43eb4236..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ActionMapper.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Action; -import org.opensrp.domain.postgres.ActionExample; - -public interface ActionMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - long countByExample(ActionExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int deleteByExample(ActionExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int insert(Action record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int insertSelective(Action record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - List selectByExample(ActionExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - Action selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int updateByExampleSelective(@Param("record") Action record, @Param("example") ActionExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int updateByExample(@Param("record") Action record, @Param("example") ActionExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int updateByPrimaryKeySelective(Action record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int updateByPrimaryKey(Action record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ActionMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ActionMetadataMapper.java deleted file mode 100644 index 3c2dfd4159..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ActionMetadataMapper.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.ActionMetadata; -import org.opensrp.domain.postgres.ActionMetadataExample; - -public interface ActionMetadataMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - long countByExample(ActionMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int deleteByExample(ActionMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int insert(ActionMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int insertSelective(ActionMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - List selectByExample(ActionMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - ActionMetadata selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int updateByExampleSelective(@Param("record") ActionMetadata record, @Param("example") ActionMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int updateByExample(@Param("record") ActionMetadata record, @Param("example") ActionMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int updateByPrimaryKeySelective(ActionMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.action_metadata - * - * @mbg.generated Wed Mar 21 14:35:49 EAT 2018 - */ - int updateByPrimaryKey(ActionMetadata record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/AlertMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/AlertMapper.java deleted file mode 100644 index 3839a054de..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/AlertMapper.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Alert; -import org.opensrp.domain.postgres.AlertExample; - -public interface AlertMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - long countByExample(AlertExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int deleteByExample(AlertExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int insert(Alert record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int insertSelective(Alert record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - List selectByExample(AlertExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - Alert selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int updateByExampleSelective(@Param("record") Alert record, @Param("example") AlertExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int updateByExample(@Param("record") Alert record, @Param("example") AlertExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int updateByPrimaryKeySelective(Alert record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int updateByPrimaryKey(Alert record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/AlertMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/AlertMetadataMapper.java deleted file mode 100644 index 2cbae37806..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/AlertMetadataMapper.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.AlertMetadata; -import org.opensrp.domain.postgres.AlertMetadataExample; - -public interface AlertMetadataMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - long countByExample(AlertMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int deleteByExample(AlertMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int insert(AlertMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int insertSelective(AlertMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - List selectByExample(AlertMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - AlertMetadata selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int updateByExampleSelective(@Param("record") AlertMetadata record, @Param("example") AlertMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int updateByExample(@Param("record") AlertMetadata record, @Param("example") AlertMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int updateByPrimaryKeySelective(AlertMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.alert_metadata - * - * @mbg.generated Thu Mar 22 17:10:48 EAT 2018 - */ - int updateByPrimaryKey(AlertMetadata record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/AppStateTokenMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/AppStateTokenMapper.java deleted file mode 100644 index 79e7d755b1..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/AppStateTokenMapper.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.session.RowBounds; -import org.opensrp.domain.postgres.AppStateToken; -import org.opensrp.domain.postgres.AppStateTokenExample; - -public interface AppStateTokenMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - long countByExample(AppStateTokenExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - int deleteByExample(AppStateTokenExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - int insert(AppStateToken record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - int insertSelective(AppStateToken record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - List selectByExampleWithRowbounds(AppStateTokenExample example, RowBounds rowBounds); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - List selectByExample(AppStateTokenExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - AppStateToken selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - int updateByExampleSelective(@Param("record") AppStateToken record, @Param("example") AppStateTokenExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - int updateByExample(@Param("record") AppStateToken record, @Param("example") AppStateTokenExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - int updateByPrimaryKeySelective(AppStateToken record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.app_state_token - * - * @mbg.generated Wed Mar 14 17:13:39 EAT 2018 - */ - int updateByPrimaryKey(AppStateToken record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/CampaignMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/CampaignMapper.java deleted file mode 100644 index 5ab581b65c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/CampaignMapper.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Campaign; -import org.opensrp.domain.postgres.CampaignExample; - -public interface CampaignMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - long countByExample(CampaignExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int deleteByExample(CampaignExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int insert(Campaign record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int insertSelective(Campaign record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - List selectByExample(CampaignExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - Campaign selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int updateByExampleSelective(@Param("record") Campaign record, @Param("example") CampaignExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int updateByExample(@Param("record") Campaign record, @Param("example") CampaignExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int updateByPrimaryKeySelective(Campaign record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int updateByPrimaryKey(Campaign record); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/CampaignMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/CampaignMetadataMapper.java deleted file mode 100644 index 8919a7563c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/CampaignMetadataMapper.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.CampaignMetadata; -import org.opensrp.domain.postgres.CampaignMetadataExample; - -public interface CampaignMetadataMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - long countByExample(CampaignMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int deleteByExample(CampaignMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int insert(CampaignMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int insertSelective(CampaignMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - List selectByExample(CampaignMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - CampaignMetadata selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int updateByExampleSelective(@Param("record") CampaignMetadata record, - @Param("example") CampaignMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int updateByExample(@Param("record") CampaignMetadata record, @Param("example") CampaignMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int updateByPrimaryKeySelective(CampaignMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.campaign_metadata - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int updateByPrimaryKey(CampaignMetadata record); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ClientMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ClientMapper.java deleted file mode 100644 index ded51531e4..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ClientMapper.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Client; -import org.opensrp.domain.postgres.ClientExample; - -public interface ClientMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - long countByExample(ClientExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int deleteByExample(ClientExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int insert(Client record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int insertSelective(Client record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - List selectByExample(ClientExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - Client selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int updateByExampleSelective(@Param("record") Client record, @Param("example") ClientExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int updateByExample(@Param("record") Client record, @Param("example") ClientExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int updateByPrimaryKeySelective(Client record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.client - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int updateByPrimaryKey(Client record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ClientMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ClientMetadataMapper.java deleted file mode 100644 index 6cb35ec6e4..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ClientMetadataMapper.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.ClientMetadata; -import org.opensrp.domain.postgres.ClientMetadataExample; - -public interface ClientMetadataMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - long countByExample(ClientMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - int deleteByExample(ClientMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - int insert(ClientMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - int insertSelective(ClientMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - List selectByExample(ClientMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - ClientMetadata selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - int updateByExampleSelective(@Param("record") ClientMetadata record, - @Param("example") ClientMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - int updateByExample(@Param("record") ClientMetadata record, @Param("example") ClientMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - int updateByPrimaryKeySelective(ClientMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.client_metadata - * @mbg.generated Tue Apr 30 18:07:16 EAT 2019 - */ - int updateByPrimaryKey(ClientMetadata record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ErrorTraceMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ErrorTraceMapper.java deleted file mode 100644 index adec08b5b7..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ErrorTraceMapper.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.ErrorTrace; -import org.opensrp.domain.postgres.ErrorTraceExample; - -public interface ErrorTraceMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - long countByExample(ErrorTraceExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - int deleteByExample(ErrorTraceExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - int insert(ErrorTrace record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - int insertSelective(ErrorTrace record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - List selectByExample(ErrorTraceExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - ErrorTrace selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - int updateByExampleSelective(@Param("record") ErrorTrace record, @Param("example") ErrorTraceExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - int updateByExample(@Param("record") ErrorTrace record, @Param("example") ErrorTraceExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - int updateByPrimaryKeySelective(ErrorTrace record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * error.error_trace - * - * @mbg.generated Thu Apr 05 16:08:08 EAT 2018 - */ - int updateByPrimaryKey(ErrorTrace record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/EventMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/EventMapper.java deleted file mode 100644 index de28909130..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/EventMapper.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Event; -import org.opensrp.domain.postgres.EventExample; - -public interface EventMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - long countByExample(EventExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int deleteByExample(EventExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int insert(Event record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int insertSelective(Event record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - List selectByExample(EventExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - Event selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int updateByExampleSelective(@Param("record") Event record, @Param("example") EventExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int updateByExample(@Param("record") Event record, @Param("example") EventExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int updateByPrimaryKeySelective(Event record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event - * - * @mbg.generated Fri Apr 06 16:01:06 EAT 2018 - */ - int updateByPrimaryKey(Event record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/EventMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/EventMetadataMapper.java deleted file mode 100644 index b2fe8df9c7..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/EventMetadataMapper.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.EventMetadata; -import org.opensrp.domain.postgres.EventMetadataExample; - -public interface EventMetadataMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - long countByExample(EventMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - int deleteByExample(EventMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - int insert(EventMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - int insertSelective(EventMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - List selectByExample(EventMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - EventMetadata selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - int updateByExampleSelective(@Param("record") EventMetadata record, @Param("example") EventMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - int updateByExample(@Param("record") EventMetadata record, @Param("example") EventMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - int updateByPrimaryKeySelective(EventMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.event_metadata - * - * @mbg.generated Fri Apr 06 12:20:41 EAT 2018 - */ - int updateByPrimaryKey(EventMetadata record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/LocationMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/LocationMapper.java deleted file mode 100644 index d16fb02954..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/LocationMapper.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Location; -import org.opensrp.domain.postgres.LocationExample; - -public interface LocationMapper { - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - long countByExample(LocationExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int deleteByExample(LocationExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int insert(Location record); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int insertSelective(Location record); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - List selectByExample(LocationExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - Location selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int updateByExampleSelective(@Param("record") Location record, @Param("example") LocationExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int updateByExample(@Param("record") Location record, @Param("example") LocationExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int updateByPrimaryKeySelective(Location record); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.location - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int updateByPrimaryKey(Location record); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/LocationMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/LocationMetadataMapper.java deleted file mode 100644 index 825c60ce56..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/LocationMetadataMapper.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.LocationMetadata; -import org.opensrp.domain.postgres.LocationMetadataExample; - -public interface LocationMetadataMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - long countByExample(LocationMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int deleteByExample(LocationMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int insert(LocationMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int insertSelective(LocationMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - List selectByExample(LocationMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - LocationMetadata selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int updateByExampleSelective(@Param("record") LocationMetadata record, - @Param("example") LocationMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int updateByExample(@Param("record") LocationMetadata record, @Param("example") LocationMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int updateByPrimaryKeySelective(LocationMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.location_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int updateByPrimaryKey(LocationMetadata record); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/MultiMediaMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/MultiMediaMapper.java deleted file mode 100644 index 6f3dae8af0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/MultiMediaMapper.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.MultiMedia; -import org.opensrp.domain.postgres.MultiMediaExample; - -public interface MultiMediaMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - long countByExample(MultiMediaExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - int deleteByExample(MultiMediaExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - int insert(MultiMedia record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - int insertSelective(MultiMedia record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - List selectByExample(MultiMediaExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - MultiMedia selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - int updateByExampleSelective(@Param("record") MultiMedia record, @Param("example") MultiMediaExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - int updateByExample(@Param("record") MultiMedia record, @Param("example") MultiMediaExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - int updateByPrimaryKeySelective(MultiMedia record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.multi_media - * - * @mbg.generated Fri Mar 23 09:39:36 EAT 2018 - */ - int updateByPrimaryKey(MultiMedia record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/OrganizationLocationMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/OrganizationLocationMapper.java deleted file mode 100644 index 86633c1176..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/OrganizationLocationMapper.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.OrganizationLocation; -import org.opensrp.domain.postgres.OrganizationLocationExample; - -public interface OrganizationLocationMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - long countByExample(OrganizationLocationExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - int deleteByExample(OrganizationLocationExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - int insert(OrganizationLocation record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - int insertSelective(OrganizationLocation record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - List selectByExample(OrganizationLocationExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - OrganizationLocation selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - int updateByExampleSelective(@Param("record") OrganizationLocation record, - @Param("example") OrganizationLocationExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - int updateByExample(@Param("record") OrganizationLocation record, - @Param("example") OrganizationLocationExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - int updateByPrimaryKeySelective(OrganizationLocation record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization_location - * @mbg.generated Mon Sep 09 18:07:17 EAT 2019 - */ - int updateByPrimaryKey(OrganizationLocation record); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/OrganizationMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/OrganizationMapper.java deleted file mode 100644 index fa516a360f..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/OrganizationMapper.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Organization; -import org.opensrp.domain.postgres.OrganizationExample; - -public interface OrganizationMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - long countByExample(OrganizationExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - int deleteByExample(OrganizationExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - int insert(Organization record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - int insertSelective(Organization record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - List selectByExample(OrganizationExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - Organization selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - int updateByExampleSelective(@Param("record") Organization record, @Param("example") OrganizationExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - int updateByExample(@Param("record") Organization record, @Param("example") OrganizationExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - int updateByPrimaryKeySelective(Organization record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table team.organization - * @mbg.generated Fri Aug 30 19:03:40 EAT 2019 - */ - int updateByPrimaryKey(Organization record); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/PlanMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/PlanMapper.java deleted file mode 100644 index 7b2fb326fb..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/PlanMapper.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Plan; -import org.opensrp.domain.postgres.PlanExample; - -import java.util.List; - -public interface PlanMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - long countByExample(PlanExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - int deleteByExample(PlanExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - int insert(Plan record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - int insertSelective(Plan record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - List selectByExample(PlanExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - Plan selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - int updateByExampleSelective(@Param("record") Plan record, @Param("example") PlanExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - int updateByExample(@Param("record") Plan record, @Param("example") PlanExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - int updateByPrimaryKeySelective(Plan record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - int updateByPrimaryKey(Plan record); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/PlanMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/PlanMetadataMapper.java deleted file mode 100644 index 8451a09311..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/PlanMetadataMapper.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.PlanMetadata; -import org.opensrp.domain.postgres.PlanMetadataExample; - -public interface PlanMetadataMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - long countByExample(PlanMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - int deleteByExample(PlanMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - int insert(PlanMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - int insertSelective(PlanMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - List selectByExample(PlanMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - int updateByExampleSelective(@Param("record") PlanMetadata record, @Param("example") PlanMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.plan_metadata - * @mbg.generated Fri Aug 30 12:59:38 EAT 2019 - */ - int updateByExample(@Param("record") PlanMetadata record, @Param("example") PlanMetadataExample example); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/PractitionerMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/PractitionerMapper.java deleted file mode 100644 index 67dc917378..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/PractitionerMapper.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Practitioner; -import org.opensrp.domain.postgres.PractitionerExample; - -public interface PractitionerMapper { - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - long countByExample(PractitionerExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int deleteByExample(PractitionerExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int insert(Practitioner record); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int insertSelective(Practitioner record); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - List selectByExample(PractitionerExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - Practitioner selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int updateByExampleSelective(@Param("record") Practitioner record, @Param("example") PractitionerExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int updateByExample(@Param("record") Practitioner record, @Param("example") PractitionerExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int updateByPrimaryKeySelective(Practitioner record); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int updateByPrimaryKey(Practitioner record); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/PractitionerRoleMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/PractitionerRoleMapper.java deleted file mode 100644 index 9ff94bd21f..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/PractitionerRoleMapper.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.PractitionerRole; -import org.opensrp.domain.postgres.PractitionerRoleExample; - -public interface PractitionerRoleMapper { - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - long countByExample(PractitionerRoleExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int deleteByExample(PractitionerRoleExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int insert(PractitionerRole record); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int insertSelective(PractitionerRole record); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - List selectByExample(PractitionerRoleExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - PractitionerRole selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int updateByExampleSelective(@Param("record") PractitionerRole record, @Param("example") PractitionerRoleExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int updateByExample(@Param("record") PractitionerRole record, @Param("example") PractitionerRoleExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int updateByPrimaryKeySelective(PractitionerRole record); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table team.practitioner_role - * - * @mbg.generated Fri Aug 30 16:08:23 EAT 2019 - */ - int updateByPrimaryKey(PractitionerRole record); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ReportMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ReportMapper.java deleted file mode 100644 index 4f81fbde5e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ReportMapper.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Report; -import org.opensrp.domain.postgres.ReportExample; - -public interface ReportMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - long countByExample(ReportExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int deleteByExample(ReportExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int insert(Report record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int insertSelective(Report record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - List selectByExample(ReportExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - Report selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int updateByExampleSelective(@Param("record") Report record, @Param("example") ReportExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int updateByExample(@Param("record") Report record, @Param("example") ReportExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int updateByPrimaryKeySelective(Report record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int updateByPrimaryKey(Report record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ReportMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ReportMetadataMapper.java deleted file mode 100644 index 3bf20f7670..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ReportMetadataMapper.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.ReportMetadata; -import org.opensrp.domain.postgres.ReportMetadataExample; - -public interface ReportMetadataMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - long countByExample(ReportMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int deleteByExample(ReportMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int insert(ReportMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int insertSelective(ReportMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - List selectByExample(ReportMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - ReportMetadata selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int updateByExampleSelective(@Param("record") ReportMetadata record, @Param("example") ReportMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int updateByExample(@Param("record") ReportMetadata record, @Param("example") ReportMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int updateByPrimaryKeySelective(ReportMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.report_metadata - * - * @mbg.generated Fri Mar 23 14:23:39 EAT 2018 - */ - int updateByPrimaryKey(ReportMetadata record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/SettingsMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/SettingsMapper.java deleted file mode 100644 index 681d9f959a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/SettingsMapper.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Settings; -import org.opensrp.domain.postgres.SettingsExample; - -public interface SettingsMapper { - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - long countByExample(SettingsExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - int deleteByExample(SettingsExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - int insert(Settings record); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - int insertSelective(Settings record); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - List selectByExample(SettingsExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - Settings selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - int updateByExampleSelective(@Param("record") Settings record, @Param("example") SettingsExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - int updateByExample(@Param("record") Settings record, @Param("example") SettingsExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - int updateByPrimaryKeySelective(Settings record); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.settings - * - * @mbg.generated Tue Sep 04 17:59:18 EAT 2018 - */ - int updateByPrimaryKey(Settings record); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/SettingsMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/SettingsMetadataMapper.java deleted file mode 100644 index 1efeb55201..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/SettingsMetadataMapper.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.SettingsMetadata; -import org.opensrp.domain.postgres.SettingsMetadataExample; - -public interface SettingsMetadataMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - long countByExample(SettingsMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - int deleteByExample(SettingsMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - int insert(SettingsMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - int insertSelective(SettingsMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - List selectByExample(SettingsMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - SettingsMetadata selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - int updateByExampleSelective(@Param("record") SettingsMetadata record, - @Param("example") SettingsMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - int updateByExample(@Param("record") SettingsMetadata record, @Param("example") SettingsMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - int updateByPrimaryKeySelective(SettingsMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.settings_metadata - * @mbg.generated Fri Oct 12 19:34:12 EAT 2018 - */ - int updateByPrimaryKey(SettingsMetadata record); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/StockMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/StockMapper.java deleted file mode 100644 index 18298e5126..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/StockMapper.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Stock; -import org.opensrp.domain.postgres.StockExample; - -public interface StockMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - long countByExample(StockExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int deleteByExample(StockExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int insert(Stock record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int insertSelective(Stock record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - List selectByExample(StockExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - Stock selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int updateByExampleSelective(@Param("record") Stock record, @Param("example") StockExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int updateByExample(@Param("record") Stock record, @Param("example") StockExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int updateByPrimaryKeySelective(Stock record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int updateByPrimaryKey(Stock record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/StockMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/StockMetadataMapper.java deleted file mode 100644 index d17fa3ac41..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/StockMetadataMapper.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.StockMetadata; -import org.opensrp.domain.postgres.StockMetadataExample; - -public interface StockMetadataMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - long countByExample(StockMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int deleteByExample(StockMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int insert(StockMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int insertSelective(StockMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - List selectByExample(StockMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - StockMetadata selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int updateByExampleSelective(@Param("record") StockMetadata record, @Param("example") StockMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int updateByExample(@Param("record") StockMetadata record, @Param("example") StockMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int updateByPrimaryKeySelective(StockMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.stock_metadata - * - * @mbg.generated Fri Mar 23 15:56:38 EAT 2018 - */ - int updateByPrimaryKey(StockMetadata record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/StructureMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/StructureMapper.java deleted file mode 100644 index e3f4f5d767..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/StructureMapper.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Structure; -import org.opensrp.domain.postgres.StructureExample; - -public interface StructureMapper { - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - long countByExample(StructureExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int deleteByExample(StructureExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int insert(Structure record); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int insertSelective(Structure record); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - List selectByExample(StructureExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - Structure selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int updateByExampleSelective(@Param("record") Structure record, @Param("example") StructureExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int updateByExample(@Param("record") Structure record, @Param("example") StructureExample example); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int updateByPrimaryKeySelective(Structure record); - - /** - * This method was generated by MyBatis Generator. - * This method corresponds to the database table core.structure - * - * @mbg.generated Thu Nov 15 15:55:07 EAT 2018 - */ - int updateByPrimaryKey(Structure record); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/StructureMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/StructureMetadataMapper.java deleted file mode 100644 index baac96c368..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/StructureMetadataMapper.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.StructureMetadata; -import org.opensrp.domain.postgres.StructureMetadataExample; - -public interface StructureMetadataMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - long countByExample(StructureMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int deleteByExample(StructureMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int insert(StructureMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int insertSelective(StructureMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - List selectByExample(StructureMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - StructureMetadata selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int updateByExampleSelective(@Param("record") StructureMetadata record, - @Param("example") StructureMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int updateByExample(@Param("record") StructureMetadata record, @Param("example") StructureMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int updateByPrimaryKeySelective(StructureMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.structure_metadata - * @mbg.generated Tue Dec 04 16:50:28 EAT 2018 - */ - int updateByPrimaryKey(StructureMetadata record); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/TaskMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/TaskMapper.java deleted file mode 100644 index d6f9ec73c7..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/TaskMapper.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Task; -import org.opensrp.domain.postgres.TaskExample; - -public interface TaskMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - long countByExample(TaskExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int deleteByExample(TaskExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int insert(Task record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int insertSelective(Task record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - List selectByExample(TaskExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - Task selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int updateByExampleSelective(@Param("record") Task record, @Param("example") TaskExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int updateByExample(@Param("record") Task record, @Param("example") TaskExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int updateByPrimaryKeySelective(Task record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task - * @mbg.generated Fri Nov 09 12:47:47 EAT 2018 - */ - int updateByPrimaryKey(Task record); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/TaskMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/TaskMetadataMapper.java deleted file mode 100644 index fb5a3be0c5..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/TaskMetadataMapper.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.TaskMetadata; -import org.opensrp.domain.postgres.TaskMetadataExample; - -public interface TaskMetadataMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - long countByExample(TaskMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - int deleteByExample(TaskMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - int insert(TaskMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - int insertSelective(TaskMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - List selectByExample(TaskMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - TaskMetadata selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - int updateByExampleSelective(@Param("record") TaskMetadata record, @Param("example") TaskMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - int updateByExample(@Param("record") TaskMetadata record, @Param("example") TaskMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - int updateByPrimaryKeySelective(TaskMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table core.task_metadata - * @mbg.generated Fri May 10 21:21:43 EAT 2019 - */ - int updateByPrimaryKey(TaskMetadata record); -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ViewConfigurationMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ViewConfigurationMapper.java deleted file mode 100644 index 514fd216b6..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ViewConfigurationMapper.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.ViewConfiguration; -import org.opensrp.domain.postgres.ViewConfigurationExample; - -public interface ViewConfigurationMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - long countByExample(ViewConfigurationExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int deleteByExample(ViewConfigurationExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int insert(ViewConfiguration record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int insertSelective(ViewConfiguration record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - List selectByExample(ViewConfigurationExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - ViewConfiguration selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int updateByExampleSelective(@Param("record") ViewConfiguration record, - @Param("example") ViewConfigurationExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int updateByExample(@Param("record") ViewConfiguration record, @Param("example") ViewConfigurationExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int updateByPrimaryKeySelective(ViewConfiguration record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int updateByPrimaryKey(ViewConfiguration record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ViewConfigurationMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ViewConfigurationMetadataMapper.java deleted file mode 100644 index a52b17b743..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/ViewConfigurationMetadataMapper.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.opensrp.repository.postgres.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.ViewConfigurationMetadata; -import org.opensrp.domain.postgres.ViewConfigurationMetadataExample; - -public interface ViewConfigurationMetadataMapper { - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - long countByExample(ViewConfigurationMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int deleteByExample(ViewConfigurationMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int deleteByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int insert(ViewConfigurationMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int insertSelective(ViewConfigurationMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - List selectByExample(ViewConfigurationMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - ViewConfigurationMetadata selectByPrimaryKey(Long id); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int updateByExampleSelective(@Param("record") ViewConfigurationMetadata record, - @Param("example") ViewConfigurationMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int updateByExample(@Param("record") ViewConfigurationMetadata record, - @Param("example") ViewConfigurationMetadataExample example); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int updateByPrimaryKeySelective(ViewConfigurationMetadata record); - - /** - * This method was generated by MyBatis Generator. This method corresponds to the database table - * core.view_configuration_metadata - * - * @mbg.generated Mon Apr 23 10:29:52 EAT 2018 - */ - int updateByPrimaryKey(ViewConfigurationMetadata record); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomActionMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomActionMapper.java deleted file mode 100644 index 3957fae497..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomActionMapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Action; -import org.opensrp.repository.postgres.mapper.ActionMapper; - -public interface CustomActionMapper extends ActionMapper { - - int insertSelectiveAndSetId(Action action); - - Action selectByDocumentId(String documentId); - - List selectIdsByTarget(String actionTarget); - - List selectNotExpired(@Param("offset") int offset, @Param("limit") int limit); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomActionMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomActionMetadataMapper.java deleted file mode 100644 index 1064744a21..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomActionMetadataMapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Action; -import org.opensrp.domain.postgres.ActionMetadataExample; -import org.opensrp.repository.postgres.mapper.ActionMetadataMapper; - -public interface CustomActionMetadataMapper extends ActionMetadataMapper { - - Action selectByDocumentId(String documentId); - - List selectMany(@Param("example") ActionMetadataExample example, @Param("offset") int offset, - @Param("limit") int limit); - - List selectManyBySchedule(@Param("example") ActionMetadataExample example, - @Param("scheduleName") String scheduleName, @Param("offset") int offset, @Param("limit") int limit); - - Long countAll(@Param("example") ActionMetadataExample example); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomAlertMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomAlertMapper.java deleted file mode 100644 index eb096ca438..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomAlertMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import org.opensrp.domain.postgres.Alert; -import org.opensrp.repository.postgres.mapper.AlertMapper; - -public interface CustomAlertMapper extends AlertMapper { - - int insertSelectiveAndSetId(Alert pgAlert); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomAlertMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomAlertMetadataMapper.java deleted file mode 100644 index 1a14b98dcc..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomAlertMetadataMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Alert; -import org.opensrp.domain.postgres.AlertMetadataExample; -import org.opensrp.repository.postgres.mapper.AlertMetadataMapper; - -public interface CustomAlertMetadataMapper extends AlertMetadataMapper { - - Alert selectByDocumentId(String documentId); - - List selectMany(@Param("example") AlertMetadataExample example, @Param("offset") int offset, - @Param("limit") int limit); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomCampaignMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomCampaignMapper.java deleted file mode 100644 index 2018a7ebed..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomCampaignMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import org.opensrp.domain.postgres.Campaign; -import org.opensrp.repository.postgres.mapper.CampaignMapper; - -public interface CustomCampaignMapper extends CampaignMapper { - - int insertSelectiveAndSetId(Campaign campaign); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomCampaignMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomCampaignMetadataMapper.java deleted file mode 100644 index afdabdd6b2..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomCampaignMetadataMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Campaign; -import org.opensrp.domain.postgres.CampaignMetadataExample; -import org.opensrp.repository.postgres.mapper.CampaignMetadataMapper; - -public interface CustomCampaignMetadataMapper extends CampaignMetadataMapper { - - Campaign selectByIdentifier(String identifier); - - List selectMany(@Param("example") CampaignMetadataExample campaignMetadataExample, - @Param("offset") int offset, @Param("limit") int limit); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomClientMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomClientMapper.java deleted file mode 100644 index c1eac81dcf..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomClientMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.Date; -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Client; -import org.opensrp.repository.postgres.mapper.ClientMapper; - -public interface CustomClientMapper extends ClientMapper { - - int insertSelectiveAndSetId(Client record); - - Client selectByDocumentId(String documentId); - - List selectByIdentifier(String identifier); - - List selectByIdentifierOfType(@Param("identifierType") String identifierType, - @Param("identifier") String identifier); - - List selectByAttributeOfType(@Param("attributeType") String attributeType, @Param("attribute") String attribute); - - List selectByRelationshipIdAndDateCreated(@Param("relationalId") String relationalId, - @Param("dateFrom") Date date, @Param("dateTo") Date date2); - - List selectByRelationshipIdOfType(@Param("relationshipType") String relationshipType, - @Param("relationshipId") String relationshipId); - - List selectByRelationShip(String relationshipId); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomClientMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomClientMetadataMapper.java deleted file mode 100644 index 55c520969b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomClientMetadataMapper.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Client; -import org.opensrp.domain.postgres.ClientMetadataExample; -import org.opensrp.domain.postgres.CustomClient; -import org.opensrp.domain.postgres.HouseholdClient; -import org.opensrp.repository.postgres.mapper.ClientMetadataMapper; -import org.opensrp.search.AddressSearchBean; -import org.opensrp.search.ClientSearchBean; - -public interface CustomClientMetadataMapper extends ClientMetadataMapper { - - List selectMany(@Param("example") ClientMetadataExample example, @Param("offset") int offset, - @Param("limit") int limit); - - Client selectOne(String baseEntityId); - - Client selectByDocumentId(String documentId); - - List selectBySearchBean(@Param("clientBean") ClientSearchBean searchBean, - @Param("addressBean") AddressSearchBean addressSearchBean, @Param("offset") int offset, - @Param("limit") int limit); - - HouseholdClient selectHouseholdCountBySearchBean(@Param("clientBean") ClientSearchBean searchBean, - @Param("addressBean") AddressSearchBean addressSearchBean); - - List selectByName(@Param("name") String nameMatches, @Param("offset") int offset, @Param("limit") int limit); - - List selectMemberCountHouseholdHeadProviderByClients(@Param("example") ClientMetadataExample example, - @Param("clientType") String clientType); - - List selectMembersByRelationshipId(@Param("baseEntityId") String baseEntityId); - - List selectAllClientsBySearchBean(@Param("clientBean") ClientSearchBean searchBean, - @Param("addressBean") AddressSearchBean addressSearchBean, - @Param("offset") int offset, @Param("limit") int limit); - - HouseholdClient selectCountAllClientsBySearchBean(@Param("clientBean") ClientSearchBean searchBean, - @Param("addressBean") AddressSearchBean addressSearchBean); - - List selectHouseholdBySearchBean(@Param("clientBean") ClientSearchBean searchBean, - @Param("addressBean") AddressSearchBean addressSearchBean, - @Param("offset") int offset, @Param("limit") int limit); - - List selectANCBySearchBean(@Param("clientBean") ClientSearchBean searchBean, - @Param("addressBean") AddressSearchBean addressSearchBean, - @Param("offset") int offset, @Param("limit") int limit); - - int selectCountANCBySearchBean(@Param("clientBean") ClientSearchBean searchBean, - @Param("addressBean") AddressSearchBean addressSearchBean); - - List selectChildBySearchBean(@Param("clientBean") ClientSearchBean searchBean, - @Param("addressBean") AddressSearchBean addressSearchBean, - @Param("offset") int offset, @Param("limit") int limit); - - int selectCountChildBySearchBean(@Param("clientBean") ClientSearchBean searchBean, - @Param("addressBean") AddressSearchBean addressSearchBean); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomErrorTraceMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomErrorTraceMapper.java deleted file mode 100644 index 030e066f91..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomErrorTraceMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.ErrorTrace; -import org.opensrp.domain.postgres.ErrorTraceExample; -import org.opensrp.repository.postgres.mapper.ErrorTraceMapper; - -public interface CustomErrorTraceMapper extends ErrorTraceMapper { - - List selectMany(@Param("example") ErrorTraceExample example, @Param("offset") int offset, - @Param("limit") int limit); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomEventMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomEventMapper.java deleted file mode 100644 index 69bf802874..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomEventMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.Date; -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Event; -import org.opensrp.repository.postgres.mapper.EventMapper; - -public interface CustomEventMapper extends EventMapper { - - int insertSelectiveAndSetId(Event record); - - Event selectByDocumentId(String documentId); - - List selectByIdentifier(String identifier); - - List selectByIdentifierOfType(@Param("identifierType") String identifierType, - @Param("identifier") String identifier); - - List selectByBaseEntityIdConceptAndDate(@Param("baseEntityId") String baseEntityId, - @Param("concept") String concept, @Param("conceptValue") String conceptValue, @Param("dateFrom") Date dateFrom, - @Param("dateTo") Date dateTo); - - List selectByBaseEntityIdAndConceptParentCode(@Param("baseEntityId") String baseEntityId, - @Param("concept") String concept, @Param("parentCode") String parentCode); - - List selectByConceptAndValue(@Param("concept") String concept, @Param("conceptValue") String conceptValue); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomEventMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomEventMetadataMapper.java deleted file mode 100644 index cfb147dc68..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomEventMetadataMapper.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Event; -import org.opensrp.domain.postgres.EventMetadataExample; -import org.opensrp.repository.postgres.mapper.EventMetadataMapper; - -public interface CustomEventMetadataMapper extends EventMetadataMapper { - - Event selectByDocumentId(String documentId); - - List selectMany(EventMetadataExample eventMetadataExample); - - List selectManyWithRowBounds(@Param("example") EventMetadataExample example, @Param("offset") int offset, - @Param("limit") int limit); - - List selectNotInOpenMRSByServerVersion(@Param("from") long serverVersion, @Param("to") long calendar, - @Param("limit") int limit); - - List selectNotInOpenMRSByServerVersionAndType(@Param("eventType") String type, @Param("from") long serverVersion, - @Param("to") long calendar, @Param("limit") int limit); - - List selectManyIds(@Param("example") EventMetadataExample example); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomLocationMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomLocationMapper.java deleted file mode 100644 index 16f2195b21..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomLocationMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import org.opensrp.domain.postgres.Location; -import org.opensrp.repository.postgres.mapper.LocationMapper; - -public interface CustomLocationMapper extends LocationMapper { - - int insertSelectiveAndSetId(Location location); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomLocationMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomLocationMetadataMapper.java deleted file mode 100644 index 535f5855e5..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomLocationMetadataMapper.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; -import java.util.Map; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.LocationDetail; -import org.opensrp.domain.postgres.Location; -import org.opensrp.domain.postgres.LocationMetadataExample; -import org.opensrp.repository.postgres.mapper.LocationMetadataMapper; - -public interface CustomLocationMetadataMapper extends LocationMetadataMapper { - - Location findById(@Param("id") String id, @Param("geometry") boolean returnGeometry); - - List selectMany(@Param("example") LocationMetadataExample locationMetadataExample, @Param("offset") int offset, - @Param("limit") int limit); - - List selectManyByProperties(@Param("example") LocationMetadataExample locationMetadataExample, - @Param("properties") Map properties, @Param("geometry") boolean returnGeometry, - @Param("offset") int offset, @Param("limit") int limit); - - List selectManyWithOptionalGeometry(@Param("example") LocationMetadataExample locationMetadataExample, - @Param("geometry") boolean returnGeometry, - @Param("offset") int offset, @Param("limit") int limit); - - List selectWithChildren(@Param("example") LocationMetadataExample locationMetadataExample, - @Param("geometry") boolean returnGeometry, - @Param("locationId") String locationId, - @Param("offset") int offset, @Param("limit") int limit); - - List selectDetailsByPlanId(@Param("example") LocationMetadataExample locationMetadataExample, - @Param("planIdentifier") String planIdentifier); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomMultiMediaMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomMultiMediaMapper.java deleted file mode 100644 index cb6619531f..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomMultiMediaMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.MultiMedia; -import org.opensrp.domain.postgres.MultiMediaExample; -import org.opensrp.repository.postgres.mapper.MultiMediaMapper; - -public interface CustomMultiMediaMapper extends MultiMediaMapper { - - List selectMany(@Param("example") MultiMediaExample example, @Param("offset") int offset, - @Param("limit") int limit); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomOrganizationLocationMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomOrganizationLocationMapper.java deleted file mode 100644 index 272c426a7c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomOrganizationLocationMapper.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * - */ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.Date; -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.AssignedLocations; -import org.opensrp.domain.postgres.OrganizationLocation; -import org.opensrp.domain.postgres.OrganizationLocationExample.Criteria; -import org.opensrp.repository.postgres.mapper.OrganizationLocationMapper; - -/** - * @author Samuel Githengi created on 09/09/19 - */ -public interface CustomOrganizationLocationMapper extends OrganizationLocationMapper { - - /** - * Gets the assigned locations and plans for an organization - * - * @param organizationId - * @return - */ - List findAssignedlocationsAndPlans(@Param("oredCriteria") List oredCriteria, - @Param("orderByClause") String orderByClause, @Param("toDate") Date toDate); - - /** - * Gets the locations and plans assigned to an organization valid until now - * - * @param example the criteria for filtering - * @param orderByClause the order by clause - * @param currentDate todays date - * @return organization locations and plans assigned to an organization valid - * until now - */ - List selectByExampleAndDateTo(@Param("oredCriteria") List oredCriteria, - @Param("orderByClause") String orderByClause, @Param("currentDate") Date currentDate); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomOrganizationMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomOrganizationMapper.java deleted file mode 100644 index 58f7628529..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomOrganizationMapper.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - */ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Organization; -import org.opensrp.domain.postgres.OrganizationExample; -import org.opensrp.repository.postgres.mapper.OrganizationMapper; - -/** - * @author Samuel Githengi created on 08/30/19 - */ -public interface CustomOrganizationMapper extends OrganizationMapper { - - /** - * Return list of Organization filtered by example with offset and limit - * - * @param example used to filter organizations - * @param offset - * @param limit - * @return the list of organizations - */ - List selectMany(@Param("example") OrganizationExample example, @Param("offset") int offset, - @Param("limit") int limit); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomPlanMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomPlanMapper.java deleted file mode 100644 index 80a4902654..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomPlanMapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Plan; -import org.opensrp.domain.postgres.PlanExample; -import org.opensrp.repository.postgres.mapper.PlanMapper; - -/** - * Created by Vincent Karuri on 02/05/2019 - */ -public interface CustomPlanMapper extends PlanMapper { - List selectMany(@Param("example") PlanExample planExample, @Param("offset") int offset, - @Param("limit") int limit); - - int insertSelectiveAndSetId(Plan plan); - - List selectManyReturnOptionalFields(@Param("example") PlanExample planExample, @Param("fields") List fields, @Param("offset") int offset, - @Param("limit") int limit); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomPlanMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomPlanMetadataMapper.java deleted file mode 100644 index d04fa1ef51..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomPlanMetadataMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Plan; -import org.opensrp.domain.postgres.PlanExample; -import org.opensrp.repository.postgres.mapper.PlanMetadataMapper; - -import java.util.List; - -public interface CustomPlanMetadataMapper extends PlanMetadataMapper { - List selectMany(@Param("example") PlanExample planExample, @Param("operationalAreaIds") List operationalAreaIds, @Param("offset") int offset, - @Param("limit") int limit); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomPractitionerMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomPractitionerMapper.java deleted file mode 100644 index c7306915b7..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomPractitionerMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Practitioner; -import org.opensrp.domain.postgres.PractitionerExample; -import org.opensrp.repository.postgres.mapper.PractitionerMapper; - -import java.util.List; - -public interface CustomPractitionerMapper extends PractitionerMapper { - List selectMany(@Param("example") PractitionerExample practitionerExample, - @Param("offset") int offset, @Param("limit") int limit); - - List selectManyByOrgId(@Param("example") PractitionerExample practitionerExample, - @Param("orgId") long orgId, @Param("offset") int offset, @Param("limit") int limit); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomPractitionerRoleMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomPractitionerRoleMapper.java deleted file mode 100644 index 604869c3cb..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomPractitionerRoleMapper.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.PractitionerRole; -import org.opensrp.domain.postgres.PractitionerRoleExample; -import org.opensrp.repository.postgres.mapper.PractitionerRoleMapper; - -import java.util.List; - -public interface CustomPractitionerRoleMapper extends PractitionerRoleMapper { - List selectMany(@Param("example") PractitionerRoleExample practitionerRoleExample, - @Param("offset") int offset, @Param("limit") int limit); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomReportMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomReportMapper.java deleted file mode 100644 index d625489eab..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomReportMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Report; -import org.opensrp.repository.postgres.mapper.ReportMapper; - -public interface CustomReportMapper extends ReportMapper { - - int insertSelectiveAndSetId(Report report); - - List selectByIdentifier(@Param("identifier") String identifier, @Param("offset") int offset, - @Param("limit") int limit); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomReportMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomReportMetadataMapper.java deleted file mode 100644 index ad4b500621..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomReportMetadataMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Report; -import org.opensrp.domain.postgres.ReportMetadataExample; -import org.opensrp.repository.postgres.mapper.ReportMetadataMapper; - -public interface CustomReportMetadataMapper extends ReportMetadataMapper { - - Report selectByDocumentId(String documentId); - - List selectMany(@Param("example") ReportMetadataExample example, @Param("offset") int offset, - @Param("limit") int limit); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomSettingMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomSettingMapper.java deleted file mode 100644 index bbeacc042d..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomSettingMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import org.opensrp.domain.postgres.Settings; -import org.opensrp.repository.postgres.mapper.SettingsMapper; - -public interface CustomSettingMapper extends SettingsMapper { - - int insertSelectiveAndSetId(Settings setting); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomSettingMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomSettingMetadataMapper.java deleted file mode 100644 index 435128d056..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomSettingMetadataMapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Settings; -import org.opensrp.domain.postgres.SettingsMetadataExample; -import org.opensrp.repository.postgres.mapper.SettingsMetadataMapper; - -public interface CustomSettingMetadataMapper extends SettingsMetadataMapper { - - List selectMany(@Param("example") SettingsMetadataExample settingsExample, @Param("offset") int offset, - @Param("limit") int limit); - - Settings selectByDocumentId(String documentId); - -} - diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomStockMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomStockMapper.java deleted file mode 100644 index 724bd29873..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomStockMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import org.opensrp.domain.postgres.Stock; -import org.opensrp.repository.postgres.mapper.StockMapper; - -public interface CustomStockMapper extends StockMapper { - - int insertSelectiveAndSetId(Stock stock); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomStockMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomStockMetadataMapper.java deleted file mode 100644 index 48656bb97e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomStockMetadataMapper.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Stock; -import org.opensrp.domain.postgres.StockMetadataExample; -import org.opensrp.repository.postgres.mapper.StockMetadataMapper; -import org.opensrp.search.StockSearchBean; - -public interface CustomStockMetadataMapper extends StockMetadataMapper { - - Stock selectByDocumentId(String documentId); - - List selectMany(@Param("example") StockMetadataExample stockMetadataExample, @Param("offset") int offset, - @Param("limit") int limit); - - List selectByIdentifier(@Param("stockTypeId") String stockTypeId, @Param("offset") int offset, - @Param("limit") int limit); - - List selectManyBySearchBean(@Param("searchBean") StockSearchBean searchBean, - @Param("orderByClause") String orderByClause, @Param("offset") int offset, @Param("limit") int limit); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomStructureMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomStructureMapper.java deleted file mode 100644 index ce2a31335f..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomStructureMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Structure; -import org.opensrp.domain.postgres.StructureFamilyDetails; -import org.opensrp.repository.postgres.mapper.StructureMapper; - -public interface CustomStructureMapper extends StructureMapper { - - int insertSelectiveAndSetId(Structure structure); - - List selectStructureAndFamilyWithinRadius(@Param("latitude") double latitude, - @Param("longitude") double longitude, @Param("radius") double radius); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomStructureMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomStructureMetadataMapper.java deleted file mode 100644 index 27ae0e1cfc..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomStructureMetadataMapper.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; -import java.util.Map; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Location; -import org.opensrp.domain.postgres.Structure; -import org.opensrp.domain.postgres.StructureMetadataExample; -import org.opensrp.repository.postgres.mapper.StructureMetadataMapper; - -public interface CustomStructureMetadataMapper extends StructureMetadataMapper { - - Structure findById(@Param("id") String id, @Param("geometry") boolean returnGeometry); - - List selectMany(@Param("example") StructureMetadataExample locationMetadataExample, - @Param("offset") int offset, @Param("limit") int limit); - - List selectManyByProperties(@Param("example") StructureMetadataExample locationMetadataExample, - @Param("properties") Map properties, @Param("geometry") boolean returnGeometry, - @Param("offset") int offset, @Param("limit") int limit); - - List selectManyIds(@Param("example") StructureMetadataExample structureMetadataExample); - -} \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomTaskMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomTaskMapper.java deleted file mode 100644 index 686b15c1e0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomTaskMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import org.opensrp.domain.postgres.Task; -import org.opensrp.repository.postgres.mapper.TaskMapper; - -public interface CustomTaskMapper extends TaskMapper { - - int insertSelectiveAndSetId(Task task); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomTaskMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomTaskMetadataMapper.java deleted file mode 100644 index 46f7e24cb1..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomTaskMetadataMapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.Task; -import org.opensrp.domain.postgres.TaskMetadataExample; -import org.opensrp.repository.postgres.mapper.TaskMetadataMapper; - -public interface CustomTaskMetadataMapper extends TaskMetadataMapper { - - Task selectByIdentifier(String identifier); - - List selectMany(@Param("example") TaskMetadataExample taskMetadataExample, - @Param("offset") int offset, @Param("limit") int limit); - - List selectManyIds(@Param("example") TaskMetadataExample taskMetadataExample); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomViewConfigurationMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomViewConfigurationMapper.java deleted file mode 100644 index 0d8dce0864..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomViewConfigurationMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import org.opensrp.domain.postgres.ViewConfiguration; -import org.opensrp.repository.postgres.mapper.ViewConfigurationMapper; - -public interface CustomViewConfigurationMapper extends ViewConfigurationMapper { - - int insertSelectiveAndSetId(ViewConfiguration viewConfiguration); -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomViewConfigurationMetadataMapper.java b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomViewConfigurationMetadataMapper.java deleted file mode 100644 index d7ec35764b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/CustomViewConfigurationMetadataMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.opensrp.repository.postgres.mapper.custom; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.opensrp.domain.postgres.ViewConfiguration; -import org.opensrp.domain.postgres.ViewConfigurationMetadataExample; -import org.opensrp.repository.postgres.mapper.ViewConfigurationMetadataMapper; - -public interface CustomViewConfigurationMetadataMapper extends ViewConfigurationMetadataMapper { - - List selectMany(@Param("example") ViewConfigurationMetadataExample viewConfigurationExample, - @Param("offset") int offset, @Param("limit") int limit); - - ViewConfiguration selectByDocumentId(String documentId); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomActionMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomActionMapper.xml deleted file mode 100644 index 094073a95f..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomActionMapper.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - insert into core.action - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ActionTypeHandler}, - - - - - - - diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomActionMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomActionMetadataMapper.xml deleted file mode 100644 index 4d9251a61f..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomActionMetadataMapper.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - a.id, a.json - - - - - - - - - - - - - - and am.${criterion.condition} - - - and am.${criterion.condition} #{criterion.value} - - - and am.${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and am.${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomAlertMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomAlertMapper.xml deleted file mode 100644 index eeba8c44ea..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomAlertMapper.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - insert into core.alert - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.AlertTypeHandler}, - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomAlertMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomAlertMetadataMapper.xml deleted file mode 100644 index 7bb6bbcd6a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomAlertMetadataMapper.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - a.id, a.json - - - - - - - - - - - - - - and am.${criterion.condition} - - - and am.${criterion.condition} #{criterion.value} - - - and am.${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and am.${criterion.condition} - - #{listItem} - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomCampaignMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomCampaignMapper.xml deleted file mode 100644 index 13e104fc73..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomCampaignMapper.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - insert into core.campaign - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.CampaignTypeHandler}, - - - - - diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomCampaignMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomCampaignMetadataMapper.xml deleted file mode 100644 index b38377b055..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomCampaignMetadataMapper.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - c.id, c.json - - - - - - - - - - - - - - and cm.${criterion.condition} - - - and cm.${criterion.condition} #{criterion.value} - - - and cm.${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and cm.${criterion.condition} - - #{listItem} - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomClientMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomClientMapper.xml deleted file mode 100644 index 1c696823d2..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomClientMapper.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - insert into core.client - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ClientTypeHandler}, - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomClientMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomClientMetadataMapper.xml deleted file mode 100644 index 46c8ea7a08..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomClientMetadataMapper.xml +++ /dev/null @@ -1,948 +0,0 @@ - - - - - - c.id, c.json - - - - from core.client_metadata cm - join core.client c on cm.client_id = c.id - - - - join core.event_metadata em on cm.base_entity_id = em.base_entity_id - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - and cm.${criterion.condition} - - - and cm.${criterion.condition} #{criterion.value} - - - and cm.${criterion.condition} #{criterion.value} - and - #{criterion.secondValue} - - - and cm.${criterion.condition} - - #{listItem} - - - - - - - - - - - - - INNER JOIN - - (#{listItem}) - - vals(v) - ON (em.location_id = v) - - - - - - - - - - - - - - - and address ->> 'addressType' = #{addressBean.addressType,jdbcType=VARCHAR} - - - and address ->'addressFields' ->> 'country' = #{addressBean.country,jdbcType=VARCHAR} - - - and address ->'addressFields' ->> 'stateProvince' = #{addressBean.stateProvince,jdbcType=VARCHAR} - - - and address ->'addressFields' ->> 'cityVillage' = #{addressBean.cityVillage,jdbcType=VARCHAR} - - - and address ->'addressFields' ->> 'countyDistrict' = #{addressBean.countyDistrict,jdbcType=VARCHAR} - - - and address ->'addressFields' ->> 'town' = #{addressBean.town,jdbcType=VARCHAR} - - - and address ->'addressFields' ->> 'subTown' = #{addressBean.subTown,jdbcType=VARCHAR} - - - and address ->'addressFields' ->> 'subTown' = #{addressBean.subTown,jdbcType=VARCHAR} - - - - - - and ( cm.first_name ilike #{name} or - cm.middle_name ilike #{name} or - cm.last_name ilike #{name} or - cm.unique_id ilike #{name} or - c.json -> 'attributes' ->> 'phoneNumber' ilike #{name} - - or - em.provider_id ilike #{name} - - ) - - - - and em.entity_type = #{clientBean.clientType,jdbcType=VARCHAR} - - - - and em.provider_id = #{clientBean.providerId,jdbcType=VARCHAR} - - - and c.json->>'gender' = #{clientBean.gender,jdbcType=VARCHAR} - - - and cm.birth_date - between #{clientBean.birthdateFrom,typeHandler=org.opensrp.repository.postgres.handler.DateTimeTypeHandler} - and #{clientBean.birthdateTo,typeHandler=org.opensrp.repository.postgres.handler.DateTimeTypeHandler} - - - and (json->>'deathdate')::date - between #{clientBean.deathdateFrom,typeHandler=org.opensrp.repository.postgres.handler.DateTimeTypeHandler} - and #{clientBean.deathdateTo,typeHandler=org.opensrp.repository.postgres.handler.DateTimeTypeHandler} - - - and json -> 'attributes' ->> #{clientBean.attributeType,jdbcType=VARCHAR} = #{clientBean.attributeValue,jdbcType=VARCHAR} - - - and (json->>'dateEdited')::timestamp - between #{clientBean.lastEditFrom,typeHandler=org.opensrp.repository.postgres.handler.DateTimeTypeHandler} - and #{clientBean.lastEditTo,typeHandler=org.opensrp.repository.postgres.handler.DateTimeTypeHandler} - - - - - and c.json->>'firstName' ilike #{firstName} - - - - and c.json->>'middleName' ilike #{middleName} - - - - and c.json->>'lastName' ilike #{lastName} - - - - - json -> 'identifiers' ->> #{key,jdbcType=VARCHAR} = #{value,jdbcType=VARCHAR} - - - - - - - json -> 'attributes' ->> #{key,jdbcType=VARCHAR} = #{value,jdbcType=VARCHAR} - - - - - - - - - - - - - and ( family_first_name ilike #{name} or - family_head_first_name ilike #{name} or - family_head_last_name ilike #{name} or - phone_number = #{name} or - provider_id = #{name} or - unique_id = #{name} - ) - - - - with family_event as ( - select - em.*, - max(em.id) over(partition by em.base_entity_id) last_id - from - core.event_metadata em - where - em.entity_type = 'ec_family' - - - and em.location_id = any (array - - #{listItem} - - ) - - ), - distinct_family_event as ( - select - fe.provider_id, - fe.location_id, - fe.event_date, - fe.entity_type, - fe.event_type, - cm.relational_id, - cm.base_entity_id, - cm.unique_id, - cm.first_name family_first_name, - cm.last_name family_last_name - from - family_event fe - join core.client_metadata cm - using(base_entity_id) - where - fe.id = fe.last_id ) , - - family_head as ( - select - cm.relational_id family_base_entity_id, - cm.base_entity_id family_head_base_entity_id, - cm.first_name family_head_first_name, - cm.last_name family_head_last_name - from - core.client_metadata cm - where - cm.base_entity_id = any ( - select - relational_id - from - distinct_family_event) ) - , - - - family_head_event as ( - select - e.json ejson, - em.base_entity_id, - em.id, - max(em.id) over(partition by em.base_entity_id) last_id - from - core.event_metadata em - join core."event" e on - em.id = e.id - where - em.base_entity_id = any ( - select - family_head_base_entity_id - from - family_head ) ) - , - - family_head_last_event as ( - select - id, - ejson, - base_entity_id - from - family_head_event fhe - where - id = last_id ), - obs as ( - select - id, - base_entity_id, - jsonb_array_elements(ejson->'obs') o - from - family_head_last_event ) - , - - phoneNumber as( - select - id, - max(base_entity_id) base_entity_id, - max(o->'values'->>0) filter( - where - (o->>'formSubmissionField') = 'phone_number') phone_number - from - obs - group by - id) - , - - family_and_family_head_and_phone as( - select - pn.phone_number, - dfe.family_first_name, - dfe.family_last_name , - dfe.base_entity_id, - dfe.unique_id, - fh.family_head_first_name, - fh.family_head_last_name, - fh.family_head_base_entity_id relational_id , - concat(fh.family_head_first_name, ' ', fh.family_head_last_name) as family_head, - dfe.provider_id, - dfe.location_id - from - family_head fh - join distinct_family_event dfe on - fh.family_head_base_entity_id = dfe.relational_id - join phoneNumber pn on - fh.family_head_base_entity_id = pn.base_entity_id - - - - - - - - ), - - member_count as ( - select - relational_id, - count(*) as member_count - from - core.client_metadata cm - where - relational_id = any ( - select - base_entity_id - from - family_and_family_head_and_phone) - group by - relational_id ), - - family_and_family_head_and_phone_member_count as( - select - ffhp.*, - member_count, - c."json", - c."json"->>'dateCreated' , - c.date_deleted, - c.id - - from - family_and_family_head_and_phone ffhp - join member_count mc on ffhp.base_entity_id = mc.relational_id - join core.client c on c."json"->>'baseEntityId' = ffhp.base_entity_id - ) - - - - - - - - - - - - - - - - - - - - - and ( cm.first_name ilike #{name} or - cm.middle_name ilike #{name} or - cm.last_name ilike #{name} or - cm.unique_id ilike #{name} - ) - - - - and em.entity_type != #{clientBean.clientType,jdbcType=VARCHAR} - - - - and c.json->>'gender' = #{clientBean.gender,jdbcType=VARCHAR} - - - - - - - and ( cm.first_name ilike #{name} or - cm.middle_name ilike #{name} or - cm.last_name ilike #{name} or - fh.family_head ilike #{name} or - cm.unique_id ilike #{name} - ) - - - - and cm.gender = #{clientBean.gender,jdbcType=VARCHAR} - - - - - with anc_event as( - select - e.json, - em.event_type, - em.location_id, - em.provider_id, - em.event_date, - em.base_entity_id, - em.id, - max(em.id) over(partition by em.base_entity_id) last_id - from - core.event_metadata em - join core."event" e on - em.id = e.id - where - (em.event_type = 'Update ANC Registration' - or em.event_type = 'ANC Registration') - - and em.location_id = any (array - - #{listItem} - - ) - - ) - , - last_anc_event as ( - select - em.id, - em.last_id, - cm.base_entity_id, - em.event_type, - cm.first_name, - cm.last_name, - cm.middle_name, - cm.unique_id, - cm.relational_id, - cm.birth_date, - em.json as ejson , - em.provider_id, - em.event_date, - em.location_id - from - anc_event em - join core.client_metadata cm on - em.base_entity_id = cm.base_entity_id - where - em.id = em.last_id ), - anc_event_client as ( - select - c.json, - c.id, - ce.ejson , - ce.base_entity_id, - ce.provider_id, - ce.event_date, - ce.location_id, - ce.relational_id, - extract(year - from - age(current_date, ce.birth_date)) :: int as age_year_part, - extract(month - from - age(current_date, ce.birth_date)) :: int as age_month_part, - ce.first_name, - ce.unique_id, - ce.middle_name, - ce.last_name - from - last_anc_event ce - join core.client as c on - c.json->>'baseEntityId' = ce.base_entity_id ), - obs as( - select - id, - jsonb_array_elements(ejson->'obs') o - from - anc_event_client ) , - last_obs as( - select - id, - max(to_date((o->'values'->>0), 'dd-mm-yyyy')) filter( - where - (o->>'formSubmissionField') = 'edd_note') edd, - max(to_date((o->'values'->>0), 'dd-mm-yyyy')) filter( - where - (o->>'formSubmissionField') = 'last_menstrual_period') lmp, - max(floor(extract(days from (now() - to_date((o->'values'->>0), 'dd-mm-yyyy') )) / 7)) filter( - where - (o->>'formSubmissionField') = 'last_menstrual_period' ) gestAge - from - obs - group by - id), - family_head as ( - select - cm.base_entity_id, - concat(cm.first_name, ' ', cm.last_name) as family_head - from - core.client_metadata cm - where - cm.base_entity_id = any ( - select - relational_id - from - anc_event_client) ), - anc_list as ( - select - cl.first_name, - cl.last_name, - cl.middle_name, - cl.unique_id, - cl.age_year_part, - cl.age_month_part, - cl.relational_id, - cl.event_date last_contact_date, - cl.provider_id, - cl.json , - edd, - coalesce(lmp,(edd- interval '180 DAY')::date) as lmp, - coalesce(gestAge, floor(extract(days from(now()-(edd- interval '180 DAY')::date))/ 7)) gestational_age - from - last_obs, - anc_event_client as cl - where - last_obs.id = cl.id - - and Date(edd) between '${clientBean.startDate}' and '${clientBean.endDate}' - - - ) - - - - - with child_event as( - select - e.json, - em.event_type, - em.location_id, - em.provider_id, - em.event_date, - em.base_entity_id, - em.id, - max(em.id) over(partition by em.base_entity_id) last_id - from - core.event_metadata em - join core."event" e on - em.id = e.id - where - (em.event_type = 'Child Registration' - or em.event_type = 'Update Child Registration' - or em.event_type = 'PNC Child Registration') - - and em.location_id = any (array - - #{listItem} - - ) - - ), - last_event as( - select - ce.id, - ce.last_id, - cm.base_entity_id, - ce.event_type, - cm.first_name, - cm.unique_id, - cm.last_name, - cm.middle_name, - cm.relational_id, - cm.birth_date, - ce.json as ejson , - ce.provider_id, - ce.event_date, - ce.location_id - from - child_event ce - join core.client_metadata cm on - ce.base_entity_id = cm.base_entity_id - where - ce.id = ce.last_id ) , - child_client as ( - select - c.json, - c.id, - le.provider_id, - le.event_date last_contact_date, - le.location_id, - le.base_entity_id, - le.first_name, - le.last_name, - le.middle_name, - le.birth_date, - le.unique_id, - le.relational_id, - c."json"->>'gender' gender, - extract(year - from - age(current_date, le.birth_date)) :: int as age_year_part , - extract(month - from - age(current_date, le.birth_date)) :: int as age_month_part , - extract(day - from - age(current_date, le.birth_date)) :: int as day , - (date_part('day', current_date::timestamp - le.birth_date::timestamp))/ 365.25 years - from - last_event le - join core.client as c on - c.json->>'baseEntityId' = le.base_entity_id ), - family_head as ( - select - cm.base_entity_id, - concat(cm.first_name, ' ', cm.last_name) as family_head - from - core.client_metadata cm - where - cm.base_entity_id = any ( - select - relational_id - from - child_client) ) - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomErrorTraceMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomErrorTraceMapper.xml deleted file mode 100644 index c54e82f5cd..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomErrorTraceMapper.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomEventMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomEventMapper.xml deleted file mode 100644 index 8486415755..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomEventMapper.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - id, json - - - - - - - insert into core.event - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.EventTypeHandler}, - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomEventMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomEventMetadataMapper.xml deleted file mode 100644 index 27eedbe695..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomEventMetadataMapper.xml +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - - e.id, e.json - - - - - - - - - - - and em.${criterion.condition} - - - and em.${criterion.condition} #{criterion.value} - - - and em.${criterion.condition} #{criterion.value} - and - #{criterion.secondValue} - - - and em.${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and em.${criterion.condition} - - - and em.${criterion.condition} #{criterion.value} - - - and em.${criterion.condition} #{criterion.value} - and - #{criterion.secondValue} - - - and em.${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomLocationMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomLocationMapper.xml deleted file mode 100644 index f64c719061..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomLocationMapper.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - insert into core.location - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler}, - - - - - diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomLocationMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomLocationMetadataMapper.xml deleted file mode 100644 index 44a3094b34..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomLocationMetadataMapper.xml +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - l.id, l.json - - - - l.id, l.json - 'geometry' as json - - - - - - - - - - - - - - - - and lm.${criterion.condition} - - - and lm.${criterion.condition} #{criterion.value} - - - and lm.${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and lm.${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomMultiMediaMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomMultiMediaMapper.xml deleted file mode 100644 index ed9ac78ade..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomMultiMediaMapper.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} - and - #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomOrganizationLocationMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomOrganizationLocationMapper.xml deleted file mode 100644 index 63792f25fc..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomOrganizationLocationMapper.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - p.identifier,l.geojson_id,ol.from_date,ol.to_date, org.identifier as org_identifier - - - - - - - - diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomOrganizationMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomOrganizationMapper.xml deleted file mode 100644 index 60a1866275..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomOrganizationMapper.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler} - - - - - - - - - - - - diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomPlanMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomPlanMapper.xml deleted file mode 100644 index e541b18c6d..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomPlanMapper.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} - and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - insert into core.plan - - - id, - - - identifier, - - - json, - - - date_deleted, - - - server_version, - - - - - #{id,jdbcType=BIGINT}, - - - #{identifier,jdbcType=VARCHAR}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.PlanTypeHandler}, - - - #{dateDeleted,jdbcType=TIMESTAMP}, - - - #{serverVersion,jdbcType=BIGINT}, - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomPlanMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomPlanMetadataMapper.xml deleted file mode 100644 index 7eb3dc98bc..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomPlanMetadataMapper.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - p.id, p.json, p.date_deleted, p.server_version - - - - - - - - - - - and p.${criterion.condition} - - - and p.${criterion.condition} #{criterion.value} - - - and p.${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and p.${criterion.condition} - - #{listItem} - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomPractionerMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomPractionerMapper.xml deleted file mode 100644 index 5397694262..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomPractionerMapper.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomPractitionerRoleMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomPractitionerRoleMapper.xml deleted file mode 100644 index dea10880b2..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomPractitionerRoleMapper.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomReportMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomReportMapper.xml deleted file mode 100644 index d40324007b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomReportMapper.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - insert into core.report - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ReportTypeHandler}, - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomReportMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomReportMetadataMapper.xml deleted file mode 100644 index a25aa82062..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomReportMetadataMapper.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - r.id, r.json - - - - from core.report_metadata rm - join core.report r on rm.report_id = r.id - - - - - - - - - - - - - - and rm.${criterion.condition} - - - and rm.${criterion.condition} #{criterion.value} - - - and rm.${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and rm.${criterion.condition} - - #{listItem} - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomSettingsMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomSettingsMapper.xml deleted file mode 100644 index 9a931971c0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomSettingsMapper.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - insert into core.settings - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.SettingTypeHandler}, - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomSettingsMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomSettingsMetadataMapper.xml deleted file mode 100644 index 1a752fd3b2..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomSettingsMetadataMapper.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - s.id, s.json - - - - from core.settings_metadata sm - join core.settings s on - sm.settings_id = - s.id - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} - and - #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomStockMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomStockMapper.xml deleted file mode 100644 index 7e0b6a6442..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomStockMapper.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - insert into core.stock - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.StockTypeHandler}, - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomStockMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomStockMetadataMapper.xml deleted file mode 100644 index b8d68c75be..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomStockMetadataMapper.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - s.id, s.json - - - - from core.stock_metadata sm - join core.stock s on sm.stock_id - = s.id - - - - - - - - - - - - - and sm.${criterion.condition} - - - and sm.${criterion.condition} #{criterion.value} - - - and sm.${criterion.condition} #{criterion.value} and - #{criterion.secondValue} - - - and sm.${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomStructureMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomStructureMapper.xml deleted file mode 100644 index 119303c7b2..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomStructureMapper.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - insert into core.structure - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler}, - - - - - - - - - - - - - - - - - - - diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomStructureMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomStructureMetadataMapper.xml deleted file mode 100644 index f0abbc9127..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomStructureMetadataMapper.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - s.id, s.json - - - - - s.id, s.json - 'geometry' as json - - - - - - - - - - - - - - and sm.${criterion.condition} - - - and sm.${criterion.condition} #{criterion.value} - - - and sm.${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and sm.${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomTaskMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomTaskMapper.xml deleted file mode 100644 index fcbc54ef9a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomTaskMapper.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - insert into core.task - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.TaskTypeHandler}, - - - - - diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomTaskMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomTaskMetadataMapper.xml deleted file mode 100644 index 714575031e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomTaskMetadataMapper.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - t.id, t.json - - - - - - - - - - - - - - and tm.${criterion.condition} - - - and tm.${criterion.condition} #{criterion.value} - - - and tm.${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and tm.${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomViewConfigurationMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomViewConfigurationMapper.xml deleted file mode 100644 index 40d9d414e8..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomViewConfigurationMapper.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - insert into core.view_configuration - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler}, - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomViewConfigurationMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomViewConfigurationMetadataMapper.xml deleted file mode 100644 index 7de779bcd1..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomViewConfigurationMetadataMapper.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - v.id, v.json - - - - from core.view_configuration_metadata m - join - core.view_configuration v on m.view_configuration_id = v.id - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and - #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ActionMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ActionMapper.xml deleted file mode 100644 index 5487c07a1d..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ActionMapper.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ActionTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ActionTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.ActionTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.ActionTypeHandler} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ActionTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ActionTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.ActionTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.ActionTypeHandler} - - - - - - - - - - - - id, json - - - - - - delete from core.action - where id = #{id,jdbcType=BIGINT} - - - - delete from core.action - - - - - - - insert into core.action (id, json - ) - values (#{id,jdbcType=BIGINT}, #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ActionTypeHandler} - ) - - - - insert into core.action - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ActionTypeHandler}, - - - - - - - update core.action - - - id = #{record.id,jdbcType=BIGINT}, - - - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ActionTypeHandler}, - - - - - - - - - update core.action - set id = #{record.id,jdbcType=BIGINT}, - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ActionTypeHandler} - - - - - - - update core.action - - - json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ActionTypeHandler}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.action - set json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ActionTypeHandler} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ActionMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ActionMetadataMapper.xml deleted file mode 100644 index 564024e259..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ActionMetadataMapper.xml +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, action_id, document_id, base_entity_id, server_version, provider_id, location_id, - team, team_id - - - - - - delete from core.action_metadata - where id = #{id,jdbcType=BIGINT} - - - - delete from core.action_metadata - - - - - - - insert into core.action_metadata (id, action_id, document_id, - base_entity_id, server_version, provider_id, - location_id, team, team_id - ) - values (#{id,jdbcType=BIGINT}, #{actionId,jdbcType=BIGINT}, #{documentId,jdbcType=VARCHAR}, - #{baseEntityId,jdbcType=VARCHAR}, #{serverVersion,jdbcType=BIGINT}, #{providerId,jdbcType=VARCHAR}, - #{locationId,jdbcType=VARCHAR}, #{team,jdbcType=VARCHAR}, #{teamId,jdbcType=VARCHAR} - ) - - - - insert into core.action_metadata - - - id, - - - action_id, - - - document_id, - - - base_entity_id, - - - server_version, - - - provider_id, - - - location_id, - - - team, - - - team_id, - - - - - #{id,jdbcType=BIGINT}, - - - #{actionId,jdbcType=BIGINT}, - - - #{documentId,jdbcType=VARCHAR}, - - - #{baseEntityId,jdbcType=VARCHAR}, - - - #{serverVersion,jdbcType=BIGINT}, - - - #{providerId,jdbcType=VARCHAR}, - - - #{locationId,jdbcType=VARCHAR}, - - - #{team,jdbcType=VARCHAR}, - - - #{teamId,jdbcType=VARCHAR}, - - - - - - - update core.action_metadata - - - id = #{record.id,jdbcType=BIGINT}, - - - action_id = #{record.actionId,jdbcType=BIGINT}, - - - document_id = #{record.documentId,jdbcType=VARCHAR}, - - - base_entity_id = #{record.baseEntityId,jdbcType=VARCHAR}, - - - server_version = #{record.serverVersion,jdbcType=BIGINT}, - - - provider_id = #{record.providerId,jdbcType=VARCHAR}, - - - location_id = #{record.locationId,jdbcType=VARCHAR}, - - - team = #{record.team,jdbcType=VARCHAR}, - - - team_id = #{record.teamId,jdbcType=VARCHAR}, - - - - - - - - - update core.action_metadata - set id = #{record.id,jdbcType=BIGINT}, - action_id = #{record.actionId,jdbcType=BIGINT}, - document_id = #{record.documentId,jdbcType=VARCHAR}, - base_entity_id = #{record.baseEntityId,jdbcType=VARCHAR}, - server_version = #{record.serverVersion,jdbcType=BIGINT}, - provider_id = #{record.providerId,jdbcType=VARCHAR}, - location_id = #{record.locationId,jdbcType=VARCHAR}, - team = #{record.team,jdbcType=VARCHAR}, - team_id = #{record.teamId,jdbcType=VARCHAR} - - - - - - - update core.action_metadata - - - action_id = #{actionId,jdbcType=BIGINT}, - - - document_id = #{documentId,jdbcType=VARCHAR}, - - - base_entity_id = #{baseEntityId,jdbcType=VARCHAR}, - - - server_version = #{serverVersion,jdbcType=BIGINT}, - - - provider_id = #{providerId,jdbcType=VARCHAR}, - - - location_id = #{locationId,jdbcType=VARCHAR}, - - - team = #{team,jdbcType=VARCHAR}, - - - team_id = #{teamId,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.action_metadata - set action_id = #{actionId,jdbcType=BIGINT}, - document_id = #{documentId,jdbcType=VARCHAR}, - base_entity_id = #{baseEntityId,jdbcType=VARCHAR}, - server_version = #{serverVersion,jdbcType=BIGINT}, - provider_id = #{providerId,jdbcType=VARCHAR}, - location_id = #{locationId,jdbcType=VARCHAR}, - team = #{team,jdbcType=VARCHAR}, - team_id = #{teamId,jdbcType=VARCHAR} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/AlertMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/AlertMapper.xml deleted file mode 100644 index 1c9e81f937..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/AlertMapper.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.AlertTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.AlertTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.AlertTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.AlertTypeHandler} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.AlertTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.AlertTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.AlertTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.AlertTypeHandler} - - - - - - - - - - - - id, json - - - - - - delete from core.alert - where id = #{id,jdbcType=BIGINT} - - - - delete from core.alert - - - - - - - insert into core.alert (id, json - ) - values (#{id,jdbcType=BIGINT}, #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.AlertTypeHandler} - ) - - - - insert into core.alert - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.AlertTypeHandler}, - - - - - - - update core.alert - - - id = #{record.id,jdbcType=BIGINT}, - - - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.AlertTypeHandler}, - - - - - - - - - update core.alert - set id = #{record.id,jdbcType=BIGINT}, - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.AlertTypeHandler} - - - - - - - update core.alert - - - json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.AlertTypeHandler}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.alert - set json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.AlertTypeHandler} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/AlertMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/AlertMetadataMapper.xml deleted file mode 100644 index 84ce1ac437..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/AlertMetadataMapper.xml +++ /dev/null @@ -1,381 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, alert_id, document_id, base_entity_id, server_version, provider_id, location_id, - team, team_id, is_active, trigger_name - - - - - - delete from core.alert_metadata - where id = #{id,jdbcType=BIGINT} - - - - delete from core.alert_metadata - - - - - - - insert into core.alert_metadata (id, alert_id, document_id, - base_entity_id, server_version, provider_id, - location_id, team, team_id, - is_active, trigger_name) - values (#{id,jdbcType=BIGINT}, #{alertId,jdbcType=BIGINT}, #{documentId,jdbcType=VARCHAR}, - #{baseEntityId,jdbcType=VARCHAR}, #{serverVersion,jdbcType=BIGINT}, #{providerId,jdbcType=VARCHAR}, - #{locationId,jdbcType=VARCHAR}, #{team,jdbcType=VARCHAR}, #{teamId,jdbcType=VARCHAR}, - #{isActive,jdbcType=BIT}, #{triggerName,jdbcType=VARCHAR}) - - - - insert into core.alert_metadata - - - id, - - - alert_id, - - - document_id, - - - base_entity_id, - - - server_version, - - - provider_id, - - - location_id, - - - team, - - - team_id, - - - is_active, - - - trigger_name, - - - - - #{id,jdbcType=BIGINT}, - - - #{alertId,jdbcType=BIGINT}, - - - #{documentId,jdbcType=VARCHAR}, - - - #{baseEntityId,jdbcType=VARCHAR}, - - - #{serverVersion,jdbcType=BIGINT}, - - - #{providerId,jdbcType=VARCHAR}, - - - #{locationId,jdbcType=VARCHAR}, - - - #{team,jdbcType=VARCHAR}, - - - #{teamId,jdbcType=VARCHAR}, - - - #{isActive,jdbcType=BIT}, - - - #{triggerName,jdbcType=VARCHAR}, - - - - - - - update core.alert_metadata - - - id = #{record.id,jdbcType=BIGINT}, - - - alert_id = #{record.alertId,jdbcType=BIGINT}, - - - document_id = #{record.documentId,jdbcType=VARCHAR}, - - - base_entity_id = #{record.baseEntityId,jdbcType=VARCHAR}, - - - server_version = #{record.serverVersion,jdbcType=BIGINT}, - - - provider_id = #{record.providerId,jdbcType=VARCHAR}, - - - location_id = #{record.locationId,jdbcType=VARCHAR}, - - - team = #{record.team,jdbcType=VARCHAR}, - - - team_id = #{record.teamId,jdbcType=VARCHAR}, - - - is_active = #{record.isActive,jdbcType=BIT}, - - - trigger_name = #{record.triggerName,jdbcType=VARCHAR}, - - - - - - - - - update core.alert_metadata - set id = #{record.id,jdbcType=BIGINT}, - alert_id = #{record.alertId,jdbcType=BIGINT}, - document_id = #{record.documentId,jdbcType=VARCHAR}, - base_entity_id = #{record.baseEntityId,jdbcType=VARCHAR}, - server_version = #{record.serverVersion,jdbcType=BIGINT}, - provider_id = #{record.providerId,jdbcType=VARCHAR}, - location_id = #{record.locationId,jdbcType=VARCHAR}, - team = #{record.team,jdbcType=VARCHAR}, - team_id = #{record.teamId,jdbcType=VARCHAR}, - is_active = #{record.isActive,jdbcType=BIT}, - trigger_name = #{record.triggerName,jdbcType=VARCHAR} - - - - - - - update core.alert_metadata - - - alert_id = #{alertId,jdbcType=BIGINT}, - - - document_id = #{documentId,jdbcType=VARCHAR}, - - - base_entity_id = #{baseEntityId,jdbcType=VARCHAR}, - - - server_version = #{serverVersion,jdbcType=BIGINT}, - - - provider_id = #{providerId,jdbcType=VARCHAR}, - - - location_id = #{locationId,jdbcType=VARCHAR}, - - - team = #{team,jdbcType=VARCHAR}, - - - team_id = #{teamId,jdbcType=VARCHAR}, - - - is_active = #{isActive,jdbcType=BIT}, - - - trigger_name = #{triggerName,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.alert_metadata - set alert_id = #{alertId,jdbcType=BIGINT}, - document_id = #{documentId,jdbcType=VARCHAR}, - base_entity_id = #{baseEntityId,jdbcType=VARCHAR}, - server_version = #{serverVersion,jdbcType=BIGINT}, - provider_id = #{providerId,jdbcType=VARCHAR}, - location_id = #{locationId,jdbcType=VARCHAR}, - team = #{team,jdbcType=VARCHAR}, - team_id = #{teamId,jdbcType=VARCHAR}, - is_active = #{isActive,jdbcType=BIT}, - trigger_name = #{triggerName,jdbcType=VARCHAR} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/AppStateTokenMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/AppStateTokenMapper.xml deleted file mode 100644 index 16f92d7bfc..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/AppStateTokenMapper.xml +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, name, description, value, last_edited_date - - - - - - delete from core.app_state_token - where id = #{id,jdbcType=BIGINT} - - - - delete from core.app_state_token - - - - - - - insert into core.app_state_token (id, name, description, - value, last_edited_date) - values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, - #{value,jdbcType=VARCHAR}, #{lastEditedDate,jdbcType=BIGINT}) - - - - insert into core.app_state_token - - - id, - - - name, - - - description, - - - value, - - - last_edited_date, - - - - - #{id,jdbcType=BIGINT}, - - - #{name,jdbcType=VARCHAR}, - - - #{description,jdbcType=VARCHAR}, - - - #{value,jdbcType=VARCHAR}, - - - #{lastEditedDate,jdbcType=BIGINT}, - - - - - - - update core.app_state_token - - - id = #{record.id,jdbcType=BIGINT}, - - - name = #{record.name,jdbcType=VARCHAR}, - - - description = #{record.description,jdbcType=VARCHAR}, - - - value = #{record.value,jdbcType=VARCHAR}, - - - last_edited_date = #{record.lastEditedDate,jdbcType=BIGINT}, - - - - - - - - - update core.app_state_token - set id = #{record.id,jdbcType=BIGINT}, - name = #{record.name,jdbcType=VARCHAR}, - description = #{record.description,jdbcType=VARCHAR}, - value = #{record.value,jdbcType=VARCHAR}, - last_edited_date = #{record.lastEditedDate,jdbcType=BIGINT} - - - - - - - update core.app_state_token - - - name = #{name,jdbcType=VARCHAR}, - - - description = #{description,jdbcType=VARCHAR}, - - - value = #{value,jdbcType=VARCHAR}, - - - last_edited_date = #{lastEditedDate,jdbcType=BIGINT}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.app_state_token - set name = #{name,jdbcType=VARCHAR}, - description = #{description,jdbcType=VARCHAR}, - value = #{value,jdbcType=VARCHAR}, - last_edited_date = #{lastEditedDate,jdbcType=BIGINT} - where id = #{id,jdbcType=BIGINT} - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/CampaignMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/CampaignMapper.xml deleted file mode 100644 index c4846f7835..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/CampaignMapper.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.CampaignTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.CampaignTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.CampaignTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.CampaignTypeHandler} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.CampaignTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.CampaignTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.CampaignTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.CampaignTypeHandler} - - - - - - - - - - - - id, json - - - - - - delete from core.campaign - where id = #{id,jdbcType=BIGINT} - - - - delete from core.campaign - - - - - - - insert into core.campaign (id, json - ) - values (#{id,jdbcType=BIGINT}, #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.CampaignTypeHandler} - ) - - - - insert into core.campaign - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.CampaignTypeHandler}, - - - - - - - update core.campaign - - - id = #{record.id,jdbcType=BIGINT}, - - - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.CampaignTypeHandler}, - - - - - - - - - update core.campaign - set id = #{record.id,jdbcType=BIGINT}, - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.CampaignTypeHandler} - - - - - - - update core.campaign - - - json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.CampaignTypeHandler}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.campaign - set json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.CampaignTypeHandler} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/CampaignMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/CampaignMetadataMapper.xml deleted file mode 100644 index 061aa4e11a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/CampaignMetadataMapper.xml +++ /dev/null @@ -1,271 +0,0 @@ - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, campaign_id, identifier, server_version - - - - - - delete from core.campaign_metadata - where id = #{id,jdbcType=BIGINT} - - - - delete from core.campaign_metadata - - - - - - - insert into core.campaign_metadata (id, campaign_id, identifier, - server_version) - values (#{id,jdbcType=BIGINT}, #{campaignId,jdbcType=BIGINT}, #{identifier,jdbcType=VARCHAR}, - #{serverVersion,jdbcType=BIGINT}) - - - - insert into core.campaign_metadata - - - id, - - - campaign_id, - - - identifier, - - - server_version, - - - - - #{id,jdbcType=BIGINT}, - - - #{campaignId,jdbcType=BIGINT}, - - - #{identifier,jdbcType=VARCHAR}, - - - #{serverVersion,jdbcType=BIGINT}, - - - - - - - update core.campaign_metadata - - - id = #{record.id,jdbcType=BIGINT}, - - - campaign_id = #{record.campaignId,jdbcType=BIGINT}, - - - identifier = #{record.identifier,jdbcType=VARCHAR}, - - - server_version = #{record.serverVersion,jdbcType=BIGINT}, - - - - - - - - - update core.campaign_metadata - set id = #{record.id,jdbcType=BIGINT}, - campaign_id = #{record.campaignId,jdbcType=BIGINT}, - identifier = #{record.identifier,jdbcType=VARCHAR}, - server_version = #{record.serverVersion,jdbcType=BIGINT} - - - - - - - update core.campaign_metadata - - - campaign_id = #{campaignId,jdbcType=BIGINT}, - - - identifier = #{identifier,jdbcType=VARCHAR}, - - - server_version = #{serverVersion,jdbcType=BIGINT}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.campaign_metadata - set campaign_id = #{campaignId,jdbcType=BIGINT}, - identifier = #{identifier,jdbcType=VARCHAR}, - server_version = #{serverVersion,jdbcType=BIGINT} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ClientMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ClientMapper.xml deleted file mode 100644 index d250de5988..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ClientMapper.xml +++ /dev/null @@ -1,294 +0,0 @@ - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ClientTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ClientTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.ClientTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.ClientTypeHandler} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ClientTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ClientTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.ClientTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.ClientTypeHandler} - - - - - - - - - - - - id, json, date_deleted - - - - - - delete from core.client - where id = #{id,jdbcType=BIGINT} - - - - delete from core.client - - - - - - - insert into core.client (id, json, - date_deleted) - values (#{id,jdbcType=BIGINT}, #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ClientTypeHandler}, - #{dateDeleted,jdbcType=TIMESTAMP}) - - - - insert into core.client - - - id, - - - json, - - - date_deleted, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ClientTypeHandler}, - - - #{dateDeleted,jdbcType=TIMESTAMP}, - - - - - - - update core.client - - - id = #{record.id,jdbcType=BIGINT}, - - - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ClientTypeHandler}, - - - date_deleted = #{record.dateDeleted,jdbcType=TIMESTAMP}, - - - - - - - - - update core.client - set id = #{record.id,jdbcType=BIGINT}, - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ClientTypeHandler}, - date_deleted = #{record.dateDeleted,jdbcType=TIMESTAMP} - - - - - - - update core.client - - - json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ClientTypeHandler}, - - - date_deleted = #{dateDeleted,jdbcType=TIMESTAMP}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.client - set json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ClientTypeHandler}, - date_deleted = #{dateDeleted,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ClientMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ClientMetadataMapper.xml deleted file mode 100644 index cb372ce2e1..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ClientMetadataMapper.xml +++ /dev/null @@ -1,428 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, client_id, document_id, base_entity_id, relational_id, server_version, openmrs_uuid, - unique_id, first_name, middle_name, last_name, birth_date, date_deleted, residence - - - - - - delete from core.client_metadata - where id = #{id,jdbcType=BIGINT} - - - - delete from core.client_metadata - - - - - - - insert into core.client_metadata (id, client_id, document_id, - base_entity_id, relational_id, server_version, - openmrs_uuid, unique_id, first_name, - middle_name, last_name, birth_date, - date_deleted, residence) - values (#{id,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, #{documentId,jdbcType=VARCHAR}, - #{baseEntityId,jdbcType=VARCHAR}, #{relationalId,jdbcType=VARCHAR}, #{serverVersion,jdbcType=BIGINT}, - #{openmrsUuid,jdbcType=VARCHAR}, #{uniqueId,jdbcType=VARCHAR}, #{firstName,jdbcType=VARCHAR}, - #{middleName,jdbcType=VARCHAR}, #{lastName,jdbcType=VARCHAR}, #{birthDate,jdbcType=DATE}, - #{dateDeleted,jdbcType=TIMESTAMP}, #{residence,jdbcType=VARCHAR}) - - - - insert into core.client_metadata - - - id, - - - client_id, - - - document_id, - - - base_entity_id, - - - relational_id, - - - server_version, - - - openmrs_uuid, - - - unique_id, - - - first_name, - - - middle_name, - - - last_name, - - - birth_date, - - - date_deleted, - - - residence, - - - - - #{id,jdbcType=BIGINT}, - - - #{clientId,jdbcType=BIGINT}, - - - #{documentId,jdbcType=VARCHAR}, - - - #{baseEntityId,jdbcType=VARCHAR}, - - - #{relationalId,jdbcType=VARCHAR}, - - - #{serverVersion,jdbcType=BIGINT}, - - - #{openmrsUuid,jdbcType=VARCHAR}, - - - #{uniqueId,jdbcType=VARCHAR}, - - - #{firstName,jdbcType=VARCHAR}, - - - #{middleName,jdbcType=VARCHAR}, - - - #{lastName,jdbcType=VARCHAR}, - - - #{birthDate,jdbcType=DATE}, - - - #{dateDeleted,jdbcType=TIMESTAMP}, - - - #{residence,jdbcType=VARCHAR}, - - - - - - - update core.client_metadata - - - id = #{record.id,jdbcType=BIGINT}, - - - client_id = #{record.clientId,jdbcType=BIGINT}, - - - document_id = #{record.documentId,jdbcType=VARCHAR}, - - - base_entity_id = #{record.baseEntityId,jdbcType=VARCHAR}, - - - relational_id = #{record.relationalId,jdbcType=VARCHAR}, - - - server_version = #{record.serverVersion,jdbcType=BIGINT}, - - - openmrs_uuid = #{record.openmrsUuid,jdbcType=VARCHAR}, - - - unique_id = #{record.uniqueId,jdbcType=VARCHAR}, - - - first_name = #{record.firstName,jdbcType=VARCHAR}, - - - middle_name = #{record.middleName,jdbcType=VARCHAR}, - - - last_name = #{record.lastName,jdbcType=VARCHAR}, - - - birth_date = #{record.birthDate,jdbcType=DATE}, - - - date_deleted = #{record.dateDeleted,jdbcType=TIMESTAMP}, - - - residence = #{record.residence,jdbcType=VARCHAR}, - - - - - - - - - update core.client_metadata - set id = #{record.id,jdbcType=BIGINT}, - client_id = #{record.clientId,jdbcType=BIGINT}, - document_id = #{record.documentId,jdbcType=VARCHAR}, - base_entity_id = #{record.baseEntityId,jdbcType=VARCHAR}, - relational_id = #{record.relationalId,jdbcType=VARCHAR}, - server_version = #{record.serverVersion,jdbcType=BIGINT}, - openmrs_uuid = #{record.openmrsUuid,jdbcType=VARCHAR}, - unique_id = #{record.uniqueId,jdbcType=VARCHAR}, - first_name = #{record.firstName,jdbcType=VARCHAR}, - middle_name = #{record.middleName,jdbcType=VARCHAR}, - last_name = #{record.lastName,jdbcType=VARCHAR}, - birth_date = #{record.birthDate,jdbcType=DATE}, - date_deleted = #{record.dateDeleted,jdbcType=TIMESTAMP}, - residence = #{record.residence,jdbcType=VARCHAR} - - - - - - - update core.client_metadata - - - client_id = #{clientId,jdbcType=BIGINT}, - - - document_id = #{documentId,jdbcType=VARCHAR}, - - - base_entity_id = #{baseEntityId,jdbcType=VARCHAR}, - - - relational_id = #{relationalId,jdbcType=VARCHAR}, - - - server_version = #{serverVersion,jdbcType=BIGINT}, - - - openmrs_uuid = #{openmrsUuid,jdbcType=VARCHAR}, - - - unique_id = #{uniqueId,jdbcType=VARCHAR}, - - - first_name = #{firstName,jdbcType=VARCHAR}, - - - middle_name = #{middleName,jdbcType=VARCHAR}, - - - last_name = #{lastName,jdbcType=VARCHAR}, - - - birth_date = #{birthDate,jdbcType=DATE}, - - - date_deleted = #{dateDeleted,jdbcType=TIMESTAMP}, - - - residence = #{residence,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.client_metadata - set client_id = #{clientId,jdbcType=BIGINT}, - document_id = #{documentId,jdbcType=VARCHAR}, - base_entity_id = #{baseEntityId,jdbcType=VARCHAR}, - relational_id = #{relationalId,jdbcType=VARCHAR}, - server_version = #{serverVersion,jdbcType=BIGINT}, - openmrs_uuid = #{openmrsUuid,jdbcType=VARCHAR}, - unique_id = #{uniqueId,jdbcType=VARCHAR}, - first_name = #{firstName,jdbcType=VARCHAR}, - middle_name = #{middleName,jdbcType=VARCHAR}, - last_name = #{lastName,jdbcType=VARCHAR}, - birth_date = #{birthDate,jdbcType=DATE}, - date_deleted = #{dateDeleted,jdbcType=TIMESTAMP}, - residence = #{residence,jdbcType=VARCHAR} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ErrorTraceMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ErrorTraceMapper.xml deleted file mode 100644 index 9fa1753e4e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ErrorTraceMapper.xml +++ /dev/null @@ -1,381 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, document_id, date_occurred, error_type, occurred_at, stack_trace, status, record_id, - date_closed, document_type, retry_url - - - - - - delete from error.error_trace - where id = #{id,jdbcType=BIGINT} - - - - delete from error.error_trace - - - - - - - insert into error.error_trace (id, document_id, date_occurred, - error_type, occurred_at, stack_trace, - status, record_id, date_closed, - document_type, retry_url) - values (#{id,jdbcType=BIGINT}, #{documentId,jdbcType=VARCHAR}, #{dateOccurred,jdbcType=TIMESTAMP}, - #{errorType,jdbcType=VARCHAR}, #{occurredAt,jdbcType=VARCHAR}, #{stackTrace,jdbcType=VARCHAR}, - #{status,jdbcType=VARCHAR}, #{recordId,jdbcType=VARCHAR}, #{dateClosed,jdbcType=TIMESTAMP}, - #{documentType,jdbcType=VARCHAR}, #{retryUrl,jdbcType=VARCHAR}) - - - - insert into error.error_trace - - - id, - - - document_id, - - - date_occurred, - - - error_type, - - - occurred_at, - - - stack_trace, - - - status, - - - record_id, - - - date_closed, - - - document_type, - - - retry_url, - - - - - #{id,jdbcType=BIGINT}, - - - #{documentId,jdbcType=VARCHAR}, - - - #{dateOccurred,jdbcType=TIMESTAMP}, - - - #{errorType,jdbcType=VARCHAR}, - - - #{occurredAt,jdbcType=VARCHAR}, - - - #{stackTrace,jdbcType=VARCHAR}, - - - #{status,jdbcType=VARCHAR}, - - - #{recordId,jdbcType=VARCHAR}, - - - #{dateClosed,jdbcType=TIMESTAMP}, - - - #{documentType,jdbcType=VARCHAR}, - - - #{retryUrl,jdbcType=VARCHAR}, - - - - - - - update error.error_trace - - - id = #{record.id,jdbcType=BIGINT}, - - - document_id = #{record.documentId,jdbcType=VARCHAR}, - - - date_occurred = #{record.dateOccurred,jdbcType=TIMESTAMP}, - - - error_type = #{record.errorType,jdbcType=VARCHAR}, - - - occurred_at = #{record.occurredAt,jdbcType=VARCHAR}, - - - stack_trace = #{record.stackTrace,jdbcType=VARCHAR}, - - - status = #{record.status,jdbcType=VARCHAR}, - - - record_id = #{record.recordId,jdbcType=VARCHAR}, - - - date_closed = #{record.dateClosed,jdbcType=TIMESTAMP}, - - - document_type = #{record.documentType,jdbcType=VARCHAR}, - - - retry_url = #{record.retryUrl,jdbcType=VARCHAR}, - - - - - - - - - update error.error_trace - set id = #{record.id,jdbcType=BIGINT}, - document_id = #{record.documentId,jdbcType=VARCHAR}, - date_occurred = #{record.dateOccurred,jdbcType=TIMESTAMP}, - error_type = #{record.errorType,jdbcType=VARCHAR}, - occurred_at = #{record.occurredAt,jdbcType=VARCHAR}, - stack_trace = #{record.stackTrace,jdbcType=VARCHAR}, - status = #{record.status,jdbcType=VARCHAR}, - record_id = #{record.recordId,jdbcType=VARCHAR}, - date_closed = #{record.dateClosed,jdbcType=TIMESTAMP}, - document_type = #{record.documentType,jdbcType=VARCHAR}, - retry_url = #{record.retryUrl,jdbcType=VARCHAR} - - - - - - - update error.error_trace - - - document_id = #{documentId,jdbcType=VARCHAR}, - - - date_occurred = #{dateOccurred,jdbcType=TIMESTAMP}, - - - error_type = #{errorType,jdbcType=VARCHAR}, - - - occurred_at = #{occurredAt,jdbcType=VARCHAR}, - - - stack_trace = #{stackTrace,jdbcType=VARCHAR}, - - - status = #{status,jdbcType=VARCHAR}, - - - record_id = #{recordId,jdbcType=VARCHAR}, - - - date_closed = #{dateClosed,jdbcType=TIMESTAMP}, - - - document_type = #{documentType,jdbcType=VARCHAR}, - - - retry_url = #{retryUrl,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=BIGINT} - - - - update error.error_trace - set document_id = #{documentId,jdbcType=VARCHAR}, - date_occurred = #{dateOccurred,jdbcType=TIMESTAMP}, - error_type = #{errorType,jdbcType=VARCHAR}, - occurred_at = #{occurredAt,jdbcType=VARCHAR}, - stack_trace = #{stackTrace,jdbcType=VARCHAR}, - status = #{status,jdbcType=VARCHAR}, - record_id = #{recordId,jdbcType=VARCHAR}, - date_closed = #{dateClosed,jdbcType=TIMESTAMP}, - document_type = #{documentType,jdbcType=VARCHAR}, - retry_url = #{retryUrl,jdbcType=VARCHAR} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/EventMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/EventMapper.xml deleted file mode 100644 index c541c19ad3..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/EventMapper.xml +++ /dev/null @@ -1,294 +0,0 @@ - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.EventTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.EventTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.EventTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.EventTypeHandler} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.EventTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.EventTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.EventTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.EventTypeHandler} - - - - - - - - - - - - id, json, date_deleted - - - - - - delete from core.event - where id = #{id,jdbcType=BIGINT} - - - - delete from core.event - - - - - - - insert into core.event (id, json, - date_deleted) - values (#{id,jdbcType=BIGINT}, #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.EventTypeHandler}, - #{dateDeleted,jdbcType=TIMESTAMP}) - - - - insert into core.event - - - id, - - - json, - - - date_deleted, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.EventTypeHandler}, - - - #{dateDeleted,jdbcType=TIMESTAMP}, - - - - - - - update core.event - - - id = #{record.id,jdbcType=BIGINT}, - - - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.EventTypeHandler}, - - - date_deleted = #{record.dateDeleted,jdbcType=TIMESTAMP}, - - - - - - - - - update core.event - set id = #{record.id,jdbcType=BIGINT}, - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.EventTypeHandler}, - date_deleted = #{record.dateDeleted,jdbcType=TIMESTAMP} - - - - - - - update core.event - - - json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.EventTypeHandler}, - - - date_deleted = #{dateDeleted,jdbcType=TIMESTAMP}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.event - set json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.EventTypeHandler}, - date_deleted = #{dateDeleted,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/EventMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/EventMetadataMapper.xml deleted file mode 100644 index 937ddcaf96..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/EventMetadataMapper.xml +++ /dev/null @@ -1,476 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, event_id, document_id, base_entity_id, form_submission_id, server_version, openmrs_uuid, - event_type, event_date, entity_type, provider_id, location_id, team, team_id, date_created, - date_edited, date_deleted - - - - - - delete from core.event_metadata - where id = #{id,jdbcType=BIGINT} - - - - delete from core.event_metadata - - - - - - - insert into core.event_metadata (id, event_id, document_id, - base_entity_id, form_submission_id, server_version, - openmrs_uuid, event_type, event_date, - entity_type, provider_id, location_id, - team, team_id, date_created, - date_edited, date_deleted) - values (#{id,jdbcType=BIGINT}, #{eventId,jdbcType=BIGINT}, #{documentId,jdbcType=VARCHAR}, - #{baseEntityId,jdbcType=VARCHAR}, #{formSubmissionId,jdbcType=VARCHAR}, #{serverVersion,jdbcType=BIGINT}, - #{openmrsUuid,jdbcType=VARCHAR}, #{eventType,jdbcType=VARCHAR}, #{eventDate,jdbcType=TIMESTAMP}, - #{entityType,jdbcType=VARCHAR}, #{providerId,jdbcType=VARCHAR}, #{locationId,jdbcType=VARCHAR}, - #{team,jdbcType=VARCHAR}, #{teamId,jdbcType=VARCHAR}, #{dateCreated,jdbcType=TIMESTAMP}, - #{dateEdited,jdbcType=TIMESTAMP}, #{dateDeleted,jdbcType=TIMESTAMP}) - - - - insert into core.event_metadata - - - id, - - - event_id, - - - document_id, - - - base_entity_id, - - - form_submission_id, - - - server_version, - - - openmrs_uuid, - - - event_type, - - - event_date, - - - entity_type, - - - provider_id, - - - location_id, - - - team, - - - team_id, - - - date_created, - - - date_edited, - - - date_deleted, - - - - - #{id,jdbcType=BIGINT}, - - - #{eventId,jdbcType=BIGINT}, - - - #{documentId,jdbcType=VARCHAR}, - - - #{baseEntityId,jdbcType=VARCHAR}, - - - #{formSubmissionId,jdbcType=VARCHAR}, - - - #{serverVersion,jdbcType=BIGINT}, - - - #{openmrsUuid,jdbcType=VARCHAR}, - - - #{eventType,jdbcType=VARCHAR}, - - - #{eventDate,jdbcType=TIMESTAMP}, - - - #{entityType,jdbcType=VARCHAR}, - - - #{providerId,jdbcType=VARCHAR}, - - - #{locationId,jdbcType=VARCHAR}, - - - #{team,jdbcType=VARCHAR}, - - - #{teamId,jdbcType=VARCHAR}, - - - #{dateCreated,jdbcType=TIMESTAMP}, - - - #{dateEdited,jdbcType=TIMESTAMP}, - - - #{dateDeleted,jdbcType=TIMESTAMP}, - - - - - - - update core.event_metadata - - - id = #{record.id,jdbcType=BIGINT}, - - - event_id = #{record.eventId,jdbcType=BIGINT}, - - - document_id = #{record.documentId,jdbcType=VARCHAR}, - - - base_entity_id = #{record.baseEntityId,jdbcType=VARCHAR}, - - - form_submission_id = #{record.formSubmissionId,jdbcType=VARCHAR}, - - - server_version = #{record.serverVersion,jdbcType=BIGINT}, - - - openmrs_uuid = #{record.openmrsUuid,jdbcType=VARCHAR}, - - - event_type = #{record.eventType,jdbcType=VARCHAR}, - - - event_date = #{record.eventDate,jdbcType=TIMESTAMP}, - - - entity_type = #{record.entityType,jdbcType=VARCHAR}, - - - provider_id = #{record.providerId,jdbcType=VARCHAR}, - - - location_id = #{record.locationId,jdbcType=VARCHAR}, - - - team = #{record.team,jdbcType=VARCHAR}, - - - team_id = #{record.teamId,jdbcType=VARCHAR}, - - - date_created = #{record.dateCreated,jdbcType=TIMESTAMP}, - - - date_edited = #{record.dateEdited,jdbcType=TIMESTAMP}, - - - date_deleted = #{record.dateDeleted,jdbcType=TIMESTAMP}, - - - - - - - - - update core.event_metadata - set id = #{record.id,jdbcType=BIGINT}, - event_id = #{record.eventId,jdbcType=BIGINT}, - document_id = #{record.documentId,jdbcType=VARCHAR}, - base_entity_id = #{record.baseEntityId,jdbcType=VARCHAR}, - form_submission_id = #{record.formSubmissionId,jdbcType=VARCHAR}, - server_version = #{record.serverVersion,jdbcType=BIGINT}, - openmrs_uuid = #{record.openmrsUuid,jdbcType=VARCHAR}, - event_type = #{record.eventType,jdbcType=VARCHAR}, - event_date = #{record.eventDate,jdbcType=TIMESTAMP}, - entity_type = #{record.entityType,jdbcType=VARCHAR}, - provider_id = #{record.providerId,jdbcType=VARCHAR}, - location_id = #{record.locationId,jdbcType=VARCHAR}, - team = #{record.team,jdbcType=VARCHAR}, - team_id = #{record.teamId,jdbcType=VARCHAR}, - date_created = #{record.dateCreated,jdbcType=TIMESTAMP}, - date_edited = #{record.dateEdited,jdbcType=TIMESTAMP}, - date_deleted = #{record.dateDeleted,jdbcType=TIMESTAMP} - - - - - - - update core.event_metadata - - - event_id = #{eventId,jdbcType=BIGINT}, - - - document_id = #{documentId,jdbcType=VARCHAR}, - - - base_entity_id = #{baseEntityId,jdbcType=VARCHAR}, - - - form_submission_id = #{formSubmissionId,jdbcType=VARCHAR}, - - - server_version = #{serverVersion,jdbcType=BIGINT}, - - - openmrs_uuid = #{openmrsUuid,jdbcType=VARCHAR}, - - - event_type = #{eventType,jdbcType=VARCHAR}, - - - event_date = #{eventDate,jdbcType=TIMESTAMP}, - - - entity_type = #{entityType,jdbcType=VARCHAR}, - - - provider_id = #{providerId,jdbcType=VARCHAR}, - - - location_id = #{locationId,jdbcType=VARCHAR}, - - - team = #{team,jdbcType=VARCHAR}, - - - team_id = #{teamId,jdbcType=VARCHAR}, - - - date_created = #{dateCreated,jdbcType=TIMESTAMP}, - - - date_edited = #{dateEdited,jdbcType=TIMESTAMP}, - - - date_deleted = #{dateDeleted,jdbcType=TIMESTAMP}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.event_metadata - set event_id = #{eventId,jdbcType=BIGINT}, - document_id = #{documentId,jdbcType=VARCHAR}, - base_entity_id = #{baseEntityId,jdbcType=VARCHAR}, - form_submission_id = #{formSubmissionId,jdbcType=VARCHAR}, - server_version = #{serverVersion,jdbcType=BIGINT}, - openmrs_uuid = #{openmrsUuid,jdbcType=VARCHAR}, - event_type = #{eventType,jdbcType=VARCHAR}, - event_date = #{eventDate,jdbcType=TIMESTAMP}, - entity_type = #{entityType,jdbcType=VARCHAR}, - provider_id = #{providerId,jdbcType=VARCHAR}, - location_id = #{locationId,jdbcType=VARCHAR}, - team = #{team,jdbcType=VARCHAR}, - team_id = #{teamId,jdbcType=VARCHAR}, - date_created = #{dateCreated,jdbcType=TIMESTAMP}, - date_edited = #{dateEdited,jdbcType=TIMESTAMP}, - date_deleted = #{dateDeleted,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/LocationMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/LocationMapper.xml deleted file mode 100644 index e3ebfb5bef..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/LocationMapper.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - - - - - - - - - - - - id, json - - - - - - delete from core.location - where id = #{id,jdbcType=BIGINT} - - - - delete from core.location - - - - - - - insert into core.location (id, json - ) - values (#{id,jdbcType=BIGINT}, #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - ) - - - - insert into core.location - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler}, - - - - - - - update core.location - - - id = #{record.id,jdbcType=BIGINT}, - - - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler}, - - - - - - - - - update core.location - set id = #{record.id,jdbcType=BIGINT}, - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - - - - - - - update core.location - - - json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.location - set json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/LocationMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/LocationMetadataMapper.xml deleted file mode 100644 index 58c9709df7..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/LocationMetadataMapper.xml +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, location_id, geojson_id, type, parent_id, uuid, status, server_version, name - - - - - - delete from core.location_metadata - where id = #{id,jdbcType=BIGINT} - - - - delete from core.location_metadata - - - - - - - insert into core.location_metadata (id, location_id, geojson_id, - type, parent_id, uuid, - status, server_version, name - ) - values (#{id,jdbcType=BIGINT}, #{locationId,jdbcType=BIGINT}, #{geojsonId,jdbcType=VARCHAR}, - #{type,jdbcType=VARCHAR}, #{parentId,jdbcType=VARCHAR}, #{uuid,jdbcType=VARCHAR}, - #{status,jdbcType=VARCHAR}, #{serverVersion,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR} - ) - - - - insert into core.location_metadata - - - id, - - - location_id, - - - geojson_id, - - - type, - - - parent_id, - - - uuid, - - - status, - - - server_version, - - - name, - - - - - #{id,jdbcType=BIGINT}, - - - #{locationId,jdbcType=BIGINT}, - - - #{geojsonId,jdbcType=VARCHAR}, - - - #{type,jdbcType=VARCHAR}, - - - #{parentId,jdbcType=VARCHAR}, - - - #{uuid,jdbcType=VARCHAR}, - - - #{status,jdbcType=VARCHAR}, - - - #{serverVersion,jdbcType=BIGINT}, - - - #{name,jdbcType=VARCHAR}, - - - - - - - update core.location_metadata - - - id = #{record.id,jdbcType=BIGINT}, - - - location_id = #{record.locationId,jdbcType=BIGINT}, - - - geojson_id = #{record.geojsonId,jdbcType=VARCHAR}, - - - type = #{record.type,jdbcType=VARCHAR}, - - - parent_id = #{record.parentId,jdbcType=VARCHAR}, - - - uuid = #{record.uuid,jdbcType=VARCHAR}, - - - status = #{record.status,jdbcType=VARCHAR}, - - - server_version = #{record.serverVersion,jdbcType=BIGINT}, - - - name = #{record.name,jdbcType=VARCHAR}, - - - - - - - - - update core.location_metadata - set id = #{record.id,jdbcType=BIGINT}, - location_id = #{record.locationId,jdbcType=BIGINT}, - geojson_id = #{record.geojsonId,jdbcType=VARCHAR}, - type = #{record.type,jdbcType=VARCHAR}, - parent_id = #{record.parentId,jdbcType=VARCHAR}, - uuid = #{record.uuid,jdbcType=VARCHAR}, - status = #{record.status,jdbcType=VARCHAR}, - server_version = #{record.serverVersion,jdbcType=BIGINT}, - name = #{record.name,jdbcType=VARCHAR} - - - - - - - update core.location_metadata - - - location_id = #{locationId,jdbcType=BIGINT}, - - - geojson_id = #{geojsonId,jdbcType=VARCHAR}, - - - type = #{type,jdbcType=VARCHAR}, - - - parent_id = #{parentId,jdbcType=VARCHAR}, - - - uuid = #{uuid,jdbcType=VARCHAR}, - - - status = #{status,jdbcType=VARCHAR}, - - - server_version = #{serverVersion,jdbcType=BIGINT}, - - - name = #{name,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.location_metadata - set location_id = #{locationId,jdbcType=BIGINT}, - geojson_id = #{geojsonId,jdbcType=VARCHAR}, - type = #{type,jdbcType=VARCHAR}, - parent_id = #{parentId,jdbcType=VARCHAR}, - uuid = #{uuid,jdbcType=VARCHAR}, - status = #{status,jdbcType=VARCHAR}, - server_version = #{serverVersion,jdbcType=BIGINT}, - name = #{name,jdbcType=VARCHAR} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/MultiMediaMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/MultiMediaMapper.xml deleted file mode 100644 index 239670e46e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/MultiMediaMapper.xml +++ /dev/null @@ -1,318 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, document_id, case_id, provider_id, content_type, file_path, file_category - - - - - - delete from core.multi_media - where id = #{id,jdbcType=BIGINT} - - - - delete from core.multi_media - - - - - - - insert into core.multi_media (id, document_id, case_id, - provider_id, content_type, file_path, - file_category) - values (#{id,jdbcType=BIGINT}, #{documentId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR}, - #{providerId,jdbcType=VARCHAR}, #{contentType,jdbcType=VARCHAR}, #{filePath,jdbcType=VARCHAR}, - #{fileCategory,jdbcType=VARCHAR}) - - - - insert into core.multi_media - - - id, - - - document_id, - - - case_id, - - - provider_id, - - - content_type, - - - file_path, - - - file_category, - - - - - #{id,jdbcType=BIGINT}, - - - #{documentId,jdbcType=VARCHAR}, - - - #{caseId,jdbcType=VARCHAR}, - - - #{providerId,jdbcType=VARCHAR}, - - - #{contentType,jdbcType=VARCHAR}, - - - #{filePath,jdbcType=VARCHAR}, - - - #{fileCategory,jdbcType=VARCHAR}, - - - - - - - update core.multi_media - - - id = #{record.id,jdbcType=BIGINT}, - - - document_id = #{record.documentId,jdbcType=VARCHAR}, - - - case_id = #{record.caseId,jdbcType=VARCHAR}, - - - provider_id = #{record.providerId,jdbcType=VARCHAR}, - - - content_type = #{record.contentType,jdbcType=VARCHAR}, - - - file_path = #{record.filePath,jdbcType=VARCHAR}, - - - file_category = #{record.fileCategory,jdbcType=VARCHAR}, - - - - - - - - - update core.multi_media - set id = #{record.id,jdbcType=BIGINT}, - document_id = #{record.documentId,jdbcType=VARCHAR}, - case_id = #{record.caseId,jdbcType=VARCHAR}, - provider_id = #{record.providerId,jdbcType=VARCHAR}, - content_type = #{record.contentType,jdbcType=VARCHAR}, - file_path = #{record.filePath,jdbcType=VARCHAR}, - file_category = #{record.fileCategory,jdbcType=VARCHAR} - - - - - - - update core.multi_media - - - document_id = #{documentId,jdbcType=VARCHAR}, - - - case_id = #{caseId,jdbcType=VARCHAR}, - - - provider_id = #{providerId,jdbcType=VARCHAR}, - - - content_type = #{contentType,jdbcType=VARCHAR}, - - - file_path = #{filePath,jdbcType=VARCHAR}, - - - file_category = #{fileCategory,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.multi_media - set document_id = #{documentId,jdbcType=VARCHAR}, - case_id = #{caseId,jdbcType=VARCHAR}, - provider_id = #{providerId,jdbcType=VARCHAR}, - content_type = #{contentType,jdbcType=VARCHAR}, - file_path = #{filePath,jdbcType=VARCHAR}, - file_category = #{fileCategory,jdbcType=VARCHAR} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/OrganizationLocationMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/OrganizationLocationMapper.xml deleted file mode 100644 index 310fd750f9..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/OrganizationLocationMapper.xml +++ /dev/null @@ -1,303 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, organization_id, location_id, plan_id, from_date, to_date - - - - - - delete from team.organization_location - where id = #{id,jdbcType=BIGINT} - - - - delete from team.organization_location - - - - - - - insert into team.organization_location (id, organization_id, location_id, - plan_id, from_date, to_date - ) - values (#{id,jdbcType=BIGINT}, #{organizationId,jdbcType=BIGINT}, #{locationId,jdbcType=BIGINT}, - #{planId,jdbcType=BIGINT}, #{fromDate,jdbcType=TIMESTAMP}, #{toDate,jdbcType=TIMESTAMP} - ) - - - - insert into team.organization_location - - - id, - - - organization_id, - - - location_id, - - - plan_id, - - - from_date, - - - to_date, - - - - - #{id,jdbcType=BIGINT}, - - - #{organizationId,jdbcType=BIGINT}, - - - #{locationId,jdbcType=BIGINT}, - - - #{planId,jdbcType=BIGINT}, - - - #{fromDate,jdbcType=TIMESTAMP}, - - - #{toDate,jdbcType=TIMESTAMP}, - - - - - - - update team.organization_location - - - id = #{record.id,jdbcType=BIGINT}, - - - organization_id = #{record.organizationId,jdbcType=BIGINT}, - - - location_id = #{record.locationId,jdbcType=BIGINT}, - - - plan_id = #{record.planId,jdbcType=BIGINT}, - - - from_date = #{record.fromDate,jdbcType=TIMESTAMP}, - - - to_date = #{record.toDate,jdbcType=TIMESTAMP}, - - - - - - - - - update team.organization_location - set id = #{record.id,jdbcType=BIGINT}, - organization_id = #{record.organizationId,jdbcType=BIGINT}, - location_id = #{record.locationId,jdbcType=BIGINT}, - plan_id = #{record.planId,jdbcType=BIGINT}, - from_date = #{record.fromDate,jdbcType=TIMESTAMP}, - to_date = #{record.toDate,jdbcType=TIMESTAMP} - - - - - - - update team.organization_location - - - organization_id = #{organizationId,jdbcType=BIGINT}, - - - location_id = #{locationId,jdbcType=BIGINT}, - - - plan_id = #{planId,jdbcType=BIGINT}, - - - from_date = #{fromDate,jdbcType=TIMESTAMP}, - - - to_date = #{toDate,jdbcType=TIMESTAMP}, - - - where id = #{id,jdbcType=BIGINT} - - - - update team.organization_location - set organization_id = #{organizationId,jdbcType=BIGINT}, - location_id = #{locationId,jdbcType=BIGINT}, - plan_id = #{planId,jdbcType=BIGINT}, - from_date = #{fromDate,jdbcType=TIMESTAMP}, - to_date = #{toDate,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/OrganizationMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/OrganizationMapper.xml deleted file mode 100644 index 9777b3645a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/OrganizationMapper.xml +++ /dev/null @@ -1,356 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler} - - - - - - - - - - - - id, identifier, active, name, type, date_deleted, parent_id - - - - - - delete from team.organization - where id = #{id,jdbcType=BIGINT} - - - - delete from team.organization - - - - - - - insert into team.organization (id, identifier, active, - name, type, - date_deleted, parent_id) - values (#{id,jdbcType=BIGINT}, #{identifier,jdbcType=VARCHAR}, #{active,jdbcType=BIT}, - #{name,jdbcType=VARCHAR}, #{type,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler}, - #{dateDeleted,jdbcType=TIMESTAMP}, #{parentId,jdbcType=BIGINT}) - - - - insert into team.organization - - - id, - - - identifier, - - - active, - - - name, - - - type, - - - date_deleted, - - - parent_id, - - - - - #{id,jdbcType=BIGINT}, - - - #{identifier,jdbcType=VARCHAR}, - - - #{active,jdbcType=BIT}, - - - #{name,jdbcType=VARCHAR}, - - - #{type,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler}, - - - #{dateDeleted,jdbcType=TIMESTAMP}, - - - #{parentId,jdbcType=BIGINT}, - - - - - - - update team.organization - - - id = #{record.id,jdbcType=BIGINT}, - - - identifier = #{record.identifier,jdbcType=VARCHAR}, - - - active = #{record.active,jdbcType=BIT}, - - - name = #{record.name,jdbcType=VARCHAR}, - - - type = #{record.type,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler}, - - - date_deleted = #{record.dateDeleted,jdbcType=TIMESTAMP}, - - - parent_id = #{record.parentId,jdbcType=BIGINT}, - - - - - - - - - update team.organization - set id = #{record.id,jdbcType=BIGINT}, - identifier = #{record.identifier,jdbcType=VARCHAR}, - active = #{record.active,jdbcType=BIT}, - name = #{record.name,jdbcType=VARCHAR}, - type = #{record.type,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler}, - date_deleted = #{record.dateDeleted,jdbcType=TIMESTAMP}, - parent_id = #{record.parentId,jdbcType=BIGINT} - - - - - - - update team.organization - - - identifier = #{identifier,jdbcType=VARCHAR}, - - - active = #{active,jdbcType=BIT}, - - - name = #{name,jdbcType=VARCHAR}, - - - type = #{type,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler}, - - - date_deleted = #{dateDeleted,jdbcType=TIMESTAMP}, - - - parent_id = #{parentId,jdbcType=BIGINT}, - - - where id = #{id,jdbcType=BIGINT} - - - - update team.organization - set identifier = #{identifier,jdbcType=VARCHAR}, - active = #{active,jdbcType=BIT}, - name = #{name,jdbcType=VARCHAR}, - type = #{type,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.CodeSystemTypeHandler}, - date_deleted = #{dateDeleted,jdbcType=TIMESTAMP}, - parent_id = #{parentId,jdbcType=BIGINT} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/PlanMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/PlanMapper.xml deleted file mode 100644 index 31fcafb49d..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/PlanMapper.xml +++ /dev/null @@ -1,324 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.PlanTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.PlanTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.PlanTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.PlanTypeHandler} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.PlanTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.PlanTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.PlanTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.PlanTypeHandler} - - - - - - - - - - - - id, identifier, json, date_deleted, server_version - - - - - - delete from core.plan - where id = #{id,jdbcType=BIGINT} - - - - delete from core.plan - - - - - - - insert into core.plan (id, identifier, json, - date_deleted, server_version) - values (#{id,jdbcType=BIGINT}, #{identifier,jdbcType=VARCHAR}, #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.PlanTypeHandler}, - #{dateDeleted,jdbcType=TIMESTAMP}, #{serverVersion,jdbcType=BIGINT}) - - - - insert into core.plan - - - id, - - - identifier, - - - json, - - - date_deleted, - - - server_version, - - - - - #{id,jdbcType=BIGINT}, - - - #{identifier,jdbcType=VARCHAR}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.PlanTypeHandler}, - - - #{dateDeleted,jdbcType=TIMESTAMP}, - - - #{serverVersion,jdbcType=BIGINT}, - - - - - - - update core.plan - - - id = #{record.id,jdbcType=BIGINT}, - - - identifier = #{record.identifier,jdbcType=VARCHAR}, - - - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.PlanTypeHandler}, - - - date_deleted = #{record.dateDeleted,jdbcType=TIMESTAMP}, - - - server_version = #{record.serverVersion,jdbcType=BIGINT}, - - - - - - - - - update core.plan - set id = #{record.id,jdbcType=BIGINT}, - identifier = #{record.identifier,jdbcType=VARCHAR}, - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.PlanTypeHandler}, - date_deleted = #{record.dateDeleted,jdbcType=TIMESTAMP}, - server_version = #{record.serverVersion,jdbcType=BIGINT} - - - - - - - update core.plan - - - identifier = #{identifier,jdbcType=VARCHAR}, - - - json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.PlanTypeHandler}, - - - date_deleted = #{dateDeleted,jdbcType=TIMESTAMP}, - - - server_version = #{serverVersion,jdbcType=BIGINT}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.plan - set identifier = #{identifier,jdbcType=VARCHAR}, - json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.PlanTypeHandler}, - date_deleted = #{dateDeleted,jdbcType=TIMESTAMP}, - server_version = #{serverVersion,jdbcType=BIGINT} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/PlanMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/PlanMetadataMapper.xml deleted file mode 100644 index 42d8cf486d..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/PlanMetadataMapper.xml +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - operational_area_id, identifier, plan_id - - - - - delete from core.plan_metadata - - - - - - - insert into core.plan_metadata (operational_area_id, identifier, plan_id - ) - values (#{operationalAreaId,jdbcType=VARCHAR}, #{identifier,jdbcType=VARCHAR}, #{planId,jdbcType=BIGINT} - ) - - - - insert into core.plan_metadata - - - operational_area_id, - - - identifier, - - - plan_id, - - - - - #{operationalAreaId,jdbcType=VARCHAR}, - - - #{identifier,jdbcType=VARCHAR}, - - - #{planId,jdbcType=BIGINT}, - - - - - - - update core.plan_metadata - - - operational_area_id = #{record.operationalAreaId,jdbcType=VARCHAR}, - - - identifier = #{record.identifier,jdbcType=VARCHAR}, - - - plan_id = #{record.planId,jdbcType=BIGINT}, - - - - - - - - - update core.plan_metadata - set operational_area_id = #{record.operationalAreaId,jdbcType=VARCHAR}, - identifier = #{record.identifier,jdbcType=VARCHAR}, - plan_id = #{record.planId,jdbcType=BIGINT} - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/PractitionerMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/PractitionerMapper.xml deleted file mode 100644 index e96b621923..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/PractitionerMapper.xml +++ /dev/null @@ -1,318 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, identifier, active, name, user_id, username, date_deleted - - - - - - delete from team.practitioner - where id = #{id,jdbcType=BIGINT} - - - - delete from team.practitioner - - - - - - - insert into team.practitioner (id, identifier, active, - name, user_id, username, - date_deleted) - values (#{id,jdbcType=BIGINT}, #{identifier,jdbcType=VARCHAR}, #{active,jdbcType=BIT}, - #{name,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, - #{dateDeleted,jdbcType=TIMESTAMP}) - - - - insert into team.practitioner - - - id, - - - identifier, - - - active, - - - name, - - - user_id, - - - username, - - - date_deleted, - - - - - #{id,jdbcType=BIGINT}, - - - #{identifier,jdbcType=VARCHAR}, - - - #{active,jdbcType=BIT}, - - - #{name,jdbcType=VARCHAR}, - - - #{userId,jdbcType=VARCHAR}, - - - #{username,jdbcType=VARCHAR}, - - - #{dateDeleted,jdbcType=TIMESTAMP}, - - - - - - - update team.practitioner - - - id = #{record.id,jdbcType=BIGINT}, - - - identifier = #{record.identifier,jdbcType=VARCHAR}, - - - active = #{record.active,jdbcType=BIT}, - - - name = #{record.name,jdbcType=VARCHAR}, - - - user_id = #{record.userId,jdbcType=VARCHAR}, - - - username = #{record.username,jdbcType=VARCHAR}, - - - date_deleted = #{record.dateDeleted,jdbcType=TIMESTAMP}, - - - - - - - - - update team.practitioner - set id = #{record.id,jdbcType=BIGINT}, - identifier = #{record.identifier,jdbcType=VARCHAR}, - active = #{record.active,jdbcType=BIT}, - name = #{record.name,jdbcType=VARCHAR}, - user_id = #{record.userId,jdbcType=VARCHAR}, - username = #{record.username,jdbcType=VARCHAR}, - date_deleted = #{record.dateDeleted,jdbcType=TIMESTAMP} - - - - - - - update team.practitioner - - - identifier = #{identifier,jdbcType=VARCHAR}, - - - active = #{active,jdbcType=BIT}, - - - name = #{name,jdbcType=VARCHAR}, - - - user_id = #{userId,jdbcType=VARCHAR}, - - - username = #{username,jdbcType=VARCHAR}, - - - date_deleted = #{dateDeleted,jdbcType=TIMESTAMP}, - - - where id = #{id,jdbcType=BIGINT} - - - - update team.practitioner - set identifier = #{identifier,jdbcType=VARCHAR}, - active = #{active,jdbcType=BIT}, - name = #{name,jdbcType=VARCHAR}, - user_id = #{userId,jdbcType=VARCHAR}, - username = #{username,jdbcType=VARCHAR}, - date_deleted = #{dateDeleted,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/PractitionerRoleMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/PractitionerRoleMapper.xml deleted file mode 100644 index 2a73961c6e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/PractitionerRoleMapper.xml +++ /dev/null @@ -1,303 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, identifier, active, organization_id, practitioner_id, code - - - - - - delete from team.practitioner_role - where id = #{id,jdbcType=BIGINT} - - - - delete from team.practitioner_role - - - - - - - insert into team.practitioner_role (id, identifier, active, - organization_id, practitioner_id, code - ) - values (#{id,jdbcType=BIGINT}, #{identifier,jdbcType=VARCHAR}, #{active,jdbcType=BIT}, - #{organizationId,jdbcType=BIGINT}, #{practitionerId,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR} - ) - - - - insert into team.practitioner_role - - - id, - - - identifier, - - - active, - - - organization_id, - - - practitioner_id, - - - code, - - - - - #{id,jdbcType=BIGINT}, - - - #{identifier,jdbcType=VARCHAR}, - - - #{active,jdbcType=BIT}, - - - #{organizationId,jdbcType=BIGINT}, - - - #{practitionerId,jdbcType=BIGINT}, - - - #{code,jdbcType=VARCHAR}, - - - - - - - update team.practitioner_role - - - id = #{record.id,jdbcType=BIGINT}, - - - identifier = #{record.identifier,jdbcType=VARCHAR}, - - - active = #{record.active,jdbcType=BIT}, - - - organization_id = #{record.organizationId,jdbcType=BIGINT}, - - - practitioner_id = #{record.practitionerId,jdbcType=BIGINT}, - - - code = #{record.code,jdbcType=VARCHAR}, - - - - - - - - - update team.practitioner_role - set id = #{record.id,jdbcType=BIGINT}, - identifier = #{record.identifier,jdbcType=VARCHAR}, - active = #{record.active,jdbcType=BIT}, - organization_id = #{record.organizationId,jdbcType=BIGINT}, - practitioner_id = #{record.practitionerId,jdbcType=BIGINT}, - code = #{record.code,jdbcType=VARCHAR} - - - - - - - update team.practitioner_role - - - identifier = #{identifier,jdbcType=VARCHAR}, - - - active = #{active,jdbcType=BIT}, - - - organization_id = #{organizationId,jdbcType=BIGINT}, - - - practitioner_id = #{practitionerId,jdbcType=BIGINT}, - - - code = #{code,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=BIGINT} - - - - update team.practitioner_role - set identifier = #{identifier,jdbcType=VARCHAR}, - active = #{active,jdbcType=BIT}, - organization_id = #{organizationId,jdbcType=BIGINT}, - practitioner_id = #{practitionerId,jdbcType=BIGINT}, - code = #{code,jdbcType=VARCHAR} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ReportMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ReportMapper.xml deleted file mode 100644 index 8c12a3f938..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ReportMapper.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ReportTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ReportTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.ReportTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.ReportTypeHandler} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ReportTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ReportTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.ReportTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.ReportTypeHandler} - - - - - - - - - - - - id, json - - - - - - delete from core.report - where id = #{id,jdbcType=BIGINT} - - - - delete from core.report - - - - - - - insert into core.report (id, json - ) - values (#{id,jdbcType=BIGINT}, #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ReportTypeHandler} - ) - - - - insert into core.report - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ReportTypeHandler}, - - - - - - - update core.report - - - id = #{record.id,jdbcType=BIGINT}, - - - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ReportTypeHandler}, - - - - - - - - - update core.report - set id = #{record.id,jdbcType=BIGINT}, - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ReportTypeHandler} - - - - - - - update core.report - - - json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ReportTypeHandler}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.report - set json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ReportTypeHandler} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ReportMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ReportMetadataMapper.xml deleted file mode 100644 index d9f03d1188..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ReportMetadataMapper.xml +++ /dev/null @@ -1,413 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, report_id, document_id, form_submission_id, base_entity_id, server_version, report_type, - report_date, provider_id, location_id, team, team_id, date_edited - - - - - - delete from core.report_metadata - where id = #{id,jdbcType=BIGINT} - - - - delete from core.report_metadata - - - - - - - insert into core.report_metadata (id, report_id, document_id, - form_submission_id, base_entity_id, server_version, - report_type, report_date, provider_id, - location_id, team, team_id, - date_edited) - values (#{id,jdbcType=BIGINT}, #{reportId,jdbcType=BIGINT}, #{documentId,jdbcType=VARCHAR}, - #{formSubmissionId,jdbcType=VARCHAR}, #{baseEntityId,jdbcType=VARCHAR}, #{serverVersion,jdbcType=BIGINT}, - #{reportType,jdbcType=VARCHAR}, #{reportDate,jdbcType=DATE}, #{providerId,jdbcType=VARCHAR}, - #{locationId,jdbcType=VARCHAR}, #{team,jdbcType=VARCHAR}, #{teamId,jdbcType=VARCHAR}, - #{dateEdited,jdbcType=DATE}) - - - - insert into core.report_metadata - - - id, - - - report_id, - - - document_id, - - - form_submission_id, - - - base_entity_id, - - - server_version, - - - report_type, - - - report_date, - - - provider_id, - - - location_id, - - - team, - - - team_id, - - - date_edited, - - - - - #{id,jdbcType=BIGINT}, - - - #{reportId,jdbcType=BIGINT}, - - - #{documentId,jdbcType=VARCHAR}, - - - #{formSubmissionId,jdbcType=VARCHAR}, - - - #{baseEntityId,jdbcType=VARCHAR}, - - - #{serverVersion,jdbcType=BIGINT}, - - - #{reportType,jdbcType=VARCHAR}, - - - #{reportDate,jdbcType=DATE}, - - - #{providerId,jdbcType=VARCHAR}, - - - #{locationId,jdbcType=VARCHAR}, - - - #{team,jdbcType=VARCHAR}, - - - #{teamId,jdbcType=VARCHAR}, - - - #{dateEdited,jdbcType=DATE}, - - - - - - - update core.report_metadata - - - id = #{record.id,jdbcType=BIGINT}, - - - report_id = #{record.reportId,jdbcType=BIGINT}, - - - document_id = #{record.documentId,jdbcType=VARCHAR}, - - - form_submission_id = #{record.formSubmissionId,jdbcType=VARCHAR}, - - - base_entity_id = #{record.baseEntityId,jdbcType=VARCHAR}, - - - server_version = #{record.serverVersion,jdbcType=BIGINT}, - - - report_type = #{record.reportType,jdbcType=VARCHAR}, - - - report_date = #{record.reportDate,jdbcType=DATE}, - - - provider_id = #{record.providerId,jdbcType=VARCHAR}, - - - location_id = #{record.locationId,jdbcType=VARCHAR}, - - - team = #{record.team,jdbcType=VARCHAR}, - - - team_id = #{record.teamId,jdbcType=VARCHAR}, - - - date_edited = #{record.dateEdited,jdbcType=DATE}, - - - - - - - - - update core.report_metadata - set id = #{record.id,jdbcType=BIGINT}, - report_id = #{record.reportId,jdbcType=BIGINT}, - document_id = #{record.documentId,jdbcType=VARCHAR}, - form_submission_id = #{record.formSubmissionId,jdbcType=VARCHAR}, - base_entity_id = #{record.baseEntityId,jdbcType=VARCHAR}, - server_version = #{record.serverVersion,jdbcType=BIGINT}, - report_type = #{record.reportType,jdbcType=VARCHAR}, - report_date = #{record.reportDate,jdbcType=DATE}, - provider_id = #{record.providerId,jdbcType=VARCHAR}, - location_id = #{record.locationId,jdbcType=VARCHAR}, - team = #{record.team,jdbcType=VARCHAR}, - team_id = #{record.teamId,jdbcType=VARCHAR}, - date_edited = #{record.dateEdited,jdbcType=DATE} - - - - - - - update core.report_metadata - - - report_id = #{reportId,jdbcType=BIGINT}, - - - document_id = #{documentId,jdbcType=VARCHAR}, - - - form_submission_id = #{formSubmissionId,jdbcType=VARCHAR}, - - - base_entity_id = #{baseEntityId,jdbcType=VARCHAR}, - - - server_version = #{serverVersion,jdbcType=BIGINT}, - - - report_type = #{reportType,jdbcType=VARCHAR}, - - - report_date = #{reportDate,jdbcType=DATE}, - - - provider_id = #{providerId,jdbcType=VARCHAR}, - - - location_id = #{locationId,jdbcType=VARCHAR}, - - - team = #{team,jdbcType=VARCHAR}, - - - team_id = #{teamId,jdbcType=VARCHAR}, - - - date_edited = #{dateEdited,jdbcType=DATE}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.report_metadata - set report_id = #{reportId,jdbcType=BIGINT}, - document_id = #{documentId,jdbcType=VARCHAR}, - form_submission_id = #{formSubmissionId,jdbcType=VARCHAR}, - base_entity_id = #{baseEntityId,jdbcType=VARCHAR}, - server_version = #{serverVersion,jdbcType=BIGINT}, - report_type = #{reportType,jdbcType=VARCHAR}, - report_date = #{reportDate,jdbcType=DATE}, - provider_id = #{providerId,jdbcType=VARCHAR}, - location_id = #{locationId,jdbcType=VARCHAR}, - team = #{team,jdbcType=VARCHAR}, - team_id = #{teamId,jdbcType=VARCHAR}, - date_edited = #{dateEdited,jdbcType=DATE} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/SettingsMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/SettingsMapper.xml deleted file mode 100644 index fbc2fad2d2..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/SettingsMapper.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.SettingTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.SettingTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.SettingTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.SettingTypeHandler} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.SettingTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.SettingTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.SettingTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.SettingTypeHandler} - - - - - - - - - - - - id, json - - - - - - delete from core.settings - where id = #{id,jdbcType=BIGINT} - - - - delete from core.settings - - - - - - - insert into core.settings (id, json - ) - values (#{id,jdbcType=BIGINT}, #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.SettingTypeHandler} - ) - - - - insert into core.settings - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.SettingTypeHandler}, - - - - - - - update core.settings - - - id = #{record.id,jdbcType=BIGINT}, - - - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.SettingTypeHandler}, - - - - - - - - - update core.settings - set id = #{record.id,jdbcType=BIGINT}, - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.SettingTypeHandler} - - - - - - - update core.settings - - - json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.SettingTypeHandler}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.settings - set json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.SettingTypeHandler} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/SettingsMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/SettingsMetadataMapper.xml deleted file mode 100644 index 85dbbece08..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/SettingsMetadataMapper.xml +++ /dev/null @@ -1,351 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, settings_id, document_id, identifier, server_version, team, team_id, provider_id, - location_id - - - - - - delete from core.settings_metadata - where id = #{id,jdbcType=BIGINT} - - - - delete from core.settings_metadata - - - - - - - insert into core.settings_metadata (id, settings_id, document_id, - identifier, server_version, team, - team_id, provider_id, location_id - ) - values (#{id,jdbcType=BIGINT}, #{settingsId,jdbcType=BIGINT}, #{documentId,jdbcType=VARCHAR}, - #{identifier,jdbcType=VARCHAR}, #{serverVersion,jdbcType=BIGINT}, #{team,jdbcType=VARCHAR}, - #{teamId,jdbcType=VARCHAR}, #{providerId,jdbcType=VARCHAR}, #{locationId,jdbcType=VARCHAR} - ) - - - - insert into core.settings_metadata - - - id, - - - settings_id, - - - document_id, - - - identifier, - - - server_version, - - - team, - - - team_id, - - - provider_id, - - - location_id, - - - - - #{id,jdbcType=BIGINT}, - - - #{settingsId,jdbcType=BIGINT}, - - - #{documentId,jdbcType=VARCHAR}, - - - #{identifier,jdbcType=VARCHAR}, - - - #{serverVersion,jdbcType=BIGINT}, - - - #{team,jdbcType=VARCHAR}, - - - #{teamId,jdbcType=VARCHAR}, - - - #{providerId,jdbcType=VARCHAR}, - - - #{locationId,jdbcType=VARCHAR}, - - - - - - - update core.settings_metadata - - - id = #{record.id,jdbcType=BIGINT}, - - - settings_id = #{record.settingsId,jdbcType=BIGINT}, - - - document_id = #{record.documentId,jdbcType=VARCHAR}, - - - identifier = #{record.identifier,jdbcType=VARCHAR}, - - - server_version = #{record.serverVersion,jdbcType=BIGINT}, - - - team = #{record.team,jdbcType=VARCHAR}, - - - team_id = #{record.teamId,jdbcType=VARCHAR}, - - - provider_id = #{record.providerId,jdbcType=VARCHAR}, - - - location_id = #{record.locationId,jdbcType=VARCHAR}, - - - - - - - - - update core.settings_metadata - set id = #{record.id,jdbcType=BIGINT}, - settings_id = #{record.settingsId,jdbcType=BIGINT}, - document_id = #{record.documentId,jdbcType=VARCHAR}, - identifier = #{record.identifier,jdbcType=VARCHAR}, - server_version = #{record.serverVersion,jdbcType=BIGINT}, - team = #{record.team,jdbcType=VARCHAR}, - team_id = #{record.teamId,jdbcType=VARCHAR}, - provider_id = #{record.providerId,jdbcType=VARCHAR}, - location_id = #{record.locationId,jdbcType=VARCHAR} - - - - - - - update core.settings_metadata - - - settings_id = #{settingsId,jdbcType=BIGINT}, - - - document_id = #{documentId,jdbcType=VARCHAR}, - - - identifier = #{identifier,jdbcType=VARCHAR}, - - - server_version = #{serverVersion,jdbcType=BIGINT}, - - - team = #{team,jdbcType=VARCHAR}, - - - team_id = #{teamId,jdbcType=VARCHAR}, - - - provider_id = #{providerId,jdbcType=VARCHAR}, - - - location_id = #{locationId,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.settings_metadata - set settings_id = #{settingsId,jdbcType=BIGINT}, - document_id = #{documentId,jdbcType=VARCHAR}, - identifier = #{identifier,jdbcType=VARCHAR}, - server_version = #{serverVersion,jdbcType=BIGINT}, - team = #{team,jdbcType=VARCHAR}, - team_id = #{teamId,jdbcType=VARCHAR}, - provider_id = #{providerId,jdbcType=VARCHAR}, - location_id = #{locationId,jdbcType=VARCHAR} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/StockMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/StockMapper.xml deleted file mode 100644 index 896b86db32..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/StockMapper.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.StockTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.StockTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.StockTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.StockTypeHandler} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.StockTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.StockTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.StockTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.StockTypeHandler} - - - - - - - - - - - - id, json - - - - - - delete from core.stock - where id = #{id,jdbcType=BIGINT} - - - - delete from core.stock - - - - - - - insert into core.stock (id, json - ) - values (#{id,jdbcType=BIGINT}, #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.StockTypeHandler} - ) - - - - insert into core.stock - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.StockTypeHandler}, - - - - - - - update core.stock - - - id = #{record.id,jdbcType=BIGINT}, - - - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.StockTypeHandler}, - - - - - - - - - update core.stock - set id = #{record.id,jdbcType=BIGINT}, - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.StockTypeHandler} - - - - - - - update core.stock - - - json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.StockTypeHandler}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.stock - set json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.StockTypeHandler} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/StockMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/StockMetadataMapper.xml deleted file mode 100644 index 9ad83783eb..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/StockMetadataMapper.xml +++ /dev/null @@ -1,333 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, stock_id, document_id, server_version, provider_id, location_id, team, team_id - - - - - - delete from core.stock_metadata - where id = #{id,jdbcType=BIGINT} - - - - delete from core.stock_metadata - - - - - - - insert into core.stock_metadata (id, stock_id, document_id, - server_version, provider_id, location_id, - team, team_id) - values (#{id,jdbcType=BIGINT}, #{stockId,jdbcType=BIGINT}, #{documentId,jdbcType=VARCHAR}, - #{serverVersion,jdbcType=BIGINT}, #{providerId,jdbcType=VARCHAR}, #{locationId,jdbcType=VARCHAR}, - #{team,jdbcType=VARCHAR}, #{teamId,jdbcType=VARCHAR}) - - - - insert into core.stock_metadata - - - id, - - - stock_id, - - - document_id, - - - server_version, - - - provider_id, - - - location_id, - - - team, - - - team_id, - - - - - #{id,jdbcType=BIGINT}, - - - #{stockId,jdbcType=BIGINT}, - - - #{documentId,jdbcType=VARCHAR}, - - - #{serverVersion,jdbcType=BIGINT}, - - - #{providerId,jdbcType=VARCHAR}, - - - #{locationId,jdbcType=VARCHAR}, - - - #{team,jdbcType=VARCHAR}, - - - #{teamId,jdbcType=VARCHAR}, - - - - - - - update core.stock_metadata - - - id = #{record.id,jdbcType=BIGINT}, - - - stock_id = #{record.stockId,jdbcType=BIGINT}, - - - document_id = #{record.documentId,jdbcType=VARCHAR}, - - - server_version = #{record.serverVersion,jdbcType=BIGINT}, - - - provider_id = #{record.providerId,jdbcType=VARCHAR}, - - - location_id = #{record.locationId,jdbcType=VARCHAR}, - - - team = #{record.team,jdbcType=VARCHAR}, - - - team_id = #{record.teamId,jdbcType=VARCHAR}, - - - - - - - - - update core.stock_metadata - set id = #{record.id,jdbcType=BIGINT}, - stock_id = #{record.stockId,jdbcType=BIGINT}, - document_id = #{record.documentId,jdbcType=VARCHAR}, - server_version = #{record.serverVersion,jdbcType=BIGINT}, - provider_id = #{record.providerId,jdbcType=VARCHAR}, - location_id = #{record.locationId,jdbcType=VARCHAR}, - team = #{record.team,jdbcType=VARCHAR}, - team_id = #{record.teamId,jdbcType=VARCHAR} - - - - - - - update core.stock_metadata - - - stock_id = #{stockId,jdbcType=BIGINT}, - - - document_id = #{documentId,jdbcType=VARCHAR}, - - - server_version = #{serverVersion,jdbcType=BIGINT}, - - - provider_id = #{providerId,jdbcType=VARCHAR}, - - - location_id = #{locationId,jdbcType=VARCHAR}, - - - team = #{team,jdbcType=VARCHAR}, - - - team_id = #{teamId,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.stock_metadata - set stock_id = #{stockId,jdbcType=BIGINT}, - document_id = #{documentId,jdbcType=VARCHAR}, - server_version = #{serverVersion,jdbcType=BIGINT}, - provider_id = #{providerId,jdbcType=VARCHAR}, - location_id = #{locationId,jdbcType=VARCHAR}, - team = #{team,jdbcType=VARCHAR}, - team_id = #{teamId,jdbcType=VARCHAR} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/StructureMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/StructureMapper.xml deleted file mode 100644 index 6f54f45b22..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/StructureMapper.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - - - - - - - - - - - - id, json - - - - - - delete from core.structure - where id = #{id,jdbcType=BIGINT} - - - - delete from core.structure - - - - - - - insert into core.structure (id, json - ) - values (#{id,jdbcType=BIGINT}, #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - ) - - - - insert into core.structure - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler}, - - - - - - - update core.structure - - - id = #{record.id,jdbcType=BIGINT}, - - - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler}, - - - - - - - - - update core.structure - set id = #{record.id,jdbcType=BIGINT}, - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - - - - - - - update core.structure - - - json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.structure - set json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.LocationTypeHandler} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/StructureMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/StructureMetadataMapper.xml deleted file mode 100644 index 2c7a859414..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/StructureMetadataMapper.xml +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, structure_id, geojson_id, type, parent_id, uuid, status, server_version, name - - - - - - delete from core.structure_metadata - where id = #{id,jdbcType=BIGINT} - - - - delete from core.structure_metadata - - - - - - - insert into core.structure_metadata (id, structure_id, geojson_id, - type, parent_id, uuid, - status, server_version, name - ) - values (#{id,jdbcType=BIGINT}, #{structureId,jdbcType=BIGINT}, #{geojsonId,jdbcType=VARCHAR}, - #{type,jdbcType=VARCHAR}, #{parentId,jdbcType=VARCHAR}, #{uuid,jdbcType=VARCHAR}, - #{status,jdbcType=VARCHAR}, #{serverVersion,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR} - ) - - - - insert into core.structure_metadata - - - id, - - - structure_id, - - - geojson_id, - - - type, - - - parent_id, - - - uuid, - - - status, - - - server_version, - - - name, - - - - - #{id,jdbcType=BIGINT}, - - - #{structureId,jdbcType=BIGINT}, - - - #{geojsonId,jdbcType=VARCHAR}, - - - #{type,jdbcType=VARCHAR}, - - - #{parentId,jdbcType=VARCHAR}, - - - #{uuid,jdbcType=VARCHAR}, - - - #{status,jdbcType=VARCHAR}, - - - #{serverVersion,jdbcType=BIGINT}, - - - #{name,jdbcType=VARCHAR}, - - - - - - - update core.structure_metadata - - - id = #{record.id,jdbcType=BIGINT}, - - - structure_id = #{record.structureId,jdbcType=BIGINT}, - - - geojson_id = #{record.geojsonId,jdbcType=VARCHAR}, - - - type = #{record.type,jdbcType=VARCHAR}, - - - parent_id = #{record.parentId,jdbcType=VARCHAR}, - - - uuid = #{record.uuid,jdbcType=VARCHAR}, - - - status = #{record.status,jdbcType=VARCHAR}, - - - server_version = #{record.serverVersion,jdbcType=BIGINT}, - - - name = #{record.name,jdbcType=VARCHAR}, - - - - - - - - - update core.structure_metadata - set id = #{record.id,jdbcType=BIGINT}, - structure_id = #{record.structureId,jdbcType=BIGINT}, - geojson_id = #{record.geojsonId,jdbcType=VARCHAR}, - type = #{record.type,jdbcType=VARCHAR}, - parent_id = #{record.parentId,jdbcType=VARCHAR}, - uuid = #{record.uuid,jdbcType=VARCHAR}, - status = #{record.status,jdbcType=VARCHAR}, - server_version = #{record.serverVersion,jdbcType=BIGINT}, - name = #{record.name,jdbcType=VARCHAR} - - - - - - - update core.structure_metadata - - - structure_id = #{structureId,jdbcType=BIGINT}, - - - geojson_id = #{geojsonId,jdbcType=VARCHAR}, - - - type = #{type,jdbcType=VARCHAR}, - - - parent_id = #{parentId,jdbcType=VARCHAR}, - - - uuid = #{uuid,jdbcType=VARCHAR}, - - - status = #{status,jdbcType=VARCHAR}, - - - server_version = #{serverVersion,jdbcType=BIGINT}, - - - name = #{name,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.structure_metadata - set structure_id = #{structureId,jdbcType=BIGINT}, - geojson_id = #{geojsonId,jdbcType=VARCHAR}, - type = #{type,jdbcType=VARCHAR}, - parent_id = #{parentId,jdbcType=VARCHAR}, - uuid = #{uuid,jdbcType=VARCHAR}, - status = #{status,jdbcType=VARCHAR}, - server_version = #{serverVersion,jdbcType=BIGINT}, - name = #{name,jdbcType=VARCHAR} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/TaskMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/TaskMapper.xml deleted file mode 100644 index 57297e67c2..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/TaskMapper.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.TaskTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.TaskTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.TaskTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.TaskTypeHandler} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.TaskTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.TaskTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.TaskTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.TaskTypeHandler} - - - - - - - - - - - - id, json - - - - - - delete from core.task - where id = #{id,jdbcType=BIGINT} - - - - delete from core.task - - - - - - - insert into core.task (id, json - ) - values (#{id,jdbcType=BIGINT}, #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.TaskTypeHandler} - ) - - - - insert into core.task - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.TaskTypeHandler}, - - - - - - - update core.task - - - id = #{record.id,jdbcType=BIGINT}, - - - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.TaskTypeHandler}, - - - - - - - - - update core.task - set id = #{record.id,jdbcType=BIGINT}, - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.TaskTypeHandler} - - - - - - - update core.task - - - json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.TaskTypeHandler}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.task - set json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.TaskTypeHandler} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/TaskMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/TaskMetadataMapper.xml deleted file mode 100644 index 83979ed3c4..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/TaskMetadataMapper.xml +++ /dev/null @@ -1,318 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, task_id, identifier, plan_identifier, group_identifier, for_entity, server_version - - - - - - delete from core.task_metadata - where id = #{id,jdbcType=BIGINT} - - - - delete from core.task_metadata - - - - - - - insert into core.task_metadata (id, task_id, identifier, - plan_identifier, group_identifier, for_entity, - server_version) - values (#{id,jdbcType=BIGINT}, #{taskId,jdbcType=BIGINT}, #{identifier,jdbcType=VARCHAR}, - #{planIdentifier,jdbcType=VARCHAR}, #{groupIdentifier,jdbcType=VARCHAR}, #{forEntity,jdbcType=VARCHAR}, - #{serverVersion,jdbcType=BIGINT}) - - - - insert into core.task_metadata - - - id, - - - task_id, - - - identifier, - - - plan_identifier, - - - group_identifier, - - - for_entity, - - - server_version, - - - - - #{id,jdbcType=BIGINT}, - - - #{taskId,jdbcType=BIGINT}, - - - #{identifier,jdbcType=VARCHAR}, - - - #{planIdentifier,jdbcType=VARCHAR}, - - - #{groupIdentifier,jdbcType=VARCHAR}, - - - #{forEntity,jdbcType=VARCHAR}, - - - #{serverVersion,jdbcType=BIGINT}, - - - - - - - update core.task_metadata - - - id = #{record.id,jdbcType=BIGINT}, - - - task_id = #{record.taskId,jdbcType=BIGINT}, - - - identifier = #{record.identifier,jdbcType=VARCHAR}, - - - plan_identifier = #{record.planIdentifier,jdbcType=VARCHAR}, - - - group_identifier = #{record.groupIdentifier,jdbcType=VARCHAR}, - - - for_entity = #{record.forEntity,jdbcType=VARCHAR}, - - - server_version = #{record.serverVersion,jdbcType=BIGINT}, - - - - - - - - - update core.task_metadata - set id = #{record.id,jdbcType=BIGINT}, - task_id = #{record.taskId,jdbcType=BIGINT}, - identifier = #{record.identifier,jdbcType=VARCHAR}, - plan_identifier = #{record.planIdentifier,jdbcType=VARCHAR}, - group_identifier = #{record.groupIdentifier,jdbcType=VARCHAR}, - for_entity = #{record.forEntity,jdbcType=VARCHAR}, - server_version = #{record.serverVersion,jdbcType=BIGINT} - - - - - - - update core.task_metadata - - - task_id = #{taskId,jdbcType=BIGINT}, - - - identifier = #{identifier,jdbcType=VARCHAR}, - - - plan_identifier = #{planIdentifier,jdbcType=VARCHAR}, - - - group_identifier = #{groupIdentifier,jdbcType=VARCHAR}, - - - for_entity = #{forEntity,jdbcType=VARCHAR}, - - - server_version = #{serverVersion,jdbcType=BIGINT}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.task_metadata - set task_id = #{taskId,jdbcType=BIGINT}, - identifier = #{identifier,jdbcType=VARCHAR}, - plan_identifier = #{planIdentifier,jdbcType=VARCHAR}, - group_identifier = #{groupIdentifier,jdbcType=VARCHAR}, - for_entity = #{forEntity,jdbcType=VARCHAR}, - server_version = #{serverVersion,jdbcType=BIGINT} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ViewConfigurationMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ViewConfigurationMapper.xml deleted file mode 100644 index 2485507200..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ViewConfigurationMapper.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler} - - - and ${criterion.condition} #{criterion.value,typeHandler=org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler} and #{criterion.secondValue,typeHandler=org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler} - - - and ${criterion.condition} - - #{listItem,typeHandler=org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler} - - - - - - - - - - - - id, json - - - - - - delete from core.view_configuration - where id = #{id,jdbcType=BIGINT} - - - - delete from core.view_configuration - - - - - - - insert into core.view_configuration (id, json - ) - values (#{id,jdbcType=BIGINT}, #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler} - ) - - - - insert into core.view_configuration - - - id, - - - json, - - - - - #{id,jdbcType=BIGINT}, - - - #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler}, - - - - - - - update core.view_configuration - - - id = #{record.id,jdbcType=BIGINT}, - - - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler}, - - - - - - - - - update core.view_configuration - set id = #{record.id,jdbcType=BIGINT}, - json = #{record.json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler} - - - - - - - update core.view_configuration - - - json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.view_configuration - set json = #{json,jdbcType=OTHER,typeHandler=org.opensrp.repository.postgres.handler.ViewConfigurationTypeHandler} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ViewConfigurationMetadataMapper.xml b/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ViewConfigurationMetadataMapper.xml deleted file mode 100644 index f3bcb5d618..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/repository/postgres/mapper/xml/ViewConfigurationMetadataMapper.xml +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - id, view_configuration_id, document_id, identifier, server_version - - - - - - delete from core.view_configuration_metadata - where id = #{id,jdbcType=BIGINT} - - - - delete from core.view_configuration_metadata - - - - - - - insert into core.view_configuration_metadata (id, view_configuration_id, document_id, - identifier, server_version) - values (#{id,jdbcType=BIGINT}, #{viewConfigurationId,jdbcType=BIGINT}, #{documentId,jdbcType=VARCHAR}, - #{identifier,jdbcType=VARCHAR}, #{serverVersion,jdbcType=BIGINT}) - - - - insert into core.view_configuration_metadata - - - id, - - - view_configuration_id, - - - document_id, - - - identifier, - - - server_version, - - - - - #{id,jdbcType=BIGINT}, - - - #{viewConfigurationId,jdbcType=BIGINT}, - - - #{documentId,jdbcType=VARCHAR}, - - - #{identifier,jdbcType=VARCHAR}, - - - #{serverVersion,jdbcType=BIGINT}, - - - - - - - update core.view_configuration_metadata - - - id = #{record.id,jdbcType=BIGINT}, - - - view_configuration_id = #{record.viewConfigurationId,jdbcType=BIGINT}, - - - document_id = #{record.documentId,jdbcType=VARCHAR}, - - - identifier = #{record.identifier,jdbcType=VARCHAR}, - - - server_version = #{record.serverVersion,jdbcType=BIGINT}, - - - - - - - - - update core.view_configuration_metadata - set id = #{record.id,jdbcType=BIGINT}, - view_configuration_id = #{record.viewConfigurationId,jdbcType=BIGINT}, - document_id = #{record.documentId,jdbcType=VARCHAR}, - identifier = #{record.identifier,jdbcType=VARCHAR}, - server_version = #{record.serverVersion,jdbcType=BIGINT} - - - - - - - update core.view_configuration_metadata - - - view_configuration_id = #{viewConfigurationId,jdbcType=BIGINT}, - - - document_id = #{documentId,jdbcType=VARCHAR}, - - - identifier = #{identifier,jdbcType=VARCHAR}, - - - server_version = #{serverVersion,jdbcType=BIGINT}, - - - where id = #{id,jdbcType=BIGINT} - - - - update core.view_configuration_metadata - set view_configuration_id = #{viewConfigurationId,jdbcType=BIGINT}, - document_id = #{documentId,jdbcType=VARCHAR}, - identifier = #{identifier,jdbcType=VARCHAR}, - server_version = #{serverVersion,jdbcType=BIGINT} - where id = #{id,jdbcType=BIGINT} - - \ No newline at end of file diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/Action.java b/opensrp-core/src/main/java/org/opensrp/scheduler/Action.java deleted file mode 100644 index 01d3633ebf..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/Action.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.opensrp.scheduler; - -import java.util.Map; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; -import org.motechproject.model.MotechBaseDataObject; -import org.motechproject.util.DateUtil; -import org.opensrp.dto.ActionData; - -/** - * The entity which helps in identifying the type of action applicable for the entity or provider - */ -@TypeDiscriminator("doc.type === 'Action'") -public class Action extends MotechBaseDataObject { - - @JsonProperty - private String providerId; - - @JsonProperty - private String baseEntityId; - - @JsonProperty - private Map data; - - @JsonProperty - private String actionTarget; - - @JsonProperty - private String actionType; - - @JsonProperty - private Boolean isActionActive; - - @JsonProperty - private long timeStamp; - - public long getTimeStamp() { - return timeStamp; - } - - @JsonProperty - private long version; - - @JsonProperty - private Map details; - - private Action() { - } - - public Action(String baseEntityId, String providerId, ActionData actionData) { - this.providerId = providerId; - this.baseEntityId = baseEntityId; - this.data = actionData.getData(); - this.actionTarget = actionData.getTarget(); - this.actionType = actionData.getType(); - this.timeStamp = DateUtil.now().getMillis(); - this.details = actionData.getDetails(); - this.isActionActive = true; - } - - public String providerId() { - return providerId; - } - - public String baseEntityId() { - return baseEntityId; - } - - public Map data() { - return data; - } - - public String getActionType() { - return actionType; - } - - @JsonIgnore - public long getTimestamp() { - return timeStamp; - } - - @JsonIgnore - public String getTarget() { - return actionTarget; - } - - public Action markAsInActive() { - this.isActionActive = false; - return this; - } - - public Boolean getIsActionActive() { - return isActionActive; - } - - public Map getDetails() { - return details; - } - - private String getBaseEntityId() { - return baseEntityId; - } - - public String getActionTarget() { - return actionTarget; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "id", "timeStamp", "revision"); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "id", "timeStamp", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/Alert.java b/opensrp-core/src/main/java/org/opensrp/scheduler/Alert.java deleted file mode 100644 index af86e0d8f3..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/Alert.java +++ /dev/null @@ -1,366 +0,0 @@ -package org.opensrp.scheduler; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; -import org.joda.time.DateTime; -import org.motechproject.model.MotechBaseDataObject; -import org.motechproject.util.DateUtil; -import org.opensrp.dto.AlertStatus; - -/** - * The entity which helps in identifying the type of action applicable for the entity or provider - */ -@TypeDiscriminator("doc.type === 'Alert'") -public class Alert extends MotechBaseDataObject { - - public enum AlertType { - notification, - reminder - } - - public enum TriggerType { - schedule, - report, - event, - caseClosed - } - - @JsonProperty - private String providerId; - - @JsonProperty - private String entityId; - - @JsonProperty - private String beneficiaryType; - - @JsonProperty - private String alertType; - - @JsonProperty - private String triggerType; - - @JsonProperty - private String triggerName; - - @JsonProperty - private String triggerCode; - - @JsonProperty - private String startDate; - - @JsonProperty - private String expiryDate; - - @JsonProperty - private String alertStatus; - - @JsonProperty - private String closingPeriod; - - @JsonProperty - private String dateClosed; - - @JsonProperty - private String dateComplete; - - @JsonProperty - private String reasonClosed; - - @JsonProperty - private Boolean isActive; - - @JsonProperty - private long timeStamp; - - @JsonProperty - private Map details; - - private Alert() { - } - - public Alert(String providerId, String entityId, String beneficiaryType, AlertType alertType, TriggerType triggerType, - String triggerName, String triggerCode, DateTime startDate, DateTime expiryDate, AlertStatus alertStatus, - Map details) { - setProviderId(providerId); - setEntityId(entityId); - setBeneficiaryType(beneficiaryType); - setAlertType(alertType.name()); - setTriggerType(triggerType.name()); - setTriggerName(triggerName); - setTriggerCode(triggerCode); - setStartDate(startDate.toLocalDate().toString()); - setExpiryDate(expiryDate.toLocalDate().toString()); - setAlertStatus(alertStatus.name()); - setIsActive(true); - setTimeStamp(DateUtil.now().getMillis()); - setDetails(details); - } - - public Alert markAlertAsClosed(String reasonForClose) { - if (alertStatus.equalsIgnoreCase(AlertStatus.closed.name()) - || alertStatus.equalsIgnoreCase(AlertStatus.complete.name())) { - throw new IllegalStateException("Alert was found " + alertStatus); - } - this.closingPeriod = this.alertStatus; - this.reasonClosed = reasonForClose; - this.alertStatus = AlertStatus.closed.name(); - this.dateClosed = getCurrentDateTime().toLocalDate().toString(); - this.isActive = false; - - return this; - } - - public Alert markAlertAsComplete(String completionDate) { - if (alertStatus.equalsIgnoreCase(AlertStatus.closed.name()) - || alertStatus.equalsIgnoreCase(AlertStatus.complete.name())) { - throw new IllegalStateException("Alert was found " + alertStatus); - } - this.dateComplete = completionDate; - this.closingPeriod = this.alertStatus; - this.alertStatus = AlertStatus.complete.name(); - this.dateClosed = getCurrentDateTime().toLocalDate().toString(); - this.isActive = false; - - return this; - } - - @JsonIgnore - public DateTime getCurrentDateTime() { - return new DateTime(); - } - - public String providerId() { - return providerId; - } - - public String entityId() { - return entityId; - } - - public String beneficiaryType() { - return beneficiaryType; - } - - public String alertType() { - return alertType; - } - - public String triggerType() { - return triggerType; - } - - public String triggerName() { - return triggerName; - } - - public String triggerCode() { - return triggerCode; - } - - public String startDate() { - return startDate; - } - - public String expiryDate() { - return expiryDate; - } - - public String alertStatus() { - return alertStatus; - } - - public String closingPeriod() { - return closingPeriod; - } - - public String dateClosed() { - return dateClosed; - } - - public String reasonClosed() { - return reasonClosed; - } - - @JsonIgnore - public Boolean isActive() { - return isActive; - } - - public long timestamp() { - return timeStamp; - } - - public Map details() { - if (details == null) { - details = new HashMap<>(); - } - return details; - } - - public Alert withDetails(String key, String val) { - if (details == null) { - details = new HashMap<>(); - } - details.put(key, val); - return this; - } - - String getProviderId() { - return providerId; - } - - String getEntityId() { - return entityId; - } - - String getBeneficiaryType() { - return beneficiaryType; - } - - String getTriggerType() { - return triggerType; - } - - String getAlertType() { - return alertType; - } - - public String getTriggerName() { - return triggerName; - } - - public void setTriggerName(String triggerName) { - this.triggerName = triggerName; - } - - public String getTriggerCode() { - return triggerCode; - } - - public void setTriggerCode(String triggerCode) { - this.triggerCode = triggerCode; - } - - public String getStartDate() { - return startDate; - } - - public void setStartDate(String startDate) { - this.startDate = startDate; - } - - public String getExpiryDate() { - return expiryDate; - } - - public void setExpiryDate(String expiryDate) { - this.expiryDate = expiryDate; - } - - public String getAlertStatus() { - return alertStatus; - } - - public void setAlertStatus(String alertStatus) { - this.alertStatus = alertStatus; - } - - public String getClosingPeriod() { - return closingPeriod; - } - - public void setClosingPeriod(String closingPeriod) { - this.closingPeriod = closingPeriod; - } - - public String getDateClosed() { - return dateClosed; - } - - public void setDateClosed(String dateClosed) { - this.dateClosed = dateClosed; - } - - public String getDateComplete() { - return dateComplete; - } - - public void setDateComplete(String dateComplete) { - this.dateComplete = dateComplete; - } - - public String getReasonClosed() { - return reasonClosed; - } - - public void setReasonClosed(String reasonClosed) { - this.reasonClosed = reasonClosed; - } - - public Boolean getIsActive() { - return isActive; - } - - public void setIsActive(Boolean isActive) { - this.isActive = isActive; - } - - public long getTimeStamp() { - return timeStamp; - } - - public void setTimeStamp(long timeStamp) { - this.timeStamp = timeStamp; - } - - public Map getDetails() { - return details; - } - - public void setDetails(Map details) { - this.details = details; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public void setEntityId(String entityId) { - this.entityId = entityId; - } - - public void setBeneficiaryType(String beneficiaryType) { - this.beneficiaryType = beneficiaryType; - } - - public void setAlertType(String alertType) { - this.alertType = alertType; - } - - public void setTriggerType(String triggerType) { - this.triggerType = triggerType; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, "timeStamp", "revision"); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "timeStamp", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/AlertCreationAction.java b/opensrp-core/src/main/java/org/opensrp/scheduler/AlertCreationAction.java deleted file mode 100644 index 855a7909f6..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/AlertCreationAction.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.opensrp.scheduler; - -import static java.text.MessageFormat.format; - -import java.util.Map; - -import org.motechproject.scheduletracking.api.domain.Enrollment; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.domain.SubFormData; -import org.opensrp.form.service.FormSubmissionService; -import org.opensrp.scheduler.HealthSchedulerService.MetadataField; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -@Component -@Qualifier("AlertCreationAction") -public class AlertCreationAction implements HookedEvent { - - public static final String UNKNOWN_ENTITY_TYPE = "unknown"; - - private static Logger logger = LoggerFactory.getLogger(AlertCreationAction.class.toString()); - - private HealthSchedulerService scheduler; - - private FormSubmissionService formSubmissionService; - - @Autowired - public AlertCreationAction(HealthSchedulerService scheduler, FormSubmissionService formSubmissionService) { - this.scheduler = scheduler; - this.formSubmissionService = formSubmissionService; - } - - @Override - public void invoke(MilestoneEvent event, Map extraData) { - Enrollment enr = scheduler.getEnrollment(event.externalId(), event.scheduleName()); - String formSubmissionId = enr.getMetadata().get(MetadataField.enrollmentEvent.name()); - FormSubmission fs = formSubmissionService.findByInstanceId(formSubmissionId); - String entityType = getEntityType(event.externalId(), fs); - - logger.debug( - format("Generating alert for entity {0} of type {1} , formSubmission {2} " + "for schedule {3} in window {4} ", - event.externalId(), entityType, fs.instanceId(), enr.getScheduleName(), event.windowName())); - - scheduler.alertFor(event.windowName(), entityType, event.externalId(), fs.anmId(), event.scheduleName(), - event.milestoneName(), event.startOfDueWindow(), event.startOfLateWindow(), event.startOfMaxWindow()); - } - - String getEntityType(String externalId, FormSubmission formSubmission) { - if (formSubmission.entityId().equalsIgnoreCase(externalId)) { - return formSubmission.bindType(); - } - - if (formSubmission.subForms() != null) { - for (SubFormData sf : formSubmission.subForms()) { - for (Map fld : sf.instances()) { - if (fld.get("id").equalsIgnoreCase(externalId)) { - return sf.bindType(); - } - } - } - } - - return UNKNOWN_ENTITY_TYPE; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/AlertHandler.java b/opensrp-core/src/main/java/org/opensrp/scheduler/AlertHandler.java deleted file mode 100644 index 6993615e8b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/AlertHandler.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.opensrp.scheduler; - -import static org.motechproject.scheduletracking.api.domain.WindowName.due; -import static org.motechproject.scheduletracking.api.domain.WindowName.earliest; -import static org.motechproject.scheduletracking.api.domain.WindowName.late; -import static org.motechproject.scheduletracking.api.domain.WindowName.max; -import static org.opensrp.scheduler.Matcher.any; -import static org.opensrp.scheduler.Matcher.anyOf; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -@Component -public class AlertHandler { - - @Autowired - public AlertHandler(TaskSchedulerService scheduler, - // @Qualifier("ForceFulfillAction") HookedEvent forceFulfill, - /* @Qualifier("AutoClosePNCAction") HookedEvent autoClosePNCAction,*/ - @Qualifier("ECAlertCreationAction") HookedEvent alertCreation) { - scheduler.addHookedEvent(any(), any(), anyOf(earliest.toString(), due.toString(), late.toString(), max.toString()), - alertCreation); - - // TODO scheduler.addHookedEvent(eq(SCHEDULE_ANC), any(), eq(max.toString()), forceFulfill); - // scheduler.addHookedEvent(eq(SCHEDULE_LAB), any(), eq(max.toString()), forceFulfill); - // scheduler.addHookedEvent(eq(SCHEDULE_AUTO_CLOSE_PNC), any(), any(), autoClosePNCAction); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/AlertRouter.java b/opensrp-core/src/main/java/org/opensrp/scheduler/AlertRouter.java deleted file mode 100644 index 976d784bed..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/AlertRouter.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.opensrp.scheduler; - -import java.util.ArrayList; -import java.util.List; - -import org.motechproject.scheduler.domain.MotechEvent; -import org.motechproject.scheduletracking.api.domain.Enrollment; -import org.motechproject.scheduletracking.api.domain.WindowName; -import org.motechproject.scheduletracking.api.events.DefaultmentCaptureEvent; -import org.motechproject.scheduletracking.api.events.constants.EventSubjects; -import org.motechproject.scheduletracking.api.service.ScheduleTrackingService; -import org.motechproject.server.event.annotations.MotechListener; -import org.opensrp.domain.Event; -import org.opensrp.dto.ActionData; -import org.opensrp.dto.AlertStatus; -import org.opensrp.scheduler.HealthSchedulerService.MetadataField; -import org.opensrp.scheduler.service.ActionService; -import org.opensrp.scheduler.service.ScheduleService; -import org.opensrp.service.EventService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * The class that maintains the actions against alerts by {@link ScheduleTrackingService} - */ -@Component -public class AlertRouter { - - @Autowired - ScheduleService scheduleService; - - @Autowired - ActionService actionService; - - @Autowired - EventService eventService; - - private List routes; - - private static Logger logger = LoggerFactory.getLogger(AlertRouter.class.toString()); - - public AlertRouter() { - routes = new ArrayList<>(); - } - - public Route addRoute(Matcher scheduleMatcher, Matcher milestoneMatcher, Matcher windowMatcher, HookedEvent action) { - Route route = new Route(scheduleMatcher, milestoneMatcher, windowMatcher, action); - routes.add(route); - return route; - } - - public Route addRoute(Route route) { - logger.info("ADDED ROUTE:" + route); - routes.add(route); - return route; - } - - @MotechListener(subjects = { EventSubjects.MILESTONE_ALERT, EventSubjects.DEFAULTMENT_CAPTURE }) - public void handleAlerts(MotechEvent realEvent) { - logger.debug("Handling motech milestone alerts: " + realEvent); - MilestoneEvent milestoneEvent = new MilestoneEvent(realEvent); - - try { - for (Route route : routes) { - if (route.isSatisfiedBy(milestoneEvent.scheduleName(), milestoneEvent.milestoneName(), - milestoneEvent.windowName())) { - route.invokeAction(milestoneEvent); - return; - } - } - - throw new NoRoutesMatchException(milestoneEvent); - } - catch (Exception e) { - - logger.error("", e.getMessage()); - - if (e.getClass() == NoRoutesMatchException.class) { - throw new NoRoutesMatchException(milestoneEvent); - } - - String externalId = milestoneEvent.externalId(); - DefaultmentCaptureEvent defaultmentEvent = new DefaultmentCaptureEvent(realEvent); - String enrollmentId = defaultmentEvent.getEnrollmentId();//9be0cca1be4969d7d104e14706ef81de - Enrollment enrollment = scheduleService.getEnrollment(enrollmentId); - - String eventId = enrollment.getMetadata().get(MetadataField.enrollmentEvent.name()); - Event event = eventService.getById(eventId); - String entityType = event.getEntityType(); - ActionData actionData = ActionData.createAlert(entityType, enrollment.getScheduleName(), - enrollment.getCurrentMilestoneName(), AlertStatus.defaulted, enrollment.getCurrentMilestoneStartDate(), - enrollment.getStartOfWindowForCurrentMilestone(WindowName.max)); - Action action = new Action(externalId, event.getProviderId(), actionData); - actionService.alertForBeneficiary(action); - - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/ECAlertCreationAction.java b/opensrp-core/src/main/java/org/opensrp/scheduler/ECAlertCreationAction.java deleted file mode 100644 index 46cdfb665a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/ECAlertCreationAction.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.opensrp.scheduler; - -import static java.text.MessageFormat.format; - -import java.util.Map; - -import org.motechproject.scheduletracking.api.domain.Enrollment; -import org.opensrp.domain.Event; -import org.opensrp.scheduler.HealthSchedulerService.MetadataField; -import org.opensrp.service.EventService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -@Component -@Qualifier("ECAlertCreationAction") -public class ECAlertCreationAction implements HookedEvent { - - private static Logger logger = LoggerFactory.getLogger(ECAlertCreationAction.class.toString()); - - private HealthSchedulerService scheduler; - - private EventService eventService; - - @Autowired - public ECAlertCreationAction(HealthSchedulerService scheduler, EventService eventService) { - this.scheduler = scheduler; - this.eventService = eventService; - } - - @Override - public void invoke(MilestoneEvent motechEvent, Map extraData) { - Enrollment enr = scheduler.getEnrollment(motechEvent.externalId(), motechEvent.scheduleName()); - - try { - - if (enr != null) { - String eventId = enr.getMetadata().get(MetadataField.enrollmentEvent.name()); - Event event = eventService.getById(eventId); - String entityType = event.getEntityType(); - - logger.debug(format( - "Generating alert for entity {0} of type {1} , event {2} " + "for schedule {3} in window {4} ", - motechEvent.externalId(), entityType, event.getId(), enr.getScheduleName(), motechEvent.windowName())); - - scheduler.alertFor(motechEvent.windowName(), entityType, motechEvent.externalId(), event.getProviderId(), - motechEvent.scheduleName(), motechEvent.milestoneName(), motechEvent.startOfDueWindow(), - motechEvent.startOfLateWindow(), motechEvent.startOfMaxWindow()); - } else { - logger.info("No motech enrollment found for alert for client " + motechEvent.externalId() + " and schedule " - + motechEvent.scheduleName()); - } - } - catch (Exception e) { - logger.error("", e); - } - - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/HealthSchedulerService.java b/opensrp-core/src/main/java/org/opensrp/scheduler/HealthSchedulerService.java deleted file mode 100644 index 7f38a84b3f..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/HealthSchedulerService.java +++ /dev/null @@ -1,155 +0,0 @@ -package org.opensrp.scheduler; - -import static org.opensrp.dto.AlertStatus.expired; -import static org.opensrp.dto.AlertStatus.normal; -import static org.opensrp.dto.AlertStatus.upcoming; -import static org.opensrp.dto.AlertStatus.urgent; - -import java.util.ArrayList; -import java.util.List; - -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.motechproject.scheduletracking.api.domain.Enrollment; -import org.motechproject.scheduletracking.api.domain.WindowName; -import org.motechproject.scheduletracking.api.service.EnrollmentRecord; -import org.opensrp.dto.AlertStatus; -import org.opensrp.dto.BeneficiaryType; -import org.opensrp.scheduler.service.ActionService; -import org.opensrp.scheduler.service.ScheduleService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class HealthSchedulerService { - - public enum MetadataField { - enrollmentEvent, - fulfillmentEvent, - unenrollmentEvent, - lastUpdate - } - - private final ActionService actionService; - - private final ScheduleService scheduleService; - - private final ScheduleConfig scheduleConfig; - - @Autowired - public HealthSchedulerService(ActionService actionService, ScheduleService scheduleService, - ScheduleConfig scheduleConfig) { - this.actionService = actionService; - this.scheduleService = scheduleService; - this.scheduleConfig = scheduleConfig; - } - - public List findAutomatedSchedules(String formSubmission) { - List schl = new ArrayList<>(); - for (Schedule schedule : scheduleConfig.getSchedules()) { - if (schedule.hasForm(formSubmission)) { - schl.add(schedule); - } - } - return schl; - } - - public void enrollIntoSchedule(String entityId, String schedule, LocalDate referenceDate, String formSubmissionId) { - scheduleService.enroll(entityId, schedule, referenceDate.toString(), formSubmissionId); - } - - public void enrollIntoSchedule(String entityId, String schedule, String referenceDate, String formSubmissionId) { - scheduleService.enroll(entityId, schedule, referenceDate, formSubmissionId); - } - - public void enrollIntoSchedule(String entityId, String schedule, String milestone, String referenceDate, - String formSubmissionId) { - scheduleService.enroll(entityId, schedule, milestone, referenceDate, formSubmissionId); - } - - public void fullfillMilestoneAndCloseAlert(String entityId, String providerId, String scheduleName, String milestone, - LocalDate completionDate, String formSubmissionId) { - scheduleService.fulfillMilestone(entityId, scheduleName, completionDate, formSubmissionId); - actionService.markAlertAsClosed(entityId, providerId, milestone, completionDate.toString()); - } - - public void fullfillMilestoneAndCloseAlert(String entityId, String providerId, String scheduleName, - LocalDate completionDate, String formSubmissionId) { - scheduleService.fulfillMilestone(entityId, scheduleName, completionDate, formSubmissionId); - actionService.markAlertAsClosed(entityId, providerId, scheduleName, completionDate.toString()); - } - - public void forceFullfillMilestonesAndCloseAlert(String entityId, String scheduleName, LocalDate completionDate) { - scheduleService.fulfillMilestone(entityId, scheduleName, completionDate, ""); - actionService.markAlertAsClosed(entityId, scheduleName, completionDate.toString()); - } - - public void unEnrollFromSchedule(String entityId, String providerId, String scheduleName, String formSubmissionId) { - scheduleService.unenroll(entityId, scheduleName, formSubmissionId); - actionService.markAlertAsInactive(providerId, entityId, scheduleName); - } - - public void unEnrollAndCloseSchedule(String entityId, String providerId, String scheduleName, LocalDate completionDate, - String formSubmissionId) { - scheduleService.unenroll(entityId, scheduleName, formSubmissionId); - actionService.markAlertAsClosed(providerId, entityId, scheduleName, completionDate.toString()); - } - - public void unEnrollFromAllSchedules(String entityId, String formSubmissionId) { - List activeSchedules = scheduleService.findOpenEnrollmentNames(entityId); - - scheduleService.unenroll(entityId, activeSchedules, formSubmissionId); - actionService.markAllAlertsAsInactive(entityId); - } - - public void closeBeneficiary(BeneficiaryType beneficiary, String caseId, String anmIdentifier, String reasonForClose) { - actionService.closeBeneficiary(beneficiary, caseId, anmIdentifier, reasonForClose); - } - - public List findActiveEnrollments(String entityId) { - return scheduleService.findOpenEnrollments(entityId); - } - - public List findActiveSchedules(String entityId) { - return scheduleService.findOpenEnrollmentNames(entityId); - } - - public boolean isNotEnrolled(String entityId, String scheduleName) { - return scheduleService.getEnrollment(entityId, scheduleName) == null; - } - - public Enrollment getActiveEnrollment(String entityId, String scheduleName) { - return scheduleService.getActiveEnrollment(entityId, scheduleName); - } - - public Enrollment getEnrollment(String entityId, String scheduleName) { - return scheduleService.getEnrollment(entityId, scheduleName); - } - - public EnrollmentRecord getEnrollmentRecord(String entityId, String scheduleName) { - return scheduleService.getEnrollmentRecord(entityId, scheduleName); - } - - public void alertFor(String windowName, String beneficiaryType, String entityId, String providerId, String schedule, - String milestone, DateTime startOfDueWindow, DateTime startOfLateWindow, DateTime startOfMaxWindow) { - if (WindowName.late.toString().equals(windowName)) { - actionService.alertForBeneficiary(beneficiaryType, entityId, providerId, schedule, milestone, urgent, - startOfLateWindow, startOfMaxWindow); - } else if (WindowName.earliest.toString().equals(windowName)) { - actionService.alertForBeneficiary(beneficiaryType, entityId, providerId, schedule, milestone, upcoming, - startOfDueWindow, startOfLateWindow); - } else if (WindowName.due.toString().equals(windowName)) { - actionService.alertForBeneficiary(beneficiaryType, entityId, providerId, schedule, milestone, normal, - startOfDueWindow, startOfLateWindow); - } else if (WindowName.max.toString().equals(windowName)) { - actionService.alertForBeneficiary(beneficiaryType, entityId, providerId, schedule, milestone, expired, - startOfMaxWindow, startOfMaxWindow); - } - } - - public void alertFor(String beneficiaryType, String entityId, String providerId, String schedule, String milestone, - AlertStatus alertStatus, DateTime startOfDueWindow, DateTime startDate, DateTime expiryDate) { - actionService.alertForBeneficiary(beneficiaryType, entityId, providerId, schedule, milestone, alertStatus, startDate, - expiryDate); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/HookedEvent.java b/opensrp-core/src/main/java/org/opensrp/scheduler/HookedEvent.java deleted file mode 100644 index e9373e91dd..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/HookedEvent.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.opensrp.scheduler; - -import java.util.Map; - -public interface HookedEvent { - - void invoke(MilestoneEvent event, Map extraData); -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/Matcher.java b/opensrp-core/src/main/java/org/opensrp/scheduler/Matcher.java deleted file mode 100644 index 5c6ef57cbb..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/Matcher.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.opensrp.scheduler; - -import java.util.Arrays; -import java.util.List; - -public abstract class Matcher { - - public abstract boolean matches(String actualValue); - - public static Matcher eq(String value) { - return new EqMatcher(value); - } - - public static Matcher any() { - return new AnyMatcher(); - } - - public static Matcher anyOf(String... values) { - return new AnyOfMatcher(values); - } - - private static class AnyMatcher extends Matcher { - - @Override - public boolean matches(String actualValue) { - return true; - } - } - - private static class EqMatcher extends Matcher { - - private final String expectedValue; - - public EqMatcher(String expectedValue) { - this.expectedValue = expectedValue; - } - - @Override - public boolean matches(String actualValue) { - return expectedValue.equals(actualValue); - } - } - - private static class AnyOfMatcher extends Matcher { - - private final List expectedValues; - - public AnyOfMatcher(String... expectedValues) { - this.expectedValues = Arrays.asList(expectedValues); - } - - @Override - public boolean matches(String actualValue) { - return expectedValues.contains(actualValue); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/MilestoneEvent.java b/opensrp-core/src/main/java/org/opensrp/scheduler/MilestoneEvent.java deleted file mode 100644 index a51988fb06..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/MilestoneEvent.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.opensrp.scheduler; - -import static org.motechproject.scheduletracking.api.events.constants.EventDataKeys.MILESTONE_NAME; -import static org.motechproject.scheduletracking.api.events.constants.EventDataKeys.SCHEDULE_NAME; -import static org.motechproject.scheduletracking.api.events.constants.EventDataKeys.WINDOW_NAME; - -import org.joda.time.DateTime; -import org.motechproject.scheduler.domain.MotechEvent; -import org.motechproject.scheduletracking.api.domain.MilestoneAlert; -import org.motechproject.scheduletracking.api.events.constants.EventDataKeys; - -public class MilestoneEvent { - - private final MotechEvent event; - - public MilestoneEvent(MotechEvent event) { - this.event = event; - } - - public String scheduleName() { - return (String) event.getParameters().get(SCHEDULE_NAME); - } - - public String windowName() { - return (String) event.getParameters().get(WINDOW_NAME); - } - - public String milestoneName() { - return alert().getMilestoneName(); - } - - public String externalId() { - return event.getParameters().get(EventDataKeys.EXTERNAL_ID).toString(); - } - - public DateTime startOfDueWindow() { - return alert().getDueDateTime(); - } - - public DateTime startOfLateWindow() { - return alert().getLateDateTime(); - } - - public DateTime startOfMaxWindow() { - return alert().getDefaultmentDateTime(); - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - MilestoneEvent that = (MilestoneEvent) o; - - return !(event != null ? !event.equals(that.event) : that.event != null); - } - - @Override - public int hashCode() { - return event != null ? event.hashCode() : 0; - } - - private MilestoneAlert alert() { - return (MilestoneAlert) event.getParameters().get(MILESTONE_NAME); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/NoRoutesMatchException.java b/opensrp-core/src/main/java/org/opensrp/scheduler/NoRoutesMatchException.java deleted file mode 100644 index e7b4bbd6a9..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/NoRoutesMatchException.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.opensrp.scheduler; - -import java.text.MessageFormat; - -public class NoRoutesMatchException extends RuntimeException { - - public NoRoutesMatchException(MilestoneEvent event) { - super(MessageFormat.format( - "No route found for the Milestone event with scheduleName: {0}, milestoneName: {1}, windowName: {2}", - event.scheduleName(), event.milestoneName(), event.windowName())); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/RepeatingCronSchedule.java b/opensrp-core/src/main/java/org/opensrp/scheduler/RepeatingCronSchedule.java deleted file mode 100644 index 2b02706400..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/RepeatingCronSchedule.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.opensrp.scheduler; - -import java.util.Date; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -public class RepeatingCronSchedule { - - public final String SUBJECT; - - public final int START_DELAY; - - public final TimeUnit START_DELAY_UNIT; - - public final String CRON; - - protected Date endTime; - - protected Map data; - - public RepeatingCronSchedule(String subject, int startDelay, TimeUnit startDelayUnit, String cronExpression) { - this.SUBJECT = subject; - this.START_DELAY = startDelay; - this.START_DELAY_UNIT = startDelayUnit; - this.CRON = cronExpression; - } - - public RepeatingCronSchedule(String subject, int startDelay, TimeUnit startDelayUnit, String cronExpression, - Date endTime, Map data) { - this.SUBJECT = subject; - this.START_DELAY = startDelay; - this.START_DELAY_UNIT = startDelayUnit; - this.CRON = cronExpression; - this.endTime = endTime; - this.data = data; - } - - public Date getEndTime() { - return endTime; - } - - public RepeatingCronSchedule withEndTime(Date endTime) { - this.endTime = endTime; - return this; - } - - public Map getData() { - return data; - } - - public RepeatingCronSchedule addData(String key, Object value) { - data.put(key, value); - return this; - } - - public RepeatingCronSchedule withData(Map data) { - this.data = data; - return this; - } - - public long getStartDelayMilis() { - return START_DELAY * millisConverter(START_DELAY_UNIT); - } - - protected long millisConverter(TimeUnit unit) { - long millis = 1L; - switch (unit) { - case DAYS: - millis = 1000 * 60 * 60 * 24L; - break; - case HOURS: - millis = 1000 * 60 * 60L; - break; - case MICROSECONDS: - millis = 1 / 1000; - break; - case MILLISECONDS: - millis = 1; - break; - case MINUTES: - millis = 1000 * 60L; - break; - case NANOSECONDS: - millis = 1 / 1000000; - break; - case SECONDS: - millis = 1000; - break; - default: - millis = 1; - break; - } - - return millis; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/RepeatingSchedule.java b/opensrp-core/src/main/java/org/opensrp/scheduler/RepeatingSchedule.java deleted file mode 100644 index c5fc074829..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/RepeatingSchedule.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.opensrp.scheduler; - -import java.util.Date; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -public class RepeatingSchedule { - - public final String SUBJECT; - - public final int START_DELAY; - - public final int REPEAT_INTERVAL; - - public final TimeUnit START_DELAY_UNIT; - - public final TimeUnit REPEAT_INTERVAL_UNIT; - - protected Date endTime; - - protected Map data; - - public RepeatingSchedule(String subject, int startDelay, TimeUnit startDelayUnit, int repeatInterval, - TimeUnit repeatIntervalUnit) { - this.SUBJECT = subject; - this.START_DELAY = startDelay; - this.REPEAT_INTERVAL = repeatInterval; - this.START_DELAY_UNIT = startDelayUnit; - this.REPEAT_INTERVAL_UNIT = repeatIntervalUnit; - } - - public RepeatingSchedule(String subject, int startDelay, TimeUnit startDelayUnit, int repeatInterval, - TimeUnit repeatIntervalUnit, Date endTime, Map data) { - this.SUBJECT = subject; - this.START_DELAY = startDelay; - this.REPEAT_INTERVAL = repeatInterval; - this.START_DELAY_UNIT = startDelayUnit; - this.REPEAT_INTERVAL_UNIT = repeatIntervalUnit; - this.endTime = endTime; - this.data = data; - } - - public Date getEndTime() { - return endTime; - } - - public RepeatingSchedule withEndTime(Date endTime) { - this.endTime = endTime; - return this; - } - - public Map getData() { - return data; - } - - public RepeatingSchedule addData(String key, Object value) { - data.put(key, value); - return this; - } - - public RepeatingSchedule withData(Map data) { - this.data = data; - return this; - } - - public long getStartDelayMilis() { - return START_DELAY * millisConverter(START_DELAY_UNIT); - } - - public long getRepeatIntervalMilis() { - return REPEAT_INTERVAL * millisConverter(REPEAT_INTERVAL_UNIT); - } - - protected long millisConverter(TimeUnit unit) { - long millis = 1L; - switch (unit) { - case DAYS: - millis = 1000 * 60 * 60 * 24L; - break; - case HOURS: - millis = 1000 * 60 * 60L; - break; - case MICROSECONDS: - millis = 1 / 1000; - break; - case MILLISECONDS: - millis = 1; - break; - case MINUTES: - millis = 1000 * 60L; - break; - case NANOSECONDS: - millis = 1 / 1000000; - break; - case SECONDS: - millis = 1000; - break; - default: - millis = 1; - break; - } - - return millis; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/Route.java b/opensrp-core/src/main/java/org/opensrp/scheduler/Route.java deleted file mode 100644 index 9b3a555183..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/Route.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.opensrp.scheduler; - -import java.util.HashMap; -import java.util.Map; - -public class Route { - - private final Matcher scheduleMatcher; - - private final Matcher milestoneMatcher; - - private final Matcher windowMatcher; - - private final HookedEvent action; - - private Map extraData; - - public Route(Matcher scheduleMatcher, Matcher milestoneMatcher, Matcher windowMatcher, HookedEvent action) { - this(scheduleMatcher, milestoneMatcher, windowMatcher, action, new HashMap()); - } - - public Route(Matcher scheduleMatcher, Matcher milestoneMatcher, Matcher windowMatcher, HookedEvent action, - Map extraData) { - this.scheduleMatcher = scheduleMatcher; - this.milestoneMatcher = milestoneMatcher; - this.windowMatcher = windowMatcher; - this.action = action; - this.extraData = extraData; - if (extraData == null) { - this.extraData = new HashMap(); - } - } - - public boolean isSatisfiedBy(String scheduleName, String milestoneName, String windowName) { - return scheduleMatcher.matches(scheduleName) && milestoneMatcher.matches(milestoneName) - && windowMatcher.matches(windowName); - } - - public void invokeAction(MilestoneEvent event) { - action.invoke(event, extraData); - } - - public Route addExtraData(String key, String value) { - this.extraData.put(key, value); - return this; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/Schedule.java b/opensrp-core/src/main/java/org/opensrp/scheduler/Schedule.java deleted file mode 100644 index 403d351cdc..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/Schedule.java +++ /dev/null @@ -1,177 +0,0 @@ -package org.opensrp.scheduler; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.json.JSONException; -import org.json.JSONObject; - -import com.mysql.jdbc.StringUtils; - -import ch.maxant.rules.CompileException; -import ch.maxant.rules.DuplicateNameException; -import ch.maxant.rules.Engine; -import ch.maxant.rules.NoMatchingRuleFoundException; -import ch.maxant.rules.ParseException; -import ch.maxant.rules.Rule; - -public class Schedule { - - public enum ActionType { - enroll, - unenroll, - fulfill - } - - private ActionType action; - - private List forms; - - private String schedule; - - private String milestone; - - private List triggerDateFields; - - private String entityType; - - private String passLogic; - - Schedule() { - - } - - public Schedule(String json) throws JSONException { - this(new JSONObject(json)); - } - - public Schedule(JSONObject json) throws JSONException { - this(ActionType.valueOf(json.getString("action").toLowerCase()), json.getString("form").split(","), - json.getString("schedule"), json.getString("milestone"), json.getString("triggerDateField").split(","), - json.getString("entityType"), json.has("passLogic") ? json.getString("passLogic") : null); - } - - public Schedule(ActionType action, String[] forms, String schedule, String milestone, String[] triggerDateFields, - String entityType, String passLogic) { - this.action = action; - this.forms = new ArrayList<>(); - for (String f : forms) { - this.forms.add(f.trim()); - } - this.schedule = schedule.trim(); - this.milestone = milestone.trim(); - this.triggerDateFields = new ArrayList<>(); - for (String tf : triggerDateFields) { - this.triggerDateFields.add(tf.trim()); - } - this.entityType = entityType.trim(); - this.passLogic = passLogic; - } - - public boolean hasForm(String form) { - for (String f : forms) { - if (f.trim().equalsIgnoreCase(form.trim())) { - return true; - } - } - return false; - } - - public boolean applicableForEntity(String entity) { - return entityType.equalsIgnoreCase(entity.trim()); - } - - public boolean haspassLogic() { - return !StringUtils.isEmptyOrWhitespaceOnly(passLogic); - } - - public boolean passesValidations(Map flvl) { - if (!haspassLogic()) { - return true; - } - - String xpr = passLogic; - for (Entry kv : flvl.entrySet()) { - if (kv.getValue() == null) { - flvl.put(kv.getKey(), ""); - } - xpr = xpr.replace("${fs." + kv.getKey() + "}", "input." + kv.getKey()); - } - - Rule r1 = new Rule("R1", xpr, "true", 4, "dynamic.rules"); - Rule r2 = new Rule("R2", "!#R1", "false", 4, "dynamic.rules"); - List rules = Arrays.asList(r1, r2); - try { - Engine engine = new Engine(rules, true); - String result = engine.getBestOutcome(flvl); - return Boolean.valueOf(result); - } - catch (DuplicateNameException | CompileException | ParseException e) { - e.printStackTrace(); - throw new RuntimeException("Error while parsing Schedule Logic: " + e.getMessage(), e); - } - catch (NoMatchingRuleFoundException e) {//although it would never be thrown - e.printStackTrace(); - throw new RuntimeException("Error while parsing Schedule Logic: " + e.getMessage(), e); - } - } - - public ActionType action() { - return action; - } - - public List forms() { - return forms; - } - - public String schedule() { - return schedule; - } - - public String milestone() { - return milestone; - } - - public List triggerDateFields() { - return triggerDateFields; - } - - public String entityType() { - return entityType; - } - - public String passLogic() { - return passLogic; - } - - public ActionType getAction() { - return action; - } - - public List getForms() { - return forms; - } - - public String getSchedule() { - return schedule; - } - - public String getMilestone() { - return milestone; - } - - public List getTriggerDateFields() { - return triggerDateFields; - } - - public String getEntityType() { - return entityType; - } - - public String getPassLogic() { - return passLogic; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/ScheduleConfig.java b/opensrp-core/src/main/java/org/opensrp/scheduler/ScheduleConfig.java deleted file mode 100644 index 829ca70a9c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/ScheduleConfig.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.opensrp.scheduler; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.opensrp.scheduler.Schedule.ActionType; -import org.opensrp.util.Utils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.ResourceLoader; -import org.springframework.stereotype.Repository; - -import ch.maxant.rules.CompileException; -import ch.maxant.rules.DuplicateNameException; -import ch.maxant.rules.Engine; -import ch.maxant.rules.NoMatchingRuleFoundException; -import ch.maxant.rules.ParseException; -import ch.maxant.rules.Rule; - -@Repository -public class ScheduleConfig { - - private static Logger logger = LoggerFactory.getLogger("org.opensrp"); - - private List schedules = new ArrayList<>(); - - @Autowired - public ScheduleConfig(@Value("#{opensrp['schedule.config.path']}") String scheduleConfigPath) - throws IOException, JSONException { - ResourceLoader loader = new DefaultResourceLoader(); - scheduleConfigPath = loader.getResource(scheduleConfigPath).getURI().getPath(); - - logger.info("Loading automated schedules from " + scheduleConfigPath); - - JSONArray jarr = Utils.getXlsToJson(scheduleConfigPath); - - logger.info("Found " + jarr.length() + " automated schedules"); - for (int i = 0; i < jarr.length(); i++) { - JSONObject jo = jarr.getJSONObject(i); - //logger.debug(jo.toString()); - schedules.add(new Schedule(jo)); - } - } - - public void addSchedule(Schedule sch) { - if (schedules == null) { - schedules = new ArrayList<>(); - } - schedules.add(sch); - } - - public List getSchedules() { - return Collections.unmodifiableList(schedules); - } - - public List searchSchedules(String formSubmission) { - List schl = new ArrayList<>(); - for (Schedule schedule : schedules) { - if (schedule.hasForm(formSubmission)) { - schl.add(schedule); - } - } - return schl; - } - - public List searchSchedules(String form, String schedule, String milestone, ActionType action) { - List schl = new ArrayList<>(); - for (Schedule sc : schedules) { - if (sc.hasForm(form) && sc.schedule().equalsIgnoreCase(schedule) && sc.milestone().equalsIgnoreCase(milestone) - && sc.action().equals(action)) { - schl.add(sc); - } - } - return schl; - } - - public static void main(String[] args) - throws DuplicateNameException, CompileException, ParseException, NoMatchingRuleFoundException { - Map m = new HashMap<>(); - m.put("a", "14"); - m.put("val", ""); - Rule r1 = new Rule("R1", "input.a > 13", "true", 4, "age.rules"); - Rule r2 = new Rule("R2", "!#R1", "false", 4, "age.rules"); - List rules = Arrays.asList(r1, r2); - - Engine engine = new Engine(rules, true); - - String tarif = engine.getBestOutcome(m); - System.out.println(tarif); - - String xpr = "${fs.pentavalent_1} == empty and ${fs.pentavalent_1_retro} == empty"; - String kv = "pentavalent_1"; - xpr = xpr.replace("${fs." + kv + "}", "input." + kv); - System.out.println(xpr); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/SystemEvent.java b/opensrp-core/src/main/java/org/opensrp/scheduler/SystemEvent.java deleted file mode 100644 index 784744a79a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/SystemEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.opensrp.scheduler; - -import java.util.HashMap; -import java.util.Map; - -import org.motechproject.scheduler.domain.MotechEvent; - -import com.google.gson.Gson; - -public class SystemEvent { - - public static final String DATA = "data"; - - public final String SUBJECT; - - protected T data; - - public SystemEvent(String subject, T data) { - this.SUBJECT = subject; - this.data = data; - } - - public SystemEvent(Enum subject, T data) { - this.SUBJECT = subject.name(); - this.data = data; - } - - public MotechEvent toMotechEvent() { - return toMotechEvent(null); - } - - public MotechEvent toMotechEvent(Map parameters) { - if (parameters == null) { - parameters = new HashMap<>(); - } - parameters.put(DATA, new Gson().toJson(data)); - return new MotechEvent(SUBJECT, parameters); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/TaskSchedulerService.java b/opensrp-core/src/main/java/org/opensrp/scheduler/TaskSchedulerService.java deleted file mode 100644 index eebb7453cf..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/TaskSchedulerService.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.opensrp.scheduler; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -import org.joda.time.DateTime; -import org.motechproject.scheduler.MotechSchedulerService; -import org.motechproject.scheduler.domain.CronSchedulableJob; -import org.motechproject.scheduler.domain.MotechEvent; -import org.motechproject.scheduler.domain.RepeatingSchedulableJob; -import org.motechproject.scheduler.gateway.OutboundEventGateway; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class TaskSchedulerService { - - private MotechSchedulerService motechSchedulerService; - - private OutboundEventGateway gateway; - - private AlertRouter router; - - @Autowired - public TaskSchedulerService(MotechSchedulerService schedulerService, OutboundEventGateway gateway, AlertRouter router) { - this.motechSchedulerService = schedulerService; - this.gateway = gateway; - this.router = router; - } - - public void startJob(RepeatingSchedulableJob job) { - motechSchedulerService.safeScheduleRepeatingJob(job); - } - - public void startJob(CronSchedulableJob job) { - motechSchedulerService.safeScheduleJob(job); - } - - public void startJob(RepeatingSchedule job) { - Date startTime = getCurrentTime().plusMillis((int) job.getStartDelayMilis()).toDate(); - Map data = job.getData(); - if (data == null) { - data = new HashMap<>(); - } - MotechEvent event = new MotechEvent(job.SUBJECT, data); - startJob(createRepeatingSchedulableJob(event, startTime, job.getEndTime(), job.getRepeatIntervalMilis())); - } - - public void startJob(RepeatingCronSchedule job) { - Date startTime = getCurrentTime().plusMillis((int) job.getStartDelayMilis()).toDate(); - Map data = job.getData(); - if (data == null) { - data = new HashMap<>(); - } - MotechEvent event = new MotechEvent(job.SUBJECT, data); - startJob(new CronSchedulableJob(event, job.CRON, startTime, job.getEndTime())); - } - - public void notifyEvent(SystemEvent event) { - notifyEvent(event.toMotechEvent()); - } - - public void notifyEvent(MotechEvent event) { - gateway.sendEventMessage(event); - } - - public Route addHookedEvent(Matcher scheduleMatcher, Matcher milestoneMatcher, Matcher windowMatcher, - HookedEvent action) { - return addHookedEvent(scheduleMatcher, milestoneMatcher, windowMatcher, action, null); - } - - public Route addHookedEvent(Matcher scheduleMatcher, Matcher milestoneMatcher, Matcher windowMatcher, HookedEvent action, - Map extraData) { - Route route = new Route(scheduleMatcher, milestoneMatcher, windowMatcher, action, extraData); - return router.addRoute(route); - } - - public RepeatingSchedulableJob createRepeatingSchedulableJob(MotechEvent event, Date startTime, Date endTime, - long repeatInterval) { - return new RepeatingSchedulableJob(event, startTime, endTime, repeatInterval); - } - - public DateTime getCurrentTime() { - return DateTime.now(); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/repository/ActionsRepository.java b/opensrp-core/src/main/java/org/opensrp/scheduler/repository/ActionsRepository.java deleted file mode 100644 index b4dbe2048c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/repository/ActionsRepository.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.opensrp.scheduler.repository; - -import java.util.List; - -import org.joda.time.DateTime; -import org.opensrp.repository.BaseRepository; -import org.opensrp.scheduler.Action; - -public interface ActionsRepository extends BaseRepository { - - List findByProviderIdAndTimeStamp(String providerId, long timeStamp); - - List findAlertByANMIdEntityIdScheduleName(String providerId, String baseEntityId, String scheduleName); - - List findByCaseIdScheduleAndTimeStamp(String baseEntityId, String schedule, DateTime start, DateTime end); - - List findByCaseIdAndTimeStamp(String baseEntityId, long timeStamp); - - void deleteAllByTarget(String target); - - void markAllAsInActiveFor(String baseEntityId); - - void addOrUpdateAlert(Action alertAction); - - void markAlertAsInactiveFor(String providerId, String baseEntityId, String scheduleName); - - List findByCriteria(String team, String providerId, long timeStamp, String sortBy, String sortOrder, int limit); - - List findAllActionNotExpired(); -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/repository/AlertsRepository.java b/opensrp-core/src/main/java/org/opensrp/scheduler/repository/AlertsRepository.java deleted file mode 100644 index 9fc427021c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/repository/AlertsRepository.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.opensrp.scheduler.repository; - -import java.util.List; - -import org.joda.time.DateTime; -import org.opensrp.dto.AlertStatus; -import org.opensrp.repository.BaseRepository; -import org.opensrp.scheduler.Alert; - -public interface AlertsRepository extends BaseRepository { - - List findByProviderAndTimestamp(String provider, long timeStamp); - - List findActiveByProviderAndTimestamp(String provider, long timeStamp); - - List findAlertByProviderEntityIdTriggerName(String provider, String entityId, String triggerName); - - List findActiveAlertByProviderEntityIdTriggerName(String provider, String entityId, String triggerName); - - List findActiveAlertByEntityIdTriggerName(String entityId, String triggerName); - - List findActiveAlertByEntityId(String entityId); - - List findByEntityIdTriggerAndTimeStamp(String entityId, String trigger, DateTime start, DateTime end); - - void markAllAsClosedFor(String entityId, String reasonForClose); - - void markAlertAsClosedFor(String providerId, String entityId, String triggerName, String reasonForClose); - - void markAlertAsCompleteFor(String providerId, String entityId, String triggerName, String completionDate); - - void addOrUpdateScheduleNotificationAlert(String beneficiaryType, String entityId, String providerId, String triggerName, - String triggerCode, AlertStatus alertStatus, DateTime startDate, DateTime expiryDate); - - void markAlertAsCompleteFor(String entityId, String triggerName, String completionDate); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/repository/couch/AllActions.java b/opensrp-core/src/main/java/org/opensrp/scheduler/repository/couch/AllActions.java deleted file mode 100644 index b25b540474..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/repository/couch/AllActions.java +++ /dev/null @@ -1,142 +0,0 @@ -package org.opensrp.scheduler.repository.couch; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; - -import org.ektorp.BulkDeleteDocument; -import org.ektorp.ComplexKey; -import org.ektorp.CouchDbConnector; -import org.ektorp.support.GenerateView; -import org.ektorp.support.View; -import org.joda.time.DateTime; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.common.AllConstants; -import org.opensrp.repository.lucene.LuceneActionRepository; -import org.opensrp.scheduler.Action; -import org.opensrp.scheduler.repository.ActionsRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllActions extends MotechBaseRepository implements ActionsRepository { - - private static Logger logger = LoggerFactory.getLogger(AllActions.class.toString()); - - private LuceneActionRepository luceneActionRepo; - - @Autowired - protected AllActions(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db, - LuceneActionRepository _luceneActionRepo) { - super(Action.class, db); - luceneActionRepo = _luceneActionRepo; - } - - @View(name = "action_by_provider_and_time", map = "function(doc) { if (doc.type === 'Action') { emit([doc.providerId, doc.timeStamp], null); } }") - public List findByProviderIdAndTimeStamp(String providerId, long timeStamp) { - ComplexKey startKey = ComplexKey.of(providerId, timeStamp + 1); - ComplexKey endKey = ComplexKey.of(providerId, Long.MAX_VALUE); - return db.queryView(createQuery("action_by_provider_and_time").startKey(startKey).endKey(endKey).includeDocs(true), - Action.class); - } - - @View(name = "action_by_provider_entityId_scheduleName", map = "function(doc) { " - + "if(doc.type === 'Action' && doc.actionTarget === 'alert' && doc.providerId && doc.baseEntityId && doc.data && doc.data.scheduleName) {" - + "emit([doc.providerId, doc.baseEntityId, doc.data.scheduleName], null)} " + "}") - public List findAlertByANMIdEntityIdScheduleName(String providerId, String baseEntityId, String scheduleName) { - ComplexKey key = ComplexKey.of(providerId, baseEntityId, scheduleName); - return db.queryView(createQuery("action_by_provider_entityId_scheduleName").key(key).includeDocs(true), - Action.class); - } - - @View(name = "action_by_baseEntityId_and_schedule_and_time", map = "function(doc) { if (doc.type === 'Action') { emit([doc.baseEntityId, doc.data.scheduleName, doc.timeStamp], null); } }") - public List findByCaseIdScheduleAndTimeStamp(String baseEntityId, String schedule, DateTime start, - DateTime end) { - ComplexKey startKey = ComplexKey.of(baseEntityId, schedule, start.getMillis()); - ComplexKey endKey = ComplexKey.of(baseEntityId, schedule, end.getMillis() + 1); - return db.queryView( - createQuery("action_by_baseEntityId_and_schedule_and_time").startKey(startKey).endKey(endKey).includeDocs(true), - Action.class); - } - - @View(name = "action_by_baseEntityId_and_time", map = "function(doc) { if (doc.type === 'Action') { emit([doc.baseEntityId,doc.timeStamp], null); } }") - public List findByCaseIdAndTimeStamp(String baseEntityId, long timeStamp) { - ComplexKey startKey = ComplexKey.of(baseEntityId, timeStamp); - ComplexKey endKey = ComplexKey.of(baseEntityId, Long.MAX_VALUE); - return db.queryView( - createQuery("action_by_baseEntityId_and_time").startKey(startKey).endKey(endKey).includeDocs(true), - Action.class); - } - - public void deleteAllByTarget(String target) { - deleteAll(findByActionTarget(target)); - } - - public void markAllAsInActiveFor(String baseEntityId) { - List actions = findByBaseEntityId(baseEntityId); - for (Action action : actions) { - action.markAsInActive(); - } - db.executeBulk(actions); - } - - @GenerateView - private List findByActionTarget(String target) { - return queryView("by_actionTarget", target); - } - - @GenerateView - private List findByBaseEntityId(String baseEntityId) { - return queryView("by_baseEntityId", baseEntityId); - } - - private void deleteAll(List actions) { - ArrayList deleteDocuments = new ArrayList<>(); - for (Action action : actions) { - deleteDocuments.add(BulkDeleteDocument.of(action)); - } - db.executeBulk(deleteDocuments); - } - - public void addOrUpdateAlert(Action alertAction) { - List existingAlerts = findAlertByANMIdEntityIdScheduleName(alertAction.providerId(), - alertAction.baseEntityId(), alertAction.data().get("scheduleName")); - if (existingAlerts.size() > 1) { - logger.warn(MessageFormat.format( - "Found more than one alert for the combination of providerId: {0}, entityId: {1} and scheduleName : {2}. Alerts : {3}", - alertAction.providerId(), alertAction.baseEntityId(), alertAction.data().get("scheduleName"), - existingAlerts)); - } - for (Action existingAlert : existingAlerts) { - safeRemove(existingAlert); - } - add(alertAction); - } - - public void markAlertAsInactiveFor(String providerId, String baseEntityId, String scheduleName) { - List existingAlerts = findAlertByANMIdEntityIdScheduleName(providerId, baseEntityId, scheduleName); - if (existingAlerts.size() > 1) { - logger.warn(MessageFormat.format( - "Found more than one alert for the combination of providerId: {0}, entityId: {1} and scheduleName : {2}. Alerts : {3}", - providerId, baseEntityId, scheduleName, existingAlerts)); - } - for (Action existingAlert : existingAlerts) { - existingAlert.markAsInActive(); - } - db.executeBulk(existingAlerts); - } - - public List findByCriteria(String team, String providerId, long timeStamp, String sortBy, String sortOrder, - int limit) { - return luceneActionRepo.getByCriteria(team, providerId, timeStamp, sortBy, sortOrder, limit); - } - - @View(name = "action_by_alertStatus_not_expired", map = "function(doc) { if (doc.type === 'Action' && doc.data.alertStatus!='urgent') { emit(doc.id, null); } }") - public List findAllActionNotExpired() { - return db.queryView(createQuery("action_by_alertStatus_not_expired").includeDocs(true), Action.class); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/repository/couch/AllAlerts.java b/opensrp-core/src/main/java/org/opensrp/scheduler/repository/couch/AllAlerts.java deleted file mode 100644 index 0ec77afba3..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/repository/couch/AllAlerts.java +++ /dev/null @@ -1,187 +0,0 @@ -package org.opensrp.scheduler.repository.couch; - -import java.text.MessageFormat; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; -import org.ektorp.ComplexKey; -import org.ektorp.CouchDbConnector; -import org.ektorp.support.GenerateView; -import org.ektorp.support.View; -import org.joda.time.DateTime; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.common.AllConstants; -import org.opensrp.dto.AlertStatus; -import org.opensrp.scheduler.Alert; -import org.opensrp.scheduler.Alert.AlertType; -import org.opensrp.scheduler.Alert.TriggerType; -import org.opensrp.scheduler.repository.AlertsRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllAlerts extends MotechBaseRepository implements AlertsRepository { - - private static Logger logger = LoggerFactory.getLogger(AllAlerts.class.toString()); - - @Autowired - protected AllAlerts(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db) { - super(Alert.class, db); - } - - @View(name = "alert_by_provider_and_time", map = "function(doc) { if (doc.type === 'Alert') { emit([doc.providerId, doc.timeStamp], null); } }") - public List findByProviderAndTimestamp(String provider, long timeStamp) { - ComplexKey startKey = ComplexKey.of(provider, timeStamp + 1); - ComplexKey endKey = ComplexKey.of(provider, Long.MAX_VALUE); - return db.queryView(createQuery("alert_by_provider_and_time").startKey(startKey).endKey(endKey).includeDocs(true), - Alert.class); - } - - @View(name = "alert_by_provider_and_time_active", map = "function(doc) { if (doc.type === 'Alert' && doc.isActive) { emit([doc.providerId, doc.timeStamp], null); } }") - public List findActiveByProviderAndTimestamp(String provider, long timeStamp) { - ComplexKey startKey = ComplexKey.of(provider, timeStamp + 1); - ComplexKey endKey = ComplexKey.of(provider, Long.MAX_VALUE); - return db.queryView( - createQuery("alert_by_provider_and_time_active").startKey(startKey).endKey(endKey).includeDocs(true), - Alert.class); - } - - @View(name = "alert_by_provider_entityId_trigger", map = "function(doc) { " + "if(doc.type === 'Alert') {" - + "emit([doc.providerId, doc.entityId, doc.triggerName], null)} " + "}") - public List findAlertByProviderEntityIdTriggerName(String provider, String entityId, String triggerName) { - ComplexKey key = ComplexKey.of(provider, entityId, triggerName); - return db.queryView(createQuery("alert_by_provider_entityId_trigger").key(key).includeDocs(true), Alert.class); - } - - @View(name = "alert_by_provider_entityId_trigger_active", map = "function(doc) { " - + "if(doc.type === 'Alert' && doc.isActive) {" + "emit([doc.providerId, doc.entityId, doc.triggerName], null)} " - + "}") - public List findActiveAlertByProviderEntityIdTriggerName(String provider, String entityId, String triggerName) { - ComplexKey key = ComplexKey.of(provider, entityId, triggerName); - return db.queryView(createQuery("alert_by_provider_entityId_trigger_active").key(key).includeDocs(true), - Alert.class); - } - - @View(name = "alert_by_entityId_trigger_active", map = "function(doc) { " + "if(doc.type === 'Alert' && doc.isActive) {" - + "emit([doc.entityId, doc.triggerName], null)} " + "}") - public List findActiveAlertByEntityIdTriggerName(String entityId, String triggerName) { - ComplexKey key = ComplexKey.of(entityId, triggerName); - return db.queryView(createQuery("alert_by_entityId_trigger_active").key(key).includeDocs(true), Alert.class); - } - - @View(name = "alert_by_entityId_active", map = "function(doc) { " + "if(doc.type === 'Alert' && doc.isActive) {" - + "emit(doc.entityId, null)} " + "}") - public List findActiveAlertByEntityId(String entityId) { - return db.queryView(createQuery("alert_by_entityId_active").key(entityId).includeDocs(true), Alert.class); - } - - @View(name = "alert_by_entityId_and_trigger_and_time", map = "function(doc) { if (doc.type === 'Alert') { emit([doc.entityId, doc.triggerName, doc.timeStamp], null); } }") - public List findByEntityIdTriggerAndTimeStamp(String entityId, String trigger, DateTime start, DateTime end) { - ComplexKey startKey = ComplexKey.of(entityId, trigger, start.getMillis() + 1); - ComplexKey endKey = ComplexKey.of(entityId, trigger, end.getMillis()); - return db.queryView( - createQuery("alert_by_entityId_and_trigger_and_time").startKey(startKey).endKey(endKey).includeDocs(true), - Alert.class); - } - - public void markAllAsClosedFor(String entityId, String reasonForClose) { - List actions = findActiveAlertByEntityId(entityId); - for (Alert action : actions) { - action.markAlertAsClosed(reasonForClose); - } - db.executeBulk(actions); - } - - @GenerateView - private List findByBeneficiaryType(String beneficiaryType) { - return queryView("by_beneficiaryType", beneficiaryType); - } - - @GenerateView - private List findByAlertType(String alertType) { - return queryView("by_alertType", alertType); - } - - @GenerateView - private List findByTriggerType(String triggerType) { - return queryView("by_triggerType", triggerType); - } - - @GenerateView - private List findByEntityId(String entityId) { - return queryView("by_entityId", entityId); - } - - public void markAlertAsClosedFor(String providerId, String entityId, String triggerName, String reasonForClose) { - List existingAlerts = findActiveAlertByProviderEntityIdTriggerName(providerId, entityId, triggerName); - if (existingAlerts.size() > 1) { - logger.warn(MessageFormat.format( - "Found more than one alert for the combination of providerId: {0}, entityId: {1} and triggerName : {2}. Alerts : {3}", - providerId, entityId, triggerName, existingAlerts)); - } - for (Alert existingAlert : existingAlerts) { - existingAlert.markAlertAsClosed(reasonForClose); - } - db.executeBulk(existingAlerts); - } - - public void markAlertAsCompleteFor(String providerId, String entityId, String triggerName, String completionDate) { - List existingAlerts = findActiveAlertByProviderEntityIdTriggerName(providerId, entityId, triggerName); - if (existingAlerts.size() > 1) { - logger.warn(MessageFormat.format( - "Found more than one alert for the combination of providerId: {0}, entityId: {1} and triggerName : {2}. Alerts : {3}", - providerId, entityId, triggerName, existingAlerts)); - } - for (Alert existingAlert : existingAlerts) { - existingAlert.markAlertAsComplete(completionDate); - } - db.executeBulk(existingAlerts); - } - - public void addOrUpdateScheduleNotificationAlert(String beneficiaryType, String entityId, String providerId, - String triggerName, String triggerCode, AlertStatus alertStatus, DateTime startDate, DateTime expiryDate) { - List existingAlerts = findActiveAlertByProviderEntityIdTriggerName(providerId, entityId, triggerName); - if (existingAlerts.size() > 1) { - logger.warn(MessageFormat.format("Found more than one active alerts for the combination of " - + "providerId: {0}, entityId: {1} and triggerName: {2}", - providerId, entityId, triggerName)); - } - - if (existingAlerts.size() == 0) { - add(new Alert(providerId, entityId, beneficiaryType, AlertType.notification, TriggerType.schedule, triggerName, - triggerCode, startDate, expiryDate, alertStatus, null)); - } else { - Alert al = existingAlerts.get(0); - // if visit code is same then update otherwise add another record - if (StringUtils.isNotBlank(al.triggerCode()) && StringUtils.isNotBlank(triggerCode) - && al.triggerCode().equalsIgnoreCase(triggerCode)) { - al.setAlertStatus(alertStatus.name()); - al.setStartDate(startDate.toString()); - al.setExpiryDate(expiryDate.toString()); - al.details().put(alertStatus.name() + ":start", startDate.toString()); - al.details().put(alertStatus.name() + ":end", expiryDate.toString()); - - update(al); - } else { - add(new Alert(providerId, entityId, beneficiaryType, AlertType.notification, TriggerType.schedule, - triggerName, triggerCode, startDate, expiryDate, alertStatus, null)); - } - } - } - - public void markAlertAsCompleteFor(String entityId, String triggerName, String completionDate) { - List existingAlerts = findActiveAlertByEntityIdTriggerName(entityId, triggerName); - if (existingAlerts.size() > 1) { - logger.warn(MessageFormat.format( - "Found more than one alert for the combination of entityId: {0} and triggerName : {1}. Alerts : {2}", - entityId, triggerName, existingAlerts)); - } - for (Alert existingAlert : existingAlerts) { - existingAlert.markAlertAsComplete(completionDate); - } - db.executeBulk(existingAlerts); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/service/ActionService.java b/opensrp-core/src/main/java/org/opensrp/scheduler/service/ActionService.java deleted file mode 100644 index 6165f2611c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/service/ActionService.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.opensrp.scheduler.service; - -import java.util.List; - -import org.joda.time.DateTime; -import org.opensrp.dto.ActionData; -import org.opensrp.dto.AlertStatus; -import org.opensrp.dto.BeneficiaryType; -import org.opensrp.scheduler.Action; -import org.opensrp.scheduler.Alert; -import org.opensrp.scheduler.Alert.AlertType; -import org.opensrp.scheduler.Alert.TriggerType; -import org.opensrp.scheduler.repository.ActionsRepository; -import org.opensrp.scheduler.repository.AlertsRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class ActionService { - - public static final String ALL_PROVIDERS = "all_providers"; - - private ActionsRepository allActions; - - private AlertsRepository allAlerts; - - @Autowired - public ActionService(ActionsRepository allActions, AlertsRepository allAlerts) { - this.allActions = allActions; - this.allAlerts = allAlerts; - } - - public List getNewAlertsForANM(String anmIdentifier, long timeStamp) { - return allActions.findByProviderIdAndTimeStamp(anmIdentifier, timeStamp); - } - - public List getAlertsForProvider(String providerId, long timeStamp) { - return allAlerts.findByProviderAndTimestamp(providerId, timeStamp); - } - - public List getAlertsActiveForProvider(String providerId, long timeStamp) { - return allAlerts.findActiveByProviderAndTimestamp(providerId, timeStamp); - } - - public List findByCaseIdScheduleAndTimeStamp(String caseId, String schedule, DateTime start, DateTime end) { - return allActions.findByCaseIdScheduleAndTimeStamp(caseId, schedule, start, end); - } - - public List findByCaseIdAndTimeStamp(String caseId, long timeStamp) { - return allActions.findByCaseIdAndTimeStamp(caseId, timeStamp); - } - - public List findAlertByEntityIdScheduleAndTimeStamp(String entityId, String schedule, DateTime start, - DateTime end) { - return allAlerts.findByEntityIdTriggerAndTimeStamp(entityId, schedule, start, end); - } - - public void alertForBeneficiary(String beneficiaryType, String caseID, String anmIdentifier, String scheduleName, - String visitCode, AlertStatus alertStatus, DateTime startDate, DateTime expiryDate) { - allActions.addOrUpdateAlert(new Action(caseID, anmIdentifier, - ActionData.createAlert(beneficiaryType, scheduleName, visitCode, alertStatus, startDate, expiryDate))); - allAlerts.addOrUpdateScheduleNotificationAlert(beneficiaryType, caseID, anmIdentifier, scheduleName, visitCode, - alertStatus, startDate, expiryDate); - } - - public void alertForBeneficiary(Action action) { - allActions.addOrUpdateAlert(action); - } - - public void markAllAlertsAsInactive(String entityId) { - allActions.markAllAsInActiveFor(entityId); - allAlerts.markAllAsClosedFor(entityId, "unenrolled from schedule"); - } - - public void markAlertAsInactive(String anmId, String entityId, String scheduleName) { - allActions.markAlertAsInactiveFor(anmId, entityId, scheduleName); - allAlerts.markAlertAsClosedFor(anmId, entityId, scheduleName, "unenrolled from schedule"); - } - - public void markAlertAsClosed(String caseId, String anmIdentifier, String visitCode, String completionDate) { - allActions.add(new Action(caseId, anmIdentifier, ActionData.markAlertAsClosed(visitCode, completionDate))); - allAlerts.markAlertAsCompleteFor(anmIdentifier, caseId, visitCode, completionDate); - } - - public void markAlertAsClosed(String caseId, String visitCode, String completionDate) { - allActions.add(new Action(caseId, ALL_PROVIDERS, ActionData.markAlertAsClosed(visitCode, completionDate))); - allAlerts.markAlertAsCompleteFor(caseId, visitCode, completionDate); - } - - public void closeBeneficiary(BeneficiaryType beneficiary, String caseId, String anmIdentifier, String reasonForClose) { - allActions.add(new Action(caseId, anmIdentifier, ActionData.closeBeneficiary(beneficiary.name(), reasonForClose))); - //TODO - allAlerts.add(new Alert(anmIdentifier, caseId, beneficiary.name(), AlertType.notification, TriggerType.caseClosed, - null, null, getCurrentDateTime(), getCurrentDateTime(), AlertStatus.urgent, null)); - } - - public void reportForIndicator(String anmIdentifier, ActionData actionData) { - allActions.add(new Action("", anmIdentifier, actionData)); - } - - public void deleteReportActions() { - allActions.deleteAllByTarget("report"); - } - - public List findByCriteria(String team, String providerId, long timeStamp, String sortBy, String sortOrder, - int limit) { - return allActions.findByCriteria(team, providerId, timeStamp, sortBy, sortOrder, limit); - } - - public DateTime getCurrentDateTime() { - return new DateTime(); - } - - public List findAllActionNotExpired() { - return allActions.findAllActionNotExpired(); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/service/AllEnrollmentWrapper.java b/opensrp-core/src/main/java/org/opensrp/scheduler/service/AllEnrollmentWrapper.java deleted file mode 100644 index a9033041ad..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/service/AllEnrollmentWrapper.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.opensrp.scheduler.service; - -import java.util.List; - -import org.ektorp.ComplexKey; -import org.ektorp.CouchDbConnector; -import org.ektorp.support.View; -import org.joda.time.DateTime; -import org.motechproject.scheduletracking.api.domain.Enrollment; -import org.motechproject.scheduletracking.api.repository.AllEnrollments; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllEnrollmentWrapper extends AllEnrollments { - - @Autowired - private AllScheduleWrapper allSchedules; - - @Autowired - public AllEnrollmentWrapper(@Qualifier("scheduleTrackingDbConnector") CouchDbConnector db) { - super(db); - } - - @View(name = "find_by_external_id_and_schedule_name", map = "function(doc) {if(doc.type === 'Enrollment') emit([doc.externalId, doc.scheduleName.toUpperCase()]);}") - public Enrollment getEnrollment(String externalId, String scheduleName) { - if (scheduleName.equalsIgnoreCase("Measles 1")) { - log.info("measles 1"); - } - List enrollments = queryView("find_by_external_id_and_schedule_name", - ComplexKey.of(externalId, scheduleName.toUpperCase())); - return enrollments.isEmpty() ? null : populateSchedule(enrollments.get(0)); - } - - private static final String FUNCTION_DOC_EMIT_DOC_STATUS_AND_ENROLLED_ON = "function(doc) { if(doc.type === 'Enrollment') emit([doc.status,doc.enrolledOn], doc._id);}"; - - @View(name = "by_status_date_enrolled", map = FUNCTION_DOC_EMIT_DOC_STATUS_AND_ENROLLED_ON) - public List findByEnrollmentDate(String status, DateTime start, DateTime end) { - ComplexKey s = ComplexKey.of(status, start); - ComplexKey e = ComplexKey.of(status, end); - List enrollments = db - .queryView(createQuery("by_status_date_enrolled").startKey(s).endKey(e).includeDocs(true), Enrollment.class); - return populateWithSchedule(enrollments); - } - - private static final String FUNCTION_DOC_EMIT_LAST_UPDATE = "function(doc) { if(doc.type === 'Enrollment') emit(doc.metadata.lastUpdate, doc._id);}"; - - @View(name = "by_last_update", map = FUNCTION_DOC_EMIT_LAST_UPDATE) - public List findByLastUpDate(DateTime start, DateTime end) { - List enrollments = db - .queryView(createQuery("by_last_update").startKey(start).endKey(end).includeDocs(true), Enrollment.class); - return populateWithSchedule(enrollments); - } - - private List populateWithSchedule(List enrollments) { - for (Enrollment enrollment : enrollments) - populateSchedule(enrollment); - return enrollments; - } - - private Enrollment populateSchedule(Enrollment enrollment) { - enrollment.setSchedule(allSchedules.getByName(enrollment.getScheduleName())); - return enrollment; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/service/AllScheduleWrapper.java b/opensrp-core/src/main/java/org/opensrp/scheduler/service/AllScheduleWrapper.java deleted file mode 100644 index a43ce9875b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/service/AllScheduleWrapper.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.opensrp.scheduler.service; - -import java.util.List; - -import org.ektorp.CouchDbConnector; -import org.ektorp.support.View; -import org.motechproject.scheduletracking.api.domain.ScheduleFactory; -import org.motechproject.scheduletracking.api.domain.json.ScheduleRecord; -import org.motechproject.scheduletracking.api.repository.AllSchedules; -import org.motechproject.scheduletracking.api.repository.TrackedSchedulesJsonReader; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllScheduleWrapper extends AllSchedules { - - @Autowired - public AllScheduleWrapper(@Qualifier("scheduleTrackingDbConnector") CouchDbConnector db, - TrackedSchedulesJsonReader trackedSchedulesJsonReader, ScheduleFactory scheduleFactory) { - super(db, trackedSchedulesJsonReader, scheduleFactory); - } - - @View(name = "by_schedule_name", map = "function(doc) { if(doc.type === 'ScheduleRecord') emit(doc.name); }") - public ScheduleRecord getRecordByName(String name) { - List records = queryView("by_schedule_name", name); - if (records.isEmpty()) - return null; - return records.get(0); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/scheduler/service/ScheduleService.java b/opensrp-core/src/main/java/org/opensrp/scheduler/service/ScheduleService.java deleted file mode 100644 index 45e1207385..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/scheduler/service/ScheduleService.java +++ /dev/null @@ -1,171 +0,0 @@ -package org.opensrp.scheduler.service; - -import static java.util.Arrays.asList; -import static org.joda.time.LocalDate.parse; -import static org.joda.time.LocalTime.now; -import static org.motechproject.scheduletracking.api.domain.EnrollmentStatus.ACTIVE; -import static org.opensrp.common.util.DateUtil.today; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.motechproject.model.Time; -import org.motechproject.scheduletracking.api.domain.Enrollment; -import org.motechproject.scheduletracking.api.domain.Milestone; -import org.motechproject.scheduletracking.api.domain.Schedule; -import org.motechproject.scheduletracking.api.repository.AllSchedules; -import org.motechproject.scheduletracking.api.service.EnrollmentRecord; -import org.motechproject.scheduletracking.api.service.EnrollmentRequest; -import org.motechproject.scheduletracking.api.service.EnrollmentsQuery; -import org.motechproject.scheduletracking.api.service.ScheduleTrackingService; -import org.opensrp.scheduler.HealthSchedulerService.MetadataField; -import org.opensrp.scheduler.Schedule.ActionType; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -@Service -public class ScheduleService { - - private final ScheduleTrackingService scheduleTrackingService; - - private final AllSchedules allSchedules; - - private final AllEnrollmentWrapper allEnrollments; - - @Autowired - public ScheduleService(ScheduleTrackingService scheduleTrackingService, AllSchedules allSchedules, - @Value("#{opensrp['preferred.time']}") int preferredTime, AllEnrollmentWrapper allEnrollments) { - this.scheduleTrackingService = scheduleTrackingService; - this.allSchedules = allSchedules; - this.allEnrollments = allEnrollments; - } - - public void enroll(String entityId, String scheduleName, String referenceDate, String formSubmissionId) { - String startingMilestoneName = getStartingMilestoneName(scheduleName, parse(referenceDate)); - enroll(entityId, scheduleName, startingMilestoneName, referenceDate, formSubmissionId); - } - - private String getStartingMilestoneName(String name, LocalDate referenceDate) { - Schedule schedule = allSchedules.getByName(name); - for (Milestone milestone : schedule.getMilestones()) { - if (referenceDate.plus(milestone.getMaximumDuration()).isAfter(today())) - return milestone.getName(); - } - return null; - } - - public void enroll(String entityId, String scheduleName, String milestone, String referenceDate, - String formSubmissionId) { - EnrollmentRequest request = new EnrollmentRequest(entityId, scheduleName, null, parse(referenceDate), null, null, - null, milestone, addOrUpdateEventTrackMetadata(null, formSubmissionId, ActionType.enroll)); - - System.out.println(request.getStartingMilestoneName()); - scheduleTrackingService.enroll(request); - } - - public void fulfillMilestone(String entityId, String scheduleName, LocalDate completionDate, String formSubmissionId) { - boolean successFullyUpdates = updateExistingEnrollmentWithEventTrackMetadata(entityId, scheduleName, - formSubmissionId, ActionType.fulfill); - if (successFullyUpdates) { - scheduleTrackingService.fulfillCurrentMilestone(entityId, scheduleName, completionDate, getCurrentTime()); - } - } - - public void unenroll(String entityId, String scheduleName, String formSubmissionId) { - updateExistingEnrollmentWithEventTrackMetadata(entityId, scheduleName, formSubmissionId, ActionType.unenroll); - scheduleTrackingService.unenroll(entityId, asList(scheduleName)); - } - - public Time getCurrentTime() { - return new Time(now()); - } - - public void unenroll(String entityId, List schedules, String formSubmissionId) { - for (String schedule : schedules) { - updateExistingEnrollmentWithEventTrackMetadata(entityId, schedule, formSubmissionId, ActionType.unenroll); - } - scheduleTrackingService.unenroll(entityId, schedules); - } - - public List findOpenEnrollments(String entityId) { - return scheduleTrackingService.search(createEnrollmentQueryWithActiveExternalId(entityId)); - } - - public EnrollmentsQuery createEnrollmentQueryWithActiveExternalId(String entityId) { - return new EnrollmentsQuery().havingExternalId(entityId).havingState(ACTIVE); - } - - public List findEnrollmentByStatusAndEnrollmentDate(String status, DateTime start, DateTime end) { - return allEnrollments.findByEnrollmentDate(status, start, end); - } - - public List findEnrollmentByLastUpDate(DateTime start, DateTime end) { - return allEnrollments.findByLastUpDate(start, end); - } - - public void updateEnrollmentWithMetadata(String enrollmentId, String key, String value) { - Enrollment e = allEnrollments.get(enrollmentId); - e.getMetadata().put(key, value); - allEnrollments.update(e); - } - - public List findOpenEnrollmentNames(String entityId) { - List openEnrollments = findOpenEnrollments(entityId); - List openSchedules = new ArrayList<>(); - for (EnrollmentRecord enrollment : openEnrollments) { - openSchedules.add(enrollment.getScheduleName()); - } - - return openSchedules; - } - - public Enrollment getActiveEnrollment(String entityId, String scheduleName) { - return allEnrollments.getActiveEnrollment(entityId, scheduleName); - } - - public Enrollment getEnrollment(String entityId, String scheduleName) { - return allEnrollments.getEnrollment(entityId, scheduleName); - } - - public EnrollmentRecord getEnrollmentRecord(String entityId, String scheduleName) { - return scheduleTrackingService.getEnrollment(entityId, scheduleName); - } - - public Enrollment getEnrollment(String enrollmentId) { - return allEnrollments.get(enrollmentId); - } - - private Map addOrUpdateEventTrackMetadata(Map map, String formSubmissionId, - ActionType actionType) { - if (map == null) { - map = new HashMap<>(); - } - - map.put(MetadataField.lastUpdate.name(), new DateTime().toString()); - - if (actionType.equals(ActionType.enroll)) { - map.put(MetadataField.enrollmentEvent.name(), formSubmissionId); - } else if (actionType.equals(ActionType.fulfill)) { - map.put(MetadataField.fulfillmentEvent.name(), formSubmissionId); - } else if (actionType.equals(ActionType.unenroll)) { - map.put(MetadataField.unenrollmentEvent.name(), formSubmissionId); - } - return map; - } - - private boolean updateExistingEnrollmentWithEventTrackMetadata(String entityId, String scheduleName, - String formSubmissionId, ActionType actionType) { - Enrollment enr = allEnrollments.getActiveEnrollment(entityId, scheduleName); - if (enr == null) { - return false; - } - enr.setMetadata(addOrUpdateEventTrackMetadata(enr.getMetadata(), formSubmissionId, actionType)); - allEnrollments.update(enr); - return true; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/search/AddressSearchBean.java b/opensrp-core/src/main/java/org/opensrp/search/AddressSearchBean.java deleted file mode 100644 index ed3994bbf1..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/search/AddressSearchBean.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.opensrp.search; - -import org.apache.commons.lang.StringUtils; - -public class AddressSearchBean { - - private String addressType; - - private String country; - - private String stateProvince; - - private String cityVillage; - - private String countyDistrict; - - private String subDistrict; - - private String town; - - private String subTown; - - public String getAddressType() { - return addressType; - } - - public void setAddressType(String addressType) { - this.addressType = addressType; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - public String getStateProvince() { - return stateProvince; - } - - public void setStateProvince(String stateProvince) { - this.stateProvince = stateProvince; - } - - public String getCityVillage() { - return cityVillage; - } - - public void setCityVillage(String cityVillage) { - this.cityVillage = cityVillage; - } - - public String getCountyDistrict() { - return countyDistrict; - } - - public void setCountyDistrict(String countyDistrict) { - this.countyDistrict = countyDistrict; - } - - public String getSubDistrict() { - return subDistrict; - } - - public void setSubDistrict(String subDistrict) { - this.subDistrict = subDistrict; - } - - public String getTown() { - return town; - } - - public void setTown(String town) { - this.town = town; - } - - public String getSubTown() { - return subTown; - } - - public void setSubTown(String subTown) { - this.subTown = subTown; - } - - public boolean isHasFilter() { - return StringUtils.isNotEmpty(addressType) || StringUtils.isNotEmpty(country) - || StringUtils.isNotEmpty(stateProvince) || StringUtils.isNotEmpty(cityVillage) - || StringUtils.isNotEmpty(countyDistrict) || StringUtils.isNotEmpty(town) || StringUtils.isNotEmpty(subTown); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/search/ClientSearchBean.java b/opensrp-core/src/main/java/org/opensrp/search/ClientSearchBean.java deleted file mode 100644 index f6af052760..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/search/ClientSearchBean.java +++ /dev/null @@ -1,250 +0,0 @@ -package org.opensrp.search; - -import java.util.List; -import java.util.Map; - -import org.joda.time.DateTime; - -public class ClientSearchBean { - - private String nameLike; - - private String gender; - - private DateTime birthdateFrom; - - private DateTime birthdateTo; - - private DateTime deathdateFrom; - - private DateTime deathdateTo; - - private String attributeType; - - private String attributeValue; - - private DateTime lastEditFrom; - - private DateTime lastEditTo; - - private Map identifiers; - - private Map attributes; - - private String firstName; - - private String middleName; - - private String lastName; - - private String clientType; - - private String providerId; - - private int pageNumber = 0; - - private int pageSize = 0; - - private String orderByField; // The field name which used to order result - - private String orderByType; // type of order ASC or DESC - - private List locations; - - private DateTime startDate; - - private DateTime endDate; - - public List getLocations() { - return locations; - } - - public void setLocations(List locations) { - this.locations = locations; - } - - public String getOrderByField() { - return orderByField; - } - - public void setOrderByField(String orderByField) { - this.orderByField = orderByField; - } - - public String getOrderByType() { - return orderByType; - } - - public void setOrderByType(String orderByType) { - this.orderByType = orderByType; - } - - public int getPageSize() { - return pageSize; - } - - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } - - public int getPageNumber() { - return pageNumber; - } - - public void setPageNumber(int pageNumber) { - this.pageNumber = pageNumber; - } - - public String getNameLike() { - return nameLike; - } - - public void setNameLike(String nameLike) { - this.nameLike = nameLike; - } - - public String getGender() { - return gender; - } - - public void setGender(String gender) { - this.gender = gender; - } - - public DateTime getBirthdateFrom() { - return birthdateFrom; - } - - public void setBirthdateFrom(DateTime birthdateFrom) { - this.birthdateFrom = birthdateFrom; - } - - public DateTime getBirthdateTo() { - return birthdateTo; - } - - public void setBirthdateTo(DateTime birthdateTo) { - this.birthdateTo = birthdateTo; - } - - public DateTime getDeathdateFrom() { - return deathdateFrom; - } - - public void setDeathdateFrom(DateTime deathdateFrom) { - this.deathdateFrom = deathdateFrom; - } - - public DateTime getDeathdateTo() { - return deathdateTo; - } - - public void setDeathdateTo(DateTime deathdateTo) { - this.deathdateTo = deathdateTo; - } - - public String getAttributeType() { - return attributeType; - } - - public void setAttributeType(String attributeType) { - this.attributeType = attributeType; - } - - public String getAttributeValue() { - return attributeValue; - } - - public void setAttributeValue(String attributeValue) { - this.attributeValue = attributeValue; - } - - public DateTime getLastEditFrom() { - return lastEditFrom; - } - - public void setLastEditFrom(DateTime lastEditFrom) { - this.lastEditFrom = lastEditFrom; - } - - public DateTime getLastEditTo() { - return lastEditTo; - } - - public void setLastEditTo(DateTime lastEditTo) { - this.lastEditTo = lastEditTo; - } - - public Map getIdentifiers() { - return identifiers; - } - - public void setIdentifiers(Map identifiers) { - this.identifiers = identifiers; - } - - public Map getAttributes() { - return attributes; - } - - public void setAttributes(Map attributes) { - this.attributes = attributes; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getMiddleName() { - return middleName; - } - - public void setMiddleName(String middleName) { - this.middleName = middleName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getClientType() { - return clientType; - } - - public void setClientType(String clientType) { - this.clientType = clientType; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public DateTime getStartDate() { - return startDate; - } - - public void setStartDate(DateTime startDate) { - this.startDate = startDate; - } - - public DateTime getEndDate() { - return endDate; - } - - public void setEndDate(DateTime endDate) { - this.endDate = endDate; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/search/EventSearchBean.java b/opensrp-core/src/main/java/org/opensrp/search/EventSearchBean.java deleted file mode 100644 index 17f875a0fa..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/search/EventSearchBean.java +++ /dev/null @@ -1,128 +0,0 @@ - -package org.opensrp.search; - -import org.joda.time.DateTime; - -public class EventSearchBean { - - private String baseEntityId; - - private DateTime eventDateFrom; - - private DateTime eventDateTo; - - private String eventType; - - private String entityType; - - private String providerId; - - private String locationId; - - private DateTime lastEditFrom; - - private DateTime lastEditTo; - - private String team; - - private String teamId; - - private Long serverVersion; - - public String getBaseEntityId() { - return baseEntityId; - } - - public void setBaseEntityId(String baseEntityId) { - this.baseEntityId = baseEntityId; - } - - public DateTime getEventDateFrom() { - return eventDateFrom; - } - - public void setEventDateFrom(DateTime eventDateFrom) { - this.eventDateFrom = eventDateFrom; - } - - public DateTime getEventDateTo() { - return eventDateTo; - } - - public void setEventDateTo(DateTime eventDateTo) { - this.eventDateTo = eventDateTo; - } - - public String getEventType() { - return eventType; - } - - public void setEventType(String eventType) { - this.eventType = eventType; - } - - public String getEntityType() { - return entityType; - } - - public void setEntityType(String entityType) { - this.entityType = entityType; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public String getLocationId() { - return locationId; - } - - public void setLocationId(String locationId) { - this.locationId = locationId; - } - - public DateTime getLastEditFrom() { - return lastEditFrom; - } - - public void setLastEditFrom(DateTime lastEditFrom) { - this.lastEditFrom = lastEditFrom; - } - - public DateTime getLastEditTo() { - return lastEditTo; - } - - public void setLastEditTo(DateTime lastEditTo) { - this.lastEditTo = lastEditTo; - } - - public String getTeam() { - return team; - } - - public void setTeam(String team) { - this.team = team; - } - - public String getTeamId() { - return teamId; - } - - public void setTeamId(String teamId) { - this.teamId = teamId; - } - - public Long getServerVersion() { - return serverVersion; - } - - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/search/SettingSearchBean.java b/opensrp-core/src/main/java/org/opensrp/search/SettingSearchBean.java deleted file mode 100644 index e8a6871cb0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/search/SettingSearchBean.java +++ /dev/null @@ -1,56 +0,0 @@ - -package org.opensrp.search; - -public class SettingSearchBean { - - private String providerId; - - private String locationId; - - private String team; - - private String teamId; - - private Long serverVersion; - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public String getLocationId() { - return locationId; - } - - public void setLocationId(String locationId) { - this.locationId = locationId; - } - - public String getTeam() { - return team; - } - - public void setTeam(String team) { - this.team = team; - } - - public String getTeamId() { - return teamId; - } - - public void setTeamId(String teamId) { - this.teamId = teamId; - } - - public Long getServerVersion() { - return serverVersion; - } - - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/search/StockSearchBean.java b/opensrp-core/src/main/java/org/opensrp/search/StockSearchBean.java deleted file mode 100644 index 9fe0b8977f..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/search/StockSearchBean.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.opensrp.search; - -public class StockSearchBean { - - private String identifier; - - private String stockTypeId; - - private String transactionType; - - private String providerId; - - private String value; - - private String dateCreated; - - private String toFrom; - - private String dateUpdated; - - private Long serverVersion; - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public String getStockTypeId() { - return stockTypeId; - } - - public void setStockTypeId(String stockTypeId) { - this.stockTypeId = stockTypeId; - } - - public String getTransactionType() { - return transactionType; - } - - public void setTransactionType(String transactionType) { - this.transactionType = transactionType; - } - - public String getProviderId() { - return providerId; - } - - public void setProviderId(String providerId) { - this.providerId = providerId; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getDateCreated() { - return dateCreated; - } - - public void setDateCreated(String dateCreated) { - this.dateCreated = dateCreated; - } - - public String getToFrom() { - return toFrom; - } - - public void setToFrom(String toFrom) { - this.toFrom = toFrom; - } - - public String getDateUpdated() { - return dateUpdated; - } - - public void setDateUpdated(String dateUpdated) { - this.dateUpdated = dateUpdated; - } - - public Long getServerVersion() { - return serverVersion; - } - - public void setServerVersion(Long serverVersion) { - this.serverVersion = serverVersion; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/BaseEntityService.java b/opensrp-core/src/main/java/org/opensrp/service/BaseEntityService.java deleted file mode 100644 index 97b6cb3495..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/BaseEntityService.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.opensrp.service; - -import java.util.List; - -import org.opensrp.domain.BaseEntity; -import org.opensrp.repository.BaseEntitiesRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class BaseEntityService { - - private final BaseEntitiesRepository allBaseEntities; - - @Autowired - public BaseEntityService(BaseEntitiesRepository allBaseEntities) { - this.allBaseEntities = allBaseEntities; - } - - public List getAllBaseEntities() { - return allBaseEntities.findAllBaseEntities(); - } - - public BaseEntity findByBaseEntityId(String baseEntityId) { - return allBaseEntities.findByBaseEntityId(baseEntityId); - } - - public List findByIdentifier(String identifier) { - return allBaseEntities.findAllByIdentifier(identifier); - } - - public List findByIdentifier(String identifierType, String identifier) { - return allBaseEntities.findAllByIdentifier(identifierType, identifier); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/CampaignService.java b/opensrp-core/src/main/java/org/opensrp/service/CampaignService.java deleted file mode 100644 index ce6f9917af..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/CampaignService.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.opensrp.service; - -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.joda.time.DateTime; -import org.opensrp.domain.Campaign; -import org.opensrp.repository.CampaignRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class CampaignService { - - private CampaignRepository campaignRepository; - - @Autowired - public void setCampaignRepository(CampaignRepository campaignRepository) { - this.campaignRepository = campaignRepository; - } - - public List getAllCampaigns() { - return campaignRepository.getAll(); - } - - public void addOrUpdateCampaign(Campaign campaign) { - if (StringUtils.isBlank(campaign.getIdentifier())) - throw new IllegalArgumentException("Identifier not specified"); - campaign.setServerVersion(System.currentTimeMillis()); - if (campaignRepository.get(campaign.getIdentifier()) != null) { - campaignRepository.update(campaign); - } else { - campaign.setAuthoredOn(new DateTime()); - campaignRepository.add(campaign); - } - } - - public Campaign addCampaign(Campaign campaign) { - if (StringUtils.isBlank(campaign.getIdentifier())) - throw new IllegalArgumentException("Identifier not specified"); - campaign.setServerVersion(System.currentTimeMillis()); - campaignRepository.add(campaign); - return campaign; - } - - public Campaign updateCampaign(Campaign campaign) { - if (StringUtils.isBlank(campaign.getIdentifier())) - throw new IllegalArgumentException("Identifier not specified"); - campaign.setServerVersion(System.currentTimeMillis()); - campaignRepository.update(campaign); - return campaign; - } - - public Campaign getCampaign(String identifier) { - if (StringUtils.isBlank(identifier)) - return null; - return campaignRepository.get(identifier); - } - public List getCampaignsByIdentifiers(String identifiers) { - if (StringUtils.isBlank(identifiers)) - return null; - return campaignRepository.getCampaignsByIdentifiers(identifiers); - } - - public List getCampaignsByServerVersion(long serverVersion) { - return campaignRepository.getCampaignsByServerVersion(serverVersion); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/ClientService.java b/opensrp-core/src/main/java/org/opensrp/service/ClientService.java deleted file mode 100644 index 8cf898072c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/ClientService.java +++ /dev/null @@ -1,332 +0,0 @@ -package org.opensrp.service; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.joda.time.DateTime; -import org.json.JSONException; -import org.opensrp.domain.Address; -import org.opensrp.domain.Client; -import org.opensrp.domain.postgres.HouseholdClient; -import org.opensrp.repository.ClientsRepository; -import org.opensrp.search.AddressSearchBean; -import org.opensrp.search.ClientSearchBean; -import org.opensrp.util.Utils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class ClientService { - - private final ClientsRepository allClients; - - @Autowired - public ClientService(ClientsRepository allClients) { - this.allClients = allClients; - } - - public Client getByBaseEntityId(String baseEntityId) { - return allClients.findByBaseEntityId(baseEntityId); - } - - public List findAllClients() { - return allClients.findAllClients(); - } - - public List findAllByIdentifier(String identifier) { - return allClients.findAllByIdentifier(identifier); - } - - public List findAllByIdentifier(String identifierType, String identifier) { - return allClients.findAllByIdentifier(identifierType, identifier); - } - - public List findByRelationshipIdAndDateCreated(String relationalId, String dateFrom, String dateTo) { - return allClients.findByRelationshipIdAndDateCreated(relationalId, dateFrom, dateTo); - } - - public List findByRelationship(String relationalId) { - return allClients.findByRelationShip(relationalId); - } - - public List findByRelationshipIdAndType(String relationshipType, String entityId) { - return allClients.findByRelationshipId(relationshipType, entityId); - } - - public List findAllByAttribute(String attributeType, String attribute) { - return allClients.findAllByAttribute(attributeType, attribute); - } - - public List findAllByMatchingName(String nameMatches) { - return allClients.findAllByMatchingName(nameMatches); - } - - public List findByCriteria(ClientSearchBean clientSearchBean, AddressSearchBean addressSearchBean, - DateTime lastEditFrom, DateTime lastEditTo) { - clientSearchBean.setLastEditFrom(lastEditFrom); - clientSearchBean.setLastEditTo(lastEditTo); - - return allClients.findByCriteria(clientSearchBean, addressSearchBean);//db.queryView(q.includeDocs(true), Client.class); - } - - public List findByCriteria(ClientSearchBean clientSearchBean, Long serverVersion) { - return allClients.findByCriteria(clientSearchBean, new AddressSearchBean()); - } - - /* public List findByCriteria(String addressType, String country, String stateProvince, String cityVillage, String countyDistrict, - String subDistrict, String town, String subTown, DateTime lastEditFrom, DateTime lastEditTo) { - return allClients.findByCriteria(null, null, null, null, null, null, null, null, addressType, country, stateProvince, cityVillage, countyDistrict, subDistrict, town, subTown, lastEditFrom, lastEditTo); - }*/ - - public List findByDynamicQuery(String query) { - return allClients.findByDynamicQuery(query); - } - - public Client addClient(Client client) { - if (client.getBaseEntityId() == null) { - throw new RuntimeException("No baseEntityId"); - } - Client c = findClient(client); - if (c != null) { - try { - updateClient(client); - } - catch (JSONException e) { - throw new IllegalArgumentException( - "A client already exists with given list of identifiers. Consider updating data.[" + c + "]"); - } - } - - client.setDateCreated(DateTime.now()); - allClients.add(client); - return client; - } - - public Client findClient(Client client) { - // find by auto assigned entity id - Client c = allClients.findByBaseEntityId(client.getBaseEntityId()); - if (c != null) { - return c; - } - - //still not found!! search by generic identifiers - - for (String idt : client.getIdentifiers().keySet()) { - List cl = allClients.findAllByIdentifier(client.getIdentifier(idt)); - if (cl.size() > 1) { - throw new IllegalArgumentException("Multiple clients with identifier type " + idt + " and ID " - + client.getIdentifier(idt) + " exist."); - } else if (cl.size() != 0) { - return cl.get(0); - } - } - return c; - } - - public Client find(String uniqueId) { - // find by document id - Client c = allClients.findByBaseEntityId(uniqueId); - if (c != null) { - return c; - } - - // if not found find if it is in any identifiers TODO refactor it later - List cl = allClients.findAllByIdentifier(uniqueId); - if (cl.size() > 1) { - throw new IllegalArgumentException("Multiple clients with identifier " + uniqueId + " exist."); - } else if (cl.size() != 0) { - return cl.get(0); - } - - return c; - } - - public void updateClient(Client updatedClient) throws JSONException { - // If update is on original entity - if (updatedClient.isNew()) { - throw new IllegalArgumentException( - "Client to be updated is not an existing and persisting domain object. Update database object instead of new pojo"); - } - - if (findClient(updatedClient) == null) { - throw new IllegalArgumentException("No client found with given list of identifiers. Consider adding new!"); - } - - updatedClient.setDateEdited(DateTime.now()); - allClients.update(updatedClient); - } - - public Client mergeClient(Client updatedClient) { - try { - Client original = findClient(updatedClient); - if (original == null) { - throw new IllegalArgumentException("No client found with given list of identifiers. Consider adding new!"); - } - - original = (Client) Utils.getMergedJSON(original, updatedClient, - Arrays.asList(Client.class.getDeclaredFields()), Client.class); - - for (Address a : updatedClient.getAddresses()) { - if (original.getAddress(a.getAddressType()) == null) { - original.addAddress(a); - } else { - original.removeAddress(a.getAddressType()); - original.addAddress(a); - } - } - for (String k : updatedClient.getIdentifiers().keySet()) { - original.addIdentifier(k, updatedClient.getIdentifier(k)); - } - for (String k : updatedClient.getAttributes().keySet()) { - original.addAttribute(k, updatedClient.getAttribute(k)); - } - - original.setDateEdited(DateTime.now()); - allClients.update(original); - return original; - } - catch (JSONException e) { - throw new RuntimeException(e); - } - } - - public List findByServerVersion(long serverVersion) { - return allClients.findByServerVersion(serverVersion); - } - - public List notInOpenMRSByServerVersion(long serverVersion, Calendar calendar) { - return allClients.notInOpenMRSByServerVersion(serverVersion, calendar); - } - - public List findByFieldValue(String field, List ids) { - return allClients.findByFieldValue(field, ids); - } - - public List findByFieldValue(String id) { - return allClients.findByRelationShip(id); - } - - public Client addorUpdate(Client client) { - if (client.getBaseEntityId() == null) { - throw new RuntimeException("No baseEntityId"); - } - Client c = findClient(client); - if (c != null) { - client.setRevision(c.getRevision()); - client.setId(c.getId()); - client.setDateEdited(DateTime.now()); - client.setServerVersion(null); - client.addIdentifier("OPENMRS_UUID", c.getIdentifier("OPENMRS_UUID")); - allClients.update(client); - - } else { - - client.setDateCreated(DateTime.now()); - allClients.add(client); - } - return client; - } - - public Client addorUpdate(Client client, boolean resetServerVersion) { - if (client.getBaseEntityId() == null) { - throw new RuntimeException("No baseEntityId"); - } - Client c = findClient(client); - if (c != null) { - client.setRevision(c.getRevision()); - client.setId(c.getId()); - client.setDateEdited(DateTime.now()); - if (resetServerVersion) { - client.setServerVersion(null); - } - allClients.update(client); - - } else { - client.setDateCreated(DateTime.now()); - allClients.add(client); - } - return client; - } - - public Map getMemberCountHouseholdHeadProviderByClients(List ids, String clientType) { - List householdClients = allClients.selectMemberCountHouseholdHeadProviderByClients("", ids, - clientType); - Map households = new HashMap(); - if (householdClients != null) { - for (HouseholdClient householdClient : householdClients) { - households.put(householdClient.getRelationalId(), householdClient); - } - } - return households; - } - - public HouseholdClient findTotalCountHouseholdByCriteria(ClientSearchBean clientSearchBean, - AddressSearchBean addressSearchBean) { - return allClients.findTotalCountHouseholdByCriteria(clientSearchBean, addressSearchBean); - } - - public List getHouseholdList(List ids, String clientType, AddressSearchBean addressSearchBean, - ClientSearchBean searchBean, List clients) { - Map householdClients = getMemberCountHouseholdHeadProviderByClients(ids, clientType); - - List clientList = new ArrayList(); - - for (Client client : clients) { - if (householdClients != null) { - HouseholdClient householdClient = householdClients.get(client.getBaseEntityId()); - if (householdClient != null) { - client.addAttribute("memberCount", householdClient.getMemebrCount()); - client.addAttribute("HouseholdHead", householdClient.getHouseholdHead()); - client.addAttribute("ProvierId", householdClient.getProviderId()); - } else { - client.addAttribute("memberCount", 0); - client.addAttribute("HouseholdHead", ""); - client.addAttribute("ProvierId", ""); - } - clientList.add(client); - } - } - return clientList; - } - - public List findMembersByRelationshipId(String relationshipId) { - return allClients.findMembersByRelationshipId(relationshipId); - } - - public List findAllClientsByCriteria(ClientSearchBean clientSearchBean, AddressSearchBean addressSearchBean) { - return allClients.findAllClientsByCriteria(clientSearchBean, addressSearchBean); - } - - public HouseholdClient findTotalCountAllClientsByCriteria(ClientSearchBean clientSearchBean, - AddressSearchBean addressSearchBean) { - return allClients.findCountAllClientsByCriteria(clientSearchBean, addressSearchBean); - } - - public List findHouseholdByCriteria(ClientSearchBean clientSearchBean, AddressSearchBean addressSearchBean, - DateTime lastEditFrom, DateTime lastEditTo) { - clientSearchBean.setLastEditFrom(lastEditFrom); - clientSearchBean.setLastEditTo(lastEditTo); - return allClients.findHouseholdByCriteria(clientSearchBean, addressSearchBean); - - } - - public List findAllANCByCriteria(ClientSearchBean clientSearchBean, AddressSearchBean addressSearchBean) { - return allClients.findANCByCriteria(clientSearchBean, addressSearchBean); - } - - public int findCountANCByCriteria(ClientSearchBean clientSearchBean, AddressSearchBean addressSearchBean) { - return allClients.findCountANCByCriteria(clientSearchBean, addressSearchBean); - } - - public List findAllChildByCriteria(ClientSearchBean clientSearchBean, AddressSearchBean addressSearchBean) { - return allClients.findChildByCriteria(clientSearchBean, addressSearchBean); - } - - public int findCountChildByCriteria(ClientSearchBean clientSearchBean, AddressSearchBean addressSearchBean) { - return allClients.findCountChildByCriteria(clientSearchBean, addressSearchBean); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/ConfigService.java b/opensrp-core/src/main/java/org/opensrp/service/ConfigService.java deleted file mode 100644 index 064d3ee235..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/ConfigService.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.opensrp.service; - -import java.util.List; - -import org.opensrp.domain.AppStateToken; -import org.opensrp.repository.AppStateTokensRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.mysql.jdbc.StringUtils; - -@Service -public class ConfigService { - - private final AppStateTokensRepository allAppStateTokens; - - @Autowired - public ConfigService(AppStateTokensRepository allAppStateTokens) { - this.allAppStateTokens = allAppStateTokens; - } - - /** - * @param tokenName - * @return AppStateToken with given name. Since model is supposed to keep track of system`s - * state at any given time it throws IllegalStateException incase multiple Tokens found - * with same name. - */ - public AppStateToken getAppStateTokenByName(Enum tokenName) { - List ol = allAppStateTokens.findByName(tokenName.name()); - return getUniqueAppStateTokeFromTokenList(ol, tokenName); - } - - public void updateAppStateToken(Enum tokenName, Object value) { - List ol = allAppStateTokens.findByName(tokenName.name()); - AppStateToken ast = updateUniqueAppStateToken(ol, tokenName, value); - allAppStateTokens.update(ast); - } - - /** - * Registers a new token to manage the specified variable state (by token name) of App. Throws - * IllegalArgumentException if tokenName or description is not provided or if name is not unique - * >>>>>>> bda3b96... Define interfaces for Repositories. Services to use interfaces i.e. - * already exists in system and flag suppressExceptionIfExists is false. - * - * @param tokenName - * @param defaultValue - * @param description - * @param suppressExceptionIfExists - * @return The newly registered token. - */ - public AppStateToken registerAppStateToken(Enum tokenName, Object defaultValue, String description, - boolean suppressExceptionIfExists) { - - checkIfNameAndDescriptionExist(tokenName, description); - - List atl = allAppStateTokens.findByName(tokenName.name()); - - AppStateToken existingAppStateToken = checkIfTokenAlreadyExist(atl, tokenName, suppressExceptionIfExists); - - if (existingAppStateToken != null) { - return existingAppStateToken; - } - - AppStateToken token = new AppStateToken(tokenName.name(), defaultValue, 0L, description); - allAppStateTokens.add(token); - return token; - } - - private AppStateToken getUniqueAppStateTokeFromTokenList(List appStateTokens, Enum tokenName) { - if (appStateTokens.size() > 1) { - throw new IllegalStateException("System was found to have multiple token with same name (" + tokenName.name() - + "). This can lead to potential critical inconsistencies."); - } - - return appStateTokens.size() == 0 ? null : appStateTokens.get(0); - } - - private AppStateToken updateUniqueAppStateToken(List allAppStateTokens, Enum tokenName, Object value) { - if (allAppStateTokens.size() > 1) { - throw new IllegalStateException("System was found to have multiple token with same name (" + tokenName.name() - + "). This can lead to potential critical inconsistencies."); - } - - if (allAppStateTokens.size() == 0) { - throw new IllegalStateException("Property with name (" + tokenName.name() + ") not found."); - } - - AppStateToken ast = allAppStateTokens.get(0); - ast.setValue(value); - ast.setLastEditDate(System.currentTimeMillis()); - return ast; - } - - private void checkIfNameAndDescriptionExist(Enum tokenName, String description) { - if (tokenName == null || StringUtils.isEmptyOrWhitespaceOnly(description)) { - throw new IllegalArgumentException("Token name and description must be provided"); - } - } - - private AppStateToken checkIfTokenAlreadyExist(List appStateTokens, Enum tokenName, - boolean suppressExceptionIfExists) { - if (appStateTokens.size() > 0) { - if (!suppressExceptionIfExists) { - throw new IllegalArgumentException("Token with given name (" + tokenName.name() + ") already exists."); - } - return appStateTokens.get(0); - } - return null; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/ErrorTraceService.java b/opensrp-core/src/main/java/org/opensrp/service/ErrorTraceService.java deleted file mode 100644 index 2757256872..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/ErrorTraceService.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.opensrp.service; - -import java.util.List; - -import org.ektorp.DocumentNotFoundException; -import org.joda.time.DateTime; -import org.opensrp.domain.ErrorTrace; -import org.opensrp.repository.ErrorTraceRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * @author muhammad.ahmed@ihsinformatics.com Created on May 25, 2015 - */ -@Service -public class ErrorTraceService { - - private final ErrorTraceRepository allErrorTrace; - - @Autowired - public ErrorTraceService(ErrorTraceRepository allErrorTrace) { - this.allErrorTrace = allErrorTrace; - } - - /** - * Saves logs to on database - * This method has been disabled and logs are no longer saved on the database from 06/September/2018 - * @param Error - */ - public void addError(ErrorTrace entity) { - //allErrorTrace.add(entity); - } - - /** - * @param errorType - * @param documentType - * @param recordId - * @param stackTrace - * @param retryURL this method is used for logs and it should be called on Exception Catch . - * retryURL should be given by developer, it is for resubmission or retry of that - * particular record . - */ - public void log(String errorType, String documentType, String recordId, String stackTrace, String retryURL) { - ErrorTrace error = new ErrorTrace(); - error.setErrorType(errorType); - error.setDocumentType(documentType); - error.setRecordId(recordId); - error.setStackTrace(stackTrace); - error.setRetryUrl(retryURL); - error.setDateOccurred(DateTime.now()); - addError(error); - - } - - /** - * Update logs saved on database - * This method has been disabled logs are no longer saved on the database from 06/September/2018 - * @param Error - */ - public void updateError(ErrorTrace entity) { - //allErrorTrace.update(entity); - } - - public List getAllErrors() throws DocumentNotFoundException { - - List allErrorList = allErrorTrace.findAllErrors(); - if (null == allErrorList || allErrorList.isEmpty()) { - return null; - - } - - return allErrorList; - - } - - public List getAllSolvedErrors() throws DocumentNotFoundException { - - List allErrorList = allErrorTrace.findAllSolvedErrors(); - if (null == allErrorList || allErrorList.isEmpty()) { - return null; - - } - - return allErrorList; - - } - - public List getAllUnsolvedErrors() throws DocumentNotFoundException { - - List allErrorList = allErrorTrace.findAllUnSolvedErrors(); - if (null == allErrorList || allErrorList.isEmpty()) { - return null; - - } - - return allErrorList; - - } - - public ErrorTrace getError(String id) throws DocumentNotFoundException { - - return allErrorTrace.findById(id); - - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/EventService.java b/opensrp-core/src/main/java/org/opensrp/service/EventService.java deleted file mode 100644 index b69c3e28e6..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/EventService.java +++ /dev/null @@ -1,369 +0,0 @@ -package org.opensrp.service; - -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.apache.commons.lang3.StringUtils; -import org.joda.time.DateTime; -import org.json.JSONException; -import org.opensrp.common.AllConstants.Client; -import org.opensrp.domain.Event; -import org.opensrp.domain.Obs; -import org.opensrp.repository.EventsRepository; -import org.opensrp.search.EventSearchBean; -import org.opensrp.util.Utils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class EventService { - - private final EventsRepository allEvents; - - private ClientService clientService; - - @Autowired - public EventService(EventsRepository allEvents, ClientService clientService) { - this.allEvents = allEvents; - this.clientService = clientService; - } - - public List findAllByIdentifier(String identifier) { - return allEvents.findAllByIdentifier(identifier); - } - - public List findAllByIdentifier(String identifierType, String identifier) { - return allEvents.findAllByIdentifier(identifierType, identifier); - } - - public Event getById(String id) { - return allEvents.findById(id); - } - - public Event getByBaseEntityAndFormSubmissionId(String baseEntityId, String formSubmissionId) { - return allEvents.findByBaseEntityAndFormSubmissionId(baseEntityId, formSubmissionId); - } - - public List findByBaseEntityId(String baseEntityId) { - return allEvents.findByBaseEntityId(baseEntityId); - } - - public Event findByFormSubmissionId(String formSubmissionId) { - return allEvents.findByFormSubmissionId(formSubmissionId); - } - - public List findEventsBy(EventSearchBean eventSearchBean) { - return allEvents.findEvents(eventSearchBean); - } - - public List findEventsByDynamicQuery(String query) { - return allEvents.findEventsByDynamicQuery(query); - } - - private static Logger logger = LoggerFactory.getLogger(EventService.class.toString()); - - public Event find(String uniqueId) { - try { - List el = allEvents.findAllByIdentifier(uniqueId); - return getUniqueEventFromEventList(el); - } - catch (IllegalArgumentException e) { - throw new IllegalArgumentException("Multiple events with identifier " + uniqueId + " exist."); - } - } - - public Event find(Event event) { - for (String idt : event.getIdentifiers().keySet()) { - try { - List el = allEvents.findAllByIdentifier(event.getIdentifier(idt)); - return getUniqueEventFromEventList(el); - } - catch (IllegalArgumentException e) { - throw new IllegalArgumentException( - "Multiple events with identifier type " + idt + " and ID " + event.getIdentifier(idt) + " exist."); - } - } - return null; - } - - /** - * Find an event using the event Id - * @param eventId the if for the event - * @return an event matching the eventId - */ - public Event findById(String eventId) { - try { - if (StringUtils.isEmpty(eventId) ) { - return null; - } - return allEvents.findById(eventId); - } - catch (Exception e) { - logger.error("", e); - } - return null; - } - - /** - * Find an event using an event Id or form Submission Id - * @param eventId the if for the event - * @param formSubmissionId form submission id for the events - * @return an event matching the eventId or formsubmission id - */ - public Event findByIdOrFormSubmissionId(String eventId, String formSubmissionId) { - Event event=null; - try { - if(StringUtils.isNotEmpty(eventId)) { - event = findById(eventId); - } - if (event == null && StringUtils.isNotEmpty(formSubmissionId)) { - return findByFormSubmissionId(formSubmissionId); - } - } - catch (Exception e) { - logger.error("", e); - } - return event; - } - - public synchronized Event addEvent(Event event) { - Event e = find(event); - if (e != null) { - throw new IllegalArgumentException( - "An event already exists with given list of identifiers. Consider updating data.[" + e + "]"); - } - - if (event.getFormSubmissionId() != null - && getByBaseEntityAndFormSubmissionId(event.getBaseEntityId(), event.getFormSubmissionId()) != null) { - throw new IllegalArgumentException( - "An event already exists with given baseEntity and formSubmission combination. Consider updating"); - } - - event.setDateCreated(DateTime.now()); - allEvents.add(event); - return event; - } - - /** - * An out of area event is used to record services offered outside a client's catchment area. - * The event usually will have a client unique identifier(ZEIR_ID) as the only way to identify - * the client.This method finds the client based on the identifier and assigns a basentityid to - * the event - * - * @param event - * @return - */ - public synchronized Event processOutOfArea(Event event) { - try { - final String BIRTH_REGISTRATION_EVENT = "Birth Registration"; - final String GROWTH_MONITORING_EVENT = "Growth Monitoring"; - final String VACCINATION_EVENT = "Vaccination"; - final String OUT_OF_AREA_SERVICE = "Out of Area Service"; - final String NFC_CARD_IDENTIFIER = "NFC_Card_Identifier"; - final String CARD_ID_PREFIX = "c_"; - - if (StringUtils.isNotBlank(event.getBaseEntityId())) { - return event; - } - - //get events identifiers; - String identifier = event.getIdentifier(Client.ZEIR_ID); - if (StringUtils.isBlank(identifier)) { - return event; - } - - boolean isCardId = identifier.startsWith(CARD_ID_PREFIX); - - List clients = - - isCardId ? clientService - .findAllByAttribute(NFC_CARD_IDENTIFIER, identifier.substring(CARD_ID_PREFIX.length())) - : clientService.findAllByIdentifier(Client.ZEIR_ID.toUpperCase(), identifier); - - if (clients == null || clients.isEmpty()) { - return event; - } - - for (org.opensrp.domain.Client client : clients) { - - //set providerid to the last providerid who served this client in their catchment (assumption) - List existingEvents = findByBaseEntityAndType(client.getBaseEntityId(), BIRTH_REGISTRATION_EVENT); - - if (existingEvents == null || existingEvents.isEmpty()) { - return event; - } - - Event birthRegEvent = existingEvents.get(0); - event.getIdentifiers().remove(Client.ZEIR_ID.toUpperCase()); - event.setBaseEntityId(client.getBaseEntityId()); - //Map identifiers = event.getIdentifiers(); - //event identifiers are unique so removing zeir_id since baseentityid has been found - //also out of area service events stick with the providerid so that they can sync back to them for reports generation - if (!event.getEventType().startsWith(OUT_OF_AREA_SERVICE)) { - event.setProviderId(birthRegEvent.getProviderId()); - event.setLocationId(birthRegEvent.getLocationId()); - Map details = new HashMap(); - details.put("out_of_catchment_provider_id", event.getProviderId()); - event.setDetails(details); - } else if (event.getEventType().contains(GROWTH_MONITORING_EVENT) - || event.getEventType().contains(VACCINATION_EVENT)) { - - String eventType = event.getEventType().contains(GROWTH_MONITORING_EVENT) ? GROWTH_MONITORING_EVENT - : event.getEventType().contains(VACCINATION_EVENT) ? VACCINATION_EVENT : null; - if (eventType != null) { - Event newEvent = new Event(); - newEvent.withBaseEntityId(event.getBaseEntityId()).withEventType(eventType) - .withEventDate(event.getEventDate()).withEntityType(event.getEntityType()) - .withProviderId(birthRegEvent.getProviderId()).withLocationId(birthRegEvent.getLocationId()) - .withFormSubmissionId(UUID.randomUUID().toString()).withDateCreated(event.getDateCreated()); - - newEvent.setObs(event.getObs()); - addEvent(newEvent); - } - } - //Legacy code only picked the first item so we break - if (!isCardId) { - break; - } - - } - } - catch (Exception e) { - logger.error("", e); - } - - return event; - } - - public synchronized Event addorUpdateEvent(Event event) { - Event existingEvent = findByIdOrFormSubmissionId(event.getId(),event.getFormSubmissionId()); - if (existingEvent != null) { - event.setId(existingEvent.getId()); - event.setRevision(existingEvent.getRevision()); - event.setDateEdited(DateTime.now()); - event.setServerVersion(null); - event.setRevision(existingEvent.getRevision()); - allEvents.update(event); - - } else { - event.setDateCreated(DateTime.now()); - allEvents.add(event); - - } - - return event; - } - - public void updateEvent(Event updatedEvent) { - // If update is on original entity - if (updatedEvent.isNew()) { - throw new IllegalArgumentException( - "Event to be updated is not an existing and persisting domain object. Update database object instead of new pojo"); - } - - updatedEvent.setDateEdited(DateTime.now()); - - allEvents.update(updatedEvent); - } - - //TODO Review and add test cases as well - public Event mergeEvent(Event updatedEvent) { - try { - Event original = find(updatedEvent); - if (original == null) { - throw new IllegalArgumentException("No event found with given list of identifiers. Consider adding new!"); - } - - original = (Event) Utils.getMergedJSON(original, updatedEvent, Arrays.asList(Event.class.getDeclaredFields()), - Event.class); - for (Obs o : updatedEvent.getObs()) { - // TODO handle parent - if (original.getObs(null, o.getFieldCode()) == null) { - original.addObs(o); - } else { - original.getObs(null, o.getFieldCode()).setComments(o.getComments()); - original.getObs(null, o.getFieldCode()).setEffectiveDatetime(o.getEffectiveDatetime()); - original.getObs(null, o.getFieldCode()) - .setValue(o.getValues().size() < 2 ? o.getValue() : o.getValues()); - } - } - for (String k : updatedEvent.getIdentifiers().keySet()) { - original.addIdentifier(k, updatedEvent.getIdentifier(k)); - } - - original.setDateEdited(DateTime.now()); - allEvents.update(original); - return original; - } - catch (JSONException e) { - throw new RuntimeException(e); - } - } - - public List findByServerVersion(long serverVersion) { - return allEvents.findByServerVersion(serverVersion); - } - - public List notInOpenMRSByServerVersion(long serverVersion, Calendar calendar) { - return allEvents.notInOpenMRSByServerVersion(serverVersion, calendar); - } - - public List notInOpenMRSByServerVersionAndType(String type, long serverVersion, Calendar calendar) { - return allEvents.notInOpenMRSByServerVersionAndType(type, serverVersion, calendar); - } - - public List getAll() { - return allEvents.getAll(); - } - - public List findEvents(EventSearchBean eventSearchBean, String sortBy, String sortOrder, int limit) { - return allEvents.findEvents(eventSearchBean, sortBy, sortOrder, limit); - } - - public List findEvents(EventSearchBean eventSearchBean) { - return allEvents.findEvents(eventSearchBean); - } - - public List findEventsByConceptAndValue(String concept, String conceptValue) { - return allEvents.findByConceptAndValue(concept, conceptValue); - - } - - public List findByBaseEntityAndType(String baseEntityId, String eventType) { - return allEvents.findByBaseEntityAndType(baseEntityId, eventType); - - } - - private Event getUniqueEventFromEventList(List events) throws IllegalArgumentException { - if (events.size() > 1) { - throw new IllegalArgumentException(); - } - if (events.size() == 0) { - return null; - } - return events.get(0); - } - - public List findByProviderAndEntityType(String provider) { - return allEvents.findByProvider(provider); - } - - /** - * This method searches for event ids filtered by eventType - * and the date they were deleted - * - * @param eventType used to filter the event ids - * @param dateDeleted date on or after which deleted event ids should be returned - * @return a list of event ids - */ - public List findAllIdsByEventType(String eventType, Date dateDeleted) { - return allEvents.findIdsByEventType(eventType, dateDeleted); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/FormSubmissionDataMigrationService.java b/opensrp-core/src/main/java/org/opensrp/service/FormSubmissionDataMigrationService.java deleted file mode 100644 index 8180723860..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/FormSubmissionDataMigrationService.java +++ /dev/null @@ -1,292 +0,0 @@ -package org.opensrp.service; - -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.ektorp.CouchDbConnector; -import org.json.JSONException; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.AppStateToken; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.service.FormSubmissionService; -import org.opensrp.repository.couch.AllAppStateTokens; -import org.opensrp.service.formSubmission.FormSubmissionProcessor; -import org.opensrp.util.Utils; -import org.opensrp.util.Utils.DatabaseConnectionParams; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; - -import com.mysql.jdbc.StringUtils; - -/** - * @author onamacuser This service fetches existing form submissions data from couchdb and converts - * them to events and clients - */ -@Service -public class FormSubmissionDataMigrationService { - - protected final Log logger = LogFactory.getLog(getClass()); - - @Autowired - FormSubmissionService formSubmissionService; - - @Autowired - FormSubmissionProcessor processor; - - @Autowired - private ConfigService configService; - - @Autowired - @Qualifier("couchAppStateTokensRepository") - private AllAppStateTokens allAppStateTokens; - - private volatile int BATCH_SIZE = 100; - - //private static final int THREADS_COUNT = 5; - - private enum MigrationType { - TO_LOCAL_DB, - TO_REMOTE_DB - } - - /** - * Based on the last processed form submission version process any newly added or updated - * formsubmissions. This method assumes the data is in the db the app is currently running on - * - * @return - */ - public void migrateFormSubmissions() { - //ExecutorService executor = Executors.newFixedThreadPool(THREADS_COUNT); - - try { - configService.registerAppStateToken(AllConstants.Config.FORM_ENTITY_PARSER_LAST_MIGRATED_FORM_SUBMISSION, 0, - "Token to keep track of forms processed for client n event parsing and schedule handling", true); - - boolean processSubmissions = true; - - while (processSubmissions) { - long lastMigratedFsVersion = getVersion(); - - List formSubmissions = formSubmissionService.getAllSubmissions(lastMigratedFsVersion, - BATCH_SIZE); - processSubmissions = formSubmissions != null && !formSubmissions.isEmpty(); - - if (processSubmissions) { - - Runnable migrateFormSubmissionsTask = new MigrateFormSubmissionsTask(MigrationType.TO_LOCAL_DB, - formSubmissions); - //executor.execute(migrateFormSubmissionsTask); - migrateFormSubmissionsTask.run(); - } - } - // This will make the executor accept no new threads - // and finish all existing threads in the queue - //executor.shutdown(); - } - catch (Exception e) { - logger.error("", e); - //executor.shutdown(); - } - } - - /** - * This method pulls form submissions from the source db and saves the broken down submissions - * (to EC model) to the target db - * - * @param sourceDbParams - * @param targetDbParams - */ - public void migrateFormSubmissions(DatabaseConnectionParams sourceDbParams, DatabaseConnectionParams targetDbParams) { - //ExecutorService executor = Executors.newFixedThreadPool(THREADS_COUNT); - - try { - - CouchDbConnector sourceDb = Utils.connectToDB(sourceDbParams); - CouchDbConnector targetDb = Utils.connectToDB(targetDbParams); - - registerAppStateToken(sourceDb, AllConstants.Config.FORM_ENTITY_PARSER_LAST_MIGRATED_FORM_SUBMISSION, 0, - "Token to keep track of forms processed for client n event parsing and schedule handling", true); - - boolean processSubmissions = true; - - while (processSubmissions) { - long lastMigratedFsVersion = getVersion(sourceDb); - List formSubmissions = formSubmissionService.getAllSubmissions(sourceDb, - lastMigratedFsVersion, BATCH_SIZE); - processSubmissions = formSubmissions != null && !formSubmissions.isEmpty(); - - if (processSubmissions) { - - Runnable migrateFormSubmissionsTask = new MigrateFormSubmissionsTask(sourceDb, targetDb, - MigrationType.TO_REMOTE_DB, formSubmissions); - //executor.execute(migrateFormSubmissionsTask); - migrateFormSubmissionsTask.run(); - } - } - // This will make the executor accept no new threads - // and finish all existing threads in the queue - //executor.shutdown(); - - } - catch (Exception e) { - logger.error("", e); - //executor.shutdown(); - } - - } - - private long getVersion() { - AppStateToken token = configService - .getAppStateTokenByName(AllConstants.Config.FORM_ENTITY_PARSER_LAST_MIGRATED_FORM_SUBMISSION); - return token == null ? 0L : token.longValue(); - } - - /** - * Gets appstatetoken from the specified database - * - * @param db - * @param tokenName - * @return AppStateToken with given name. Since model is supposed to keep track of system`s - * state at any given time it throws IllegalStateException incase multiple Tokens found - * with same name. - */ - public AppStateToken getAppStateTokenByName(CouchDbConnector db, Enum tokenName) { - List ol = allAppStateTokens.findByName(db, tokenName.name()); - if (ol.size() > 1) { - throw new IllegalStateException("System was found to have multiple token with same name (" + tokenName.name() - + "). This can lead to potential critical inconsistencies."); - } - - return ol.size() == 0 ? null : ol.get(0); - } - - public void updateAppStateToken(CouchDbConnector db, Enum tokenName, Object value) { - List ol = allAppStateTokens.findByName(db, tokenName.name()); - if (ol.size() > 1) { - throw new IllegalStateException("System was found to have multiple token with same name (" + tokenName.name() - + "). This can lead to potential critical inconsistencies."); - } - - if (ol.size() == 0) { - throw new IllegalStateException("Property with name (" + tokenName.name() + ") not found."); - } - - AppStateToken ast = ol.get(0); - ast.setValue(value); - ast.setLastEditDate(System.currentTimeMillis()); - db.update(ast); - } - - /** - * Registers a new token to manage the specified variable state (by token name) of App. The - * token is registered in the specified db - * - * @param db - * @param tokenName - * @param defaultValue - * @param description - * @param suppressExceptionIfExists - * @return - */ - public AppStateToken registerAppStateToken(CouchDbConnector db, Enum tokenName, Object defaultValue, - String description, boolean suppressExceptionIfExists) { - if (tokenName == null || StringUtils.isEmptyOrWhitespaceOnly(description)) { - throw new IllegalArgumentException("Token name and description must be provided"); - } - - List atl = allAppStateTokens.findByName(db, tokenName.name()); - if (atl.size() > 0) { - if (!suppressExceptionIfExists) { - throw new IllegalArgumentException("Token with given name (" + tokenName.name() + ") already exists."); - } - return atl.get(0); - } - - AppStateToken token = new AppStateToken(tokenName.name(), defaultValue, 0L, description); - allAppStateTokens.add(db, token); - return token; - } - - private long getVersion(CouchDbConnector db) { - AppStateToken token = getAppStateTokenByName(db, - AllConstants.Config.FORM_ENTITY_PARSER_LAST_MIGRATED_FORM_SUBMISSION); - return token == null ? 0L : token.longValue(); - } - - /** - * Worker thread to break down formsubmissions to ec data. - * - * @author onamacuser - */ - class MigrateFormSubmissionsTask implements Runnable { - - MigrationType type; - - List formSubmissions; - - CouchDbConnector sourceDb; - - CouchDbConnector targetDb; - - MigrateFormSubmissionsTask(MigrationType _type, List _formSubmissions) { - type = _type; - formSubmissions = _formSubmissions; - } - - MigrateFormSubmissionsTask(CouchDbConnector _sourceDb, CouchDbConnector _targetDb, MigrationType _type, - List _formSubmissions) { - type = _type; - formSubmissions = _formSubmissions; - sourceDb = _sourceDb; - targetDb = _targetDb; - } - - @Override - public void run() { - switch (type) { - case TO_LOCAL_DB: - - try { - // break down the submissions to ec model - for (FormSubmission submission : formSubmissions) { - - configService.updateAppStateToken( - AllConstants.Config.FORM_ENTITY_PARSER_LAST_MIGRATED_FORM_SUBMISSION, - submission.serverVersion()); - processor.makeModelEntities(submission); - } - } - catch (Exception e) { - logger.error("", e); - - } - break; - - case TO_REMOTE_DB: - - try { - // break down the submissions to ec model - for (FormSubmission submission : formSubmissions) { - updateAppStateToken(sourceDb, - AllConstants.Config.FORM_ENTITY_PARSER_LAST_MIGRATED_FORM_SUBMISSION, - submission.serverVersion()); - processor.makeModelEntities(targetDb, submission); - - } - } - catch (JSONException e) { - logger.error("", e); - - } - break; - default: - logger.debug("Unknown migration type"); - break; - - } - } - - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/LocationService.java b/opensrp-core/src/main/java/org/opensrp/service/LocationService.java deleted file mode 100644 index dc708787e0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/LocationService.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.opensrp.service; - -import java.util.ArrayList; -import java.util.List; - -import org.opensrp.api.domain.Location; -import org.opensrp.repository.couch.AllLocations; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class LocationService { - - private final AllLocations allLocations; - - @Autowired - public LocationService(AllLocations allLocations) { - this.allLocations = allLocations; - } - - public List getAllLocations() { - ArrayList apiLocations = new ArrayList<>(); - - List locations = allLocations.findAllLocations(); - - for (org.opensrp.domain.Location location : locations) { - org.opensrp.domain.Location parentLocation = location.getParentLocation(); - - Location apiParentLocation = new Location().withLocationId(parentLocation.getLocationId()) - .withName(parentLocation.getName()).withTags(parentLocation.getTags()) - //.withAddress(parentLocation.getAddress()) - .withAttributes(parentLocation.getAttributes()).withIdentifiers(parentLocation.getIdentifiers()); - - Location apiLocation = new Location().withLocationId(location.getLocationId()).withName(location.getName()) - .withParentLocation(apiParentLocation).withTags(location.getTags()) - // .withAddress(location.getAddress()) - .withIdentifiers(location.getIdentifiers()).withAttributes(location.getAttributes()); - - /* - apiLocation.withCreator(location.getCreator()); - apiLocation.withEditor(location.getEditor()); - apiLocation.withVoider(location.getVoider()); - apiLocation.withDateCreated(location.getDateCreated()); - apiLocation.withDateEdited(location.getDateEdited()); - apiLocation.withDateVoided(location.getDateVoided()); - apiLocation.withVoided(location.getVoided()); - apiLocation.withVoidReason(location.getRevision());*/ - - apiLocations.add(apiLocation); - - } - - return apiLocations; - - } - - public void addLocation(Location location) { - org.opensrp.domain.Location domainLocation = new org.opensrp.domain.Location() - .withLocationId(location.getLocationId()).withName(location.getName()).withTags(location.getTags()) - //.withAddress(location.getAddress()) - .withIdentifiers(location.getIdentifiers()).withAttributes(location.getAttributes()); - allLocations.add(domainLocation); - - } - - // FIXME: 8/28/17 api.Location to domain.Location doens't set id field. - public void updateLocation(Location location) { - org.opensrp.domain.Location domainLocation = new org.opensrp.domain.Location() - .withLocationId(location.getLocationId()).withName(location.getName()).withTags(location.getTags()) - //.withAddress(location.getAddress()) - .withIdentifiers(location.getIdentifiers()).withAttributes(location.getAttributes()); - allLocations.update(domainLocation); - - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/MultimediaService.java b/opensrp-core/src/main/java/org/opensrp/service/MultimediaService.java deleted file mode 100644 index 4dce5942ad..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/MultimediaService.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.opensrp.service; - -import org.opensrp.domain.Multimedia; -import org.opensrp.dto.form.MultimediaDTO; -import org.opensrp.repository.MultimediaRepository; -import org.opensrp.service.multimedia.MultimediaFileManager; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; - -import java.io.File; -import java.util.List; - -@Service -public class MultimediaService { - - public static final String VIDEOS_DIR = "videos"; - - public static final String IMAGES_DIR = "patient_images"; - - public static final String MULTI_VERSION = "multi_version"; - - private final MultimediaRepository multimediaRepository; - - private MultimediaFileManager fileManager; - - private ClientService clientService; - - @Autowired - public MultimediaService(MultimediaRepository multimediaRepository, ClientService clientService) { - this.multimediaRepository = multimediaRepository; - this.clientService = clientService; - } - - public List getMultimediaFiles(String providerId) { - return multimediaRepository.all(providerId); - } - - public Multimedia findByCaseId(String entityId) { - return multimediaRepository.findByCaseId(entityId); - } - - /** - * Returns a {@link List} of {@link Multimedia} objects that match the given parameters - * - * @param entityId The baseEntityId of the client who owns the multimedia file(s) - * @param contentType The contentType of the multimedia file(s) to be fetched - * @param fileCategory The file category of the multimedia file(s) - * - * @return A {@link List} of {@link Multimedia} objects - */ - public List getMultimediaFiles(String entityId, String contentType, String fileCategory) { - return multimediaRepository.get(entityId, contentType, fileCategory); - } - - /** - * - * Persists a {@link MultipartFile} to storage - * - * @param multimedia - * @param file - * @return - */ - public String saveFile(MultimediaDTO multimedia, MultipartFile file) { - return fileManager.saveFile(multimedia, file); - } - - /** - * - * Retrieves a file from storage or null if it doesn't exist - * - * @param filePath - * @return - */ - public File retrieveFile(String filePath) { - return fileManager.retrieveFile(filePath); - } - - @Autowired - @Qualifier("multimedia_file_manager") - public void setFileManager(MultimediaFileManager fileManager) { - this.fileManager = fileManager; - } - - public MultimediaFileManager getFileManager() { - return fileManager; - } - - public ClientService getClientService() { - return clientService; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/OpenmrsIDService.java b/opensrp-core/src/main/java/org/opensrp/service/OpenmrsIDService.java deleted file mode 100644 index f4545e2d6f..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/OpenmrsIDService.java +++ /dev/null @@ -1,218 +0,0 @@ -package org.opensrp.service; - -import java.io.IOException; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.util.EntityUtils; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.opensrp.domain.Client; -import org.opensrp.domain.UniqueId; -import org.opensrp.repository.UniqueIdRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -@Service -public class OpenmrsIDService { - - @Value("#{opensrp['openmrs.url']}") - private String openmrsUrl; - - @Value("#{opensrp['openmrs.username']}") - private String openmrsUserName; - - @Value("#{opensrp['openmrs.password']}") - private String openmrsPassword; - - @Value("#{opensrp['openmrs.idgen.idsource']}") - private int openmrsSourceId; - - // Client identifiers constant - public static final String ZEIR_IDENTIFIER = "ZEIR_ID"; - - public static final String CHILD_REGISTER_CARD_NUMBER = "Child_Register_Card_Number"; - - public static final String OPENMRS_IDGEN_URL = "module/idgen/exportIdentifiers.form"; - - private static Logger logger = LoggerFactory.getLogger(OpenmrsIDService.class.toString()); - - private HttpClient client; - - @Autowired - private UniqueIdRepository uniqueIdRepository; - - public static OpenmrsIDService createInstanceWithOpenMrsUrl(String openmrsUrl) { - OpenmrsIDService openmrsIDService = new OpenmrsIDService(); - openmrsIDService.openmrsUrl = openmrsUrl; - return openmrsIDService; - } - - public OpenmrsIDService() { - this.client = HttpClientBuilder.create().build(); - } - - public List downloadOpenmrsIds(int size) { - List ids = new ArrayList(); - String openmrsQueryUrl = this.openmrsUrl + OPENMRS_IDGEN_URL; - // Add query parameters - openmrsQueryUrl += "?source=" + this.openmrsSourceId + "&numberToGenerate=" + size; - openmrsQueryUrl += "&username=" + this.openmrsUserName + "&password=" + this.openmrsPassword; - - HttpGet get = new HttpGet(openmrsQueryUrl); - try { - HttpResponse response = client.execute(get); - String jsonResponse = EntityUtils.toString(response.getEntity()); - - JSONObject responseJson = new JSONObject(jsonResponse); - JSONArray jsonArray = responseJson.getJSONArray("identifiers"); - - if (jsonArray != null && jsonArray.length() > 0) { - for (int i = 0; i < jsonArray.length(); i++) { - ids.add(jsonArray.getString(i)); - } - } - } - catch (IOException | JSONException e) { - logger.error("", e); - return null; - } - // import IDs and client data to database together with assignments - return ids; - } - - /** - * download ids only if the total unused is less than the size specified - * - * @param size - */ - public void downloadAndSaveIds(int size, String userName) { - try { - Integer totalUnUsed = uniqueIdRepository.totalUnUsedIds(); - if (totalUnUsed < size) { - int numberToGenerate = size - totalUnUsed; - List ids = downloadOpenmrsIds(numberToGenerate); - for (String id : ids) { - UniqueId uniqueId = new UniqueId(); - uniqueId.setCreatedAt(new Date()); - uniqueId.setOpenmrsId(id); - uniqueId.setUsedBy(userName); - uniqueId.setStatus(UniqueId.STATUS_NOT_USED); - uniqueIdRepository.save(uniqueId); - } - } - } - catch (Exception e) { - logger.error("", e); - } - - } - - public void clearRecords() { - try { - uniqueIdRepository.clearTable(); - } - catch (Exception e) { - logger.error("", e); - } - } - - public Boolean checkIfClientExists(Client client) throws SQLException { - try { - String location = client.getAddress("usual_residence").getAddressField("address2"); - String checkIfExistQuery = "SELECT count(*) from " + UniqueId.tbName + " WHERE " + UniqueId.COL_USEDBY - + " = ? AND " + UniqueId.COL_LOCATION + " = ?"; - String[] args = new String[2]; - args[0] = (String) client.getAttribute(CHILD_REGISTER_CARD_NUMBER); - args[1] = location; - - int rowCount = uniqueIdRepository.checkIfExists(checkIfExistQuery, args); - - logger.info( - "[checkIfClientExists] - Card Number:" + args[0] + " - [Exists] " + (rowCount == 0 ? "false" : "true")); - - return rowCount >= 1 ? true : false; - } - catch (Exception e) { - logger.error("", e); - return null; - } - } - - public void assignOpenmrsIdToClient(String zeirID, Client client) throws SQLException { - // create jdbc template to persist the ids - try { - String location = client.getAddress("usual_residence").getAddressField("address2"); - - if (!this.checkIfClientExists(client)) { - String childRegisterCardNumber = (String) client.getAttribute(CHILD_REGISTER_CARD_NUMBER); - client.addIdentifier(ZEIR_IDENTIFIER, zeirID); - UniqueId uniqueId = new UniqueId(); - uniqueId.setOpenmrsId(zeirID); - uniqueId.setStatus(UniqueId.STATUS_USED); - uniqueId.setUsedBy(childRegisterCardNumber); - uniqueId.setLocation(location); - uniqueId.setCreatedAt(new Date()); - uniqueIdRepository.save(uniqueId); - logger.info("Assigned " + ZEIR_IDENTIFIER + " to " + client.fullName()); - } - } - catch (Exception e) { - logger.error("", e); - } - } - - public List getNotUsedIds(int limit) { - return uniqueIdRepository.getNotUsedIds(limit); - } - - public List getNotUsedIdsAsString(int limit) { - return uniqueIdRepository.getNotUsedIdsAsString(limit); - } - - public int[] markIdsAsUsed(List ids) { - return uniqueIdRepository.markAsUsed(ids); - } - - public List getOpenMRSIdentifiers(String source, String numberToGenerate, String userName, String password) - throws JSONException { - List ids = new ArrayList<>(); - String openMRSUrl = this.openmrsUrl + OPENMRS_IDGEN_URL; - openMRSUrl += "?source=" + source + "&numberToGenerate=" + numberToGenerate; - openMRSUrl += "&username=" + userName + "&password=" + password; - - HttpGet get = new HttpGet(openMRSUrl); - try { - HttpResponse response = client.execute(get); - String jsonResponse = EntityUtils.toString(response.getEntity()); - - JSONObject responseJson = new JSONObject(jsonResponse); - JSONArray jsonArray = responseJson.getJSONArray("identifiers"); - - if (jsonArray != null && jsonArray.length() > 0) { - for (int i = 0; i < jsonArray.length(); i++) { - ids.add(jsonArray.getString(i)); - } - } - - return ids; - - } - catch (IOException | JSONException e) { - logger.error("", e); - return null; - } - - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/OrganizationService.java b/opensrp-core/src/main/java/org/opensrp/service/OrganizationService.java deleted file mode 100644 index e1c3ef43d1..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/OrganizationService.java +++ /dev/null @@ -1,213 +0,0 @@ -/** - * - */ -package org.opensrp.service; - -import java.util.Date; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; -import org.opensrp.domain.AssignedLocations; -import org.opensrp.domain.Organization; -import org.opensrp.repository.LocationRepository; -import org.opensrp.repository.OrganizationRepository; -import org.opensrp.repository.PlanRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * @author Samuel Githengi created on 09/09/19 - */ -@Service -public class OrganizationService { - - private OrganizationRepository organizationRepository; - - private LocationRepository locationRepository; - - private PlanRepository planRepository; - - /** - * Get all organizations - * - * @return all organizations - */ - public List getAllOrganizations() { - return organizationRepository.getAll(); - } - - /** - * Get the organization that has the identifier - * - * @param identifier - * @return organization with matching identifier - */ - public Organization getOrganization(String identifier) { - return organizationRepository.get(identifier); - } - - /** - * Get the organization that has the identifier - * - * @param identifier - * @return organization with matching identifier - */ - public Organization getOrganization(Long id) { - return organizationRepository.getByPrimaryKey(id); - } - - private void validateIdentifier(Organization organization) { - validateIdentifier(organization.getIdentifier()); - } - - public void validateIdentifier(String identifier) { - if (StringUtils.isBlank(identifier)) - throw new IllegalArgumentException("Organization Identifier not specified"); - } - - /** - * Adds or Updates an Organization - * - * @param organization to add on update - */ - public void addOrUpdateOrganization(Organization organization) { - validateIdentifier(organization); - Organization entity = organizationRepository.get(organization.getIdentifier()); - if (entity != null) { - organizationRepository.update(entity); - } else { - organizationRepository.add(organization); - } - - } - - /** - * Adds an Organization - * - * @param organization to add - */ - public void addOrganization(Organization organization) { - validateIdentifier(organization); - organizationRepository.add(organization); - - } - - /** - * Updates an Organization - * - * @param organization to update - */ - public void updateOrganization(Organization organization) { - validateIdentifier(organization); - organizationRepository.update(organization); - - } - - /** - * Assigns the jurisdiction and /or plan to the organization with organizationId - * - * @param organizationId the id of the organization - * @param jurisdictionId the identifier of the jurisdiction - * @param planId the identifier of the plan - * @param fromDate - * @param toDate - */ - public void assignLocationAndPlan(String identifier, String jurisdictionId, String planId, Date fromDate, - Date toDate) { - validateIdentifier(identifier); - if (StringUtils.isBlank(identifier)) - throw new IllegalArgumentException("identifier cannot be null or empty"); - if (StringUtils.isBlank(jurisdictionId) && StringUtils.isBlank(planId)) - throw new IllegalArgumentException("jurisdictionId and planId cannot be null"); - Organization organization = getOrganization(identifier); - if (organization == null) - throw new IllegalArgumentException("Organization not found"); - - organizationRepository.assignLocationAndPlan(organization.getId(), jurisdictionId, - locationRepository.retrievePrimaryKey(jurisdictionId, true), planId, - planRepository.retrievePrimaryKey(planId), fromDate == null ? new Date() : fromDate, toDate); - - } - - /** - * Gets the locations and Plans assigned to an organization - * - * @param identifier the organization identifier - * - * @return the assigned locations and plans - */ - public List findAssignedLocationsAndPlans(String identifier) { - validateIdentifier(identifier); - Organization organization = getOrganization(identifier); - if (organization == null) - throw new IllegalArgumentException("Organization not found"); - return organizationRepository.findAssignedLocations(organization.getId()); - - } - - /** - * Gets the locations and Plans assigned to a list of organizations - * - * @param organizationIds the organization ids - * - * @return the assigned locations and plans - */ - public List findAssignedLocationsAndPlans(List organizationIds) { - return organizationRepository.findAssignedLocations(organizationIds); - - } - - /** - * Gets the locations and Plans using the Plan Identifier - * - * @param planIdentifier the plan identifier - * - * @return the assigned locations and plans - */ - public List findAssignedLocationsAndPlansByPlanIdentifier(String planIdentifier) { - if (StringUtils.isBlank(planIdentifier)) - throw new IllegalArgumentException("PlanIdentifier Identifier not specified"); - - Long planId = planRepository.retrievePrimaryKey(planIdentifier); - - if (planId == null) - throw new IllegalArgumentException("Plan not found"); - - return organizationRepository.findAssignedLocationsByPlanId(planId); - - } - - /** - * Set the Organization repository - * - * @param organizationRepository the organizationRepository to set - */ - @Autowired - public void setOrganizationRepository(OrganizationRepository organizationRepository) { - this.organizationRepository = organizationRepository; - } - - /** - * set the location repository - * - * @param locationRepository the locationRepository to set - */ - @Autowired - /** - * @param locationRepository the locationRepository to set - */ - public void setLocationRepository(LocationRepository locationRepository) { - this.locationRepository = locationRepository; - } - - /** - * set the plan Repository - * - * @param planRepository the planRepository to set - */ - @Autowired - public void setPlanRepository(PlanRepository planRepository) { - this.planRepository = planRepository; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/PhysicalLocationService.java b/opensrp-core/src/main/java/org/opensrp/service/PhysicalLocationService.java deleted file mode 100644 index fe28548cf5..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/PhysicalLocationService.java +++ /dev/null @@ -1,237 +0,0 @@ -package org.opensrp.service; - -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.lang.StringUtils; -import org.opensrp.domain.LocationDetail; -import org.opensrp.domain.PhysicalLocation; -import org.opensrp.domain.StructureDetails; -import org.opensrp.repository.LocationRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class PhysicalLocationService { - - private static Logger logger = LoggerFactory.getLogger(PhysicalLocationService.class.toString()); - - private LocationRepository locationRepository; - - private final boolean DEFAULT_RETURN_BOOLEAN = true; - - @Autowired - public void setLocationRepository(LocationRepository locationRepository) { - this.locationRepository = locationRepository; - } - - public PhysicalLocation getLocation(String id, boolean returnGeometry) { - return locationRepository.get(id, returnGeometry); - } - - public PhysicalLocation getStructure(String id, boolean returnGeometry) { - return locationRepository.getStructure(id, returnGeometry); - } - - public List getAllLocations() { - return locationRepository.getAll(); - } - - public void addOrUpdate(PhysicalLocation physicalLocation) { - if (StringUtils.isBlank(physicalLocation.getId())) - throw new IllegalArgumentException("id not specified"); - if ((physicalLocation.isJurisdiction() && getLocation(physicalLocation.getId(), DEFAULT_RETURN_BOOLEAN) == null) - || (!physicalLocation.isJurisdiction() && getStructure(physicalLocation.getId(), DEFAULT_RETURN_BOOLEAN) == null)) { - add(physicalLocation); - } else { - update(physicalLocation); - } - } - - public void add(PhysicalLocation physicalLocation) { - if (StringUtils.isBlank(physicalLocation.getId())) - throw new IllegalArgumentException("id not specified"); - physicalLocation.setServerVersion(null); - locationRepository.add(physicalLocation); - } - - public void update(PhysicalLocation physicalLocation) { - if (StringUtils.isBlank(physicalLocation.getId())) - throw new IllegalArgumentException("id not specified"); - physicalLocation.setServerVersion(null); - locationRepository.update(physicalLocation); - } - - public List findLocationsByServerVersion(long serverVersion) { - return locationRepository.findLocationsByServerVersion(serverVersion); - } - - public List findLocationsByNames(String locationNames, long serverVersion) { - return locationRepository.findLocationsByNames(locationNames, serverVersion); - } - - public List findStructuresByParentAndServerVersion(String parentId, long serverVersion) { - if (StringUtils.isBlank(parentId)) - throw new IllegalArgumentException("parentId not specified"); - return locationRepository.findStructuresByParentAndServerVersion(parentId, serverVersion); - } - - public void addServerVersion() { - try { - List locations = locationRepository.findByEmptyServerVersion(); - logger.info("RUNNING addServerVersion Jurisdiction locations size: " + locations.size()); - setServerVersion(locations, true); - List structures = locationRepository.findStructuresByEmptyServerVersion(); - logger.info("RUNNING addServerVersion structures size: " + structures.size()); - setServerVersion(structures, false); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - } - - private void setServerVersion(List locations, boolean isJurisdiction) { - long currentTimeMillis = System.currentTimeMillis(); - for (PhysicalLocation location : locations) { - try { - Thread.sleep(1); - location.setServerVersion(currentTimeMillis); - location.setJurisdiction(isJurisdiction); - locationRepository.update(location); - currentTimeMillis += 1; - } catch (InterruptedException e) { - logger.error(e.getMessage()); - } - } - } - - public Set saveLocations(List locations, boolean isJurisdiction) { - Set locationsWithErrors = new HashSet<>(); - for (PhysicalLocation location : locations) { - try { - location.setJurisdiction(isJurisdiction); - addOrUpdate(location); - } catch (Exception e) { - logger.error(e.getMessage(), e); - locationsWithErrors.add(location.getId()); - } - } - return locationsWithErrors; - - } - - public Collection findStructuresWithinRadius(double latitude, double longitude, double radius) { - return locationRepository.findStructureAndFamilyDetails(latitude, longitude, radius); - } - - /** - * This methods searches for jurisdictions using the parentId and location properties - * It returns the Geometry optionally if @param returnGeometry is set to true. - * @param returnGeometry boolean which controls if geometry is returned - * @param parentId string the parent id of the jurisdiction being searched - * @param properties map of location properties to filter with, each entry in map has property name and value - * @return jurisdictions matching the params - * @see org.opensrp.repository.LocationRepository#findLocationsByProperties(boolean, String, Map) - */ - public List findLocationsByProperties(boolean returnGeometry, String parentId, - Map properties) { - return locationRepository.findLocationsByProperties(returnGeometry, parentId, properties); - } - - /** - * This methods searches for structures using the parentId and location properties - * It returns the Geometry optionally if @param returnGeometry is set to true. - * @param returnGeometry boolean which controls if geometry is returned - * @param parentId string the parent id of the structure being searched - * @param properties map of location properties to filter with, each entry in map has property name and value - * @return structures matching the params - * @see org.opensrp.repository.LocationRepository#findStructuresByProperties(boolean, String, Map) - */ - public List findStructuresByProperties(boolean returnGeometry, String parentId, - Map properties) { - return locationRepository.findStructuresByProperties(returnGeometry, parentId, properties); - } - - /** - * This methods provides an API endpoint that searches for locations using a list of provided location ids. - * It returns the Geometry optionally if @param returnGeometry is set to true. - * @param returnGeometry boolean which controls if geometry is returned - * @param ids list of location ids - * @return jurisdictions whose ids match the provided params - */ - public List findLocationsByIds(boolean returnGeometry, List ids) { - return locationRepository.findLocationsByIds(returnGeometry, ids); - } - - - /** - * This methods searches for locations using a list of provided location ids.It - * returns location whose is in the list or whose parent is in list It returns - * the Geometry optionally if @param returnGeometry is set to true. - * - * @param returnGeometry boolean which controls if geometry is returned - * @param ids list of location ids - * @return jurisdictions whose ids match the provided params - */ - public List findLocationsByIdsOrParentIds(boolean returnGeometry, List ids) { - return locationRepository.findLocationsByIdsOrParentIds(returnGeometry, ids); - } - - /** - * This methods searches for a location and it's children using the provided location id - * It returns the Geometry optionally if @param returnGeometry is set to true. - * @param returnGeometry boolean which controls if geometry is returned - * @param id location id - * @param pageSize number of records to be returned - * @return location together with it's children whose id matches the provided param - */ - public List findLocationByIdWithChildren(boolean returnGeometry, String id, int pageSize) { - return locationRepository.findLocationByIdWithChildren(returnGeometry, id, pageSize); - } - - /** - * This method searches for all structure ids - * @return a list of strcuture ids - */ - public List findAllStructureIds() { - return locationRepository.findAllStructureIds(); - } - - /** - * This method searches for location identifier and name using a plan identifier. - * - * @param planIdentifier identifier of the plan - * @return list of location details i.e. identifier and name - */ - public List findLocationDetailsByPlanId(String planIdentifier) { - return locationRepository.findLocationDetailsByPlanId(planIdentifier); - } - - /** - * This method searches for jurisdictions ordered by serverVersion ascending - * - * @param returnGeometry boolean which controls if geometry is returned - * @param serverVersion - * @param limit upper limit on number of jurisdictions to fetch - * @return list of jurisdictions - */ - public List findAllLocations(boolean returnGeometry, Long serverVersion, int limit) { - return locationRepository.findAllLocations(returnGeometry, serverVersion, limit); - }; - - /** - * This method searches for structures ordered by serverVersion ascending - * - * @param returnGeometry boolean which controls if geometry is returned - * @param limit upper limit on number of structures to fetch - * @return list of structures - */ - public List findAllStructures(boolean returnGeometry, Long serverVersion, int limit) { - return locationRepository.findAllStructures(returnGeometry, serverVersion, limit); - }; - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/PlanService.java b/opensrp-core/src/main/java/org/opensrp/service/PlanService.java deleted file mode 100644 index 9b660ae2b3..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/PlanService.java +++ /dev/null @@ -1,151 +0,0 @@ -package org.opensrp.service; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by Vincent Karuri on 06/05/2019 - */ - -import org.apache.commons.lang.StringUtils; -import org.opensrp.domain.AssignedLocations; -import org.opensrp.domain.PlanDefinition; -import org.opensrp.domain.postgres.PractitionerRole; -import org.opensrp.repository.PlanRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class PlanService { - - private PlanRepository planRepository; - - private PractitionerService practitionerService; - - private PractitionerRoleService practitionerRoleService; - - private OrganizationService organizationService; - - @Autowired - public PlanService(PlanRepository planRepository, PractitionerService practitionerService, - PractitionerRoleService practitionerRoleService, OrganizationService organizationService) { - this.planRepository = planRepository; - this.practitionerService = practitionerService; - this.practitionerRoleService = practitionerRoleService; - this.organizationService = organizationService; - } - - public PlanRepository getPlanRepository() { - return planRepository; - } - - public List getAllPlans() { - return getPlanRepository().getAll(); - } - - public void addOrUpdatePlan(PlanDefinition plan) { - if (StringUtils.isBlank(plan.getIdentifier())) { - throw new IllegalArgumentException("Identifier not specified"); - } - plan.setServerVersion(System.currentTimeMillis()); - if (getPlanRepository().get(plan.getIdentifier()) != null) { - getPlanRepository().update(plan); - } else { - getPlanRepository().add(plan); - } - } - - public PlanDefinition addPlan(PlanDefinition plan) { - if (StringUtils.isBlank(plan.getIdentifier())) { - throw new IllegalArgumentException("Identifier not specified"); - } - plan.setServerVersion(System.currentTimeMillis()); - getPlanRepository().add(plan); - - return plan; - } - - public PlanDefinition updatePlan(PlanDefinition plan) { - if (StringUtils.isBlank(plan.getIdentifier())) { - throw new IllegalArgumentException("Identifier not specified"); - } - plan.setServerVersion(System.currentTimeMillis()); - getPlanRepository().update(plan); - - return plan; - } - - public PlanDefinition getPlan(String identifier) { - return StringUtils.isBlank(identifier) ? null : getPlanRepository().get(identifier); - } - - public List getPlansByServerVersionAndOperationalArea(long serverVersion, - List operationalAreaIds) { - return getPlanRepository().getPlansByServerVersionAndOperationalAreas(serverVersion, operationalAreaIds); - } - - /** - * This method searches for plans using a list of provided plan identifiers and returns a subset - * of fields determined by the list of provided fields If no plan identifier(s) are provided the - * method returns all available plans If no fields are provided the method returns all the - * available fields - * - * @param ids list of plan identifiers - * @param fields list of fields to return - * @return plan definitions whose identifiers match the provided params - */ - public List getPlansByIdsReturnOptionalFields(List ids, List fields) { - return getPlanRepository().getPlansByIdsReturnOptionalFields(ids, fields); - } - - /** - * Gets the plans using organization Ids that have server version >= the server version param - * - * @param organizationIds the list of organization Ids - * @param serverVersion the server version to filter plans with - * @return the plans matching the above - */ - public List getPlansByOrganizationsAndServerVersion(List organizationIds, long serverVersion) { - - List assignedPlansAndLocations = organizationService - .findAssignedLocationsAndPlans(organizationIds); - List planIdentifiers = new ArrayList<>(); - for (AssignedLocations assignedLocation : assignedPlansAndLocations) { - planIdentifiers.add(assignedLocation.getPlanId()); - } - return planRepository.getPlansByIdentifiersAndServerVersion(planIdentifiers, serverVersion); - } - - /** - * Gets the plans that a user has access to according to the plan location assignment that have - * server version >= the server version param - * - * @param username the username of user - * @param serverVersion the server version to filter plans with - * @return the plans a user has access to - */ - public List getPlansByUsernameAndServerVersion(String username, long serverVersion) { - org.opensrp.domain.Practitioner practitioner = practitionerService.getPractionerByUsername(username); - if (practitioner != null) { - List roles = practitionerRoleService.getPgRolesForPractitioner(practitioner.getIdentifier()); - if (roles.isEmpty()) - return null; - List organizationIds = new ArrayList<>(); - for (PractitionerRole role : roles) - organizationIds.add(role.getOrganizationId()); - return getPlansByOrganizationsAndServerVersion(organizationIds, serverVersion); - } - - return null; - } - - /** - * This method searches for plans ordered by serverVersion ascending - * - * @param serverVersion - * @param limit upper limit on number of plas to fetch - * @return list of plan identifiers - */ - public List getAllPlans(Long serverVersion, int limit) { - return getPlanRepository().getAllPlans(serverVersion, limit); } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/PractitionerRoleService.java b/opensrp-core/src/main/java/org/opensrp/service/PractitionerRoleService.java deleted file mode 100644 index 2feca52bf9..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/PractitionerRoleService.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.opensrp.service; - -import org.apache.commons.lang3.StringUtils; -import org.opensrp.domain.Organization; -import org.opensrp.domain.postgres.Practitioner; -import org.opensrp.domain.PractitionerRole; -import org.opensrp.repository.PractitionerRoleRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -@Service -public class PractitionerRoleService { - - private PractitionerRoleRepository practitionerRoleRepository; - - private PractitionerService practitionerService; - - private OrganizationService organizationService; - - @Autowired - public void setPractitionerRoleRepository(PractitionerRoleRepository practitionerRoleRepository) { - this.practitionerRoleRepository = practitionerRoleRepository; - } - - /** - * @param practitionerService the practitionerService to set - */ - @Autowired - public void setPractitionerService(PractitionerService practitionerService) { - this.practitionerService = practitionerService; - } - - /** - * - * @param organizationService the organizationService to set - */ - @Autowired - public void setOrganizationService(OrganizationService organizationService) { - this.organizationService = organizationService; - } - - public PractitionerRoleRepository getPractitionerRoleRepository() { - return practitionerRoleRepository; - } - - public PractitionerRole getPractitionerRole(String identifier) { - return StringUtils.isBlank(identifier) ? null : getPractitionerRoleRepository().get(identifier); - } - - public List getAllPractitionerRoles() { - return getPractitionerRoleRepository().getAll(); - } - - public PractitionerRole addOrUpdatePractitionerRole(PractitionerRole practitionerRole) { - if (StringUtils.isBlank(practitionerRole.getIdentifier())) { - throw new IllegalArgumentException("Identifier not specified"); - } - - if (getPractitionerRoleRepository().get(practitionerRole.getIdentifier()) != null) { - getPractitionerRoleRepository().update(practitionerRole); - } else { - getPractitionerRoleRepository().add(practitionerRole); - } - return practitionerRole; - } - - public void deletePractitionerRole(PractitionerRole practitionerRole) { - if (StringUtils.isBlank(practitionerRole.getIdentifier())) { - throw new IllegalArgumentException("Identifier not specified"); - } - - getPractitionerRoleRepository().safeRemove(practitionerRole); - } - - public void deletePractitionerRole(String identifier) { - if (StringUtils.isBlank(identifier)) { - throw new IllegalArgumentException("Identifier not specified"); - } - - getPractitionerRoleRepository().safeRemove(identifier); - } - - public void deletePractitionerRole(String organizationIdentifier, String practitionerIdentifier) { - if (StringUtils.isBlank(organizationIdentifier) || StringUtils.isBlank(practitionerIdentifier) ) { - throw new IllegalArgumentException("Organization Identifier or Practitioner Identifier not specified"); - } - - Organization organization = organizationService.getOrganization(organizationIdentifier); - - Practitioner pgPractitioner= practitionerService.getPgPractitioner(practitionerIdentifier); - - if (organization == null || pgPractitioner == null) { - return; - } - - getPractitionerRoleRepository().safeRemove(organization.getId(), pgPractitioner.getId()); - } - - public List getRolesForPractitioner(String practitionerIdentifier) { - if (StringUtils.isBlank(practitionerIdentifier)) { - throw new IllegalArgumentException("Identifier not specified"); - } - - return getPractitionerRoleRepository().getRolesForPractitioner(practitionerIdentifier); - } - - public List getPgRolesForPractitioner(String practitionerIdentifier) { - if (StringUtils.isBlank(practitionerIdentifier)) { - throw new IllegalArgumentException("Identifier not specified"); - } - - return getPractitionerRoleRepository().getPgRolesForPractitioner(practitionerIdentifier); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/PractitionerService.java b/opensrp-core/src/main/java/org/opensrp/service/PractitionerService.java deleted file mode 100644 index d5bdfee128..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/PractitionerService.java +++ /dev/null @@ -1,120 +0,0 @@ -package org.opensrp.service; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.opensrp.domain.Organization; -import org.opensrp.domain.Practitioner; -import org.opensrp.domain.postgres.PractitionerRole; -import org.opensrp.repository.PractitionerRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class PractitionerService { - - private PractitionerRepository practitionerRepository; - - private PractitionerRoleService practitionerRoleService; - - private OrganizationService organizationService; - - @Autowired - public void setPractitionerRepository(PractitionerRepository practitionerRepository) { - this.practitionerRepository = practitionerRepository; - } - - /** - * @param practitionerRoleService the practitionerRoleService to set - */ - @Autowired - public void setPractitionerRoleService(PractitionerRoleService practitionerRoleService) { - this.practitionerRoleService = practitionerRoleService; - } - - @Autowired - public void setOrganizationService(OrganizationService organizationService) { - this.organizationService = organizationService; - } - - public PractitionerRepository getPractitionerRepository() { - return practitionerRepository; - } - - public Practitioner getPractitioner(String identifier) { - return StringUtils.isBlank(identifier) ? null : getPractitionerRepository().get(identifier); - } - - public org.opensrp.domain.postgres.Practitioner getPgPractitioner(String identifier) { - return StringUtils.isBlank(identifier) ? null : getPractitionerRepository().getPractitioner(identifier); - } - - public List getAllPractitioners() { - return getPractitionerRepository().getAll(); - } - - public Practitioner addOrUpdatePractitioner(Practitioner practitioner) { - if (StringUtils.isBlank(practitioner.getIdentifier())) { - throw new IllegalArgumentException("Identifier not specified"); - } - - if (getPractitionerRepository().get(practitioner.getIdentifier()) != null) { - getPractitionerRepository().update(practitioner); - } else { - getPractitionerRepository().add(practitioner); - } - return practitioner; - } - - public void deletePractitioner(Practitioner practitioner) { - if (StringUtils.isBlank(practitioner.getIdentifier())) { - throw new IllegalArgumentException("Identifier not specified"); - } - - getPractitionerRepository().safeRemove(practitioner); - - } - - public void deletePractitioner(String identifier) { - if (StringUtils.isBlank(identifier)) { - throw new IllegalArgumentException("Identifier not specified"); - } - - getPractitionerRepository().safeRemove(identifier); - - } - - public ImmutablePair> getOrganizationsByUserId(String userId) { - Practitioner practioner = getPractitionerRepository().getPractitionerByUserId(userId); - List organizationIds = new ArrayList<>(); - for (PractitionerRole practitionerRole : practitionerRoleService - .getPgRolesForPractitioner(practioner.getIdentifier())) { - organizationIds.add(practitionerRole.getOrganizationId()); - } - return new ImmutablePair<>(practioner, organizationIds); - - } - - /** - * Get practitioner using username - * @param username - * @return practitioner with the username - */ - public Practitioner getPractionerByUsername(String username) { - return getPractitionerRepository().getPractitionerByUsername(username); - - } - - public List getPractitionersByOrgIdentifier(String organizationIdentifier) { - organizationService.validateIdentifier(organizationIdentifier); - Organization organization = organizationService.getOrganization(organizationIdentifier); - - if (organization == null) { - throw new IllegalArgumentException("Organization does not exist"); - } - - return getPractitionerRepository().getPractitionersByOrgId(organization.getId()); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/ProviderService.java b/opensrp-core/src/main/java/org/opensrp/service/ProviderService.java deleted file mode 100644 index 9a5d9094b1..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/ProviderService.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.opensrp.service; - -import java.util.List; - -import org.opensrp.domain.Provider; -import org.opensrp.repository.couch.AllProviders; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class ProviderService { - - private final AllProviders allProviders; - - @Autowired - public ProviderService(AllProviders allProviders) { - this.allProviders = allProviders; - } - - public Provider getProviderByBaseEntityId(String baseEntityId) { - return allProviders.findByBaseEntityId(baseEntityId); - } - - public List getAllProviders() { - return allProviders.findAllProviders(); - } - - public void addProvider(Provider provider) { - allProviders.add(provider); - } - - public void updateProvider(Provider provider) { - allProviders.update(provider); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/RapidProService.java b/opensrp-core/src/main/java/org/opensrp/service/RapidProService.java deleted file mode 100644 index 98e5c9a4c7..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/RapidProService.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.opensrp.service; - -import java.util.List; -import java.util.Map; - -public interface RapidProService { - - public static final String RAPIDPRO_UUID_IDENTIFIER_TYPE = "RAPIDPRO_UUID"; - - public static final String RAPIDPRO_GROUPS = "RAPIDPRO_GROUPS"; - - String sendMessage(List urns, List contacts, List groups, String text, String channel); - - String createContact(Map fieldValues); - - int deleteContact(String uuid); - - String createGroup(String name); - - String addField(String label, String valueType); - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/RapidProServiceImpl.java b/opensrp-core/src/main/java/org/opensrp/service/RapidProServiceImpl.java deleted file mode 100644 index 520e8f126e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/RapidProServiceImpl.java +++ /dev/null @@ -1,223 +0,0 @@ -package org.opensrp.service; - -import java.net.URI; -import java.util.List; -import java.util.Map; - -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.util.EntityUtils; -import org.json.JSONArray; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -@Component -public class RapidProServiceImpl implements RapidProService { - - @Value("#{opensrp['rapidpro.url']}") - private String rapidproUrl; - - @Value("#{opensrp['rapidpro.token']}") - private String rapidproToken; - - private static Logger logger = LoggerFactory.getLogger(RapidProServiceImpl.class.toString()); - - HttpClient client = HttpClientBuilder.create().build(); - - /** - * urns - JSON array of URNs to send the message to (array of strings, optional) contacts - JSON - * array of contact UUIDs to send the message to (array of strings, optional) groups - JSON - * array of group UUIDs to send the message to (array of strings, optional) text - the text of - * the message to send (string, limit of 480 characters) channel - the id of the channel to use. - * Contacts and URNs which can't be reached with this channel are ignored (int, optional) - * - * @param urns - * @param contacts - * @param groups - * @param text - * @param channel - * @return - */ - - @Override - public String sendMessage(List urns, List contacts, List groups, String text, String channel) { - try { - HttpPost post = new HttpPost(); - if (text == null || text.isEmpty() || text.length() > 480) { - logger.info("RapidPro: Message character limit of 480 exceeded"); - return "Empty text or text longer than 480 characters not allowed"; - } - String uri = rapidproUrl + "/api/v1/broadcasts.json"; - post = setPostAuthHeader(uri, post); - - JSONObject jsonParams = new JSONObject(); - - if (urns != null && !urns.isEmpty()) { - jsonParams.put("urns", new JSONArray(urns)); - } - if (contacts != null && !contacts.isEmpty()) { - jsonParams.put("contacts", new JSONArray(contacts)); - } - if (groups != null && !groups.isEmpty()) { - jsonParams.put("groups", new JSONArray(groups)); - } - if (channel != null && !channel.isEmpty()) { - jsonParams.put("channel", channel); - } - - if (!jsonParams.has("urns") && !jsonParams.has("contacts") && !jsonParams.has("groups")) { - logger.info("RapidPro: No one to send message to!"); - return "No recipients specified"; - } - - jsonParams.put("text", text); - - StringEntity params = new StringEntity(jsonParams.toString()); - post.setEntity(params); - - HttpResponse response = client.execute(post); - HttpEntity entity = response.getEntity(); - String responseString = EntityUtils.toString(entity, "UTF-8"); - return responseString; - } - catch (Exception e) { - logger.error("", e); - return "Exception occurred"; - } - } - - /** - * This method creates a contact in rapidpro. The param fieldValues should contain a key urns(a - * list of URNs you want associated with the contact (java.util.arraylist)) which is required by - * rapidpro. uuid - the UUID of the contact to update (string) (optional, new contact created if - * not present). name - the full name of the contact (string, optional).language - the preferred - * language for the contact (3 letter iso code, optional). group_uuids - a list of the UUIDs of - * any groups this contact is part of (string array, optional). fields - a hashmap of contact - * fields you want to set or update on this contact (JSON, optional) - */ - @SuppressWarnings("unchecked") - @Override - public String createContact(Map fieldValues) { - try { - HttpPost post = new HttpPost(); - if (fieldValues == null || fieldValues.isEmpty() || !fieldValues.containsKey("urns")) { - return "Field values cannot be empty and must have urns"; - } - String uri = rapidproUrl + "/api/v1/contacts.json"; - post = setPostAuthHeader(uri, post); - - JSONObject jsonParams = new JSONObject(); - for (Map.Entry entry : fieldValues.entrySet()) { - String key = entry.getKey(); - Object value = entry.getValue(); - if (value instanceof List) { - value = new JSONArray((List) value); - } - // create the fields just in case they don't exist first - if (key.equalsIgnoreCase("fields")) { - for (Map.Entry fieldEntrySet : ((Map) value).entrySet()) { - String fieldName = fieldEntrySet.getKey(); - addField(fieldName, null); - logger.info("Creating RapidPro field " + fieldName); - } - } - jsonParams.put(key, value); - - } - StringEntity params = new StringEntity(jsonParams.toString()); - post.setEntity(params); - logger.info("Creating RapidPro contact for " + (fieldValues.containsKey("name") ? fieldValues.get("name") : "")); - HttpResponse response = client.execute(post); - HttpEntity entity = response.getEntity(); - String responseString = EntityUtils.toString(entity, "UTF-8"); - return responseString; - } - catch (Exception e) { - logger.error("", e); - return "Exception occurred"; - } - - } - - private HttpPost setPostAuthHeader(String url, HttpPost post) { - post.setURI(URI.create(url)); - // add header Authorization: Token YOUR_API_TOKEN_GOES_HERE - post.setHeader("Authorization", " Token " + rapidproToken); - post.addHeader("content-type", "application/json"); - post.addHeader("Accept", "application/json"); - return post; - } - - private HttpDelete setDeleteAuthHeader(String url, HttpDelete delete) { - delete.setURI(URI.create(url)); - // add header Authorization: Token YOUR_API_TOKEN_GOES_HERE - delete.setHeader("Authorization", " Token " + rapidproToken); - delete.addHeader("content-type", "application/json"); - delete.addHeader("Accept", "application/json"); - return delete; - } - - @Override - public String createGroup(String name) { - // FIXME Not currently supported in rapidpro - return "Exception occurred"; - } - - /** - * This method adds a field to rapidpro valuetype is a required field in rapidpro so if empty - * the default is set to T-text other acceptable fieldtypes are: N - Decimal Number D - Datetime - * S - State I - District label is the field name as it will appear in rapidpro and it's used to - * generate the field key e.g a field label like woman name translates to woman_name key - */ - @Override - public String addField(String label, String valueType) { - try { - HttpPost post = new HttpPost(); - if (label == null || label.isEmpty()) { - return "Field label is required"; - } - String uri = rapidproUrl + "/api/v1/fields.json"; - post = setPostAuthHeader(uri, post); - JSONObject jsonParams = new JSONObject(); - jsonParams.put("label", label); - jsonParams.put("value_type", valueType == null || valueType.isEmpty() ? "T" : valueType); - - StringEntity params = new StringEntity(jsonParams.toString()); - post.setEntity(params); - HttpResponse response = client.execute(post); - HttpEntity entity = response.getEntity(); - String responseString = EntityUtils.toString(entity, "UTF-8"); - return responseString; - } - catch (Exception e) { - logger.error("", e); - return "Exception occurred"; - } - } - - @Override - public int deleteContact(String uuid) { - try { - HttpDelete delete = new HttpDelete(); - String uri = rapidproUrl + "/api/v1/contacts.json?uuid=" + uuid; - delete = setDeleteAuthHeader(uri, delete); - HttpResponse response = client.execute(delete); - int status = response.getStatusLine().getStatusCode(); - return status; - - } - catch (Exception e) { - logger.error("", e); - return HttpStatus.SC_INTERNAL_SERVER_ERROR; - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/ReportService.java b/opensrp-core/src/main/java/org/opensrp/service/ReportService.java deleted file mode 100644 index c37c830ec6..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/ReportService.java +++ /dev/null @@ -1,151 +0,0 @@ -package org.opensrp.service; - -import java.util.List; - -import org.joda.time.DateTime; -import org.opensrp.domain.Report; -import org.opensrp.repository.ReportsRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class ReportService { - - private final ReportsRepository allReports; - - private static Logger logger = LoggerFactory.getLogger(ReportService.class.toString()); - - @Autowired - public ReportService(ReportsRepository allReports) { - this.allReports = allReports; - } - - public List findAllByIdentifier(String identifier) { - return allReports.findAllByIdentifier(identifier); - } - - public List findByServerVersion(long serverVersion) { - return allReports.findByServerVersion(serverVersion); - } - - public Report getById(String id) { - return allReports.findById(id); - } - - public List getAll() { - return allReports.getAll(); - } - - public Report find(String uniqueId) { - List reportList = allReports.findAllByIdentifier(uniqueId); - if (reportList.size() > 1) { - throw new IllegalArgumentException("Multiple reports with identifier " + uniqueId + " exist."); - } else if (reportList.size() != 0) { - return reportList.get(0); - } - return null; - } - - public Report find(Report report) { - for (String idt : report.getIdentifiers().keySet()) { - List reportList = allReports.findAllByIdentifier(report.getIdentifier(idt)); - if (reportList.size() > 1) { - throw new IllegalArgumentException( - "Multiple reports with identifier type " + idt + " and ID " + report.getIdentifier(idt) + " exist."); - } else if (reportList.size() != 0) { - return reportList.get(0); - } - } - return null; - } - - public Report findById(String reportId) { - try { - if (reportId == null || reportId.isEmpty()) { - return null; - } - return allReports.findById(reportId); - } - catch (Exception e) { - logger.error("", e); - } - return null; - } - - public synchronized Report addReport(Report report) { - Report existingReport = find(report); - if (existingReport != null) { - throw new IllegalArgumentException( - "An report already exists with given list of identifiers. Consider updating data.[" + existingReport - + "]"); - } - - if (report.getFormSubmissionId() != null - && getByBaseEntityAndFormSubmissionId(report.getBaseEntityId(), report.getFormSubmissionId()) != null) { - throw new IllegalArgumentException( - "An report already exists with given baseEntity and formSubmission combination. Consider updating"); - } - - report.setDateCreated(DateTime.now()); - allReports.add(report); - return report; - } - - public void updateReport(Report updatedReport) { - // If update is on original entity - if (updatedReport.isNew()) { - throw new IllegalArgumentException( - "Report to be updated is not an existing and persisting domain object. Update database object instead of new pojo"); - } - - updatedReport.setDateEdited(DateTime.now()); - - allReports.update(updatedReport); - } - - public synchronized Report addorUpdateReport(Report report) { - Report existingReport = findById(report.getId()); - if (existingReport != null) { - report.setDateEdited(DateTime.now()); - report.setServerVersion(null); - report.setRevision(existingReport.getRevision()); - allReports.update(report); - - } else { - report.setDateCreated(DateTime.now()); - allReports.add(report); - - } - - return report; - } - - public Report getByBaseEntityAndFormSubmissionId(String baseEntityId, String formSubmissionId) { - List reportList = allReports.findByBaseEntityAndFormSubmissionId(baseEntityId, formSubmissionId); - if (reportList.size() > 1) { - throw new IllegalStateException("Multiple reports for baseEntityId and formSubmissionId combination (" - + baseEntityId + "," + formSubmissionId + ")"); - } - if (reportList.size() == 0) { - return null; - } - return reportList.get(0); - } - - public List findByBaseEntityId(String baseEntityId) { - return allReports.findByBaseEntityId(baseEntityId); - } - - public List findReports(String team, String providerId, String locationId, Long serverVersion, String sortBy, - String sortOrder, int limit) { - return allReports.findReports(team, providerId, locationId, null, serverVersion, sortBy, sortOrder, limit); - } - - public List findReports(String team, String providerId, String locationId, String baseEntityId, - Long serverVersion, String sortBy, String sortOrder, int limit) { - return allReports.findReports(team, providerId, locationId, baseEntityId, serverVersion, sortBy, sortOrder, limit); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/SearchService.java b/opensrp-core/src/main/java/org/opensrp/service/SearchService.java deleted file mode 100644 index 34a2d10a6f..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/SearchService.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.opensrp.service; - -import java.util.List; - -import org.opensrp.domain.Client; -import org.opensrp.repository.SearchRepository; -import org.opensrp.search.ClientSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class SearchService { - - private final SearchRepository search; - - @Autowired - public SearchService(SearchRepository search) { - this.search = search; - } - - public List searchClient(ClientSearchBean clientSearchBean, String firstName, String middleName, String lastName, - Integer limit) { - return search.findByCriteria(clientSearchBean, firstName, middleName, lastName, limit); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/SettingService.java b/opensrp-core/src/main/java/org/opensrp/service/SettingService.java deleted file mode 100644 index 328186ac27..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/SettingService.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.opensrp.service; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.ibm.icu.util.Calendar; -import org.joda.time.DateTime; -import org.opensrp.domain.setting.SettingConfiguration; -import org.opensrp.repository.SettingRepository; -import org.opensrp.repository.postgres.handler.SettingTypeHandler; -import org.opensrp.search.SettingSearchBean; -import org.opensrp.util.DateTimeTypeConverter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.io.IOException; -import java.util.List; - -@Service -public class SettingService { - - private static Logger logger = LoggerFactory.getLogger(SettingService.class.toString()); - - private SettingRepository settingRepository; - - Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") - .registerTypeAdapter(DateTime.class, new DateTimeTypeConverter()).create(); - - @Autowired - public void setSettingRepository(SettingRepository settingRepository) { - this.settingRepository = settingRepository; - } - - public List findSettings(SettingSearchBean settingQueryBean) { - return settingRepository.findSettings(settingQueryBean); - } - - public void addServerVersion() { - try { - List settingConfigurations = settingRepository.findByEmptyServerVersion(); - logger.info("RUNNING addServerVersion settings size: " + settingConfigurations.size()); - long currentTimeMillis = System.currentTimeMillis(); - for (SettingConfiguration settingConfiguration : settingConfigurations) { - try { - Thread.sleep(1); - settingConfiguration.setServerVersion(currentTimeMillis); - settingRepository.update(settingConfiguration); - currentTimeMillis += 1; - } - catch (InterruptedException e) { - logger.error(e.getMessage()); - } - } - } - catch (Exception e) { - logger.error(e.getMessage(), e); - } - } - - public synchronized String saveSetting(String jsonSettingConfiguration) { - SettingTypeHandler settingTypeHandler = new SettingTypeHandler(); - SettingConfiguration settingConfigurations = null; - try { - settingConfigurations = settingTypeHandler.mapper.readValue(jsonSettingConfiguration, SettingConfiguration.class); - } catch (IOException e) { - e.printStackTrace(); - } - - settingConfigurations.setServerVersion(Calendar.getInstance().getTimeInMillis()); - - if (settingConfigurations.getId() != null && settingRepository.get(settingConfigurations.getId()) != null) { - - settingRepository.update(settingConfigurations); - - } else { - - settingRepository.add(settingConfigurations); - } - - return settingConfigurations.getIdentifier(); - - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/StockService.java b/opensrp-core/src/main/java/org/opensrp/service/StockService.java deleted file mode 100644 index 9b871df178..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/StockService.java +++ /dev/null @@ -1,114 +0,0 @@ -package org.opensrp.service; - -import java.util.List; - -import org.joda.time.DateTime; -import org.opensrp.domain.Stock; -import org.opensrp.repository.StocksRepository; -import org.opensrp.search.StockSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class StockService { - - private final StocksRepository allStocks; - - @Autowired - public StockService(StocksRepository allStocks) { - this.allStocks = allStocks; - } - - public List findAllByProviderid(String providerid) { - return allStocks.findAllByProviderid(providerid); - } - - public Stock getById(String id) { - return allStocks.findById(id); - } - - public List getAll() { - return allStocks.getAll(); - } - - public List findStocks(StockSearchBean searchBean, String sortBy, String sortOrder, int limit) { - return allStocks.findStocks(searchBean, sortBy, sortOrder, limit); - } - - public List findStocks(StockSearchBean searchBean) { - return allStocks.findStocks(searchBean); - } - - public List findAllStocks() { - return allStocks.findAllStocks(); - } - - public Stock find(Stock stock) { - Stock st = allStocks.findById(stock.getId()); - if (st == null) { - return null; - } else { - return stock; - } - } - - public synchronized Stock addStock(Stock stock) { - Stock st = find(stock); - if (st != null) { - throw new IllegalArgumentException( - "A stock already exists with given id. Consider updating data.[" + st.getId() + "]"); - } - allStocks.add(stock); - return stock; - } - - public synchronized Stock addorUpdateStock(Stock stock) { - if (stock.getId() != null && getById(stock.getId()) != null) { - stock.setDateEdited(DateTime.now()); - stock.setServerVersion(null); - stock.setRevision(getById(stock.getId()).getRevision()); - allStocks.update(stock); - } else { - stock.setDateCreated(DateTime.now()); - allStocks.add(stock); - } - return stock; - } - - public void updateStock(Stock updatedStock) { - // If update is on original entity - if (updatedStock.isNew()) { - throw new IllegalArgumentException( - "Stock to be updated is not an existing and persisting domain object. Update database object instead of new pojo"); - } - - updatedStock.setDateEdited(DateTime.now()); - - allStocks.update(updatedStock); - } - - public Stock find(String uniqueId) { - List sList = allStocks.findAllByProviderid(uniqueId); - if (sList.size() > 1) { - throw new IllegalArgumentException("Multiple events with identifier " + uniqueId + " exist."); - } else if (sList.size() != 0) { - return sList.get(0); - } - return null; - } - - public Stock mergeStock(Stock updatedStock) { - Stock original = find(updatedStock); - if (original == null) { - throw new IllegalArgumentException("No stock found with given id. Consider adding new!"); - } - original.setDateEdited(DateTime.now()); - allStocks.update(original); - return original; - } - - public List findStocksBy(StockSearchBean searchBean) { - return allStocks.findStocks(searchBean); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/TaskService.java b/opensrp-core/src/main/java/org/opensrp/service/TaskService.java deleted file mode 100644 index faba62053a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/TaskService.java +++ /dev/null @@ -1,159 +0,0 @@ -package org.opensrp.service; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.apache.commons.lang.StringUtils; -import org.joda.time.DateTime; -import org.opensrp.domain.Task; -import org.opensrp.domain.TaskUpdate; -import org.opensrp.repository.TaskRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class TaskService { - - private static Logger logger = LoggerFactory.getLogger(TaskService.class.toString()); - - private TaskRepository taskRepository; - - @Autowired - public void setTaskRepository(TaskRepository taskRepository) { - this.taskRepository = taskRepository; - } - - public List getAllTasks() { - return taskRepository.getAll(); - } - - public void addOrUpdateTask(Task task) { - if (StringUtils.isBlank(task.getIdentifier())) - throw new IllegalArgumentException("Identifier not specified"); - task.setServerVersion(null); - task.setLastModified(new DateTime()); - if (taskRepository.get(task.getIdentifier()) != null) { - taskRepository.update(task); - } else { - task.setAuthoredOn(new DateTime()); - taskRepository.add(task); - } - } - - public Task addTask(Task task) { - if (StringUtils.isBlank(task.getIdentifier())) - throw new IllegalArgumentException("Identifier not specified"); - task.setServerVersion(null); - task.setAuthoredOn(new DateTime()); - task.setLastModified(new DateTime()); - taskRepository.add(task); - return task; - - } - - public Task updateTask(Task task) { - if (StringUtils.isBlank(task.getIdentifier())) - throw new IllegalArgumentException("Identifier not specified"); - task.setServerVersion(null); - task.setLastModified(new DateTime()); - taskRepository.update(task); - return task; - } - - public Task getTask(String identifier) { - if (StringUtils.isBlank(identifier)) - return null; - return taskRepository.get(identifier); - } - - public List getTasksByTaskAndGroup(String task, String group, long serverVersion) { - return taskRepository.getTasksByPlanAndGroup(task, group, serverVersion); - } - - public Set saveTasks(List tasks) { - Set tasksWithErrors = new HashSet<>(); - for (Task task : tasks) { - try { - addOrUpdateTask(task); - } catch (Exception e) { - logger.error(e.getMessage(), e); - tasksWithErrors.add(task.getIdentifier()); - } - } - return tasksWithErrors; - } - - public void addServerVersion() { - try { - List tasks = taskRepository.findByEmptyServerVersion(); - logger.info("RUNNING addServerVersion tasks size: " + tasks.size()); - long currentTimeMillis = System.currentTimeMillis(); - for (Task task : tasks) { - try { - Thread.sleep(1); - task.setServerVersion(currentTimeMillis); - taskRepository.update(task); - currentTimeMillis += 1; - } catch (InterruptedException e) { - logger.error(e.getMessage()); - } - } - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - } - - public static Task.TaskStatus fromString(String statusParam) { - for (Task.TaskStatus status : Task.TaskStatus.values()) { - if (status.name().equalsIgnoreCase(statusParam)) { - return status; - } - } - return null; - } - - public List updateTaskStatus(List taskUpdates) { - List updatedTaskIds = new ArrayList<>(); - for (TaskUpdate taskUpdate : taskUpdates) { - Task task = taskRepository.get(taskUpdate.getIdentifier()); - try { - Task.TaskStatus status = fromString(taskUpdate.getStatus()); - if (task != null && status != null) { - task.setBusinessStatus(taskUpdate.getBusinessStatus()); - task.setStatus(status); - task.setLastModified(new DateTime()); - task.setServerVersion(null); - taskRepository.update(task); - updatedTaskIds.add(task.getIdentifier()); - } - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - } - return updatedTaskIds; - } - - /** - * This method searches for all task Ids - * - * @return a list of all task ids - */ - public List findAllTaskIds() { - return taskRepository.findAllIds(); - } - - /** - * This method searches for tasks ordered by serverVersion ascending - * - * @param serverVersion - * @param limit upper limit on number of tasks to fetch - * @return list of plan identifiers - */ - public List getAllTasks(Long serverVersion, int limit) { - return taskRepository.getAllTasks(serverVersion, limit); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/UserService.java b/opensrp-core/src/main/java/org/opensrp/service/UserService.java deleted file mode 100644 index ea7dd94b71..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/UserService.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.opensrp.service; - -import java.util.List; - -import org.opensrp.domain.User; -import org.opensrp.repository.couch.AllUsers; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class UserService { - - private final AllUsers allUsers; - - @Autowired - public UserService(AllUsers allUsers) { - this.allUsers = allUsers; - } - - public User getUserByEntityId(String baseEntityId) { - return allUsers.findByBaseEntityId(baseEntityId); - } - - public List getAllUsers() { - return allUsers.findAllUsers(); - } - - public void addUser(User user) { - allUsers.add(user); - } - - public void updateUser(User user) { - allUsers.update(user); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/ViewConfigurationService.java b/opensrp-core/src/main/java/org/opensrp/service/ViewConfigurationService.java deleted file mode 100644 index 1666564fdb..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/ViewConfigurationService.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.opensrp.service; - -import java.util.List; - -import org.opensrp.domain.viewconfiguration.ViewConfiguration; -import org.opensrp.repository.ViewConfigurationRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class ViewConfigurationService { - - private static Logger logger = LoggerFactory.getLogger(ViewConfigurationService.class.toString()); - - private ViewConfigurationRepository viewConfigurationRepository; - - @Autowired - public void setViewConfigurationRepository(ViewConfigurationRepository viewConfigurationRepository) { - this.viewConfigurationRepository = viewConfigurationRepository; - } - - public List findViewConfigurationsByVersion(Long lastSyncedServerVersion) { - return viewConfigurationRepository.findViewConfigurationsByVersion(lastSyncedServerVersion); - } - - public void addServerVersion() { - try { - List viewConfigurations = viewConfigurationRepository.findByEmptyServerVersion(); - logger.info("RUNNING addServerVersion viewConfigurations size: " + viewConfigurations.size()); - long currentTimeMillis = System.currentTimeMillis(); - for (ViewConfiguration viewConfiguration : viewConfigurations) { - try { - Thread.sleep(1); - viewConfiguration.setServerVersion(currentTimeMillis); - viewConfigurationRepository.update(viewConfiguration); - currentTimeMillis += 1; - } - catch (InterruptedException e) { - logger.error(e.getMessage()); - } - } - } - catch (Exception e) { - logger.error(e.getMessage(), e); - } - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/XlsFormDownloaderService.java b/opensrp-core/src/main/java/org/opensrp/service/XlsFormDownloaderService.java deleted file mode 100644 index 9b6a3c9992..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/XlsFormDownloaderService.java +++ /dev/null @@ -1,189 +0,0 @@ -package org.opensrp.service; - -import java.io.IOException; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.Writer; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.codehaus.jackson.JsonProcessingException; -import org.opensrp.util.FileCreator; -import org.opensrp.util.JsonParser; -import org.opensrp.util.NetClientGet; -import org.springframework.stereotype.Service; -import org.w3c.dom.Node; -import org.w3c.dom.bootstrap.DOMImplementationRegistry; -import org.w3c.dom.ls.DOMImplementationLS; -import org.w3c.dom.ls.LSSerializer; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -import com.sun.org.apache.xml.internal.serialize.OutputFormat; -import com.sun.org.apache.xml.internal.serialize.XMLSerializer; - -/** - * @author muhammad.ahmed@ihsinformatics.com Created on 17-September, 2015 - */ -@Service -public class XlsFormDownloaderService { - - private NetClientGet netClientGet; - - private FileCreator fileCreator; - - private JsonParser jsonParser; - - private byte[] formJson = null; - - public XlsFormDownloaderService() { - netClientGet = new NetClientGet(); - fileCreator = new FileCreator(); - - jsonParser = new JsonParser(); - } - - public static void main(String[] args) { - try { - - /*System.out.println(DateTime.now().getWeekOfWeekyear()); - new XlsFormDownloaderService().downloadFormFiles("D:\\opensrpVaccinatorWkspc\\forms", - "maimoonak", "opensrp", JustForFun.Form, "crvs_verbal_autopsy", "156735"); - - new XlsFormDownloaderService().downloadFormFiles("D:\\opensrpVaccinatorWkspc\\forms", - "maimoonak", "opensrp", JustForFun.Form, "crvs_death_notification", "156734"); - - new XlsFormDownloaderService().downloadFormFiles("D:\\opensrpVaccinatorWkspc\\forms", - "maimoonak", "opensrp", JustForFun.Form, "crvs_birth_notification", "156733"); - - new XlsFormDownloaderService().downloadFormFiles("D:\\opensrpVaccinatorWkspc\\forms", - "maimoonak", "opensrp", JustForFun.Form, "crvs_pregnancy_notification", "156721"); - - new XlsFormDownloaderService().downloadFormFiles("D:\\opensrpVaccinatorWkspc\\forms", - "maimoonak", "opensrp", JustForFun.Form, "new_member_registration", "148264"); - - - new XlsFormDownloaderService().downloadFormFiles("D:\\opensrpVaccinatorWkspc\\forms", - "maimoonak", "opensrp", JustForFun.Form, "family_registration_form", "148263"); - */ - /*new XlsFormDownloaderService().downloadFormFiles("D:\\opensrpVaccinatorWkspc\\forms", - "maimoonak", "opensrp", JustForFun.Form, "vaccine_stock_position", "151804"); - */ - - /*new XlsFormDownloaderService().downloadFormFiles("D:\\opensrpVaccinatorWkspc\\forms", - "maimoonak", "opensrp", JustForFun.Form, "child_vaccination_enrollment", "135187"); - //------------------------- - new XlsFormDownloaderService().downloadFormFiles("D:\\opensrpVaccinatorWkspc\\forms", - "maimoonak", "opensrp", JustForFun.Form, "child_vaccination_followup", "135199"); - //--------------------------- - new XlsFormDownloaderService().downloadFormFiles("D:\\opensrpVaccinatorWkspc\\forms", - "maimoonak", "opensrp", JustForFun.Form, "woman_tt_enrollement_form", "135200"); - //---------------------------- - new XlsFormDownloaderService().downloadFormFiles("D:\\opensrpVaccinatorWkspc\\forms", - "maimoonak", "opensrp", JustForFun.Form, "woman_tt_followup_form", "135203"); - - */ - - /*new XlsFormDownloaderService().downloadFormFiles("D:\\opensrpVaccinatorWkspc\\forms", - "maimoonak", "opensrp", JustForFun.Form, "offsite_child_vaccination_followup", "115138"); - - - new XlsFormDownloaderService().downloadFormFiles("D:\\opensrpVaccinatorWkspc\\forms", - "maimoonak", "opensrp", JustForFun.Form, "offsite_woman_followup_form", "115135");*/ - } - catch (Exception e) { - e.printStackTrace(); - } - } - - public String formatXML(String input) { - try { - final InputSource src = new InputSource(new StringReader(input)); - final Node document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(src).getDocumentElement(); - - final DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); - final DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS"); - final LSSerializer writer = impl.createLSSerializer(); - - writer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE); - writer.getDomConfig().setParameter("xml-declaration", false); - - return writer.writeToString(document); - } - catch (Exception e) { - e.printStackTrace(); - return input; - } - } - - public String format(String unformattedXml) { - try { - final org.w3c.dom.Document document = parseXmlFile(unformattedXml); - - OutputFormat format = new OutputFormat(document); - format.setLineWidth(380); - //format.setIndenting(true); - format.setIndent(2); - Writer out = new StringWriter(); - XMLSerializer serializer = new XMLSerializer(out, format); - serializer.serialize(document); - - return out.toString(); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - private org.w3c.dom.Document parseXmlFile(String in) { - try { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - InputSource is = new InputSource(new StringReader(in)); - return db.parse(is); - } - catch (ParserConfigurationException e) { - throw new RuntimeException(e); - } - catch (SAXException e) { - throw new RuntimeException(e); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - public boolean downloadFormFiles(String directory, String username, String formPath, String password, String formId, - String formPk) throws IOException { - - String xmlData = netClientGet.convertToString("", formPath, formId); - String modelData = netClientGet.getModel(xmlData); - String formData = fileCreator.prettyFormat(netClientGet.getForm(xmlData)); - - modelData = format(modelData); - - formData = formData.replaceAll("selected\\(", "contains("); - formData = formData.replaceAll("", ""); - formData = formData.replaceAll("", ""); - - formJson = netClientGet.downloadJson(username, password, formPk); - - //formData=fileCreator.prettyFormat(formData); - System.out.println(getFormDefinition()); - fileCreator.createFile("form_definition.json", fileCreator.osDirectorySet(directory) + formId, - getFormDefinition().getBytes()); - return fileCreator.createFormFiles(fileCreator.osDirectorySet(directory) + formId, formId, formData.getBytes(), - modelData.getBytes(), formJson); - } - - public String getFormDefinition() throws JsonProcessingException, IOException { - if (formJson == null) { - return "Data not found on server . Please retry again !"; - - } - return jsonParser.getFormDefinition(formJson); - - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/EventsListener.java b/opensrp-core/src/main/java/org/opensrp/service/formSubmission/EventsListener.java deleted file mode 100644 index 01e950d8c7..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/EventsListener.java +++ /dev/null @@ -1,184 +0,0 @@ -package org.opensrp.service.formSubmission; - -import static java.text.MessageFormat.format; -import static java.util.Collections.sort; -import static org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace; - -import java.util.Comparator; -import java.util.List; -import java.util.concurrent.locks.ReentrantLock; - -import org.joda.time.DateTime; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.AppStateToken; -import org.opensrp.domain.Client; -import org.opensrp.domain.ErrorTrace; -import org.opensrp.domain.Event; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.repository.ClientsRepository; -import org.opensrp.repository.EventsRepository; -import org.opensrp.service.ConfigService; -import org.opensrp.service.ErrorTraceService; -import org.opensrp.service.EventService; -import org.opensrp.service.formSubmission.handler.EventsRouter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class EventsListener { - - private static Logger logger = LoggerFactory.getLogger(EventsListener.class.toString()); - - private static final ReentrantLock lock = new ReentrantLock(); - - private ConfigService configService; - - private EventsRepository allEvents; - - @Autowired - private ClientsRepository allClients; - - @Autowired - EventService eventService; - - private EventsRouter eventsRouter; - - private ErrorTraceService errorTraceService; - - @Autowired - public EventsListener(EventsRouter eventsRouter, ConfigService configService, EventsRepository allEvents, - ErrorTraceService errorTraceService) { - this.configService = configService; - this.errorTraceService = errorTraceService; - this.eventsRouter = eventsRouter; - this.allEvents = allEvents; - this.configService.registerAppStateToken(AllConstants.Config.EVENTS_PARSER_LAST_PROCESSED_EVENT, 0, - "Token to keep track of events processed for client n event parsing and schedule handling", true); - } - - public EventsListener(EventsRouter eventsRouter, ConfigService configService, EventsRepository allEvents, - EventService eventService, ErrorTraceService errorTraceService, ClientsRepository allClients) { - this.configService = configService; - this.errorTraceService = errorTraceService; - this.eventsRouter = eventsRouter; - this.allEvents = allEvents; - this.eventService = eventService; - this.allClients = allClients; - this.configService.registerAppStateToken(AllConstants.Config.EVENTS_PARSER_LAST_PROCESSED_EVENT, 0, - "Token to keep track of events processed for client n event parsing and schedule handling", true); - } - - public void processEvent() { - if (!lock.tryLock()) { - logger.warn("Not fetching events from Message Queue. It is already in progress."); - return; - } - try { - //update server version first - addServerVersion(); - logger.info("Fetching Events"); - long version = getVersion(); - - List events = allEvents.findByServerVersion(version); - - if (events.isEmpty()) { - logger.info("No new events found. Export token: " + version); - return; - } - - logger.info(format("Fetched {0} new events found. Export token: {1}", events.size(), version)); - - sort(events, serverVersionComparator()); - - for (Event event : events) { - try { - event = eventService.processOutOfArea(event); - eventsRouter.route(event); - configService.updateAppStateToken(AllConstants.Config.EVENTS_PARSER_LAST_PROCESSED_EVENT, - event.getServerVersion()); - } - catch (Exception e) { - e.printStackTrace(); - errorTraceService - .addError(new ErrorTrace(new DateTime(), "FormSubmissionProcessor", this.getClass().getName(), - e.getStackTrace().toString(), "unsolved", FormSubmission.class.getName())); - } - } - } - catch (Exception e) { - logger.error(format("{0} occurred while trying to fetch events. Message: {1} with stack trace {2}", e.toString(), - e.getMessage(), getFullStackTrace(e))); - } - finally { - lock.unlock(); - } - } - - private synchronized void addServerVersion() { - try { - List clients = allClients.findByEmptyServerVersion(); - long currentTimeMillis = getCurrentMilliseconds(); - while (clients != null && !clients.isEmpty()) { - for (Client client : clients) { - try { - Thread.sleep(1); - client.setServerVersion(currentTimeMillis); - allClients.update(client); - logger.debug("Add server_version: found new client " + client.getBaseEntityId()); - } - catch (InterruptedException e) { - logger.error("", e); - } - currentTimeMillis += 1; - } - clients = allClients.findByEmptyServerVersion(); - } - - List events = allEvents.findByEmptyServerVersion(); - while (events != null && !events.isEmpty()) { - for (Event event : events) { - try { - Thread.sleep(1); - event = eventService.processOutOfArea(event); - event.setServerVersion(currentTimeMillis); - allEvents.update(event); - - logger.debug("Add server_version: found new event " + event.getBaseEntityId()); - } - catch (InterruptedException e) { - logger.error("", e); - } - currentTimeMillis += 1; - } - - events = allEvents.findByEmptyServerVersion(); - } - } - catch (Exception e) { - logger.error("", e); - } - - } - - public long getCurrentMilliseconds() { - return System.currentTimeMillis(); - } - - private long getVersion() { - AppStateToken token = configService.getAppStateTokenByName(AllConstants.Config.EVENTS_PARSER_LAST_PROCESSED_EVENT); - return token == null ? 0L : token.longValue(); - } - - private Comparator serverVersionComparator() { - return new Comparator() { - - public int compare(Event firstEvent, Event secondEvent) { - long firstTimestamp = firstEvent.getVersion(); - long secondTimestamp = secondEvent.getVersion(); - return firstTimestamp == secondTimestamp ? 0 : firstTimestamp < secondTimestamp ? -1 : 1; - } - }; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/FormEntityConverter.java b/opensrp-core/src/main/java/org/opensrp/service/formSubmission/FormEntityConverter.java deleted file mode 100644 index 1709c6267a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/FormEntityConverter.java +++ /dev/null @@ -1,487 +0,0 @@ - -package org.opensrp.service.formSubmission; - -import java.io.IOException; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPathExpressionException; - -import org.apache.commons.lang3.math.NumberUtils; -import org.joda.time.DateTime; -import org.opensrp.common.FormEntityConstants; -import org.opensrp.common.FormEntityConstants.Encounter; -import org.opensrp.common.FormEntityConstants.FormEntity; -import org.opensrp.common.FormEntityConstants.Person; -import org.opensrp.common.util.DateUtil; -import org.opensrp.domain.Address; -import org.opensrp.domain.Client; -import org.opensrp.domain.Event; -import org.opensrp.domain.Obs; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.service.FormAttributeParser; -import org.opensrp.form.service.FormFieldMap; -import org.opensrp.form.service.FormSubmissionMap; -import org.opensrp.form.service.SubformMap; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.xml.sax.SAXException; - -import com.google.gson.JsonIOException; -import com.google.gson.JsonSyntaxException; -import com.mysql.jdbc.StringUtils; - -@Service -public class FormEntityConverter { - - private FormAttributeParser formAttributeParser; - - @Autowired - public FormEntityConverter(FormAttributeParser formAttributeParser) { - this.formAttributeParser = formAttributeParser; - } - - /** - * Whether form submission is an openmrs form. The xlsform made openmrs form by mapping to an - * encounter_type in settings in xlsform. - * - * @param fs - * @return - */ - public boolean isOpenmrsForm(FormSubmissionMap fs) { - String eventType = fs.formAttributes().get("encounter_type"); - return !StringUtils.isEmptyOrWhitespaceOnly(eventType); - } - - /** - * Extract Event from given form submission - * - * @param fs - * @return - * @throws ParseException - */ - public Event getEventFromFormSubmission(FormSubmissionMap fs) throws ParseException { - return createEvent(fs.entityId(), fs.formAttributes().get("encounter_type"), fs.fields(), fs); - } - - private Event createEvent(String entityId, String eventType, List fields, FormSubmissionMap fs) - throws ParseException { - String encounterDateField = getFieldName(Encounter.encounter_date, fs); - String encounterLocation = getFieldName(Encounter.location_id, fs); - - //TODO - String encounterStart = getFieldName(Encounter.encounter_start, fs); - String encounterEnd = getFieldName(Encounter.encounter_end, fs); - - Event e = new Event().withBaseEntityId(entityId)//should be different for main and subform - .withEventDate(new DateTime(FormEntityConstants.FORM_DATE.parse(fs.getFieldValue(encounterDateField)))) - .withEventType(eventType).withLocationId(fs.getFieldValue(encounterLocation)).withProviderId(fs.providerId()) - .withEntityType(fs.bindType()).withFormSubmissionId(fs.instanceId()); - - for (FormFieldMap fl : fields) { - Map fat = fl.fieldAttributes(); - if (!fl.values().isEmpty() && !StringUtils.isEmptyOrWhitespaceOnly(fl.values().get(0)) - && fat.containsKey("openmrs_entity") && fat.get("openmrs_entity").equalsIgnoreCase("concept")) { - List vall = new ArrayList<>(); - List humanReadableValues = new ArrayList<>(); - for (String vl : fl.values()) { - String val = fl.valueCodes(vl) == null ? null : fl.valueCodes(vl).get("openmrs_code"); - val = StringUtils.isEmptyOrWhitespaceOnly(val) ? vl : val; - vall.add(val); - if (fl.valueCodes(vl) != null && fl.valueCodes(vl).get("openmrs_code") != null) {// this value is in concept id form - String hval = fl.getValues() == null ? null : fl.getValues().get(0); - humanReadableValues.add(hval); - } - } - Obs o = new Obs("concept", fl.type(), fat.get("openmrs_entity_id"), fat.get("openmrs_entity_parent"), vall, - humanReadableValues, null, fl.name()); - o.setEffectiveDatetime(e.getEventDate()); - e.addObs(o); - } - } - return e; - } - - public Event getEventFromFormSubmission(FormSubmission fs) throws IllegalStateException { - try { - return getEventFromFormSubmission(formAttributeParser.createFormSubmissionMap(fs)); - } - catch (JsonIOException | JsonSyntaxException | XPathExpressionException | ParseException - | ParserConfigurationException | SAXException | IOException e) { - throw new IllegalStateException(e); - } - } - - /** - * Extract Event for given subform with given data mapped to specified Encounter Type. - * - * @param fs - * @param subform - * @param eventType - * @param subformInstance - * @return - * @throws ParseException - */ - private Event getEventForSubform(FormSubmissionMap fs, String eventType, SubformMap subformInstance) - throws ParseException { - return createEvent(subformInstance.entityId(), subformInstance.formAttributes().get("openmrs_entity_id"), - subformInstance.fields(), fs); - } - - /** - * Get field name for specified openmrs entity in given form submission - * - * @param en - * @param fs - * @return - */ - String getFieldName(FormEntity en, FormSubmissionMap fs) { - return getFieldName(en, fs.fields()); - } - - /** - * Get field name for specified openmrs entity in given form submission for given subform - * - * @param en - * @param subform - * @param fs - * @return - */ - String getFieldName(FormEntity en, SubformMap subf) { - return getFieldName(en, subf.fields()); - } - - String getFieldName(FormEntity en, List fields) { - for (FormFieldMap f : fields) { - if (f.fieldAttributes().containsKey("openmrs_entity") - && f.fieldAttributes().get("openmrs_entity").equalsIgnoreCase(en.entity()) - && f.fieldAttributes().get("openmrs_entity_id").equalsIgnoreCase(en.entityId())) { - return f.name(); - } - } - return null; - } - - /** - * Get field name for specified openmrs attribute mappings in given form submission - * - * @param entity - * @param entityId - * @param entityParentId - * @param fs - * @return - */ - String getFieldName(String entity, String entityId, String entityParentId, FormSubmissionMap fs) { - return getFieldName(entity, entityId, entityParentId, fs.fields()); - } - - String getFieldName(String entity, String entityId, String entityParentId, SubformMap subf) { - return getFieldName(entity, entityId, entityParentId, subf.fields()); - } - - String getFieldName(String entity, String entityId, String entityParentId, List fields) { - for (FormFieldMap f : fields) { - if (f.fieldAttributes().containsKey("openmrs_entity") - && f.fieldAttributes().get("openmrs_entity").equalsIgnoreCase(entity) - && f.fieldAttributes().get("openmrs_entity_id").equalsIgnoreCase(entityId) - && matchSting(f.fieldAttributes().get("openmrs_entity_parent"), entityParentId)) { - return f.name(); - } - } - return null; - } - - private boolean matchSting(String expected, String actual) { - if (expected == null) { - return actual == null; - } else { - return expected.equalsIgnoreCase(actual); - } - } - - Map extractAddresses(FormSubmissionMap fs) throws ParseException { - Map paddr = new HashMap<>(); - for (FormFieldMap fl : fs.fields()) { - fillAddressFields(fl, paddr); - } - return paddr; - } - - Map extractAddressesForSubform(SubformMap subf) throws ParseException { - Map paddr = new HashMap<>(); - for (FormFieldMap fl : subf.fields()) { - fillAddressFields(fl, paddr); - } - return paddr; - } - - void fillAddressFields(FormFieldMap fl, Map addresses) throws ParseException { - Map att = fl.fieldAttributes(); - if (att.containsKey("openmrs_entity") && att.get("openmrs_entity").equalsIgnoreCase("person_address")) { - String addressType = att.get("openmrs_entity_parent"); - String addressField = att.get("openmrs_entity_id"); - Address ad = addresses.get(addressType); - if (ad == null) { - ad = new Address(addressType, null, null, null, null, null, null, null, null); - } - - if (addressField.equalsIgnoreCase("startDate") || addressField.equalsIgnoreCase("start_date")) { - ad.setStartDate(DateUtil.parseDate(fl.value())); - } else if (addressField.equalsIgnoreCase("endDate") || addressField.equalsIgnoreCase("end_date")) { - ad.setEndDate(DateUtil.parseDate(fl.value())); - } else if (addressField.equalsIgnoreCase("latitude")) { - ad.setLatitude(fl.value()); - } else if (addressField.equalsIgnoreCase("longitute")) { - ad.setLongitude(fl.value()); - } else if (addressField.equalsIgnoreCase("geopoint")) { - // example geopoint 34.044494 -84.695704 4 76 = lat lon alt prec - String geopoint = fl.value(); - if (!StringUtils.isEmptyOrWhitespaceOnly(geopoint)) { - String[] g = geopoint.split(" "); - ad.setLatitude(g[0]); - ad.setLongitude(g[1]); - ad.setGeopoint(geopoint); - } - } else if (addressField.equalsIgnoreCase("postal_code") || addressField.equalsIgnoreCase("postalCode")) { - ad.setPostalCode(fl.value()); - } else if (addressField.equalsIgnoreCase("sub_town") || addressField.equalsIgnoreCase("subTown")) { - ad.setSubTown(fl.value()); - } else if (addressField.equalsIgnoreCase("town")) { - ad.setTown(fl.value()); - } else if (addressField.equalsIgnoreCase("sub_district") || addressField.equalsIgnoreCase("subDistrict")) { - ad.setSubDistrict(fl.value()); - } else if (addressField.equalsIgnoreCase("district") || addressField.equalsIgnoreCase("county") - || addressField.equalsIgnoreCase("county_district") || addressField.equalsIgnoreCase("countyDistrict")) { - ad.setCountyDistrict(fl.value()); - } else if (addressField.equalsIgnoreCase("city") || addressField.equalsIgnoreCase("village") - || addressField.equalsIgnoreCase("cityVillage") || addressField.equalsIgnoreCase("city_village")) { - ad.setCityVillage(fl.value()); - } else if (addressField.equalsIgnoreCase("state") || addressField.equalsIgnoreCase("state_province") - || addressField.equalsIgnoreCase("stateProvince")) { - ad.setStateProvince(fl.value()); - } else if (addressField.equalsIgnoreCase("country")) { - ad.setCountry(fl.value()); - } else { - ad.addAddressField(addressField, fl.value()); - } - addresses.put(addressType, ad); - } - } - - Map extractIdentifiers(FormSubmissionMap fs) { - Map pids = new HashMap<>(); - fillIdentifiers(pids, fs.fields()); - return pids; - } - - Map extractIdentifiers(SubformMap subf) { - Map pids = new HashMap<>(); - fillIdentifiers(pids, subf.fields()); - return pids; - } - - void fillIdentifiers(Map pids, List fields) { - for (FormFieldMap fl : fields) { - if (fl.values().size() < 2 && !StringUtils.isEmptyOrWhitespaceOnly(fl.value())) { - Map att = fl.fieldAttributes(); - - if (att.containsKey("openmrs_entity") && att.get("openmrs_entity").equalsIgnoreCase("person_identifier")) { - pids.put(att.get("openmrs_entity_id"), fl.value()); - } - } - } - } - - Map extractAttributes(FormSubmissionMap fs) { - Map pattributes = new HashMap<>(); - fillAttributes(pattributes, fs.fields()); - return pattributes; - } - - Map extractAttributes(SubformMap subf) { - Map pattributes = new HashMap<>(); - fillAttributes(pattributes, subf.fields()); - return pattributes; - } - - Map fillAttributes(Map pattributes, List fields) { - for (FormFieldMap fl : fields) { - if (fl.values().size() < 2 && !StringUtils.isEmptyOrWhitespaceOnly(fl.value())) { - Map att = fl.fieldAttributes(); - if (att.containsKey("openmrs_entity") && att.get("openmrs_entity").equalsIgnoreCase("person_attribute")) { - pattributes.put(att.get("openmrs_entity_id"), fl.value()); - } - } - } - return pattributes; - } - - /** - * Extract Client from given form submission - * - * @param fs - * @return - * @throws ParseException - */ - public Client getClientFromFormSubmission(FormSubmission fsubmission) throws IllegalStateException { - FormSubmissionMap fs; - try { - fs = formAttributeParser.createFormSubmissionMap(fsubmission); - return createBaseClient(fs); - } - catch (Exception e) { - throw new IllegalStateException(e); - } - } - - public Client getClientFromFormSubmission(FormSubmissionMap fsubmission) throws Exception { - return createBaseClient(fsubmission); - - } - - public Client createBaseClient(FormSubmissionMap fs) throws ParseException { - String firstName = fs.getFieldValue(getFieldName(Person.first_name, fs)); - String middleName = fs.getFieldValue(getFieldName(Person.middle_name, fs)); - String lastName = fs.getFieldValue(getFieldName(Person.last_name, fs)); - String bd = fs.getFieldValue(getFieldName(Person.birthdate, fs)); - DateTime birthdate = bd == null ? null : new DateTime(bd).withTimeAtStartOfDay(); - String dd = fs.getFieldValue(getFieldName(Person.deathdate, fs)); - DateTime deathdate = dd == null ? null : new DateTime(dd).withTimeAtStartOfDay(); - String aproxbd = fs.getFieldValue(getFieldName(Person.birthdate_estimated, fs)); - Boolean birthdateApprox = false; - if (!StringUtils.isEmptyOrWhitespaceOnly(aproxbd) && NumberUtils.isNumber(aproxbd)) { - int bde = 0; - try { - bde = Integer.parseInt(aproxbd); - } - catch (Exception e) { - e.printStackTrace(); - } - birthdateApprox = bde > 0 ? true : false; - } - String aproxdd = fs.getFieldValue(getFieldName(Person.deathdate_estimated, fs)); - Boolean deathdateApprox = false; - if (!StringUtils.isEmptyOrWhitespaceOnly(aproxdd) && NumberUtils.isNumber(aproxdd)) { - int dde = 0; - try { - dde = Integer.parseInt(aproxdd); - } - catch (Exception e) { - e.printStackTrace(); - } - deathdateApprox = dde > 0 ? true : false; - } - String gender = fs.getFieldValue(getFieldName(Person.gender, fs)); - - List
addresses = new ArrayList<>(extractAddresses(fs).values()); - - Client c = new Client(fs.entityId()).withFirstName(firstName).withMiddleName(middleName).withLastName(lastName) - .withBirthdate(birthdate, birthdateApprox).withDeathdate(deathdate, deathdateApprox).withGender(gender); - - c.withAddresses(addresses).withAttributes(extractAttributes(fs)).withIdentifiers(extractIdentifiers(fs)); - return c; - } - - public Client createSubformClient(SubformMap subf) throws ParseException { - String firstName = subf.getFieldValue(getFieldName(Person.first_name, subf)); - String gender = subf.getFieldValue(getFieldName(Person.gender, subf)); - String bb = subf.getFieldValue(getFieldName(Person.birthdate, subf)); - - Map idents = extractIdentifiers(subf); - if (StringUtils.isEmptyOrWhitespaceOnly(firstName) && StringUtils.isEmptyOrWhitespaceOnly(bb) && idents.size() < 1 - && StringUtils.isEmptyOrWhitespaceOnly(gender)) {//we need to ignore uuid of entity - // if empty repeat group leave this entry and move to next - return null; - } - - String middleName = subf.getFieldValue(getFieldName(Person.middle_name, subf)); - String lastName = subf.getFieldValue(getFieldName(Person.last_name, subf)); - DateTime birthdate = (bb != null && bb.isEmpty()) ? null : new DateTime(bb).withTimeAtStartOfDay(); - String dd = subf.getFieldValue(getFieldName(Person.deathdate, subf)); - DateTime deathdate = dd == null ? null : new DateTime(dd).withTimeAtStartOfDay(); - String aproxbd = subf.getFieldValue(getFieldName(Person.birthdate_estimated, subf)); - Boolean birthdateApprox = false; - if (!StringUtils.isEmptyOrWhitespaceOnly(aproxbd) && NumberUtils.isNumber(aproxbd)) { - int bde = 0; - try { - bde = Integer.parseInt(aproxbd); - } - catch (Exception e) { - e.printStackTrace(); - } - birthdateApprox = bde > 0 ? true : false; - } - String aproxdd = subf.getFieldValue(getFieldName(Person.deathdate_estimated, subf)); - Boolean deathdateApprox = false; - if (!StringUtils.isEmptyOrWhitespaceOnly(aproxdd) && NumberUtils.isNumber(aproxdd)) { - int dde = 0; - try { - dde = Integer.parseInt(aproxdd); - } - catch (Exception e) { - e.printStackTrace(); - } - deathdateApprox = dde > 0 ? true : false; - } - - List
addresses = new ArrayList<>(extractAddressesForSubform(subf).values()); - - Client c = new Client(subf.getFieldValue("id")).withFirstName(firstName).withMiddleName(middleName) - .withLastName(lastName).withBirthdate(new DateTime(birthdate), birthdateApprox) - .withDeathdate(new DateTime(deathdate), deathdateApprox).withGender(gender); - - c.withAddresses(addresses).withAttributes(extractAttributes(subf)).withIdentifiers(idents); - - return c; - } - - /** - * Extract Client and Event from given form submission for entities dependent on main - * beneficiary (excluding main beneficiary). The dependent entities are specified via subforms - * (repeat groups) in xls forms. - * - * @param fs - * @return The clients and events Map with id of dependent entity as key. Each entry in Map - * contains an internal map that holds Client and Event info as "client" and "event" - * respectively for that dependent entity (whose id is the key of main Map). Ex: - * {222222-55d555-ffffff-232323-ffffff: {client: ClientObjForGivenID, event: - * EventObjForGivenIDAndForm}}, {339393-545445-ffdddd-333333-ffffff: {client: - * ClientObjForGivenID, event: EventObjForGivenIDAndForm}}, - * {278383-765766-dddddd-767666-ffffff: {client: ClientObjForGivenID, event: - * EventObjForGivenIDAndForm}} - * @throws ParseException - */ - public Map> getDependentClientsFromFormSubmission(FormSubmission fsubmission) - throws IllegalStateException { - FormSubmissionMap fs; - try { - fs = formAttributeParser.createFormSubmissionMap(fsubmission); - Map> map = new HashMap<>(); - for (SubformMap sbf : fs.subforms()) { - Map att = sbf.formAttributes(); - if (att.containsKey("openmrs_entity") && att.get("openmrs_entity").equalsIgnoreCase("person")) { - Map cne = new HashMap<>(); - - Client subformClient = createSubformClient(sbf); - - if (subformClient != null) { - cne.put("client", subformClient); - cne.put("event", getEventForSubform(fs, att.get("openmrs_entity_id"), sbf)); - - map.put(sbf.entityId(), cne); - } - } - } - return map; - } - catch (JsonIOException | JsonSyntaxException | XPathExpressionException | ParserConfigurationException | SAXException - | IOException | ParseException e) { - e.printStackTrace(); - throw new IllegalStateException(e); - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/FormSubmissionListener.java b/opensrp-core/src/main/java/org/opensrp/service/formSubmission/FormSubmissionListener.java deleted file mode 100644 index f859752ec0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/FormSubmissionListener.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.opensrp.service.formSubmission; - -import static java.text.MessageFormat.format; -import static java.util.Collections.sort; -import static org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace; - -import java.text.MessageFormat; -import java.util.Comparator; -import java.util.List; -import java.util.concurrent.locks.ReentrantLock; - -import org.joda.time.DateTime; -import org.motechproject.scheduler.domain.MotechEvent; -import org.motechproject.server.event.annotations.MotechListener; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.AppStateToken; -import org.opensrp.domain.ErrorTrace; -import org.opensrp.dto.form.FormSubmissionDTO; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.service.FormSubmissionService; -import org.opensrp.service.ConfigService; -import org.opensrp.service.ErrorTraceService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; - -@Component -public class FormSubmissionListener { - - private static Logger logger = LoggerFactory.getLogger(FormSubmissionListener.class.toString()); - - private static final ReentrantLock lock = new ReentrantLock(); - - private FormSubmissionService formSubmissionService; - - private ConfigService configService; - - private FormSubmissionProcessor fsp; - - private ErrorTraceService errorTraceService; - - @Autowired - public FormSubmissionListener(FormSubmissionService formSubmissionService, FormSubmissionProcessor fsp, - ConfigService configService, ErrorTraceService errorTraceService) { - this.formSubmissionService = formSubmissionService; - this.configService = configService; - this.errorTraceService = errorTraceService; - this.fsp = fsp; - this.configService.registerAppStateToken(AllConstants.Config.FORM_ENTITY_PARSER_LAST_SYNCED_FORM_SUBMISSION, 0, - "Token to keep track of forms processed for client n event parsing and schedule handling", true); - } - - @MotechListener(subjects = AllConstants.OpenSRPEvent.FORM_SUBMISSION) - public void submitForms(MotechEvent event) { - List formSubmissions = new Gson().fromJson((String) event.getParameters().get("data"), - new TypeToken>() {}.getType()); - formSubmissionService.submit(formSubmissions); - } - - public void parseForms() { - if (!lock.tryLock()) { - logger.warn("Not fetching forms from Message Queue. It is already in progress."); - return; - } - try { - logger.info("Fetching Forms"); - long version = getVersion(); - - List formSubmissions = formSubmissionService.getAllSubmissions(version, null); - if (formSubmissions.isEmpty()) { - logger.info("No new forms found. Export token: " + version); - return; - } - - logger.info(format("Fetched {0} new forms found. Export token: {1}", formSubmissions.size(), version)); - - sort(formSubmissions, serverVersionComparator()); - - for (FormSubmission submission : formSubmissions) { - try { - logger.info(format("Invoking save for form with instance Id: {0} and for entity Id: {1}", - submission.instanceId(), submission.entityId())); - - if (submission.getField("no_client_event") == null - || submission.getField("no_client_event").contains("false")) { - fsp.processFormSubmission(submission); - } - - configService.updateAppStateToken(AllConstants.Config.FORM_ENTITY_PARSER_LAST_SYNCED_FORM_SUBMISSION, - submission.serverVersion()); - } - catch (Exception e) { - e.printStackTrace(); - errorTraceService - .addError(new ErrorTrace(DateTime.now(), "FormSubmissionProcessor", this.getClass().getName(), - e.getStackTrace().toString(), "unsolved", FormSubmission.class.getName())); - } - } - } - catch (Exception e) { - logger.error(MessageFormat.format("{0} occurred while trying to fetch forms. Message: {1} with stack trace {2}", - e.toString(), e.getMessage(), getFullStackTrace(e))); - } - finally { - lock.unlock(); - } - } - - private long getVersion() { - AppStateToken token = configService - .getAppStateTokenByName(AllConstants.Config.FORM_ENTITY_PARSER_LAST_SYNCED_FORM_SUBMISSION); - return token == null ? 0L : token.longValue(); - } - - private Comparator serverVersionComparator() { - return new Comparator() { - - public int compare(FormSubmission firstSubmission, FormSubmission secondSubmission) { - long firstTimestamp = firstSubmission.serverVersion(); - long secondTimestamp = secondSubmission.serverVersion(); - return firstTimestamp == secondTimestamp ? 0 : firstTimestamp < secondTimestamp ? -1 : 1; - } - }; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/FormSubmissionProcessor.java b/opensrp-core/src/main/java/org/opensrp/service/formSubmission/FormSubmissionProcessor.java deleted file mode 100644 index b57fddd0df..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/FormSubmissionProcessor.java +++ /dev/null @@ -1,286 +0,0 @@ -package org.opensrp.service.formSubmission; - -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.ektorp.CouchDbConnector; -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.json.JSONException; -import org.opensrp.domain.Client; -import org.opensrp.domain.Event; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.domain.SubFormData; -import org.opensrp.repository.couch.AllClients; -import org.opensrp.repository.couch.AllEvents; -import org.opensrp.scheduler.HealthSchedulerService; -import org.opensrp.scheduler.Schedule; -import org.opensrp.scheduler.Schedule.ActionType; -import org.opensrp.service.ClientService; -import org.opensrp.service.EventService; -import org.opensrp.service.formSubmission.handler.FormSubmissionRouter; -import org.opensrp.service.formSubmission.ziggy.ZiggyService; -import org.opensrp.util.Utils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; - -import com.google.gson.Gson; -import com.mysql.jdbc.StringUtils; - -@Service -public class FormSubmissionProcessor { - - private static Logger logger = LoggerFactory.getLogger(FormSubmissionListener.class.toString()); - - private ZiggyService ziggyService; - - private FormSubmissionRouter formSubmissionRouter; - - private FormEntityConverter formEntityConverter; - - private ClientService clientService; - - private EventService eventService; - - private HealthSchedulerService scheduleService; - - private final AllClients allClients; - - private final AllEvents allEvents; - - @Autowired - public FormSubmissionProcessor(ZiggyService ziggyService, FormSubmissionRouter formSubmissionRouter, - FormEntityConverter formEntityConverter, HealthSchedulerService scheduleService, ClientService clientService, - @Qualifier("couchClientsRepository") AllClients allClients, EventService eventService, - @Qualifier("couchEventsRepository") AllEvents allEvents) throws IOException { - this.ziggyService = ziggyService; - this.formSubmissionRouter = formSubmissionRouter; - this.formEntityConverter = formEntityConverter; - this.scheduleService = scheduleService; - this.clientService = clientService; - this.eventService = eventService; - this.allClients = allClients; - this.allEvents = allEvents; - } - - public void processFormSubmission(FormSubmission submission) throws Exception { - // parse and into client and event model - logger.info("Creating model entities"); - makeModelEntities(submission); - logger.info("Handling xls configured schedules"); - handleSchedules(submission); - if (ziggyService.isZiggyCompliant(submission.bindType())) { - passToZiggy(submission); - //and skip form submission routing as ziggy does it automatically - } else {//if not ziggy entity call custom route handler explicitly - logger.info("Routing to custom handler"); - formSubmissionRouter.route(submission); - } - } - - void handleSchedules(FormSubmission submission) throws JSONException, IOException { - List schl = scheduleService.findAutomatedSchedules(submission.formName()); - for (Schedule sch : schl) { - Map entsch = getEntitiesQualifyingForSchedule(submission, sch); - System.out.println("creating schedule for : " + entsch); - System.out.println(new Gson().toJson(sch)); - - for (String enid : entsch.keySet()) { - if (sch.action().equals(ActionType.enroll)) { - scheduleService.enrollIntoSchedule(enid, sch.schedule(), sch.milestone(), entsch.get(enid), - submission.instanceId()); - } else if (sch.action().equals(ActionType.fulfill)) { - scheduleService.fullfillMilestoneAndCloseAlert(enid, submission.anmId(), sch.schedule(), - LocalDate.parse(entsch.get(enid)), submission.instanceId()); - } else if (sch.action().equals(ActionType.unenroll)) { - scheduleService.unEnrollFromSchedule(enid, submission.anmId(), sch.schedule(), submission.instanceId()); - } else if (sch.action().equals(ActionType.unenroll) && sch.schedule().equalsIgnoreCase("*")) { - scheduleService.unEnrollFromAllSchedules(enid, submission.instanceId()); - } - } - } - } - - Map getEntitiesQualifyingForSchedule(FormSubmission submission, Schedule schedule) throws JSONException { - Map entityIds = new HashMap(); - if (schedule.applicableForEntity(submission.bindType())) { - String res = evaluateScheduleFor(schedule, submission.instance().form().getFieldsAsMap()); - if (!StringUtils.isEmptyOrWhitespaceOnly(res)) { - entityIds.put(submission.entityId(), res); - } - } - - if (submission.subForms() != null) { - for (SubFormData subFormData : submission.subForms()) { - if (schedule.applicableForEntity(subFormData.bindType())) { - for (Map instance : subFormData.instances()) { - String res = evaluateScheduleFor(schedule, instance); - if (!StringUtils.isEmptyOrWhitespaceOnly(res)) { - entityIds.put(instance.get("id"), res); - } - } - } - } - } - return entityIds; - } - - String evaluateScheduleFor(Schedule schedule, Map flvl) { - //find first field in submission that qualifies triggerdate field and has a value - for (String tf : schedule.triggerDateFields()) { - String flv = flvl.get(tf); - // if field has value and schedule flag field is empty or has value 1 or true - if (!StringUtils.isEmptyOrWhitespaceOnly(flv) && schedule.passesValidations(flvl)) { - return flv; - } - } - return null; - } - - public void makeModelEntities(FormSubmission submission) throws JSONException { - if (submission.getInstanceId().equalsIgnoreCase("b7dfb183-97a9-4bd1-8f1c-d85f88189d6a")) { - logger.debug("" + submission.getInstanceId()); - } - Client c = formEntityConverter.getClientFromFormSubmission(submission); - Event e = formEntityConverter.getEventFromFormSubmission(submission); - Map> dep = formEntityConverter.getDependentClientsFromFormSubmission(submission); - - if (clientService.findClient(c) != null) { - clientService.mergeClient(c); - } else - clientService.addClient(c); - - eventService.addEvent(e); - // TODO relationships b/w entities - - for (Map cm : dep.values()) { - Client cin = (Client) cm.get("client"); - Event evin = (Event) cm.get("event"); - clientService.addClient(cin); - eventService.addEvent(evin); - } - } - - /** - * Find a client from the specified db - * - * @param targetDb - * @param client - * @return - */ - public Client findClient(CouchDbConnector targetDb, Client client) { - // find by auto assigned entity id - try { - Client c = allClients.findByBaseEntityId(client.getBaseEntityId()); - if (c != null) { - return c; - } - - //still not found!! search by generic identifiers - - for (String idt : client.getIdentifiers().keySet()) { - List cl = allClients.findAllByIdentifier(targetDb, client.getIdentifier(idt)); - if (cl.size() > 1) { - throw new IllegalArgumentException("Multiple clients with identifier type " + idt + " and ID " - + client.getIdentifier(idt) + " exist."); - } else if (cl.size() != 0) { - return cl.get(0); - } - } - return c; - } - catch (Exception e) { - - return null; - } - } - - public Client addClient(CouchDbConnector targetDb, Client client) { - if (client.getBaseEntityId() == null) { - throw new IllegalArgumentException("No baseEntityId"); - } - Client c = findClient(targetDb, client); - if (c != null) { - throw new IllegalArgumentException( - "A client already exists with given list of identifiers. Consider updating data.[" + c + "]"); - } - - client.setDateCreated(new DateTime()); - allClients.add(targetDb, client); - return client; - } - - public synchronized Event addEvent(CouchDbConnector targetDb, Event event) { - // Event e = find(targetDb,event); - // if(e != null){ - // throw new IllegalArgumentException("An event already exists with given list of identifiers. Consider updating data.["+e+"]"); - // } - if (event.getFormSubmissionId() != null && getByBaseEntityAndFormSubmissionId(targetDb, event.getBaseEntityId(), - event.getFormSubmissionId()) != null) { - throw new IllegalArgumentException( - "An event already exists with given baseEntity and formSubmission combination. Consider updating"); - } - - event.setDateCreated(new DateTime()); - - allEvents.add(targetDb, event); - return event; - } - - public Event getByBaseEntityAndFormSubmissionId(CouchDbConnector targetDb, String baseEntityId, - String formSubmissionId) { - try { - List el = allEvents.findByBaseEntityAndFormSubmissionId(targetDb, baseEntityId, formSubmissionId); - if (el.size() > 1) { - throw new IllegalStateException("Multiple events for baseEntityId and formSubmissionId combination (" - + baseEntityId + "," + formSubmissionId + ")"); - } - if (el.size() == 0) { - return null; - } - return el.get(0); - } - catch (Exception e) { - return null; - } - } - - /** - * Break down form submission and save it to a target db - * - * @param targetDb - * @param submission - * @throws JSONException - */ - public void makeModelEntities(CouchDbConnector targetDb, FormSubmission submission) throws JSONException { - Client c = formEntityConverter.getClientFromFormSubmission(submission); - Event e = formEntityConverter.getEventFromFormSubmission(submission); - Map> dep = formEntityConverter.getDependentClientsFromFormSubmission(submission); - - if (findClient(targetDb, c) != null) { - clientService.mergeClient(c); - } else - addClient(targetDb, c); - - addEvent(targetDb, e); - // TODO relationships b/w entities - - for (Map cm : dep.values()) { - Client cin = (Client) cm.get("client"); - Event evin = (Event) cm.get("event"); - addClient(targetDb, cin); - addEvent(targetDb, evin); - } - } - - private void passToZiggy(FormSubmission submission) { - String params = Utils.getZiggyParams(submission); - ziggyService.saveForm(params, new Gson().toJson(submission.instance())); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/CustomFormSubmissionHandler.java b/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/CustomFormSubmissionHandler.java deleted file mode 100644 index 15efcec83b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/CustomFormSubmissionHandler.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.opensrp.service.formSubmission.handler; - -import org.opensrp.form.domain.FormSubmission; - -public interface CustomFormSubmissionHandler { - - public void handle(FormSubmission submission); -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/EventsHandler.java b/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/EventsHandler.java deleted file mode 100644 index c986e36f14..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/EventsHandler.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.opensrp.service.formSubmission.handler; - -import org.json.JSONObject; -import org.opensrp.domain.Event; - -public interface EventsHandler { - - public void handle(Event event, JSONObject scheduleConfigEvent, String scheduleName); -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/EventsRouter.java b/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/EventsRouter.java deleted file mode 100644 index 28e0e7a0a2..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/EventsRouter.java +++ /dev/null @@ -1,147 +0,0 @@ -package org.opensrp.service.formSubmission.handler; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.io.FileUtils; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.opensrp.domain.Event; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.ResourceLoader; -import org.springframework.stereotype.Component; - -@Component -public class EventsRouter { - - private static Logger logger = LoggerFactory.getLogger(EventsRouter.class.toString()); - - @Autowired - private IHandlerMapper handlerMapper; - - // @Value("#{opensrp['schedule.config.json.path']}") - // String scheduleConfigPath; - @Value("#{opensrp['schedules.config.files.dir']}") - String scheduleConfigFilesPath; - - // private static final String JSON_KEY_SCHEDULES = "schedules"; - private static final String JSON_KEY_HANDLER = "handler"; - - private static final String JSON_KEY_TYPES = "types"; - - private static final String JSON_KEY_SCHEDULE_NAME = "name"; - - private static final String JSON_KEY_EVENTS = "events"; - - ResourceLoader loader = new DefaultResourceLoader(); - - File scheduleConfigsFolder = null; - - Event event; - - @Autowired - public EventsRouter(IHandlerMapper handlerMapper, - @Value("#{opensrp['schedules.config.files.dir']}") String scheduleConfigFilesPath) { - this.handlerMapper = handlerMapper; - this.scheduleConfigFilesPath = scheduleConfigFilesPath; - } - - /** - * @param event - */ - public void route(Event _event) { - try { - event = _event; - if (scheduleConfigFilesPath != null && !scheduleConfigFilesPath.isEmpty()) { - - String schedulesStr = getScheduleConfigs(); - - JSONArray schedulesJsonObject = new JSONArray("[" + schedulesStr + "]"); - //iterate through concatenated schedule-configs files to retrieve the events and compare with the current event from the db - for (int i = 0; i < schedulesJsonObject.length(); i++) { - JSONObject scheduleJsonObject = schedulesJsonObject.getJSONObject(i); - String handler = scheduleJsonObject.has(JSON_KEY_HANDLER) - ? scheduleJsonObject.getString(JSON_KEY_HANDLER) - : "VaccinesScheduleHandler"; - JSONArray eventsJsonArray = scheduleJsonObject.getJSONArray(JSON_KEY_EVENTS); - String scheduleName = scheduleJsonObject.getString(JSON_KEY_SCHEDULE_NAME); - processScheduleConfigEvents(eventsJsonArray, handler, scheduleName); - - } - - } - } - catch (IOException | JSONException e) { - logger.error("", e); - } - - } - - /** - * This method iterates through 'events' defined in the schedule-configs to see if they match - * the current event, if so get the handler and process the event - * - * @param eventsJsonArray - * @param handler - * @throws JSONException - */ - private void processScheduleConfigEvents(JSONArray eventsJsonArray, String handler, String scheduleName) - throws JSONException { - //iterate through the events in the scheduleconfigs to see if the current event (the one passed to this route method) has a schedule handler - for (int j = 0; j < eventsJsonArray.length(); j++) { - JSONObject scheduleConfigEvent = eventsJsonArray.getJSONObject(j); - JSONArray eventTypesJsonArray = scheduleConfigEvent.getJSONArray(JSON_KEY_TYPES); - List eventsList = jsonArrayToList(eventTypesJsonArray); - - if (eventsList.contains(event.getEventType())) { - if (handlerMapper.handlerMap().get(handler) != null) { - handlerMapper.handlerMap().get(handler).handle(event, scheduleConfigEvent, scheduleName); - } - - } - - } - } - - /** - * This method merges all the files in the schedule-configs folder to create one - * jsonobject/array - * - * @return - * @throws IOException - */ - private String getScheduleConfigs() throws IOException { - if (scheduleConfigsFolder == null && loader.getResource(scheduleConfigFilesPath).exists()) - scheduleConfigFilesPath = loader.getResource(scheduleConfigFilesPath).getURI().getPath(); - scheduleConfigsFolder = new File(scheduleConfigFilesPath); - String scheduleConfigMapping = ""; - File[] scheduleFiles = scheduleConfigsFolder.listFiles(); - for (int i = 0; i < scheduleFiles.length; i++) { - final File fileEntry = scheduleFiles[i]; - String scheduleConfig = FileUtils.readFileToString(new File(fileEntry.getAbsolutePath()), "UTF-8"); - scheduleConfigMapping += (i + 1 == scheduleFiles.length) ? scheduleConfig : scheduleConfig.concat(","); - - } - return scheduleConfigMapping; - } - - private List jsonArrayToList(JSONArray jsonArray) throws JSONException { - List values = new ArrayList(); - if (jsonArray == null) { - return values; - } - - for (int i = 0; i < jsonArray.length(); i++) { - values.add((String) jsonArray.get(i)); - } - return values; - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/FormSubmissionProcessedListener.java b/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/FormSubmissionProcessedListener.java deleted file mode 100644 index 2753f05255..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/FormSubmissionProcessedListener.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.opensrp.service.formSubmission.handler; - -import java.util.List; - -import org.opensrp.form.domain.FormSubmission; - -public interface FormSubmissionProcessedListener { - - public void onFormSubmissionProcessed(String client, List dependents, FormSubmission submission); -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/FormSubmissionRouter.java b/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/FormSubmissionRouter.java deleted file mode 100644 index 0c0469fcf0..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/FormSubmissionRouter.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.opensrp.service.formSubmission.handler; - -import static java.text.MessageFormat.format; -import static org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace; - -import java.util.List; - -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.service.FormSubmissionService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class FormSubmissionRouter { - - private static Logger logger = LoggerFactory.getLogger(FormSubmissionRouter.class.toString()); - - private FormSubmissionService formSubmissionService; - - private HandlerMapper handlerMapper; - - @Autowired - public FormSubmissionRouter(FormSubmissionService formSubmissionService, HandlerMapper handlerMapper) { - - this.formSubmissionService = formSubmissionService; - this.handlerMapper = handlerMapper; - } - - public void formSubmissionProcessed(String client, List dependents, FormSubmission formSubmission) { - FormSubmissionProcessedListener handler = handlerMapper.formSubmissionProcessedListenerMap() - .get(formSubmission.formName()); - if (handler != null) { - logger.info( - format("Found a post processor handler for form submission ( {0} ) with instance Id: {1} for entity: {2}", - formSubmission.formName(), formSubmission.instanceId(), formSubmission.entityId())); - handler.onFormSubmissionProcessed(client, dependents, formSubmission); - } - } - - public void route(String instanceId) throws Exception { - FormSubmission submission = formSubmissionService.findByInstanceId(instanceId); - route(submission); - } - - public void route(FormSubmission formSubmission) throws Exception { - CustomFormSubmissionHandler handler = handlerMapper.customFormSubmissionHandlerMap().get(formSubmission.formName());// handlerMap.get(submission.formName()); - if (handler == null) { - logger.warn(format( - "Could not find a handler due to unknown form submission ( {0} ) with instance Id: {1} for entity: {2}", - formSubmission.formName(), formSubmission.instanceId(), formSubmission.entityId())); - return; - } - logger.info(format("Handling {0} form submission with instance Id: {1} for entity: {2}", formSubmission.formName(), - formSubmission.instanceId(), formSubmission.entityId())); - try { - handler.handle(formSubmission); - } - catch (Exception e) { - logger.error(format( - "Handling {0} form submission with instance Id: {1} for entity: {2} failed with exception : {3}", - formSubmission.formName(), formSubmission.instanceId(), formSubmission.entityId(), getFullStackTrace(e))); - throw e; - } - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/HandlerMapper.java b/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/HandlerMapper.java deleted file mode 100644 index aa7766b25e..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/HandlerMapper.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.opensrp.service.formSubmission.handler; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.springframework.stereotype.Repository; - -@Repository -public class HandlerMapper { - - private static final Map customFormSubmissionHandlerMap = new HashMap(); - - private static final Map onFormSubmissionProcessedListenerMap = new HashMap<>(); - - public Map customFormSubmissionHandlerMap() { - return Collections.unmodifiableMap(customFormSubmissionHandlerMap); - } - - public Map formSubmissionProcessedListenerMap() { - return Collections.unmodifiableMap(onFormSubmissionProcessedListenerMap); - } - - public HandlerMapper addFormSubmissionProcessedListener(String formName, FormSubmissionProcessedListener listener) { - onFormSubmissionProcessedListenerMap.put(formName, listener); - return this; - } - - public HandlerMapper addCustomFormSubmissionHandler(String formName, CustomFormSubmissionHandler handler) { - customFormSubmissionHandlerMap.put(formName, handler); - return this; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/IHandlerMapper.java b/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/IHandlerMapper.java deleted file mode 100644 index 2dac682d6c..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/handler/IHandlerMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.opensrp.service.formSubmission.handler; - -import java.util.Map; - -public interface IHandlerMapper { - - public Map handlerMap(); - - public Map addHandler(String name, EventsHandler handler); -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/ziggy/EntityDataMap.java b/opensrp-core/src/main/java/org/opensrp/service/formSubmission/ziggy/EntityDataMap.java deleted file mode 100644 index b5e450b8a6..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/ziggy/EntityDataMap.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.opensrp.service.formSubmission.ziggy; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.opensrp.util.Utils; -import org.springframework.stereotype.Repository; - -@Repository -public class EntityDataMap { - - public static final String ID = "id"; - - public static final String DETAILS = "details"; - - public static final String DOCUMENT_TYPE = "type"; - - public static final String[] ID_FIELD_ON_ENTITY = new String[] { "caseId", "baseEntityId", "entityId" }; - - private Map> classMap; - - public EntityDataMap() { - classMap = new HashMap<>(); - } - - public void addEntity(String entityType, Class cls) { - classMap.put(entityType, cls); - } - - public List getFieldsList(String entityType) { - return Utils.getFieldsAsList(classMap.get(entityType)); - } - - public String getIdField(String entityType) { - for (String idf : ID_FIELD_ON_ENTITY) { - try { - if (classMap.get(entityType).getDeclaredField(idf) != null) { - return idf; - } - } - catch (NoSuchFieldException | SecurityException e) { - // do nothing as method finds field name is null and returns null - } - } - return null; - } - - public String getIdViewName(String entityType) { - return "by_" + getIdField(entityType); - } - - public String getDocEntityType(String entityType) { - return classMap.get(entityType).getSimpleName(); - } - - public boolean hasEntityMap(String entityMap) { - return classMap.containsKey(entityMap); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/ziggy/ZiggyDataHandler.java b/opensrp-core/src/main/java/org/opensrp/service/formSubmission/ziggy/ZiggyDataHandler.java deleted file mode 100644 index e5c73f5549..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/ziggy/ZiggyDataHandler.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.opensrp.service.formSubmission.ziggy; - -import static java.util.UUID.randomUUID; - -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.node.JsonNodeFactory; -import org.codehaus.jackson.node.ObjectNode; -import org.ektorp.CouchDbConnector; -import org.ektorp.ViewQuery; -import org.ektorp.ViewResult; -import org.opensrp.common.AllConstants; -import org.opensrp.util.Utils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class ZiggyDataHandler { - - private CouchDbConnector db; - - private EntityDataMap edMap; - - @Autowired - public ZiggyDataHandler(@Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) CouchDbConnector db, EntityDataMap edMap) { - this.db = db; - this.edMap = edMap; - } - - public boolean isZiggyCompliant(String entityType) { - return edMap.hasEntityMap(entityType); - } - - public String saveEntity(String entityType, String fields) { - Map updatedFieldsMap = Utils.getStringMapFromJSON(fields); - String entityId = updatedFieldsMap.get(edMap.getIdField(entityType)); - - List viewQueryResult = getDBViewQueryResult(entityId, entityType); - - ObjectNode entity; - ObjectNode details; - if (viewQueryResult.size() != 0) { - JsonNode document = viewQueryResult.get(0).getDocAsNode(); - entity = (ObjectNode) document; - details = (ObjectNode) document.get(EntityDataMap.DETAILS); - } else { - String docEntityType = edMap.getDocEntityType(entityType); - - entity = new ObjectNode(JsonNodeFactory.instance); - details = new ObjectNode(JsonNodeFactory.instance); - entity.put("_id", randomUUID().toString()); - entity.put(EntityDataMap.DOCUMENT_TYPE, docEntityType); - } - - List fieldList = getFieldsList(entityType); - for (String fieldName : updatedFieldsMap.keySet()) { - if (fieldList.contains(fieldName)) { - entity.put(fieldName, updatedFieldsMap.get(fieldName)); - } else if (fieldName.equals(EntityDataMap.ID)) { - entity.put(edMap.getIdField(entityType), updatedFieldsMap.get(fieldName)); - } else { - details.put(fieldName, updatedFieldsMap.get(fieldName)); - } - } - entity.put(EntityDataMap.DETAILS, details); - - db.update(entity); - return entityId; - } - - List getDBViewQueryResult(String id, String entityType) { - String docEntityType = edMap.getDocEntityType(entityType); - return db.queryView(new ViewQuery().viewName(edMap.getIdViewName(entityType)).designDocId("_design/" + docEntityType) - .key(id).queryParam(edMap.getIdField(entityType), id).includeDocs(true)).getRows(); - } - - private List getFieldsList(String entityType) { - return Collections.unmodifiableList(edMap.getFieldsList(entityType)); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/ziggy/ZiggyFileLoader.java b/opensrp-core/src/main/java/org/opensrp/service/formSubmission/ziggy/ZiggyFileLoader.java deleted file mode 100644 index 78f3cf9adf..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/ziggy/ZiggyFileLoader.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.opensrp.service.formSubmission.ziggy; - -import static java.text.MessageFormat.format; - -import java.io.File; -import java.io.FileFilter; -import java.io.FileInputStream; -import java.io.IOException; -import java.net.URISyntaxException; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -@Component -public class ZiggyFileLoader { - - private static Logger logger = LoggerFactory.getLogger(ZiggyFileLoader.class.toString()); - - private String jsDirectoryName; - - private String formDirectoryName; - - @Autowired - public ZiggyFileLoader(@Value("#{opensrp['js.directory.name']}") String jsDirectoryName, - @Value("#{opensrp['form.directory.name']}") String formDirectoryName) throws IOException { - this.jsDirectoryName = jsDirectoryName; - this.formDirectoryName = formDirectoryName; - } - - public String getJSFiles() throws IOException, URISyntaxException { - File jsFolder = new File(this.getClass().getResource(jsDirectoryName).toURI()); - File[] files = jsFolder.listFiles(new FileFilter() { - - @Override - public boolean accept(File file) { - return file.getName().endsWith(".js"); - } - }); - StringBuilder builder = new StringBuilder(); - for (File file : files) { - builder.append(load(file)); - } - return builder.toString(); - } - - public String loadAppData(String fileName) { - try { - File file = new File(this.getClass().getResource(formDirectoryName).getPath() + "/" + fileName); - return load(file); - } - catch (IOException e) { - logger.error(format("Error while loading app data file: {0}, with exception: {1}", fileName, e)); - } - return null; - } - - public String load(File file) throws IOException { - FileInputStream inputStream = new FileInputStream(file); - return IOUtils.toString(inputStream, "UTF-8"); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/ziggy/ZiggyService.java b/opensrp-core/src/main/java/org/opensrp/service/formSubmission/ziggy/ZiggyService.java deleted file mode 100644 index cd099d6877..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/service/formSubmission/ziggy/ZiggyService.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.opensrp.service.formSubmission.ziggy; - -import static java.text.MessageFormat.format; -import static javax.script.ScriptContext.ENGINE_SCOPE; - -import javax.script.Bindings; -import javax.script.Invocable; -import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; - -import org.opensrp.service.formSubmission.handler.FormSubmissionRouter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class ZiggyService { - - public static final String JAVA_SCRIPT = "JavaScript"; - - private static Logger logger = LoggerFactory.getLogger(ZiggyService.class.toString()); - - private static final String SAVE_METHOD_NAME = "createOrUpdateEntity"; - - private static final String JS_INIT_SCRIPT = "require([\"ziggy/FormDataController\"], function (FormDataController) {\n" - + " controller = FormDataController;\n" + "});"; - - private static final String ZIGGY_FILE_LOADER = "ziggyFileLoader"; - - private static final String REPOSITORY = "formDataRepositoryContext"; - - private static final String FORM_SUBMISSION_ROUTER = "formSubmissionRouter"; - - private ZiggyFileLoader ziggyFileLoader; - - private ZiggyDataHandler ziggyDataHandler; - - private FormSubmissionRouter formSubmissionRouter; - - private Object ziggyFormController; - - private Invocable invocable; - - @Autowired - public ZiggyService(ZiggyFileLoader ziggyFileLoader, ZiggyDataHandler ziggyDataHandler, - FormSubmissionRouter formSubmissionRouter) throws Exception { - this.ziggyFileLoader = ziggyFileLoader; - this.ziggyDataHandler = ziggyDataHandler; - this.formSubmissionRouter = formSubmissionRouter; - initRhino(); - } - - public boolean isZiggyCompliant(String entityType) { - return ziggyDataHandler.isZiggyCompliant(entityType); - } - - public void saveForm(String params, String formInstance) { - try { - invocable.invokeMethod(ziggyFormController, SAVE_METHOD_NAME, params, formInstance); - logger.info(format("Saving form successful, with params: {0}.", params)); - logger.debug(format("Saving form successful, with params: {0}, with instance {1}.", params, formInstance)); - } - catch (Exception e) { - e.printStackTrace(); - logger.error( - format("Form save failed, with params: {0}, with instance {1}. Exception: {2}", params, formInstance, e)); - } - } - - private void initRhino() throws Exception { - ScriptEngineManager manager = new ScriptEngineManager(); - ScriptEngine engine = manager.getEngineByName(JAVA_SCRIPT); - - Bindings bindings = getBindings(engine); - engine.setBindings(bindings, ENGINE_SCOPE); - - String jsFiles = ziggyFileLoader.getJSFiles(); - - engine.eval(jsFiles); - engine.eval(JS_INIT_SCRIPT); - - ziggyFormController = engine.get("controller"); - invocable = (Invocable) engine; - } - - private Bindings getBindings(ScriptEngine engine) { - Bindings bindings = engine.createBindings(); - bindings.put(ZIGGY_FILE_LOADER, ziggyFileLoader); - bindings.put(REPOSITORY, ziggyDataHandler); - bindings.put(FORM_SUBMISSION_ROUTER, formSubmissionRouter); - return bindings; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/util/DataQuery.java b/opensrp-core/src/main/java/org/opensrp/util/DataQuery.java deleted file mode 100644 index cfc1b6917b..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/util/DataQuery.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.opensrp.util; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; - -public class DataQuery { - - public static final String LUCENE_CLIENT_QUERY = new String("lucene-client-query"); - - static { - for (Field field : DataQuery.class.getDeclaredFields()) { - if (field.getName().toLowerCase().endsWith("_query")) { - try { - field.setAccessible(true); - Field modifiers = field.getClass().getDeclaredField("modifiers"); - modifiers.setAccessible(true); - modifiers.setInt(field, field.getModifiers() & ~Modifier.FINAL); - field.set(null, getQuery(field.get(null).toString())); - } - catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - } - catch (NoSuchFieldException e) { - e.printStackTrace(); - } - catch (SecurityException e) { - e.printStackTrace(); - } - } - } - } - - private static String getQuery(String fileName) { - try { - InputStream in = DataQuery.class.getResourceAsStream("/queries/" + fileName); - BufferedReader r = new BufferedReader(new InputStreamReader(in)); - StringBuilder stringJson = new StringBuilder(); - - int chunksize = 1024; - char[] charBuffer = new char[chunksize]; - int count = 0; - - do { - count = r.read(charBuffer, 0, chunksize); - - if (count >= 0) { - stringJson.append(charBuffer, 0, count); - } - } while (count > 0); - - r.close(); - - return stringJson.toString(); - } - catch (IOException e) { - e.printStackTrace(); - } - return null; - } - - public static void main(String[] args) { - System.out.println(LUCENE_CLIENT_QUERY); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/util/DateTimeDeserializer.java b/opensrp-core/src/main/java/org/opensrp/util/DateTimeDeserializer.java deleted file mode 100644 index 1d5af4893d..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/util/DateTimeDeserializer.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.opensrp.util; - -import java.io.IOException; - -import org.codehaus.jackson.JsonParseException; -import org.codehaus.jackson.JsonParser; -import org.codehaus.jackson.JsonToken; -import org.codehaus.jackson.map.DeserializationContext; -import org.codehaus.jackson.map.deser.std.StdScalarDeserializer; -import org.joda.time.DateTime; - -public class DateTimeDeserializer extends StdScalarDeserializer { - - public DateTimeDeserializer() { - super(DateTime.class); - } - - @Override - public DateTime deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) - throws JsonParseException, IOException { - JsonToken currentToken = jsonParser.getCurrentToken(); - if (currentToken == JsonToken.VALUE_STRING) { - String dateTimeAsString = jsonParser.getText().trim(); - return new DateTime(dateTimeAsString); - } - return null; - - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/util/DateTimeTypeConverter.java b/opensrp-core/src/main/java/org/opensrp/util/DateTimeTypeConverter.java deleted file mode 100644 index 13ccbc5215..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/util/DateTimeTypeConverter.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.opensrp.util; - -import java.lang.reflect.Type; - -import org.joda.time.DateTime; - -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -public class DateTimeTypeConverter implements JsonSerializer, JsonDeserializer { - - @Override - public DateTime deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) - throws JsonParseException { - return new DateTime(json.getAsString()); - } - - @Override - public JsonElement serialize(DateTime src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toString()); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/util/DateTypeConverter.java b/opensrp-core/src/main/java/org/opensrp/util/DateTypeConverter.java deleted file mode 100644 index 87f4a8849a..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/util/DateTypeConverter.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.opensrp.util; - -import java.lang.reflect.Type; - -import org.joda.time.LocalDate; - -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -public class DateTypeConverter implements JsonSerializer, JsonDeserializer { - - @Override - public LocalDate deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) - throws JsonParseException { - return new LocalDate(json.getAsString()); - } - - @Override - public JsonElement serialize(LocalDate src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toString()); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/util/FileCreator.java b/opensrp-core/src/main/java/org/opensrp/util/FileCreator.java deleted file mode 100644 index a1ee8bf6d8..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/util/FileCreator.java +++ /dev/null @@ -1,190 +0,0 @@ -/** - * Contributors: muhammad.ahmed@ihsinformatics.com - */ -package org.opensrp.util; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.StringReader; -import java.io.StringWriter; - -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - -import org.w3c.dom.Node; -import org.xml.sax.InputSource; - -public class FileCreator { - - // private static String directory=null;//= System.getProperty("user.home"); - - // public FileCreator() { - // directory = System.getProperty("user.home"); - // - // } - - public void createFile(String filename, String directory, byte[] content) throws FileNotFoundException, IOException { - - File f = new File(directory); - if (f.mkdirs()) { - - } - //System.out.println(s); - FileOutputStream fos2 = new FileOutputStream(f.getPath() + System.getProperty("file.separator") + filename); - fos2.write(content); - fos2.close(); - - } - - public String createDirectory(String directory) { - - File file = new File(osDirectorySet(directory)); - if (!file.exists()) { - if (file.mkdir()) { - System.out.println("Directory is created!"); - } else { - System.out.println("Failed to create directory!"); - } - } - - return file.getAbsolutePath(); - } - - public boolean createFormFiles(String directory, String formId, byte[] form, byte[] model, byte[] formjson) { - - try { - // System.out.println("before creating files "+directory); - createFile("form.xml", directory, form); - createFile("model.xml", directory, model); - createFile("form.json", directory, formjson); - // System.out.println("before creating files "+directory); - return true; - } - catch (Exception e) { - e.printStackTrace(); - } - return false; - } - - public boolean createTextFile(String directory, byte[] context, String formId) { - try { - directory = createDirectory(directory); - createFile(formId + ".txt", directory, context); - - return true; - } - catch (Exception e) { - e.printStackTrace(); - } - return false; - } - - public boolean createModelFile(String directory, String formId, byte[] context) { - try { - directory = createDirectory(directory); - createFile("model.xml", directory, context); - - return true; - } - catch (Exception e) { - e.printStackTrace(); - } - return false; - - } - - public boolean createFormFile(String directory, String formId, byte[] context) { - try { - directory = createDirectory(directory); - createFile("form.xml", directory, context); - - return true; - } - catch (Exception e) { - e.printStackTrace(); - } - return false; - } - - public boolean createFormJsonFile(String directory, String formId, byte[] context) { - try { - directory = createDirectory(directory); - createFile("form.json", directory, context); - - return true; - } - catch (Exception e) { - e.printStackTrace(); - } - return false; - } - - public String osDirectorySet(String name) { - - if (name.startsWith("/")) { - name += "/"; - // directory += "/"+name+"/"; - } else { - // directory += "\\"+name+"\\"; - name += "\\"; - } - return name; - } - - private String prettyFormat(String input, int indent) { - try { - // Source xmlInput = new StreamSource(new StringReader(input)); - // StringWriter stringWriter = new StringWriter(); - // StreamResult xmlOutput = new StreamResult(new OutputStreamWriter(System.out)); - // - final InputSource src = new InputSource(new StringReader(input)); - final Node document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(src).getDocumentElement(); - - Transformer transformer = TransformerFactory.newInstance().newTransformer(); - transformer.setOutputProperty(OutputKeys.INDENT, "yes"); - transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); - //initialize StreamResult with File object to save to file - StreamResult result = new StreamResult(new StringWriter()); - DOMSource source = new DOMSource(document); - transformer.transform(source, result); - String xmlString = result.getWriter().toString(); - System.out.println(xmlString); - - return xmlString; - } - catch (Throwable e) { - e.printStackTrace(); - // You'll come here if you are using JDK 1.5 - // you are getting an the following exeption - // java.lang.IllegalArgumentException: Not supported: indent-number - // Use this code (Set the output property in transformer. - try { - Source xmlInput = new StreamSource(new StringReader(input)); - StringWriter stringWriter = new StringWriter(); - StreamResult xmlOutput = new StreamResult(stringWriter); - TransformerFactory transformerFactory = TransformerFactory.newInstance(); - Transformer transformer = transformerFactory.newTransformer(); - transformer.setOutputProperty(OutputKeys.INDENT, "yes"); - transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", String.valueOf(indent)); - transformer.transform(xmlInput, xmlOutput); - return xmlOutput.getWriter().toString(); - } - catch (Throwable t) { - return input; - } - } - } - - public String prettyFormat(String input) { - return prettyFormat(input, 2); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/util/JsonArrayDeserializer.java b/opensrp-core/src/main/java/org/opensrp/util/JsonArrayDeserializer.java deleted file mode 100644 index 5dc46ec699..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/util/JsonArrayDeserializer.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.opensrp.util; - -import org.codehaus.jackson.JsonParser; -import org.codehaus.jackson.JsonProcessingException; -import org.codehaus.jackson.map.DeserializationContext; -import org.codehaus.jackson.map.deser.std.StdScalarDeserializer; -import org.json.JSONArray; -import org.json.JSONException; - -import java.io.IOException; - -public class JsonArrayDeserializer extends StdScalarDeserializer { - - public JsonArrayDeserializer() { - super(JsonArrayDeserializer.class); - } - - @Override - public JSONArray deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { - try { - return new JSONArray(jsonParser.readValueAsTree().toString()); - } catch (JSONException e) { - e.printStackTrace(); - } - return null; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/util/JsonArraySerializer.java b/opensrp-core/src/main/java/org/opensrp/util/JsonArraySerializer.java deleted file mode 100644 index 448282e685..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/util/JsonArraySerializer.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.opensrp.util; - -import org.codehaus.jackson.JsonGenerationException; -import org.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.map.SerializerProvider; -import org.codehaus.jackson.map.ser.std.SerializerBase; -import org.json.JSONArray; - -import java.io.IOException; - -public class JsonArraySerializer extends SerializerBase { - - - public JsonArraySerializer() { - super(JSONArray.class); - } - - @Override - public void serialize(JSONArray value, JsonGenerator gen, SerializerProvider provider) throws IOException, JsonGenerationException { - gen.writeRawValue(value.toString()); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/util/JsonParser.java b/opensrp-core/src/main/java/org/opensrp/util/JsonParser.java deleted file mode 100644 index 5f44395b78..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/util/JsonParser.java +++ /dev/null @@ -1,200 +0,0 @@ -package org.opensrp.util; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.JsonProcessingException; -import org.codehaus.jackson.map.ObjectMapper; -import org.opensrp.domain.Form; -import org.opensrp.domain.FormDefinition; -import org.opensrp.domain.FormField; -import org.opensrp.domain.SubFormDefinition; - -public class JsonParser { - - public String getFormDefinition(byte[] jsonData) throws JsonProcessingException, IOException { - try { - - //read json file data to String - //byte[] jsonData = Files.readAllBytes(Paths.get("tt.json")); - JsonParser jsonParser = new JsonParser(); - //create ObjectMapper instance - ObjectMapper objectMapper = new ObjectMapper(); - // objectMapper.enable(SerializationFeature.INDENT_OUTPUT); - // objectMapper.readValue(jsonData, FormSubmission.class) - //read JSON like DOM Parser FormSubmission - JsonNode rootNode = objectMapper.readTree(jsonData); - FormDefinition formD = jsonParser.getForm(rootNode); - //System.out.println(objectMapper.writeValueAsString(formD));; - // objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true); - //objectMapper.writeValue(new File("form_definition.json"), formD); - String s = objectMapper.writer().withDefaultPrettyPrinter().writeValueAsString(formD); - //String s=objectMapper.writeValueAsString(formD); - //objectMapper. - //System.out.println(s); - - return s; - } - catch (Exception e) { - System.err.println(e.getMessage()); - e.printStackTrace(); - - } - return null; - } - - private List getFields(JsonNode jsonNode) { - //StringBuilder fields=new StringBuilder(); - List fields = new ArrayList(); - - Iterator elements = jsonNode.getElements(); - while (elements.hasNext()) { - Iterator phones = elements.next().getElements(); - while (phones.hasNext()) { - JsonNode jsonNode1 = (JsonNode) phones.next(); - Iterator ps = jsonNode1.iterator(); - while (ps.hasNext()) { - JsonNode jsonNode2 = (JsonNode) ps.next(); - if (jsonNode2.get("name") != null) { - // System.out.println(jsonNode2.get("name")); - fields.add(jsonNode2.get("name").asText()); - } - } - // System.out.println("Phone No = "+Text()); - } - - } - return fields; - } - - private List getFields(JsonNode node, String source) { - List list = new ArrayList(); - //String source="/model/instance/"+source+"/"; - - Iterator elements = node.getElements(); - - // System.err.println(node); - //System.out.println(phoneNosNode); - while (elements.hasNext()) { - JsonNode jjNode = elements.next(); - Iterator phones = node.getElements(); - - if (!jjNode.get("type").asText().equalsIgnoreCase("group") - && !jjNode.get("type").asText().equalsIgnoreCase("repeat")) { - - // list.add(new FormField( Node.get("name").asText(), source+Node.get("name").asText() )); - - list.add(new FormField(jjNode.get("name").asText(), source + jjNode.get("name").asText())); - } else if (jjNode.get("type").asText().equalsIgnoreCase("group")) { - //System.err.println( ); - list.addAll(getGroupFields(jjNode, source)); - } - - //System.out.println(Node.get("name")); - } - - return list; - } - - private List getGroupFields(JsonNode node, String formName) { - - List list = new ArrayList(); - String source = formName + node.get("name").asText() + "/"; - try {//jjNode.path("children") - Iterator elements = node.path("children").getElements(); - - //System.out.println(phoneNosNode); - while (elements.hasNext()) { - //System.err.println("sda"); - JsonNode jjNode = elements.next(); - //System.err.println(jjNode); - //Iterator phones = node.getElements(); - if (jjNode.get("name") != null) { - //System.err.println(jjNode.get("name").asText()); - - list.add(new FormField(jjNode.get("name").asText(), source + jjNode.get("name").asText())); - - // }//list.add(node.get("name")+"/"+(Node.get("name").asText())); - //System.out.println(Node.get("name")); - } else { - - // - System.err.println(jjNode.get("name").asText()); - } - } - } - catch (Exception e) { - e.printStackTrace(); - } - - return list; - - } - - private FormDefinition getForm(JsonNode rootNode) { - //StringBuilder sBuilder=new StringBuilder("{ "); - FormDefinition formDefinition = new FormDefinition(); - //FormInstance formInstance=new FormInstance(); - //formInstance. - - //] - - String formName = rootNode.get("name").asText(); - String source = "/model/instance/" + formName + "/"; - - //System.out.println(rootNode.get("name")); - JsonNode phoneNosNode = rootNode.path("children"); - //getFields(); - List fields = getFields(phoneNosNode, source); - //System.out.println(fields); - FormField field = new FormField("id", null); - field.setShouldLoadValue(true); - //fields.add(field); - // fields.set(0, field); - fields.add(0, field); - Form formData = new Form("", source, fields, null); - List sub_forms = getSubForms(phoneNosNode, source); - formData.setSub_forms(sub_forms); - formDefinition.setForm(formData); - return formDefinition; - } - - private SubFormDefinition getSubForm(JsonNode rootNode, String source) { - String formName = rootNode.get("name").asText(); - source += formName + "/"; - System.out.println(rootNode.path("children")); - List fields = getFields(rootNode.path("children"), source); - FormField field = new FormField("id", null); - field.setShouldLoadValue(true); - //fields.add(field); - fields.add(0, field); - SubFormDefinition subForm = new SubFormDefinition(formName, fields); - subForm.setDefault_bind_path(source); - subForm.setBind_type(""); - //SubFormDefinition - return subForm; - } - - private List getSubForms(JsonNode node, String source) { - List list = new ArrayList(); - //String source="/model/instance/"+source+"/"; - Iterator elements = node.getElements(); - //System.out.println(phoneNosNode); - while (elements.hasNext()) { - JsonNode jjNode = elements.next(); - Iterator phones = node.getElements(); - - if (jjNode.get("type").asText().equalsIgnoreCase("repeat")) { - - list.add(getSubForm(jjNode, source)); - } - - //System.out.println(Node.get("name")); - } - - return list; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/util/NetClientGet.java b/opensrp-core/src/main/java/org/opensrp/util/NetClientGet.java deleted file mode 100644 index f8ca90c566..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/util/NetClientGet.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Contributors: muhammad.ahmed@ihsinformatics.com - */ -package org.opensrp.util; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; - -import org.apache.commons.codec.binary.Base64; - -public class NetClientGet { - - // http://localhost:8080/RESTfulExample/json/product/get - public String convertToString(String dataurl, String username, String formId) { - - try { - - URL url = new URL("https://enketo.formhub.org/transform/get_html_form"); - HttpURLConnection conn = (HttpURLConnection) url.openConnection(); - conn.setRequestMethod("POST"); - conn.setDoInput(true); - conn.setDoOutput(true); - String url1 = "server_url=https://ona.io/" + username + "&form_id=" + formId; //+dataurl; - //String url2="server_url=https://ona.io/"+username+"/forms/"+formId+"/form.json&callback=CALLBACKFN"; - - // System.out.println(url2); - //"server_url=https://ona.io/ahmedihs&form_id=crvs_birth_notification" - conn.getOutputStream().write(url1.getBytes()); - if (conn.getResponseCode() != 200) { - throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode()); - } - // System.out.println(conn.getResponseCode()); - BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream()))); - - StringBuilder sb = new StringBuilder(); - String output = null; - // System.out.println("Output from Server .... \n"); - - while ((output = br.readLine()) != null) { - // System.out.println(output); - sb.append(output); - } - - /*FileOutputStream fop = new FileOutputStream("d:\\tlocal201312161608.xml"); - fop.write(sb.toString().getBytes()); - conn.disconnect();*/ - return sb.toString(); - - } - catch (MalformedURLException e) { - - e.printStackTrace(); - - } - catch (IOException e) { - - e.printStackTrace(); - - } - return null; - } - - public byte[] downloadJson(String username, String password, String formPk) throws IOException { - - try { - String authString = username + ":" + password; - System.out.println("auth string: " + authString); - byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); - String authStringEnc = new String(authEncBytes); - System.out.println("Base64 encoded auth string: " + authStringEnc); - //The file that you want to download - String url2 = "https://api.ona.io/api/v1/forms/" + formPk + "/form.json"; - URL link = new URL(url2); - URLConnection urlConnection = link.openConnection(); - urlConnection.setRequestProperty("Authorization", "Basic " + authStringEnc); - InputStream is = urlConnection.getInputStream(); - InputStreamReader isr = new InputStreamReader(is); - - int numCharsRead; - char[] charArray = new char[1024]; - StringBuffer sb = new StringBuffer(); - while ((numCharsRead = isr.read(charArray)) > 0) { - sb.append(charArray, 0, numCharsRead); - } - String result = sb.toString(); - - System.out.println("*** BEGIN ***"); - System.out.println(result); - System.out.println("*** END ***"); - - return result.getBytes(); - } - catch (MalformedURLException e) { - e.printStackTrace(); - } - catch (IOException e) { - e.printStackTrace(); - } - - return null; - } - - public String getModel(String data) { - - return data.substring(data.indexOf(""), data.indexOf("") + 8); - - } - - public String getForm(String data) { - - return data.substring(data.indexOf("
") + 7); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/util/OpenSRPHttpClientFactoryBean.java b/opensrp-core/src/main/java/org/opensrp/util/OpenSRPHttpClientFactoryBean.java deleted file mode 100644 index 597d60a670..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/util/OpenSRPHttpClientFactoryBean.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.opensrp.util; - -import java.util.Properties; - -import org.ektorp.spring.HttpClientFactoryBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -/** - * OpenSrp Factory Bean The application context must define properties along the line of: - * - * - * - * @author keyman - */ -public class OpenSRPHttpClientFactoryBean extends HttpClientFactoryBean { - - @Autowired - @Qualifier("couchdbProperties") - private Properties opensrpCouchdbProperties; - - /** - * Create the couchDB connection when starting the bean factory - */ - @Override - public void afterPropertiesSet() throws Exception { - if (opensrpCouchdbProperties != null) { - setProperties(opensrpCouchdbProperties); - } - super.afterPropertiesSet(); - } - -} diff --git a/opensrp-core/src/main/java/org/opensrp/util/PropertiesConverter.java b/opensrp-core/src/main/java/org/opensrp/util/PropertiesConverter.java deleted file mode 100644 index 55565892af..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/util/PropertiesConverter.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.opensrp.util; - -import java.lang.reflect.Field; -import java.lang.reflect.Type; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.opensrp.domain.LocationProperty; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -public class PropertiesConverter implements JsonSerializer, JsonDeserializer { - - public static Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HHmm").create(); - - @Override - public JsonElement serialize(LocationProperty locationProperty, Type type, - JsonSerializationContext jsonSerializationContext) { - JsonObject object = gson.toJsonTree(locationProperty).getAsJsonObject(); - if (locationProperty.getCustomProperties() != null) { - for (Map.Entry entryset : locationProperty.getCustomProperties().entrySet()) { - object.addProperty(entryset.getKey(), entryset.getValue()); - } - } - return object; - } - - @Override - public LocationProperty deserialize(JsonElement json, Type type, - JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { - - LocationProperty properties = gson.fromJson(json, LocationProperty.class); - - Set> entrySet = json.getAsJsonObject().entrySet(); - Set mappedkeys = new HashSet<>(); - for (Field field : LocationProperty.class.getDeclaredFields()) { - mappedkeys.add(field.getName()); - } - for (Map.Entry entry : entrySet) { - if (!mappedkeys.contains(entry.getKey())) { - properties.getCustomProperties().put(entry.getKey(), entry.getValue().getAsString()); - } - } - - return properties; - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/util/SafeMap.java b/opensrp-core/src/main/java/org/opensrp/util/SafeMap.java deleted file mode 100644 index adc7f482d2..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/util/SafeMap.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.opensrp.util; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -public class SafeMap { - - private Map data; - - public SafeMap() { - this(new HashMap()); - } - - public SafeMap(Map data) { - this.data = data; - } - - public SafeMap putAll(SafeMap formFieldsMap) { - for (String key : formFieldsMap.data.keySet()) { - put(key, formFieldsMap.get(key)); - } - return this; - } - - public String get(String key) { - if (!data.containsKey(key)) { - throw new RuntimeException("Key: " + key + " does not exist in: " + this); - } - return data.get(key); - } - - public SafeMap put(String key, String value) { - data.put(key, value); - return this; - } - - public boolean isEmpty() { - return data.isEmpty(); - } - - public boolean has(String key) { - return data.containsKey(key); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - @Override - public boolean equals(Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/util/TaskDateTimeTypeConverter.java b/opensrp-core/src/main/java/org/opensrp/util/TaskDateTimeTypeConverter.java deleted file mode 100644 index 1bbf51f980..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/util/TaskDateTimeTypeConverter.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.opensrp.util; - -import java.lang.reflect.Type; - -import org.joda.time.DateTime; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; - -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; - -public class TaskDateTimeTypeConverter extends DateTimeTypeConverter { - - private DateTimeFormatter dateTimeFormatter; - - public TaskDateTimeTypeConverter() { - this("yyyy-MM-dd'T'HHmm"); - } - - public TaskDateTimeTypeConverter(String dateFormat) { - dateTimeFormatter = DateTimeFormat.forPattern(dateFormat); - } - - @Override - public DateTime deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) - throws JsonParseException { - try { - return dateTimeFormatter.parseDateTime(json.getAsString()); - } catch (IllegalArgumentException e) { - return new DateTime(json.getAsString()); - } - } - - @Override - public JsonElement serialize(DateTime src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toString(dateTimeFormatter)); - } -} diff --git a/opensrp-core/src/main/java/org/opensrp/util/Utils.java b/opensrp-core/src/main/java/org/opensrp/util/Utils.java deleted file mode 100644 index 810ebf1cda..0000000000 --- a/opensrp-core/src/main/java/org/opensrp/util/Utils.java +++ /dev/null @@ -1,225 +0,0 @@ -package org.opensrp.util; - -import static java.lang.String.valueOf; -import static org.opensrp.common.AllConstants.Form.ANM_ID; -import static org.opensrp.common.AllConstants.Form.CLIENT_VERSION; -import static org.opensrp.common.AllConstants.Form.ENTITY_ID; -import static org.opensrp.common.AllConstants.Form.FORM_NAME; -import static org.opensrp.common.AllConstants.Form.INSTANCE_ID; -import static org.opensrp.common.AllConstants.Form.SERVER_VERSION; -import static org.opensrp.common.util.EasyMap.create; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.lang.reflect.Field; -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.poi.hssf.usermodel.HSSFRow; -import org.apache.poi.hssf.usermodel.HSSFSheet; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.Row; -import org.ektorp.CouchDbConnector; -import org.ektorp.CouchDbInstance; -import org.ektorp.http.HttpClient; -import org.ektorp.http.StdHttpClient; -import org.ektorp.impl.StdCouchDbConnector; -import org.ektorp.impl.StdCouchDbInstance; -import org.joda.time.DateTime; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.opensrp.form.domain.FormSubmission; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.reflect.TypeToken; -import com.mysql.jdbc.StringUtils; - -public class Utils { - - private Utils() { - - } - - public static Map getStringMapFromJSON(String fields) { - return new Gson().fromJson(fields, new TypeToken>() {}.getType()); - } - - public static List getFieldsAsList(Class cls) { - List fieldList = new ArrayList<>(); - Field[] fieldSet = cls.getDeclaredFields(); - for (Field field : fieldSet) { - if (!field.isSynthetic()) { - fieldList.add(field.getName()); - } - } - return fieldList; - } - - public static Object getMergedJSON(Object original, Object updated, List fn, Class clazz) - throws JSONException { - - Gson gs = new GsonBuilder().registerTypeAdapter(DateTime.class, new DateTimeTypeConverter()).create(); - JSONObject originalJo = new JSONObject(gs.toJson(original, clazz)); - - JSONObject updatedJo = new JSONObject(gs.toJson(updated, clazz)); - - JSONObject mergedJson = new JSONObject(); - if (originalJo.length() > 0) { - mergedJson = new JSONObject(originalJo, JSONObject.getNames(originalJo)); - } - - if (updatedJo.length() > 0) { - for (Field key : fn) { - String jokey = key.getName(); - if (updatedJo.has(jokey)) - mergedJson.put(jokey, updatedJo.get(jokey)); - } - } - if (mergedJson.length() > 0) - return gs.fromJson(mergedJson.toString(), clazz); - return original; - } - - public static String getZiggyParams(FormSubmission formSubmission) { - return new Gson().toJson(create(ANM_ID, formSubmission.anmId()).put(INSTANCE_ID, formSubmission.instanceId()) - .put(ENTITY_ID, formSubmission.entityId()).put(FORM_NAME, formSubmission.formName()) - .put(CLIENT_VERSION, valueOf(formSubmission.clientVersion())) - .put(SERVER_VERSION, valueOf(formSubmission.serverVersion())).map()); - } - - public static JSONArray getXlsToJson(String path) throws JSONException, IOException { - FileInputStream inp = new FileInputStream(new File(path)); - // Get the workbook instance for XLS file - HSSFWorkbook workbook = new HSSFWorkbook(inp); - - // Get first sheet from the workbook - HSSFSheet sheet = workbook.getSheetAt(0); - - int hrn = getHeaderRowNum(sheet); - List hr = getRowContent(sheet, hrn); - // Start constructing JSON. - JSONArray jarr = new JSONArray(); - - for (int i = hrn + 1; i <= sheet.getLastRowNum(); i++) { - List rc = getRowContent(sheet, i); - if (!isRowEmpty(rc)) { - JSONObject row = new JSONObject(); - for (int j = 0; j < hr.size(); j++) { - row.put(hr.get(j), rc.get(j)); - } - jarr.put(row); - } - } - - workbook.close(); - return jarr; - } - - private static int getHeaderRowNum(HSSFSheet sheet) { - Iterator i = sheet.iterator(); - while (i.hasNext()) { - Row r = i.next(); - for (Cell c : r) { - if (!StringUtils.isEmptyOrWhitespaceOnly(c.getStringCellValue())) { - return r.getRowNum(); - } - } - } - return -1; - } - - private static boolean isRowEmpty(List rcontent) { - for (String r : rcontent) { - if (!StringUtils.isEmptyOrWhitespaceOnly(r)) { - return false; - } - } - return true; - } - - private static List getRowContent(HSSFSheet sheet, int rowNum) { - List hc = new ArrayList<>(); - HSSFRow r = sheet.getRow(rowNum); - if (r != null && r.getPhysicalNumberOfCells() > 0) { - for (int i = 0; i < r.getLastCellNum(); i++) { - Cell c = r.getCell(i); - hc.add(c == null ? "" : c.getStringCellValue()); - } - } - - /* - * Iterator it = sheet.getRow(rowNum).cellIterator(); while - * (it.hasNext()) { Cell c = it.next(); hc.add(c.getStringCellValue()); - * } - */ - return hc; - } - - /** - * Connect to the database specified by DatabaseConnectionParams - * - * @param dbParams - * @return - * @throws MalformedURLException - */ - public static CouchDbConnector connectToDB(DatabaseConnectionParams dbParams) throws MalformedURLException { - HttpClient authenticatedHttpClient = null; - - if (dbParams.userName != null && !dbParams.userName.isEmpty() && dbParams.password != null - && !dbParams.password.isEmpty()) { - - authenticatedHttpClient = new StdHttpClient.Builder().url(dbParams.url.concat(":").concat(dbParams.portNumber)) - .username(dbParams.userName).password(dbParams.password).build(); - } else { - authenticatedHttpClient = new StdHttpClient.Builder().url(dbParams.url.concat(":").concat(dbParams.portNumber)) - .build(); - } - - CouchDbInstance dbInstance = new StdCouchDbInstance(authenticatedHttpClient); - - CouchDbConnector db = new StdCouchDbConnector(dbParams.dbName, dbInstance); - return db; - - } - - public static CouchDbInstance getDbInstance(DatabaseConnectionParams dbParams) throws MalformedURLException { - HttpClient authenticatedHttpClient = null; - - if (dbParams.userName != null && !dbParams.userName.isEmpty() && dbParams.password != null - && !dbParams.password.isEmpty()) { - - authenticatedHttpClient = new StdHttpClient.Builder().url(dbParams.url.concat(":").concat(dbParams.portNumber)) - .username(dbParams.userName).password(dbParams.password).build(); - } else { - authenticatedHttpClient = new StdHttpClient.Builder().url(dbParams.url.concat(":").concat(dbParams.portNumber)) - .build(); - } - - CouchDbInstance dbInstance = new StdCouchDbInstance(authenticatedHttpClient); - return dbInstance; - } - - public static boolean isEmptyList(List list) { - return list == null || list.size() == 0; - } - - public static class DatabaseConnectionParams { - - public String url; - - public String portNumber; - - public String userName; - - public String password; - - public String dbName; - } -} diff --git a/opensrp-core/src/main/resources/applicationContext-opensrp.xml b/opensrp-core/src/main/resources/applicationContext-opensrp.xml deleted file mode 100755 index 94e2ea81da..0000000000 --- a/opensrp-core/src/main/resources/applicationContext-opensrp.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/opensrp-core/src/main/resources/persistence_couchdb.xml b/opensrp-core/src/main/resources/persistence_couchdb.xml deleted file mode 100755 index 35a901ef6f..0000000000 --- a/opensrp-core/src/main/resources/persistence_couchdb.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/main/resources/persistence_postgres.xml b/opensrp-core/src/main/resources/persistence_postgres.xml deleted file mode 100755 index 8ee4a25af0..0000000000 --- a/opensrp-core/src/main/resources/persistence_postgres.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/opensrp-core/src/main/resources/queries/lucene-client-query b/opensrp-core/src/main/resources/queries/lucene-client-query deleted file mode 100755 index 4069f24f69..0000000000 --- a/opensrp-core/src/main/resources/queries/lucene-client-query +++ /dev/null @@ -1,38 +0,0 @@ -function (doc) { - if(doc.type !== 'Client') return null; - var docl = new Array(); - var len = doc.addresses ? doc.addresses.length : 1; - for(var al = 0; al < len; al++) { - var arr1 = ['firstName', 'middleName', 'lastName', 'gender']; - var arr2 = ['addressType', 'country', 'stateProvince', 'cityVillage', 'countyDistrict', 'subDistrict', 'town', 'subTown']; - var ret = new Document(); - for(var i in arr1) { - ret.add(doc[arr1[i]], {'field' : arr1[i]}); - } - for(var key in doc.attributes) { - ret.add(doc.attributes[key], {'field' : key}); - } - if(doc.addresses) { - var ad = doc.addresses[al]; - if(ad){ - for(var i in arr2) { - ret.add(ad[arr2[i]], {'field' : arr2[i]}); - } - } - - } - var bd = doc.birthdate.substring(0, 19); - ret.add(bd, {'field' : 'birthdate','type' : 'date'}); - - var crd = doc.dateCreated.substring(0, 19); - ret.add(crd, {'field' : 'lastEdited','type' : 'date'}); - - if(doc.dateEdited){ - var led = doc.dateEdited.substring(0, 19); - ret.add(led, {'field' : 'lastEdited','type' : 'date'}); - } - - docl.push(ret); - } - return docl; -} \ No newline at end of file diff --git a/opensrp-core/src/main/resources/queries/lucene-event-query b/opensrp-core/src/main/resources/queries/lucene-event-query deleted file mode 100755 index 54d11380c7..0000000000 --- a/opensrp-core/src/main/resources/queries/lucene-event-query +++ /dev/null @@ -1,22 +0,0 @@ -function(doc) { - if(doc.type !== 'Event') return null; - var arr1 = ['baseEntityId','eventType','entityType','providerId','locationId']; - var ret = new Document(); - for (var i in arr1){ - ret.add(doc[arr1[i]], {'field':arr1[i]}); - } - if(doc.eventDate){ - var bd=doc.eventDate.substring(0,19); - ret.add(bd, {'field':'eventDate','type':'date'}); - } - - var crd = doc.dateCreated.substring(0, 19); - ret.add(crd, {'field' : 'lastEdited','type' : 'date'}); - - if(doc.dateEdited){ - var led = doc.dateEdited.substring(0, 19); - ret.add(led, {'field' : 'lastEdited','type' : 'date'}); - } - - return ret; - } \ No newline at end of file diff --git a/opensrp-core/src/main/resources/queries/lucene-formsubmission-query b/opensrp-core/src/main/resources/queries/lucene-formsubmission-query deleted file mode 100755 index 4069f24f69..0000000000 --- a/opensrp-core/src/main/resources/queries/lucene-formsubmission-query +++ /dev/null @@ -1,38 +0,0 @@ -function (doc) { - if(doc.type !== 'Client') return null; - var docl = new Array(); - var len = doc.addresses ? doc.addresses.length : 1; - for(var al = 0; al < len; al++) { - var arr1 = ['firstName', 'middleName', 'lastName', 'gender']; - var arr2 = ['addressType', 'country', 'stateProvince', 'cityVillage', 'countyDistrict', 'subDistrict', 'town', 'subTown']; - var ret = new Document(); - for(var i in arr1) { - ret.add(doc[arr1[i]], {'field' : arr1[i]}); - } - for(var key in doc.attributes) { - ret.add(doc.attributes[key], {'field' : key}); - } - if(doc.addresses) { - var ad = doc.addresses[al]; - if(ad){ - for(var i in arr2) { - ret.add(ad[arr2[i]], {'field' : arr2[i]}); - } - } - - } - var bd = doc.birthdate.substring(0, 19); - ret.add(bd, {'field' : 'birthdate','type' : 'date'}); - - var crd = doc.dateCreated.substring(0, 19); - ret.add(crd, {'field' : 'lastEdited','type' : 'date'}); - - if(doc.dateEdited){ - var led = doc.dateEdited.substring(0, 19); - ret.add(led, {'field' : 'lastEdited','type' : 'date'}); - } - - docl.push(ret); - } - return docl; -} \ No newline at end of file diff --git a/opensrp-core/src/main/resources/ziggy/ziggy.min.js b/opensrp-core/src/main/resources/ziggy/ziggy.min.js deleted file mode 100755 index 59a345e5b6..0000000000 --- a/opensrp-core/src/main/resources/ziggy/ziggy.min.js +++ /dev/null @@ -1,1085 +0,0 @@ -/** vim: et:ts=4:sw=4:sts=4 - * @license RequireJS 2.1.9 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. - * Available via the MIT or new BSD license. - * see: http://github.com/jrburke/requirejs for details - */ -var requirejs, require, define; -(function(global) { - function isFunction(e) { - return ostring.call(e) === "[object Function]" - } - - function isArray(e) { - return ostring.call(e) === "[object Array]" - } - - function each(e, t) { - if (e) { - var n; - for (n = 0; n < e.length; n += 1) - if (e[n] && t(e[n], n, e)) break - } - } - - function eachReverse(e, t) { - if (e) { - var n; - for (n = e.length - 1; n > -1; n -= 1) - if (e[n] && t(e[n], n, e)) break - } - } - - function hasProp(e, t) { - return hasOwn.call(e, t) - } - - function getOwn(e, t) { - return hasProp(e, t) && e[t] - } - - function eachProp(e, t) { - var n; - for (n in e) - if (hasProp(e, n) && t(e[n], n)) break - } - - function mixin(e, t, n, r) { - return t && eachProp(t, function(t, i) { - if (n || !hasProp(e, i)) r && typeof t != "string" ? (e[i] || (e[i] = {}), mixin(e[i], t, n, r)) : e[i] = t - }), e - } - - function bind(e, t) { - return function() { - return t.apply(e, arguments) - } - } - - function scripts() { - return document.getElementsByTagName("script") - } - - function defaultOnError(e) { - throw e - } - - function getGlobal(e) { - if (!e) return e; - var t = global; - return each(e.split("."), function(e) { - t = t[e] - }), t - } - - function makeError(e, t, n, r) { - var i = new Error(t + "\nhttp://requirejs.org/docs/errors.html#" + e); - return i.requireType = e, i.requireModules = r, n && (i.originalError = n), i - } - - function newContext(e) { - function v(e) { - var t, n; - for (t = 0; e[t]; t += 1) { - n = e[t]; - if (n === ".") e.splice(t, 1), t -= 1; - else if (n === "..") { - if (t === 1 && (e[2] === ".." || e[0] === "..")) break; - t > 0 && (e.splice(t - 1, 2), t -= 2) - } - } - } - - function m(e, t, n) { - var r, i, s, u, a, f, l, c, h, p, d, m = t && t.split("/"), - g = m, - y = o.map, - b = y && y["*"]; - e && e.charAt(0) === "." && (t ? (getOwn(o.pkgs, t) ? g = m = [t] : g = m.slice(0, m.length - 1), e = g.concat(e.split("/")), v(e), i = getOwn(o.pkgs, r = e[0]), e = e.join("/"), i && e === r + "/" + i.main && (e = r)) : e.indexOf("./") === 0 && (e = e.substring(2))); - if (n && y && (m || b)) { - u = e.split("/"); - for (a = u.length; a > 0; a -= 1) { - l = u.slice(0, a).join("/"); - if (m) - for (f = m.length; f > 0; f -= 1) { - s = getOwn(y, m.slice(0, f).join("/")); - if (s) { - s = getOwn(s, l); - if (s) { - c = s, h = a; - break - } - } - } - if (c) break; - !p && b && getOwn(b, l) && (p = getOwn(b, l), d = a) - }!c && p && (c = p, h = d), c && (u.splice(0, h, c), e = u.join("/")) - } - return e - } - - function g(e) { - isBrowser && each(scripts(), function(t) { - if (t.getAttribute("data-requiremodule") === e && t.getAttribute("data-requirecontext") === r.contextName) return t.parentNode.removeChild(t), !0 - }) - } - - function y(e) { - var t = getOwn(o.paths, e); - if (t && isArray(t) && t.length > 1) return t.shift(), r.require.undef(e), r.require([e]), !0 - } - - function b(e) { - var t, n = e ? e.indexOf("!") : -1; - return n > -1 && (t = e.substring(0, n), e = e.substring(n + 1, e.length)), [t, e] - } - - function w(e, t, n, i) { - var s, o, u, a, f = null, - l = t ? t.name : null, - h = e, - v = !0, - g = ""; - return e || (v = !1, e = "_@r" + (p += 1)), a = b(e), f = a[0], e = a[1], f && (f = m(f, l, i), o = getOwn(c, f)), e && (f ? o && o.normalize ? g = o.normalize(e, function(e) { - return m(e, l, i) - }) : g = m(e, l, i) : (g = m(e, l, i), a = b(g), f = a[0], g = a[1], n = !0, s = r.nameToUrl(g))), u = f && !o && !n ? "_unnormalized" + (d += 1) : "", { - prefix: f, - name: g, - parentMap: t, - unnormalized: !!u, - url: s, - originalName: h, - isDefine: v, - id: (f ? f + "!" + g : g) + u - } - } - - function E(e) { - var t = e.id, - n = getOwn(u, t); - return n || (n = u[t] = new r.Module(e)), n - } - - function S(e, t, n) { - var r = e.id, - i = getOwn(u, r); - hasProp(c, r) && (!i || i.defineEmitComplete) ? t === "defined" && n(c[r]) : (i = E(e), i.error && t === "error" ? n(i.error) : i.on(t, n)) - } - - function x(e, t) { - var n = e.requireModules, - r = !1; - t ? t(e) : (each(n, function(t) { - var n = getOwn(u, t); - n && (n.error = e, n.events.error && (r = !0, n.emit("error", e))) - }), r || req.onError(e)) - } - - function T() { - globalDefQueue.length && (apsp.apply(l, [l.length - 1, 0].concat(globalDefQueue)), globalDefQueue = []) - } - - function N(e) { - delete u[e], delete a[e] - } - - function C(e, t, n) { - var r = e.map.id; - e.error ? e.emit("error", e.error) : (t[r] = !0, each(e.depMaps, function(r, i) { - var s = r.id, - o = getOwn(u, s); - o && !e.depMatched[i] && !n[s] && (getOwn(t, s) ? (e.defineDep(i, c[s]), e.check()) : C(o, t, n)) - }), n[r] = !0) - } - - function k() { - var e, n, i, u, f = o.waitSeconds * 1e3, - l = f && r.startTime + f < (new Date).getTime(), - c = [], - h = [], - p = !1, - d = !0; - if (t) return; - t = !0, eachProp(a, function(t) { - e = t.map, n = e.id; - if (!t.enabled) return; - e.isDefine || h.push(t); - if (!t.error) - if (!t.inited && l) y(n) ? (u = !0, p = !0) : (c.push(n), g(n)); - else if (!t.inited && t.fetched && e.isDefine) { - p = !0; - if (!e.prefix) return d = !1 - } - }); - if (l && c.length) return i = makeError("timeout", "Load timeout for modules: " + c, null, c), i.contextName = r.contextName, x(i); - d && each(h, function(e) { - C(e, {}, {}) - }), (!l || u) && p && (isBrowser || isWebWorker) && !s && (s = setTimeout(function() { - s = 0, k() - }, 50)), t = !1 - } - - function L(e) { - hasProp(c, e[0]) || E(w(e[0], null, !0)).init(e[1], e[2]) - } - - function A(e, t, n, r) { - e.detachEvent && !isOpera ? r && e.detachEvent(r, t) : e.removeEventListener(n, t, !1) - } - - function O(e) { - var t = e.currentTarget || e.srcElement; - return A(t, r.onScriptLoad, "load", "onreadystatechange"), A(t, r.onScriptError, "error"), { - node: t, - id: t && t.getAttribute("data-requiremodule") - } - } - - function M() { - var e; - T(); - while (l.length) { - e = l.shift(); - if (e[0] === null) return x(makeError("mismatch", "Mismatched anonymous define() module: " + e[e.length - 1])); - L(e) - } - } - var t, n, r, i, s, o = { - waitSeconds: 7, - baseUrl: "./", - paths: {}, - pkgs: {}, - shim: {}, - config: {} - }, - u = {}, - a = {}, - f = {}, - l = [], - c = {}, - h = {}, - p = 1, - d = 1; - return i = { - require: function(e) { - return e.require ? e.require : e.require = r.makeRequire(e.map) - }, - exports: function(e) { - e.usingExports = !0; - if (e.map.isDefine) return e.exports ? e.exports : e.exports = c[e.map.id] = {} - }, - module: function(e) { - return e.module ? e.module : e.module = { - id: e.map.id, - uri: e.map.url, - config: function() { - var t, n = getOwn(o.pkgs, e.map.id); - return t = n ? getOwn(o.config, e.map.id + "/" + n.main) : getOwn(o.config, e.map.id), t || {} - }, - exports: c[e.map.id] - } - } - }, n = function(e) { - this.events = getOwn(f, e.id) || {}, this.map = e, this.shim = getOwn(o.shim, e.id), this.depExports = [], this.depMaps = [], this.depMatched = [], this.pluginMaps = {}, this.depCount = 0 - }, n.prototype = { - init: function(e, t, n, r) { - r = r || {}; - if (this.inited) return; - this.factory = t, n ? this.on("error", n) : this.events.error && (n = bind(this, function(e) { - this.emit("error", e) - })), this.depMaps = e && e.slice(0), this.errback = n, this.inited = !0, this.ignore = r.ignore, r.enabled || this.enabled ? this.enable() : this.check() - }, - defineDep: function(e, t) { - this.depMatched[e] || (this.depMatched[e] = !0, this.depCount -= 1, this.depExports[e] = t) - }, - fetch: function() { - if (this.fetched) return; - this.fetched = !0, r.startTime = (new Date).getTime(); - var e = this.map; - if (!this.shim) return e.prefix ? this.callPlugin() : this.load(); - r.makeRequire(this.map, { - enableBuildCallback: !0 - })(this.shim.deps || [], bind(this, function() { - return e.prefix ? this.callPlugin() : this.load() - })) - }, - load: function() { - var e = this.map.url; - h[e] || (h[e] = !0, r.load(this.map.id, e)) - }, - check: function() { - if (!this.enabled || this.enabling) return; - var e, t, n = this.map.id, - i = this.depExports, - s = this.exports, - o = this.factory; - if (!this.inited) this.fetch(); - else if (this.error) this.emit("error", this.error); - else if (!this.defining) { - this.defining = !0; - if (this.depCount < 1 && !this.defined) { - if (isFunction(o)) { - if (this.events.error && this.map.isDefine || req.onError !== defaultOnError) try { - s = r.execCb(n, o, i, s) - } catch (u) { - e = u - } else s = r.execCb(n, o, i, s); - this.map.isDefine && (t = this.module, t && t.exports !== undefined && t.exports !== this.exports ? s = t.exports : s === undefined && this.usingExports && (s = this.exports)); - if (e) return e.requireMap = this.map, e.requireModules = this.map.isDefine ? [this.map.id] : null, e.requireType = this.map.isDefine ? "define" : "require", x(this.error = e) - } else s = o; - this.exports = s, this.map.isDefine && !this.ignore && (c[n] = s, req.onResourceLoad && req.onResourceLoad(r, this.map, this.depMaps)), N(n), this.defined = !0 - } - this.defining = !1, this.defined && !this.defineEmitted && (this.defineEmitted = !0, this.emit("defined", this.exports), this.defineEmitComplete = !0) - } - }, - callPlugin: function() { - var e = this.map, - t = e.id, - n = w(e.prefix); - this.depMaps.push(n), S(n, "defined", bind(this, function(n) { - var i, s, a, f = this.map.name, - l = this.map.parentMap ? this.map.parentMap.name : null, - c = r.makeRequire(e.parentMap, { - enableBuildCallback: !0 - }); - if (this.map.unnormalized) { - n.normalize && (f = n.normalize(f, function(e) { - return m(e, l, !0) - }) || ""), s = w(e.prefix + "!" + f, this.map.parentMap), S(s, "defined", bind(this, function(e) { - this.init([], function() { - return e - }, null, { - enabled: !0, - ignore: !0 - }) - })), a = getOwn(u, s.id), a && (this.depMaps.push(s), this.events.error && a.on("error", bind(this, function(e) { - this.emit("error", e) - })), a.enable()); - return - } - i = bind(this, function(e) { - this.init([], function() { - return e - }, null, { - enabled: !0 - }) - }), i.error = bind(this, function(e) { - this.inited = !0, this.error = e, e.requireModules = [t], eachProp(u, function(e) { - e.map.id.indexOf(t + "_unnormalized") === 0 && N(e.map.id) - }), x(e) - }), i.fromText = bind(this, function(n, s) { - var u = e.name, - a = w(u), - f = useInteractive; - s && (n = s), f && (useInteractive = !1), E(a), hasProp(o.config, t) && (o.config[u] = o.config[t]); - try { - req.exec(n) - } catch (l) { - return x(makeError("fromtexteval", "fromText eval for " + t + " failed: " + l, l, [t])) - } - f && (useInteractive = !0), this.depMaps.push(a), r.completeLoad(u), c([u], i) - }), n.load(e.name, c, i, o) - })), r.enable(n, this), this.pluginMaps[n.id] = n - }, - enable: function() { - a[this.map.id] = this, this.enabled = !0, this.enabling = !0, each(this.depMaps, bind(this, function(e, t) { - var n, s, o; - if (typeof e == "string") { - e = w(e, this.map.isDefine ? this.map : this.map.parentMap, !1, !this.skipMap), this.depMaps[t] = e, o = getOwn(i, e.id); - if (o) { - this.depExports[t] = o(this); - return - } - this.depCount += 1, S(e, "defined", bind(this, function(e) { - this.defineDep(t, e), this.check() - })), this.errback && S(e, "error", bind(this, this.errback)) - } - n = e.id, s = u[n], !hasProp(i, n) && s && !s.enabled && r.enable(e, this) - })), eachProp(this.pluginMaps, bind(this, function(e) { - var t = getOwn(u, e.id); - t && !t.enabled && r.enable(e, this) - })), this.enabling = !1, this.check() - }, - on: function(e, t) { - var n = this.events[e]; - n || (n = this.events[e] = []), n.push(t) - }, - emit: function(e, t) { - each(this.events[e], function(e) { - e(t) - }), e === "error" && delete this.events[e] - } - }, r = { - config: o, - contextName: e, - registry: u, - defined: c, - urlFetched: h, - defQueue: l, - Module: n, - makeModuleMap: w, - nextTick: req.nextTick, - onError: x, - configure: function(e) { - e.baseUrl && e.baseUrl.charAt(e.baseUrl.length - 1) !== "/" && (e.baseUrl += "/"); - var t = o.pkgs, - n = o.shim, - i = { - paths: !0, - config: !0, - map: !0 - }; - eachProp(e, function(e, t) { - i[t] ? t === "map" ? (o.map || (o.map = {}), mixin(o[t], e, !0, !0)) : mixin(o[t], e, !0) : o[t] = e - }), e.shim && (eachProp(e.shim, function(e, t) { - isArray(e) && (e = { - deps: e - }), (e.exports || e.init) && !e.exportsFn && (e.exportsFn = r.makeShimExports(e)), n[t] = e - }), o.shim = n), e.packages && (each(e.packages, function(e) { - var n; - e = typeof e == "string" ? { - name: e - } : e, n = e.location, t[e.name] = { - name: e.name, - location: n || e.name, - main: (e.main || "main").replace(currDirRegExp, "").replace(jsSuffixRegExp, "") - } - }), o.pkgs = t), eachProp(u, function(e, t) { - !e.inited && !e.map.unnormalized && (e.map = w(t)) - }), (e.deps || e.callback) && r.require(e.deps || [], e.callback) - }, - makeShimExports: function(e) { - function t() { - var t; - return e.init && (t = e.init.apply(global, arguments)), t || e.exports && getGlobal(e.exports) - } - return t - }, - makeRequire: function(t, n) { - function s(o, a, f) { - var l, h, p; - return n.enableBuildCallback && a && isFunction(a) && (a.__requireJsBuild = !0), typeof o == "string" ? isFunction(a) ? x(makeError("requireargs", "Invalid require call"), f) : t && hasProp(i, o) ? i[o](u[t.id]) : req.get ? req.get(r, o, t, s) : (h = w(o, t, !1, !0), l = h.id, hasProp(c, l) ? c[l] : x(makeError("notloaded", 'Module name "' + l + '" has not been loaded yet for context: ' + e + (t ? "" : ". Use require([])")))) : (M(), r.nextTick(function() { - M(), p = E(w(null, t)), p.skipMap = n.skipMap, p.init(o, a, f, { - enabled: !0 - }), k() - }), s) - } - return n = n || {}, mixin(s, { - isBrowser: isBrowser, - toUrl: function(e) { - var n, i = e.lastIndexOf("."), - s = e.split("/")[0], - o = s === "." || s === ".."; - return i !== -1 && (!o || i > 1) && (n = e.substring(i, e.length), e = e.substring(0, i)), r.nameToUrl(m(e, t && t.id, !0), n, !0) - }, - defined: function(e) { - return hasProp(c, w(e, t, !1, !0).id) - }, - specified: function(e) { - return e = w(e, t, !1, !0).id, hasProp(c, e) || hasProp(u, e) - } - }), t || (s.undef = function(e) { - T(); - var n = w(e, t, !0), - r = getOwn(u, e); - g(e), delete c[e], delete h[n.url], delete f[e], r && (r.events.defined && (f[e] = r.events), N(e)) - }), s - }, - enable: function(e) { - var t = getOwn(u, e.id); - t && E(e).enable() - }, - completeLoad: function(e) { - var t, n, r, i = getOwn(o.shim, e) || {}, - s = i.exports; - T(); - while (l.length) { - n = l.shift(); - if (n[0] === null) { - n[0] = e; - if (t) break; - t = !0 - } else n[0] === e && (t = !0); - L(n) - } - r = getOwn(u, e); - if (!t && !hasProp(c, e) && r && !r.inited) { - if (o.enforceDefine && (!s || !getGlobal(s))) { - if (y(e)) return; - return x(makeError("nodefine", "No define call for " + e, null, [e])) - } - L([e, i.deps || [], i.exportsFn]) - } - k() - }, - nameToUrl: function(e, t, n) { - var r, i, s, u, a, f, l, c, h; - if (req.jsExtRegExp.test(e)) c = e + (t || ""); - else { - r = o.paths, i = o.pkgs, a = e.split("/"); - for (f = a.length; f > 0; f -= 1) { - l = a.slice(0, f).join("/"), s = getOwn(i, l), h = getOwn(r, l); - if (h) { - isArray(h) && (h = h[0]), a.splice(0, f, h); - break - } - if (s) { - e === s.name ? u = s.location + "/" + s.main : u = s.location, a.splice(0, f, u); - break - } - } - c = a.join("/"), c += t || (/^data\:|\?/.test(c) || n ? "" : ".js"), c = (c.charAt(0) === "/" || c.match(/^[\w\+\.\-]+:/) ? "" : o.baseUrl) + c - } - return o.urlArgs ? c + ((c.indexOf("?") === -1 ? "?" : "&") + o.urlArgs) : c - }, - load: function(e, t) { - req.load(r, e, t) - }, - execCb: function(e, t, n, r) { - return t.apply(r, n) - }, - onScriptLoad: function(e) { - if (e.type === "load" || readyRegExp.test((e.currentTarget || e.srcElement).readyState)) { - interactiveScript = null; - var t = O(e); - r.completeLoad(t.id) - } - }, - onScriptError: function(e) { - var t = O(e); - if (!y(t.id)) return x(makeError("scripterror", "Script error for: " + t.id, e, [t.id])) - } - }, r.require = r.makeRequire(), r - } - - function getInteractiveScript() { - return interactiveScript && interactiveScript.readyState === "interactive" ? interactiveScript : (eachReverse(scripts(), function(e) { - if (e.readyState === "interactive") return interactiveScript = e - }), interactiveScript) - } - var req, s, head, baseElement, dataMain, src, interactiveScript, currentlyAddingScript, mainScript, subPath, version = "2.1.9", - commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg, - cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, - jsSuffixRegExp = /\.js$/, - currDirRegExp = /^\.\//, - op = Object.prototype, - ostring = op.toString, - hasOwn = op.hasOwnProperty, - ap = Array.prototype, - apsp = ap.splice, - isBrowser = typeof window != "undefined" && typeof navigator != "undefined" && !!window.document, - isWebWorker = !isBrowser && typeof importScripts != "undefined", - readyRegExp = isBrowser && navigator.platform === "PLAYSTATION 3" ? /^complete$/ : /^(complete|loaded)$/, - defContextName = "_", - isOpera = typeof opera != "undefined" && opera.toString() === "[object Opera]", - contexts = {}, - cfg = {}, - globalDefQueue = [], - useInteractive = !1; - if (typeof define != "undefined") return; - if (typeof requirejs != "undefined") { - if (isFunction(requirejs)) return; - cfg = requirejs, requirejs = undefined - } - typeof require != "undefined" && !isFunction(require) && (cfg = require, require = undefined), req = requirejs = function(e, t, n, r) { - var i, s, o = defContextName; - return !isArray(e) && typeof e != "string" && (s = e, isArray(t) ? (e = t, t = n, n = r) : e = []), s && s.context && (o = s.context), i = getOwn(contexts, o), i || (i = contexts[o] = req.s.newContext(o)), s && i.configure(s), i.require(e, t, n) - }, req.config = function(e) { - return req(e) - }, req.nextTick = typeof setTimeout != "undefined" ? function(e) { - setTimeout(e, 4) - } : function(e) { - e() - }, require || (require = req), req.version = version, req.jsExtRegExp = /^\/|:|\?|\.js$/, req.isBrowser = isBrowser, s = req.s = { - contexts: contexts, - newContext: newContext - }, req({}), each(["toUrl", "undef", "defined", "specified"], function(e) { - req[e] = function() { - var t = contexts[defContextName]; - return t.require[e].apply(t, arguments) - } - }), isBrowser && (head = s.head = document.getElementsByTagName("head")[0], baseElement = document.getElementsByTagName("base")[0], baseElement && (head = s.head = baseElement.parentNode)), req.onError = defaultOnError, req.createNode = function(e, t, n) { - var r = e.xhtml ? document.createElementNS("http://www.w3.org/1999/xhtml", "html:script") : document.createElement("script"); - return r.type = e.scriptType || "text/javascript", r.charset = "utf-8", r.async = !0, r - }, req.load = function(e, t, n) { - var r = e && e.config || {}, - i; - if (isBrowser) return i = req.createNode(r, t, n), i.setAttribute("data-requirecontext", e.contextName), i.setAttribute("data-requiremodule", t), i.attachEvent && !(i.attachEvent.toString && i.attachEvent.toString().indexOf("[native code") < 0) && !isOpera ? (useInteractive = !0, i.attachEvent("onreadystatechange", e.onScriptLoad)) : (i.addEventListener("load", e.onScriptLoad, !1), i.addEventListener("error", e.onScriptError, !1)), i.src = n, currentlyAddingScript = i, baseElement ? head.insertBefore(i, baseElement) : head.appendChild(i), currentlyAddingScript = null, i; - if (isWebWorker) try { - importScripts(n), e.completeLoad(t) - } catch (s) { - e.onError(makeError("importscripts", "importScripts failed for " + t + " at " + n, s, [t])) - } - }, isBrowser && !cfg.skipDataMain && eachReverse(scripts(), function(e) { - head || (head = e.parentNode), dataMain = e.getAttribute("data-main"); - if (dataMain) return mainScript = dataMain, cfg.baseUrl || (src = mainScript.split("/"), mainScript = src.pop(), subPath = src.length ? src.join("/") + "/" : "./", cfg.baseUrl = subPath), mainScript = mainScript.replace(jsSuffixRegExp, ""), req.jsExtRegExp.test(mainScript) && (mainScript = dataMain), cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript], !0 - }), define = function(e, t, n) { - var r, i; - typeof e != "string" && (n = t, t = e, e = null), isArray(t) || (n = t, t = null), !t && isFunction(n) && (t = [], n.length && (n.toString().replace(commentRegExp, "").replace(cjsRequireRegExp, function(e, n) { - t.push(n) - }), t = (n.length === 1 ? ["require"] : ["require", "exports", "module"]).concat(t))), useInteractive && (r = currentlyAddingScript || getInteractiveScript(), r && (e || (e = r.getAttribute("data-requiremodule")), i = contexts[r.getAttribute("data-requirecontext")])), (i ? i.defQueue : globalDefQueue).push([e, t, n]) - }, define.amd = { - jQuery: !0 - }, req.exec = function(text) { - return eval(text) - }, req(cfg) -})(this), define("../../node_modules/requirejs/require.js", function() {}), define("ziggy/EntityRelationshipLoader", [], function() { - return { - load: function() { - return JSON.parse(ziggyFileLoader.loadAppData("entity_relationship.json")) - } - } -}), define("ziggy/FormDefinitionLoader", [], function() { - return { - load: function(e) { - return JSON.parse(ziggyFileLoader.loadAppData(e + "/form_definition.json")) - } - } -}), define("ziggy/FormDataRepository", [], function() { - var e; - return typeof formDataRepositoryContext != "undefined" && (e = formDataRepositoryContext), { - getFormInstanceByFormTypeAndId: function(e, t) { - return null - }, - queryUniqueResult: function(t) { - return e.queryUniqueResult(t) - }, - queryList: function(t) { - return e.queryList(t) - }, - saveFormSubmission: function(t, n, r) { - return e.saveFormSubmission(JSON.stringify(t), JSON.stringify(n), r) - }, - saveEntity: function(t, n) { - return e.saveEntity(t, JSON.stringify(n)) - } - } -}), define("ziggy/RelationKind", [], function() { - var e = { - one_to_one: { - type: "one_to_one" - }, - one_to_many: { - type: "one_to_many" - }, - many_to_one: { - type: "many_to_one" - } - }; - return e.one_to_one.inverse = e.one_to_one, e.one_to_many.inverse = e.many_to_one, e.many_to_one.inverse = e.one_to_many, e -}), define("ziggy/Util", [], function() { - return String.prototype.format || (String.prototype.format = function() { - var e = arguments; - return this.replace(/{(\d+)}/g, function(t, n) { - return typeof e[n] != "undefined" ? e[n] : t - }) - }), { - hasValue: function(e) { - return typeof e != "undefined" && !!e - } - } -}), define("ziggy/SqlQueryBuilder", ["ziggy/FormDataRepository", "ziggy/RelationKind", "ziggy/Util"], function(e, t, n) { - var r = function(e, t, s, o) { - var u = e.findEntityDefinitionByType(o.type), - a = o.from.split(".")[1], - f = "select * from " + o.type + " where " + o.to + " = '" + t[a] + "'", - l = JSON.parse(i(o)(f)); - return n.hasValue(l) ? !n.hasValue(u.relations) || u.relations.length === 0 ? l : (u.relations.forEach(function(t) { - if (t.type !== s) { - var i = r(e, l, u.type, t); - n.hasValue(i) && (l[t.type] = i) - } - }), l) : null - }, - i = function(n) { - return t[n.kind] === t.one_to_many ? e.queryList : e.queryUniqueResult - }; - return { - loadEntityHierarchy: function(t, i, s) { - var o = t.findEntityDefinitionByType(i), - u = "select * from " + i + " where id = '" + s + "'", - a = JSON.parse(e.queryUniqueResult(u)); - if (!n.hasValue(o.relations) || o.relations.length === 0) { - var f = {}; - return f[i] = a, f - } - o.relations.forEach(function(e) { - a[e.type] = r(t, a, i, e) - }); - var l = {}; - return l[i] = a, l - } - } -}), define("ziggy/IdFactoryBridge", [], function() { - var e; - return typeof formDataRepositoryContext != "undefined" && (e = formDataRepositoryContext), { - generateIdFor: function(t) { - return e.generateIdFor(t) - } - } -}), define("ziggy/IdFactory", ["ziggy/IdFactoryBridge"], function(e) { - return { - generateIdFor: function(t) { - return e.generateIdFor(t) - } - } -}), define("ziggy/Entities", ["ziggy/Util"], function(e) { - var t = function() { - var t = this; - t.entities = [], t.add = function(e) { - return t.entities.push(e), t - }, t.addAll = function(e) { - return t.entities = t.entities.concat(e.entities), t - }, t.forEach = function(e) { - return t.entities.forEach(e) - }, t.findEntityByType = function(e) { - for (var n = 0; n < t.entities.length; n++) - if (t.entities[n].type === e) return t.entities[n]; - return null - }, t.findEntityByTypeAndId = function(e) { - for (var n = 0; n < t.entities.length; n++) - if (t.entities[n].type === e.type && t.entities[n].getFieldByPersistenceName("id").value === e.getFieldByPersistenceName("id").value) return t.entities[n]; - return null - }, t.findEntitiesByType = function(e) { - return t.entities.filter(function(t) { - return t.type === e - }) - }, t.contains = function(n) { - return e.hasValue(t.findEntityByTypeAndId(n)) - } - }; - return { - newInstance: function() { - return new t - } - } -}), define("ziggy/FormModelMapper", ["ziggy/FormDataRepository", "ziggy/SqlQueryBuilder", "ziggy/IdFactory", "ziggy/Util", "ziggy/RelationKind", "ziggy/Entities"], function(e, t, n, r, i, s) { - var o = function(e, t, n) { - return r.hasValue(e) && t.contains(e) && !n.contains(e) - }, - u = function(e, t, n, r) { - var i = e.to.split(".")[1], - s = t.findEntityByTypeAndId(r); - s.createField(s.source + "." + i, s.source + "." + i, i, n) - }, - a = function(e, t) { - var n = e.form.fields.filter(function(e) { - return e.source === t.source - })[0]; - r.hasValue(n) ? r.hasValue(n.value) || (n.value = t.value) : e.form.fields.push(t) - }, - f = function(e, t) { - e.forEach(function(e) { - var n = c(e); - a(t, n) - }) - }, - l = function(e, t) { - var n = c(e); - t.id = n.value - }, - c = function(e) { - var t = e.getFieldByPersistenceName("id"); - return r.hasValue(t) ? r.hasValue(t.value) || (t.value = n.generateIdFor(e.type)) : (t = { - name: e.source + ".id", - source: e.source + ".id", - persistenceName: "id", - value: n.generateIdFor(e.type) - }, e.addField(t)), t - }, - h = function(e, t, n, r, i) { - o(e, t, n) && (u(i, t, r, e), p(e, t, n)) - }, - p = function(t, n, r) { - var s = t.findParents(); - s.forEach(function(e) { - var t = n.findEntityByType(e.type); - o(t, n, r) && p(t, n, r) - }); - var u; - if (o(t, n, r)) { - var a = {}; - t.forEachField(function(e) { - a[e.persistenceName] = e.value - }), e.saveEntity(t.type, a), u = t.getFieldByPersistenceName("id").value, r.add(t) - } - var f = t.findChildren(); - f.forEach(function(e) { - if (e.kind === i.one_to_many.type) { - var t = n.findEntitiesByType(e.type); - t.forEach(function(t) { - h(t, n, r, u, e) - }) - } else { - var s = n.findEntityByType(e.type); - h(s, n, r, u, e) - } - }) - }, - d = function(e, t) { - var n = e; - for (var i = 0; i < t.length; i++) { - var s = t[i]; - if (!r.hasValue(n[s])) { - n = undefined; - break - } - n = n[s] - } - return n - }, - v = function(e, t) { - return e.filter(function(e) { - if (e.name === t) return e - })[0] - }, - m = function(e, t) { - e.form.fields.forEach(function(e) { - if (e.shouldLoadValue) { - var n = e.source.split("."), - i = d(t, n); - r.hasValue(i) && (e.value = i) - } - }) - }, - g = function(e, t, n) { - r.hasValue(e.form.sub_forms) && e.form.sub_forms.forEach(function(i) { - var s = t.findPathToBaseEntityFromSubEntity(e.form.bind_type, i.bind_type), - o = d(n, s); - o.forEach(function(e) { - var t = null; - i.fields.forEach(function(n) { - if (n.shouldLoadValue) { - var i = d(e, n.source.split(".").slice(-1)); - r.hasValue(i) && (t = t || {}, t[n.name] = i) - } - }), r.hasValue(t) && i.instances.push(t) - }) - }) - }, - y = function(e, t) { - if (!r.hasValue(t)) return; - var n = decodeURIComponent(decodeURIComponent(t)), - i = JSON.parse(n); - for (var s in i) - if (i.hasOwnProperty(s)) { - var o = v(e.form.fields, s); - r.hasValue(o) && (o.value = i[s]) - } - }, - b = function(e, t) { - e.forEach(function(e) { - r.hasValue(e.source) || (e.source = t + "." + e.name) - }) - }, - w = function(e) { - r.hasValue(e.form.sub_forms) && e.form.sub_forms.forEach(function(e) { - b(e.fields, e.bind_type), e.instances = [] - }) - }; - return { - mapToFormModel: function(n, i, s) { - var o = e.getFormInstanceByFormTypeAndId(s.id, s.formName); - if (r.hasValue(o)) { - var u = JSON.parse(o); - if (r.hasValue(u)) return u - } - if (!r.hasValue(n)) return i; - b(i.form.fields, i.form.bind_type), w(i); - if (!r.hasValue(s.entityId)) return i; - var a = t.loadEntityHierarchy(n, i.form.bind_type, s.entityId); - return m(i, a), y(i, s.fieldOverrides), g(i, n, a), i - }, - mapToEntityAndSave: function(e, t) { - var n = s.newInstance(); - t.form.fields.forEach(function(t) { - var i = t.source.split("."), - s = i[i.length - 2], - o = n.findEntityByType(s); - r.hasValue(o) || (o = e.findEntityDefinitionByType(s).createInstance(), o.source = t.source.substring(0, t.source.lastIndexOf(".")), n.add(o)), o.createField(t.name, t.source, i[i.length - 1], t.value) - }); - var i = s.newInstance(); - r.hasValue(t.form.sub_forms) && t.form.sub_forms.forEach(function(t) { - t.instances.forEach(function(n) { - var r = e.findEntityDefinitionByType(t.bind_type).createInstance(); - t.fields.forEach(function(e) { - var t = e.source.split("."); - r.createField(e.name, e.source, t[t.length - 1], n[e.name]) - }), r.source = t.bind_type, l(r, n), i.add(r) - }) - }), f(n, t), n.addAll(i); - var o = s.newInstance(), - u = n.findEntityByType(t.form.bind_type); - p(u, n, o) - } - } -}), define("ziggy/FormSubmissionRouter", [], function() { - var e; - return typeof formSubmissionRouter != "undefined" && (e = formSubmissionRouter), { - route: function(t) { - return e.route(t) - } - } -}), define("ziggy/Entity", [], function() { - var e = function(e) { - var t = this, - n = function(e) { - return t.relations.filter(function(t) { - return t.as === e - }) - }; - t.type = e, t.relations = [], t.fields = [], t.addField = function(e) { - return t.fields.push(e), t - }, t.createField = function(e, n, r, i) { - return t.fields.push({ - name: e, - source: n, - persistenceName: r, - value: i - }), t - }, t.findParents = function() { - return n("child") - }, t.findChildren = function() { - return n("parent") - }, t.getFieldByPersistenceName = function(e) { - return t.fields.filter(function(t) { - return t.persistenceName === e - })[0] - }, t.forEachField = function(e) { - return t.fields.forEach(e) - } - }; - return { - newInstance: function(t) { - return new e(t) - } - } -}), define("ziggy/EntityDef", ["ziggy/Entity"], function(e) { - var t = function(t) { - var n = this; - n.type = t, n.relations = [], n.fields = [], n.addRelation = function(e) { - return n.relations.push(e), n - }, n.removeAllRelations = function() { - n.relations = [] - }, n.createInstance = function() { - var t = e.newInstance(n.type); - return n.relations.forEach(function(e) { - t.relations.push(e.createInstance()) - }), t - }, n.findRelationByType = function(e) { - return n.relations.filter(function(t) { - return t.type === e - })[0] - } - }; - return { - newInstance: function(e) { - return new t(e) - } - } -}), define("ziggy/EntityDefinitions", ["ziggy/Util"], function(e) { - var t = function() { - var t = this; - t.entityDefinitions = [], t.add = function(e) { - return t.entityDefinitions.push(e), t - }, t.findEntityDefinitionByType = function(e) { - for (var n = 0; n < t.entityDefinitions.length; n++) - if (t.entityDefinitions[n].type === e) return t.entityDefinitions[n]; - return null - }, t.hasEntityDefinitions = function() { - return t.entityDefinitions.length !== 0 - }, t.findPathToBaseEntityFromSubEntity = function(n, r) { - var i = t.findEntityDefinitionByType(r), - s = i.findRelationByType(n); - if (e.hasValue(s)) return [s.type, r]; - for (var o = 0; o < i.relations.length; o++) { - var u = t.findPathToBaseEntityFromSubEntity(n, i.relations[o].type); - if (e.hasValue(u)) return u.push(r), u - } - return null - } - }; - return { - newInstance: function() { - return new t - } - } -}), define("ziggy/Relation", [], function() { - var e = function(e, t, n, r, i) { - var s = this; - s.type = e, s.kind = t, s.as = n, s.from = r, s.to = i - }; - return { - newInstance: function(t, n, r, i, s) { - return new e(t, n, r, i, s) - } - } -}), define("ziggy/RelationDef", ["ziggy/Relation"], function(e) { - var t = function(t, n, r, i, s) { - var o = this; - o.type = t, o.kind = n, o.as = r, o.from = i, o.to = s, o.createInstance = function() { - return e.newInstance(o.type, o.kind, o.as, o.from, o.to) - } - }; - return { - newInstance: function(e, n, r, i, s) { - return new t(e, n, r, i, s) - } - } -}), define("ziggy/EntityRelationships", ["ziggy/EntityDef", "ziggy/EntityDefinitions", "ziggy/RelationDef", "ziggy/RelationKind", "ziggy/Util"], function(e, t, n, r, i) { - var s = function(n, r) { - var s = t.newInstance(); - return i.hasValue(n) && n.forEach(function(t) { - var n = s.findEntityDefinitionByType(t.parent); - i.hasValue(n) || s.add(e.newInstance(t.parent)), n = s.findEntityDefinitionByType(t.child), i.hasValue(n) || s.add(e.newInstance(t.child)) - }), i.hasValue(r.form.bind_type) && !i.hasValue(s.findEntityDefinitionByType(r.form.bind_type)) && s.add(e.newInstance(r.form.bind_type)), s - }; - return { - determineEntitiesAndRelations: function(e, t) { - var o = s(e, t); - return i.hasValue(e) ? (e.forEach(function(e) { - var t = o.findEntityDefinitionByType(e.parent); - i.hasValue(t.relations) || t.removeAllRelations(), t.addRelation(n.newInstance(e.child, e.kind, "parent", e.from, e.to)); - var s = o.findEntityDefinitionByType(e.child); - i.hasValue(s.relations) || s.removeAllRelations(), s.addRelation(n.newInstance(e.parent, r[e.kind].inverse.type, "child", e.to, e.from)) - }), o) : o - } - } -}), define("FormDataController", ["ziggy/EntityRelationshipLoader", "ziggy/FormDefinitionLoader", "ziggy/FormModelMapper", "ziggy/FormDataRepository", "ziggy/FormSubmissionRouter", "ziggy/EntityRelationships", "ziggy/Util"], function(e, t, n, r, i, s, o) { - var u = "1", - a, f, l, c = function(n) { - o.hasValue(a) || (a = e.load()), o.hasValue(f) || (f = t.load(n.formName)), o.hasValue(l) || (l = s.determineEntitiesAndRelations(a, f)) - }, - h = function(e, t) { - c(e); - if (l.hasEntityDefinitions()) { - n.mapToEntityAndSave(l, t); - var r = t.form.fields.filter(function(e) { - return e.source === t.form.bind_type + ".id" - })[0]; - e.entityId = r.value - } - return e - }; - return { - get: function(e) { - return c(e), n.mapToFormModel(l, f, e) - }, - save: function(e, t) { - typeof e != "object" && (e = JSON.parse(e)), typeof t != "object" && (t = JSON.parse(t)), e = h(e, t); - var n = r.saveFormSubmission(e, t, t.form_data_definition_version || u); - o.hasValue(n) && i.route(e.instanceId) - }, - createOrUpdateEntity: function(e, t) { - typeof e != "object" && (e = JSON.parse(e)), typeof t != "object" && (t = JSON.parse(t)), e = h(e, t), i.route(e.instanceId) - }, - deleteFormSubmission: function(e) { - c(e) - } - } -}), requirejs.config({ - paths: { - ziggy: "." - } -}), require(["FormDataController"], function(e) { - controller = e -}), define("../../main", function() {}); \ No newline at end of file diff --git a/opensrp-core/src/test/java/org/opensrp/BaseIntegrationTest.java b/opensrp-core/src/test/java/org/opensrp/BaseIntegrationTest.java deleted file mode 100644 index 4bfa043828..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/BaseIntegrationTest.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.opensrp; - -public abstract class BaseIntegrationTest extends SpringApplicationContextProvider { - -} diff --git a/opensrp-core/src/test/java/org/opensrp/FormSubmissionProcessorTest.java b/opensrp-core/src/test/java/org/opensrp/FormSubmissionProcessorTest.java deleted file mode 100644 index 958567a42f..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/FormSubmissionProcessorTest.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.mockito.Mock; -import org.opensrp.domain.Client; -import org.opensrp.domain.Event; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.domain.SubFormData; -import org.opensrp.form.service.FormAttributeParser; -import org.opensrp.repository.couch.AllClients; -import org.opensrp.repository.couch.AllEvents; -import org.opensrp.scheduler.HealthSchedulerService; -import org.opensrp.scheduler.Schedule; -import org.opensrp.scheduler.Schedule.ActionType; -import org.opensrp.service.ClientService; -import org.opensrp.service.EventService; -import org.opensrp.service.formSubmission.FormEntityConverter; -import org.opensrp.service.formSubmission.FormSubmissionProcessor; -import org.opensrp.service.formSubmission.handler.FormSubmissionRouter; -import org.opensrp.service.formSubmission.ziggy.ZiggyService; -import org.opensrp.util.TestResourceLoader; - -public class FormSubmissionProcessorTest extends TestResourceLoader { - - @Mock - private FormSubmissionProcessor fsp; - - @Mock - private ZiggyService ziggyService; - - @Mock - private FormSubmissionRouter formSubmissionRouter; - - @Mock - private FormEntityConverter formEntityConverter; - - @Mock - private HealthSchedulerService scheduleService; - - @Mock - private ClientService clientService; - - @Mock - private EventService eventService; - - @Mock - private AllClients allClients; - - @Mock - private AllEvents allEvents; - - public FormSubmissionProcessorTest() throws IOException { - super(); - } - - @Before - public void setup() throws IOException { - initMocks(this); - FormEntityConverter fec = new FormEntityConverter(new FormAttributeParser("/form")); - fsp = new FormSubmissionProcessor(ziggyService, formSubmissionRouter, fec, scheduleService, clientService, - allClients, eventService, allEvents); - } - - @Test - @Ignore //FIXME - public void testFormSubmission() throws Exception { - FormSubmission submission = getFormSubmissionFor("pnc_reg_form"); - - List schl = new ArrayList(); - schl.add(new Schedule(ActionType.enroll, new String[] { submission.formName() }, "Boosters", "REMINDER", - new String[] { "birthdate" }, "child", "")); - when(scheduleService.findAutomatedSchedules(submission.formName())).thenReturn(schl); - - fsp.processFormSubmission(submission); - - int totalEntities = 1; - for (SubFormData e : submission.subForms()) { - totalEntities += e.instances().size(); - } - verify(clientService, times(totalEntities)).addClient(any(Client.class)); - verify(eventService, times(totalEntities)).addEvent(any(Event.class)); - verify(scheduleService, times(totalEntities - 1)).enrollIntoSchedule(any(String.class), eq("Boosters"), - eq("REMINDER"), any(String.class), eq(submission.getInstanceId())); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/MultimediaServiceTest.java b/opensrp-core/src/test/java/org/opensrp/MultimediaServiceTest.java deleted file mode 100644 index 4200817583..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/MultimediaServiceTest.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.opensrp; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.opensrp.domain.Multimedia; -import org.opensrp.dto.form.MultimediaDTO; -import org.opensrp.repository.couch.MultimediaRepositoryImpl; -import org.opensrp.service.ClientService; -import org.opensrp.service.MultimediaService; -import org.opensrp.service.multimedia.BaseMultimediaFileManager; -import org.powermock.reflect.Whitebox; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.web.multipart.MultipartFile; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.MockitoAnnotations.initMocks; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public class MultimediaServiceTest { - - @Autowired - private MultimediaService multimediaService; - - @Mock - private MultimediaRepositoryImpl multimediaRepository; - - @Mock - private ClientService clientService; - - @Autowired - @Qualifier("multimedia_file_manager") - private BaseMultimediaFileManager fileManager; - - @Before - public void setUp() { - initMocks(this); - multimediaService = new MultimediaService(multimediaRepository, clientService); - } - - @Test - public void testGetMultimediaFilesShouldReturnAllClientMultimediaFiles() { - List multimediaFiles = new ArrayList<>(); - multimediaFiles.add(new Multimedia("caseId1", "provideId1", "contentType1", "filePath1", "fileCategory1")); - multimediaFiles.add(new Multimedia("caseId2", "provideId2", "contentType2", "filePath2", "fileCategory2")); - doReturn(multimediaFiles).when(multimediaRepository).get(anyString(), anyString(), anyString()); - List result = multimediaService.getMultimediaFiles("entityId", "contentType", "fileCategory"); - assertEquals(result.size(), 2); - assertEquals(result.get(0).getCaseId(), "caseId1"); - assertEquals(result.get(1).getCaseId(), "caseId2"); - } - - @Test - public void testUploadFileShouldSetCorrectFilePath() { - final String BASE_MULTIMEDIA_DIR_PATH = "baseMultimediaDirPath"; - Whitebox.setInternalState(fileManager, "baseMultimediaDirPath", BASE_MULTIMEDIA_DIR_PATH ); - - MultimediaDTO multimedia = new MultimediaDTO("caseId1", "provideId1", "image/jpeg", "filePath1", "multi_version"); - MultipartFile multipartFile = mock(MultipartFile.class); - doReturn("original_file_name").when(multipartFile).getOriginalFilename(); - fileManager.uploadFile(multimedia, multipartFile); - assertEquals(multimedia.getFilePath(), BASE_MULTIMEDIA_DIR_PATH + "/patient_images/caseId1/original_file_name"); - - multimedia = new MultimediaDTO("caseId1", "provideId1", "image/jpeg", "filePath1", "profileimage"); - fileManager.uploadFile(multimedia, mock(MultipartFile.class)); - assertEquals(multimedia.getFilePath(), BASE_MULTIMEDIA_DIR_PATH + "/patient_images/caseId1.jpg"); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/SpringApplicationContextProvider.java b/opensrp-core/src/test/java/org/opensrp/SpringApplicationContextProvider.java deleted file mode 100644 index 6d57159a3b..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/SpringApplicationContextProvider.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opensrp; - -import org.junit.runner.RunWith; -import org.opensrp.util.TestResourceLoader; -import org.springframework.context.ApplicationContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public class SpringApplicationContextProvider extends TestResourceLoader { - - public static ApplicationContext context; - - public static ApplicationContext getContext() { - return context; - } - - public static void setContext(ApplicationContext context) { - SpringApplicationContextProvider.context = context; - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/AddressTest.java b/opensrp-core/src/test/java/org/opensrp/domain/AddressTest.java deleted file mode 100644 index 2e05ee474c..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/AddressTest.java +++ /dev/null @@ -1,159 +0,0 @@ -package org.opensrp.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import org.joda.time.DateTime; -import org.junit.Test; -import org.opensrp.common.AddressField; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -public class AddressTest { - - @Test - public void testEqualAndHashCode() { - EqualsVerifier.forClass(Address.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(Address.class)); - } - - @Test - public void testSetAndGetAddressField() { - Address address = new Address(); - address.withAddressFields(null); - assertNull(address.getAddressFields()); - - address.withAddressField("field", "val"); - assertEquals("val", address.getAddressField("field")); - assertNull(address.getAddressField("ddd")); - - address.withAddressFields(null); - assertNull(address.getAddressFields()); - - address.withAddressField(AddressField.AREA, "val"); - assertEquals("val", address.getAddressField(AddressField.AREA)); - assertNull(address.getAddressField(AddressField.HOUSE_NUMBER)); - - address.withAddressFields(null); - assertNull(address.getAddressFields()); - - } - - @Test - public void testAddAndRemoveAddressField() { - Address address = new Address(); - address.withAddressFields(null); - assertNull(address.getAddressFields()); - - address.addAddressField("field", "val"); - address.addAddressField(AddressField.AREA, "val"); - assertEquals(2, address.getAddressFields().size()); - assertEquals("val", address.getAddressField("field")); - assertEquals("val", address.getAddressField(AddressField.AREA)); - - address.removeAddressField("ddd"); - address.removeAddressField(AddressField.HOUSE_NUMBER); - assertEquals(2, address.getAddressFields().size()); - assertEquals("val", address.getAddressField("field")); - assertEquals("val", address.getAddressField(AddressField.AREA)); - - address.removeAddressField("field"); - address.removeAddressField(AddressField.AREA); - assertEquals(0, address.getAddressFields().size()); - assertNull(address.getAddressField("field")); - assertNull(address.getAddressField(AddressField.AREA)); - } - - @Test - public void testGetAddressFieldUsingRegex() { - Address address = new Address(); - address.withAddressFields(null); - assertNull(address.getAddressFields()); - - address.addAddressField(AddressField.AREA, "area"); - address.addAddressField("field", "val"); - - assertNull(address.getAddressFieldMatchingRegex("")); - assertNull(address.getAddressFieldMatchingRegex("^[0-9]+")); - assertEquals("val", address.getAddressFieldMatchingRegex("^field")); - assertNull(address.getAddressFieldMatchingRegex("^TYPE")); - assertEquals("area", address.getAddressFieldMatchingRegex("^AREA")); - assertNull(address.getAddressFieldMatchingRegex("^area")); - assertNull(address.getAddressFieldMatchingRegex("^id")); - - } - - @Test - public void testIsActive() { - Address address = new Address(); - assertTrue(address.isActive()); - - address.withEndDate(new DateTime().plusDays(5)); - assertTrue(address.isActive()); - - address.withEndDate(new DateTime().minusDays(5)); - assertFalse(address.isActive()); - } - - @Test - public void testDurationCalculation() { - Address address = new Address(); - assertEquals(-1, address.durationInDays()); - - address.withStartDate(new DateTime().minusDays(5)); - assertEquals(5, address.durationInDays()); - - address.withStartDate(new DateTime()); - address.withEndDate(new DateTime().plusMonths(2)); - assertEquals(2, address.durationInMonths()); - - address.withEndDate(new DateTime().plusWeeks(2)); - assertEquals(2, address.durationInWeeks()); - - address.withEndDate(new DateTime().plusYears(2)); - assertEquals(2, address.durationInYears()); - } - - @Test - public void testCreatingObject() { - Address address = new Address(); - String latitude = "222"; - String longitude = "22"; - String geopoint = "geopoint"; - String postalCode = "postalCode"; - String town = "town"; - String subDistrict = "sub"; - String countyDistrict = "count"; - String cityVillage = "village"; - String stateProvince = "province"; - String country = "country"; - address.withLatitude(latitude).withLongitude(longitude).withGeopoint(geopoint).withPostalCode(postalCode) - .withTown(town).withSubDistrict(subDistrict).withCountyDistrict(countyDistrict).withCityVillage(cityVillage) - .withStateProvince(stateProvince).withCountry(country); - - assertEquals(latitude, address.getLatitude()); - assertEquals(longitude, address.getLongitude()); - assertEquals(geopoint, address.getGeopoint()); - assertEquals(postalCode, address.getPostalCode()); - assertEquals(town, address.getTown()); - assertEquals(subDistrict, address.getSubDistrict()); - assertEquals(countyDistrict, address.getCountyDistrict()); - assertEquals(cityVillage, address.getCityVillage()); - assertEquals(country, address.getCountry()); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/AppStateTokenTest.java b/opensrp-core/src/test/java/org/opensrp/domain/AppStateTokenTest.java deleted file mode 100644 index b151abdb3b..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/AppStateTokenTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.opensrp.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import org.joda.time.DateTime; -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -public class AppStateTokenTest { - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(AppStateToken.class)); - } - - @Test - public void testEqualAndHashcodeContract() { - EqualsVerifier.forClass(AppStateToken.class).suppress(Warning.NONFINAL_FIELDS).withIgnoredFields("id", "revision") - .withRedefinedSuperclass().verify(); - } - - @Test - public void testValueBasedOnType() { - AppStateToken appStateToken = new AppStateToken("name", "2.3", 3l); - - assertEquals(2.3, appStateToken.doubleValue(), 0); - assertEquals(2.3, appStateToken.floatValue(), 0.2); - assertEquals("2.3", appStateToken.stringValue()); - - appStateToken = new AppStateToken("name", "true", 3l); - assertTrue(appStateToken.booleanValue()); - - appStateToken = new AppStateToken("name", "2", 3l); - assertEquals(2, appStateToken.intValue()); - - appStateToken = new AppStateToken("name", new DateTime(0l).toLocalDate(), 3l); - assertEquals(new DateTime(0l).toLocalDate(), appStateToken.datetimeValue()); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/BaseEntityTest.java b/opensrp-core/src/test/java/org/opensrp/domain/BaseEntityTest.java deleted file mode 100644 index 06cf7bc604..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/BaseEntityTest.java +++ /dev/null @@ -1,180 +0,0 @@ -package org.opensrp.domain; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.HashMap; -import java.util.List; - -import org.joda.time.DateTime; -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -public class BaseEntityTest { - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(BaseEntity.class)); - } - - @Test - public void testEqualAndHashcodeContract() { - EqualsVerifier.forClass(BaseEntity.class).suppress(Warning.NONFINAL_FIELDS).suppress(Warning.STRICT_INHERITANCE) - .withPrefabValues(User.class, new User("dsd"), new User("sdf")).withRedefinedSuperclass().verify(); - } - - @Test - public void testIdentifiers() { - BaseEntity baseEntity = new BaseEntity(); - - baseEntity.withIdentifiers(null); - assertEquals(0, baseEntity.getIdentifiers().size()); - - String type = "type"; - String id = "id"; - baseEntity.withIdentifier(type, id); - assertEquals(1, baseEntity.getIdentifiers().size()); - assertEquals(id, baseEntity.getIdentifier(type)); - - baseEntity.withIdentifiers(null); - baseEntity.addIdentifier(type, id); - assertEquals(1, baseEntity.getIdentifiers().size()); - assertEquals(id, baseEntity.getIdentifier(type)); - - baseEntity.removeIdentifier("eee"); - assertEquals(1, baseEntity.getIdentifiers().size()); - assertEquals(id, baseEntity.getIdentifier(type)); - - baseEntity.removeIdentifier(type); - assertEquals(0, baseEntity.getIdentifiers().size()); - assertNull(baseEntity.getIdentifier(type)); - - } - - @Test - public void testGettingIdentifiersUsingRegex() { - BaseEntity baseEntity = new BaseEntity(); - - baseEntity.withIdentifiers(null); - baseEntity.addIdentifier("type", "id"); - assertEquals(1, baseEntity.getIdentifiers().size()); - assertEquals("id", baseEntity.getIdentifier("type")); - - assertNull(baseEntity.getIdentifierMatchingRegex("")); - assertEquals("id", baseEntity.getIdentifierMatchingRegex("^[a-zA-Z]+")); - assertNull(baseEntity.getIdentifierMatchingRegex("^[0-9]+")); - assertEquals("id", baseEntity.getIdentifierMatchingRegex("^type")); - assertNull(baseEntity.getIdentifierMatchingRegex("^id")); - } - - @Test - public void testAttributes() { - BaseEntity baseEntity = new BaseEntity(); - - baseEntity.withAttributes(null); - - assertEquals(0, baseEntity.getAttributes().size()); - - baseEntity.withAttribute("type", "id"); - assertEquals(1, baseEntity.getAttributes().size()); - assertEquals("id", baseEntity.getAttribute("type")); - - baseEntity.removeAttribute("type"); - assertEquals(0, baseEntity.getAttributes().size()); - assertNull(baseEntity.getAttribute("type")); - - baseEntity.withAttributes(null); - baseEntity.addAttribute("type", "id"); - assertEquals(1, baseEntity.getAttributes().size()); - assertEquals("id", baseEntity.getAttribute("type")); - - } - - @Test - public void testSuperObjectCreation() { - BaseEntity baseEntity = new BaseEntity(); - - DateTime dateCreated = new DateTime(0l); - DateTime dateEdited = new DateTime(1l); - DateTime dateVoided = new DateTime(3l); - User editor = new User("dd"); - String voidReason = "void"; - User creator = new User("ee"); - User voider = new User("klj"); - baseEntity.withCreator(creator).withDateCreated(dateCreated).withDateEdited(dateEdited).withDateVoided(dateVoided) - .withEditor(editor).withVoided(true).withVoidReason(voidReason).withVoider(voider); - - assertEquals(creator, baseEntity.getCreator()); - assertEquals(editor, baseEntity.getEditor()); - assertEquals(voider, baseEntity.getVoider()); - assertEquals(dateCreated, baseEntity.getDateCreated()); - assertEquals(dateEdited, baseEntity.getDateEdited()); - assertEquals(dateVoided, baseEntity.getDateVoided()); - assertEquals(voidReason, baseEntity.getVoidReason()); - assertTrue(baseEntity.getVoided()); - - baseEntity = new BaseEntity(); - baseEntity.setCreator(creator); - baseEntity.setEditor(editor); - baseEntity.setVoider(voider); - baseEntity.setDateCreated(dateCreated); - baseEntity.setDateEdited(dateEdited); - baseEntity.setDateVoided(dateVoided); - baseEntity.setVoided(false); - baseEntity.setVoidReason(voidReason); - - assertEquals(creator, baseEntity.getCreator()); - assertEquals(editor, baseEntity.getEditor()); - assertEquals(voider, baseEntity.getVoider()); - assertEquals(dateCreated, baseEntity.getDateCreated()); - assertEquals(dateEdited, baseEntity.getDateEdited()); - assertEquals(dateVoided, baseEntity.getDateVoided()); - assertEquals(voidReason, baseEntity.getVoidReason()); - assertFalse(baseEntity.getVoided()); - } - - @Test - public void testConstructor() { - BaseEntity baseEntity; - HashMap identifiers = new HashMap<>(); - identifiers.put("k", "l"); - HashMap attribues = new HashMap<>(); - attribues.put("l", "k"); - Address address = new Address().withCountry("country").withAddressType("type"); - List
addressList = asList(address); - - baseEntity = new BaseEntity("dd", identifiers); - assertEquals("dd", baseEntity.getBaseEntityId()); - assertEquals(identifiers, baseEntity.getIdentifiers()); - - baseEntity = new BaseEntity("dd", identifiers, attribues); - assertEquals("dd", baseEntity.getBaseEntityId()); - assertEquals(identifiers, baseEntity.getIdentifiers()); - assertEquals(attribues, baseEntity.getAttributes()); - - baseEntity = new BaseEntity("dd", identifiers, attribues, addressList); - assertEquals("dd", baseEntity.getBaseEntityId()); - assertEquals(identifiers, baseEntity.getIdentifiers()); - assertEquals(attribues, baseEntity.getAttributes()); - assertEquals(addressList, baseEntity.getAddresses()); - assertEquals(address, baseEntity.getAddress("type")); - - baseEntity = new BaseEntity().withBaseEntityId("dd"); - assertEquals("dd", baseEntity.getBaseEntityId()); - assertEquals(null, baseEntity.getAddress("type")); - - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/CampaignTest.java b/opensrp-core/src/test/java/org/opensrp/domain/CampaignTest.java deleted file mode 100644 index d32a6fcf41..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/CampaignTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.opensrp.domain; - -import static org.junit.Assert.assertEquals; - -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; -import org.junit.Test; -import org.opensrp.domain.Task.TaskStatus; -import org.opensrp.util.DateTypeConverter; -import org.opensrp.util.TaskDateTimeTypeConverter; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public class CampaignTest { - - private static Gson gson = new GsonBuilder().registerTypeAdapter(DateTime.class, new TaskDateTimeTypeConverter()) - .registerTypeAdapter(LocalDate.class, new DateTypeConverter()) - .serializeNulls().create(); - - protected static DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HHmm"); - - private String campaignJson = "{\"identifier\":\"IRS_2018_S1\",\"title\":\"2019 IRS Season 1\",\"description\":\"This is the 2010 IRS Spray Campaign for Zambia for the first spray season dated 1 Jan 2019 - 31 Mar 2019.\",\"status\":\"In Progress\",\"executionPeriod\":{\"start\":\"2019-01-01\",\"end\":\"2019-03-31\"},\"authoredOn\":\"2018-10-01T0900\",\"lastModified\":\"2018-10-01T0900\",\"owner\":\"jdoe\",\"serverVersion\":0}"; - - @Test - public void testDeserialize() { - Campaign campaign = gson.fromJson(campaignJson, Campaign.class); - assertEquals("IRS_2018_S1", campaign.getIdentifier()); - assertEquals("2019 IRS Season 1", campaign.getTitle()); - assertEquals( - "This is the 2010 IRS Spray Campaign for Zambia for the first spray season dated 1 Jan 2019 - 31 Mar 2019.", - campaign.getDescription()); - assertEquals("2019 IRS Season 1", campaign.getTitle()); - assertEquals("2019-01-01", campaign.getExecutionPeriod().getStart().toString("yyyy-MM-dd")); - assertEquals("2019-03-31", campaign.getExecutionPeriod().getEnd().toString("yyyy-MM-dd")); - assertEquals(TaskStatus.IN_PROGRESS, campaign.getStatus()); - assertEquals("2018-10-01T0900", campaign.getAuthoredOn().toString(formatter)); - assertEquals("2018-10-01T0900", campaign.getLastModified().toString(formatter)); - assertEquals("jdoe", campaign.getOwner()); - - } - - @Test - public void testSerialize() { - Campaign campaign = gson.fromJson(campaignJson, Campaign.class); - assertEquals(campaignJson, gson.toJson(campaign)); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/ClientTest.java b/opensrp-core/src/test/java/org/opensrp/domain/ClientTest.java deleted file mode 100644 index 8797d68a2a..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/ClientTest.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.opensrp.domain; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import java.util.HashSet; -import java.util.List; - -import org.joda.time.DateTime; -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -public class ClientTest { - - @Test - public void testEqualAndHashcodeContract() { - EqualsVerifier.forClass(Client.class).withIgnoredFields("id", "revision").suppress(Warning.NONFINAL_FIELDS) - .withPrefabValues(User.class, new User("ll"), new User("e")).withRedefinedSuperclass().verify(); - } - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(Client.class)); - } - - @Test - public void testSetAndGetRelationship() { - Client client = new Client(); - client.withRelationships(null); - - assertNull(client.getRelationships()); - assertNull(client.findRelatives("dd")); - assertEquals(0, client.getRelationships("d").size()); - - client.withRelationships(null); - client.addRelationship("type", "r"); - client.addRelationship("type", "e"); - client.addRelationship("type1", "r"); - - List expectedRelationships = asList("type1", "type"); - List expectedIds = asList("r", "e"); - assertEquals(2, client.getRelationships().size()); - assertEquals(new HashSet<>(expectedRelationships), new HashSet<>(client.getRelationships("r"))); - assertEquals(new HashSet<>(expectedIds), new HashSet<>(client.findRelatives("type"))); - assertEquals(0, client.getRelationships("d").size()); - - } - - @Test - public void testConstructor() { - String baseEntityId = "id"; - String firstName = "first"; - String middleName = "middleName"; - String lastName = "lastName"; - DateTime birthDate = new DateTime(0l); - boolean birthDateApprx = true; - DateTime deathDate = new DateTime(1l); - boolean deathDateApprox = false; - String gender = "male"; - String type = "type"; - String identifier = "identifier"; - - Client client = new Client(baseEntityId, firstName, middleName, lastName, birthDate, deathDate, birthDateApprx, - deathDateApprox, gender, type, identifier); - - assertEquals(firstName, client.getFirstName()); - assertEquals(middleName, client.getMiddleName()); - assertEquals(lastName, client.getLastName()); - assertEquals(birthDate, client.getBirthdate()); - assertEquals(birthDateApprx, client.getBirthdateApprox()); - assertEquals(deathDate, client.getDeathdate()); - assertEquals(deathDateApprox, client.getDeathdateApprox()); - assertEquals(identifier, client.getIdentifier(type)); - assertEquals(gender, client.getGender()); - - client = new Client(baseEntityId, firstName, middleName, lastName, birthDate, deathDate, birthDateApprx, - deathDateApprox, gender); - assertEquals(firstName, client.getFirstName()); - assertEquals(middleName, client.getMiddleName()); - assertEquals(lastName, client.getLastName()); - assertEquals(birthDate, client.getBirthdate()); - assertEquals(birthDateApprx, client.getBirthdateApprox()); - assertEquals(deathDate, client.getDeathdate()); - assertEquals(deathDateApprox, client.getDeathdateApprox()); - assertNull(client.getIdentifier(type)); - assertEquals(gender, client.getGender()); - } - - @Test - public void testFullName() { - Client client = new Client("ss").withFirstName("first").withMiddleName("middle").withLastName("last"); - assertEquals("first middle last", client.fullName()); - - client = new Client("dd").withName("first", "middle", null); - assertEquals("first middle", client.fullName()); - - client = new Client("dd").withName("first", null, "last"); - assertEquals("first last", client.fullName()); - - client = new Client("dd").withName("first", null, null); - assertEquals("first", client.fullName()); - - client = new Client("dd").withName(null, "middle", null); - assertEquals("middle", client.fullName()); - - client = new Client("dd").withName(null, "middle", "last"); - assertEquals("middle last", client.fullName()); - - client = new Client("dd").withName(null, null, "last"); - assertEquals("last", client.fullName()); - - client = new Client("dd").withName(null, null, null); - assertEquals("", client.fullName()); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/ContactPointTest.java b/opensrp-core/src/test/java/org/opensrp/domain/ContactPointTest.java deleted file mode 100644 index 401e41096c..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/ContactPointTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.opensrp.domain; - -import static org.junit.Assert.assertEquals; - -import org.joda.time.DateTime; -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.affirm.Affirm; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class ContactPointTest { - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(ContactPoint.class)); - } - - @Test - public void testConstructor() { - final Class clazz = ContactPoint.class; - final Object obj1 = FormTest.getInstance(clazz, "type", "use", "number", 0, new DateTime(0l), new DateTime(1l)); - Affirm.affirmNotNull("Should have created an object", obj1); - ContactPoint contactPoint = (ContactPoint) obj1; - assertEquals("type", contactPoint.getType()); - assertEquals("use", contactPoint.getUse()); - assertEquals("number", contactPoint.getNumber()); - assertEquals(0, contactPoint.getPreference()); - assertEquals(new DateTime(0l), contactPoint.getStartDate()); - assertEquals(new DateTime(1l), contactPoint.getEndDate()); - - final Object obj2 = FormTest.getInstance(clazz, new Object[] {}); - Affirm.affirmTrue("Should have created a different object", obj1 != obj2); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/ErrorTraceFormTest.java b/opensrp-core/src/test/java/org/opensrp/domain/ErrorTraceFormTest.java deleted file mode 100644 index 5b111aeb77..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/ErrorTraceFormTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.opensrp.domain; - -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class ErrorTraceFormTest { - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(ErrorTraceForm.class)); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/ErrorTraceTest.java b/opensrp-core/src/test/java/org/opensrp/domain/ErrorTraceTest.java deleted file mode 100644 index be9e1d6515..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/ErrorTraceTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.opensrp.domain; - -import static org.junit.Assert.assertEquals; - -import org.joda.time.DateTime; -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.affirm.Affirm; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class ErrorTraceTest { - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(ErrorTrace.class)); - } - - @Test - public void testConstructor() { - final Class clazz = ErrorTrace.class; - String document = "document"; - String status = "status"; - String stackTrace = "stactTrace"; - String occurredAt = "occuredAt"; - String errorType = "errorType"; - DateTime dateTime = new DateTime(0l); - - final Object obj1 = FormTest.getInstance(clazz, dateTime, errorType, occurredAt, stackTrace, status, document); - Affirm.affirmNotNull("Should have created an object", obj1); - - ErrorTrace errorTrace = (ErrorTrace) obj1; - assertEquals(dateTime, errorTrace.getDate()); - assertEquals(status, errorTrace.getStatus()); - assertEquals(errorType, errorTrace.getErrorType()); - assertEquals(document, errorTrace.getDocumentType()); - assertEquals(stackTrace, errorTrace.getStackTrace()); - assertEquals(occurredAt, errorTrace.getOccurredAt()); - - String recordId = "recordId"; - String name = "name"; - final Object obj2 = FormTest.getInstance(clazz, recordId, dateTime, name, occurredAt, stackTrace, status); - errorTrace = (ErrorTrace) obj2; - assertEquals(dateTime, errorTrace.getDate()); - assertEquals(status, errorTrace.getStatus()); - assertEquals(recordId, errorTrace.getRecordId()); - assertEquals(name, errorTrace.getErrorType()); - assertEquals(stackTrace, errorTrace.getStackTrace()); - assertEquals(occurredAt, errorTrace.getOccurredAt()); - - Affirm.affirmTrue("Should have created a different object", obj1 != obj2); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/EventTest.java b/opensrp-core/src/test/java/org/opensrp/domain/EventTest.java deleted file mode 100644 index c6bdad541b..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/EventTest.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.opensrp.domain; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - -import org.joda.time.DateTime; -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -public class EventTest { - - @Test - public void testEqualAndHashcodeContract() { - EqualsVerifier.forClass(Event.class).withIgnoredFields("id", "revision").suppress(Warning.NONFINAL_FIELDS) - .withPrefabValues(User.class, new User("ll"), new User("e")).withRedefinedSuperclass().verify(); - } - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(Event.class)); - } - - @Test - public void testObs() { - Event event = new Event(); - event.setObs(null); - assertEquals(0, event.getObs().size()); - - event.setObs(null); - event.withObs(new Obs()); - assertEquals(1, event.getObs().size()); - assertNull(event.getObs("p", "c")); - - Obs obs = new Obs().withFieldCode("concept"); - event.setObs(null); - event.withObs(asList(obs)); - assertEquals(1, event.getObs().size()); - assertEquals(obs, event.getObs("", "concept")); - assertNull(event.getObs("p", "concept")); - - obs = new Obs().withFieldCode("concept"); - obs.withParentCode("p"); - event.setObs(null); - event.withObs(obs); - assertEquals(1, event.getObs().size()); - assertEquals(obs, event.getObs("p", "concept")); - assertEquals(obs, event.getObs("", "concept")); - assertNull(event.getObs("p", "con")); - } - - @Test - public void testIdentifiers() { - Event event = new Event(); - event.withIdentifiers(null); - assertEquals(0, event.getIdentifiers().size()); - assertNull(event.getIdentifier("dd")); - - event.withIdentifiers(null); - event.withIdentifier("type", "id"); - assertEquals(1, event.getIdentifiers().size()); - assertNull(event.getIdentifier("dd")); - assertEquals("id", event.getIdentifier("type")); - - event.removeIdentifier("dd"); - assertEquals(1, event.getIdentifiers().size()); - assertNull(event.getIdentifier("dd")); - assertEquals("id", event.getIdentifier("type")); - - event.removeIdentifier("type"); - assertEquals(0, event.getIdentifiers().size()); - assertNull(event.getIdentifier("type")); - - event.withIdentifiers(null); - event.addIdentifier("type", "id"); - assertEquals(1, event.getIdentifiers().size()); - assertEquals("id", event.getIdentifier("type")); - } - - @Test - public void testGettingIdentifiersUsingRegex() { - Event event = new Event(); - event.withIdentifiers(null); - event.addIdentifier("type", "id"); - assertEquals(1, event.getIdentifiers().size()); - assertEquals("id", event.getIdentifier("type")); - - assertNull(event.getIdentifierMatchingRegex("")); - assertEquals("id", event.getIdentifierMatchingRegex("^[a-zA-Z]+")); - assertNull(event.getIdentifierMatchingRegex("^[0-9]+")); - assertEquals("id", event.getIdentifierMatchingRegex("^type")); - assertNull(event.getIdentifierMatchingRegex("^id")); - } - - @Test - public void testAddingDetails() { - Event event = new Event(); - event.setDetails(null); - event.addDetails("key", "val"); - assertEquals(1, event.getDetails().size()); - assertEquals("val", event.getDetails().get("key")); - - } - - @Test - public void testConstructor() { - Event event = new Event("baseEntityId", "eventType", new DateTime(), "entityType", "providerId", - "locationId", "formSubmissionId", "teamId", "team", "childLocationId", - 1, 1); - assertEquals(event.getChildLocationId(), "childLocationId"); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/FormDefinitionTest.java b/opensrp-core/src/test/java/org/opensrp/domain/FormDefinitionTest.java deleted file mode 100644 index d124b63913..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/FormDefinitionTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.opensrp.domain; - -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class FormDefinitionTest { - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(FormDefinition.class)); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/FormFieldTest.java b/opensrp-core/src/test/java/org/opensrp/domain/FormFieldTest.java deleted file mode 100644 index 0d096a0a59..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/FormFieldTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.opensrp.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.affirm.Affirm; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class FormFieldTest { - - @Test - @SuppressWarnings("RedundantArrayCreation") - public void shouldCreateUsingDefaultConstructor() { - final Class clazz = FormField.class; - final Object obj1 = FormTest.getInstance(clazz, (Object[]) null); - Affirm.affirmNotNull("Should have created an object", obj1); - - final Object obj2 = FormTest.getInstance(clazz, new Object[] {}); - Affirm.affirmTrue("Should have created a different object", obj1 != obj2); - } - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(FormField.class)); - } - - @Test - public void testConstructorWithParameter() { - final Class clazz = FormField.class; - final Object obj1 = FormTest.getInstance(clazz, "bind", "bind_path"); - FormField formField = (FormField) obj1; - Affirm.affirmNotNull("Should have created an object", obj1); - assertEquals("bind", formField.name()); - assertEquals("bind_path", formField.bind()); - - final Object obj2 = FormTest.getInstance(clazz, new Object[] {}); - Affirm.affirmTrue("Should have created a different object", obj1 != obj2); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/FormTest.java b/opensrp-core/src/test/java/org/opensrp/domain/FormTest.java deleted file mode 100644 index 7c61d766b7..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/FormTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.opensrp.domain; - -import static java.util.Arrays.asList; - -import org.junit.Test; - -import com.openpojo.reflection.PojoClass; -import com.openpojo.reflection.construct.InstanceFactory; -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.affirm.Affirm; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class FormTest { - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(Form.class)); - } - - @Test - public void testConstructor() { - final Class clazz = Form.class; - final Object obj1 = getInstance(clazz, "bind", "bind_path", asList(new FormField()), - asList(new SubFormDefinition())); - Affirm.affirmNotNull("Should have created an object", obj1); - - final Object obj2 = getInstance(clazz, new Object[] {}); - Affirm.affirmTrue("Should have created a different object", obj1 != obj2); - } - - public static Object getInstance(final Class clazz, final Object... parameters) { - final PojoClass pojoClass = PojoClassFactory.getPojoClass(clazz); - return InstanceFactory.getInstance(pojoClass, parameters); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/MultimediaTest.java b/opensrp-core/src/test/java/org/opensrp/domain/MultimediaTest.java deleted file mode 100644 index bf1be80437..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/MultimediaTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.opensrp.domain; - -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -public class MultimediaTest { - - @Test - public void testEqualAndHashcodeContract() { - EqualsVerifier.forClass(Multimedia.class).withIgnoredFields("id", "revision").suppress(Warning.NONFINAL_FIELDS) - .withRedefinedSuperclass().verify(); - } - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(Multimedia.class)); - } - - @Test - public void testConstructor() { - String fileCategory = "fileCategory"; - String filePath = "filePath"; - String contentType = "contentType"; - String providerId = "providerId"; - String caseId = "caseId"; - - Multimedia multimedia = new Multimedia(caseId, providerId, contentType, filePath, fileCategory); - - Multimedia multimedia1 = new Multimedia().withCaseId(caseId).withProviderId(providerId).withContentType(contentType) - .withFilePath(filePath).withFileCategory(fileCategory); - - assertTrue(multimedia.equals(multimedia1)); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/ObsTest.java b/opensrp-core/src/test/java/org/opensrp/domain/ObsTest.java deleted file mode 100644 index c59c45360f..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/ObsTest.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.opensrp.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import java.util.ArrayList; -import java.util.List; - -import org.joda.time.DateTime; -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -public class ObsTest { - - @Test - public void testEqualAndHashcodeContract() { - EqualsVerifier.forClass(Obs.class).suppress(Warning.NONFINAL_FIELDS).withIgnoredFields("set").verify(); - } - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(Obs.class)); - } - - @Test(expected = RuntimeException.class) - public void shouldThrowExceptionIfMultipleValuesFound() { - List values = new ArrayList<>(); - values.add("dd"); - values.add("d"); - Obs obs = new Obs().withValues(values); - - obs.getValue(); - } - - @Test - public void testGettingSingleValue() { - Obs obs = new Obs().withValues(null); - assertNull(obs.getValue()); - - obs.setValue("d"); - assertEquals("d", obs.getValue()); - - } - - @Test - public void testAddToValueList() { - Obs obs = new Obs().withValues(null); - obs = obs.addToValueList(null); - - assertNull(obs.getValues()); - - List values = new ArrayList<>(); - values.add("dd"); - obs = obs.addToValueList(values); - - assertEquals(1, obs.getValues().size()); - assertEquals("dd", obs.getValue()); - } - - @Test - public void shouldDeleteExistingValueWileAddingNewOne() { - List values = new ArrayList<>(); - values.add("dd"); - values.add("d"); - Obs obs = new Obs().withValues(values); - - obs.addToValueList("dd"); - - assertEquals(1, obs.getValues().size()); - assertEquals("dd", obs.getValue()); - } - - @Test - public void testCreatingObject() { - List values = new ArrayList<>(); - values.add("dd"); - String fieldType = "fieldType"; - String dataType = "dataType"; - String fieldCode = "fieldCode"; - String parentCode = "parentCode"; - String value = "sd"; - String comment = "comment"; - String formSubmission = "formSubmission"; - - Obs obs = new Obs().withFieldType(fieldType).withFieldDataType(dataType).withFieldCode(fieldCode) - .withParentCode(parentCode).withValue(value).withComments(comment).withFormSubmissionField(formSubmission) - .withEffectiveDatetime(new DateTime(0l)).withHumanReadableValues(values); - - assertEquals(fieldType, obs.getFieldType()); - assertEquals(fieldCode, obs.getFieldCode()); - assertEquals(dataType, obs.getFieldDataType()); - assertEquals(parentCode, obs.getParentCode()); - assertEquals(value, obs.getValue()); - assertEquals(comment, obs.getComments()); - assertEquals(formSubmission, obs.getFormSubmissionField()); - assertEquals(new DateTime(0l), obs.getEffectiveDatetime()); - assertEquals(values, obs.getHumanReadableValues()); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/PhotoTest.java b/opensrp-core/src/test/java/org/opensrp/domain/PhotoTest.java deleted file mode 100644 index 27246a590b..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/PhotoTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.opensrp.domain; - -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class PhotoTest { - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(Photo.class)); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/PhysicalLocationTest.java b/opensrp-core/src/test/java/org/opensrp/domain/PhysicalLocationTest.java deleted file mode 100644 index 082d27b0af..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/PhysicalLocationTest.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.opensrp.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; - -import java.text.ParseException; -import java.text.SimpleDateFormat; - -import org.junit.Test; -import org.opensrp.domain.Geometry.GeometryType; -import org.opensrp.domain.LocationProperty.PropertyStatus; -import org.opensrp.util.PropertiesConverter; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; - -public class PhysicalLocationTest { - public static Gson gson = new GsonBuilder().registerTypeAdapter(LocationProperty.class, new PropertiesConverter()) - .setDateFormat("yyyy-MM-dd'T'HHmm").create(); - - public static String structureJson = "{\"type\":\"Feature\",\"id\":\"90397\",\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[32.5978597,-14.1699446],[32.5978956,-14.1699609],[32.5978794,-14.1699947],[32.5978434,-14.1699784],[32.5978597,-14.1699446]]]},\"properties\":{\"uid\":\"41587456-b7c8-4c4e-b433-23a786f742fc\",\"code\":\"21384443\",\"type\":\"Residential Structure\",\"status\":\"Active\",\"parentId\":\"3734\",\"geographicLevel\":5,\"effectiveStartDate\":\"2017-01-10T0000\",\"version\":0}}"; - - public static String parentJson = "{\"type\":\"Feature\",\"id\":\"3734\",\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[32.59989007736522,-14.167432040756012],[32.599899215376524,-14.167521429770147],[32.59990104639621,-14.167611244163538],[32.599895558733124,-14.16770091736339],[32.59989008366051,-14.167739053114758],[32.59993602462787,-14.16775581827636],[32.600019423257834,-14.167793873088726],[32.60009945932262,-14.167838272618155],[32.60017562650404,-14.167888735376776],[32.60024744456398,-14.16794494480331],[32.60031445844555,-14.168006542967532],[32.60037624546743,-14.168073141362354],[32.60043241352514,-14.168144319105009],[32.6004826082858,-14.168219626534494],[32.60052651318807,-14.168298587010156],[32.60056384854283,-14.168380700508862],[32.60059438052627,-14.168465449920518],[32.600617914884936,-14.168552297450503],[32.60062693688366,-14.16860096246438],[32.600629671722004,-14.168608553641775],[32.600653206080665,-14.16869540117176],[32.60066959442628,-14.168783799132996],[32.600678733336906,-14.168873188147074],[32.60068056435659,-14.168963002540465],[32.600675075794186,-14.169052674840998],[32.60066230362247,-14.169141638475764],[32.60064232698187,-14.169229331368513],[32.60061527357607,-14.169315197738115],[32.60058131337695,-14.169398695293522],[32.6005406613225,-14.169479297031899],[32.60049357461884,-14.169556492138383],[32.600440351840795,-14.169629793180375],[32.60038132753629,-14.169698736107762],[32.60031687672256,-14.169762885648595],[32.60024740499381,-14.169821836208712],[32.60017335391722,-14.169875214569458],[32.600095189341566,-14.169922684384344],[32.600073628095515,-14.169933562583822],[32.60007671007219,-14.169963706060116],[32.600078541091875,-14.170053520453562],[32.60007305252941,-14.170143193653415],[32.600060280357695,-14.170232157288183],[32.600040303717094,-14.170319849281555],[32.60001324941197,-14.170405715651212],[32.599979289212854,-14.170489214105885],[32.59993897080693,-14.170569153943234],[32.599943946755786,-14.170617831547645],[32.599945777775474,-14.170707646840356],[32.59994028921301,-14.170797319140943],[32.59992751704135,-14.170886282775712],[32.59990754040069,-14.170973974769083],[32.59988048609562,-14.171059841138685],[32.5998465258965,-14.171143339593414],[32.59980587384205,-14.17122394043247],[32.59975878713834,-14.171301135538954],[32.59970556346104,-14.171374436580948],[32.59964653915648,-14.171443379508332],[32.59958208744342,-14.171507529049165],[32.59951261571467,-14.171566479609282],[32.59943856373877,-14.171619858869349],[32.59936039916312,-14.171667327784915],[32.599278615715605,-14.17170858778104],[32.59919373140565,-14.17174337715511],[32.599106283128485,-14.171771477371749],[32.59901682216866,-14.171792708566613],[32.59892591599828,-14.171806937640042],[32.5988341383848,-14.171814074659776],[32.59874206939105,-14.171814074659776],[32.598650291777574,-14.171806937640042],[32.59855938470787,-14.171792708566613],[32.59846992464736,-14.171771477371749],[32.59838247547094,-14.17174337715511],[32.5983273353383,-14.17172077809141],[32.59831050992216,-14.17173505572822],[32.59823645704688,-14.17178843408891],[32.59815829247128,-14.171835903903796],[32.59807650992303,-14.171877163899921],[32.597991625613076,-14.17191195327399],[32.59790417643665,-14.17194005259131],[32.597814715476765,-14.171961283786173],[32.59772380930639,-14.171975513758923],[32.59763203169297,-14.171982650778657],[32.59753996269916,-14.171982650778657],[32.59744818508574,-14.171975513758923],[32.597357278016034,-14.171961283786173],[32.59726781795547,-14.17194005259131],[32.59718036877905,-14.17191195327399],[32.597125046084045,-14.171889279566528],[32.59711651511515,-14.171899244054828],[32.59705206340203,-14.171963393595718],[32.59698259167334,-14.172022344155835],[32.59690853879806,-14.172075722516524],[32.59683037422246,-14.172123192331412],[32.596748590774894,-14.172164452327593],[32.596669124880236,-14.172197021275451],[32.59666535402294,-14.172199310949395],[32.596583571474696,-14.172240570945519],[32.59649868716474,-14.172275360319588],[32.59641123798832,-14.172303459636908],[32.596321777028436,-14.172324691731092],[32.59623087085805,-14.172338920804519],[32.59613909234531,-14.172346057824257],[32.5960470233515,-14.172346057824257],[32.595955245738025,-14.172338920804519],[32.59586433866832,-14.172324691731092],[32.595803283694636,-14.172310200954938],[32.59573533092083,-14.172367862786585],[32.59566127804561,-14.172421241147333],[32.59558311346996,-14.172468710062901],[32.59551500691208,-14.172503069560946],[32.59545514174147,-14.172546221730727],[32.59537697626649,-14.172593691545558],[32.59529519371824,-14.172634951541738],[32.59521030850897,-14.17266974091575],[32.59512285933255,-14.17269784023307],[32.59503339927198,-14.172719072327254],[32.59494249220228,-14.172733301400683],[32.59485071368954,-14.172740438420476],[32.59475864469573,-14.172740438420476],[32.59466686618299,-14.172733301400683],[32.594575960012605,-14.172719072327254],[32.59448649905272,-14.17269784023307],[32.59445585105675,-14.172687992656677],[32.59442677507565,-14.172690253552332],[32.59433470518257,-14.172690253552332],[32.5942429275691,-14.17268311653254],[32.59415202049939,-14.172668887459167],[32.594062559539566,-14.172647656264303],[32.59397511036309,-14.172619556946927],[32.593890226053134,-14.172584766673594],[32.59380844260562,-14.17254350667747],[32.593730278029966,-14.172496037761903],[32.593656225154746,-14.172442658501836],[32.593586753425996,-14.17238370794172],[32.593567544806376,-14.172364589254355],[32.59351203505241,-14.172317486362884],[32.593447582440035,-14.172253336821994],[32.59338855813547,-14.17218439389461],[32.593335334458175,-14.172111092852617],[32.59328824685514,-14.172033897746132],[32.59324759480069,-14.171953296907077],[32.593213634601625,-14.171869799351725],[32.5931865802965,-14.171783932082747],[32.5931666036559,-14.171696240089375],[32.59315383148419,-14.171607276454608],[32.59314834292172,-14.171517604154076],[32.5931501739414,-14.171427788861308],[32.59315931285203,-14.17133840074655],[32.59317570119771,-14.17125000278537],[32.59319923555631,-14.171163155255385],[32.59322976753981,-14.17107840584373],[32.593267104693155,-14.170996292344967],[32.59331100869616,-14.170917331869305],[32.59336120435614,-14.170842024439821],[32.59341737331317,-14.170770846697167],[32.59347916123437,-14.170704248302341],[32.59354617601525,-14.17064265013812],[32.593617994075196,-14.170586440711643],[32.593694163055204,-14.170535977952964],[32.59377420001937,-14.170491578423535],[32.593857599548635,-14.170453523611172],[32.59394383374098,-14.170422054534129],[32.594032357607254,-14.170397369942634],[32.594122611769194,-14.170379625419342],[32.594214026056534,-14.170368934278827],[32.5943060213059,-14.170365362171708],[32.59439801655525,-14.170368934278827],[32.594402085987554,-14.170369410020214],[32.59439156302028,-14.170336010998085],[32.594371587279,-14.170248319004656],[32.594358814207965,-14.17015935536989],[32.59435618369099,-14.170116383963887],[32.594347703084054,-14.170089466355762],[32.59432772734277,-14.170001773463014],[32.594314954271795,-14.169912809828245],[32.59430946660865,-14.169823137527715],[32.59431129672901,-14.169733323134324],[32.594320435639645,-14.169643934120245],[32.594336823985316,-14.16955553615901],[32.59436035834392,-14.169468688629022],[32.59439089032736,-14.169383940116688],[32.59442822658144,-14.16930182571866],[32.59447213148371,-14.169222865243],[32.59452232624443,-14.169147557813517],[32.59457849520146,-14.169076380070862],[32.59464028132396,-14.169009781676039],[32.5947072961049,-14.168948183511816],[32.59477911416485,-14.168891974984604],[32.59485528224553,-14.168841511326661],[32.59493531831032,-14.168797111797232],[32.595018716940274,-14.168759056984868],[32.59510495113261,-14.168727587907824],[32.595193474099574,-14.168702903316273],[32.5952837282615,-14.168685158792982],[32.59537514075021,-14.168674467652522],[32.59545842696491,-14.168671234589736],[32.5954623282239,-14.168656837343121],[32.5954928602074,-14.168572088830786],[32.595530195562105,-14.168489974432703],[32.59557410046443,-14.168411013957098],[32.595624295225086,-14.168335707426932],[32.595680463282804,-14.168264529684278],[32.59574225030468,-14.168197930390136],[32.595809264186244,-14.168136332225913],[32.59588108224619,-14.1680801236987],[32.59595725032687,-14.168029660040759],[32.596033266422175,-14.16798749083],[32.59606430112666,-14.167931676205853],[32.59611449588732,-14.16785636877637],[32.59617066394503,-14.167785191033715],[32.59623245006759,-14.167718592638892],[32.59629946394915,-14.167656993575347],[32.596371282009095,-14.167600785048137],[32.596447450089784,-14.167550322289514],[32.59652748525531,-14.167505922760085],[32.59661088388526,-14.167467867947721],[32.59669711717828,-14.167436398870677],[32.59678564014524,-14.167411714279126],[32.59687589340779,-14.167393969755835],[32.5969673058965,-14.167383278615375],[32.59705930024654,-14.1673797065082],[32.597151294596635,-14.167383278615375],[32.59724270708534,-14.167393969755835],[32.5973329603479,-14.167411714279126],[32.59742148331486,-14.167436398870677],[32.59746305357709,-14.16745156953425],[32.59747073828402,-14.167423210312847],[32.59750126936814,-14.167338461800512],[32.597508451353974,-14.167322665208815],[32.59752348801862,-14.167280928571927],[32.59752577679319,-14.16727248213931],[32.59755630787737,-14.167187732727655],[32.59759364413145,-14.16710561832957],[32.5976375481344,-14.16702665875323],[32.59768774289506,-14.166951351323744],[32.59774391095277,-14.16688017358109],[32.59780569707533,-14.166813574287005],[32.59787271005757,-14.166751976122782],[32.59794452811752,-14.16669576759557],[32.598020695298885,-14.166645303937571],[32.59810073136373,-14.166600904408142],[32.59818412909431,-14.166562850495096],[32.598270361488055,-14.166531381418054],[32.598358884455024,-14.166506696826557],[32.59844913681826,-14.166488952303268],[32.59852580672065,-14.166479984263844],[32.598559981857704,-14.166473265428806],[32.598651394346405,-14.166462574288346],[32.598743387797185,-14.166459002181169],[32.59883538214722,-14.166462574288346],[32.59892679373661,-14.166473265428806],[32.599017046999165,-14.166491009952097],[32.59910556996613,-14.166515694543648],[32.599191802359826,-14.166547163620635],[32.59927520009046,-14.166585218433056],[32.599355236155304,-14.166629617962426],[32.599431403336666,-14.166680081620425],[32.5995032204973,-14.16673629014764],[32.59957023437886,-14.166797888311862],[32.59963202050142,-14.16686448670663],[32.59968818855913,-14.166935664449284],[32.59973838331979,-14.167010971878824],[32.59978228732274,-14.167089932354429],[32.5998196226775,-14.167172046752512],[32.59985015466094,-14.167256795264848],[32.5998736890196,-14.167343642794833],[32.59989007736522,-14.167432040756012]]]]},\"properties\":{\"uid\":\"41587456-b7c8-4c4e-b433-23a786f742fc\",\"code\":\"3734\",\"type\":\"Intervention Unit\",\"status\":\"Active\",\"parentId\":\"21\",\"name\":\"01_5\",\"geographicLevel\":4,\"effectiveStartDate\":\"2015-01-01T0000\",\"version\":0}}"; - - @Test - public void testDeserialize() throws ParseException { - - PhysicalLocation structure = gson.fromJson(structureJson, PhysicalLocation.class); - assertEquals("Feature", structure.getType()); - assertEquals("90397", structure.getId()); - - assertEquals(GeometryType.POLYGON, structure.getGeometry().getType()); - assertFalse(structure.getGeometry().getCoordinates().isJsonNull()); - - assertEquals("41587456-b7c8-4c4e-b433-23a786f742fc", structure.getProperties().getUid()); - assertEquals("21384443", structure.getProperties().getCode()); - assertEquals("Residential Structure", structure.getProperties().getType()); - assertEquals(PropertyStatus.ACTIVE, structure.getProperties().getStatus()); - assertEquals("3734", structure.getProperties().getParentId()); - assertNull(structure.getProperties().getName()); - assertEquals(5, structure.getProperties().getGeographicLevel()); - assertEquals(new SimpleDateFormat("yyyy-MM-dd").parse("2017-01-10"), - structure.getProperties().getEffectiveStartDate()); - assertNull(structure.getProperties().getEffectiveEndDate()); - assertEquals(0, structure.getProperties().getVersion()); - - PhysicalLocation parentLocation = gson.fromJson(parentJson, PhysicalLocation.class); - assertFalse(parentLocation.getGeometry().getCoordinates().isJsonNull()); - JsonArray coordinates = parentLocation.getGeometry().getCoordinates().get(0).getAsJsonArray().get(0) - .getAsJsonArray(); - assertEquals(267, coordinates.size()); - - JsonArray coordinate1 = coordinates.get(0).getAsJsonArray(); - assertEquals(32.59989007736522, coordinate1.get(0).getAsDouble(), 0); - assertEquals(-14.167432040756012, coordinate1.get(1).getAsDouble(), 0); - - JsonArray coordinate67 = coordinates.get(66).getAsJsonArray(); - assertEquals(32.5988341383848, coordinate67.get(0).getAsDouble(), 0); - assertEquals(-14.171814074659776, coordinate67.get(1).getAsDouble(), 0); - - } - - @Test - public void testSerialize() { - - PhysicalLocation structure = gson.fromJson(structureJson, PhysicalLocation.class); - assertEquals(structureJson, gson.toJson(structure)); - - PhysicalLocation parentLocation = gson.fromJson(parentJson, PhysicalLocation.class); - - assertEquals(parentJson, gson.toJson(parentLocation)); - - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/ProviderTest.java b/opensrp-core/src/test/java/org/opensrp/domain/ProviderTest.java deleted file mode 100644 index 36eed0f156..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/ProviderTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.opensrp.domain; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.affirm.Affirm; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -public class ProviderTest { - - @Test - public void testEqualAndHashcodeContract() { - EqualsVerifier.forClass(Provider.class).withIgnoredFields("id", "revision").suppress(Warning.NONFINAL_FIELDS) - .withPrefabValues(User.class, new User("ll"), new User("e")).withRedefinedSuperclass().verify(); - } - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(Provider.class)); - } - - @Test - public void testConstructor() { - final Class clazz = Provider.class; - final Object obj1 = FormTest.getInstance(clazz, "entityId", "name"); - Affirm.affirmNotNull("Should have created an object", obj1); - - Provider provider = (Provider) obj1; - assertEquals("entityId", provider.getBaseEntityId()); - assertEquals("name", provider.getFullName()); - - final Object obj2 = FormTest.getInstance(clazz, "entityId"); - provider = (Provider) obj2; - assertEquals("entityId", provider.getBaseEntityId()); - assertEquals(null, provider.getFullName()); - Affirm.affirmTrue("Should have created a different object", obj1 != obj2); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/SearchTest.java b/opensrp-core/src/test/java/org/opensrp/domain/SearchTest.java deleted file mode 100644 index 9c567e1fdf..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/SearchTest.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.domain; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; - -import org.joda.time.DateTime; -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -public class SearchTest { - - @Test - public void testEqualAndHashcodeContract() { - EqualsVerifier.forClass(Search.class).withIgnoredFields("id", "revision").suppress(Warning.NONFINAL_FIELDS) - .withPrefabValues(User.class, new User("ll"), new User("e")).withRedefinedSuperclass().verify(); - } - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(Search.class)); - } - - @Test - public void testFullName() { - Search search = new Search("ss").withFirstName("first").withMiddleName("middle").withLastName("last"); - assertEquals("first middle last", search.fullName()); - - search = new Search("ss").withName("first", "middle", null); - assertEquals("first middle", search.fullName()); - - search = new Search("ee", "first", "", "last", new DateTime(0l), true, "male"); - assertEquals("first last", search.fullName()); - - search = new Search("ee", "first", "", null, new DateTime(0l), true, "male"); - assertEquals("first", search.fullName()); - - search = new Search("ee", null, "middle", "", new DateTime(0l), true, "male"); - assertEquals("middle", search.fullName()); - - search = new Search("ee", null, "middle", "last", new DateTime(0l), true, "male"); - assertEquals("middle last", search.fullName()); - - search = new Search("ee", "", "", "last", new DateTime(0l), true, "male"); - assertEquals("last", search.fullName()); - - search = new Search("ee", "", "", null, new DateTime(0l), true, "male", Collections.EMPTY_LIST, - new HashMap(), new HashMap()); - assertEquals("", search.fullName()); - } - - @Test - public void testRelationShip() { - Search search = new Search("ee", "", "", "last", new DateTime(0l), true, "male", "d", "d"); - search.withBirthdate(new DateTime(0l), true); - search.withGender("male"); - search.withRelationships(null); - assertNull(search.findRelatives("d")); - - search.withRelationships(null); - search.addRelationship("t", "id"); - assertEquals(1, search.getRelationships().size()); - assertEquals(asList("id"), search.findRelatives("t")); - assertEquals(asList("t"), search.getRelationships("id")); - assertEquals(0, search.getRelationships("ddd").size()); - - search.withRelationships(null); - search.addRelationship("t", "id"); - search.addRelationship("t", "id1"); - search.addRelationship("t2", "id"); - assertEquals(2, search.getRelationships().size()); - List expectedRelationships = new ArrayList<>(); - expectedRelationships.add("t"); - expectedRelationships.add("t2"); - List expectedIds = new ArrayList<>(); - expectedIds.add("id"); - expectedIds.add("id1"); - assertEquals(new HashSet<>(expectedIds), new HashSet<>(search.findRelatives("t"))); - assertEquals(new HashSet<>(expectedRelationships), new HashSet<>(search.getRelationships("id"))); - - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/SubFormDefinitionTest.java b/opensrp-core/src/test/java/org/opensrp/domain/SubFormDefinitionTest.java deleted file mode 100644 index 99cbd08fea..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/SubFormDefinitionTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.opensrp.domain; - -import static org.junit.Assert.assertEquals; - -import java.util.Collections; - -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.affirm.Affirm; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class SubFormDefinitionTest { - - @Test - @SuppressWarnings("RedundantArrayCreation") - public void shouldCreateUsingDefaultConstructor() { - final Class clazz = SubFormDefinition.class; - final Object obj1 = FormTest.getInstance(clazz, (Object[]) null); - SubFormDefinition subFormDefinition = (SubFormDefinition) obj1; - assertEquals("", subFormDefinition.name()); - Affirm.affirmNotNull("Should have created an object", obj1); - - final Object obj2 = FormTest.getInstance(clazz, new Object[] {}); - subFormDefinition = (SubFormDefinition) obj2; - assertEquals("", subFormDefinition.name()); - Affirm.affirmTrue("Should have created a different object", obj1 != obj2); - } - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(SubFormDefinition.class)); - } - - @Test - public void testConstructorWithParameter() { - final Class clazz = SubFormDefinition.class; - final Object obj1 = FormTest.getInstance(clazz, "bind", Collections.EMPTY_LIST); - SubFormDefinition subFormDefinition = (SubFormDefinition) obj1; - Affirm.affirmNotNull("Should have created an object", obj1); - assertEquals("bind", subFormDefinition.name()); - assertEquals(Collections.EMPTY_LIST, subFormDefinition.getFields()); - - final Object obj2 = FormTest.getInstance(clazz, new Object[] {}); - Affirm.affirmTrue("Should have created a different object", obj1 != obj2); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/TaskTest.java b/opensrp-core/src/test/java/org/opensrp/domain/TaskTest.java deleted file mode 100644 index c837aa75bc..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/TaskTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.opensrp.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import org.joda.time.DateTime; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; -import org.junit.Test; -import org.opensrp.domain.Task.TaskStatus; -import org.opensrp.util.TaskDateTimeTypeConverter; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public class TaskTest { - - private static Gson gson = new GsonBuilder().registerTypeAdapter(DateTime.class, new TaskDateTimeTypeConverter()) - .serializeNulls().create(); - - protected static DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HHmm"); - - private String taskJson = "{\"identifier\":\"tsk11231jh22\",\"planIdentifier\":\"IRS_2018_S1\",\"groupIdentifier\":\"2018_IRS-3734{\",\"status\":\"Ready\",\"businessStatus\":\"Not Visited\",\"priority\":3,\"code\":\"IRS\",\"description\":\"Spray House\",\"focus\":\"IRS Visit\",\"for\":\"location.properties.uid:41587456-b7c8-4c4e-b433-23a786f742fc\",\"executionStartDate\":\"2018-11-10T2200\",\"executionEndDate\":null,\"authoredOn\":\"2018-10-31T0700\",\"lastModified\":\"2018-10-31T0700\",\"owner\":\"demouser\",\"note\":[{\"authorString\":\"demouser\",\"time\":\"2018-01-01T0800\",\"text\":\"This should be assigned to patrick.\"}],\"serverVersion\":0,\"reasonReference\":\"reasonrefuuid\",\"location\":\"catchment1\",\"requester\":\"chw1\"}"; - - private String task2Json = "{\"identifier\":\"tsk11231jh22\",\"planIdentifier\":\"IRS_2018_S1\",\"groupIdentifier\":\"2018_IRS-3734{\",\"status\":\"Ready\",\"businessStatus\":\"Not Visited\",\"priority\":3,\"code\":\"IRS\",\"description\":\"Spray House\",\"focus\":\"IRS Visit\",\"for\":\"location.properties.uid:41587456-b7c8-4c4e-b433-23a786f742fc\",\"executionStartDate\":\"2018-11-10T2200\",\"executionEndDate\":null,\"authoredOn\":\"2018-10-31T0700\",\"lastModified\":\"2018-10-31T07:00:00\",\"owner\":\"demouser\",\"note\":[{\"authorString\":\"demouser\",\"time\":\"2018-01-01T0800\",\"text\":\"This should be assigned to patrick.\"}],\"serverVersion\":0}"; - - @Test - public void testDeserialize() { - Task task = gson.fromJson(taskJson, Task.class); - assertEquals("tsk11231jh22", task.getIdentifier()); - assertEquals("2018_IRS-3734{", task.getGroupIdentifier()); - assertEquals(TaskStatus.READY, task.getStatus()); - assertEquals("Not Visited", task.getBusinessStatus()); - assertEquals(3, task.getPriority()); - assertEquals("IRS", task.getCode()); - assertEquals("Spray House", task.getDescription()); - assertEquals("IRS Visit", task.getFocus()); - assertEquals("location.properties.uid:41587456-b7c8-4c4e-b433-23a786f742fc", task.getForEntity()); - assertEquals("2018-11-10T2200", task.getExecutionStartDate().toString(formatter)); - assertNull(task.getExecutionEndDate()); - assertEquals("2018-10-31T0700", task.getAuthoredOn().toString(formatter)); - assertEquals("2018-10-31T0700", task.getLastModified().toString(formatter)); - assertEquals("demouser", task.getOwner()); - assertEquals(1, task.getNotes().size()); - assertEquals("demouser", task.getNotes().get(0).getAuthorString()); - assertEquals("2018-01-01T0800", task.getNotes().get(0).getTime().toString(formatter)); - assertEquals("This should be assigned to patrick.", task.getNotes().get(0).getText()); - assertEquals("This should be assigned to patrick.", task.getNotes().get(0).getText()); - assertEquals("chw1", task.getRequester()); - assertEquals("catchment1", task.getLocation()); - } - - @Test - public void testDeserializeWithTimeFormatArgument() { - Task task = gson.fromJson(task2Json, Task.class); - assertEquals("2018-10-31T0700", task.getLastModified().toString(formatter)); - } - - @Test - public void testSerialize() { - Task task = gson.fromJson(taskJson, Task.class); - assertEquals(taskJson, gson.toJson(task)); - } - - @Test - public void testGettingReasonReference() { - String reasonReference = "reasonreferenceuuid"; - Task task = new Task(); - assertNull(task.getReasonReference()); - - task.setReasonReference(reasonReference); - assertEquals(reasonReference, task.getReasonReference()); - - } - - - @Test - public void testLocationAndRequesterMethods() { - String location = "chaliwa"; - String user = "chw11"; - Task task = new Task(); - task.setLocation(location); - task.setRequester(user); - assertEquals(location, task.getLocation()); - assertEquals(user, task.getRequester()); - - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/UniqueIdTest.java b/opensrp-core/src/test/java/org/opensrp/domain/UniqueIdTest.java deleted file mode 100644 index 0d38ecf527..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/UniqueIdTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.opensrp.domain; - -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class UniqueIdTest { - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(UniqueId.class)); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/domain/UserTest.java b/opensrp-core/src/test/java/org/opensrp/domain/UserTest.java deleted file mode 100644 index dd19703d28..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/domain/UserTest.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.domain; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.affirm.Affirm; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -public class UserTest { - - @Test - public void testEqualAndHashcodeContract() { - EqualsVerifier.forClass(User.class).withIgnoredFields("id", "revision").suppress(Warning.NONFINAL_FIELDS) - .withPrefabValues(User.class, new User("ll"), new User("e")).withRedefinedSuperclass().verify(); - } - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(User.class)); - } - - @Test - public void testConstructor() { - final Class clazz = User.class; - final Object obj1 = FormTest.getInstance(clazz, "entityId", "username", "password", "salt"); - Affirm.affirmNotNull("Should have created an object", obj1); - - final Object obj2 = FormTest.getInstance(clazz, new Object[] {}); - Affirm.affirmTrue("Should have created a different object", obj1 != obj2); - } - - @Test - public void testRoles() { - User user = new User("dd", "userName", "password", "salt", "status", null, null); - assertFalse(user.hasRole("role")); - assertFalse(user.hasAdminRights()); - assertFalse(user.isDefaultAdmin()); - - user.addRole("role"); - assertTrue(user.hasRole("role")); - assertFalse(user.hasAdminRights()); - assertFalse(user.isDefaultAdmin()); - - user.removeRole("role"); - assertFalse(user.hasRole("role")); - - user.withRole("admin"); - assertTrue(user.hasRole("admin")); - assertTrue(user.hasAdminRights()); - assertFalse(user.isDefaultAdmin()); - - user.removeRole("admin"); - user.withRole("administrator"); - assertFalse(user.hasRole("admin")); - assertTrue(user.hasAdminRights()); - assertFalse(user.isDefaultAdmin()); - - user.withUsername("admin"); - assertTrue(user.hasRole("administrator")); - assertTrue(user.hasAdminRights()); - assertTrue(user.isDefaultAdmin()); - } - - @Test - public void testPermission() { - User user = new User(); - assertNull(user.getPermissions()); - assertFalse(user.hasPermission("permission")); - - user.withPermission("permission"); - assertNotNull(user.getPermissions()); - assertTrue(user.hasPermission("permission")); - assertFalse(user.hasPermission("permis")); - - assertFalse(user.removePermission("perms")); - - assertTrue(user.removePermission("permission")); - assertFalse(user.hasPermission("permission")); - - user.withPermissions(null); - user.addPermission("permission"); - assertTrue(user.hasPermission("permission")); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/it/ActionCreationIntegrationTest.java b/opensrp-core/src/test/java/org/opensrp/repository/it/ActionCreationIntegrationTest.java deleted file mode 100644 index 143a128491..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/it/ActionCreationIntegrationTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.opensrp.repository.it; - -import static org.mockito.MockitoAnnotations.initMocks; - -import java.io.IOException; - -import org.junit.Before; -import org.mockito.Mock; -import org.opensrp.form.service.FormSubmissionService; -import org.opensrp.scheduler.AlertCreationAction; -import org.opensrp.scheduler.HealthSchedulerService; -import org.opensrp.util.TestResourceLoader; - -public class ActionCreationIntegrationTest extends TestResourceLoader { - - public ActionCreationIntegrationTest() throws IOException { - super(); - } - - @Mock - private HealthSchedulerService scheduler; - - private AlertCreationAction reminderAction; - - @Mock - private FormSubmissionService formSubmissionService; - - @Before - public void setUp() throws Exception { - initMocks(this); - - } - - public static void main(String[] args) { - System.out.println(Boolean.valueOf("0")); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/it/AllActionsIntegrationTest.java b/opensrp-core/src/test/java/org/opensrp/repository/it/AllActionsIntegrationTest.java deleted file mode 100644 index 826ee31ae4..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/it/AllActionsIntegrationTest.java +++ /dev/null @@ -1,235 +0,0 @@ -package org.opensrp.repository.it; - -import static java.util.Arrays.asList; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; -import static org.opensrp.dto.AlertStatus.normal; -import static org.opensrp.dto.BeneficiaryType.mother; - -import java.util.List; - -import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.dto.ActionData; -import org.opensrp.scheduler.Action; -import org.opensrp.scheduler.repository.couch.AllActions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public class AllActionsIntegrationTest { - - public static final String SCHEDULE_NAME = "Ante Natal Care - Normal"; - - public static final String VISIT_CODE = "ANC 1"; - - @Autowired - AllActions allActions; - - @Before - public void setUp() throws Exception { - allActions.removeAll(); - } - - @Test - public void shouldSaveAReminder() throws Exception { - Action alertAction = new Action("Case X", "ANM phone no", alert()); - - allActions.add(alertAction); - - List allTheAlertActionsInDB = allActions.getAll(); - assertEquals(1, allTheAlertActionsInDB.size()); - assertEquals(alertAction, allTheAlertActionsInDB.get(0)); - } - - @Test - public void shouldNotFindAnyAlertsIfNoneExistForGivenANM() throws Exception { - assertEquals(0, allActions.findByProviderIdAndTimeStamp("ANM 1", 0).size()); - } - - @Test - public void shouldReturnAlertActionsBasedOnProviderIdAndTimeStamp() throws Exception { - Action firstAction = new Action("Case X", "ANM 1", alert()); - allActions.add(firstAction); - - Action secondAction = new Action("Case Y", "ANM 1", alert()); - allActions.add(secondAction); - - Action thirdAction = new Action("Case Z", "ANM 1", alert()); - allActions.add(thirdAction); - - assertEquals(asList(firstAction, secondAction, thirdAction), allActions.findByProviderIdAndTimeStamp("ANM 1", 0)); - assertEquals(asList(secondAction, thirdAction), - allActions.findByProviderIdAndTimeStamp("ANM 1", firstAction.getTimestamp())); - assertEquals(asList(thirdAction), allActions.findByProviderIdAndTimeStamp("ANM 1", secondAction.getTimestamp())); - - assertEquals(0, allActions.findByProviderIdAndTimeStamp("ANM 1", thirdAction.getTimestamp()).size()); - } - - @Test - public void shouldReturnAlertActionsBasedOnCaseIdAndScheduleNameAndTimeStamp() throws Exception { - Action firstAction = new Action("Case X", "ANM 1", alert()); - allActions.add(firstAction); - - Action secondAction = new Action("Case X", "ANM 1", alert()); - allActions.add(secondAction); - - Action thirdAction = new Action("Case X", "ANM 1", alert()); - allActions.add(thirdAction); - - assertEquals(asList(firstAction, secondAction, thirdAction), allActions.findByCaseIdScheduleAndTimeStamp("Case X", - SCHEDULE_NAME, new DateTime(0), new DateTime(thirdAction.getTimeStamp()))); - assertEquals(asList(secondAction, thirdAction), allActions.findByCaseIdScheduleAndTimeStamp("Case X", SCHEDULE_NAME, - new DateTime(firstAction.getTimeStamp() + 1), new DateTime(thirdAction.getTimeStamp()))); - assertEquals(asList(thirdAction), allActions.findByCaseIdScheduleAndTimeStamp("Case X", SCHEDULE_NAME, - new DateTime(secondAction.getTimeStamp() + 1), new DateTime(thirdAction.getTimeStamp()))); - assertEquals(0, allActions.findByCaseIdScheduleAndTimeStamp("Case X", SCHEDULE_NAME, - new DateTime(thirdAction.getTimeStamp() + 1), new DateTime(thirdAction.getTimeStamp() + 2)).size()); - } - - @Test - public void shouldReturnAlertActionsBasedOnCaseIdAndTimeStamp() throws Exception { - Action firstAction = new Action("Case X", "ANM 1", alert()); - allActions.add(firstAction); - - Action secondAction = new Action("Case X", "ANM 1", alert()); - allActions.add(secondAction); - - Action thirdAction = new Action("Case X", "ANM 1", alert()); - allActions.add(thirdAction); - - assertEquals(asList(firstAction, secondAction, thirdAction), allActions.findByCaseIdAndTimeStamp("Case X", 0)); - assertEquals(asList(secondAction, thirdAction), - allActions.findByCaseIdAndTimeStamp("Case X", firstAction.getTimestamp() + 1)); - assertEquals(asList(thirdAction), allActions.findByCaseIdAndTimeStamp("Case X", secondAction.getTimestamp() + 1)); - - assertEquals(0, allActions.findByCaseIdAndTimeStamp("Case X", thirdAction.getTimestamp() + 1).size()); - } - - @Test - public void shouldFindAlertsOnlyForTheANMSpecified() throws Exception { - Action firstAction = new Action("Case X", "ANM 1", alert()); - allActions.add(firstAction); - - Action secondAction = new Action("Case Y", "ANM 2", alert()); - allActions.add(secondAction); - - assertEquals(asList(firstAction), allActions.findByProviderIdAndTimeStamp("ANM 1", 0)); - assertEquals(asList(secondAction), allActions.findByProviderIdAndTimeStamp("ANM 2", 0)); - } - - @Test - public void shouldMarkAllActionsAsInActiveForACase() throws Exception { - Action firstAction = new Action("Case X", "ANM 1", alert()); - Action secondAction = new Action("Case X", "ANM 1", alert()); - Action thirdAction = new Action("Case Y", "ANM 2", alert()); - allActions.add(firstAction); - allActions.add(secondAction); - allActions.add(thirdAction); - - allActions.markAllAsInActiveFor("Case X"); - - assertEquals(asList(firstAction.markAsInActive(), secondAction.markAsInActive()), - allActions.findByProviderIdAndTimeStamp("ANM 1", 0)); - assertEquals(asList(thirdAction), allActions.findByProviderIdAndTimeStamp("ANM 2", 0)); - } - - @Test - public void shouldFetchAlertsSortedByTimestamp() throws Exception { - Action earlierAction = new Action("Case X", "ANM 1", alert()); - Thread.sleep(100); - Action laterAction = new Action("Case X", "ANM 1", alert()); - Thread.sleep(100); - Action latestAction = new Action("Case X", "ANM 1", alert()); - - allActions.add(laterAction); - allActions.add(latestAction); - allActions.add(earlierAction); - - assertEquals(asList(earlierAction, laterAction, latestAction), allActions.findByProviderIdAndTimeStamp("ANM 1", 0)); - } - - @Test - public void shouldNotDoAnythingIfNoActionsAreFoundForATarget() { - Action alertAction = new Action("Case X", "ANM 1", alert()); - allActions.add(alertAction); - - allActions.deleteAllByTarget("report"); - - assertEquals(asList(alertAction), allActions.findByProviderIdAndTimeStamp("ANM 1", 0)); - } - - @Test - public void shouldReturnActionBasedOnANMIdEntityIdScheduleName() throws Exception { - Action anmAction = new Action("entity id 1", "anm id 1", alert("schedule1", "milestone1")); - Action anotherANMAction = new Action("entity id 2", "anm id 2", alert("schedule2", "milestone2")); - Action anotherEntityAction = new Action("entity id 2", "anm id 1", alert("schedule1", "milestone1")); - Action anotherScheduleAction = new Action("entity id 1", "anm id 1", alert("schedule2", "milestone1")); - allActions.add(anmAction); - allActions.add(anotherEntityAction); - allActions.add(anotherANMAction); - allActions.add(anotherScheduleAction); - - assertEquals(asList(anmAction), - allActions.findAlertByANMIdEntityIdScheduleName("anm id 1", "entity id 1", "schedule1")); - assertEquals(asList(anotherScheduleAction), - allActions.findAlertByANMIdEntityIdScheduleName("anm id 1", "entity id 1", "schedule2")); - assertEquals(asList(anotherEntityAction), - allActions.findAlertByANMIdEntityIdScheduleName("anm id 1", "entity id 2", "schedule1")); - assertEquals(asList(anotherANMAction), - allActions.findAlertByANMIdEntityIdScheduleName("anm id 2", "entity id 2", "schedule2")); - } - - @Test - public void shouldRemoveExistingAlertBeforeAddingNewOne() throws Exception { - Action existingAlert = new Action("entity id 1", "anm id 1", alert("schedule1", "milestone1")); - Action existingDifferentScheduleAlert = new Action("entity id 1", "anm id 1", alert("schedule2", "milestone3")); - allActions.add(existingAlert); - allActions.add(existingDifferentScheduleAlert); - - Action newAlert = new Action("entity id 1", "anm id 1", alert("schedule1", "milestone2")); - allActions.addOrUpdateAlert(newAlert); - - assertFalse(allActions.contains(existingAlert.getId())); - assertTrue(allActions.contains(existingDifferentScheduleAlert.getId())); - assertEquals(allActions.findAlertByANMIdEntityIdScheduleName("anm id 1", "entity id 1", "schedule1").get(0).getId(), - newAlert.getId()); - } - - @Test - public void shouldAddNewAlertWhenThereIsNoExistingAlert() throws Exception { - Action newAlert = new Action("entity id 1", "anm id 1", alert("schedule1", "milestone2")); - allActions.addOrUpdateAlert(newAlert); - - assertTrue(allActions.contains(newAlert.getId())); - } - - @Test - public void shouldUpdateAlertAsAnInactive() { - Action firstAction = new Action("Case X", "ANM 1", alert("schedule1", "milestone1")); - Action secondAction = new Action("Case X", "ANM 1", alert("schedule2", "milestone2")); - allActions.add(firstAction); - allActions.add(secondAction); - - allActions.markAlertAsInactiveFor("ANM 1", "Case X", "schedule1"); - - assertEquals(asList(firstAction.markAsInActive()), - allActions.findAlertByANMIdEntityIdScheduleName("ANM 1", "Case X", "schedule1")); - assertEquals(asList(secondAction), allActions.findAlertByANMIdEntityIdScheduleName("ANM 1", "Case X", "schedule2")); - } - - private ActionData alert() { - return ActionData.createAlert(mother.value(), SCHEDULE_NAME, VISIT_CODE, normal, DateTime.now(), - DateTime.now().plusDays(3)); - } - - private ActionData alert(String schedule, String milestone) { - return ActionData.createAlert(mother.value(), schedule, milestone, normal, DateTime.now(), - DateTime.now().plusDays(3)); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/it/AllAlertsIntegrationTest.java b/opensrp-core/src/test/java/org/opensrp/repository/it/AllAlertsIntegrationTest.java deleted file mode 100644 index e671552f04..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/it/AllAlertsIntegrationTest.java +++ /dev/null @@ -1,214 +0,0 @@ -package org.opensrp.repository.it; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.opensrp.dto.AlertStatus.normal; - -import java.util.List; - -import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.dto.AlertStatus; -import org.opensrp.scheduler.Alert; -import org.opensrp.scheduler.Alert.AlertType; -import org.opensrp.scheduler.Alert.TriggerType; -import org.opensrp.scheduler.repository.couch.AllAlerts; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public class AllAlertsIntegrationTest { - - @Autowired - public AllAlerts allAlerts; - - @Before - public void setUp() throws Exception { - allAlerts.removeAll(); - } - - @Test - public void shouldSaveANotification() throws Exception { - DateTime dueDate = DateTime.now().minusDays(1); - DateTime expiryDate = dueDate.plusWeeks(2); - - Alert alert = new Alert("ANM 1", "Entity 1", "mother", AlertType.notification, TriggerType.schedule, "Penta 1", - "penta1", dueDate, expiryDate, AlertStatus.upcoming, null); - - allAlerts.add(alert); - - List allTheAlertsInDB = allAlerts.getAll(); - assertEquals(1, allTheAlertsInDB.size()); - assertEquals(alert, allTheAlertsInDB.get(0)); - } - - @Test - public void shouldNotFindAnyAlertsIfNoneExistForGivenProvider() throws Exception { - assertEquals(0, allAlerts.findActiveByProviderAndTimestamp("ANM 1", 0).size()); - } - - @Test - public void shouldReturnAlertActionsBasedOnProviderIDAndTimeStamp() throws Exception { - DateTime dueDate = DateTime.now().minusDays(1); - DateTime expiryDate = dueDate.plusWeeks(2); - - Alert alert1 = new Alert("ANM 1", "Entity 1", "mother", AlertType.notification, TriggerType.schedule, "Penta 1", - "penta1", dueDate, expiryDate, AlertStatus.upcoming, null); - allAlerts.add(alert1); - - Alert alert2 = new Alert("ANM 1", "Entity 2", "mother", AlertType.notification, TriggerType.schedule, "Penta 1", - "penta1", dueDate, expiryDate, AlertStatus.upcoming, null); - allAlerts.add(alert2); - - Alert alert3 = new Alert("ANM 1", "Entity 3", "mother", AlertType.notification, TriggerType.schedule, "Penta 1", - "penta1", dueDate, expiryDate, AlertStatus.upcoming, null); - allAlerts.add(alert3); - - assertEquals(asList(alert1, alert2, alert3), allAlerts.findActiveByProviderAndTimestamp("ANM 1", 0)); - assertEquals(asList(alert2, alert3), allAlerts.findActiveByProviderAndTimestamp("ANM 1", alert1.timestamp())); - assertEquals(asList(alert3), allAlerts.findActiveByProviderAndTimestamp("ANM 1", alert2.timestamp())); - - assertEquals(0, allAlerts.findActiveByProviderAndTimestamp("ANM 1", alert3.timestamp()).size()); - } - - @Test - public void shouldFindAlertsOnlyForTheANMSpecified() throws Exception { - DateTime dueDate = DateTime.now().minusDays(1); - DateTime expiryDate = dueDate.plusWeeks(2); - - Alert alert1 = new Alert("ANM 1", "Entity 1", "mother", AlertType.notification, TriggerType.schedule, "Penta 1", - "penta1", dueDate, expiryDate, AlertStatus.upcoming, null); - allAlerts.add(alert1); - - Alert alert2 = new Alert("ANM 2", "Entity 2", "mother", AlertType.notification, TriggerType.schedule, "Penta 1", - "penta1", dueDate, expiryDate, AlertStatus.upcoming, null); - allAlerts.add(alert2); - - Alert alert3 = new Alert("ANM 1", "Entity 3", "mother", AlertType.notification, TriggerType.schedule, "Penta 1", - "penta1", dueDate, expiryDate, AlertStatus.upcoming, null); - allAlerts.add(alert3); - - assertEquals(asList(alert1, alert3), allAlerts.findActiveByProviderAndTimestamp("ANM 1", 0)); - assertEquals(asList(alert2), allAlerts.findActiveByProviderAndTimestamp("ANM 2", 0)); - } - - @Test - public void shouldMarkAllAlertsAsInActiveForACase() throws Exception { - DateTime dueDate = DateTime.now().minusDays(1); - DateTime expiryDate = dueDate.plusWeeks(2); - - Alert alert1 = new Alert("ANM 1", "Entity 1", "mother", AlertType.notification, TriggerType.schedule, "Penta 1", - "penta1", dueDate, expiryDate, AlertStatus.upcoming, null); - - Alert alert2 = new Alert("ANM 1", "Entity 2", "mother", AlertType.notification, TriggerType.schedule, "Penta 1", - "penta1", dueDate, expiryDate, AlertStatus.upcoming, null); - - Alert alert3 = new Alert("ANM 2", "Entity 3", "mother", AlertType.notification, TriggerType.schedule, "Penta 1", - "penta1", dueDate, expiryDate, AlertStatus.upcoming, null); - - Alert alert4 = new Alert("ANM 1", "Entity 4", "mother", AlertType.notification, TriggerType.schedule, "Penta 1", - "penta1", dueDate, expiryDate, AlertStatus.upcoming, null); - - allAlerts.add(alert1); - allAlerts.add(alert2); - allAlerts.add(alert3); - allAlerts.add(alert4); - - allAlerts.markAllAsClosedFor("Entity 1", "none"); - - assertEquals(asList(alert2, alert4), allAlerts.findActiveByProviderAndTimestamp("ANM 1", 0)); - assertEquals(asList(alert3), allAlerts.findActiveByProviderAndTimestamp("ANM 2", 0)); - } - - @Test - public void shouldNotDoAnythingIfNoActionsAreFoundForATarget() { - //TODO - } - - @Test - public void shouldReturnActionBasedOnProviderIdEntityIdScheduleName() throws Exception { - DateTime dueDate = DateTime.now().minusDays(1); - DateTime expiryDate = dueDate.plusWeeks(2); - - Alert alert1 = new Alert("ANM 1", "Entity 1", "mother", AlertType.notification, TriggerType.schedule, "Penta 1", - "penta1", dueDate, expiryDate, AlertStatus.upcoming, null); - - Alert alert2 = new Alert("ANM 1", "Entity 1", "mother", AlertType.notification, TriggerType.schedule, "Penta 2", - "penta2", dueDate, expiryDate, AlertStatus.upcoming, null); - - Alert alert3 = new Alert("ANM 2", "Entity 2", "mother", AlertType.notification, TriggerType.schedule, "Penta 1", - "penta1", dueDate, expiryDate, AlertStatus.upcoming, null); - - Alert alert4 = new Alert("ANM 1", "Entity 3", "mother", AlertType.notification, TriggerType.schedule, "Penta 2", - "penta2", dueDate, expiryDate, AlertStatus.upcoming, null); - - allAlerts.add(alert1); - allAlerts.add(alert2); - allAlerts.add(alert3); - allAlerts.add(alert4); - - assertEquals(asList(alert1), allAlerts.findActiveAlertByProviderEntityIdTriggerName("ANM 1", "Entity 1", "Penta 1")); - assertEquals(asList(alert2), allAlerts.findActiveAlertByProviderEntityIdTriggerName("ANM 1", "Entity 1", "Penta 2")); - assertEquals(asList(alert3), allAlerts.findActiveAlertByProviderEntityIdTriggerName("ANM 2", "Entity 2", "Penta 1")); - assertEquals(asList(alert4), allAlerts.findActiveAlertByProviderEntityIdTriggerName("ANM 1", "Entity 3", "Penta 2")); - } - - @Test - public void shouldRemoveExistingAlertBeforeAddingNewOne() throws Exception { - DateTime dueDate = DateTime.now().minusDays(1); - DateTime expiryDate = dueDate.plusWeeks(2); - - allAlerts.addOrUpdateScheduleNotificationAlert("mother", "Entity 1", "ANM 1", "Penta 1", "penta1", - AlertStatus.upcoming, dueDate, expiryDate); - assertTrue(allAlerts.findActiveAlertByEntityId("Entity 1").size() == 1); - - allAlerts.addOrUpdateScheduleNotificationAlert("mother", "Entity 1", "ANM 1", "Penta 1", "penta1", normal, dueDate, - expiryDate); - - List al = allAlerts.findActiveAlertByEntityId("Entity 1"); - assertTrue(al.size() == 1); - assertTrue(al.get(0).alertStatus().equalsIgnoreCase(normal.name())); - } - - @Test - public void shouldAddNewAlertWhenThereIsNoExistingAlert() throws Exception { - DateTime dueDate = DateTime.now().minusDays(1); - DateTime expiryDate = dueDate.plusWeeks(2); - - allAlerts.addOrUpdateScheduleNotificationAlert("mother", "Entity 1", "ANM 1", "Penta 1", "penta1", - AlertStatus.upcoming, dueDate, expiryDate); - - assertTrue(allAlerts.findActiveAlertByEntityId("Entity 1").size() == 1); - } - - @Test - public void shouldUpdateAlertAsAnInactive() { - DateTime dueDate = DateTime.now().minusDays(1); - DateTime expiryDate = dueDate.plusWeeks(2); - - Alert alert1 = new Alert("ANM 1", "Entity 1", "mother", AlertType.notification, TriggerType.schedule, "Penta 1", - "penta1", dueDate, expiryDate, AlertStatus.upcoming, null); - - Alert alert2 = new Alert("ANM 1", "Entity 1", "mother", AlertType.notification, TriggerType.schedule, "Penta 2", - "penta2", dueDate, expiryDate, AlertStatus.upcoming, null); - - allAlerts.add(alert1); - allAlerts.add(alert2); - - assertEquals(asList(alert1, alert2), allAlerts.findActiveAlertByEntityId("Entity 1")); - assertEquals(asList(alert1), allAlerts.findActiveAlertByProviderEntityIdTriggerName("ANM 1", "Entity 1", "Penta 1")); - assertEquals(asList(alert2), allAlerts.findActiveAlertByProviderEntityIdTriggerName("ANM 1", "Entity 1", "Penta 2")); - - allAlerts.markAlertAsClosedFor("ANM 1", "Entity 1", "Penta 1", "none"); - - assertEquals(asList(alert2), allAlerts.findActiveAlertByEntityId("Entity 1")); - assertEquals(asList(), allAlerts.findActiveAlertByProviderEntityIdTriggerName("ANM 1", "Entity 1", "Penta 1")); - assertEquals(asList(alert2), allAlerts.findActiveAlertByProviderEntityIdTriggerName("ANM 1", "Entity 1", "Penta 2")); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/it/AllBaseEntitiesIntegrationTest.java b/opensrp-core/src/test/java/org/opensrp/repository/it/AllBaseEntitiesIntegrationTest.java deleted file mode 100644 index 25afc9adef..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/it/AllBaseEntitiesIntegrationTest.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.opensrp.repository.it; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.MockitoAnnotations.initMocks; - -import java.util.List; - -import org.ektorp.CouchDbConnector; -import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.common.AllConstants; -import org.opensrp.common.Gender; -import org.opensrp.domain.Address; -import org.opensrp.domain.BaseEntity; -import org.opensrp.domain.Client; -import org.opensrp.repository.couch.AllBaseEntities; -import org.opensrp.repository.couch.AllClients; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public class AllBaseEntitiesIntegrationTest { - - @Autowired - @Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) - CouchDbConnector db; - - @Autowired - private AllBaseEntities allBaseEntities; - - @Autowired - private AllClients allClients; - - @Before - public void setUp() throws Exception { - allClients.removeAll(); - initMocks(this); - } - - @Test - public void shouldFetchBaseEntityForClientData() throws Exception { - String baseEntityId = "testclient1"; - Client c = new Client(baseEntityId).withBirthdate(new DateTime(), false).withFirstName("C first n") - .withLastName("C last n").withMiddleName("C middle n").withGender(Gender.FEMALE); - c.withAddress(new Address("birthplace", new DateTime(System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 2), - DateTime.now(), null, "lat", "lon", "75210", "Sindh", "Pakistan")); - c.withAttribute("ETHNICITY", "Mughal"); - c.withIdentifier("Program ID", "01001221"); - - allClients.add(c); - - BaseEntity be = allBaseEntities.findByBaseEntityId("testclient1"); - assertEquals("testclient1", be.getBaseEntityId()); - assertTrue(Client.class.getSimpleName().equals(be.type())); - assertEquals("birthplace", be.getAddresses().get(0).getAddressType()); - assertEquals("Mughal", be.getAttribute("ethnicity")); - assertEquals("01001221", be.getIdentifier("program id")); - - List be2 = allBaseEntities.findAllByIdentifier("01001221"); - assertTrue(be2.size() == 1); - assertEquals("testclient1", be2.get(0).getBaseEntityId()); - - List be3 = allBaseEntities.findAllByIdentifier("Program ID", "01001221"); - assertTrue(be3.size() == 1); - assertEquals("testclient1", be3.get(0).getBaseEntityId()); - } - - @Test - public void shouldFetchBaseEntityByIdentifier() throws Exception { - String baseEntityId = "testclient2"; - Client c = new Client(baseEntityId).withBirthdate(new DateTime(), false).withFirstName("C first n") - .withLastName("C last n").withMiddleName("C middle n").withGender(Gender.MALE); - c.withAddress(new Address("birthplace", new DateTime(System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 2), - DateTime.now(), null, "lat", "lon", "75210", "Sindh", "Pakistan")); - c.withAttribute("ETHNICITY", "Mughal"); - c.withIdentifier("Program ID", "01001222"); - - allClients.add(c); - - BaseEntity be = allBaseEntities.findByBaseEntityId("testclient2"); - assertEquals("testclient2", be.getBaseEntityId()); - assertTrue(Client.class.getSimpleName().equals(be.type())); - assertEquals("01001222", be.getIdentifier("program id")); - - List be2 = allBaseEntities.findAllByIdentifier("01001222"); - assertTrue(be2.size() == 1); - assertEquals("testclient2", be2.get(0).getBaseEntityId()); - - List be3 = allBaseEntities.findAllByIdentifier("Program ID", "01001222"); - assertTrue(be3.size() == 1); - assertEquals("testclient2", be3.get(0).getBaseEntityId()); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/it/AllClientsIntegrationTest.java b/opensrp-core/src/test/java/org/opensrp/repository/it/AllClientsIntegrationTest.java deleted file mode 100644 index 488a6af460..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/it/AllClientsIntegrationTest.java +++ /dev/null @@ -1,270 +0,0 @@ -package org.opensrp.repository.it; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.MockitoAnnotations.initMocks; - -import java.net.MalformedURLException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import org.apache.log4j.FileAppender; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.apache.log4j.PatternLayout; -import org.ektorp.CouchDbConnector; -import org.hamcrest.Matchers; -import org.joda.time.DateTime; -import org.json.JSONException; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.common.Gender; -import org.opensrp.domain.Address; -import org.opensrp.domain.Client; -import org.opensrp.repository.couch.AllClients; -import org.opensrp.search.AddressSearchBean; -import org.opensrp.search.ClientSearchBean; -import org.opensrp.service.ClientService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public class AllClientsIntegrationTest { - //TODO detailed testign - - @Autowired - private ClientService clientService; - - @Autowired - private AllClients ac; - - @Before - public void setUp() throws Exception { - System.out.println("Removing all data"); - ac.removeAll(); - System.out.println("Removed"); - initMocks(this); - - FileAppender fa = new FileAppender(); - fa.setName("FileLogger"); - fa.setFile("d:\\opensrp-logger.log"); - fa.setLayout(new PatternLayout("%d %-5p [%c{1}] %m%n")); - fa.setThreshold(Level.INFO); - fa.setAppend(true); - fa.activateOptions(); - - // add appender to any Logger (here is root) - Logger.getRootLogger().addAppender(fa); - } - - private void addClients() { - for (int i = 0; i < 10; i++) { - Client c = new Client("eid" + i).withName("fn" + i, "mn" + i, "ln" + i).withGender("MALE") - .withBirthdate(new DateTime(), false); - c.withAddress(new Address().withAddressType("usual_residence").withCityVillage("city" + i).withTown("town" + i)); - c.withAttribute("at1", "atval" + i); - - clientService.addClient(c); - } - } - - @Test - public void shouldMergeSuccessfullyIfClientFound() throws JSONException {//TODO - Client c = new Client("eid0").withName("fn", "mn", "ln").withGender("MALE").withBirthdate(new DateTime(), false); - c.withAddress(new Address().withAddressType("usual_residence").withCityVillage("city").withTown("town")); - c.withAttribute("at1", "atval1"); - - c = clientService.addClient(c); - - Client cu = new Client("eid0").withGender("FEMALE").withBirthdate(new DateTime(), false); - cu.withAddress(new Address().withAddressType("deathplace").withCityVillage("city").withTown("town")); - cu.withAttribute("at2", "atval2"); - - clientService.mergeClient(cu); - } - - @Test - public void shouldSearchByLastUpdatedDate() throws JSONException {//TODO - DateTime start = DateTime.now(); - - addClients(); - - DateTime end = DateTime.now(); - - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setLastEditFrom(start); - clientSearchBean.setLastEditTo(end); - - List cll = clientService.findByCriteria(clientSearchBean, null); - - assertEquals(10, cll.size()); - } - - public static void main(String[] args) { - System.out.println(new DateTime("2016-01-23").toString("MMMM (yyyy)")); - } - - @Test - public void shouldSearchFullDataClientsIn10Sec() throws MalformedURLException { - - /*org.ektorp.http.HttpClient httpClient = new StdHttpClient.Builder().url("http://202.141.249.106:6808").build(); - CouchDbInstance dbInstance = new StdCouchDbInstance(httpClient); - - CouchDbConnector db = new StdCouchDbConnector("opensrp", dbInstance); - - Logger.getLogger("FileLogger").info("Starting at "+new DateTime());*/ - - final long start = System.currentTimeMillis(); - - for (int i = 0; i < 100; i++) { - addClient(i, false, null); - } - Logger.getLogger("FileLogger").info( - "10K entries complete at " + new DateTime() + " in " + ((System.currentTimeMillis() - start) / 1000) + " sec"); - - Logger.getLogger("FileLogger").info("Going for First search by Couch"); - clientService.findAllByIdentifier("1234556" + "786"); - Logger.getLogger("FileLogger").info("Completed First search by Couch"); - - Logger.getLogger("FileLogger").info("Going for 2nd search by Couch"); - clientService.findAllByIdentifier("1234556" + "786"); - Logger.getLogger("FileLogger").info("Completed 2nd search by Couch"); - - Logger.getLogger("FileLogger").info("Going for First search by Lucene"); - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike("first"); - clientSearchBean.setGender("MALE"); - clientSearchBean.setBirthdateFrom(new DateTime()); - clientSearchBean.setAttributeType("ethnicity"); - clientSearchBean.setAttributeValue("eth3"); - List l = clientService.findByCriteria(clientSearchBean, null); - Logger.getLogger("FileLogger").info("Completed First search of size " + l.size() + " by Lucene"); - - Logger.getLogger("FileLogger").info("Going for 2nd search by Lucene"); - l = clientService.findByCriteria(clientSearchBean, null); - - Logger.getLogger("FileLogger").info("Completed 2nd search of size " + l.size() + " by Lucene"); - } - - void addClient(int i, boolean direct, CouchDbConnector db) { - int ageInWeeks = new Random().nextInt(2860);// assuming average age of people is 55 years - DateTime birthdate = new DateTime().minusWeeks(ageInWeeks); - DateTime deathdate = i % 7 == 0 ? new DateTime() : null;// every 7th person died today - Client c = new Client("entityId" + i, "firstName" + i, "middleName" + i, "lastName" + i, birthdate, deathdate, false, - false, i % 2 == 0 ? "FEMALE" : "MALE"); - - Map am = new HashMap<>(); - Address ab = new Address("birthplace", null, null, am, null, null, null, "Sindh", "Pakistan"); - ab.setCityVillage("Karachi"); - ab.setTown("Korangi"); - ab.setSubTown("UC" + i % 11); - c.addAddress(ab); - - Address ur = new Address("usual_residence", null, null, am, null, null, "752" + new Random().nextInt(5), "Sindh", - "Pakistan"); - ur.setCityVillage("Karachi"); - ur.setTown(i % 3 == 0 ? "Korangi" : "Baldia"); - ur.setSubTown("UC" + i % 11); - c.addAddress(ur); - - c.addAttribute("ethnicity", "eth" + i % 7); - c.addAttribute("health area", "healtha" + i % 7); - - c.addIdentifier("CNIC", "1234556" + i); - c.addIdentifier("NTN", "564300" + i); - - if (db != null) { - db.create(c); - } else if (direct) { - ac.add(c); - } else { - clientService.addClient(c); - } - } - - @Test - public void shouldGetByDynamicView() { - addClients(); - - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setGender("MALE"); - List l2 = clientService.findByCriteria(clientSearchBean, new AddressSearchBean(), null, null); - assertTrue(l2.size() == 10); - - clientSearchBean = new ClientSearchBean(); - clientSearchBean.setGender("FEMALE"); - l2 = clientService.findByCriteria(clientSearchBean, new AddressSearchBean(), null, null); - assertTrue(l2.size() == 0); - - clientSearchBean = new ClientSearchBean(); - clientSearchBean.setGender("FEMALE"); - clientSearchBean.setNameLike("fn"); - l2 = clientService.findByCriteria(clientSearchBean, new AddressSearchBean(), null, null); - assertTrue(l2.size() == 10); - - clientSearchBean.setNameLike("fn1"); - l2 = clientService.findByCriteria(clientSearchBean, new AddressSearchBean(), null, null); - assertTrue(l2.size() == 1); - } - - @Test - public void shouldFetchClientByIdentifier() { - String baseEntityId = "testclient2"; - Client c = new Client(baseEntityId).withBirthdate(new DateTime(), false).withFirstName("C first n") - .withLastName("C last n").withMiddleName("C middle n").withGender(Gender.MALE); - c.withAddress(new Address("birthplace", new DateTime(System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 2), - DateTime.now(), null, "lat", "lon", "75210", "Sindh", "Pakistan")); - c.withAttribute("ETHNICITY", "Mughal"); - c.withIdentifier("Program ID", "01001222"); - - clientService.addClient(c); - - Client ce = clientService.getByBaseEntityId("testclient2"); - assertEquals("testclient2", ce.getBaseEntityId()); - assertTrue(Client.class.getSimpleName().equals(ce.type())); - assertEquals("birthplace", ce.getAddresses().get(0).getAddressType()); - assertEquals("Mughal", ce.getAttribute("ethnicity")); - assertEquals("01001222", ce.getIdentifier("program id")); - - List ce2 = clientService.findAllByIdentifier("01001222"); - assertTrue(ce2.size() == 1); - assertEquals("testclient2", ce2.get(0).getBaseEntityId()); - - List ce3 = clientService.findAllByIdentifier("Program ID", "01001222"); - assertTrue(ce3.size() == 1); - assertEquals("testclient2", ce3.get(0).getBaseEntityId()); - } - - @Test - public void shouldFetchClientByAttribute() { - String baseEntityId = "testclient2"; - Client c = new Client(baseEntityId).withBirthdate(new DateTime(), false).withFirstName("C first n") - .withLastName("C last n").withMiddleName("C middle n").withGender(Gender.MALE); - c.withAddress(new Address("birthplace", new DateTime(System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 2), - DateTime.now(), null, "lat", "lon", "75210", "Sindh", "Pakistan")); - c.withAttribute("ETHNICITY", "Mughal"); - c.withIdentifier("Program ID", "01001222"); - - clientService.addClient(c); - - c = new Client("testclient3").withBirthdate(new DateTime(), false).withFirstName("C first n") - .withLastName("C last n").withMiddleName("C middle n").withGender(Gender.MALE); - c.withAttribute("ETHNICITY", "Mughal"); - c.addIdentifier("Program ID", "01001223"); - - clientService.addClient(c); - - List ce = clientService.findAllByAttribute("ETHNICITY", "Mughal"); - assertTrue(ce.size() == 2); - assertThat(ce, Matchers. hasItem(Matchers. hasProperty("baseEntityId", equalTo("testclient2")))); - assertThat(ce, Matchers. hasItem(Matchers. hasProperty("baseEntityId", equalTo("testclient3")))); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/it/AllErrorTraceIntegrationTest.java b/opensrp-core/src/test/java/org/opensrp/repository/it/AllErrorTraceIntegrationTest.java deleted file mode 100644 index b5332269a4..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/it/AllErrorTraceIntegrationTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.opensrp.repository.it; - -import static org.mockito.MockitoAnnotations.initMocks; - -import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.domain.ErrorTrace; -import org.opensrp.repository.couch.AllErrorTrace; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public class AllErrorTraceIntegrationTest { - - @Autowired - private AllErrorTrace allErrorTrace; - - @Before - public void setUp() throws Exception { - initMocks(this); - } - - @Test - public void shouldAddError() throws Exception { - //ErrorTrace error=new ErrorTrace(new Date(), "Error Testing" , "not availalbe","this is an Testing Error", "unsolved"); - ErrorTrace error = new ErrorTrace(); - error.setErrorType("error loggging test"); - error.setDate(DateTime.now()); - error.setStackTrace("Complete Stack Trace :"); - error.setStatus("unsolved"); - error.setDocumentType("Test Document"); - // error.setErrorType("test Error"); - allErrorTrace.add(error); - - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/it/AllEventsIntegrationTest.java b/opensrp-core/src/test/java/org/opensrp/repository/it/AllEventsIntegrationTest.java deleted file mode 100644 index 13f4ab3247..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/it/AllEventsIntegrationTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.opensrp.repository.it; - -import static org.junit.Assert.assertTrue; -import static org.mockito.MockitoAnnotations.initMocks; - -import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.domain.Event; -import org.opensrp.domain.Obs; -import org.opensrp.repository.couch.AllEvents; -import org.opensrp.service.EventService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public class AllEventsIntegrationTest { - - //TODO Detailed testing - @Autowired - private EventService eventService; - - @Autowired - private AllEvents allEvents; - - @Before - public void setUp() throws Exception { - allEvents.removeAll(); - initMocks(this); - } - - private void addEvents() { - for (int i = 0; i < 20; i++) { - Event e = new Event("entityid" + i, "Immunization", new DateTime(), "testentity", "demotest", "location" + i, - "formSubmission" + i + 100); - e.addObs(new Obs("concept", "txt", "1025AAAAAAAAAAAAAAAA", null, "2015-01-01", "comments test" + i, "bcg")); - e.addObs(new Obs("concept", "txt", "1026AAAAAAAAAAAAAAAA", null, "2015-01-01", "comments test" + i, "penta1")); - e.addObs(new Obs("concept", "txt", "1027AAAAAAAAAAAAAAAA", null, "2015-01-01", "comments test" + i, "penta2")); - e.addObs(new Obs("concept", "txt", "1028AAAAAAAAAAAAAAAA", null, "2015-01-01", "comments test" + i, "penta3")); - e.addObs(new Obs("concept", "txt", "1029AAAAAAAAAAAAAAAA", null, "2015-01-01", "comments test" + i, "mealses1")); - e.addObs(new Obs("concept", "txt", "1030AAAAAAAAAAAAAAAA", null, "2015-01-01", "comments test" + i, "measles2")); - e.addObs(new Obs("concept", "txt", "1029AAAAAAAAAAAAAAAA", null, "2015-01-01", "comments test" + i, "tt1")); - e.addObs(new Obs("concept", "txt", "1030AAAAAAAAAAAAAAAA", null, "2016-02-01", "comments test" + i, "tt2")); - eventService.addEvent(e); - } - } - - @Test - public void test() { - addEvents(); - assertTrue(eventService.getByBaseEntityAndFormSubmissionId("entityid0", "formSubmission0100") != null); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/it/AllLocationsIntegrationTest.java b/opensrp-core/src/test/java/org/opensrp/repository/it/AllLocationsIntegrationTest.java deleted file mode 100644 index 9ee726219e..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/it/AllLocationsIntegrationTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.opensrp.repository.it; - -import static org.mockito.MockitoAnnotations.initMocks; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.domain.Address; -import org.opensrp.repository.couch.AllLocations; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public class AllLocationsIntegrationTest { - - @Autowired - private AllLocations allLocations; - - @Before - public void setUp() throws Exception { - initMocks(this); - } - - @Test - public void shouldAddLocation() throws Exception { - Map addressFields = new HashMap(); - addressFields.put("PS", "Dimla"); - addressFields.put("Union", "Gaya Bari"); - addressFields.put("Ward", "Middle Gaya Bari"); - - Address address = new Address("Permanent", DateTime.now(), DateTime.now(), addressFields, "70.5", "40.5", "6300", "", - "Bangladesh"); - - Map identifiers = new HashMap(); - identifiers.put("identifier-1", "FWA0001"); - - Set tags = new HashSet(); - tags.add("tag1"); - tags.add("tag2"); - - Map attributes = new HashMap(); - - attributes.put("attr1", "value1"); - attributes.put("attr2", "value2"); - - org.opensrp.domain.Location domainLocation = new org.opensrp.domain.Location().withLocationId("10203040") - .withName("Dimla").withAddress(address).withIdentifiers(identifiers).withAttributes(attributes) - .withTags(tags); - - allLocations.add(domainLocation); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/it/AllProvidersIntegrationTest.java b/opensrp-core/src/test/java/org/opensrp/repository/it/AllProvidersIntegrationTest.java deleted file mode 100644 index 91e3170921..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/it/AllProvidersIntegrationTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.opensrp.repository.it; - -import static org.mockito.MockitoAnnotations.initMocks; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.repository.couch.AllProviders; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public class AllProvidersIntegrationTest { - - @Autowired - private AllProviders allProviders; - - @Before - public void setUp() throws Exception { - initMocks(this); - } - - @Test - public void shouldAddProvider() { - /*Map identifiers = new HashMap(); - identifiers.put("identifier-1", - "FWA-1"); - - - org.opensrp.domain.Provider domainProvider = new org.opensrp.domain.Provider() - .withBaseEntityId("0001") - .withIdentifiers(identifiers); - - - allProviders.add(domainProvider);*/ - - org.opensrp.domain.Provider baseEntityIdInProvider = allProviders.findByBaseEntityId("0001"); - - //assertThat(allBaseEntitiesInDB, is(asList(domainBaseEntity))); - //assertThat(baseEntityIdInProvider.getBaseEntityId(), is("0001")); - - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/it/AllUsersIntegrationTest.java b/opensrp-core/src/test/java/org/opensrp/repository/it/AllUsersIntegrationTest.java deleted file mode 100644 index 78d6dacdce..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/it/AllUsersIntegrationTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.opensrp.repository.it; - -import static org.mockito.MockitoAnnotations.initMocks; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.domain.BaseEntity; -import org.opensrp.domain.User; -import org.opensrp.repository.couch.AllBaseEntities; -import org.opensrp.repository.couch.AllUsers; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public class AllUsersIntegrationTest { - - @Autowired - private AllUsers allUsers; - - @Autowired - private AllBaseEntities allBaseEntities; - - @Before - public void setUp() throws Exception { - initMocks(this); - } - - @Test - public void shouldAddUser() throws Exception { - List permissions = new ArrayList<>(); - permissions.add("add"); - permissions.add("edit"); - permissions.add("delete"); - - List roles = new ArrayList<>(); - roles.add("tlp"); - - BaseEntity baseEntity = allBaseEntities.findByBaseEntityId("0001"); - - User domainUser = new User("0001").withUsername("FWA2").withPassword("77ba08ff5832b6c4143c51160b7e9bab7b72d98a") - .withSalt("1efa26b9-9cc9-40df-aecb-14836069a8f8").withStatus("active").withPermissions(permissions) - .withRoles(roles); - - //domainUser.isDefaultAdmin(); - - allUsers.add(domainUser); - - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/it/ConfigServiceIntegrationTest.java b/opensrp-core/src/test/java/org/opensrp/repository/it/ConfigServiceIntegrationTest.java deleted file mode 100644 index b32aef2ce4..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/it/ConfigServiceIntegrationTest.java +++ /dev/null @@ -1,140 +0,0 @@ -package org.opensrp.repository.it; - -import static org.junit.Assert.assertEquals; - -import org.joda.time.LocalDate; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.opensrp.common.AllConstants.Config; -import org.opensrp.repository.couch.AllAppStateTokens; -import org.opensrp.service.ConfigService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class ConfigServiceIntegrationTest { - - public enum TestToken { - token1_int(Integer.valueOf(12)), - token2_long(Long.valueOf(1234567890123L)), - token3_string("test string"), - token5_datetime(LocalDate.now()), - token6_float(Float.valueOf("21212.3323")), - token7_double(Double.valueOf(43748384.347384738)), - token9_boolean(Boolean.valueOf(true)); - - private Object value; - - public Object value() { - return value; - } - - private TestToken(Object value) { - this.value = value; - } - } - - @Autowired - private AllAppStateTokens alltokens; - - private static AllAppStateTokens allAppTokens; - - @Autowired - private ConfigService configService; - - @Before - public void setUp() { - if (allAppTokens == null) { - alltokens.removeAll(); - allAppTokens = alltokens; - - for (TestToken tk : TestToken.values()) { - configService.registerAppStateToken(tk, tk.value(), tk.name(), false); - } - - for (TestToken tk : TestToken.values()) { - assertEquals(tk.name(), configService.getAppStateTokenByName(tk).getName()); - } - } - } - - @AfterClass - public static void cleanup() { - allAppTokens.removeAll(); - } - - @Test - public void shouldGetIntToken() { - TestToken tk = TestToken.token1_int; - assertEquals(tk.value(), configService.getAppStateTokenByName(tk).intValue()); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionForRegisteringDuplicateEntryFlaggedAsDonotSuppressException() { - configService.registerAppStateToken(TestToken.token1_int, "", "token1_int", false); - } - - @Test - public void shouldNotThrowExceptionForRegisteringDuplicateEntryFlaggedAsSuppressException() { - configService.registerAppStateToken(TestToken.token1_int, "", "token1_int", true); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionForRegisteringWithMissingDescription() { - configService.registerAppStateToken(TestToken.token1_int, "", "", false); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionForRegisteringWithMissingName() { - configService.registerAppStateToken(null, "", "", false); - } - - @Test(expected = IllegalStateException.class) - public void shouldThrowExceptionForUpdatingWithNonExistentName() { - configService.updateAppStateToken(Config.FORM_ENTITY_PARSER_LAST_SYNCED_FORM_SUBMISSION, ""); - } - - @Test - public void shouldGetLongToken() { - TestToken tk = TestToken.token2_long; - assertEquals(tk.value(), configService.getAppStateTokenByName(tk).longValue()); - } - - @Test - public void shouldGetStringToken() { - TestToken tk = TestToken.token3_string; - assertEquals(tk.value(), configService.getAppStateTokenByName(tk).stringValue()); - } - - @Test - public void shouldGetDatetimeToken() { - TestToken tk = TestToken.token5_datetime; - assertEquals(tk.value(), configService.getAppStateTokenByName(tk).datetimeValue()); - } - - @Test - public void shouldGetFloatToken() { - TestToken tk = TestToken.token6_float; - assertEquals(tk.value(), configService.getAppStateTokenByName(tk).floatValue()); - } - - @Test - public void shouldGetDoubleToken() { - TestToken tk = TestToken.token7_double; - assertEquals(tk.value(), configService.getAppStateTokenByName(tk).doubleValue()); - } - - @Test - public void shouldGetBooleanToken() { - TestToken tk = TestToken.token9_boolean; - assertEquals(tk.value(), configService.getAppStateTokenByName(tk).booleanValue()); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/it/FormLifeCycleTest.java b/opensrp-core/src/test/java/org/opensrp/repository/it/FormLifeCycleTest.java deleted file mode 100644 index 9b514e13c0..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/it/FormLifeCycleTest.java +++ /dev/null @@ -1,256 +0,0 @@ -package org.opensrp.repository.it; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.ektorp.CouchDbConnector; -import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.motechproject.model.MotechBaseDataObject; -import org.motechproject.scheduletracking.api.domain.Enrollment; -import org.motechproject.scheduletracking.api.domain.EnrollmentStatus; -import org.motechproject.scheduletracking.api.domain.WindowName; -import org.motechproject.scheduletracking.api.repository.AllEnrollments; -import org.opensrp.api.domain.Client; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.Event; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.service.FormSubmissionService; -import org.opensrp.repository.couch.AllClients; -import org.opensrp.repository.couch.AllEvents; -import org.opensrp.scheduler.Action; -import org.opensrp.scheduler.Alert; -import org.opensrp.scheduler.AlertCreationAction; -import org.opensrp.scheduler.HealthSchedulerService; -import org.opensrp.scheduler.repository.couch.AllActions; -import org.opensrp.scheduler.repository.couch.AllAlerts; -import org.opensrp.service.ClientService; -import org.opensrp.service.EventService; -import org.opensrp.service.formSubmission.FormEntityConverter; -import org.opensrp.service.formSubmission.FormSubmissionProcessor; -import org.opensrp.service.formSubmission.handler.CustomFormSubmissionHandler; -import org.opensrp.service.formSubmission.handler.FormSubmissionRouter; -import org.opensrp.service.formSubmission.handler.HandlerMapper; -import org.opensrp.service.formSubmission.ziggy.EntityDataMap; -import org.opensrp.service.formSubmission.ziggy.ZiggyService; -import org.opensrp.util.ScheduleBuilder; -import org.opensrp.util.TestResourceLoader; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public class FormLifeCycleTest extends TestResourceLoader { - - public FormLifeCycleTest() throws IOException { - super(); - } - - private List docsToRemove = new ArrayList<>(); - - @Autowired - @Qualifier(AllConstants.OPENSRP_DATABASE_CONNECTOR) - private CouchDbConnector db; - - @Autowired - private FormSubmissionProcessor fsp; - - @Autowired - private ZiggyService ziggyService; - - @Autowired - private FormSubmissionRouter formSubmissionRouter; - - @Autowired - private FormEntityConverter formEntityConverter; - - /*@Autowired - private ActionService actionService; - @Autowired - private ScheduleService schService;*/ - @Autowired - private HealthSchedulerService scheduleService; - - @Autowired - private ClientService clientService; - - @Autowired - private EventService eventService; - - @Autowired - private HandlerMapper hmap; - - @Autowired - private EntityDataMap edmap; - - @Mock - private FormSubmissionService formSubmissionService; - - private AlertCreationAction reminderAction; - - private DateTime dueWindowStart; - - private DateTime lateWindowStart; - - private DateTime maxWindowStart; - - @Autowired - private AllActions allActions; - - @Autowired - private AllAlerts allAlerts; - - @Autowired - private AllClients allClients; - - @Autowired - private AllEvents allEvents; - - @Autowired - private AllEnrollments allEnrollments; - - @Before - public void setup() throws IOException { - initMocks(this); - - allEnrollments.removeAll(); - allClients.removeAll(); - allEvents.removeAll(); - allActions.removeAll(); - allAlerts.removeAll(); - - fsp = new FormSubmissionProcessor(ziggyService, formSubmissionRouter, formEntityConverter, scheduleService, - clientService, allClients, eventService, allEvents); - reminderAction = new AlertCreationAction(scheduleService, formSubmissionService); - - dueWindowStart = DateTime.now(); - lateWindowStart = DateTime.now().plusDays(10); - maxWindowStart = DateTime.now().plusDays(20); - } - - @Ignore - @Test //TODO - public void shouldCreateClientAndEventAndSchedulesAllDynamic() throws Exception { - FormSubmission fs = getFormSubmissionFor("child_enrollment", 1); - //child birthdate is 10/Nov/2015 - fsp.processFormSubmission(fs); - - assertNotNull(clientService.getByBaseEntityId(fs.entityId())); - List evl = allEvents.findByBaseEntityId(fs.entityId()); - assertTrue(evl.size() == 1); - //TODO assertTrue(eventService.findEventsBy(fs.entityId(), null, "Enrollement Vaccination Register", null, "pkchild", 0, Long.MAX_VALUE).size() == 1); - Enrollment p1schedule = scheduleService.getEnrollment(fs.entityId(), "PENTAVALENT 1"); - assertNotNull(p1schedule); - assertTrue(p1schedule.isActive()); - assertFalse(p1schedule.isCompleted()); - assertEquals(p1schedule.getStatus(), EnrollmentStatus.ACTIVE); - assertEquals(p1schedule.getLastFulfilledDate(), null); - assertTrue(p1schedule.getFulfillments().isEmpty()); - - Enrollment m1schedule = scheduleService.getActiveEnrollment(fs.entityId(), "Measles 1"); - assertNotNull(m1schedule); - assertTrue(m1schedule.isActive()); - assertFalse(m1schedule.isCompleted()); - assertEquals(m1schedule.getStatus(), EnrollmentStatus.ACTIVE); - assertEquals(m1schedule.getLastFulfilledDate(), null); - assertTrue(m1schedule.getFulfillments().isEmpty()); - - when(formSubmissionService.findByInstanceId(fs.instanceId())).thenReturn(fs); - - reminderAction.invoke(ScheduleBuilder.event(fs.entityId(), "PENTAVALENT 1", "penta1", WindowName.earliest, - p1schedule.getStartOfWindowForCurrentMilestone(WindowName.due), - p1schedule.getStartOfWindowForCurrentMilestone(WindowName.late), - p1schedule.getStartOfWindowForCurrentMilestone(WindowName.max)), null); - - List acl = allActions.findByCaseIdScheduleAndTimeStamp(fs.entityId(), p1schedule.getScheduleName(), - new DateTime(0), new DateTime(System.currentTimeMillis())); - assertTrue(acl.size() == 1); - Action ac = acl.get(0); - assertEquals(fs.anmId(), ac.providerId()); - assertEquals(fs.entityId(), ac.baseEntityId()); - assertEquals("createAlert", ac.getActionType()); - assertEquals("alert", ac.getActionTarget()); - assertEquals(true, ac.getIsActionActive()); - assertEquals(fs.bindType(), ac.data().get("beneficiaryType")); - assertEquals(p1schedule.getScheduleName(), ac.data().get("scheduleName")); - assertEquals("pentavalent_1", ac.data().get("visitCode")); - assertEquals(p1schedule.getStartOfWindowForCurrentMilestone(WindowName.due).toLocalDate().toString(), - ac.data().get("startDate")); - assertEquals(p1schedule.getStartOfWindowForCurrentMilestone(WindowName.late).toLocalDate().toString(), - ac.data().get("expiryDate")); - - List all = allAlerts.findByEntityIdTriggerAndTimeStamp(fs.entityId(), p1schedule.getScheduleName(), - new DateTime(0), new DateTime(System.currentTimeMillis())); - assertTrue(all.size() == 1); - Alert al = all.get(0); - assertEquals(fs.anmId(), al.providerId()); - assertEquals(fs.entityId(), al.entityId()); - assertEquals("upcoming", al.alertStatus()); - assertEquals("notification", al.alertType()); - assertEquals("pkchild", al.beneficiaryType()); - assertEquals(p1schedule.getStartOfWindowForCurrentMilestone(WindowName.late).toLocalDate().toString(), - al.expiryDate()); - assertEquals(p1schedule.getStartOfWindowForCurrentMilestone(WindowName.due).toLocalDate().toString(), - al.startDate()); - assertEquals(true, al.isActive()); - assertEquals("penta1", al.triggerCode()); - assertEquals("PENTAVALENT 1", al.triggerName()); - assertEquals("schedule", al.triggerType()); - - //TODO followup handling - } - - @Test - @Ignore //FIXME - public void shouldCreateClientAndEventAndSchedulesWithRouter() throws Exception { - hmap.addCustomFormSubmissionHandler("pnc_1st_registration", new CustomFormSubmissionHandler() { - - @Override - public void handle(FormSubmission submission) { - assertEquals("pnc_1st_registration", submission.formName()); - assertEquals("b716d938-1aea-40ae-a081-9ddddddcccc9", submission.entityId()); - assertEquals("admin", submission.anmId()); - assertEquals("demo_mother", submission.bindType()); - System.out.println("I want to call scheduler myself :D"); - } - }); - FormSubmission fs = getFormSubmissionFor("pnc_1st_registration"); - fsp.processFormSubmission(fs); - - } - - @Test - @Ignore - public void shouldCreateClientAndEventAndSchedulesWithZiggy() throws Exception { - hmap.addCustomFormSubmissionHandler("new_household_registration", new CustomFormSubmissionHandler() { - - @Override - public void handle(FormSubmission submission) { - assertEquals("new_household_registration", submission.formName()); - assertEquals("b716d938-1aea-40ae-a081-9ddddddcccc9", submission.entityId()); - assertEquals("admin", submission.anmId()); - assertEquals("household", submission.bindType()); - System.out.println("I am Ziggy scheduler"); - } - }); - edmap.addEntity("household", Client.class); - - FormSubmission fs = getFormSubmissionFor("new_household_registration", 1); - - fsp.processFormSubmission(fs); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/it/ScheduleLifeCycleTest.java b/opensrp-core/src/test/java/org/opensrp/repository/it/ScheduleLifeCycleTest.java deleted file mode 100644 index 3aa0259b4c..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/it/ScheduleLifeCycleTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.opensrp.repository.it; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.motechproject.scheduletracking.api.repository.AllEnrollments; -import org.opensrp.scheduler.service.ScheduleService; -import org.opensrp.util.TestResourceLoader; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public class ScheduleLifeCycleTest extends TestResourceLoader { - - public ScheduleLifeCycleTest() throws IOException { - super(); - } - - @Autowired - private ScheduleService scheduleService; - - @Autowired - private AllEnrollments allEnrollments; - - @Test - public void name() { - List keys = new ArrayList(); - // Enrollment l2 = allEnrollments.getActiveEnrollment("4634", "hshdsd"); - // l2.toString(); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/it/ZiggyServiceTest.java b/opensrp-core/src/test/java/org/opensrp/repository/it/ZiggyServiceTest.java deleted file mode 100644 index f0ba3bb479..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/it/ZiggyServiceTest.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.opensrp.repository.it; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -import java.io.IOException; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.service.FormSubmissionService; -import org.opensrp.service.formSubmission.handler.CustomFormSubmissionHandler; -import org.opensrp.service.formSubmission.handler.FormSubmissionRouter; -import org.opensrp.service.formSubmission.handler.HandlerMapper; -import org.opensrp.service.formSubmission.ziggy.EntityDataMap; -import org.opensrp.service.formSubmission.ziggy.ZiggyDataHandler; -import org.opensrp.service.formSubmission.ziggy.ZiggyFileLoader; -import org.opensrp.service.formSubmission.ziggy.ZiggyService; -import org.opensrp.util.TestResourceLoader; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import com.google.gson.Gson; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public class ZiggyServiceTest extends TestResourceLoader { - - public ZiggyServiceTest() throws IOException { - super(); - } - - @Mock - private ZiggyDataHandler ziggyDataHandler; - - @Autowired - private EntityDataMap edmap; - - @Autowired - @Value("#{opensrp['form.directory.name']}") - private String formFilePath; - - @Autowired - @Value("#{opensrp['js.directory.name']}") - private String jsDirectoryName; - - @Mock - private FormSubmissionService formSubmissionService; - - private ZiggyFileLoader ziggyFileLoader; - - @Mock - private HandlerMapper handlerMapper; - - @Before - public void setUp() throws Exception { - initMocks(this); - ziggyFileLoader = new ZiggyFileLoader(jsDirectoryName, formFilePath); - } - - @Test - public void test() throws Exception { - String params = "{\"instanceId\":\"88c0e824-10b4-44c2-9429-754b8d823776\", \"anmId\":\"demotest\", \"entityId\":\"a3f2abf4-2699-4761-819a-cea739224164\",\"formName\":\"new_household_registration\",\"clientVersion\":\"1430997074596\", \"serverVersion\": \"1430998001293\"}"; - FormSubmission fs = getFormSubmissionFor("new_household_registration", 1); - String formInstance = new Gson().toJson(fs.instance()); - - when(formSubmissionService.findByInstanceId("88c0e824-10b4-44c2-9429-754b8d823776")).thenReturn(fs); - when(ziggyDataHandler.saveEntity(eq("household"), any(String.class))) - .thenReturn("a3f2abf4-2699-4761-819a-cea739224164"); - - handlerMapper = new HandlerMapper().addCustomFormSubmissionHandler("new_household_registration", - new CustomFormSubmissionHandler() { - - @Override - public void handle(FormSubmission submission) { - System.out.println("CUSTOM FORM CALLED"); - assertEquals("new_household_registration", submission.formName()); - assertEquals("demotest", submission.anmId()); - assertEquals("a3f2abf4-2699-4761-819a-cea739224164", submission.entityId()); - assertEquals("household", submission.bindType()); - } - }); - - ZiggyService service = new ZiggyService(ziggyFileLoader, ziggyDataHandler, - new FormSubmissionRouter(formSubmissionService, handlerMapper)); - - service.saveForm(params, formInstance); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/lucene/it/LuceneActionRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/lucene/it/LuceneActionRepositoryTest.java deleted file mode 100644 index 429df39214..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/lucene/it/LuceneActionRepositoryTest.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.opensrp.repository.lucene.it; - -import static org.opensrp.util.SampleFullDomainObject.BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.DIFFERENT_BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.EPOCH_DATE_TIME; -import static org.opensrp.util.SampleFullDomainObject.PROVIDER_ID; -import static org.utils.AssertionUtil.assertTwoListAreSameIgnoringOrder; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; - -import java.util.Arrays; -import java.util.List; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.dto.ActionData; -import org.opensrp.dto.AlertStatus; -import org.opensrp.repository.lucene.LuceneActionRepository; -import org.opensrp.scheduler.Action; -import org.opensrp.scheduler.repository.couch.AllActions; -import org.springframework.beans.factory.annotation.Autowired; - -public class LuceneActionRepositoryTest extends BaseIntegrationTest { - - @Autowired - private AllActions allActions; - - @Autowired - private LuceneActionRepository luceneActionRepository; - - @Before - public void setUp() { - allActions.removeAll(); - } - - @After - public void cleanUp() { - //allActions.removeAll(); - } - - @Test - public void shouldFindByAllCriteria() { - ActionData actionData = ActionData.createAlert("beneficiaryType", "scheduleName", "visitCode", AlertStatus.normal, - EPOCH_DATE_TIME, EPOCH_DATE_TIME); - Action expectedAction = new Action(BASE_ENTITY_ID, PROVIDER_ID, actionData); - Action expectedAction2 = new Action(DIFFERENT_BASE_ENTITY_ID, DIFFERENT_BASE_ENTITY_ID, actionData); - List expectedActions = Arrays.asList(expectedAction, expectedAction2); - addObjectToRepository(expectedActions, allActions); - - String teamIds = PROVIDER_ID + "," + DIFFERENT_BASE_ENTITY_ID; - List actualActions = luceneActionRepository.getByCriteria(teamIds, PROVIDER_ID, EPOCH_DATE_TIME.getMillis(), - null, "desc", 100); - - assertTwoListAreSameIgnoringOrder(expectedActions, actualActions); - } - - //TODO: fix source - @Test(expected = NullPointerException.class) - public void throwExceptionIfNoSortOrderSpecified() { - ActionData actionData = ActionData.createAlert("beneficiaryType", "scheduleName", "visitCode", AlertStatus.normal, - EPOCH_DATE_TIME, EPOCH_DATE_TIME); - Action expectedAction = new Action(BASE_ENTITY_ID, PROVIDER_ID, actionData); - Action expectedAction2 = new Action(DIFFERENT_BASE_ENTITY_ID, DIFFERENT_BASE_ENTITY_ID, actionData); - List expectedActions = Arrays.asList(expectedAction, expectedAction2); - addObjectToRepository(expectedActions, allActions); - - String teamIds = PROVIDER_ID + "," + DIFFERENT_BASE_ENTITY_ID; - luceneActionRepository.getByCriteria(teamIds, PROVIDER_ID, EPOCH_DATE_TIME.getMillis(), null, null, 100); - } - - @Test(expected = RuntimeException.class) - public void shouldThrowExceptionIfNoFilterAdded() { - luceneActionRepository.getByCriteria(null, null, null, null, null, 100); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/lucene/it/LuceneClientRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/lucene/it/LuceneClientRepositoryTest.java deleted file mode 100644 index d9f8435f62..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/lucene/it/LuceneClientRepositoryTest.java +++ /dev/null @@ -1,431 +0,0 @@ -package org.opensrp.repository.lucene.it; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.opensrp.common.AllConstants.BaseEntity.BASE_ENTITY_ID; -import static org.opensrp.common.AllConstants.BaseEntity.MOTHERS_INDENTIFIER; -import static org.opensrp.util.SampleFullDomainObject.ATTRIBUTES_TYPE; -import static org.opensrp.util.SampleFullDomainObject.DIFFERENT_BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.EPOCH_DATE_TIME; -import static org.opensrp.util.SampleFullDomainObject.FEMALE; -import static org.opensrp.util.SampleFullDomainObject.FIRST_NAME; -import static org.opensrp.util.SampleFullDomainObject.IDENTIFIER_VALUE; -import static org.opensrp.util.SampleFullDomainObject.attributes; -import static org.opensrp.util.SampleFullDomainObject.getAddress; -import static org.utils.AssertionUtil.assertTwoListAreSameIgnoringOrder; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; - -import java.util.Collections; -import java.util.List; - -import org.ektorp.DbAccessException; -import org.joda.time.DateTime; -import org.joda.time.DateTimeZone; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.domain.Address; -import org.opensrp.domain.Client; -import org.opensrp.repository.couch.AllClients; -import org.opensrp.repository.lucene.LuceneClientRepository; -import org.opensrp.search.AddressSearchBean; -import org.opensrp.search.ClientSearchBean; -import org.springframework.beans.factory.annotation.Autowired; - -//TODO: test birthDate range -public class LuceneClientRepositoryTest extends BaseIntegrationTest { - - @Autowired - public AllClients allClients; - - @Autowired - LuceneClientRepository luceneClientRepository; - - @Before - public void setUp() { - allClients.removeAll(); - } - - @After - public void cleanUp() { - //allClients.removeAll(); - } - - @Test - public void shouldFindBasedOnFirstNameCriteria() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike(expectedClient.getFirstName()); - List actualClients = luceneClientRepository.getByCriteria(clientSearchBean, null); - - assertEquals(expectedClient, actualClients.get(0)); - } - - @Test(expected = RuntimeException.class) - public void shouldThrowExceptionIfNoCriteriaIsSelected() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - List actualClients = luceneClientRepository.getByCriteria(new ClientSearchBean(), null); - - assertEquals(expectedClient, actualClients.get(0)); - } - - @Test(expected = NullPointerException.class) - public void shouldThrowExceptionWithOutClientBirthDateField() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike(expectedClient.getFirstName()); - luceneClientRepository.getByCriteria(clientSearchBean, null); - - } - - @Test(expected = NullPointerException.class) - public void shouldThrowExceptionWithClientNullBirthDateField() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - expectedClient.setDateCreated(null); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike(expectedClient.getFirstName()); - luceneClientRepository.getByCriteria(clientSearchBean, null); - - } - - @Test(expected = NullPointerException.class) - public void shouldThrowExceptionWithOutClientDateCreatedField() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike(expectedClient.getFirstName()); - luceneClientRepository.getByCriteria(clientSearchBean, null); - - } - - @Test(expected = NullPointerException.class) - public void shouldThrowExceptionWithClientNullDateCreatedField() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - expectedClient.setDateCreated(null); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike(expectedClient.getFirstName()); - luceneClientRepository.getByCriteria(clientSearchBean, null); - - } - - @Test - public void shouldNotFindWithOutClientAddressField() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike(expectedClient.getFirstName()); - List actualClients = luceneClientRepository.getByCriteria(clientSearchBean, new AddressSearchBean(), null); - - assertTrue(actualClients.isEmpty()); - } - - @Test - public void shouldNotFindWithClientNullAddressField() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setAddresses(null); - - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike(expectedClient.getFirstName()); - List actualClients = luceneClientRepository.getByCriteria(clientSearchBean, new AddressSearchBean(), null); - - assertTrue(actualClients.isEmpty()); - } - - @Test - public void shouldNotFindWithClientEmptyAddressField() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setAddresses(Collections.EMPTY_LIST); - - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike(expectedClient.getFirstName()); - List actualClients = luceneClientRepository.getByCriteria(clientSearchBean, new AddressSearchBean(), null); - - assertTrue(actualClients.isEmpty()); - } - - //TODO:Fix source - @Test - public void canNotSearchWithDeathDate() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - expectedClient.setDeathdate(new DateTime(DateTimeZone.UTC)); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike(expectedClient.getFirstName()); - clientSearchBean.setDeathdateFrom(EPOCH_DATE_TIME); - clientSearchBean.setDeathdateTo(new DateTime(DateTimeZone.UTC)); - List actualClients = luceneClientRepository.getByCriteria(clientSearchBean, new AddressSearchBean(), null); - - assertEquals(0, actualClients.size()); - } - - @Test - public void shouldFindBasedOnAll() { - addRandomInvalidClient(); - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - expectedClient.setGender(FEMALE); - expectedClient.setDateEdited(EPOCH_DATE_TIME); - expectedClient.setAttributes(attributes); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike(expectedClient.getFirstName()); - clientSearchBean.setGender(expectedClient.getGender()); - clientSearchBean.setBirthdateFrom(EPOCH_DATE_TIME); - clientSearchBean.setBirthdateTo(new DateTime()); - clientSearchBean.setAttributeType(ATTRIBUTES_TYPE); - clientSearchBean.setAttributeValue(IDENTIFIER_VALUE); - clientSearchBean.setLastEditFrom(EPOCH_DATE_TIME); - clientSearchBean.setLastEditTo(new DateTime(DateTimeZone.UTC)); - - AddressSearchBean addressSearchBean = new AddressSearchBean(); - addressSearchBean.setAddressType(getAddress().getAddressType()); - addressSearchBean.setCountry(getAddress().getCountry()); - addressSearchBean.setStateProvince(getAddress().getStateProvince()); - addressSearchBean.setCityVillage(getAddress().getCityVillage()); - addressSearchBean.setCountyDistrict(getAddress().getCountyDistrict()); - addressSearchBean.setSubDistrict(getAddress().getSubDistrict()); - addressSearchBean.setTown(getAddress().getTown()); - addressSearchBean.setSubTown(getAddress().getSubTown()); - List actualClients = luceneClientRepository.getByCriteria(clientSearchBean, addressSearchBean, null); - - assertEquals(1, actualClients.size()); - assertEquals(expectedClient, actualClients.get(0)); - } - - @Test - public void shouldFindByWithOutAddressCriteria() { - addRandomInvalidClient(); - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - expectedClient.setGender(FEMALE); - expectedClient.setDateEdited(EPOCH_DATE_TIME); - expectedClient.setAttributes(attributes); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike(expectedClient.getFirstName()); - clientSearchBean.setGender(expectedClient.getGender()); - clientSearchBean.setBirthdateFrom(EPOCH_DATE_TIME); - clientSearchBean.setBirthdateTo(new DateTime()); - clientSearchBean.setAttributeType(ATTRIBUTES_TYPE); - clientSearchBean.setAttributeValue(IDENTIFIER_VALUE); - clientSearchBean.setLastEditFrom(EPOCH_DATE_TIME); - clientSearchBean.setLastEditTo(new DateTime(DateTimeZone.UTC)); - - List actualClients = luceneClientRepository.getByCriteria(clientSearchBean, null); - - assertEquals(1, actualClients.size()); - assertEquals(expectedClient, actualClients.get(0)); - } - - @Test - public void shouldFindByWithOutNameAndGenderAndBirthDateAndDeathDateAndAttributes() { - addRandomInvalidClient(); - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - expectedClient.setGender(FEMALE); - expectedClient.setDateEdited(EPOCH_DATE_TIME); - expectedClient.setAttributes(attributes); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - AddressSearchBean addressSearchBean = new AddressSearchBean(); - addressSearchBean.setAddressType(getAddress().getAddressType()); - addressSearchBean.setCountry(getAddress().getCountry()); - addressSearchBean.setStateProvince(getAddress().getStateProvince()); - addressSearchBean.setCityVillage(getAddress().getCityVillage()); - addressSearchBean.setCountyDistrict(getAddress().getCountyDistrict()); - addressSearchBean.setSubDistrict(getAddress().getSubDistrict()); - addressSearchBean.setTown(getAddress().getTown()); - addressSearchBean.setSubTown(getAddress().getSubTown()); - - List actualClients = luceneClientRepository.getByCriteria(addressSearchBean, EPOCH_DATE_TIME, - new DateTime(DateTimeZone.UTC), null); - assertEquals(1, actualClients.size()); - assertEquals(expectedClient, actualClients.get(0)); - } - - @Test - public void shouldFindByStringQuery() { - String query = "(firstName:\"firstName\"OR middleName:\"firstName\"OR lastName:\"firstName\")AND gender:female AND birthdate:[1970-01-01T00:00:00 TO 2017-08-30T10:29:01] AND lastEdited:[1970-01-01T00:00:00 TO 2017-08-30T04:29:01] AND attributesType:attributesValue AND addressType:addressType AND country:country AND stateProvince:stateProvince AND cityVillage:cityVillage AND countyDistrict:countryDistrict AND subDistrict:subDistrict AND town:town"; - addRandomInvalidClient(); - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - expectedClient.setGender(FEMALE); - expectedClient.setDateEdited(EPOCH_DATE_TIME); - expectedClient.setAttributes(attributes); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - List actualClients = luceneClientRepository.getByCriteria(query); - - assertEquals(1, actualClients.size()); - assertEquals(expectedClient, actualClients.get(0)); - } - - //TODO: Fix source - @Test(expected = DbAccessException.class) - public void throwExcetionMotherIdentifierInRelationship() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - expectedClient.addRelationship(MOTHERS_INDENTIFIER, IDENTIFIER_VALUE); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - List actualClients = luceneClientRepository.getByClientByMother(MOTHERS_INDENTIFIER, IDENTIFIER_VALUE); - assertEquals(0, actualClients.size()); - } - - @Test - public void shouldFindByBaseEntityFieldAndValue() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - List actualClients = luceneClientRepository.getByFieldValue(BASE_ENTITY_ID, BASE_ENTITY_ID); - assertEquals(1, actualClients.size()); - assertEquals(expectedClient, actualClients.get(0)); - } - - @Test - public void shouldReturnEmptyForBaseEntityFieldAndValue() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - String value = null; - - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - List actualClients = luceneClientRepository.getByFieldValue(BASE_ENTITY_ID, value); - assertEquals(0, actualClients.size()); - } - - @Test - public void shouldFindByBaseEntityFieldAndValues() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - - Client expectedClient2 = new Client(DIFFERENT_BASE_ENTITY_ID); - expectedClient2.setFirstName(FIRST_NAME); - expectedClient2.setBirthdate(EPOCH_DATE_TIME); - expectedClient2.setAddresses(asList(getAddress())); - expectedClient2.setDateCreated(EPOCH_DATE_TIME); - - addObjectToRepository(asList(expectedClient, expectedClient2), allClients); - - List actualClients = luceneClientRepository.getByFieldValue(BASE_ENTITY_ID, - asList(BASE_ENTITY_ID, DIFFERENT_BASE_ENTITY_ID)); - assertEquals(2, actualClients.size()); - assertTwoListAreSameIgnoringOrder(asList(expectedClient, expectedClient2), actualClients); - } - - @Test - public void shouldReturnEmptyForNullOrEmptyValues() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - - Client expectedClient2 = new Client(DIFFERENT_BASE_ENTITY_ID); - expectedClient2.setFirstName(FIRST_NAME); - expectedClient2.setBirthdate(EPOCH_DATE_TIME); - expectedClient2.setAddresses(asList(getAddress())); - expectedClient2.setDateCreated(EPOCH_DATE_TIME); - - addObjectToRepository(asList(expectedClient, expectedClient2), allClients); - - List actualClients = luceneClientRepository.getByFieldValue(BASE_ENTITY_ID, Collections.EMPTY_LIST); - assertEquals(0, actualClients.size()); - - List nullList = null; - actualClients = luceneClientRepository.getByFieldValue(BASE_ENTITY_ID, nullList); - assertEquals(0, actualClients.size()); - - } - - private void addRandomInvalidClient() { - for (int i = 0; i < 100; i++) { - Client client = new Client(BASE_ENTITY_ID + i); - client.setFirstName(FIRST_NAME + i); - client.setBirthdate(EPOCH_DATE_TIME); - client.setAddresses(asList(new Address())); - client.setDateCreated(EPOCH_DATE_TIME); - client.setGender(FEMALE); - client.setDateEdited(EPOCH_DATE_TIME); - client.setAttributes(attributes); - addObjectToRepository(Collections.singletonList(client), allClients); - } - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/lucene/it/LuceneEventRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/lucene/it/LuceneEventRepositoryTest.java deleted file mode 100644 index 6b8cd05148..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/lucene/it/LuceneEventRepositoryTest.java +++ /dev/null @@ -1,260 +0,0 @@ -package org.opensrp.repository.lucene.it; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.opensrp.util.SampleFullDomainObject.BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.DIFFERENT_BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.ENTITY_TYPE; -import static org.opensrp.util.SampleFullDomainObject.EPOCH_DATE_TIME; -import static org.opensrp.util.SampleFullDomainObject.EVENT_TYPE; -import static org.opensrp.util.SampleFullDomainObject.LOCATION_ID; -import static org.opensrp.util.SampleFullDomainObject.PROVIDER_ID; -import static org.utils.AssertionUtil.assertTwoListAreSameIgnoringOrder; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; - -import java.util.List; - -import org.ektorp.DbAccessException; -import org.joda.time.DateTime; -import org.joda.time.DateTimeZone; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.domain.Event; -import org.opensrp.repository.couch.AllEvents; -import org.opensrp.repository.lucene.LuceneEventRepository; -import org.opensrp.search.EventSearchBean; -import org.springframework.beans.factory.annotation.Autowired; - -public class LuceneEventRepositoryTest extends BaseIntegrationTest { - - @Autowired - private AllEvents allEvents; - - @Autowired - private LuceneEventRepository luceneEventRepository; - - @Before - public void setUp() { - allEvents.removeAll(); - } - - @After - public void cleanUp() { - //allEvents.removeAll(); - } - - @Test - public void shouldFindByBaseEntityId() { - Event expectedEvent = new Event(); - expectedEvent.setBaseEntityId(BASE_ENTITY_ID); - expectedEvent.setDateCreated(EPOCH_DATE_TIME); - - addObjectToRepository(asList(expectedEvent), allEvents); - - EventSearchBean eventSearchBean = new EventSearchBean(); - eventSearchBean.setBaseEntityId(BASE_ENTITY_ID); - List actualEvents = luceneEventRepository.getByCriteria(eventSearchBean); - - assertEquals(1, actualEvents.size()); - assertEquals(expectedEvent, actualEvents.get(0)); - } - - @Test(expected = DbAccessException.class) - public void shouldThrowExceptionIfEventDateCreatedFieldFound() { - Event expectedEvent = new Event(); - expectedEvent.setBaseEntityId(BASE_ENTITY_ID); - - addObjectToRepository(asList(expectedEvent), allEvents); - - EventSearchBean eventSearchBean = new EventSearchBean(); - eventSearchBean.setBaseEntityId(BASE_ENTITY_ID); - luceneEventRepository.getByCriteria(eventSearchBean); - - } - - @Test - public void shouldFindByAllCriteria() { - addRandomInvalidEvents(); - Event expectedEvent = new Event(); - expectedEvent.setBaseEntityId(BASE_ENTITY_ID); - expectedEvent.setDateCreated(EPOCH_DATE_TIME); - expectedEvent.setEventDate(new DateTime(DateTimeZone.UTC)); - expectedEvent.setEventType(EVENT_TYPE); - expectedEvent.setEntityType(ENTITY_TYPE); - expectedEvent.setProviderId(PROVIDER_ID); - expectedEvent.setLocationId(LOCATION_ID); - expectedEvent.setDateEdited(new DateTime(DateTimeZone.UTC)); - - addObjectToRepository(asList(expectedEvent), allEvents); - - EventSearchBean eventSearchBean = new EventSearchBean(); - eventSearchBean.setBaseEntityId(BASE_ENTITY_ID); - eventSearchBean.setEventDateFrom(EPOCH_DATE_TIME); - eventSearchBean.setEventDateTo(new DateTime(DateTimeZone.UTC)); - eventSearchBean.setEntityType(expectedEvent.getEventType()); - eventSearchBean.setEntityType(expectedEvent.getEntityType()); - eventSearchBean.setProviderId(expectedEvent.getProviderId()); - eventSearchBean.setLocationId(expectedEvent.getLocationId()); - eventSearchBean.setLastEditFrom(EPOCH_DATE_TIME); - eventSearchBean.setLastEditTo(new DateTime(DateTimeZone.UTC)); - - List actualEvents = luceneEventRepository.getByCriteria(eventSearchBean); - - assertEquals(1, actualEvents.size()); - assertEquals(expectedEvent, actualEvents.get(0)); - } - - @Test(expected = RuntimeException.class) - public void shouldThrowExceptionWithNoCriteriaWithTeamIds() { - addRandomInvalidEvents(); - Event expectedEvent = new Event(); - expectedEvent.setBaseEntityId(BASE_ENTITY_ID); - expectedEvent.setDateCreated(EPOCH_DATE_TIME); - expectedEvent.setEventDate(new DateTime(DateTimeZone.UTC)); - expectedEvent.setEventType(EVENT_TYPE); - expectedEvent.setEntityType(ENTITY_TYPE); - expectedEvent.setProviderId(PROVIDER_ID); - expectedEvent.setLocationId(LOCATION_ID); - expectedEvent.setDateEdited(new DateTime(DateTimeZone.UTC)); - - addObjectToRepository(asList(expectedEvent), allEvents); - - luceneEventRepository.getByCriteria(new EventSearchBean()); - } - - @Test - public void shouldFindByAllCriteriaWithTeamId() { - addRandomInvalidEvents(); - Event expectedEvent = new Event(); - expectedEvent.setBaseEntityId(BASE_ENTITY_ID); - expectedEvent.setDateCreated(EPOCH_DATE_TIME); - expectedEvent.setEventDate(new DateTime(DateTimeZone.UTC)); - expectedEvent.setEventType(EVENT_TYPE); - expectedEvent.setEntityType(ENTITY_TYPE); - expectedEvent.setProviderId(PROVIDER_ID); - expectedEvent.setLocationId(LOCATION_ID); - expectedEvent.setDateEdited(new DateTime(DateTimeZone.UTC)); - - Event expectedEvent2 = new Event(); - expectedEvent2.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - expectedEvent2.setDateCreated(EPOCH_DATE_TIME); - expectedEvent2.setEventDate(new DateTime(DateTimeZone.UTC)); - expectedEvent2.setEventType(EVENT_TYPE); - expectedEvent2.setEntityType(ENTITY_TYPE); - expectedEvent2.setProviderId(DIFFERENT_BASE_ENTITY_ID); - expectedEvent2.setLocationId(LOCATION_ID); - expectedEvent2.setDateEdited(new DateTime(DateTimeZone.UTC)); - - addObjectToRepository(asList(expectedEvent, expectedEvent2), allEvents); - - String teamIds = PROVIDER_ID + "," + DIFFERENT_BASE_ENTITY_ID; - String baseEntityIds = BASE_ENTITY_ID + "," + DIFFERENT_BASE_ENTITY_ID; - - EventSearchBean eventSearchBean = new EventSearchBean(); - eventSearchBean.setBaseEntityId(baseEntityIds); - eventSearchBean.setProviderId(teamIds); - eventSearchBean.setLocationId(LOCATION_ID); - eventSearchBean.setServerVersion(EPOCH_DATE_TIME.getMillis()); - List actualEvents = luceneEventRepository.getByCriteria(eventSearchBean, null, "desc", 100); - - assertTwoListAreSameIgnoringOrder(asList(expectedEvent, expectedEvent2), actualEvents); - } - - //TODO: fix source - @Test(expected = NullPointerException.class) - public void shouldThrowExceptionFindByCriteriaWithTeamIdWithOutSortOrder() { - addRandomInvalidEvents(); - Event expectedEvent = new Event(); - expectedEvent.setBaseEntityId(BASE_ENTITY_ID); - expectedEvent.setDateCreated(EPOCH_DATE_TIME); - expectedEvent.setEventDate(new DateTime(DateTimeZone.UTC)); - expectedEvent.setEventType(EVENT_TYPE); - expectedEvent.setEntityType(ENTITY_TYPE); - expectedEvent.setProviderId(PROVIDER_ID); - expectedEvent.setLocationId(LOCATION_ID); - expectedEvent.setDateEdited(new DateTime(DateTimeZone.UTC)); - - Event expectedEvent2 = new Event(); - expectedEvent2.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - expectedEvent2.setDateCreated(EPOCH_DATE_TIME); - expectedEvent2.setEventDate(new DateTime(DateTimeZone.UTC)); - expectedEvent2.setEventType(EVENT_TYPE); - expectedEvent2.setEntityType(ENTITY_TYPE); - expectedEvent2.setProviderId(DIFFERENT_BASE_ENTITY_ID); - expectedEvent2.setLocationId(LOCATION_ID); - expectedEvent2.setDateEdited(new DateTime(DateTimeZone.UTC)); - - addObjectToRepository(asList(expectedEvent, expectedEvent2), allEvents); - - String teamIds = PROVIDER_ID + "," + DIFFERENT_BASE_ENTITY_ID; - String baseEntityIds = BASE_ENTITY_ID + "," + DIFFERENT_BASE_ENTITY_ID; - - EventSearchBean eventSearchBean = new EventSearchBean(); - eventSearchBean.setBaseEntityId(baseEntityIds); - eventSearchBean.setProviderId(teamIds); - eventSearchBean.setLocationId(LOCATION_ID); - eventSearchBean.setServerVersion(EPOCH_DATE_TIME.getMillis()); - - List actualEvents = luceneEventRepository.getByCriteria(eventSearchBean, null, null, 100); - - assertTwoListAreSameIgnoringOrder(asList(expectedEvent, expectedEvent2), actualEvents); - } - - @Test(expected = RuntimeException.class) - public void shouldThrowExceptionWithNoCriteria() { - addRandomInvalidEvents(); - Event expectedEvent = new Event(); - expectedEvent.setBaseEntityId(BASE_ENTITY_ID); - expectedEvent.setDateCreated(EPOCH_DATE_TIME); - expectedEvent.setEventDate(new DateTime(DateTimeZone.UTC)); - expectedEvent.setEventType(EVENT_TYPE); - expectedEvent.setEntityType(ENTITY_TYPE); - expectedEvent.setProviderId(PROVIDER_ID); - expectedEvent.setLocationId(LOCATION_ID); - expectedEvent.setDateEdited(new DateTime(DateTimeZone.UTC)); - - addObjectToRepository(asList(expectedEvent), allEvents); - - luceneEventRepository.getByCriteria(new EventSearchBean(), null, null, 0); - } - - @Test - public void shouldFindByStringQuery() { - String query = "eventDate:[1970-01-01T00:00:00 TO 3017-08-30T08:12:38] AND lastEdited:[1970-01-01T00:00:00 TO 3017-08-30T08:12:38] AND baseEntityId:baseEntityId AND eventType:eventType AND entityType:entityType AND providerId:providerId AND locationId:locationId"; - addRandomInvalidEvents(); - Event expectedEvent = new Event(); - expectedEvent.setBaseEntityId(BASE_ENTITY_ID); - expectedEvent.setDateCreated(EPOCH_DATE_TIME); - expectedEvent.setEventDate(EPOCH_DATE_TIME); - expectedEvent.setEventType(EVENT_TYPE); - expectedEvent.setEntityType(ENTITY_TYPE); - expectedEvent.setProviderId(PROVIDER_ID); - expectedEvent.setLocationId(LOCATION_ID); - expectedEvent.setDateEdited(EPOCH_DATE_TIME); - - addObjectToRepository(asList(expectedEvent), allEvents); - - List actualEvents = luceneEventRepository.getByCriteria(query); - assertEquals(1, actualEvents.size()); - assertEquals(expectedEvent, actualEvents.get(0)); - - } - - private void addRandomInvalidEvents() { - for (int i = 0; i < 100; i++) { - Event event = new Event(); - event.setBaseEntityId(BASE_ENTITY_ID + i); - event.setDateCreated(EPOCH_DATE_TIME); - event.setEventDate(new DateTime(DateTimeZone.UTC)); - event.setEventType(EVENT_TYPE + i); - event.setEntityType(ENTITY_TYPE + i); - event.setProviderId(PROVIDER_ID + i); - event.setLocationId(LOCATION_ID + i); - event.setDateEdited(new DateTime(DateTimeZone.UTC)); - allEvents.add(event); - } - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/lucene/it/LuceneReportRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/lucene/it/LuceneReportRepositoryTest.java deleted file mode 100644 index 6b930a2fa7..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/lucene/it/LuceneReportRepositoryTest.java +++ /dev/null @@ -1,159 +0,0 @@ -package org.opensrp.repository.lucene.it; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.opensrp.util.SampleFullDomainObject.BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.DIFFERENT_BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.EPOCH_DATE_TIME; -import static org.opensrp.util.SampleFullDomainObject.LOCATION_ID; -import static org.opensrp.util.SampleFullDomainObject.PROVIDER_ID; -import static org.opensrp.util.SampleFullDomainObject.REPORT_TYPE; -import static org.opensrp.util.SampleFullDomainObject.getReport; -import static org.utils.AssertionUtil.assertTwoListAreSameIgnoringOrder; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; - -import java.util.Collections; -import java.util.List; - -import org.ektorp.DbAccessException; -import org.joda.time.DateTime; -import org.joda.time.DateTimeZone; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.domain.Report; -import org.opensrp.repository.couch.AllReports; -import org.opensrp.repository.lucene.LuceneReportRepository; -import org.springframework.beans.factory.annotation.Autowired; - -public class LuceneReportRepositoryTest extends BaseIntegrationTest { - - @Autowired - public AllReports allReports; - - @Autowired - public LuceneReportRepository luceneReportRepository; - - @Before - public void setUp() { - allReports.removeAll(); - } - - @After - public void cleanUp() { - //allReports.removeAll(); - } - - @Test - public void shouldSearchUsingAllCriteria() { - Report expectedReport = getReport(); - expectedReport.setDateCreated(EPOCH_DATE_TIME); - expectedReport.setDateEdited(EPOCH_DATE_TIME); - addObjectToRepository(Collections.singletonList(expectedReport), allReports); - - List actualReports = luceneReportRepository.getByCriteria(BASE_ENTITY_ID, EPOCH_DATE_TIME, - new DateTime(DateTimeZone.UTC), REPORT_TYPE, PROVIDER_ID, LOCATION_ID, EPOCH_DATE_TIME, - new DateTime(DateTimeZone.UTC)); - - assertEquals(1, actualReports.size()); - assertEquals(expectedReport, actualReports.get(0)); - } - - @Test(expected = RuntimeException.class) - public void shouldThrowExceptionIfNoParameterSpecified() { - Report expectedReport = getReport(); - expectedReport.setDateCreated(EPOCH_DATE_TIME); - expectedReport.setDateEdited(EPOCH_DATE_TIME); - addObjectToRepository(Collections.singletonList(expectedReport), allReports); - - luceneReportRepository.getByCriteria(null, null, null, null, null, null, null, null); - } - - @Test - public void findByAllCriteriaV2() { - Report expectedReport = getReport(); - expectedReport.setDateCreated(EPOCH_DATE_TIME); - expectedReport.setDateEdited(EPOCH_DATE_TIME); - expectedReport.setServerVersion(EPOCH_DATE_TIME.getMillis()); - - Report expectedReport2 = getReport(); - expectedReport2.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - expectedReport2.setDateCreated(EPOCH_DATE_TIME); - expectedReport2.setDateEdited(EPOCH_DATE_TIME); - expectedReport2.setServerVersion(EPOCH_DATE_TIME.getMillis()); - - Report expectedReport3 = getReport(); - expectedReport3.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - expectedReport3.setDateCreated(EPOCH_DATE_TIME); - expectedReport3.setDateEdited(EPOCH_DATE_TIME); - expectedReport3.setProviderId(DIFFERENT_BASE_ENTITY_ID); - expectedReport3.setServerVersion(EPOCH_DATE_TIME.getMillis()); - List expectedReports = asList(expectedReport, expectedReport2, expectedReport3); - addObjectToRepository(expectedReports, allReports); - - String teamIds = PROVIDER_ID + "," + DIFFERENT_BASE_ENTITY_ID; - String baseEntityIds = BASE_ENTITY_ID + "," + DIFFERENT_BASE_ENTITY_ID; - List actualReports = luceneReportRepository.getByCriteria(teamIds, PROVIDER_ID, LOCATION_ID, baseEntityIds, - EPOCH_DATE_TIME.getMillis(), null, "DESC", 100); - - assertTwoListAreSameIgnoringOrder(expectedReports, actualReports); - } - - @Test(expected = NullPointerException.class) - public void shouldThrowExceptionIfSortOrderNotSpecifiedInV2() { - Report expectedReport = getReport(); - expectedReport.setDateCreated(EPOCH_DATE_TIME); - expectedReport.setDateEdited(EPOCH_DATE_TIME); - addObjectToRepository(Collections.singletonList(expectedReport), allReports); - luceneReportRepository.getByCriteria(null, PROVIDER_ID, LOCATION_ID, BASE_ENTITY_ID, EPOCH_DATE_TIME.getMillis(), - null, null, 100); - } - - @Test(expected = RuntimeException.class) - public void shouldThrowExceptionIfNoQueryParameterSpecifiedInV2() { - Report expectedReport = getReport(); - expectedReport.setDateCreated(EPOCH_DATE_TIME); - expectedReport.setDateEdited(EPOCH_DATE_TIME); - addObjectToRepository(Collections.singletonList(expectedReport), allReports); - luceneReportRepository.getByCriteria(null, null, null, null, null, null, null, 100); - } - - @Test - public void shouldFindByStringQuery() { - Report expectedReport = getReport(); - expectedReport.setDateCreated(EPOCH_DATE_TIME); - expectedReport.setDateEdited(EPOCH_DATE_TIME); - expectedReport.setServerVersion(EPOCH_DATE_TIME.getMillis()); - - Report expectedReport2 = getReport(); - expectedReport2.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - expectedReport2.setDateCreated(EPOCH_DATE_TIME); - expectedReport2.setDateEdited(EPOCH_DATE_TIME); - expectedReport2.setServerVersion(EPOCH_DATE_TIME.getMillis()); - - Report expectedReport3 = getReport(); - expectedReport3.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - expectedReport3.setDateCreated(EPOCH_DATE_TIME); - expectedReport3.setDateEdited(EPOCH_DATE_TIME); - expectedReport3.setProviderId(DIFFERENT_BASE_ENTITY_ID); - expectedReport3.setServerVersion(EPOCH_DATE_TIME.getMillis()); - List expectedReports = asList(expectedReport, expectedReport2, expectedReport3); - addObjectToRepository(expectedReports, allReports); - - String query = "serverVersion:[0 TO 9223372036854775807]AND providerId:(providerId OR differentBaseEntityId)AND locationId:locationId AND (baseEntityId:(baseEntityId OR differentBaseEntityId))"; - List actualReports = luceneReportRepository.getByCriteria(query); - - assertTwoListAreSameIgnoringOrder(expectedReports, actualReports); - } - - @Test(expected = DbAccessException.class) - public void shouldThrowExceptionIfDateCreatedFileNotPresent() { - Report expectedReport = new Report(); - expectedReport.setBaseEntityId(BASE_ENTITY_ID); - - addObjectToRepository(Collections.singletonList(expectedReport), allReports); - - luceneReportRepository.getByCriteria(BASE_ENTITY_ID, null, null, null, null, null, null, null); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/lucene/it/LuceneSearchRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/lucene/it/LuceneSearchRepositoryTest.java deleted file mode 100644 index 93a907a999..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/lucene/it/LuceneSearchRepositoryTest.java +++ /dev/null @@ -1,169 +0,0 @@ -package org.opensrp.repository.lucene.it; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.opensrp.common.AllConstants.BaseEntity.BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.ATTRIBUTES_TYPE; -import static org.opensrp.util.SampleFullDomainObject.ATTRIBUTES_VALUE; -import static org.opensrp.util.SampleFullDomainObject.EPOCH_DATE_TIME; -import static org.opensrp.util.SampleFullDomainObject.FEMALE; -import static org.opensrp.util.SampleFullDomainObject.FIRST_NAME; -import static org.opensrp.util.SampleFullDomainObject.LAST_NAME; -import static org.opensrp.util.SampleFullDomainObject.MIDDLE_NAME; -import static org.opensrp.util.SampleFullDomainObject.attributes; -import static org.opensrp.util.SampleFullDomainObject.getAddress; -import static org.opensrp.util.SampleFullDomainObject.identifier; -import static org.utils.AssertionUtil.assertTwoListAreSameIgnoringOrder; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.joda.time.DateTime; -import org.joda.time.DateTimeZone; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.domain.Client; -import org.opensrp.repository.couch.AllClients; -import org.opensrp.repository.lucene.LuceneSearchRepository; -import org.opensrp.search.ClientSearchBean; -import org.springframework.beans.factory.annotation.Autowired; - -public class LuceneSearchRepositoryTest extends BaseIntegrationTest { - - @Autowired - public AllClients allClients; - - @Autowired - public LuceneSearchRepository luceneSearchRepository; - - @Before - public void setUp() { - allClients.removeAll(); - } - - @After - public void cleanUp() { - allClients.removeAll(); - } - - @Test - public void shouldSearchByAllCriteria() { - Client expectedClient = createExpectedClient(); - expectedClient.setAttributes(attributes); - Client expectedClient2 = createExpectedClient(); - expectedClient2.addAttribute("inactive", true); - Client expectedClient3 = createExpectedClient(); - expectedClient3.addAttribute("lost_to_follow_up", true); - Client expectedClient4 = createExpectedClient(); - expectedClient4.addAttribute("inactive", false); - List expectedClients = asList(expectedClient, expectedClient2, expectedClient3, expectedClient4); - addObjectToRepository(expectedClients, allClients); - - Map queryAttributes = new HashMap<>(); - queryAttributes.put(ATTRIBUTES_TYPE, ATTRIBUTES_VALUE); - queryAttributes.put("inactive", "true"); - queryAttributes.put("inactive", "false"); - queryAttributes.put("lost_to_follow_up", "true"); - - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike("first"); - clientSearchBean.setGender(expectedClient.getGender()); - clientSearchBean.setBirthdateFrom(EPOCH_DATE_TIME); - clientSearchBean.setBirthdateTo(new DateTime(DateTimeZone.UTC)); - clientSearchBean.setLastEditFrom(EPOCH_DATE_TIME); - clientSearchBean.setLastEditTo(new DateTime(DateTimeZone.UTC)); - List actualClients = luceneSearchRepository.getByCriteria(clientSearchBean, "first", "middle", "last", 10); - - assertTwoListAreSameIgnoringOrder(expectedClients, actualClients); - } - - @Test - public void canNotSearchWithIdentifiers() { - Client expectedClient = createExpectedClient(); - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike("first"); - clientSearchBean.setGender(expectedClient.getGender()); - clientSearchBean.setBirthdateFrom(EPOCH_DATE_TIME); - clientSearchBean.setBirthdateTo(new DateTime(DateTimeZone.UTC)); - clientSearchBean.setIdentifiers(identifier); - clientSearchBean.setLastEditFrom(EPOCH_DATE_TIME); - clientSearchBean.setLastEditTo(new DateTime(DateTimeZone.UTC)); - List actualClients = luceneSearchRepository.getByCriteria(clientSearchBean, "first", "middle", "last", 10); - assertEquals(0, actualClients.size()); - } - - @Test - public void canNotSearchWithAttributes() { - Client expectedClient = createExpectedClient(); - expectedClient.setAttributes(attributes); - Client expectedClient2 = createExpectedClient(); - expectedClient2.addAttribute("inactive", true); - Client expectedClient3 = createExpectedClient(); - expectedClient3.addAttribute("lost_to_follow_up", true); - Client expectedClient4 = createExpectedClient(); - expectedClient4.addAttribute("inactive", false); - List expectedClients = asList(expectedClient, expectedClient2, expectedClient3, expectedClient4); - addObjectToRepository(expectedClients, allClients); - - Map queryAttributes = new HashMap<>(); - queryAttributes.put(ATTRIBUTES_TYPE, ATTRIBUTES_VALUE); - queryAttributes.put("inactive", "true"); - queryAttributes.put("inactive", "false"); - queryAttributes.put("lost_to_follow_up", "true"); - - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike("first"); - clientSearchBean.setGender(expectedClient.getGender()); - clientSearchBean.setBirthdateFrom(EPOCH_DATE_TIME); - clientSearchBean.setBirthdateTo(new DateTime(DateTimeZone.UTC)); - clientSearchBean.setAttributes(queryAttributes); - clientSearchBean.setLastEditFrom(EPOCH_DATE_TIME); - clientSearchBean.setLastEditTo(new DateTime(DateTimeZone.UTC)); - - List actualClients = luceneSearchRepository.getByCriteria(clientSearchBean, "first", "middle", "last", 10); - assertEquals(0, actualClients.size()); - } - - @Test - public void shouldSearchWithStringQuery() { - Client expectedClient = createExpectedClient(); - expectedClient.setAttributes(attributes); - Client expectedClient2 = createExpectedClient(); - expectedClient2.addAttribute("inactive", true); - Client expectedClient3 = createExpectedClient(); - expectedClient3.addAttribute("lost_to_follow_up", true); - Client expectedClient4 = createExpectedClient(); - expectedClient4.addAttribute("inactive", false); - List expectedClients = asList(expectedClient, expectedClient2, expectedClient3, expectedClient4); - addObjectToRepository(expectedClients, allClients); - - Map queryAttributes = new HashMap<>(); - queryAttributes.put(ATTRIBUTES_TYPE, ATTRIBUTES_VALUE); - queryAttributes.put("inactive", "true"); - queryAttributes.put("inactive", "false"); - queryAttributes.put("lost_to_follow_up", "true"); - - String query = "(firstName:first* OR middleName:first* OR lastName:first* )AND firstName:first* AND middleName:middle* AND lastName:last* AND gender:female AND birthdate:[1970-01-01T00:00:00 TO 2017-09-07T10:12:18] AND lastEdited:[1970-01-01T00:00:00 TO 2017-09-07T10:12:18]"; - List actualClients = luceneSearchRepository.getByCriteria(query); - - assertTwoListAreSameIgnoringOrder(expectedClients, actualClients); - } - - private Client createExpectedClient() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setMiddleName(MIDDLE_NAME); - expectedClient.setLastName(LAST_NAME); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - expectedClient.setGender(FEMALE); - expectedClient.setDateEdited(EPOCH_DATE_TIME); - expectedClient.setIdentifiers(identifier); - return expectedClient; - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/ActionsRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/ActionsRepositoryTest.java deleted file mode 100644 index ef38197d47..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/ActionsRepositoryTest.java +++ /dev/null @@ -1,250 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.junit.Test; -import org.opensrp.dto.ActionData; -import org.opensrp.scheduler.Action; -import org.opensrp.scheduler.repository.ActionsRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -public class ActionsRepositoryTest extends BaseRepositoryTest { - - @Autowired - @Qualifier("actionsRepositoryPostgres") - private ActionsRepository actionsRepository; - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet(); - scripts.add("action.sql"); - return scripts; - } - - @Test - public void testGet() { - Action action = actionsRepository.get("05934ae338431f28bf6793b2417c98f9"); - assertEquals(6, action.data().size()); - assertEquals("PENTA 1", action.data().get("scheduleName")); - assertEquals("2018-02-22", action.data().get("startDate")); - assertEquals("aabcd2cc-c111-41c6-85e6-cb5d9e350d08", action.baseEntityId()); - - //missing action - assertNull(actionsRepository.get("05934ae338431f28bf6793b241")); - } - - @Test - public void testAdd() { - Action action = new Action("bshjfsdf-sdfsd9-4243-ssf", "tester", ActionData.markAlertAsClosed("BCG", "2018-02-23")); - actionsRepository.add(action); - assertEquals(35, actionsRepository.getAll().size()); - - action = actionsRepository.findByCaseIdAndTimeStamp("bshjfsdf-sdfsd9-4243-ssf", 0l).get(0); - assertEquals("BCG", action.data().get("visitCode")); - assertEquals("2018-02-23", action.data().get("completionDate")); - assertEquals("closeAlert", action.getActionType()); - - } - - @Test - public void testUpdate() { - Action action = actionsRepository.get("05934ae338431f28bf6793b2417c98f9"); - action.getDetails().put("Key11", "Baby123"); - String today = new LocalDate().toString(); - action.data().put("expiryDate", today); - - actionsRepository.update(action); - - Action updatedAction = actionsRepository.get("05934ae338431f28bf6793b2417c98f9"); - assertEquals("Baby123", updatedAction.getDetails().get("Key11")); - assertEquals(today, updatedAction.data().get("expiryDate")); - - } - - @Test - public void testGetAll() { - assertEquals(34, actionsRepository.getAll().size()); - - actionsRepository.safeRemove(actionsRepository.get("05934ae338431f28bf6793b2417c98f9")); - - List actions = actionsRepository.getAll(); - assertEquals(33, actions.size()); - - List ids = Arrays.asList("05934ae338431f28bf6793b241645f1f", "05934ae338431f28bf6793b24164a5d7", - "05934ae338431f28bf6793b2417c5aae"); - int found = 0; - for (Action act : actions) { - assertNotEquals("05934ae338431f28bf6793b2417c98f9", act.getId()); - if (ids.contains(act.getId())) - found++; - } - assertEquals(3, found); - - } - - @Test - public void testSafeRemove() { - - Action action = actionsRepository.get("05934ae338431f28bf6793b2417c7d94"); - actionsRepository.safeRemove(action); - - List actions = actionsRepository.getAll(); - assertEquals(33, actions.size()); - - for (Action act : actions) { - assertNotEquals("05934ae338431f28bf6793b2417c7d94", act.getId()); - } - - assertNull(actionsRepository.get("05934ae338431f28bf6793b2417c7d94")); - } - - @Test - public void testFindByProviderIdAndTimeStamp() { - assertEquals(34, actionsRepository.findByProviderIdAndTimeStamp("biddemo", 0l).size()); - - assertEquals(24, actionsRepository.findByProviderIdAndTimeStamp("biddemo", 1520932703825l).size()); - - List actions = actionsRepository.findByProviderIdAndTimeStamp("biddemo", 1520978414513l); - assertEquals(1, actions.size()); - assertEquals("05934ae338431f28bf6793b2417da475", actions.get(0).getId()); - - assertTrue(actionsRepository.findByProviderIdAndTimeStamp("biddeo", 0l).isEmpty()); - - assertTrue(actionsRepository.findByProviderIdAndTimeStamp("biddemo", System.currentTimeMillis()).isEmpty()); - } - - @Test - public void findAlertByANMIdEntityIdScheduleName() { - List actions = actionsRepository.findAlertByANMIdEntityIdScheduleName("biddemo", - "b06e0847-0d68-4f5c-9288-58bc394fe052", "BCG"); - assertEquals(1, actions.size()); - assertEquals("05934ae338431f28bf6793b2417db6ca", actions.get(0).getId()); - assertEquals("2018-01-11", actions.get(0).data().get("startDate")); - assertEquals("05934ae338431f28bf6793b2417db6ca", actions.get(0).getId()); - - assertTrue(actionsRepository - .findAlertByANMIdEntityIdScheduleName("biddemo", "b06e0847-0d68-4f5c-9288-58bc394fe052", "OPV 2").isEmpty()); - } - - @Test - public void testFindByCaseIdScheduleAndTimeStamp() { - List actions = actionsRepository.findByCaseIdScheduleAndTimeStamp("b06e0847-0d68-4f5c-9288-58bc394fe052", - "BCG", new DateTime("2018-03-13"), new DateTime()); - assertEquals(1, actions.size()); - assertEquals("05934ae338431f28bf6793b2417db6ca", actions.get(0).getId()); - assertEquals("2018-01-11", actions.get(0).data().get("startDate")); - assertEquals("05934ae338431f28bf6793b2417db6ca", actions.get(0).getId()); - - assertTrue(actionsRepository.findByCaseIdScheduleAndTimeStamp("b06e0847-0d68-4f5c-9288-58bc394fe052", "BCG", - new DateTime("2018-03-20"), new DateTime()).isEmpty()); - } - - @Test - public void testFindByCaseIdAndTimeStamp() { - List actions = actionsRepository.findByCaseIdAndTimeStamp("b06e0847-0d68-4f5c-9288-58bc394fe052", - new DateTime("2018-03-13").getMillis()); - assertEquals(5, actions.size()); - - actions = actionsRepository.findByCaseIdAndTimeStamp("b06e0847-0d68-4f5c-9288-58bc394fe052", 1520978414514l); - assertEquals("05934ae338431f28bf6793b2417da475", actions.get(0).getId()); - assertEquals("2018-02-22", actions.get(0).data().get("startDate")); - assertEquals("pcv1", actions.get(0).data().get("visitCode")); - - assertTrue(actionsRepository.findByCaseIdScheduleAndTimeStamp("b06e0847-0d68-4f5c-9288-58bc394fe052", "BCG", - new DateTime("2018-03-20"), new DateTime()).isEmpty()); - } - - @Test - public void testDeleteAllByTarget() { - actionsRepository.deleteAllByTarget("alert"); - assertTrue(actionsRepository.getAll().isEmpty()); - } - - @Test - public void testMarkAllAsInActiveFor() { - actionsRepository.markAllAsInActiveFor("b06e0847-0d68-4f5c-9288-58bc394fe052"); - List actions = actionsRepository.findByCaseIdAndTimeStamp("b06e0847-0d68-4f5c-9288-58bc394fe052", 0l); - for (Action action : actions) - assertFalse(action.getIsActionActive()); - } - - @Test - public void testAddOrUpdateAlert() { - Action action = new Action("bshjfsdf-sdfsd9-42642-ssf", "tester1", - ActionData.markAlertAsClosed("OPV 1", "2018-03-23")); - actionsRepository.addOrUpdateAlert(action); - assertEquals(35, actionsRepository.getAll().size()); - - action = actionsRepository.findByCaseIdAndTimeStamp("bshjfsdf-sdfsd9-42642-ssf", 0l).get(0); - assertEquals("OPV 1", action.data().get("visitCode")); - assertEquals("2018-03-23", action.data().get("completionDate")); - assertEquals("closeAlert", action.getActionType()); - - action.getDetails().put("tag", "1234"); - String today = new LocalDate().toString(); - action.data().put("expiryDate", today); - - actionsRepository.addOrUpdateAlert(action); - - assertEquals(35, actionsRepository.getAll().size()); - Action updatedAction = actionsRepository.findByCaseIdAndTimeStamp("bshjfsdf-sdfsd9-42642-ssf", 0l).get(0); - assertEquals("1234", updatedAction.getDetails().get("tag")); - assertEquals(today, updatedAction.data().get("expiryDate")); - - } - - @Test - public void testMarkAlertAsInactiveFor() { - String provider = "biddemo"; - String entityId = "b06e0847-0d68-4f5c-9288-58bc394fe052"; - String schedule = "BCG"; - actionsRepository.markAlertAsInactiveFor(provider, entityId, schedule); - List actions = actionsRepository.findAlertByANMIdEntityIdScheduleName(provider, entityId, schedule); - for (Action action : actions) - assertFalse(action.getIsActionActive()); - } - - @Test - public void testFindByCriteria() { - - long now = System.currentTimeMillis(); - Action action = new Action("bshdsf989-32hjh-d9-42642-ssf", "tester1", - ActionData.markAlertAsClosed("OPV 2", "2018-04-23")); - actionsRepository.addOrUpdateAlert(action); - - assertEquals(34, actionsRepository.findByCriteria(null, "biddemo", 0, null, null, 50).size()); - - assertEquals(35, actionsRepository.findByCriteria("biddemo,tester1", "biddemo", 0, null, null, 50).size()); - - assertEquals(35, actionsRepository.findByCriteria("biddemo,tester1", null, 0, null, null, 50).size()); - - assertEquals(5, actionsRepository.findByCriteria("biddemo,tester1", null, 0, "server_version", "desc", 5).size()); - - List actions = actionsRepository.findByCriteria("biddemo,tester1", null, now, null, null, 50); - assertEquals(1, actions.size()); - - assertEquals("bshdsf989-32hjh-d9-42642-ssf", actions.get(0).baseEntityId()); - assertEquals("OPV 2", actions.get(0).data().get("visitCode")); - assertEquals("2018-04-23", actions.get(0).data().get("completionDate")); - } - - @Test - public void testFindAllActionNotExpired() { - List actions = actionsRepository.findAllActionNotExpired(); - assertEquals(1, actions.size()); - assertEquals("05934ae338431f28bf6793b2417dba2d", actions.get(0).getId()); - - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/AlertsRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/AlertsRepositoryTest.java deleted file mode 100644 index d6e6bc69a2..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/AlertsRepositoryTest.java +++ /dev/null @@ -1,321 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.joda.time.DateTime; -import org.junit.Test; -import org.opensrp.dto.AlertStatus; -import org.opensrp.scheduler.Alert; -import org.opensrp.scheduler.Alert.AlertType; -import org.opensrp.scheduler.Alert.TriggerType; -import org.opensrp.scheduler.repository.AlertsRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -public class AlertsRepositoryTest extends BaseRepositoryTest { - - @Autowired - @Qualifier("alertsRepositoryPostgres") - private AlertsRepository alertsRepository; - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet(); - scripts.add("alert.sql"); - return scripts; - } - - @Test - public void testGet() { - Alert alert = alertsRepository.get("170c64f5-a187-4c90-b76d-09ff14d5e280"); - assertEquals("06e4d8c0-f3ff-458c-8141-53d199355c7a", alert.entityId()); - assertEquals("PCV 3", alert.getTriggerName()); - assertEquals(1521756016156l, alert.timestamp()); - - assertNull(alertsRepository.get("170c64f5-nbnsd8-sdfds-234-09ff14d5e280")); - } - - @Test - public void testAdd() { - Alert alert = new Alert("tester1", "ssdf-mn878-jsdjsd-kn", "child", AlertType.notification, TriggerType.schedule, - "BCG 2", "b2g2", new DateTime("2017-08-22"), new DateTime("2018-02-22"), AlertStatus.normal, null); - alertsRepository.add(alert); - assertEquals(16, alertsRepository.getAll().size()); - Alert savedAlert = alertsRepository.findActiveAlertByEntityId("ssdf-mn878-jsdjsd-kn").get(0); - assertEquals("2017-08-22", savedAlert.startDate()); - assertEquals("2018-02-22", savedAlert.expiryDate()); - } - - @Test - public void testUpdate() { - Alert alert = alertsRepository.findActiveAlertByEntityId("4a2a4ad9-cd29-47cb-bdb9-5b617a73b898").get(0); - alert.setClosingPeriod("closingPresiod"); - alert.setDateClosed("2017-09-18"); - alert.setReasonClosed("Test closing"); - long timeStamp = System.currentTimeMillis(); - alert.setTimeStamp(timeStamp); - - alertsRepository.update(alert); - - Alert updatedAlert = alertsRepository.findActiveAlertByEntityId("4a2a4ad9-cd29-47cb-bdb9-5b617a73b898").get(0); - assertEquals("closingPresiod", updatedAlert.closingPeriod()); - assertEquals("2017-09-18", updatedAlert.getDateClosed()); - assertEquals("Test closing", updatedAlert.getReasonClosed()); - assertEquals(timeStamp, updatedAlert.timestamp()); - } - - @Test - public void testGetAll() { - assertEquals(15, alertsRepository.getAll().size()); - - alertsRepository.safeRemove(alertsRepository.get("f210392d-2905-458a-8301-5a7fb844c448")); - - List alerts = alertsRepository.getAll(); - assertEquals(14, alerts.size()); - - for (Alert alert : alerts) - assertNotEquals("f210392d-2905-458a-8301-5a7fb844c448", alert.getId()); - } - - @Test - public void testSafeRemove() { - Alert alert = alertsRepository.findActiveAlertByEntityId("4a2a4ad9-cd29-47cb-bdb9-5b617a73b898").get(0); - alertsRepository.safeRemove(alert); - assertEquals(14, alertsRepository.getAll().size()); - - assertTrue(alertsRepository.findActiveAlertByEntityId("4a2a4ad9-cd29-47cb-bdb9-5b617a73b898").isEmpty()); - - for (Alert alert_ : alertsRepository.getAll()) - assertNotEquals("4a2a4ad9-cd29-47cb-bdb9-5b617a73b898", alert_.entityId()); - } - - @Test - public void testFindByProviderAndTimestamp() { - assertEquals(8, alertsRepository.findActiveByProviderAndTimestamp("biddemo", 0l).size()); - - assertEquals(4, alertsRepository.findActiveByProviderAndTimestamp("biddemo", 1521842403899l).size()); - - List alerts = alertsRepository.findActiveByProviderAndTimestamp("biddemo", 1522188003908l); - - assertEquals(1, alerts.size()); - assertEquals("01741058-588c-4105-b2e4-6e5ae47f4880", alerts.get(0).getId()); - - assertTrue(alertsRepository.findActiveByProviderAndTimestamp("biddemo1", 0l).isEmpty()); - - assertTrue(alertsRepository.findActiveByProviderAndTimestamp("biddemo", System.currentTimeMillis()).isEmpty()); - } - - @Test - public void testFindActiveByProviderAndTimestamp() { - assertEquals(8, alertsRepository.findActiveByProviderAndTimestamp("biddemo", 0l).size()); - - alertsRepository.markAllAsClosedFor("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "testing"); - - assertEquals(3, alertsRepository.findActiveByProviderAndTimestamp("biddemo", 0l).size()); - - List alerts = alertsRepository.findActiveByProviderAndTimestamp("biddemo", 1520978414377l); - assertEquals(2, alerts.size()); - for (Alert alert : alerts) { - assertTrue(alert.getTimeStamp() > 1520978414377l); - assertEquals("biddemo", alert.providerId()); - } - - assertTrue(alertsRepository.findActiveByProviderAndTimestamp("biddemo1", 0l).isEmpty()); - - assertTrue(alertsRepository.findActiveByProviderAndTimestamp("biddemo", System.currentTimeMillis()).isEmpty()); - - } - - @Test - public void testFindAlertByProviderEntityIdTriggerName() { - - List alerts = alertsRepository.findAlertByProviderEntityIdTriggerName("biddemo", - "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PCV 1"); - assertEquals(1, alerts.size()); - assertEquals("f210392d-2905-458a-8301-5a7fb844c448", alerts.get(0).getId()); - - alerts = alertsRepository.findAlertByProviderEntityIdTriggerName("biddemo", "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", - "PENTA 2"); - assertEquals(1, alerts.size()); - assertEquals("52e33167-4b64-4189-bf0c-e7a916815bc9", alerts.get(0).getId()); - - assertTrue(alertsRepository - .findAlertByProviderEntityIdTriggerName("biddemo1", "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PENTA 2") - .isEmpty()); - - assertTrue(alertsRepository - .findAlertByProviderEntityIdTriggerName("biddemo", "01a12dba-d25e-451-cfa8cf5ebf40", "PENTA 2").isEmpty()); - assertTrue(alertsRepository - .findAlertByProviderEntityIdTriggerName("biddemo", "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "BCG").isEmpty()); - } - - @Test - public void testFindActiveAlertByProviderEntityIdTriggerName() { - List alerts = alertsRepository.findActiveAlertByProviderEntityIdTriggerName("biddemo", - "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PCV 1"); - assertEquals(1, alerts.size()); - assertEquals("f210392d-2905-458a-8301-5a7fb844c448", alerts.get(0).getId()); - - alerts = alertsRepository.findActiveAlertByProviderEntityIdTriggerName("biddemo", - "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PENTA 2"); - assertEquals(1, alerts.size()); - assertEquals("52e33167-4b64-4189-bf0c-e7a916815bc9", alerts.get(0).getId()); - - alertsRepository.markAlertAsCompleteFor("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PENTA 2", "2018-03-31"); - - assertTrue(alertsRepository - .findActiveAlertByProviderEntityIdTriggerName("biddemo", "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PENTA 2") - .isEmpty()); - - assertTrue(alertsRepository - .findActiveAlertByProviderEntityIdTriggerName("biddemo1", "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PENTA 2") - .isEmpty()); - - assertTrue(alertsRepository - .findActiveAlertByProviderEntityIdTriggerName("biddemo", "01a12dba-d25e-451-cfa8cf5ebf40", "PENTA 2") - .isEmpty()); - assertTrue(alertsRepository - .findActiveAlertByProviderEntityIdTriggerName("biddemo", "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "BCG") - .isEmpty()); - } - - @Test - public void testFindActiveAlertByEntityIdTriggerName() { - List alerts = alertsRepository.findActiveAlertByEntityIdTriggerName("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", - "PCV 1"); - assertEquals(1, alerts.size()); - assertEquals("f210392d-2905-458a-8301-5a7fb844c448", alerts.get(0).getId()); - - alerts = alertsRepository.findActiveAlertByEntityIdTriggerName("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PENTA 2"); - assertEquals(1, alerts.size()); - assertEquals("52e33167-4b64-4189-bf0c-e7a916815bc9", alerts.get(0).getId()); - - alertsRepository.markAlertAsCompleteFor("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PENTA 2", "2018-03-31"); - - assertTrue(alertsRepository.findActiveAlertByEntityIdTriggerName("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PENTA 2") - .isEmpty()); - - assertTrue( - alertsRepository.findActiveAlertByEntityIdTriggerName("01a12dba-d25e-451-cfa8cf5ebf40", "PENTA 2").isEmpty()); - assertTrue( - alertsRepository.findActiveAlertByEntityIdTriggerName("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "BCG").isEmpty()); - } - - @Test - public void testFindActiveAlertByEntityId() { - List alerts = alertsRepository.findActiveAlertByEntityId("06e4d8c0-f3ff-458c-8141-53d199355c7a"); - assertEquals(3, alerts.size()); - - for (Alert alert : alerts) { - assertEquals("06e4d8c0-f3ff-458c-8141-53d199355c7a", alert.entityId()); - assertTrue(alert.isActive()); - } - - alertsRepository.markAllAsClosedFor("06e4d8c0-f3ff-458c-8141-53d199355c7a", "testing"); - - assertTrue(alertsRepository.findActiveAlertByEntityId("06e4d8c0-f3ff-458c-8141-53d199355c7a").isEmpty()); - - assertTrue(alertsRepository.findActiveAlertByEntityId("06e4d8c0-f3ff-453kk-kjj1-53d199355c7a").isEmpty()); - } - - @Test - public void testFindByEntityIdTriggerAndTimeStamp() { - List alerts = alertsRepository.findByEntityIdTriggerAndTimeStamp("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", - "PCV 1", new DateTime(0), new DateTime()); - assertEquals(1, alerts.size()); - assertEquals("f210392d-2905-458a-8301-5a7fb844c448", alerts.get(0).getId()); - - alertsRepository.markAlertAsCompleteFor("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PCV 1", "2018-03-31"); - - assertTrue(alertsRepository.findActiveAlertByEntityIdTriggerName("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PCV 1") - .isEmpty()); - - assertTrue(alertsRepository.findByEntityIdTriggerAndTimeStamp("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PCV 1", - new DateTime(1521842403913l), new DateTime()).isEmpty()); - assertTrue(alertsRepository.findByEntityIdTriggerAndTimeStamp("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "BCG", - new DateTime(1521842403913l), new DateTime()).isEmpty()); - - } - - @Test - public void testMarkAllAsClosedFor() { - alertsRepository.markAllAsClosedFor("06e4d8c0-f3ff-458c-8141-53d199355c7a", "DYuyi"); - assertFalse(alertsRepository.get("89bcc696-9491-4b03-8064-d7752b0cb12a").isActive()); - assertTrue(alertsRepository.findActiveAlertByEntityId("06e4d8c0-f3ff-458c-8141-53d199355c7a").isEmpty()); - } - - @Test - public void testMarkAlertAsClosedFor() { - alertsRepository.markAlertAsClosedFor("biddemo", "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PENTA 2", - "Testing Close!!"); - - assertTrue(alertsRepository.findActiveAlertByEntityIdTriggerName("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PENTA 2") - .isEmpty()); - - Alert alert = alertsRepository.get("52e33167-4b64-4189-bf0c-e7a916815bc9"); - assertEquals(false, alert.isActive()); - assertEquals("Testing Close!!", alert.getReasonClosed()); - assertEquals(AlertStatus.closed.name(), alert.getAlertStatus()); - } - - @Test - public void testMarkAlertAsCompleteFor() { - alertsRepository.markAlertAsCompleteFor("biddemo", "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PENTA 2", "2018-03-27"); - - assertTrue(alertsRepository.findActiveAlertByEntityIdTriggerName("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PENTA 2") - .isEmpty()); - - Alert alert = alertsRepository.get("52e33167-4b64-4189-bf0c-e7a916815bc9"); - assertEquals(false, alert.isActive()); - assertEquals("2018-03-27", alert.getDateComplete()); - assertEquals(AlertStatus.complete.name(), alert.getAlertStatus()); - } - - @Test - public void testMarkAlertAsCompleteForWithoutProvider() { - alertsRepository.markAlertAsCompleteFor("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PENTA 2", "2018-03-27"); - - assertTrue(alertsRepository.findActiveAlertByEntityIdTriggerName("01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "PENTA 2") - .isEmpty()); - - Alert alert = alertsRepository.get("52e33167-4b64-4189-bf0c-e7a916815bc9"); - assertEquals(false, alert.isActive()); - assertEquals("2018-03-27", alert.getDateComplete()); - assertEquals(AlertStatus.complete.name(), alert.getAlertStatus()); - } - - @Test - public void testAddOrUpdateScheduleNotificationAlert() { - //test update - alertsRepository.addOrUpdateScheduleNotificationAlert("vaccination", "06e4d8c0-f3ff-458c-8141-53d199355c7a", "DYuyi", - "OPV 3", "opv3", AlertStatus.upcoming, new DateTime("2018-04-28"), new DateTime("2021-02-19")); - - Alert alert = alertsRepository.findActiveAlertByEntityIdTriggerName("06e4d8c0-f3ff-458c-8141-53d199355c7a", "OPV 3") - .get(0); - assertEquals(new DateTime("2018-04-28").toString(), alert.getStartDate()); - assertEquals(new DateTime("2021-02-19").toString(), alert.getExpiryDate()); - assertEquals(AlertStatus.upcoming.name(), alert.getAlertStatus()); - - assertEquals(15, alertsRepository.getAll().size()); - - //test add - alertsRepository.addOrUpdateScheduleNotificationAlert("vaccination", "06e4d8c0-f3ff-458c-8141-53d199355c7a", "DYuyi", - "OPV 4", "opv4", AlertStatus.urgent, new DateTime("2017-01-21"), new DateTime("2020-05-09")); - - alert = alertsRepository.findActiveAlertByEntityIdTriggerName("06e4d8c0-f3ff-458c-8141-53d199355c7a", "OPV 4") - .get(0); - assertEquals("2017-01-21", alert.getStartDate()); - assertEquals("2020-05-09", alert.getExpiryDate()); - assertEquals(AlertStatus.urgent.name(), alert.getAlertStatus()); - - assertEquals(16, alertsRepository.getAll().size()); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/AppStateTokensRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/AppStateTokensRepositoryTest.java deleted file mode 100644 index ba0e862149..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/AppStateTokensRepositoryTest.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.junit.Test; -import org.opensrp.domain.AppStateToken; -import org.opensrp.repository.AppStateTokensRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -public class AppStateTokensRepositoryTest extends BaseRepositoryTest { - - @Autowired - @Qualifier("appStateTokensRepositoryPostgres") - private AppStateTokensRepository appStateTokensRepository; - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet(); - scripts.add("app_state_token.sql"); - return scripts; - } - - @Test - public void testGet() { - AppStateToken token = appStateTokensRepository.get("1"); - assertEquals("sync_schedule_tracker_by_last_update_enrollment", token.getName()); - assertEquals("34343", token.getValue().toString()); - assertEquals("ScheduleTracker token to keep track of enrollment", token.getDescription()); - assertEquals(1521017416, token.getLastEditDate()); - //Try to find non-exist token - assertNull(appStateTokensRepository.get("10")); - } - - @Test - public void testGetAll() { - List tokens = appStateTokensRepository.getAll(); - assertEquals(5, tokens.size()); - - appStateTokensRepository.safeRemove(appStateTokensRepository.findByName("sync_event_by_date_updated").get(0)); - - tokens = appStateTokensRepository.getAll(); - assertEquals(4, tokens.size()); - for (AppStateToken token : tokens) - assertNotEquals("sync_event_by_date_updated", token.getName()); - } - - @Test - public void testFindByName() { - List tokens = appStateTokensRepository.findByName("sync_event_by_date_updated"); - assertEquals(1, tokens.size()); - assertEquals("343232", tokens.get(0).getValue()); - assertEquals(1521017416, tokens.get(0).getLastEditDate()); - //Try to find non-exist token - assertTrue(appStateTokensRepository.findByName("sync_client_non_existent").isEmpty()); - } - - @Test - public void testSafeRemove() { - appStateTokensRepository.safeRemove(appStateTokensRepository.findByName("sync_event_by_date_voided").get(0)); - assertTrue(appStateTokensRepository.findByName("sync_event_by_date_voided").isEmpty()); - List tokens = appStateTokensRepository.getAll(); - assertEquals(4, tokens.size()); - for (AppStateToken token : tokens) - assertNotEquals("sync_event_by_date_voided", token.getName()); - } - - @Test - public void testUpdate() { - AppStateToken token = new AppStateToken("sync_event_by_date_updated", "4564353453434", 1521019916); - appStateTokensRepository.update(token); - - AppStateToken updatedToken = appStateTokensRepository.findByName("sync_event_by_date_updated").get(0); - - assertEquals("4564353453434", updatedToken.getValue()); - assertEquals(1521019916, updatedToken.getLastEditDate()); - - } - - @Test - public void testAdd() { - AppStateToken token = new AppStateToken("sync_apptoken_custom", "45643534MKHT", 15210234516l, - "Custom Test App Token"); - appStateTokensRepository.add(token); - - AppStateToken savedToken = appStateTokensRepository.findByName("sync_apptoken_custom").get(0); - - assertEquals("45643534MKHT", savedToken.getValue()); - assertEquals(15210234516l, savedToken.getLastEditDate()); - assertEquals("Custom Test App Token", savedToken.getDescription()); - - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/BaseRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/BaseRepositoryTest.java deleted file mode 100644 index d886418e70..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/BaseRepositoryTest.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.opensrp.repository.postgres; - -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import javax.sql.DataSource; - -import org.junit.Before; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.io.ClassPathResource; -import org.springframework.jdbc.datasource.DataSourceUtils; -import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public abstract class BaseRepositoryTest { - - private static String TEST_SCRIPTS_ROOT_DIRECTORY = "test-scripts/"; - - @Autowired - private DataSource openSRPDataSource; - protected static List tableNames = new ArrayList<>(); - - /** - * Populates the configured {@link DataSource} with data from passed scripts - * - * @param the scripts to load - * @throws SQLException - */ - @Before - public void populateDatabase() throws SQLException { - truncateTables(); - if (getDatabaseScripts() == null || getDatabaseScripts().isEmpty()) - return; - ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); - for (String script : getDatabaseScripts()) { - populator.addScript(new ClassPathResource(TEST_SCRIPTS_ROOT_DIRECTORY + script)); - } - - Connection connection = null; - - try { - connection = DataSourceUtils.getConnection(openSRPDataSource); - populator.populate(connection); - } - finally { - if (connection != null) { - DataSourceUtils.releaseConnection(connection, openSRPDataSource); - } - } - } - - private void truncateTables() { - try { - for (String tableName : tableNames) { - Connection connection = DataSourceUtils.getConnection(openSRPDataSource); - Statement statement = connection.createStatement(); - statement.executeUpdate("TRUNCATE " + tableName +" CASCADE"); - connection.close(); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - protected abstract Set getDatabaseScripts(); -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/CampaignRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/CampaignRepositoryTest.java deleted file mode 100644 index b8aa94aaaa..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/CampaignRepositoryTest.java +++ /dev/null @@ -1,178 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.joda.time.LocalDate; -import org.junit.Test; -import org.opensrp.domain.Campaign; -import org.opensrp.domain.ExecutionPeriod; -import org.opensrp.domain.Task; -import org.opensrp.repository.CampaignRepository; -import org.springframework.beans.factory.annotation.Autowired; - -public class CampaignRepositoryTest extends BaseRepositoryTest { - - @Autowired - private CampaignRepository campaignRepository; - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet(); - scripts.add("campaign.sql"); - return scripts; - } - - @Test - public void testGet() { - - Campaign campaign = campaignRepository.get("IRS_2018_S1"); - assertEquals("2019 IRS Season 1", campaign.getTitle()); - assertEquals( - "This is the 2010 IRS Spray Campaign for Zambia for the first spray season dated 1 Jan 2019 - 31 Mar 2019.", - campaign.getDescription()); - assertEquals("2019 IRS Season 1", campaign.getTitle()); - assertEquals("2019-01-01", campaign.getExecutionPeriod().getStart().toString("yyyy-MM-dd")); - assertEquals("2019-03-31", campaign.getExecutionPeriod().getEnd().toString("yyyy-MM-dd")); - assertEquals(Task.TaskStatus.IN_PROGRESS, campaign.getStatus()); - assertEquals("2018-10-01T0900", campaign.getAuthoredOn().toString("yyyy-MM-dd'T'HHmm")); - assertEquals("2018-11-12T1149", campaign.getLastModified().toString("yyyy-MM-dd'T'HHmm")); - assertEquals("jdoe", campaign.getOwner()); - - } - - @Test - public void testGetWithNoIdentifier() { - - Campaign campaign = campaignRepository.get(""); - assertNull(campaign); - - } - - @Test - public void testSafeRemove() { - assertEquals(2, campaignRepository.getAll().size()); - Campaign campaign = campaignRepository.get("IRS_2018_S1"); - campaignRepository.safeRemove(campaign); - assertEquals(1, campaignRepository.getAll().size()); - assertNull(campaignRepository.get("IRS_2018_S1")); - - } - - @Test - public void testSafeRemoveNonExistentCampaign() { - campaignRepository.safeRemove(null); - campaignRepository.safeRemove(new Campaign()); - assertEquals(2, campaignRepository.getAll().size()); - - campaignRepository.safeRemove(campaignRepository.get("IRS_2018_S1")); - assertEquals(1, campaignRepository.getAll().size()); - - campaignRepository.safeRemove(campaignRepository.get("IRS_2018_S1")); - assertEquals(1, campaignRepository.getAll().size()); - - } - - @Test - public void testAdd() { - Campaign campaign = new Campaign(); - campaign.setIdentifier("ITN_2018_S1"); - campaign.setDescription("ITN for 2018 Season 1"); - ExecutionPeriod executionPeriod = new ExecutionPeriod(); - executionPeriod.setStart(new LocalDate("2018-01-01")); - executionPeriod.setStart(new LocalDate("2018-03-31")); - campaign.setExecutionPeriod(executionPeriod); - campaign.setOwner("superAdmin"); - campaignRepository.add(campaign); - assertEquals(3, campaignRepository.getAll().size()); - Campaign addedCampaign = campaignRepository.get("ITN_2018_S1"); - assertNotNull(addedCampaign); - assertEquals("ITN for 2018 Season 1", addedCampaign.getDescription()); - - } - - @Test - public void testAddInvalidObject() { - assertEquals(2, campaignRepository.getAll().size()); - Campaign campaign = new Campaign(); - campaignRepository.add(campaign); - assertEquals(2, campaignRepository.getAll().size()); - - campaignRepository.add(null); - assertEquals(2, campaignRepository.getAll().size()); - - } - - @Test - public void testAddExistingObject() { - assertEquals(2, campaignRepository.getAll().size()); - Campaign campaign = campaignRepository.get("IRS_2018_S2"); - campaignRepository.add(campaign); - assertEquals(2, campaignRepository.getAll().size()); - - } - - @Test - public void testEdit() { - Campaign campaign = campaignRepository.get("IRS_2018_S2"); - campaign.setDescription("Sprap season 2 2018"); - ExecutionPeriod executionPeriod = new ExecutionPeriod(); - executionPeriod.setStart(new LocalDate("2018-04-01")); - executionPeriod.setEnd(new LocalDate("2018-06-30")); - campaign.setExecutionPeriod(executionPeriod); - campaignRepository.update(campaign); - - Campaign updatedCampaign = campaignRepository.get("IRS_2018_S2"); - assertEquals("Sprap season 2 2018", updatedCampaign.getDescription()); - assertEquals("2018-04-01", updatedCampaign.getExecutionPeriod().getStart().toString("yyyy-MM-dd")); - assertEquals("2018-06-30", updatedCampaign.getExecutionPeriod().getEnd().toString("yyyy-MM-dd")); - - } - - @Test - public void testEditInvalidObject() { - assertEquals(2, campaignRepository.getAll().size()); - Campaign campaign = campaignRepository.get("IRS_2018_S2"); - campaignRepository.safeRemove(campaign); - - campaignRepository.update(campaign); - assertNull(campaignRepository.get("IRS_2018_S2")); - - } - - @Test - public void testEditNonExistentCampaign() { - assertEquals(2, campaignRepository.getAll().size()); - Campaign campaign = new Campaign(); - campaignRepository.update(campaign); - assertEquals(2, campaignRepository.getAll().size()); - - campaignRepository.update(null); - assertEquals(2, campaignRepository.getAll().size()); - - } - - @Test - public void testGetCampaignsByServerVersion() { - List campaigns = campaignRepository.getCampaignsByServerVersion(0); - assertEquals(2, campaigns.size()); - - assertEquals(2, campaignRepository.getCampaignsByServerVersion(1542012540782l).size()); - - campaigns = campaignRepository.getCampaignsByServerVersion(1542012540783l); - - assertEquals(1, campaigns.size()); - - assertEquals("IRS_2018_S2", campaigns.get(0).getIdentifier()); - - assertTrue(campaignRepository.getCampaignsByServerVersion(System.currentTimeMillis()).isEmpty()); - - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/ClientsRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/ClientsRepositoryTest.java deleted file mode 100644 index e69f7e224a..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/ClientsRepositoryTest.java +++ /dev/null @@ -1,662 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.opensrp.common.AllConstants.BaseEntity.BASE_ENTITY_ID; -import static org.opensrp.common.AllConstants.Client.OPENMRS_UUID_IDENTIFIER_TYPE; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.joda.time.DateTime; -import org.junit.Test; -import org.opensrp.domain.Client; -import org.opensrp.domain.postgres.HouseholdClient; -import org.opensrp.repository.ClientsRepository; -import org.opensrp.search.AddressSearchBean; -import org.opensrp.search.ClientSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -public class ClientsRepositoryTest extends BaseRepositoryTest { - - @Autowired - @Qualifier("clientsRepositoryPostgres") - private ClientsRepository clientsRepository; - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet(); - scripts.add("client.sql"); - return scripts; - } - - @Test - public void testGet() { - Client client = clientsRepository.get("05934ae338431f28bf6793b2416946b7"); - assertEquals("469597f0-eefe-4171-afef-f7234cbb2859", client.getBaseEntityId()); - assertEquals("eb4b258c-7558-436c-a1fe-e91d9e12f849", client.getIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE)); - assertEquals("January", client.getFirstName().trim()); - assertEquals("Babysix", client.getLastName()); - assertEquals("05934ae338431f28bf6793b2416946b7", client.getId()); - //missing client - assertNull(clientsRepository.get("05934ae338bf6793b2416946b7")); - - //test deleted client - clientsRepository.safeRemove(clientsRepository.get("05934ae338431f28bf6793b2416946b7")); - assertNull(clientsRepository.get("05934ae338431f28bf6793b2416946b7")); - } - - @Test - public void testAdd() { - Client client = new Client("f67823b0-378e-4a35-93fc-bb00def74e2f").withBirthdate(new DateTime("2017-03-31"), true) - .withGender("Male").withFirstName("xobili").withLastName("mbangwa"); - - client.withIdentifier("ZEIR_ID", "233864-8").withAttribute("Home_Facility", "Linda"); - clientsRepository.add(client); - assertEquals(22, clientsRepository.getAll().size()); - - Client savedClient = clientsRepository.findByBaseEntityId("f67823b0-378e-4a35-93fc-bb00def74e2f"); - assertNotNull(savedClient.getId()); - assertEquals(new DateTime("2017-03-31"), client.getBirthdate()); - assertEquals("xobili", client.getFirstName()); - assertEquals("mbangwa", client.getLastName()); - assertEquals("233864-8", client.getIdentifier("ZEIR_ID")); - - //test if a client with voided date add client as deleted - client = new Client("f67823b0-4a35-93fc-bb00def74e2f").withBirthdate(new DateTime("2017-03-31"), true) - .withGender("Male").withFirstName("Test").withLastName("Deleted"); - client.withDateVoided(new DateTime()); - clientsRepository.add(client); - assertNull(clientsRepository.findByBaseEntityId(client.getBaseEntityId())); - - } - - @Test - public void testUpdate() { - Client client = clientsRepository.get("05934ae338431f28bf6793b2416946b7"); - client.setFirstName("Hummel"); - client.setLastName("Basialis"); - client.withIdentifier("ZEIR_ID", "09876-98"); - clientsRepository.update(client); - - Client updatedClient = clientsRepository.get(client.getId()); - assertEquals("Hummel", updatedClient.getFirstName()); - assertEquals("Basialis", updatedClient.getLastName()); - assertEquals("09876-98", client.getIdentifier("ZEIR_ID")); - - //test update with voided date deletes client - updatedClient.setDateVoided(new DateTime()); - clientsRepository.update(updatedClient); - assertNull(clientsRepository.get(updatedClient.getId())); - } - - @Test - public void testGetAll() { - assertEquals(21, clientsRepository.getAll().size()); - clientsRepository.safeRemove(clientsRepository.get("05934ae338431f28bf6793b24164cbd9")); - - List clients = clientsRepository.getAll(); - - //test deleted clients - assertEquals(20, clients.size()); - for (Client client : clients) - assertNotEquals("05934ae338431f28bf6793b24164cbd9", client.getId()); - - assertNull(clientsRepository.get("05934ae338431f28bf6793b24164cbd9")); - - } - - @Test - public void testSafeRemove() { - Client client = clientsRepository.get("05934ae338431f28bf6793b2416946b7"); - clientsRepository.safeRemove(client); - List clients = clientsRepository.getAll(); - assertEquals(20, clients.size()); - - for (Client cl : clients) - assertNotEquals("05934ae338431f28bf6793b2416946b7", cl.getId()); - - assertNull(clientsRepository.get("05934ae338431f28bf6793b2416946b7")); - } - - @Test - public void testFindByBaseEntityId() { - Client client = clientsRepository.findByBaseEntityId("86c039a2-0b68-4166-849e-f49897e3a510"); - assertEquals("05934ae338431f28bf6793b24164cbd9", client.getId()); - assertEquals("ab91df5d-e433-40f3-b44f-427b73c9ae2a", client.getIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE)); - assertEquals("Sally", client.getFirstName()); - assertEquals("Mtini", client.getLastName().trim()); - - assertNull(clientsRepository.findByBaseEntityId("f67823b0-378e-4a35-93fc-bb00def74e2f")); - - //test deleted client - clientsRepository.safeRemove(client); - assertNull(clientsRepository.findByBaseEntityId("86c039a2-0b68-4166-849e-f49897e3a510")); - } - - @Test - public void testFindAllClients() { - assertEquals(21, clientsRepository.findAllClients().size()); - - clientsRepository.safeRemove(clientsRepository.get("05934ae338431f28bf6793b24164cbd9")); - - List clients = clientsRepository.findAllClients(); - - assertEquals(20, clients.size()); - for (Client client : clients) - assertNotEquals("05934ae338431f28bf6793b24164cbd9", client.getId()); - - //test deleted client - assertNull(clientsRepository.get("05934ae338431f28bf6793b24164cbd9")); - } - - @Test - public void testFindAllByIdentifier() { - assertTrue(clientsRepository.findAllByIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE, "ab91df5d-e433-40f3-b44f-427b73ca") - .isEmpty()); - - assertTrue(clientsRepository.findAllByIdentifier("identifier_type", "ab91df5d-e433-40f3-b44f-427b73c9ae2a") - .isEmpty()); - - List clients = clientsRepository.findAllByIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE, - "ab91df5d-e433-40f3-b44f-427b73c9ae2a"); - - assertEquals(1, clients.size()); - assertEquals("05934ae338431f28bf6793b24164cbd9", clients.get(0).getId()); - assertEquals("Sally", clients.get(0).getFirstName()); - assertEquals("Mtini", clients.get(0).getLastName().trim()); - - //test deleted clients - clientsRepository.safeRemove(clients.get(0)); - assertTrue(clientsRepository.findAllByIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE, - "ab91df5d-e433-40f3-b44f-427b73c9ae2a").isEmpty()); - - } - - @Test - public void testAllByAttribute() { - List clients = clientsRepository.findAllByAttribute("Home_Facility", "Happy Kids Clinic"); - - assertEquals(9, clients.size()); - - clients = clientsRepository.findAllByAttribute("CHW_Phone_Number", "0964357951"); - assertEquals(1, clients.size()); - assertEquals("05934ae338431f28bf6793b24164cbd9", clients.get(0).getId()); - assertEquals("Sally", clients.get(0).getFirstName()); - assertEquals("Mtini", clients.get(0).getLastName().trim()); - - assertTrue(clientsRepository.findAllByAttribute("CHW_Phone_Number", "+0964357951").isEmpty()); - - assertTrue(clientsRepository.findAllByAttribute("Phone_Number", "0964357951").isEmpty()); - - //test deleted clients - clientsRepository.safeRemove(clients.get(0)); - assertTrue(clientsRepository.findAllByAttribute("CHW_Phone_Number", "0964357951").isEmpty()); - } - - @Test - public void testFindAllByMatchingName() { - assertEquals(7, clientsRepository.findAllByMatchingName("b").size()); - - List clients = clientsRepository.findAllByMatchingName("babytwo"); - - assertEquals(1, clients.size()); - - assertEquals("05934ae338431f28bf6793b24167b6d1", clients.get(0).getId()); - assertEquals("fe7b6350-16d2-41d0-8574-c194088705df", clients.get(0).getBaseEntityId()); - assertEquals("218227-7", clients.get(0).getIdentifier("ZEIR_ID")); - assertEquals("ba5d3927-414f-4796-ae1e-9b73b50a5573", clients.get(0).getIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE)); - - assertEquals(11, clientsRepository.findAllByMatchingName("a").size()); - - assertEquals(6, clientsRepository.findAllByMatchingName("Ja").size()); - - assertEquals(4, clientsRepository.findAllByMatchingName("Janu").size()); - - assertEquals(2, clientsRepository.findAllByMatchingName("January").size()); - - assertTrue(clientsRepository.findAllByMatchingName("Kimbley").isEmpty()); - - //test deleted clients - clientsRepository.safeRemove(clientsRepository.findAllByMatchingName("babytwo").get(0)); - assertTrue(clientsRepository.findAllByMatchingName("babytwo").isEmpty()); - } - - @Test - public void testFindByRelationshipIdAndDateCreated() { - assertEquals( - 2, - clientsRepository.findByRelationshipIdAndDateCreated("0154839f-8766-4eda-b729-89067c7a8c5d", - new DateTime("2018-03-13").toString(), new DateTime().toString()).size()); - - assertTrue(clientsRepository.findByRelationshipIdAndDateCreated("0154839f-8766-4eda-89067c7a8c5d", - new DateTime("2018-03-14").toString(), new DateTime().toString()).isEmpty()); - - assertTrue(clientsRepository.findByRelationshipIdAndDateCreated("0154839f-8766-4eda-b729-89067c7a8c5d", - new DateTime("2018-03-14").toString(), new DateTime().toString()).isEmpty()); - - Client client = clientsRepository.findByRelationshipIdAndDateCreated("3abdb25a-f151-4a95-9311-bd30bf935085", - new DateTime("2018-03-13").toString(), new DateTime().toString()).get(0); - assertEquals("05934ae338431f28bf6793b2415a0374", client.getId()); - assertEquals("94f3e8fb-2f05-4fca-8119-2b593d1962eb", client.getBaseEntityId()); - assertEquals("2018-03-01", client.getBirthdate().toLocalDate().toString()); - - //test deleted clients - clientsRepository.safeRemove(client); - assertTrue(clientsRepository.findByRelationshipIdAndDateCreated("3abdb25a-f151-4a95-9311-bd30bf935085", - new DateTime("2018-03-13").toString(), new DateTime().toString()).isEmpty()); - } - - @Test - public void testFindByRelationshipId() { - assertEquals(2, clientsRepository.findByRelationshipId("mother", "0154839f-8766-4eda-b729-89067c7a8c5d").size()); - - Client client = clientsRepository.findByRelationshipId("mother", "3abdb25a-f151-4a95-9311-bd30bf935085").get(0); - assertEquals("05934ae338431f28bf6793b2415a0374", client.getId()); - assertEquals("94f3e8fb-2f05-4fca-8119-2b593d1962eb", client.getBaseEntityId()); - assertEquals("cf58894b-71c6-41e0-a977-7283f2411cd5", client.getIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE)); - assertEquals("2018-03-01", client.getBirthdate().toLocalDate().toString()); - - assertTrue(clientsRepository.findByRelationshipId("father", "0154839f-8766-4eda-b729-89067c7a8c5d").isEmpty()); - - assertTrue(clientsRepository.findByRelationshipId("mother", "0154839f-4eda-b729-89067c7a8c5d").isEmpty()); - - //test deleted clients - clientsRepository.safeRemove(client); - assertTrue(clientsRepository.findByRelationshipId("mother", "3abdb25a-f151-4a95-9311-bd30bf935085").isEmpty()); - } - - @Test - public void testFindByCriteria() { - ClientSearchBean searchBean = new ClientSearchBean(); - AddressSearchBean addressSearchBean = new AddressSearchBean(); - assertEquals(21, clientsRepository.findByCriteria(searchBean, addressSearchBean).size()); - - searchBean.setNameLike("Janu"); - assertEquals(4, clientsRepository.findByCriteria(searchBean, addressSearchBean).size()); - - searchBean.setNameLike("Baby"); - searchBean.setGender("Male"); - assertEquals(2, clientsRepository.findByCriteria(searchBean, addressSearchBean).size()); - - searchBean.setBirthdateFrom(new DateTime("2016-04-13")); - searchBean.setBirthdateTo(new DateTime()); - assertEquals(2, clientsRepository.findByCriteria(searchBean, addressSearchBean).size()); - - searchBean.setDeathdateFrom(new DateTime("2018-01-01")); - searchBean.setDeathdateTo(new DateTime()); - assertEquals(1, clientsRepository.findByCriteria(searchBean, addressSearchBean).size()); - - searchBean = new ClientSearchBean(); - searchBean.setAttributeType("Home_Facility"); - searchBean.setAttributeValue("Happy Kids Clinic"); - assertEquals(9, clientsRepository.findByCriteria(searchBean, addressSearchBean).size()); - - searchBean.setAttributeType("CHW_Name"); - searchBean.setAttributeValue("Hellen"); - List clients = clientsRepository.findByCriteria(searchBean, addressSearchBean); - assertEquals(1, clients.size()); - assertEquals("05934ae338431f28bf6793b24164cbd9", clients.get(0).getId()); - - searchBean = new ClientSearchBean(); - searchBean.setLastEditFrom(new DateTime("2018-03-13T12:57:05.652")); - searchBean.setLastEditTo(new DateTime()); - assertEquals(6, clientsRepository.findByCriteria(searchBean, addressSearchBean).size()); - - addressSearchBean.setAddressType("usual_residence"); - assertEquals(6, clientsRepository.findByCriteria(searchBean, addressSearchBean).size()); - - addressSearchBean.setAddressType("usual_residence"); - assertEquals(6, clientsRepository.findByCriteria(searchBean, addressSearchBean).size()); - - //test deleted clients - for (Client client : clientsRepository.findByCriteria(searchBean, addressSearchBean)) - clientsRepository.safeRemove(client); - assertTrue(clientsRepository.findByCriteria(searchBean, addressSearchBean).isEmpty()); - - } - - @Test - public void testFindByCriteriaWithoutAddressBean() { - ClientSearchBean searchBean = new ClientSearchBean(); - assertEquals(21, clientsRepository.findByCriteria(searchBean).size()); - - searchBean.setNameLike("Janu"); - assertEquals(4, clientsRepository.findByCriteria(searchBean).size()); - - searchBean.setNameLike("Baby"); - searchBean.setGender("Male"); - assertEquals(2, clientsRepository.findByCriteria(searchBean).size()); - - searchBean.setBirthdateFrom(new DateTime("2016-04-13")); - searchBean.setBirthdateTo(new DateTime()); - assertEquals(2, clientsRepository.findByCriteria(searchBean).size()); - - searchBean.setDeathdateFrom(new DateTime("2018-01-01")); - searchBean.setDeathdateTo(new DateTime()); - assertEquals(1, clientsRepository.findByCriteria(searchBean).size()); - - searchBean = new ClientSearchBean(); - searchBean.setAttributeType("Home_Facility"); - searchBean.setAttributeValue("Happy Kids Clinic"); - assertEquals(9, clientsRepository.findByCriteria(searchBean).size()); - - searchBean.setAttributeType("CHW_Name"); - searchBean.setAttributeValue("Hellen"); - List clients = clientsRepository.findByCriteria(searchBean); - assertEquals(1, clients.size()); - assertEquals("05934ae338431f28bf6793b24164cbd9", clients.get(0).getId()); - - searchBean = new ClientSearchBean(); - searchBean.setLastEditFrom(new DateTime("2018-03-13T12:57:05.652")); - searchBean.setLastEditTo(new DateTime()); - assertEquals(6, clientsRepository.findByCriteria(searchBean).size()); - - //test deleted clients - for (Client client : clientsRepository.findByCriteria(searchBean)) - clientsRepository.safeRemove(client); - assertTrue(clientsRepository.findByCriteria(searchBean).isEmpty()); - - } - - @Test - public void testFindByCriteriaWithEditDateParams() { - - DateTime from = new DateTime("2018-03-13T12:57:05.652"); - DateTime to = new DateTime(); - List clients = clientsRepository.findByCriteria(new AddressSearchBean(), from, to); - assertEquals(6, clients.size()); - - for (Client client : clients) - assertTrue(client.getDateEdited().isEqual(from) || client.getDateEdited().isAfter(from)); - - to = from; - from = new DateTime("2018-01-01"); - clients = clientsRepository.findByCriteria(new AddressSearchBean(), from, to); - assertEquals(11, clients.size()); - - for (Client client : clients) { - assertTrue(client.getDateEdited().isEqual(from) || client.getDateEdited().isAfter(from)); - assertTrue(client.getDateEdited().isEqual(to) || client.getDateEdited().isBefore(to)); - } - - AddressSearchBean addressSearchBean = new AddressSearchBean(); - addressSearchBean.setCityVillage("hui"); - assertTrue(clientsRepository.findByCriteria(addressSearchBean, new DateTime("2018-01-01"), new DateTime()).isEmpty()); - - //test deleted clients - for (Client client : clientsRepository.findByCriteria(new AddressSearchBean(), from, to)) - clientsRepository.safeRemove(client); - assertTrue(clientsRepository.findByCriteria(new AddressSearchBean(), from, to).isEmpty()); - } - - @Test - public void testFindByRelationShip() { - assertEquals(2, clientsRepository.findByRelationShip("0154839f-8766-4eda-b729-89067c7a8c5d").size()); - - Client client = clientsRepository.findByRelationShip("3abdb25a-f151-4a95-9311-bd30bf935085").get(0); - assertEquals("05934ae338431f28bf6793b2415a0374", client.getId()); - assertEquals("94f3e8fb-2f05-4fca-8119-2b593d1962eb", client.getBaseEntityId()); - assertEquals("Fith", client.getFirstName()); - assertEquals("2018-03-01", client.getBirthdate().toLocalDate().toString()); - - //test deleted clients - clientsRepository.safeRemove(client); - assertTrue(clientsRepository.findByRelationShip("3abdb25a-f151-4a95-9311-bd30bf935085").isEmpty()); - - assertTrue(clientsRepository.findByRelationShip("0154839f-4eda-b729-89067c7a8c5d").isEmpty()); - } - - @Test - public void testFindByEmptyServerVersion() { - assertTrue(clientsRepository.findByEmptyServerVersion().isEmpty()); - - Client client = clientsRepository.get("05934ae338431f28bf6793b2415a0374"); - client.setServerVersion(null); - clientsRepository.update(client); - - client = clientsRepository.findByEmptyServerVersion().get(0); - assertEquals("94f3e8fb-2f05-4fca-8119-2b593d1962eb", client.getBaseEntityId()); - assertEquals("Fith", client.getFirstName()); - assertEquals("2018-03-01", client.getBirthdate().toLocalDate().toString()); - assertEquals("218224-4", client.getIdentifier("ZEIR_ID")); - - //test deleted clients - clientsRepository.safeRemove(client); - assertTrue(clientsRepository.findByEmptyServerVersion().isEmpty()); - - } - - @Test - public void testFindByServerVersion() { - assertEquals(11, clientsRepository.findByServerVersion(1520935878136l).size()); - List clients = clientsRepository.findByServerVersion(1521003136406l); - List expectedIds = Arrays.asList("05934ae338431f28bf6793b241839005", "05934ae338431f28bf6793b2418380ce", - "ade884f8-2685-45fd-93f8-122045b2635e", "2e14b66f-206c-4314-a0f7-c5d2c4d9860f", - "b0cb057b-c396-4ec9-bfab-388117a9a5f6", "28ea8f0a-fa53-447d-b8f9-ad07263b382c", - "5bd3e1eb-5cd4-4e8d-9180-4293b7ea3b78", "f5934ae338431f28bf6793b24159ce5a"); - assertEquals(8, clients.size()); - for (Client client : clients) { - assertTrue(client.getServerVersion() >= 1521003136406l); - assertTrue(expectedIds.contains(client.getId())); - } - - //test deleted clients - for (Client client : clients) - clientsRepository.safeRemove(client); - assertTrue(clientsRepository.findByServerVersion(1521003136406l).isEmpty()); - } - - @Test - public void testFindByFieldValue() { - assertEquals( - 3, - clientsRepository.findByFieldValue( - BASE_ENTITY_ID, - Arrays.asList(new String[] { "86c039a2-0b68-4166-849e-f49897e3a510", "f33c71c7-a9a4-495d-8028-b6d59e4034b3", - "fe7b6350-16d2-41d0-8574-c194088705df" })).size()); - - assertTrue(clientsRepository.findByFieldValue("Firstname", Arrays.asList(new String[] { "Baby", "Jan" })).isEmpty()); - - assertTrue(clientsRepository.findByFieldValue(BASE_ENTITY_ID, Arrays.asList(new String[] { "Baby", "Jan" })) - .isEmpty()); - - Client client = clientsRepository.findByFieldValue(BASE_ENTITY_ID, - Arrays.asList(new String[] { "f33c71c7-a9a4-495d-8028-b6d59e4034b3" })).get(0); - - assertEquals("05934ae338431f28bf6793b241679500", client.getId()); - assertEquals("Jan", client.getFirstName()); - assertEquals("2018-01-01", client.getBirthdate().toLocalDate().toString()); - assertEquals("218226-9", client.getIdentifier("ZEIR_ID")); - - //test deleted clients - clientsRepository.safeRemove(client); - assertTrue(clientsRepository.findByFieldValue(BASE_ENTITY_ID, - Arrays.asList(new String[] { "f33c71c7-a9a4-495d-8028-b6d59e4034b3" })).isEmpty()); - } - - @Test - public void testNotInOpenMRSByServerVersion() { - assertTrue(clientsRepository.notInOpenMRSByServerVersion(0l, Calendar.getInstance()).isEmpty()); - - Client client = clientsRepository.get("05934ae338431f28bf6793b2415a0374"); - client.removeIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE); - clientsRepository.update(client); - - client = clientsRepository.notInOpenMRSByServerVersion(0l, Calendar.getInstance()).get(0); - assertEquals("94f3e8fb-2f05-4fca-8119-2b593d1962eb", client.getBaseEntityId()); - assertEquals("Fith", client.getFirstName()); - assertEquals("2018-03-01", client.getBirthdate().toLocalDate().toString()); - assertEquals("218224-4", client.getIdentifier("ZEIR_ID")); - - //test deleted clients - clientsRepository.safeRemove(client); - assertTrue(clientsRepository.notInOpenMRSByServerVersion(0l, Calendar.getInstance()).isEmpty()); - } - - @Test - public void shouldFindMembersByRelationshipId() { - List expectedClient = clientsRepository.findMembersByRelationshipId("43930c23-c787-4ddb-ab76-770f77e7b17d"); - assertNotNull(expectedClient); - assertEquals(1, expectedClient.size()); - - } - - @Test - public void shouldGetMemberCountHouseholdHeadProviderByClients() { - List id = new ArrayList(); - id.add("43930c23-c787-4ddb-ab76-770f77e7b17d"); - List householdClient = clientsRepository.selectMemberCountHouseholdHeadProviderByClients("", id, - "mother"); - - assertEquals("biddemo", householdClient.get(0).getProviderId()); - assertEquals(1, householdClient.get(0).getMemebrCount()); - } - - @Test - public void shouldFindAllClientsByCriteria() { - AddressSearchBean addressSearchBean = new AddressSearchBean(); - ClientSearchBean searchBean = new ClientSearchBean(); - searchBean.setClientType("ec_family"); - List locationUuids = new ArrayList(); - locationUuids.add("42abc582-6658-488b-922e-7be500c070f3"); - searchBean.setLocations(locationUuids); - List clients = clientsRepository.findAllClientsByCriteria(searchBean, addressSearchBean); - assertNotNull(clients); - assertEquals(2, clients.size()); - } - - @Test - public void shouldFindCountAllClientsByCriteria() { - AddressSearchBean addressSearchBean = new AddressSearchBean(); - ClientSearchBean searchBean = new ClientSearchBean(); - searchBean.setClientType("ec_family"); - List locationUuids = new ArrayList(); - locationUuids.add("42abc582-6658-488b-922e-7be500c070f3"); - searchBean.setLocations(locationUuids); - HouseholdClient householdClient = clientsRepository.findCountAllClientsByCriteria(searchBean, addressSearchBean); - assertNotNull(householdClient.getTotalCount()); - assertEquals(2, householdClient.getTotalCount()); - } - - @Test - public void shouldFindHouseholdByCriteria() { - AddressSearchBean addressSearchBean = new AddressSearchBean(); - ClientSearchBean searchBean = new ClientSearchBean(); - searchBean.setNameLike("Haran Mia"); - List clients = clientsRepository.findHouseholdByCriteria(searchBean, addressSearchBean); - assertNotNull(clients); - assertEquals(1, clients.size()); - } - - @Test - public void shouldFindHouseholdByLocation() { - AddressSearchBean addressSearchBean = new AddressSearchBean(); - ClientSearchBean searchBean = new ClientSearchBean(); - List locationUuids = new ArrayList(); - locationUuids.add("e3170b23-bb22-42a4-875d-35c7f32c28ae"); - searchBean.setLocations(locationUuids); - List clients = clientsRepository.findHouseholdByCriteria(searchBean, addressSearchBean); - assertNotNull(clients); - assertEquals(1, clients.size()); - } - - @Test - public void shouldCountHouseholdByLocation() { - AddressSearchBean addressSearchBean = new AddressSearchBean(); - ClientSearchBean searchBean = new ClientSearchBean(); - List locationUuids = new ArrayList(); - locationUuids.add("e3170b23-bb22-42a4-875d-35c7f32c28ae"); - searchBean.setLocations(locationUuids); - HouseholdClient clients = clientsRepository.findTotalCountHouseholdByCriteria(searchBean, addressSearchBean); - assertNotNull(clients); - assertEquals(1, clients.getTotalCount()); - } - - @Test - public void shouldCountHouseholdByCriteria() { - AddressSearchBean addressSearchBean = new AddressSearchBean(); - ClientSearchBean searchBean = new ClientSearchBean(); - searchBean.setNameLike("Haran Mia"); - HouseholdClient clients = clientsRepository.findTotalCountHouseholdByCriteria(searchBean, addressSearchBean); - assertNotNull(clients); - assertEquals(1, clients.getTotalCount()); - } - - @Test - public void shouldFindANCByCriteria() { - AddressSearchBean addressSearchBean = new AddressSearchBean(); - ClientSearchBean searchBean = new ClientSearchBean(); - searchBean.setNameLike("Nobonita"); - searchBean.setClientType(null); - List clients = clientsRepository.findANCByCriteria(searchBean, addressSearchBean); - assertNotNull(clients); - assertEquals(1, clients.size()); - } - - @Test - public void shouldFindAllANCByCriteria() { - AddressSearchBean addressSearchBean = new AddressSearchBean(); - ClientSearchBean searchBean = new ClientSearchBean(); - searchBean.setClientType(null); - List clients = clientsRepository.findANCByCriteria(searchBean, addressSearchBean); - assertNotNull(clients); - assertEquals(1, clients.size()); - } - - @Test - public void shouldFindChildByCriteria() { - AddressSearchBean addressSearchBean = new AddressSearchBean(); - ClientSearchBean searchBean = new ClientSearchBean(); - searchBean.setNameLike("mala"); - searchBean.setClientType(null); - List clients = clientsRepository.findChildByCriteria(searchBean, addressSearchBean); - assertNotNull(clients); - assertEquals(1, clients.size()); - } - - @Test - public void shouldFindANCByLocation() { - AddressSearchBean addressSearchBean = new AddressSearchBean(); - ClientSearchBean searchBean = new ClientSearchBean(); - searchBean.setClientType(null); - List locations = new ArrayList<>(); - locations.add("ce39f858-a2f6-4676-8db1-81fbb1891b01"); - searchBean.setLocations(locations); - List clients = clientsRepository.findChildByCriteria(searchBean, addressSearchBean); - assertNotNull(clients); - assertEquals(1, clients.size()); - } - - @Test - public void shouldFindAllChildByCriteria() { - AddressSearchBean addressSearchBean = new AddressSearchBean(); - ClientSearchBean searchBean = new ClientSearchBean(); - searchBean.setClientType(null); - List clients = clientsRepository.findChildByCriteria(searchBean, addressSearchBean); - assertNotNull(clients); - assertEquals(1, clients.size()); - } - - @Test - public void shouldFindChildByLocation() { - AddressSearchBean addressSearchBean = new AddressSearchBean(); - ClientSearchBean searchBean = new ClientSearchBean(); - searchBean.setClientType(null); - List locations = new ArrayList<>(); - locations.add("ce39f858-a2f6-4676-8db1-81fbb1891b01"); - searchBean.setLocations(locations); - List clients = clientsRepository.findChildByCriteria(searchBean, addressSearchBean); - assertNotNull(clients); - assertEquals(1, clients.size()); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/ErrorTraceRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/ErrorTraceRepositoryTest.java deleted file mode 100644 index b5f32e21b9..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/ErrorTraceRepositoryTest.java +++ /dev/null @@ -1,166 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.opensrp.repository.postgres.ErrorTraceRepositoryImpl.SOLVED; -import static org.opensrp.repository.postgres.ErrorTraceRepositoryImpl.UNSOLVED; - -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.joda.time.DateTime; -import org.junit.Test; -import org.opensrp.domain.ErrorTrace; -import org.opensrp.repository.ErrorTraceRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -public class ErrorTraceRepositoryTest extends BaseRepositoryTest { - - @Autowired - @Qualifier("errorRepositoryPostgres") - private ErrorTraceRepository errorTraceRepository; - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet(); - scripts.add("error.sql"); - return scripts; - } - - @Test - public void testGet() { - ErrorTrace error = errorTraceRepository.get("85ed95b2-8436-4a93-9ae7-ab104d65edd7"); - assertEquals(new DateTime("2018-03-14T07:53:11.152"), error.getDateOccurred()); - assertEquals("OPENMRS FAILED CLIENT PUSH", error.getErrorType()); - assertEquals("org.opensrp.domain.Client", error.getDocumentType()); - assertNull(errorTraceRepository.get("07271855-4018-497a-b180-6af")); - } - - @Test - public void testAdd() { - DateTime occured = new DateTime(); - ErrorTrace error = new ErrorTrace(occured, "GENERIC ERROR 123!!", occured.toString(), - "error at stocktrace.java(677)", "unsolved", "org.test.bean"); - errorTraceRepository.add(error); - List errors = errorTraceRepository.getAll(); - assertEquals(9, errors.size()); - boolean found = false; - for (ErrorTrace er : errors) { - if (er.getDateOccurred().equals(occured)) { - found = true; - assertEquals("GENERIC ERROR 123!!", error.getErrorType()); - assertEquals("error at stocktrace.java(677)", error.getStackTrace()); - break; - } - } - assertTrue(found); - - } - - @Test - public void testUpdate() { - ErrorTrace error = errorTraceRepository.get("85ed95b2-8436-4a93-9ae7-ab104d65edd7"); - error.setStatus("closed"); - Date now = new Date(); - error.setDateClosed(now); - error.setRecordId("jjhi-iiui-234423-ll"); - errorTraceRepository.update(error); - - ErrorTrace updateError = errorTraceRepository.get("85ed95b2-8436-4a93-9ae7-ab104d65edd7"); - assertEquals("closed", updateError.getStatus()); - assertEquals(now, updateError.getDateClosed()); - assertEquals("jjhi-iiui-234423-ll", updateError.getRecordId()); - errorTraceRepository.update(error); - } - - @Test - public void testGetAll() { - assertEquals(8, errorTraceRepository.getAll().size()); - errorTraceRepository.safeRemove(errorTraceRepository.get("ea96c23d-bbf1-4365-bdf5-bcf56f08ce1f")); - assertEquals(7, errorTraceRepository.getAll().size()); - } - - @Test - public void testSafeRemove() { - errorTraceRepository.safeRemove(errorTraceRepository.get("911c7520-f701-419e-b225-5e21286b585b")); - List errors = errorTraceRepository.getAll(); - assertEquals(7, errors.size()); - for (ErrorTrace error : errors) - assertNotEquals("911c7520-f701-419e-b225-5e21286b585b", error.getId()); - } - - @Test - public void testFindById() { - ErrorTrace error = errorTraceRepository.get("07c32814-d7d1-48a5-8320-ed80435a4606"); - assertEquals(new DateTime("2018-01-03T17:06:11.166"), error.getDateOccurred()); - assertEquals("FormSubmissionProcessor", error.getErrorType()); - assertEquals("org.opensrp.service.formSubmission.FormSubmissionListener", error.getOccurredAt()); - assertEquals("[Ljava.lang.StackTraceElement;@50ef4583", error.getStackTrace()); - - assertNull(errorTraceRepository.get("07271855-4-b180-6af")); - } - - @Test - public void testExists() { - assertTrue(errorTraceRepository.exists("07c32814-d7d1-48a5-8320-ed80435a4606")); - - assertTrue(errorTraceRepository.exists("ea96c23d-bbf1-4365-bdf5-bcf56f08ce1f")); - - assertFalse(errorTraceRepository.exists("07c32814-d7d1-48a5-8320-ed804356")); - } - - @Test - public void testFindAllErrors() { - assertEquals(8, errorTraceRepository.findAllErrors().size()); - errorTraceRepository.safeRemove(errorTraceRepository.get("ea96c23d-bbf1-4365-bdf5-bcf56f08ce1f")); - - List errors = errorTraceRepository.findAllErrors(); - assertEquals(7, errors.size()); - - for (ErrorTrace error : errors) - assertNotEquals("ea96c23d-bbf1-4365-bdf5-bcf56f08ce1f", error.getId()); - } - - @Test - public void testFindAllUnSolvedErrors() { - assertEquals(6, errorTraceRepository.findAllUnSolvedErrors().size()); - - ErrorTrace error = errorTraceRepository.get("911c7520-f701-419e-b225-5e21286b585b"); - error.setStatus(SOLVED); - error.setDateClosed(new Date()); - errorTraceRepository.update(error); - - List errors = errorTraceRepository.findAllUnSolvedErrors(); - assertEquals(5, errors.size()); - - for (ErrorTrace err : errors) - assertTrue(err.getStatus() == null || err.getStatus().equals(UNSOLVED)); - } - - @Test - public void testFindAllSolvedErrors() { - List errors = errorTraceRepository.findAllSolvedErrors(); - assertEquals(2, errors.size()); - for (ErrorTrace err : errors) - assertTrue(err.getStatus().equals(SOLVED)); - - ErrorTrace error = errorTraceRepository.get("48106c03-8900-4156-a7bf-93226e1d3e58"); - error.setStatus(UNSOLVED); - error.setDateClosed(null); - errorTraceRepository.update(error); - - errors = errorTraceRepository.findAllSolvedErrors(); - assertEquals(1, errors.size()); - assertEquals(new DateTime("2018-01-03T17:06:11.166"), errors.get(0).getDateOccurred()); - assertEquals("FormSubmissionProcessor", errors.get(0).getErrorType()); - assertEquals("org.opensrp.service.formSubmission.FormSubmissionListener", errors.get(0).getOccurredAt()); - assertEquals("[Ljava.lang.StackTraceElement;@50ef4583", errors.get(0).getStackTrace()); - - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/EventsRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/EventsRepositoryTest.java deleted file mode 100644 index 42d0706b27..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/EventsRepositoryTest.java +++ /dev/null @@ -1,612 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.Arrays; -import java.util.Calendar; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.joda.time.DateTime; -import org.junit.Test; -import org.opensrp.common.AllConstants.BaseEntity; -import org.opensrp.domain.Event; -import org.opensrp.domain.Obs; -import org.opensrp.repository.EventsRepository; -import org.opensrp.search.EventSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -public class EventsRepositoryTest extends BaseRepositoryTest { - - @Autowired - @Qualifier("eventsRepositoryPostgres") - private EventsRepository eventsRepository; - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet(); - scripts.add("event.sql"); - return scripts; - } - - @Test - public void testGet() { - Event event = eventsRepository.get("05934ae338431f28bf6793b2419c319a"); - assertEquals("ea1f9439-a663-4073-93b9-6ef2b8bca3c1", event.getBaseEntityId()); - assertEquals("d960046a-e2a0-4bbf-b687-d41c2a52d8c8", event.getFormSubmissionId()); - assertEquals("Vaccination", event.getEventType()); - //find non existent event - assertNull(eventsRepository.get("05934ae338431f28bf4234gvnbvvh")); - assertNull(eventsRepository.get(null)); - - //test results with deleted event - eventsRepository.safeRemove(event); - assertNull(eventsRepository.get(event.getId())); - } - - @Test - public void testGetAll() { - List events = eventsRepository.getAll(); - assertEquals(20, events.size()); - - //test with deleted event - Event event = eventsRepository.findById("05934ae338431f28bf6793b2419c319a"); - eventsRepository.safeRemove(event); - events = eventsRepository.getAll(); - assertEquals(19, events.size()); - for (Event e : events) - assertNotEquals("05934ae338431f28bf6793b2419c319a", e.getId()); - - } - - @Test - public void testFindAllByIdentifier() { - assertTrue(eventsRepository.findAllByIdentifier(null).isEmpty()); - List events = eventsRepository.findAllByIdentifier("06c8644b-b560-45fd-9af5-b6b1484e3504"); - assertEquals(1, events.size()); - assertEquals("d59504cc-09ef-4d09-9dc3-8f7eb65882fd", events.get(0).getFormSubmissionId()); - assertEquals("05934ae338431f28bf6793b241bdb88c", events.get(0).getId()); - - //test with deleted event - eventsRepository.safeRemove(events.get(0)); - assertTrue(eventsRepository.findAllByIdentifier("06c8644b-b560-45fd-9af5-b6b1484e3504").isEmpty()); - } - - @Test - public void testFindAllByIdentifierAndType() { - assertTrue(eventsRepository.findAllByIdentifier(null, null).isEmpty()); - List events = eventsRepository.findAllByIdentifier("OPENMRS_UUID", "06c8644b-b560-45fd-9af5-b6b1484e3504"); - assertEquals(1, events.size()); - assertEquals("d59504cc-09ef-4d09-9dc3-8f7eb65882fd", events.get(0).getFormSubmissionId()); - assertEquals("05934ae338431f28bf6793b241bdb88c", events.get(0).getId()); - - assertTrue(eventsRepository.findAllByIdentifier("OPENMRS", "06c8644b-b560-45fd-9af5-b6b1484e3504").isEmpty()); - - //test with deleted event - eventsRepository.safeRemove(events.get(0)); - assertTrue(eventsRepository.findAllByIdentifier("OPENMRS_UUID", "06c8644b-b560-45fd-9af5-b6b1484e3504").isEmpty()); - } - - @Test - public void testFindById() { - Event event = eventsRepository.findById("05934ae338431f28bf6793b2419c319a"); - assertEquals("ea1f9439-a663-4073-93b9-6ef2b8bca3c1", event.getBaseEntityId()); - assertEquals("d960046a-e2a0-4bbf-b687-d41c2a52d8c8", event.getFormSubmissionId()); - assertEquals("Vaccination", event.getEventType()); - //find non existent event - assertNull(eventsRepository.findById("05934ae338431f28bf4234gvnbvvh")); - assertNull(eventsRepository.findById(null)); - - //test with deleted event - eventsRepository.safeRemove(event); - assertNull(eventsRepository.findById("05934ae338431f28bf6793b2419c319a")); - } - - @Test - public void testFindByFormSubmissionId() { - Event event = eventsRepository.findByFormSubmissionId("31c4a45a-09f4-4b01-abe8-a87526827df6"); - assertEquals("ea1f9439-a663-4073-93b9-6ef2b8bca3c1", event.getBaseEntityId()); - assertEquals("05934ae338431f28bf6793b241781149", event.getId()); - assertEquals("Growth Monitoring", event.getEventType()); - //find non existent event - assertNull(eventsRepository.findByFormSubmissionId("05934ae338431f28bf4234gvnbvvh")); - assertNull(eventsRepository.findByFormSubmissionId(null)); - - //test with deleted event - eventsRepository.safeRemove(event); - assertNull(eventsRepository.findByFormSubmissionId("31c4a45a-09f4-4b01-abe8-a87526827df6")); - } - - @Test - public void testFindByBaseEntityId() { - List events = eventsRepository.findByBaseEntityId("58b33379-dab2-4f5c-8f09-6d2bd63023d8"); - assertEquals(7, events.size()); - - events = eventsRepository.findByBaseEntityId("43930c23-c787-4ddb-ab76-770f77e7b17d"); - assertEquals(1, events.size()); - assertEquals("6b3243e9-3d45-495c-af69-f012061def01", events.get(0).getFormSubmissionId()); - assertEquals("05934ae338431f28bf6793b24199e690", events.get(0).getId()); - assertEquals("New Woman Registration", events.get(0).getEventType()); - //non-existent records - assertTrue(eventsRepository.findByBaseEntityId("05934ae338431f28bf4234gvnbvvh").isEmpty()); - - //test with deleted event - eventsRepository.safeRemove(events.get(0)); - assertTrue(eventsRepository.findByBaseEntityId("43930c23-c787-4ddb-ab76-770f77e7b17d").isEmpty()); - } - - @Test - public void testFindByBaseEntityAndFormSubmissionId() { - Event event = eventsRepository.findByBaseEntityAndFormSubmissionId("58b33379-dab2-4f5c-8f09-6d2bd63023d8", - "baf8e663-71a1-4a30-8d40-2f3cab45a6d7"); - assertEquals("05934ae338431f28bf6793b241bdbb60", event.getId()); - - event = eventsRepository.findByBaseEntityAndFormSubmissionId("43930c23-c787-4ddb-ab76-770f77e7b17d", - "6b3243e9-3d45-495c-af69-f012061def01"); - assertEquals(3, event.getObs().size()); - assertEquals("05934ae338431f28bf6793b24199e690", event.getId()); - assertEquals("New Woman Registration", event.getEventType()); - //non-existent records - assertNull(eventsRepository.findByBaseEntityAndFormSubmissionId("58b33379-dab2-4f5c-8f09-6d2bd63023d8", "34354")); - - //test with deleted event - eventsRepository.safeRemove(event); - assertNull(eventsRepository.findByBaseEntityAndFormSubmissionId("43930c23-c787-4ddb-ab76-770f77e7b17d", - "6b3243e9-3d45-495c-af69-f012061def01")); - } - - @Test - public void testFindByBaseEntityAndType() { - List events = eventsRepository.findByBaseEntityAndType("58b33379-dab2-4f5c-8f09-6d2bd63023d8", "Vaccination"); - assertEquals(6, events.size()); - - events = eventsRepository.findByBaseEntityAndType("58b33379-dab2-4f5c-8f09-6d2bd63023d8", "Birth Registration"); - assertEquals(1, events.size()); - assertEquals("d59504cc-09ef-4d09-9dc3-8f7eb65882fd", events.get(0).getFormSubmissionId()); - assertEquals("05934ae338431f28bf6793b241bdb88c", events.get(0).getId()); - assertEquals(1521183592609l, events.get(0).getServerVersion().longValue()); - //non-existent records - assertTrue(eventsRepository.findByBaseEntityAndType("58b33379-dab2-4f5c-8f09-6d2bd63023d8", "Growth Monitoring") - .isEmpty()); - assertTrue(eventsRepository.findByBaseEntityAndType("58b33379", "Vaccination").isEmpty()); - - //test with deleted event - eventsRepository.safeRemove(events.get(0)); - assertTrue(eventsRepository.findByBaseEntityAndType("58b33379-dab2-4f5c-8f09-6d2bd63023d8", "Birth Registration") - .isEmpty()); - } - - @Test - public void testFindEvents() { - - EventSearchBean eventSearchBean = new EventSearchBean(); - eventSearchBean.setBaseEntityId("58b33379-dab2-4f5c-8f09-6d2bd63023d8"); - List events = eventsRepository.findEvents(eventSearchBean); - assertEquals(7, events.size()); - - DateTime from = new DateTime("2018-01-10T11:59:37.380"); - DateTime to = new DateTime("2018-02-21T12:00:08.788"); - - eventSearchBean.setEventDateFrom(from); - eventSearchBean.setEventDateTo(to); - events = eventsRepository.findEvents(eventSearchBean); - assertEquals(6, events.size()); - - eventSearchBean.setEventType("Vaccination"); - events = eventsRepository.findEvents(eventSearchBean); - assertEquals(6, events.size()); - - eventSearchBean.setEntityType("vaccination"); - events = eventsRepository.findEvents(eventSearchBean); - assertEquals(6, events.size()); - - eventSearchBean.setProviderId("biddemo"); - eventSearchBean.setLocationId("42abc582-6658-488b-922e-7be500c070f3"); - events = eventsRepository.findEvents(eventSearchBean); - assertEquals(6, events.size()); - - eventSearchBean.setTeam("ATeam"); - eventSearchBean.setTeamId("3453hgb454-4j345n-llk345"); - events = eventsRepository.findEvents(eventSearchBean); - assertEquals(2, events.size()); - for (Event event : events) { - assertEquals("3453hgb454-4j345n-llk345", event.getTeamId()); - assertEquals("ATeam", event.getTeam()); - assertEquals("42abc582-6658-488b-922e-7be500c070f3", event.getLocationId()); - assertEquals("biddemo", event.getProviderId()); - assertEquals("vaccination", event.getEntityType()); - assertEquals("Vaccination", event.getEventType()); - assertEquals("58b33379-dab2-4f5c-8f09-6d2bd63023d8", event.getBaseEntityId()); - assertTrue(event.getEventDate().isEqual(from) || event.getEventDate().isAfter(from)); - assertTrue(event.getEventDate().isEqual(to) || event.getEventDate().isBefore(to)); - } - - eventSearchBean.setLastEditFrom(new DateTime()); - eventSearchBean.setLastEditTo(new DateTime()); - events = eventsRepository.findEvents(eventSearchBean); - assertTrue(events.isEmpty()); - - DateTime editFrom = new DateTime("2018-03-16T10:03:01.537+03:00"); - DateTime editTo = new DateTime("2018-03-19T17:17:15.929+03:00"); - eventSearchBean.setLastEditFrom(editFrom); - eventSearchBean.setLastEditTo(editTo); - events = eventsRepository.findEvents(eventSearchBean); - assertEquals(2, events.size()); - for (Event event : events) { - assertTrue(event.getDateEdited().equals(editFrom) || event.getDateEdited().isAfter(editFrom)); - assertTrue(event.getDateEdited().equals(editTo) || event.getDateEdited().isBefore(editTo)); - } - - //test with deleted event - for (Event event : events) - eventsRepository.safeRemove(event); - assertTrue(eventsRepository.findEvents(eventSearchBean).isEmpty()); - } - - @Test(expected = IllegalArgumentException.class) - public void testFindEventsByDynamicQuery() { - eventsRepository.findEventsByDynamicQuery("baseEntityId:4234324"); - } - - @Test - public void testFindByServerVersion() { - assertEquals(20, eventsRepository.findByServerVersion(0).size()); - - //missing data - assertTrue(eventsRepository.findByServerVersion(1578908926000l).isEmpty()); - - List events = eventsRepository.findByServerVersion(1521469045587l); - assertEquals(8, events.size()); - List expectedIds = Arrays.asList("05934ae338431f28bf6793b241780bac", "05934ae338431f28bf6793b241781149", - "05934ae338431f28bf6793b241781a1e", "05934ae338431f28bf6793b241781149", "34166bde-2d40-4cb9-aec7-d8e4feb47c53", - "66c1ffdc-697c-4d31-b50d-6396ccb6368c", "f9db43e1-1b15-4d26-ba56-29136edb73d6", - "18a43e36-5701-4afc-b901-8eb4ce0e2002", "d945f800-eeca-415e-b737-e5611e19f706"); - for (Event event : events) { - assertTrue(event.getServerVersion() >= 1521469045587l); - assertTrue(expectedIds.contains(event.getId())); - } - - //test with deleted event - for (Event event : events) - eventsRepository.safeRemove(event); - assertTrue(eventsRepository.findByServerVersion(1521469045587l).isEmpty()); - } - - @Test - public void testNotInOpenMRSByServerVersion() { - Calendar cal = Calendar.getInstance(); - assertEquals(12, eventsRepository.notInOpenMRSByServerVersion(0, cal).size()); - - cal.setTimeInMillis(1521469045589l); - - //test missing data - assertTrue(eventsRepository.notInOpenMRSByServerVersion(1521469045597l, cal).isEmpty()); - - List events = eventsRepository.notInOpenMRSByServerVersion(1521469045588l, cal); - assertEquals(2, events.size()); - - List expectedIds = Arrays.asList("05934ae338431f28bf6793b241780bac", "05934ae338431f28bf6793b241781149"); - for (Event event : events) { - assertTrue(event.getServerVersion() >= 1521469045588l && event.getServerVersion() <= cal.getTimeInMillis()); - assertTrue(expectedIds.contains(event.getId())); - } - - //test with deleted event - for (Event event : events) - eventsRepository.safeRemove(event); - assertTrue(eventsRepository.notInOpenMRSByServerVersion(1521469045588l, cal).isEmpty()); - - } - - @Test - public void testNotInOpenMRSByServerVersionAndType() { - Calendar cal = Calendar.getInstance(); - assertEquals(4, eventsRepository.notInOpenMRSByServerVersionAndType("Growth Monitoring", 0, cal).size()); - //missing data - assertTrue(eventsRepository.notInOpenMRSByServerVersion(1578908926000l, cal).isEmpty()); - cal.setTimeInMillis(1521469045589l); - List events = eventsRepository.notInOpenMRSByServerVersionAndType("Growth Monitoring", 1521469045588l, cal); - List expectedIds = Arrays.asList("05934ae338431f28bf6793b241780bac", "05934ae338431f28bf6793b241781149"); - assertEquals(2, events.size()); - for (Event event : events) { - assertTrue(event.getServerVersion() >= 1521469045588l && event.getServerVersion() <= cal.getTimeInMillis()); - assertTrue(expectedIds.contains(event.getId())); - assertEquals("Growth Monitoring", event.getEventType()); - } - - //test with deleted event - for (Event event : events) - eventsRepository.safeRemove(event); - assertTrue(eventsRepository.notInOpenMRSByServerVersionAndType("Growth Monitoring", 1521469045588l, cal).isEmpty()); - - } - - @Test - public void testFindByClientAndConceptAndDate() { - List events = eventsRepository.findByClientAndConceptAndDate("58b33379-dab2-4f5c-8f09-6d2bd63023d8", - "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "1", "2018-01-10", new DateTime().toString("yyyy-MM-dd")); - assertEquals(5, events.size()); - for (Event event : events) { - assertTrue(event.getEventDate().equals(new DateTime("2018-01-10")) - || event.getEventDate().isAfter(new DateTime("2018-01-10"))); - assertEquals("58b33379-dab2-4f5c-8f09-6d2bd63023d8", event.getBaseEntityId()); - assertEquals("1", events.get(0).getObs(null, "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getValues().get(0)); - } - - events = eventsRepository.findByClientAndConceptAndDate("58b33379-dab2-4f5c-8f09-6d2bd63023d8", - "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "1", "2018-03-20", new DateTime().toString("yyyy-MM-dd")); - - assertTrue(events.isEmpty()); - - events = eventsRepository.findByClientAndConceptAndDate("58b33379-dab2-4f5c-8f09-6d2bd63023d8", - "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "2018-02-21", "2018-03-19", new DateTime().toString("yyyy-MM-dd")); - - assertEquals(4, events.size()); - - events = eventsRepository - .findByClientAndConceptAndDate("58b33379-dab2-4f5c-8f09-6d2bd63023d8", - "163531AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "Happy Kids Clinic", "2018-03-19", - new DateTime().toString("yyyy-MM-dd")); - - assertEquals(1, events.size()); - assertEquals("58b33379-dab2-4f5c-8f09-6d2bd63023d8", events.get(0).getBaseEntityId()); - assertEquals("05934ae338431f28bf6793b241bdb88c", events.get(0).getId()); - assertEquals("Happy Kids Clinic", events.get(0).getObs(null, "163531AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getValues() - .get(0)); - assertTrue(events.get(0).getDateCreated().equals(new DateTime("2018-03-19")) - || events.get(0).getDateCreated().isAfter(new DateTime("2018-03-19"))); - - //test with deleted event - eventsRepository.safeRemove(events.get(0)); - assertTrue(eventsRepository - .findByClientAndConceptAndDate("58b33379-dab2-4f5c-8f09-6d2bd63023d8", - "163531AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "Happy Kids Clinic", "2018-03-19", - new DateTime().toString("yyyy-MM-dd")).isEmpty()); - - } - - @Test - public void testFindByBaseEntityIdAndConceptParentCode() { - //missing data - List events = eventsRepository.findByBaseEntityIdAndConceptParentCode("58b33379-dab2-4f5c-8f09-6d2bd63023d8", - "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); - - assertTrue(events.isEmpty()); - - events = eventsRepository.findByBaseEntityIdAndConceptParentCode("58b33379-dab2-4f5c-8f09-6d2bd63023d8", - "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); - assertEquals(2, events.size()); - - events = eventsRepository.findByBaseEntityIdAndConceptParentCode("58b33379-dab2-4f5c-8f09-6d2bd63023d8", - "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); - - assertEquals(1, events.size()); - assertEquals("05934ae338431f28bf6793b241bdbc55", events.get(0).getId()); - boolean found = false; - for (Obs obs : events.get(0).getObs()) { - if (obs.getParentCode().equals("886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") - && obs.getFieldCode().equals("1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")) { - found = true; - break; - } - } - assertTrue(found); - - //test with deleted event - eventsRepository.safeRemove(events.get(0)); - assertTrue(eventsRepository.findByBaseEntityIdAndConceptParentCode("58b33379-dab2-4f5c-8f09-6d2bd63023d8", - "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").isEmpty()); - - } - - @Test - public void testFindByConceptAndValue() { - List events = eventsRepository.findByConceptAndValue("1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "1"); - assertEquals(8, events.size()); - - events = eventsRepository.findByConceptAndValue("1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "5"); - - assertTrue(events.isEmpty()); - - events = eventsRepository.findByConceptAndValue("1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "2018-02-21"); - - assertEquals(4, events.size()); - for (Event event : events) { - assertEquals("2018-02-21", event.getObs(null, "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getValues().get(0)); - } - - events = eventsRepository.findByConceptAndValue("163531AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "Happy Kids Clinic"); - - assertEquals(1, events.size()); - assertEquals("58b33379-dab2-4f5c-8f09-6d2bd63023d8", events.get(0).getBaseEntityId()); - assertEquals("05934ae338431f28bf6793b241bdb88c", events.get(0).getId()); - - //test with deleted event - eventsRepository.safeRemove(events.get(0)); - assertTrue(eventsRepository.findByConceptAndValue("163531AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "Happy Kids Clinic") - .isEmpty()); - - } - - @Test - public void testFindEvents2() { - EventSearchBean eventSearchBean = new EventSearchBean(); - eventSearchBean.setTeam("ATeam"); - eventSearchBean.setTeamId("3453hgb454-4j345n-llk345"); - List events = eventsRepository.findEvents(eventSearchBean, null, null, 20); - assertEquals(2, events.size()); - - eventSearchBean = new EventSearchBean(); - eventSearchBean.setTeam("ATeam,BTeam"); - events = eventsRepository.findEvents(eventSearchBean, null, null, 20); - assertEquals(3, events.size()); - - eventSearchBean = new EventSearchBean(); - eventSearchBean.setProviderId("biddemo,biddemo2"); - eventSearchBean.setLocationId("42b88545-7ebb-4e11-8d1a-3d3a924c8af4,42b88545-7ebb-4e11-8d1a-3d3a924c8af5"); - events = eventsRepository.findEvents(eventSearchBean, null, null, 20); - assertEquals(7, events.size()); - - eventSearchBean.setBaseEntityId("58b33379-dab2-4f5c-8f09-6d2bd63023d8"); - events = eventsRepository.findEvents(eventSearchBean, null, null, 20); - assertEquals(0, events.size()); - - eventSearchBean.setLocationId("42abc582-6658-488b-922e-7be500c070f3"); - events = eventsRepository.findEvents(eventSearchBean, null, null, 20); - assertEquals(7, events.size()); - - eventSearchBean.setEventType("Birth Registration"); - events = eventsRepository.findEvents(eventSearchBean, null, null, 20); - assertEquals(1, events.size()); - assertEquals("Birth Registration", events.get(0).getEventType()); - assertEquals("05934ae338431f28bf6793b241bdb88c", events.get(0).getId()); - - eventSearchBean = new EventSearchBean(); - eventSearchBean.setTeam("ATeam,BTeam"); - eventSearchBean.setTeamId("3453hgb454-4j345n-llk345,3453hgb454-4j345n-llk348"); - eventSearchBean.setProviderId("biddemo"); - eventSearchBean.setServerVersion(0l); - events = eventsRepository.findEvents(eventSearchBean, BaseEntity.SERVER_VERSIOIN, "asc", 20); - assertEquals(3, events.size()); - - long previousVersion = 0; - for (Event event : events) { - assertTrue(event.getTeam().equals("ATeam") || event.getTeam().equals("BTeam")); - assertTrue(event.getTeamId().equals("3453hgb454-4j345n-llk345") - || event.getTeamId().equals("3453hgb454-4j345n-llk348")); - assertEquals("42abc582-6658-488b-922e-7be500c070f3", event.getLocationId()); - assertEquals("biddemo", event.getProviderId()); - assertTrue(event.getServerVersion() >= previousVersion); - previousVersion = event.getServerVersion(); - } - - //test with deleted event - for (Event event : events) - eventsRepository.safeRemove(event); - assertTrue(eventsRepository.findEvents(eventSearchBean, BaseEntity.SERVER_VERSIOIN, "asc", 20).isEmpty()); - } - - @Test - public void testUpdate() { - Event event = eventsRepository.get("05934ae338431f28bf6793b2419c64fb"); - long now = System.currentTimeMillis(); - event.setServerVersion(now); - event.setDateEdited(new DateTime(now)); - Obs obs = new Obs("concept", "text", "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", null, "25-Apr-2017", null, - "Date_Reaction"); - event.addObs(obs); - eventsRepository.update(event); - event = eventsRepository.get("05934ae338431f28bf6793b2419c64fb"); - assertEquals(now, event.getServerVersion().longValue()); - assertEquals(now, event.getDateEdited().getMillis()); - assertEquals(3, event.getObs().size()); - assertEquals(obs.getValue(), event.getObs(null, "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getValue()); - - //test update with voided date deletes event - event.setDateVoided(new DateTime()); - eventsRepository.update(event); - assertNull(eventsRepository.get(event.getId())); - } - - @Test - public void testFindByEmptyServerVersion() { - assertEquals(0, eventsRepository.findByEmptyServerVersion().size()); - Event event = eventsRepository.get("05934ae338431f28bf6793b241bdb88c"); - event.setServerVersion(0l); - eventsRepository.update(event); - - event = eventsRepository.get("05934ae338431f28bf6793b241bdbb60"); - event.setServerVersion(null); - eventsRepository.update(event); - long beforeFetch = System.currentTimeMillis(); - List events = eventsRepository.findByEmptyServerVersion(); - assertEquals(2, events.size()); - for (Event loopEvent : events) { - assertTrue(loopEvent.getId().equals("05934ae338431f28bf6793b241bdb88c") - || loopEvent.getId().equals("05934ae338431f28bf6793b241bdbb60")); - //if serverVersion is null will automatically be set to current timestamp in org.opensrp.domain.BaseDataObject.serverVersion - assertTrue(loopEvent.getServerVersion() == 0 || loopEvent.getServerVersion() >= beforeFetch); - - } - - //test with deleted event - for (Event e : events) - eventsRepository.safeRemove(e); - assertTrue(eventsRepository.findByEmptyServerVersion().isEmpty()); - } - - @Test - public void testFindEventByEventTypeBetweenTwoDates() { - List events = eventsRepository.getAll(); - Calendar cal = Calendar.getInstance(); - cal.set(Calendar.DATE, 1); - for (Event event : events) { - event.setServerVersion(cal.getTimeInMillis()); - eventsRepository.update(event); - } - assertEquals(9, eventsRepository.findEventByEventTypeBetweenTwoDates("Vaccination").size()); - assertEquals(4, eventsRepository.findEventByEventTypeBetweenTwoDates("Growth Monitoring").size()); - events = eventsRepository.findEventByEventTypeBetweenTwoDates("Birth Registration"); - assertEquals(1, events.size()); - assertEquals("58b33379-dab2-4f5c-8f09-6d2bd63023d8", events.get(0).getBaseEntityId()); - assertEquals("05934ae338431f28bf6793b241bdb88c", events.get(0).getId()); - - //test with deleted event - eventsRepository.safeRemove(events.get(0)); - assertTrue(eventsRepository.findEventByEventTypeBetweenTwoDates("Birth Registration").isEmpty()); - } - - @Test - public void testSafeRemove() { - Event event = eventsRepository.get("05934ae338431f28bf6793b241bdb88c"); - eventsRepository.safeRemove(event); - List events = eventsRepository.getAll(); - assertEquals(19, events.size()); - for (Event e : events) - assertNotEquals("05934ae338431f28bf6793b241bdb88c", e.getId()); - assertNull(eventsRepository.get("05934ae338431f28bf6793b241bdb88c")); - } - - @Test - public void testAdd() { - Obs obs = new Obs("concept", "decimal", "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", null, "3.5", null, "weight"); - Event event = new Event().withBaseEntityId("435534534543").withEventType("Growth Monitoring") - .withFormSubmissionId("gjhg34534 nvbnv3345345__4").withEventDate(new DateTime()).withObs(obs); - - eventsRepository.add(event); - - event = eventsRepository.findByFormSubmissionId("gjhg34534 nvbnv3345345__4"); - assertEquals("435534534543", event.getBaseEntityId()); - assertEquals("Growth Monitoring", event.getEventType()); - assertEquals(1, event.getObs().size()); - assertEquals("3.5", event.getObs(null, "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getValue()); - - //test if an event with voided date add event as deleted - event = new Event().withBaseEntityId("2423nj-sdfsd-sf2dfsd-2399d").withEventType("Vaccination") - .withFormSubmissionId("hshj2342_jsjs-jhjsdfds-23").withEventDate(new DateTime()).withObs(obs); - event.setDateVoided(new DateTime()); - eventsRepository.add(event); - assertNull(eventsRepository.findByFormSubmissionId(event.getFormSubmissionId())); - - } - - @Test - public void testFindByProvider() { - List events = eventsRepository.findByProvider("biddemo"); - assertEquals(13, events.size()); - events = eventsRepository.findByProvider("biddemo2"); - assertEquals(2, events.size()); - for (Event event : events) { - assertEquals("biddemo2", event.getProviderId()); - assertTrue(event.getId().equals("05934ae338431f28bf6793b241781149") - || event.getId().equals("05934ae338431f28bf6793b241781a1e")); - } - assertTrue(eventsRepository.findByProvider("biddemo9").isEmpty()); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/LocationRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/LocationRepositoryTest.java deleted file mode 100644 index e1fe15bff7..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/LocationRepositoryTest.java +++ /dev/null @@ -1,675 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.sql.SQLException; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; - -import org.apache.commons.lang.builder.ReflectionToStringBuilder; -import org.joda.time.LocalDate; -import org.junit.Test; -import org.opensrp.domain.Client; -import org.opensrp.domain.Geometry; -import org.opensrp.domain.Geometry.GeometryType; -import org.opensrp.domain.LocationProperty; -import org.opensrp.domain.LocationProperty.PropertyStatus; -import org.opensrp.domain.PhysicalLocation; -import org.opensrp.domain.StructureDetails; -import org.opensrp.repository.ClientsRepository; -import org.opensrp.repository.LocationRepository; -import org.opensrp.util.DateTypeConverter; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonPrimitive; - -public class LocationRepositoryTest extends BaseRepositoryTest { - private String parentJson = "{\"id\": \"3366\", \"type\": \"Feature\", \"geometry\": {\"type\": \"MultiPolygon\", \"coordinates\": [[[[32.60019625316408, -14.16712789883206], [32.60026392129685, -14.167200170670068], [32.600326068380916, -14.167277018364924], [32.60038237040833, -14.167358041272504], [32.60043253384264, -14.167442816981005], [32.600461865346055, -14.167501855260806], [32.600467305754925, -14.167504082164154], [32.6005567791152, -14.167548365892056], [32.60064274437109, -14.16759883363829], [32.60072475334385, -14.167655222291442], [32.600802378479834, -14.167717237871212], [32.60087521507938, -14.167784557061506], [32.60094288340667, -14.167856828895705], [32.60100503066945, -14.167933676586241], [32.6010613328587, -14.168014699489389], [32.60111149643739, -14.16809947519317], [32.601155259871, -14.168187561720227], [32.60119239499158, -14.168278499831782], [32.60122270818726, -14.168371815421606], [32.601246041411336, -14.168467021987961], [32.60126227300679, -14.16856362316997], [32.60127131834104, -14.168661115335109], [32.601273130246504, -14.168758990205273], [32.60126809520835, -14.168849611326149], [32.601268746132114, -14.168884772675423], [32.60126331515021, -14.16898251997554], [32.601250669585276, -14.1690796300968], [32.6012308753564, -14.169175596751185], [32.60120403565332, -14.169269919610993], [32.6011702903973, -14.169362106918296], [32.60112981551378, -14.169451678048457], [32.60108282201332, -14.169538166015567], [32.60102955489338, -14.169621119908012], [32.60097029185993, -14.169700107238382], [32.60090534188031, -14.169774716199182], [32.6008350435718, -14.169844557809366], [32.600817649001606, -14.169859510027148], [32.60076264386304, -14.169914157803586], [32.60068736370561, -14.169978867936662], [32.60060749419761, -14.170038109219828], [32.600559934780954, -14.170068364123377], [32.60056014202427, -14.170070597813773], [32.6005619539411, -14.170168472672398], [32.60055652292868, -14.170266219962112], [32.60054387729263, -14.170363330073084], [32.600524082952795, -14.170459296717066], [32.60049724309874, -14.170553619566872], [32.600463497653145, -14.170645806864396], [32.60042302254208, -14.17073537798495], [32.60037602877764, -14.170821865942909], [32.600344492416745, -14.170870977832461], [32.60034438539213, -14.170871496706125], [32.60031754548958, -14.170965819552745], [32.60028379998311, -14.171058006847087], [32.600243324799, -14.171147577964515], [32.600196330949636, -14.17123406591946], [32.600143063434295, -14.171317019800309], [32.60008379996071, -14.171396007119537], [32.600018849498774, -14.171470616069879], [32.59994855066821, -14.171540457670288], [32.59987326997469, -14.17160516779455], [32.59979339989791, -14.171664409069702], [32.59970935684628, -14.171717872634868], [32.59964225969093, -14.17175411050408], [32.59958840035244, -14.171794059057728], [32.599504357253004, -14.171847522622325], [32.59941657934149, -14.171894929738581], [32.59932552425658, -14.17193603324409], [32.59923166672291, -14.171970618840756], [32.599135496077615, -14.171998506212216], [32.599037513717285, -14.172019549964542], [32.59893823048531, -14.17203364038323], [32.598838164007354, -14.172040704006005], [32.59873783599283, -14.172040704006005], [32.5986377695147, -14.17203364038323], [32.598538486282784, -14.172019549964542], [32.59844050392257, -14.171998506212216], [32.59836476694522, -14.171976544154969], [32.598302157782705, -14.172016372605977], [32.598214379806386, -14.172063779721551], [32.59812332465395, -14.172104883226435], [32.59802946705104, -14.172139468822703], [32.59793329633447, -14.172167356193764], [32.59783531390183, -14.17218839994575], [32.59773603059636, -14.172202490364267], [32.59763596404451, -14.172209553987042], [32.597535635955744, -14.172209553987042], [32.59743556940372, -14.172202490364267], [32.59735870544443, -14.17219158172912], [32.59734235282223, -14.172210366013356], [32.597272053763895, -14.172280207609443], [32.59721759844722, -14.172327016406367], [32.59719788529895, -14.172349660918595], [32.59712758619781, -14.172419502513943], [32.59705230521461, -14.172484212633432], [32.59697243483037, -14.172543453904321], [32.59691580121147, -14.17257948095516], [32.596914419626664, -14.172580505700747], [32.596830376237726, -14.172633969261877], [32.59674259802403, -14.172681376375007], [32.59665154262529, -14.172722479877844], [32.59655768476852, -14.172757065472238], [32.59646151379189, -14.17278495284199], [32.59636353109419, -14.172805996592896], [32.59626424752013, -14.172820087010617], [32.596164180697365, -14.172827150632937], [32.596063852337345, -14.172827150632937], [32.595963785514634, -14.172820087010617], [32.595864501940746, -14.172805996592896], [32.59576651924305, -14.17278495284199], [32.595670348266246, -14.172757065472238], [32.59562983666279, -14.17274213738909], [32.59557352665137, -14.17277254919497], [32.595482471216194, -14.172813652697524], [32.59538861332191, -14.172848238291575], [32.595346903973216, -14.172860333037871], [32.59534239579221, -14.172862368083766], [32.59524853787786, -14.172896953677704], [32.59515236684228, -14.172924841047173], [32.595054384084555, -14.17294588479774], [32.59495510044973, -14.172959975215402], [32.594855033565686, -14.172967038837665], [32.59475470514422, -14.172967038837665], [32.59465463826023, -14.172959975215402], [32.594555354625406, -14.17294588479774], [32.59445737186763, -14.172924841047173], [32.59442506589232, -14.172915473063707], [32.59433007182053, -14.172915473063707], [32.59423000495905, -14.17290840944133], [32.594130721346794, -14.172894319023781], [32.59403273861107, -14.172873275273044], [32.593936567597375, -14.172845387903461], [32.59384270970417, -14.172810802309353], [32.59375165427024, -14.1727696988068], [32.59366387602261, -14.172722291693898], [32.59357983260116, -14.172668828133279], [32.593499962173034, -14.172609586863073], [32.5934246811484, -14.172544876744151], [32.5934126306829, -14.172532904709552], [32.59335004540372, -14.17247910759323], [32.593279746284274, -14.172409265998223], [32.593214795555234, -14.172334657053792], [32.59315553183807, -14.172255669740649], [32.59310226410371, -14.172172715866392], [32.59305527006142, -14.172086227918097], [32.593014794710705, -14.171996656807604], [32.592981049065706, -14.171904469520424], [32.59295420905283, -14.171810146681306], [32.592934414595895, -14.17171418004801], [32.59292176888527, -14.171617069947953], [32.59291633784067, -14.171519322669322], [32.59291814976836, -14.171421447821611], [32.592927195211864, -14.171323955678812], [32.59294342700377, -14.17122735451903], [32.5929667605099, -14.171132147974616], [32.59299707407205, -14.171038832406278], [32.593034209641694, -14.170947894315642], [32.59307797360429, -14.17085980780882], [32.59312813778927, -14.170775032124592], [32.59318444065922, -14.170694009240147], [32.593246588673246, -14.170617161567233], [32.59331425781857, -14.170544889749747], [32.59338709529839, -14.17047757057497], [32.59346472137269, -14.170415555009466], [32.59354673133668, -14.17035916636939], [32.593632697631556, -14.170308698634809], [32.59372217207328, -14.17026441491714], [32.59381468818895, -14.17022654608763], [32.59390976364897, -14.170195289573538], [32.59400690278124, -14.17017080832937], [32.59410559915556, -14.17015322998668], [32.594108641289544, -14.170152907171083], [32.59410452416977, -14.170078807274818], [32.594104747347494, -14.170066751816304], [32.59409492477396, -14.170019130079421], [32.594082279157185, -14.169922019965721], [32.59407684815306, -14.169824272673221], [32.59407866006705, -14.169726397811754], [32.59408770544342, -14.169628905655198], [32.5941039371147, -14.169532304481717], [32.59412727044752, -14.169437097923888], [32.59415758378457, -14.169343782342306], [32.59419471907852, -14.16925284423888], [32.59423848271643, -14.169164757719555], [32.59428864652886, -14.169079982023387], [32.59434494898084, -14.168998959127517], [32.59440709653352, -14.168922111443745], [32.594474765176464, -14.16884983961597], [32.59454760211582, -14.168782520431701], [32.59462522761384, -14.168720504857387], [32.594707236969036, -14.168664116209353], [32.59479320262607, -14.168613648467609], [32.59488267640358, -14.168569364743629], [32.594975191832525, -14.168531495908722], [32.59507026658701, -14.168500239390308], [32.59516740499827, -14.168475758142618], [32.59526610063994, -14.168458179797423], [32.59529244876699, -14.168455383848364], [32.59529777359045, -14.168442344202102], [32.59534153707289, -14.16835425767692], [32.595391700707346, -14.168269481975013], [32.595448002959465, -14.16818845907363], [32.59551015029154, -14.168111611384685], [32.59557781869437, -14.16803933955202], [32.5956506553752, -14.167972020363091], [32.595728280597704, -14.16791000478474], [32.59578277701842, -14.167872533564658], [32.59578663074716, -14.167869454781108], [32.59586863979683, -14.167813066128982], [32.595870154342826, -14.167812176983087], [32.59588304190657, -14.167790397169766], [32.595939344040566, -14.167709374265083], [32.59600149124241, -14.167632526573069], [32.59606915950308, -14.167560254737506], [32.59614199603117, -14.167492935545964], [32.59621962109099, -14.167430919964941], [32.59630162998314, -14.167374531310939], [32.59638759515462, -14.16732406356368], [32.59647706842696, -14.167279779834924], [32.596569583333626, -14.167241910996037], [32.59666465755111, -14.1672106544741], [32.59676179541406, -14.16718617322385], [32.59686049049849, -14.167168594876781], [32.59696022826284, -14.167158011076763], [32.597060488729475, -14.167154477001755], [32.59716074919606, -14.167158011076763], [32.5972604869604, -14.167168594876781], [32.59731452694961, -14.167178219810861], [32.59732387518306, -14.167149442233491], [32.597361010120146, -14.167058504113466], [32.59740477333741, -14.166970417578053], [32.59745493666792, -14.166885641866255], [32.59751123857881, -14.166804618955549], [32.59757338553447, -14.16672777125768], [32.59764105352729, -14.166655499416716], [32.59771388976673, -14.16658818022], [32.597791514519024, -14.166526164634373], [32.59787352308643, -14.166469775975994], [32.597959487917244, -14.166419308225041], [32.59804896083539, -14.166375024492819], [32.59814147537559, -14.166337155650975], [32.59823654921649, -14.166305899126767], [32.598333686694666, -14.166281417874698], [32.59843238138813, -14.16626383952632], [32.598480894615356, -14.16625869146247], [32.59854368499213, -14.166247507971715], [32.59864342235414, -14.166236924170786], [32.59874368241662, -14.16623339009561], [32.59884394247893, -14.166236924170786], [32.598943679841106, -14.166247507971715], [32.59904237452752, -14.166265086320092], [32.59913951199871, -14.166289567572331], [32.59923458583284, -14.166320824096541], [32.5993271003665, -14.166358692938498], [32.599416573278056, -14.166402976670607], [32.59950253810285, -14.166453444421673], [32.599584546664396, -14.166509833080223], [32.599662171411175, -14.16657184866585], [32.59973500764527, -14.166639167862566], [32.59980267563332, -14.166711439703702], [32.59986482258454, -14.166788287401683], [32.59992112449134, -14.166869310312448], [32.59996455353569, -14.16694270512846], [32.60004579186107, -14.166998564054833], [32.600123416774004, -14.167060579638072], [32.60019625316408, -14.16712789883206]]]]}, \"properties\": {\"name\": \"MKB_5\", \"status\": \"Active\", \"version\": 0, \"parentId\": \"2953\", \"geographicLevel\": 2}, \"serverVersion\": 1542965231623}"; - private Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HHmm") - .registerTypeAdapter(LocalDate.class, new DateTypeConverter()).serializeNulls().create(); - - private Set scripts = new HashSet(); - - private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - @Autowired - private LocationRepository locationRepository; - - @Autowired - @Qualifier("clientsRepositoryPostgres") - private ClientsRepository clientsRepository; - - protected Set getDatabaseScripts() { - scripts.add("location.sql"); - scripts.add("structure.sql"); - return scripts; - } - - @Test - public void testGet() { - PhysicalLocation location = locationRepository.get("3734"); - assertNotNull(location); - assertEquals("41587456-b7c8-4c4e-b433-23a786f742fc", location.getProperties().getUid()); - assertEquals("21", location.getProperties().getParentId()); - assertEquals("Intervention Unit", location.getProperties().getType()); - assertEquals(PropertyStatus.ACTIVE, location.getProperties().getStatus()); - assertEquals(1542378347104l, location.getServerVersion().longValue()); - - JsonArray coordinates = location.getGeometry().getCoordinates().get(0).getAsJsonArray().get(0).getAsJsonArray(); - assertEquals(267, coordinates.size()); - - JsonArray coordinate1 = coordinates.get(0).getAsJsonArray(); - assertEquals(32.59989007736522, coordinate1.get(0).getAsDouble(), 0); - assertEquals(-14.167432040756012, coordinate1.get(1).getAsDouble(), 0); - - JsonArray coordinate67 = coordinates.get(66).getAsJsonArray(); - assertEquals(32.5988341383848, coordinate67.get(0).getAsDouble(), 0); - assertEquals(-14.171814074659776, coordinate67.get(1).getAsDouble(), 0); - } - - @Test - public void testGetWithNullOrEmptyParams() { - assertNull(locationRepository.get("")); - - assertNull(locationRepository.get(null)); - - } - - @Test - public void testGetNotExistingLocation() { - assertNull(locationRepository.get("1212121")); - } - - @Test - public void testGetStructure() throws ParseException { - PhysicalLocation structure = locationRepository.getStructure("90397", true); - assertNotNull(structure); - assertEquals("90397", structure.getId()); - - assertEquals(GeometryType.POLYGON, structure.getGeometry().getType()); - assertFalse(structure.getGeometry().getCoordinates().isJsonNull()); - - assertEquals("41587456-b7c8-4c4e-b433-23a786f742fc", structure.getProperties().getUid()); - assertEquals("21384443", structure.getProperties().getCode()); - assertEquals("Residential Structure", structure.getProperties().getType()); - assertEquals(PropertyStatus.ACTIVE, structure.getProperties().getStatus()); - assertEquals("3734", structure.getProperties().getParentId()); - assertNull(structure.getProperties().getName()); - assertEquals(5, structure.getProperties().getGeographicLevel()); - assertEquals(dateFormat.parse("2017-01-10"), structure.getProperties().getEffectiveStartDate()); - assertNull(structure.getProperties().getEffectiveEndDate()); - assertEquals(0, structure.getProperties().getVersion()); - } - - @Test - public void testGetStructureWithNullOrEmptyParams() { - assertNull(locationRepository.getStructure("", true)); - - assertNull(locationRepository.getStructure(null, true)); - - } - - @Test - public void testGetStructureNotExistingLocation() { - assertNull(locationRepository.getStructure("1212121", true)); - } - - @Test - public void testAddLocation() { - String uuid = UUID.randomUUID().toString(); - PhysicalLocation physicalLocation = createLocation(uuid); - locationRepository.add(physicalLocation); - PhysicalLocation savedLocation = locationRepository.get("223232"); - - assertNotNull(savedLocation); - assertEquals("Feature", savedLocation.getType()); - - assertNull(locationRepository.getStructure("223232", true)); - - } - - @Test - public void testAddLocationWithoutId() { - PhysicalLocation physicalLocation = new PhysicalLocation(); - physicalLocation.setJurisdiction(true); - locationRepository.add(physicalLocation); - - assertEquals(2, locationRepository.getAll().size()); - assertEquals(1, locationRepository.getAllStructures().size()); - - } - - @Test - public void testAddLocationExistingShouldNotChangeObject() { - - PhysicalLocation physicalLocation = locationRepository.get("3734"); - physicalLocation.getProperties().setName("MY Operational Area"); - physicalLocation.setJurisdiction(true); - - locationRepository.add(physicalLocation); - - physicalLocation = locationRepository.get("3734"); - assertNotEquals("MY Operational Area", physicalLocation.getProperties().getName()); - - assertEquals(2, locationRepository.getAll().size()); - assertEquals(1, locationRepository.getAllStructures().size()); - - } - - @Test - public void testAddStructure() { - String uuid = UUID.randomUUID().toString(); - PhysicalLocation physicalLocation = createStructure(uuid); - - locationRepository.add(physicalLocation); - PhysicalLocation savedLocation = locationRepository.getStructure("121212", true); - - assertNotNull(savedLocation); - assertEquals("Feature", savedLocation.getType()); - assertEquals(GeometryType.POLYGON, savedLocation.getGeometry().getType()); - assertEquals(PropertyStatus.ACTIVE, savedLocation.getProperties().getStatus()); - assertEquals(uuid, savedLocation.getProperties().getUid()); - - assertNull(locationRepository.get("121212")); - - } - - @Test - public void testAddStructureWithoutId() { - PhysicalLocation physicalLocation = new PhysicalLocation(); - locationRepository.add(physicalLocation); - - assertEquals(2, locationRepository.getAll().size()); - assertEquals(1, locationRepository.getAllStructures().size()); - - } - - @Test - public void testAddStructureExistingShouldNotChangeObject() { - - PhysicalLocation physicalLocation = locationRepository.getStructure("90397", true); - physicalLocation.getProperties().setName("Mwangala Household"); - locationRepository.add(physicalLocation); - - physicalLocation = locationRepository.getStructure("90397", true); - assertNotEquals("Mwangala Household", physicalLocation.getProperties().getName()); - - assertEquals(2, locationRepository.getAll().size()); - assertEquals(1, locationRepository.getAllStructures().size()); - - } - - @Test - public void testUpdateLocation() throws ParseException { - PhysicalLocation physicalLocation = locationRepository.get("3734"); - physicalLocation.getGeometry().setType(GeometryType.POLYGON); - physicalLocation.getProperties().setStatus(PropertyStatus.PENDING_REVIEW); - physicalLocation.getProperties().setGeographicLevel(3); - - Date effectiveStartDate = dateFormat.parse("2019-07-15"); - Date effectiveEndDate = dateFormat.parse("2020-07-15"); - physicalLocation.getProperties().setEffectiveStartDate(effectiveStartDate); - physicalLocation.getProperties().setEffectiveEndDate(effectiveEndDate); - physicalLocation.getProperties().setVersion(2); - physicalLocation.setJurisdiction(true); - locationRepository.update(physicalLocation); - PhysicalLocation updatedLocation = locationRepository.get("3734"); - - assertNotNull(updatedLocation); - assertEquals(GeometryType.POLYGON, updatedLocation.getGeometry().getType()); - assertEquals(PropertyStatus.PENDING_REVIEW, updatedLocation.getProperties().getStatus()); - assertEquals(3, updatedLocation.getProperties().getGeographicLevel()); - assertEquals(effectiveStartDate, updatedLocation.getProperties().getEffectiveStartDate()); - assertEquals(effectiveEndDate, updatedLocation.getProperties().getEffectiveEndDate()); - assertEquals(2, updatedLocation.getProperties().getVersion()); - - assertNull(locationRepository.getStructure("3734", true)); - - } - - @Test - public void testUpdateLocationWithoutId() { - PhysicalLocation physicalLocation = new PhysicalLocation(); - locationRepository.add(physicalLocation); - - assertEquals(2, locationRepository.getAll().size()); - assertEquals(1, locationRepository.getAllStructures().size()); - - } - - @Test - public void testUpdateLocationNonExistingShouldNotChangeObject() { - - PhysicalLocation physicalLocation = new PhysicalLocation(); - physicalLocation.setId("223232"); - physicalLocation.setType("Feature"); - physicalLocation.setJurisdiction(true); - locationRepository.update(physicalLocation); - - assertNull(locationRepository.get("223232")); - assertNull(locationRepository.getStructure("223232", true)); - - } - - @Test - public void testUpdateStructure() { - PhysicalLocation structure = locationRepository.getStructure("90397", true); - structure.getProperties().setCode("12121"); - structure.getProperties().setParentId("11"); - locationRepository.update(structure); - - PhysicalLocation updatedStructure = locationRepository.getStructure("90397", true); - - assertNotNull(updatedStructure); - assertEquals("12121", updatedStructure.getProperties().getCode()); - assertEquals("11", updatedStructure.getProperties().getParentId()); - - assertNull(locationRepository.get("90397")); - - } - - @Test - public void testUpdateStructureWithoutId() { - PhysicalLocation structure = new PhysicalLocation(); - locationRepository.add(structure); - - assertEquals(2, locationRepository.getAll().size()); - assertEquals(1, locationRepository.getAllStructures().size()); - - } - - @Test - public void testUpdateStructureExistingShouldNotChangeObject() { - - PhysicalLocation physicalLocation = new PhysicalLocation(); - physicalLocation.setId("223232"); - physicalLocation.setType("Feature"); - locationRepository.update(physicalLocation); - - assertNull(locationRepository.get("223232")); - assertNull(locationRepository.getStructure("223232", true)); - - } - - @Test - public void testGetAll() { - List locations = locationRepository.getAll(); - assertEquals(2, locations.size()); - - locationRepository.safeRemove(locationRepository.get("3734")); - locationRepository.safeRemove(locationRepository.get("3735")); - - assertTrue(locationRepository.getAll().isEmpty()); - - String uuid = UUID.randomUUID().toString(); - locationRepository.add(createLocation(uuid)); - - locations = locationRepository.getAll(); - - assertEquals(1, locations.size()); - assertEquals("223232", locations.get(0).getId()); - assertEquals(uuid, locations.get(0).getProperties().getUid()); - - } - - @Test - public void testSafeRemoveLocation() { - - assertNotNull(locationRepository.get("3734")); - - locationRepository.safeRemove(locationRepository.get("3734")); - - assertNull(locationRepository.get("3734")); - } - - @Test - public void testSafeRemoveStructure() { - - assertNotNull(locationRepository.getStructure("90397", true)); - - locationRepository.safeRemove(locationRepository.getStructure("90397", true)); - - assertNull(locationRepository.getStructure("90397", true)); - } - - @Test - public void testSafeRemoveNonExistentLocation() { - locationRepository.safeRemove(null); - locationRepository.safeRemove(new PhysicalLocation()); - assertEquals(2, locationRepository.getAll().size()); - - locationRepository.safeRemove(locationRepository.get("671198")); - assertEquals(2, locationRepository.getAll().size()); - - } - - @Test - public void testFindLocationsByServerVersion() { - - List locations = locationRepository.findLocationsByServerVersion(1542378347106l); - assertTrue(locations.isEmpty()); - - locations = locationRepository.findLocationsByServerVersion(1l); - System.out.println(ReflectionToStringBuilder.toString(locations.get(0))); - assertEquals(1, locations.size()); - assertEquals("3734", locations.get(0).getId()); - assertTrue(locations.get(0).getServerVersion() >= 1l); - - locations.get(0).setServerVersion(null); - locationRepository.update(locations.get(0)); - - locations = locationRepository.findLocationsByServerVersion(1l); - assertTrue(locations.isEmpty()); - - } - - @Test - public void testFindStructuresByParentAndServerVersion() { - - List locations = locationRepository.findStructuresByParentAndServerVersion("3734", - 1542376382859l); - assertTrue(locations.isEmpty()); - - locations = locationRepository.findStructuresByParentAndServerVersion("3734", 1542376382851l); - assertEquals(1, locations.size()); - assertEquals("90397", locations.get(0).getId()); - assertEquals("3734", locations.get(0).getProperties().getParentId()); - assertEquals(1542376382851l, locations.get(0).getServerVersion().longValue()); - assertTrue(locations.get(0).getServerVersion() >= 1l); - - locations = locationRepository.findStructuresByParentAndServerVersion("3734,001", 1542376382851l); - assertEquals(1, locations.size()); - assertEquals("90397", locations.get(0).getId()); - assertEquals("3734", locations.get(0).getProperties().getParentId()); - - locations.get(0).setServerVersion(null); - locationRepository.update(locations.get(0)); - - locations = locationRepository.findStructuresByParentAndServerVersion("3734", 0l); - assertTrue(locations.isEmpty()); - } - - @Test - public void testFindByEmptyServerVersion() { - - List locations = locationRepository.findByEmptyServerVersion(); - assertTrue(locations.isEmpty()); - - PhysicalLocation location = locationRepository.get("3734"); - location.setServerVersion(null); - locationRepository.update(location); - - locations = locationRepository.findByEmptyServerVersion(); - - assertEquals(1, locations.size()); - assertEquals("3734", locations.get(0).getId()); - - } - - @Test - public void testFindStructuresByEmptyServerVersion() { - - List locations = locationRepository.findStructuresByEmptyServerVersion(); - assertTrue(locations.isEmpty()); - - PhysicalLocation location = locationRepository.getStructure("90397", true); - location.setServerVersion(null); - locationRepository.update(location); - - locations = locationRepository.findStructuresByEmptyServerVersion(); - assertEquals(1, locations.size()); - assertEquals("90397", locations.get(0).getId()); - - } - - private PhysicalLocation createLocation(String uuid) { - PhysicalLocation physicalLocation = new PhysicalLocation(); - physicalLocation.setId("223232"); - physicalLocation.setType("Feature"); - physicalLocation.setJurisdiction(true); - Geometry geometry = new Geometry(); - geometry.setType(GeometryType.MULTI_POLYGON); - physicalLocation.setGeometry(geometry); - LocationProperty properties = new LocationProperty(); - properties.setStatus(PropertyStatus.INACTIVE); - properties.setUid(uuid); - properties.setName("01_5"); - physicalLocation.setProperties(properties); - return physicalLocation; - - } - - private PhysicalLocation createStructure(String uuid) { - PhysicalLocation physicalLocation = new PhysicalLocation(); - physicalLocation.setId("121212"); - physicalLocation.setType("Feature"); - Geometry geometry = new Geometry(); - geometry.setType(GeometryType.POLYGON); - physicalLocation.setGeometry(geometry); - LocationProperty properties = new LocationProperty(); - properties.setStatus(PropertyStatus.ACTIVE); - properties.setUid(uuid); - physicalLocation.setProperties(properties); - return physicalLocation; - } - - @Test - public void testFindLocationsByNames() { - - List locations = locationRepository.findLocationsByNames("MKB_5", 0l); - assertTrue(locations.isEmpty()); - - PhysicalLocation parentLocation = gson.fromJson(parentJson, PhysicalLocation.class); - parentLocation.setJurisdiction(true); - locationRepository.add(parentLocation); - - locations = locationRepository.findLocationsByNames("MKB_5", 0l); - assertEquals(1, locations.size()); - PhysicalLocation location = locations.get(0); - assertEquals("MKB_5", location.getProperties().getName()); - assertEquals("Feature", location.getType()); - assertEquals(GeometryType.MULTI_POLYGON, location.getGeometry().getType()); - - locations = locationRepository.findLocationsByNames("MKB_5,other_location_name", 0l); - assertEquals(1, locations.size()); - location = locations.get(0); - assertEquals("MKB_5", location.getProperties().getName()); - assertEquals("Feature", location.getType()); - assertEquals(GeometryType.MULTI_POLYGON, location.getGeometry().getType()); - - } - - @Test - public void testFindStructureAndFamilyDetailsWithFamilyDetails() throws SQLException { - scripts.add("client.sql"); - populateDatabase(); - - Client family = new Client(UUID.randomUUID().toString()).withFirstName("Otala").withLastName("Family"); - family.withAttribute(ClientsRepositoryImpl.RESIDENCE, "90397"); - clientsRepository.add(family); - - double latitude = -14.1619809; - double longitude = 32.5978597; - - Collection details = locationRepository.findStructureAndFamilyDetails(latitude, longitude, - 100); - assertEquals(0, details.size()); - - details = locationRepository.findStructureAndFamilyDetails(latitude, longitude, 1000); - assertEquals(1, details.size()); - - StructureDetails structureDetails = details.iterator().next(); - assertEquals("90397", structureDetails.getStructureId()); - assertEquals("3734", structureDetails.getStructureParentId()); - assertEquals("Residential Structure", structureDetails.getStructureType()); - assertEquals(family.getBaseEntityId(), structureDetails.getFamilyId()); - assertEquals(1, structureDetails.getFamilyMembers().size()); - assertEquals("d4eda055-60c6-44a4-ba48-61dfe6485bea", structureDetails.getFamilyMembers().iterator().next()); - } - - @Test - public void testFindStructureAndFamilyDetailsWithoutFamilyDetails() { - double latitude = -14.1619809; - double longitude = 34.5978597; - - Collection details = locationRepository.findStructureAndFamilyDetails(latitude, longitude, - 1000); - assertEquals(0, details.size()); - - String uuid = UUID.randomUUID().toString(); - PhysicalLocation structure = createStructure(uuid); - JsonArray cordinates = new JsonArray(); - cordinates.add(new JsonPrimitive(longitude)); - cordinates.add(new JsonPrimitive(latitude)); - structure.getGeometry().setCoordinates(cordinates); - structure.getGeometry().setType(GeometryType.POINT); - structure.getProperties().setParentId("2465476"); - structure.getProperties().setType("Larvacide Point"); - locationRepository.add(structure); - - details = locationRepository.findStructureAndFamilyDetails(latitude, longitude, 1000); - assertEquals(1, details.size()); - - StructureDetails structureDetails = details.iterator().next(); - assertEquals("121212", structureDetails.getStructureId()); - assertEquals("2465476", structureDetails.getStructureParentId()); - assertEquals("Larvacide Point", structureDetails.getStructureType()); - assertTrue(structureDetails.getFamilyMembers().isEmpty()); - - assertTrue(locationRepository.findStructureAndFamilyDetails(latitude + 1, longitude, 1000).isEmpty()); - - double metersPerDegree = 110637; - assertEquals(1, - locationRepository.findStructureAndFamilyDetails(latitude + 1, longitude, metersPerDegree).size()); - } - - @Test - public void testFindLocationsByPropertiesWithoutProperties() { - List locations = locationRepository.findLocationsByProperties(false, "21", null); - assertEquals(1, locations.size()); - assertEquals("3734", locations.get(0).getId()); - assertNull(locations.get(0).getGeometry()); - - locations = locationRepository.findLocationsByProperties(true, "21", null); - assertEquals(1, locations.size()); - assertEquals("3734", locations.get(0).getId()); - assertNotNull(locations.get(0).getGeometry()); - - locations = locationRepository.findLocationsByProperties(true, null, null); - assertEquals(2, locations.size()); - assertEquals("3734", locations.get(0).getId()); - assertEquals(GeometryType.MULTI_POLYGON, locations.get(0).getGeometry().getType()); - assertEquals(267, - locations.get(0).getGeometry().getCoordinates().get(0).getAsJsonArray().get(0).getAsJsonArray().size()); - - // test non-existent parent - locations = locationRepository.findLocationsByProperties(true, "1233", null); - assertTrue(locations.isEmpty()); - - } - - @Test - public void testFindLocationsByProperties() { - - Map filters = new HashMap<>(); - filters.put("code", "3734"); - filters.put("name", "01_5"); - filters.put("uid", "41587456-b7c8-4c4e-b433-23a786f742fc"); - List locations = locationRepository.findLocationsByProperties(true, null, filters); - assertEquals(1, locations.size()); - assertEquals("3734", locations.get(0).getId()); - assertEquals("01_5", locations.get(0).getProperties().getName()); - assertEquals(GeometryType.MULTI_POLYGON, locations.get(0).getGeometry().getType()); - JsonArray coordinates = locations.get(0).getGeometry().getCoordinates().get(0).getAsJsonArray().get(0) - .getAsJsonArray(); - assertEquals(267, coordinates.size()); - - JsonArray coordinate1 = coordinates.get(0).getAsJsonArray(); - assertEquals(32.59989007736522, coordinate1.get(0).getAsDouble(), 0); - assertEquals(-14.167432040756012, coordinate1.get(1).getAsDouble(), 0); - - JsonArray coordinate67 = coordinates.get(66).getAsJsonArray(); - assertEquals(32.5988341383848, coordinate67.get(0).getAsDouble(), 0); - assertEquals(-14.171814074659776, coordinate67.get(1).getAsDouble(), 0); - - // test non-existent property value - filters.put("name", "name1"); - locations = locationRepository.findLocationsByProperties(true, null, filters); - assertTrue(locations.isEmpty()); - - } - - @Test - public void testFindStructuresByPropertiesWithoutProperties() { - List structures = locationRepository.findStructuresByProperties(false, "3734", null); - assertEquals(1, structures.size()); - assertEquals("90397", structures.get(0).getId()); - assertNull(structures.get(0).getGeometry()); - - structures = locationRepository.findStructuresByProperties(true, "3734", null); - assertEquals(1, structures.size()); - assertEquals("90397", structures.get(0).getId()); - assertNotNull(structures.get(0).getGeometry()); - - structures = locationRepository.findStructuresByProperties(true, null, null); - assertEquals(1, structures.size()); - assertEquals("90397", structures.get(0).getId()); - assertEquals(GeometryType.POLYGON, structures.get(0).getGeometry().getType()); - assertEquals(2, structures.get(0).getGeometry().getCoordinates().get(0).getAsJsonArray().get(0).getAsJsonArray() - .size()); - - // test non-existent parent - structures = locationRepository.findLocationsByProperties(true, "1233", null); - assertTrue(structures.isEmpty()); - } - - @Test - public void testFindStructuresByProperties() { - - Map filters = new HashMap<>(); - filters.put("code", "21384443"); - filters.put("geographicLevel", "5"); - filters.put("type", "Residential Structure"); - List locations = locationRepository.findStructuresByProperties(true, null, filters); - assertEquals(1, locations.size()); - assertEquals("90397", locations.get(0).getId()); - assertEquals("21384443", locations.get(0).getProperties().getCode()); - assertNull(locations.get(0).getProperties().getName()); - assertEquals("Residential Structure", locations.get(0).getProperties().getType()); - assertEquals(GeometryType.POLYGON, locations.get(0).getGeometry().getType()); - assertEquals(2, - locations.get(0).getGeometry().getCoordinates().get(0).getAsJsonArray().get(0).getAsJsonArray().size()); - - // test non-existent property - filters.put("name", "House23"); - locations = locationRepository.findStructuresByProperties(true, null, filters); - assertTrue(locations.isEmpty()); - - } - - @Test - public void testFindLocationByIdWithChildren() { - - List locations = locationRepository.findLocationByIdWithChildren(true, "3734", 10); - assertEquals(2, locations.size()); - assertEquals("3734", locations.get(0).getId()); - assertEquals("3735", locations.get(1).getId()); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/MultimediaRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/MultimediaRepositoryTest.java deleted file mode 100644 index a06419b976..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/MultimediaRepositoryTest.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.opensrp.repository.postgres; - -import org.junit.Test; -import org.opensrp.domain.Multimedia; -import org.opensrp.repository.MultimediaRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static org.junit.Assert.*; - -public class MultimediaRepositoryTest extends BaseRepositoryTest { - - @Autowired - @Qualifier("multimediaRepositoryPostgres") - private MultimediaRepository multimediaRepository; - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet(); - scripts.add("multimedia.sql"); - return scripts; - } - - @Test - public void testGet() { - Multimedia multimedia = multimediaRepository.get("05934ae338431f28bf6793b241f0c5ca"); - assertEquals("040d4f18-8140-479c-aa21-725612073490", multimedia.getCaseId()); - assertEquals("/opt/multimedia/patient_images/040d4f18-8140-479c-aa21-725612073490.jpg", multimedia.getFilePath()); - assertEquals("profilepic", multimedia.getFileCategory()); - - assertNull(multimediaRepository.get("05934ae338431f28bf6793b241fa")); - } - - @Test - public void testAdd() { - Multimedia multimedia = new Multimedia("2332kkj-jhjmmn-23423423", "tester1", "image/jpeg", "/tmp/123.jpg", - "thumbnail"); - multimediaRepository.add(multimedia); - - assertEquals(6, multimediaRepository.getAll().size()); - - Multimedia savedEntity = multimediaRepository.findByCaseId("2332kkj-jhjmmn-23423423"); - assertEquals("/tmp/123.jpg", savedEntity.getFilePath()); - assertEquals("thumbnail", savedEntity.getFileCategory()); - assertEquals("image/jpeg", savedEntity.getContentType()); - } - - @Test - public void testUpdate() { - Multimedia multimedia = multimediaRepository.get("3157f9339bf0c948dd5d12aff82111e1"); - multimedia.setContentType("image/png"); - multimedia.setFilePath("/opt/images/783434-34534.png"); - multimediaRepository.update(multimedia); - - Multimedia updatedEntity = multimediaRepository.get("3157f9339bf0c948dd5d12aff82111e1"); - assertEquals("/opt/images/783434-34534.png", updatedEntity.getFilePath()); - assertEquals("image/png", updatedEntity.getContentType()); - } - - @Test - public void testGetAll() { - assertEquals(5, multimediaRepository.getAll().size()); - - Multimedia multimedia = new Multimedia("2332kkj-76385430sdfsd-23423423", "tester23", "image/jpeg", - "/tmp/b7jhkh23.jpg", "thumbnail"); - multimediaRepository.add(multimedia); - - List expectedClients = Arrays.asList("2332kkj-76385430sdfsd-23423423", - "87dc3230-84f7-4088-b257-e8b3130ab86b", "24eec0d8-e0ee-4f22-9d6b-3cca84bdefcf"); - int found = 0; - List multimediaList = multimediaRepository.getAll(); - assertEquals(6, multimediaList.size()); - for (Multimedia media : multimediaList) - if (expectedClients.contains(media.getCaseId())) - found++; - assertEquals(3, found); - - } - - @Test - public void testSafeRemove() { - - Multimedia multimedia = multimediaRepository.get("3157f9339bf0c948dd5d12aff82111e1"); - multimediaRepository.safeRemove(multimedia); - - List multimediaList = multimediaRepository.getAll(); - assertEquals(4, multimediaList.size()); - for (Multimedia media : multimediaList) - assertNotEquals("3157f9339bf0c948dd5d12aff82111e1", media.getId()); - - assertNull(multimediaRepository.get("3157f9339bf0c948dd5d12aff82111e1")); - - } - - @Test - public void testFindByCaseId() { - Multimedia multimedia = multimediaRepository.findByCaseId("87dc3230-84f7-4088-b257-e8b3130ab86b"); - assertEquals("091488163b6ecd589a915372a0ad3b0d", multimedia.getId()); - assertEquals("/opt/multimedia/patient_images/87dc3230-84f7-4088-b257-e8b3130ab86b.jpg", multimedia.getFilePath()); - assertEquals("profilepic", multimedia.getFileCategory()); - - assertNull(multimediaRepository.findByCaseId("05934ae338431f28bf6793b241fa")); - } - - @Test - public void testAll() { - assertEquals(4, multimediaRepository.all("biddemo").size()); - - List multimedia = multimediaRepository.all("tester11"); - assertEquals(1, multimedia.size()); - assertEquals("317f8db1bb6cc4b15ecc9993a2922f47", multimedia.get(0).getId()); - assertEquals("24eec0d8-e0ee-4f22-9d6b-3cca84bdefcf", multimedia.get(0).getCaseId()); - } - - @Test - public void testGetExtended() { - Multimedia multimedia = new Multimedia("caseId1", "providerId1", "contentType1", "filePath1", "fileCategory1"); - multimediaRepository.add(multimedia); - multimedia = new Multimedia("caseId1", "providerId1", "contentType1", "filePath2", "fileCategory1"); - multimediaRepository.add(multimedia); - - List multimediaFiles = multimediaRepository.get("caseId1", "contentType1", "fileCategory1"); - assertEquals(multimediaFiles.size(), 2); - - String filePath1 = multimediaFiles.get(0).getFilePath(); - String filePath2 = multimediaFiles.get(1).getFilePath(); - assertTrue("filePath1".equals(filePath1) || "filePath2".equals(filePath1)); - assertTrue("filePath1".equals(filePath2) || "filePath2".equals(filePath2)); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/OrganizationRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/OrganizationRepositoryTest.java deleted file mode 100644 index 11f95d0b8c..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/OrganizationRepositoryTest.java +++ /dev/null @@ -1,214 +0,0 @@ -/** - * - */ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Set; -import java.util.UUID; - -import org.codehaus.jackson.JsonGenerationException; -import org.codehaus.jackson.map.JsonMappingException; -import org.junit.Test; -import org.opensrp.domain.AssignedLocations; -import org.opensrp.domain.Code; -import org.opensrp.domain.Organization; -import org.opensrp.repository.OrganizationRepository; -import org.springframework.beans.factory.annotation.Autowired; - -/** - * @author Samuel Githengi created on 09/16/19 - */ -public class OrganizationRepositoryTest extends BaseRepositoryTest { - - private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - - @Autowired - private OrganizationRepository organizationRepository; - - @Override - protected Set getDatabaseScripts() { - return Collections.singleton("organization.sql"); - } - - @Test - public void testGetOrganization() throws JsonGenerationException, JsonMappingException, IOException { - Organization organization = organizationRepository.get("fcc19470-d599-11e9-bb65-2a2ae2dbcce4"); - assertNotNull(organization); - assertEquals(1, organization.getId(), 0); - assertEquals("fcc19470-d599-11e9-bb65-2a2ae2dbcce4", organization.getIdentifier()); - assertEquals("The Luang", organization.getName()); - assertEquals(1, organization.getType().getCoding().size()); - Code code = organization.getType().getCoding().get(0); - assertEquals("http://terminology.hl7.org/CodeSystem/organization-type", code.getSystem()); - assertEquals("team", code.getCode()); - assertEquals("Team", code.getDisplay()); - assertNull(organization.getPartOf()); - - assertNull(organizationRepository.get("121sd")); - - } - - @Test - public void testAddOrganization() { - String identifier = UUID.randomUUID().toString(); - assertNull(organizationRepository.get(identifier)); - - Organization organization = new Organization(); - organization.setIdentifier(identifier); - organization.setName("Ateam"); - organization.setPartOf(1l); - organization.setActive(true); - organizationRepository.add(organization); - - Organization savedOrganization = organizationRepository.get(identifier); - - assertNotNull(savedOrganization); - assertNotNull(savedOrganization.getId()); - assertEquals(identifier, savedOrganization.getIdentifier()); - assertEquals("Ateam", savedOrganization.getName()); - assertNull(savedOrganization.getType()); - assertEquals(1, savedOrganization.getPartOf(), 0); - - } - - @Test - public void testUpdateOrganization() { - - Organization organization = organizationRepository.getByPrimaryKey(3l); - organization.setName("Ateam"); - organization.setPartOf(1l); - organization.setActive(false); - organizationRepository.update(organization); - - Organization updatedOrganization = organizationRepository.getByPrimaryKey(3l); - - assertNotNull(updatedOrganization); - assertEquals(3l, updatedOrganization.getId(), 0); - assertEquals("4c506c98-d3a9-11e9-bb65-2a2ae2dbcce4", updatedOrganization.getIdentifier()); - assertEquals("Ateam", updatedOrganization.getName()); - assertNull(updatedOrganization.getType()); - assertEquals(1l, updatedOrganization.getPartOf(), 0); - - } - - @Test - public void testGetAll() { - assertEquals(3, organizationRepository.getAll().size()); - - Organization organization = new Organization(); - organization.setIdentifier(UUID.randomUUID().toString()); - organization.setName("Ateam"); - organization.setPartOf(1l); - organization.setActive(true); - organizationRepository.add(organization); - - assertEquals(4, organizationRepository.getAll().size()); - - } - - @Test - public void testSafeRemove() { - - Organization organization = organizationRepository.getByPrimaryKey(2l); - organizationRepository.safeRemove(organization); - - assertNull(organizationRepository.getByPrimaryKey(2l)); - - assertEquals(2, organizationRepository.getAll().size()); - - } - - @Test - public void testAssignLocationAndPlan() { - String identifier = UUID.randomUUID().toString(); - Organization organization = new Organization(); - organization.setIdentifier(identifier); - organization.setName("ATeam"); - organizationRepository.add(organization); - - organization = organizationRepository.get(identifier); - Calendar calendar = Calendar.getInstance(); - Date fromDate = calendar.getTime(); - calendar.add(Calendar.YEAR, 2); - Date toDate = calendar.getTime(); - organizationRepository.assignLocationAndPlan(organization.getId(), "04cbcd4-0850-404a-a8b1-486b02f7b84d", 2243l, - "7f2ae03f-9569-5535-918c-9d976b3ae5f8", 11l, fromDate, toDate); - - List assignedLocations = organizationRepository.findAssignedLocations(organization.getId()); - assertEquals(1, assignedLocations.size()); - assertEquals("304cbcd4-0850-404a-a8b1-486b02f7b84d", assignedLocations.get(0).getJurisdictionId()); - assertEquals("9d1403a5-756d-517b-91d6-5b19059a69f0", assignedLocations.get(0).getPlanId()); - assertEquals(dateFormat.format(fromDate), dateFormat.format(assignedLocations.get(0).getFromDate())); - assertEquals(dateFormat.format(toDate), dateFormat.format(assignedLocations.get(0).getToDate())); - - organizationRepository.assignLocationAndPlan(organization.getId(), "04cbcd4-0850-404a-a8b1-486b02f7b84d", 2243l, - "7f2ae03f-9569-5535-918c-9d976b3ae5f8", 11l, fromDate, null); - - assignedLocations = organizationRepository.findAssignedLocations(organization.getId()); - assertNull(assignedLocations.get(0).getToDate()); - } - - @Test - public void testAssignLocationAndPlanExpired() { - String identifier = UUID.randomUUID().toString(); - Organization organization = new Organization(); - organization.setIdentifier(identifier); - organization.setName("ATeam"); - organizationRepository.add(organization); - - organization = organizationRepository.get(identifier); - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.YEAR, -1); - Date fromDate = calendar.getTime(); - calendar.add(Calendar.MONTH, 2); - Date toDate = calendar.getTime(); - organizationRepository.assignLocationAndPlan(organization.getId(), "04cbcd4-0850-404a-a8b1-486b02f7b84d", 2243l, - "7f2ae03f-9569-5535-918c-9d976b3ae5f8", 11l, fromDate, toDate); - - List assignedLocations = organizationRepository.findAssignedLocations(organization.getId()); - assertEquals(0, assignedLocations.size()); - } - - @Test - public void testFindAssignedLocations() { - List assignedLocations = organizationRepository.findAssignedLocations(1l); - assertEquals(2, assignedLocations.size()); - - assignedLocations = organizationRepository.findAssignedLocations(2l); - assertEquals(1, assignedLocations.size()); - assertEquals("304cbcd4-0850-404a-a8b1-486b02f7b84d", assignedLocations.get(0).getJurisdictionId()); - assertEquals("7f2ae03f-9569-5535-918c-9d976b3ae5f8", assignedLocations.get(0).getPlanId()); - assertEquals("2019-09-10", dateFormat.format(assignedLocations.get(0).getFromDate())); - assertEquals("2021-09-10", dateFormat.format(assignedLocations.get(0).getToDate())); - - } - - @Test - public void testFindAssignedLocationsMutipleIds() { - List assignedLocations = organizationRepository - .findAssignedLocations(Collections.singletonList(1l)); - assertEquals(2, assignedLocations.size()); - - assignedLocations = organizationRepository.findAssignedLocations(Collections.singletonList(2l)); - assertEquals(1, assignedLocations.size()); - assertEquals("304cbcd4-0850-404a-a8b1-486b02f7b84d", assignedLocations.get(0).getJurisdictionId()); - assertEquals("7f2ae03f-9569-5535-918c-9d976b3ae5f8", assignedLocations.get(0).getPlanId()); - assertEquals("2019-09-10", dateFormat.format(assignedLocations.get(0).getFromDate())); - assertEquals("2021-09-10", dateFormat.format(assignedLocations.get(0).getToDate())); - - assignedLocations = organizationRepository.findAssignedLocations(Arrays.asList(1l, 2l)); - assertEquals(3, assignedLocations.size()); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/PlanRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/PlanRepositoryTest.java deleted file mode 100644 index 3cfc9b1388..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/PlanRepositoryTest.java +++ /dev/null @@ -1,442 +0,0 @@ -package org.opensrp.repository.postgres; - -import org.junit.BeforeClass; -import org.junit.Test; -import org.opensrp.domain.PlanDefinition; -import org.opensrp.domain.postgres.Jurisdiction; -import org.opensrp.repository.PlanRepository; -import org.springframework.beans.factory.annotation.Autowired; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - - -/** - * Created by Vincent Karuri on 03/05/2019 - */ -public class PlanRepositoryTest extends BaseRepositoryTest { - - @Autowired - private PlanRepository planRepository; - - @BeforeClass - public static void bootStrap() { - tableNames.add("core.plan"); - tableNames.add("core.plan_metadata"); - } - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet<>(); - return scripts; - } - - @Test - public void testAddShouldAddNewPlans() { - PlanDefinition plan = new PlanDefinition(); - plan.setIdentifier("identifier_1"); - - List jurisdictions = new ArrayList<>(); - Jurisdiction jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_1"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - planRepository.add(plan); - - plan = new PlanDefinition(); - plan.setIdentifier("identifier_2"); - jurisdictions = new ArrayList<>(); - jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_2"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - planRepository.add(plan); - - List plans = planRepository.getAll(); - assertEquals(plans.size(), 2); - - Set ids = new HashSet<>(); - ids.add("identifier_1"); - ids.add("identifier_2"); - assertTrue(testIfAllIdsExists(plans, ids)); - } - - @Test - public void testGetShouldGetByPlanId() { - PlanDefinition plan = new PlanDefinition(); - plan.setIdentifier("identifier_3"); - - List jurisdictions = new ArrayList<>(); - Jurisdiction jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_1"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - planRepository.add(plan); - - plan = new PlanDefinition(); - plan.setIdentifier("identifier_4"); - jurisdictions = new ArrayList<>(); - jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_2"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - planRepository.add(plan); - - PlanDefinition result = planRepository.get("identifier_4"); - assertNotNull(result); - assertEquals(result.getIdentifier(), "identifier_4"); - assertEquals(result.getJurisdiction().get(0).getCode(), "operation_area_2"); - } - - @Test - public void testGetShouldNotGetDeletedPlans() { - PlanDefinition plan = new PlanDefinition(); - plan.setIdentifier("identifier_3"); - - List jurisdictions = new ArrayList<>(); - Jurisdiction jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_1"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - planRepository.add(plan); - planRepository.safeRemove(plan); - - plan = new PlanDefinition(); - plan.setIdentifier("identifier_4"); - jurisdictions = new ArrayList<>(); - jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_2"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - planRepository.add(plan); - - List plans = planRepository.getAll(); - assertEquals(plans.size(), 1); - - Set ids = new HashSet<>(); - ids.add("identifier_4"); - assertTrue(testIfAllIdsExists(plans, ids)); - - assertNull(planRepository.get("identifier_3")); - } - - @Test - public void testUpdateShouldUpdateExistingPlan() { - PlanDefinition plan = new PlanDefinition(); - plan.setIdentifier("identifier_5"); - - List jurisdictions = new ArrayList<>(); - Jurisdiction jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_1"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - planRepository.add(plan); - - PlanDefinition result = planRepository.get("identifier_5"); - assertEquals(result.getIdentifier(), "identifier_5"); - assertEquals(result.getJurisdiction().get(0).getCode(), "operation_area_1"); - - plan = new PlanDefinition(); - plan.setIdentifier("identifier_5"); - jurisdictions = new ArrayList<>(); - jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_2"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - planRepository.update(plan); - - result = planRepository.get("identifier_5"); - assertEquals(result.getIdentifier(), "identifier_5"); - assertEquals(result.getJurisdiction().get(0).getCode(), "operation_area_2"); - } - - @Test - public void testGetAllShouldGetAllPlans() { - PlanDefinition plan = new PlanDefinition(); - plan.setIdentifier("identifier_6"); - - List jurisdictions = new ArrayList<>(); - Jurisdiction jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_1"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - planRepository.add(plan); - - plan = new PlanDefinition(); - plan.setIdentifier("identifier_7"); - jurisdictions = new ArrayList<>(); - jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_2"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - planRepository.add(plan); - - List plans = planRepository.getAll(); - assertEquals(plans.size(), 2); - - Set ids = new HashSet<>(); - ids.add("identifier_6"); - ids.add("identifier_7"); - assertTrue(testIfAllIdsExists(plans, ids)); - } - - @Test - public void testSafeRemoveShouldMarkPlansAsDelete() { - PlanDefinition plan = new PlanDefinition(); - plan.setIdentifier("identifier_7"); - - List jurisdictions = new ArrayList<>(); - Jurisdiction jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_1"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - planRepository.add(plan); - - plan = new PlanDefinition(); - plan.setIdentifier("identifier_8"); - jurisdictions = new ArrayList<>(); - jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_2"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - planRepository.add(plan); - - List plans = planRepository.getAll(); - assertEquals(plans.size(), 2); - - planRepository.safeRemove(plan); - plans = planRepository.getAll(); - assertEquals(plans.size(), 1); - assertEquals(planRepository.getAll().get(0).getIdentifier(), "identifier_7"); - } - - @Test - public void testSyncPlansByServerVersionAndOperationalAreaShouldReturnAllPlansAtOrBeforeAServerVersion() { - PlanDefinition plan = new PlanDefinition(); - plan.setIdentifier("identifier_7"); - - List jurisdictions = new ArrayList<>(); - Jurisdiction jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_1"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - plan.setServerVersion(1l); - planRepository.add(plan); - - Set ids = new HashSet<>(); - - plan = new PlanDefinition(); - plan.setIdentifier("identifier_8"); - ids.add("identifier_8"); - jurisdictions = new ArrayList<>(); - jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_2"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - plan.setServerVersion(2l); - planRepository.add(plan); - - plan = new PlanDefinition(); - plan.setIdentifier("identifier_9"); - ids.add("identifier_9"); - jurisdictions = new ArrayList<>(); - jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_2"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - plan.setServerVersion(3l); - planRepository.add(plan); - - List plans = planRepository.getPlansByServerVersionAndOperationalAreas(2l, null); - assertEquals(plans.size(), 2); - testIfAllIdsExists(plans, ids); - } - - @Test - public void testGetPlansByServerVersionAndOperationalAreaShouldReturnAllPlansAtOrBeforeAServerVersionAndCorrectOperationalArea() { - PlanDefinition plan = new PlanDefinition(); - plan.setIdentifier("identifier_7"); - - List jurisdictions = new ArrayList<>(); - Jurisdiction jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_1"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - plan.setServerVersion(1l); - planRepository.add(plan); - - Set ids = new HashSet<>(); - - plan = new PlanDefinition(); - plan.setIdentifier("identifier_8"); - ids.add("identifier_8"); - jurisdictions = new ArrayList<>(); - jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_2"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - plan.setServerVersion(2l); - planRepository.add(plan); - - plan = new PlanDefinition(); - plan.setIdentifier("identifier_9"); - ids.add("identifier_9"); - jurisdictions = new ArrayList<>(); - jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_2"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - plan.setServerVersion(3l); - planRepository.add(plan); - - List operationalAreaIds = new ArrayList<>(); - operationalAreaIds.add("operation_area_2"); - List plans = planRepository.getPlansByServerVersionAndOperationalAreas(2l, operationalAreaIds); - assertEquals(plans.size(), 2); - testIfAllIdsExists(plans, ids); - } - - - @Test - public void testSyncShouldNotGetDeletedOperationalAreas() { - PlanDefinition plan = new PlanDefinition(); - plan.setIdentifier("identifier_7"); - - List jurisdictions = new ArrayList<>(); - Jurisdiction jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_2"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - plan.setServerVersion(1l); - planRepository.add(plan); - - Set ids = new HashSet<>(); - - plan = new PlanDefinition(); - plan.setIdentifier("identifier_8"); - ids.add("identifier_8"); - jurisdictions = new ArrayList<>(); - jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_2"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - plan.setServerVersion(2l); - planRepository.add(plan); - - plan = new PlanDefinition(); - plan.setIdentifier("identifier_7"); - jurisdictions = new ArrayList<>(); - jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_1"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - plan.setServerVersion(0l); - planRepository.update(plan); - - List operationalAreaIds = new ArrayList<>(); - operationalAreaIds.add("operation_area_1"); - List plans = planRepository.getPlansByServerVersionAndOperationalAreas(0l, operationalAreaIds); - - assertEquals(plans.size(), 1); - testIfAllIdsExists(plans, ids); - } - - @Test - public void testGetPlansByIdsReturnOptionalFields() { - PlanDefinition plan = new PlanDefinition(); - plan.setIdentifier("identifier_7"); - plan.setVersion("v1"); - plan.setName("Focus Investigation"); - plan.setTitle("Plan title"); - plan.setStatus("incomplete"); - - List jurisdictions = new ArrayList<>(); - Jurisdiction jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_1"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - - planRepository.add(plan); - - List plans = planRepository.getAll(); - assertEquals(plans.size(), 1); - - List fields = new ArrayList<>(); - fields.add("identifier"); - fields.add("name"); - - plans = planRepository.getPlansByIdsReturnOptionalFields(Collections.singletonList("identifier_7"), fields); - assertEquals(plans.size(), 1); - assertEquals("identifier_7", plans.get(0).getIdentifier()); - assertEquals("Focus Investigation", planRepository.getAll().get(0).getName()); - assertEquals(null, plans.get(0).getVersion()); - assertEquals(null, plans.get(0).getTitle()); - assertEquals(null, plans.get(0).getStatus()); - - } - - @Test - public void getGetPlansByIdentifiersAndServerVersion() { - PlanDefinition plan = new PlanDefinition(); - plan.setIdentifier("identifier_7"); - - List jurisdictions = new ArrayList<>(); - Jurisdiction jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_2"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - plan.setServerVersion(1l); - planRepository.add(plan); - - Set ids = new HashSet<>(); - - plan = new PlanDefinition(); - plan.setIdentifier("identifier_8"); - ids.add("identifier_8"); - jurisdictions = new ArrayList<>(); - jurisdiction = new Jurisdiction(); - jurisdiction.setCode("operation_area_2"); - jurisdictions.add(jurisdiction); - plan.setJurisdiction(jurisdictions); - plan.setServerVersion(2l); - planRepository.add(plan); - - List operationalAreaIds = new ArrayList<>(); - operationalAreaIds.add("operation_area_1"); - List plans = planRepository.getPlansByIdentifiersAndServerVersion(Arrays.asList("identifier_7","identifier_8"), 0l); - - assertEquals(2,plans.size()); - testIfAllIdsExists(plans, ids); - - - - plans = planRepository.getPlansByIdentifiersAndServerVersion(Arrays.asList("identifier_7","identifier_8"), 2l); - assertEquals(1,plans.size()); - assertEquals("identifier_8",plans.get(0).getIdentifier()); - - - plans = planRepository.getPlansByIdentifiersAndServerVersion(Arrays.asList("identifier_7","identifier_8"), 3l); - assertEquals(0,plans.size()); - - - plans = planRepository.getPlansByIdentifiersAndServerVersion(Arrays.asList("identifier_70"), 0l); - assertEquals(0,plans.size()); - - } - - private boolean testIfAllIdsExists(List plans, Set ids) { - for (PlanDefinition plan : plans) { - ids.remove(plan.getIdentifier()); - } - return ids.size() == 0; - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/PractitionerRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/PractitionerRepositoryTest.java deleted file mode 100644 index 4a1c9942b2..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/PractitionerRepositoryTest.java +++ /dev/null @@ -1,331 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.junit.BeforeClass; -import org.junit.Test; -import org.opensrp.domain.Practitioner; -import org.opensrp.repository.PractitionerRepository; -import org.springframework.beans.factory.annotation.Autowired; - -public class PractitionerRepositoryTest extends BaseRepositoryTest{ - - @Autowired - private PractitionerRepository practitionerRepository; - - @BeforeClass - public static void bootStrap() { - tableNames.add("team.practitioner"); - } - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet<>(); - return scripts; - } - - @Test - public void testAddShouldAddNewPractitioner() { - Practitioner practitioner1 = initTestPractitioner1(); - practitionerRepository.add(practitioner1); - - List practitioners = practitionerRepository.getAll(); - assertNotNull(practitioners); - assertEquals(1,practitioners.size()); - assertEquals("practitoner-1-identifier",practitioners.get(0).getIdentifier()); - assertEquals(true,practitioners.get(0).getActive()); - assertEquals("Practitioner",practitioners.get(0).getName()); - assertEquals("Practioner1",practitioners.get(0).getUsername()); - assertEquals("user1",practitioners.get(0).getUserId()); - } - - @Test - public void testAddShouldNotInsertRecordIfPractitionerIsNull() { - practitionerRepository.add(null); - - List practitioners = practitionerRepository.getAll(); - assertTrue(practitioners.isEmpty()); - } - - @Test - public void testAddShouldNotInsertRecordIfPractitionerIdentifierIsNull() { - Practitioner expectedPractitioner = initTestPractitioner1(); - expectedPractitioner.setIdentifier(null); - practitionerRepository.add(expectedPractitioner); - - List practitioners = practitionerRepository.getAll(); - assertTrue(practitioners.isEmpty()); - } - - @Test - public void testGetShouldGetPractitionerByIdentifier() { - - Practitioner practitioner1 = initTestPractitioner1(); - practitionerRepository.add(practitioner1); - - Practitioner practitioner2 = initTestPractitioner2(); - practitionerRepository.add(practitioner2); - - Practitioner practitioner = practitionerRepository.get("practitoner-2-identifier"); - assertNotNull(practitioner); - assertEquals("practitoner-2-identifier", practitioner.getIdentifier()); - assertEquals(false, practitioner.getActive()); - assertEquals("Second Practitioner", practitioner.getName()); - assertEquals("Practioner2", practitioner.getUsername()); - assertEquals("user2", practitioner.getUserId()); - - } - - @Test - public void testGetShouldGetReturnsNullIfIdentifierIsNullOrEmpty() { - Practitioner practitioner = practitionerRepository.get(null); - assertNull(practitioner); - - practitioner = practitionerRepository.get(""); - assertNull(practitioner); - } - - @Test - public void testGetShouldnotReturnDeletedPractitioners() { - Practitioner practitioner1 = initTestPractitioner1(); - practitionerRepository.add(practitioner1); - - Practitioner practitioner2 = initTestPractitioner2(); - practitionerRepository.add(practitioner2); - - practitionerRepository.safeRemove(practitioner2.getIdentifier()); - - List practitioners = practitionerRepository.getAll(); - assertNotNull(practitioners); - assertEquals(1,practitioners.size()); - assertEquals("practitoner-1-identifier",practitioners.get(0).getIdentifier()); - assertEquals(true,practitioners.get(0).getActive()); - assertEquals("Practitioner",practitioners.get(0).getName()); - assertEquals("Practioner1",practitioners.get(0).getUsername()); - assertEquals("user1",practitioners.get(0).getUserId()); - } - - @Test - public void testUpdateShouldUpdateExistingPractitioner() { - Practitioner practitioner1 = initTestPractitioner1(); - practitionerRepository.add(practitioner1); - - Practitioner addedPractitioner = practitionerRepository.get(practitioner1.getIdentifier()); - assertNotNull(addedPractitioner); - assertEquals("practitoner-1-identifier", addedPractitioner.getIdentifier()); - assertEquals(true, addedPractitioner.getActive()); - assertEquals("Practitioner", addedPractitioner.getName()); - - practitioner1.setActive(false); - practitioner1.setName("First Practitioner"); - practitionerRepository.update(practitioner1); - - Practitioner updatedPractitioner = practitionerRepository.get(practitioner1.getIdentifier()); - assertNotNull(addedPractitioner); - assertEquals("practitoner-1-identifier", updatedPractitioner.getIdentifier()); - assertEquals(false, updatedPractitioner.getActive()); - assertEquals("First Practitioner", updatedPractitioner.getName()); - } - - @Test - public void testUpdateWithNullParamDoesNotUpdateExistingRecord() { - Practitioner practitioner1 = initTestPractitioner1(); - practitionerRepository.add(practitioner1); - - Practitioner addedPractitioner = practitionerRepository.get(practitioner1.getIdentifier()); - assertNotNull(addedPractitioner); - assertEquals("practitoner-1-identifier", addedPractitioner.getIdentifier()); - assertEquals(true, addedPractitioner.getActive()); - assertEquals("Practitioner", addedPractitioner.getName()); - - practitionerRepository.update(null); - - Practitioner updatedPractitioner = practitionerRepository.get(practitioner1.getIdentifier()); - assertNotNull(addedPractitioner); - assertEquals("practitoner-1-identifier", updatedPractitioner.getIdentifier()); - assertEquals(true, updatedPractitioner.getActive()); - assertEquals("Practitioner", updatedPractitioner.getName()); - } - - @Test - public void testUpdateWithNullIdentifierDoesNotUpdateExistingRecord() { - Practitioner practitioner1 = initTestPractitioner1(); - String practitioner1Identifier = practitioner1.getIdentifier(); - practitionerRepository.add(practitioner1); - - Practitioner addedPractitioner = practitionerRepository.get(practitioner1.getIdentifier()); - assertNotNull(addedPractitioner); - assertEquals("practitoner-1-identifier", addedPractitioner.getIdentifier()); - assertEquals(true, addedPractitioner.getActive()); - assertEquals("Practitioner", addedPractitioner.getName()); - - practitioner1.setIdentifier(null); - practitioner1.setActive(false); - practitioner1.setName("Practitioner edit"); - practitionerRepository.update(practitioner1); - - Practitioner updatedPractitioner = practitionerRepository.get(practitioner1Identifier); - assertNotNull(updatedPractitioner); - assertEquals("practitoner-1-identifier", updatedPractitioner.getIdentifier()); - assertEquals(true, updatedPractitioner.getActive()); - assertEquals("Practitioner", updatedPractitioner.getName()); - } - - @Test - public void testUpdateWithNonExistingRecordNotUpdate() { - Practitioner practitioner1 = initTestPractitioner1(); - - practitionerRepository.update(practitioner1); - - Practitioner updatedPractitioner = practitionerRepository.get(practitioner1.getIdentifier()); - assertNull(updatedPractitioner); - } - - @Test - public void testGetAllShouldGetAllPractitioners() { - Practitioner practitioner1 = initTestPractitioner1(); - practitionerRepository.add(practitioner1); - - Practitioner practitioner2 = initTestPractitioner2(); - practitionerRepository.add(practitioner2); - - List practitioners = practitionerRepository.getAll(); - assertNotNull(practitioners); - assertEquals(2,practitioners.size()); - - Set ids = new HashSet<>(); - ids.add(practitioner1.getIdentifier()); - ids.add(practitioner2.getIdentifier()); - assertTrue(testIfAllIdsExists(practitioners, ids)); - } - - @Test - public void testSafeRemoveShouldMarkPractitionerAsDeleted() { - Practitioner practitioner1 = initTestPractitioner1(); - practitionerRepository.add(practitioner1); - - Practitioner practitioner2 = initTestPractitioner2(); - practitionerRepository.add(practitioner2); - - List practitioners = practitionerRepository.getAll(); - assertNotNull(practitioners); - assertEquals(2,practitioners.size()); - - practitionerRepository.safeRemove(practitioner2); - - practitioners = practitionerRepository.getAll(); - assertNotNull(practitioners); - assertEquals(1, practitioners.size()); - assertEquals(practitioner1.getIdentifier(), practitioners.get(0).getIdentifier()); - } - - @Test - public void testSafeRemoveWithEmptyParamDoesNotAffectExistingRecord() { - Practitioner practitioner1 = initTestPractitioner1(); - practitionerRepository.add(practitioner1); - - List practitioners = practitionerRepository.getAll(); - assertNotNull(practitioners); - assertEquals(1,practitioners.size()); - - practitionerRepository.safeRemove(new Practitioner()); - - practitioners = practitionerRepository.getAll(); - assertNotNull(practitioners); - assertEquals(1, practitioners.size()); - assertEquals(practitioner1.getIdentifier(), practitioners.get(0).getIdentifier()); - } - - @Test - public void testSafeRemoveWithNonExistingRecordShouldDoesNotAffectExistingRecord() { - Practitioner practitioner1 = initTestPractitioner1(); - practitionerRepository.add(practitioner1); - - List practitioners = practitionerRepository.getAll(); - assertNotNull(practitioners); - assertEquals(1,practitioners.size()); - - Practitioner practitioner2 = initTestPractitioner2(); - practitionerRepository.safeRemove(practitioner2); - - practitioners = practitionerRepository.getAll(); - assertNotNull(practitioners); - assertEquals(1, practitioners.size()); - assertEquals(practitioner1.getIdentifier(), practitioners.get(0).getIdentifier()); - } - - @Test - public void testGetPractitionerByUserId() { - Practitioner expectedPractitioner = initTestPractitioner2(); - practitionerRepository.add(expectedPractitioner); - - Practitioner actualPractitioner = practitionerRepository.getPractitionerByUserId(expectedPractitioner.getUserId()); - assertNotNull(actualPractitioner); - assertEquals("practitoner-2-identifier", actualPractitioner.getIdentifier()); - assertEquals(false, actualPractitioner.getActive()); - assertEquals("Second Practitioner", actualPractitioner.getName()); - assertEquals("Practioner2", actualPractitioner.getUsername()); - assertEquals("user2", actualPractitioner.getUserId()); - } - - @Test - public void testGetPractitionerByUserIdWithNullUserIdReturnsNull() { - Practitioner expectedPractitioner = initTestPractitioner2(); - expectedPractitioner.setUserId(null); - - Practitioner actualPractitioner = practitionerRepository.getPractitionerByUserId(expectedPractitioner.getUserId()); - assertNull(actualPractitioner); - } - - - - @Test - public void testGetPractitionerByUsername() { - Practitioner expectedPractitioner = initTestPractitioner2(); - practitionerRepository.add(expectedPractitioner); - - Practitioner actualPractitioner = practitionerRepository.getPractitionerByUsername(expectedPractitioner.getUsername()); - assertNotNull(actualPractitioner); - assertEquals(expectedPractitioner.getIdentifier(),actualPractitioner.getIdentifier()); - assertEquals(expectedPractitioner.getName(),actualPractitioner.getName()); - assertEquals(expectedPractitioner.getUserId(),actualPractitioner.getUserId()); - assertEquals(expectedPractitioner.getUsername(),actualPractitioner.getUsername()); - - assertNull( practitionerRepository.getPractitionerByUsername("janeDoe")); - } - - private Practitioner initTestPractitioner1(){ - Practitioner practitioner = new Practitioner(); - practitioner.setIdentifier("practitoner-1-identifier"); - practitioner.setActive(true); - practitioner.setName("Practitioner"); - practitioner.setUsername("Practioner1"); - practitioner.setUserId("user1"); - return practitioner; - } - - private Practitioner initTestPractitioner2(){ - Practitioner practitioner = new Practitioner(); - practitioner.setIdentifier("practitoner-2-identifier"); - practitioner.setActive(false); - practitioner.setName("Second Practitioner"); - practitioner.setUsername("Practioner2"); - practitioner.setUserId("user2"); - return practitioner; - } - - private boolean testIfAllIdsExists(List practitioners, Set ids) { - for (Practitioner practitioner : practitioners) { - ids.remove(practitioner.getIdentifier()); - } - return ids.size() == 0; - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/PractitionerRoleRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/PractitionerRoleRepositoryTest.java deleted file mode 100644 index fe0341ae1b..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/PractitionerRoleRepositoryTest.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.opensrp.repository.postgres; - -import org.junit.BeforeClass; -import org.junit.Test; -import org.opensrp.domain.PractitionerRole; -import org.opensrp.domain.PractitionerRoleCode; -import org.opensrp.repository.PractitionerRoleRepository; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -public class PractitionerRoleRepositoryTest extends BaseRepositoryTest { - - @Autowired - private PractitionerRoleRepository practitionerRoleRepository; - - @BeforeClass - public static void bootStrap() { - tableNames.add("team.organization"); - tableNames.add("team.practitioner"); - tableNames.add("team.practitioner_role"); - } - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet<>(); - scripts.add("practitioner.sql"); - return scripts; - } - - @Test - public void testAddShouldAddNewPractitionerRole() { - PractitionerRole practitionerRole1 = initTestPractitionerRole1(); - practitionerRoleRepository.add(practitionerRole1); - - List practitionerRoles = practitionerRoleRepository.getAll(); - assertNotNull(practitionerRoles); - assertEquals(1, practitionerRoles.size()); - assertEquals("pr1-identifier", practitionerRoles.get(0).getIdentifier()); - assertEquals(true, practitionerRoles.get(0).getActive()); - assertEquals("org1", practitionerRoles.get(0).getOrganizationIdentifier()); - assertEquals("p1-identifier", practitionerRoles.get(0).getPractitionerIdentifier()); - assertEquals("pr1Code", practitionerRoles.get(0).getCode().getText()); - } - - @Test - public void testAddShouldNotInsertRecordIfPractitionerRoleIsNull() { - practitionerRoleRepository.add(null); - - List practitionerRoles = practitionerRoleRepository.getAll(); - assertTrue(practitionerRoles.isEmpty()); - } - - @Test - public void testAddShouldNotInsertRecordIfPractitionerRoleIdentifierIsNull() { - PractitionerRole expectedPractitionerRole = initTestPractitionerRole1(); - expectedPractitionerRole.setIdentifier(null); - practitionerRoleRepository.add(expectedPractitionerRole); - - List practitionerRoles = practitionerRoleRepository.getAll(); - assertTrue(practitionerRoles.isEmpty()); - } - - @Test - public void testGetShouldGetPractitionerRoleByIdentifier() { - - PractitionerRole practitionerRole1 = initTestPractitionerRole1(); - practitionerRoleRepository.add(practitionerRole1); - - PractitionerRole practitionerRole2 = initTestPractitionerRole2(); - practitionerRoleRepository.add(practitionerRole2); - - PractitionerRole practitionerRole = practitionerRoleRepository.get("pr2-identifier"); - assertNotNull(practitionerRole); - assertEquals("pr2-identifier", practitionerRole.getIdentifier()); - assertEquals(true, practitionerRole.getActive()); - assertEquals("org1", practitionerRole.getOrganizationIdentifier()); - assertEquals("p2-identifier", practitionerRole.getPractitionerIdentifier()); - assertEquals("pr2Code", practitionerRole.getCode().getText()); - - } - - @Test - public void testGetShouldGetReturnsNullIfIdentifierIsNullOrEmpty() { - - PractitionerRole practitionerRole1 = initTestPractitionerRole1(); - practitionerRoleRepository.add(practitionerRole1); - - PractitionerRole practitionerRole = practitionerRoleRepository.get(null); - assertNull(practitionerRole); - - practitionerRole = practitionerRoleRepository.get(""); - assertNull(practitionerRole); - } - - @Test - public void testUpdateShouldUpdateExistingPractitioner() { - PractitionerRole practitionerRole2 = initTestPractitionerRole2(); - practitionerRoleRepository.add(practitionerRole2); - - PractitionerRole addedPractitionerRole = practitionerRoleRepository.get(practitionerRole2.getIdentifier()); - assertNotNull(addedPractitionerRole); - assertEquals("pr2-identifier", addedPractitionerRole.getIdentifier()); - assertEquals(true, addedPractitionerRole.getActive()); - assertEquals("pr2Code", addedPractitionerRole.getCode().getText()); - - practitionerRole2.setActive(false); - practitionerRole2.getCode().setText("updatedCode"); - practitionerRoleRepository.update(practitionerRole2); - - PractitionerRole updatedPractitionerRole = practitionerRoleRepository.get(practitionerRole2.getIdentifier()); - assertNotNull(updatedPractitionerRole); - assertEquals("pr2-identifier", updatedPractitionerRole.getIdentifier()); - assertEquals(false, updatedPractitionerRole.getActive()); - assertEquals("updatedCode", updatedPractitionerRole.getCode().getText()); - } - - @Test - public void testUpdateWithNullParamDoesNotUpdateExistingRecord() { - PractitionerRole practitionerRole2 = initTestPractitionerRole2(); - practitionerRoleRepository.add(practitionerRole2); - - PractitionerRole addedPractitionerRole = practitionerRoleRepository.get(practitionerRole2.getIdentifier()); - assertNotNull(addedPractitionerRole); - assertEquals("pr2-identifier", addedPractitionerRole.getIdentifier()); - assertEquals(true, addedPractitionerRole.getActive()); - assertEquals("pr2Code", addedPractitionerRole.getCode().getText()); - - practitionerRoleRepository.update(null); - - PractitionerRole updatedPractitionerRole = practitionerRoleRepository.get(practitionerRole2.getIdentifier()); - assertNotNull(updatedPractitionerRole); - assertEquals("pr2-identifier", addedPractitionerRole.getIdentifier()); - assertEquals(true, addedPractitionerRole.getActive()); - assertEquals("pr2Code", addedPractitionerRole.getCode().getText()); - } - - @Test - public void testUpdateWithNullIdentifierDoesNotUpdateExistingRecord() { - PractitionerRole practitionerRole2 = initTestPractitionerRole2(); - String practitionerRole2Identifier = practitionerRole2.getIdentifier(); - practitionerRoleRepository.add(practitionerRole2); - - PractitionerRole addedPractitionerRole = practitionerRoleRepository.get(practitionerRole2.getIdentifier()); - assertNotNull(addedPractitionerRole); - assertEquals("pr2-identifier", addedPractitionerRole.getIdentifier()); - assertEquals(true, addedPractitionerRole.getActive()); - assertEquals("pr2Code", addedPractitionerRole.getCode().getText()); - - practitionerRole2.setIdentifier(null); - practitionerRole2.setActive(false); - PractitionerRoleCode code = new PractitionerRoleCode(); - code.setText("Updated code"); - practitionerRole2.setCode(code); - practitionerRoleRepository.update(practitionerRole2); - - PractitionerRole updatedPractitionerRole = practitionerRoleRepository.get(practitionerRole2Identifier); - assertNotNull(updatedPractitionerRole); - assertEquals("pr2-identifier", addedPractitionerRole.getIdentifier()); - assertEquals(true, addedPractitionerRole.getActive()); - assertEquals("pr2Code", addedPractitionerRole.getCode().getText()); - } - - @Test - public void testUpdateWithNonExistingRecordDoesNotUpdate() { - PractitionerRole practitionerRole2 = initTestPractitionerRole2(); - practitionerRoleRepository.update(practitionerRole2); - - PractitionerRole updatedPractitionerRole = practitionerRoleRepository.get(practitionerRole2.getIdentifier()); - assertNull(updatedPractitionerRole); - } - - @Test - public void testGetAllShouldGetAllPractitionerRoles() { - PractitionerRole practitionerRole1 = initTestPractitionerRole1(); - practitionerRoleRepository.add(practitionerRole1); - - PractitionerRole practitionerRole2 = initTestPractitionerRole2(); - practitionerRoleRepository.add(practitionerRole2); - - List practitionerRoles = practitionerRoleRepository.getAll(); - assertNotNull(practitionerRoles); - assertEquals(2,practitionerRoles.size()); - - Set ids = new HashSet<>(); - ids.add(practitionerRole1.getIdentifier()); - ids.add(practitionerRole2.getIdentifier()); - assertTrue(testIfAllIdsExists(practitionerRoles, ids)); - } - - @Test - public void testSafeRemoveShouldDeletePractitionerRole() { - PractitionerRole practitionerRole1 = initTestPractitionerRole1(); - practitionerRoleRepository.add(practitionerRole1); - - PractitionerRole practitionerRole2 = initTestPractitionerRole2(); - practitionerRoleRepository.add(practitionerRole2); - - List practitionerRoles = practitionerRoleRepository.getAll(); - assertNotNull(practitionerRoles); - assertEquals(2,practitionerRoles.size()); - - practitionerRoleRepository.safeRemove(practitionerRole2); - - practitionerRoles = practitionerRoleRepository.getAll(); - assertNotNull(practitionerRoles); - assertEquals(1, practitionerRoles.size()); - assertEquals(practitionerRole1.getIdentifier(), practitionerRoles.get(0).getIdentifier()); - } - - @Test - public void testSafeRemoveWithEmptyParamShouldDoesNotAffectExistingRecord() { - PractitionerRole practitionerRole1 = initTestPractitionerRole1(); - practitionerRoleRepository.add(practitionerRole1); - - List practitionerRoles = practitionerRoleRepository.getAll(); - assertNotNull(practitionerRoles); - assertEquals(1,practitionerRoles.size()); - - practitionerRoleRepository.safeRemove(new PractitionerRole()); - - practitionerRoles = practitionerRoleRepository.getAll(); - assertNotNull(practitionerRoles); - assertEquals(1, practitionerRoles.size()); - assertEquals(practitionerRole1.getIdentifier(), practitionerRoles.get(0).getIdentifier()); - } - - @Test - public void testSafeRemoveWithNonExistingRecordDoesNotAffectExistingRecord() { - PractitionerRole practitionerRole1 = initTestPractitionerRole1(); - practitionerRoleRepository.add(practitionerRole1); - - List practitionerRoles = practitionerRoleRepository.getAll(); - assertNotNull(practitionerRoles); - assertEquals(1,practitionerRoles.size()); - - PractitionerRole practitionerRole2 = initTestPractitionerRole2(); - practitionerRoleRepository.safeRemove(practitionerRole2); - - practitionerRoles = practitionerRoleRepository.getAll(); - assertNotNull(practitionerRoles); - assertEquals(1, practitionerRoles.size()); - assertEquals(practitionerRole1.getIdentifier(), practitionerRoles.get(0).getIdentifier()); - } - - @Test - public void testGetPgRolesForPractitioner() { - - PractitionerRole practitionerRole1 = initTestPractitionerRole1(); - practitionerRoleRepository.add(practitionerRole1); - - List pgPractitionerRoles = practitionerRoleRepository.getPgRolesForPractitioner(practitionerRole1.getPractitionerIdentifier()); - - assertNotNull(pgPractitionerRoles); - assertEquals(1, pgPractitionerRoles.size()); - assertEquals(practitionerRole1.getIdentifier(), pgPractitionerRoles.get(0).getIdentifier()); - assertEquals(practitionerRole1.getActive(), pgPractitionerRoles.get(0).getActive()); - assertEquals(practitionerRole1.getCode().getText(), pgPractitionerRoles.get(0).getCode()); - - } - - private static PractitionerRole initTestPractitionerRole1(){ - PractitionerRole practitionerRole = new PractitionerRole(); - practitionerRole.setIdentifier("pr1-identifier"); - practitionerRole.setActive(true); - practitionerRole.setOrganizationIdentifier("org1"); - practitionerRole.setPractitionerIdentifier("p1-identifier"); - PractitionerRoleCode code = new PractitionerRoleCode(); - code.setText("pr1Code"); - practitionerRole.setCode(code); - return practitionerRole; - } - - private static PractitionerRole initTestPractitionerRole2(){ - PractitionerRole practitionerRole = new PractitionerRole(); - practitionerRole.setIdentifier("pr2-identifier"); - practitionerRole.setActive(true); - practitionerRole.setOrganizationIdentifier("org1"); - practitionerRole.setPractitionerIdentifier("p2-identifier"); - PractitionerRoleCode code = new PractitionerRoleCode(); - code.setText("pr2Code"); - practitionerRole.setCode(code); - return practitionerRole; - } - - private boolean testIfAllIdsExists(List practitionerRoles, Set ids) { - for (PractitionerRole practitionerRole : practitionerRoles) { - ids.remove(practitionerRole.getIdentifier()); - } - return ids.size() == 0; - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/ReportsRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/ReportsRepositoryTest.java deleted file mode 100644 index 65015ede37..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/ReportsRepositoryTest.java +++ /dev/null @@ -1,239 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.joda.time.DateTime; -import org.junit.Test; -import org.opensrp.domain.Report; -import org.opensrp.repository.ReportsRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -public class ReportsRepositoryTest extends BaseRepositoryTest { - - @Autowired - @Qualifier("reportsRepositoryPostgres") - private ReportsRepository reportsRepository; - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet(); - scripts.add("report.sql"); - return scripts; - } - - @Test - public void testGet() { - Report report = reportsRepository.get("07271855-4018-497a-b180-6af01f0fa62b"); - assertEquals("7073cef4-b974-4910-afa7-dd2ccadba089", report.getFormSubmissionId()); - assertEquals("b0781dd2-e1b1-4878-8e6c-fba488eb9fa3", report.getLocationId()); - assertNull(reportsRepository.get("07271855-4018-497a-b180-6af")); - } - - @Test - public void testAdd() { - Report report = new Report("ghsjf-s723-sj97s", "3453535sdfs", new DateTime(), "MONTHLY", "435-njhjh-jjh", "tester11", - "3", 1522829702064l, 0, null); - reportsRepository.add(report); - assertEquals(6, reportsRepository.getAll().size()); - List reports = reportsRepository.findByBaseEntityAndFormSubmissionId("ghsjf-s723-sj97s", "435-njhjh-jjh"); - assertEquals("3453535sdfs", reports.get(0).getLocationId()); - assertEquals("MONTHLY", report.getReportType()); - assertNull(report.getHia2Indicators()); - - } - - @Test - public void testUpdate() { - Report report = reportsRepository.get("cd09a3d4-01d9-485c-a1c5-a2eb078a61be"); - report.setBaseEntityId("asads-asdas7676-ggas"); - report.setServerVersion(1522827820l); - report.setDuration(6); - - reportsRepository.update(report); - - Report updateReport = reportsRepository.get("cd09a3d4-01d9-485c-a1c5-a2eb078a61be"); - assertEquals("asads-asdas7676-ggas", updateReport.getBaseEntityId()); - assertEquals(1522827820l, updateReport.getServerVersion().longValue()); - assertEquals(6, updateReport.getDuration()); - - } - - @Test - public void testGetAll() { - assertEquals(5, reportsRepository.getAll().size()); - reportsRepository.safeRemove(reportsRepository.get("cd09a3d4-01d9-485c-a1c5-a2eb078a61be")); - List reports = reportsRepository.getAll(); - assertEquals(4, reports.size()); - for (Report report : reports) - assertNotEquals("cd09a3d4-01d9-485c-a1c5-a2eb078a61be", report.getId()); - } - - @Test - public void testSafeRemove() { - reportsRepository.safeRemove(reportsRepository.get("c57ba49f-34b9-4986-9b87-69f48b1830c5")); - List reports = reportsRepository.getAll(); - assertEquals(4, reports.size()); - for (Report report : reports) - assertNotEquals("c57ba49f-34b9-4986-9b87-69f48b1830c5", report.getId()); - assertNull(reportsRepository.get("c57ba49f-34b9-4986-9b87-69f48b1830c5")); - } - - @Test - public void testFindById() { - Report report = reportsRepository.findById("c57ba49f-34b9-4986-9b87-69f48b1830c5"); - assertEquals("88f9fe90-1e45-46b3-8056-e932574dcbd9", report.getFormSubmissionId()); - assertEquals(64, report.getHia2Indicators().size()); - } - - @Test - public void testFindByBaseEntityId() { - - assertEquals(2, reportsRepository.findByBaseEntityId("6654kk-mnj45-mmnfgd-l45645").size()); - - List reports = reportsRepository.findByBaseEntityId("678343544-nhj7-jghdfgfd-mkjdkfg"); - assertEquals(1, reports.size()); - assertEquals("ecafd20f-c95b-4046-9355-9512e1908da4", reports.get(0).getId()); - assertEquals("1aea74ac-b737-477a-99d3-728011fbae3f", reports.get(0).getFormSubmissionId()); - - assertTrue(reportsRepository.findByBaseEntityId("sfsdfd").isEmpty()); - - } - - @Test - public void testFindAllByIdentifier() { - assertEquals(2, reportsRepository.findAllByIdentifier("56757L").size()); - - List reports = reportsRepository.findAllByIdentifier("1121K"); - assertEquals(1, reports.size()); - assertEquals("07271855-4018-497a-b180-6af01f0fa62b", reports.get(0).getId()); - - assertTrue(reportsRepository.findAllByIdentifier("7234M").isEmpty()); - } - - @Test - public void testFindByBaseEntityAndType() { - assertEquals(2, reportsRepository.findByBaseEntityAndType("6654kk-mnj45-mmnfgd-l45645", "HIA2").size()); - - List reports = reportsRepository.findByBaseEntityAndType("678343544-nhj7-jghdfgfd-mkjdkfg", "HIA2"); - assertEquals(1, reports.size()); - assertEquals("ecafd20f-c95b-4046-9355-9512e1908da4", reports.get(0).getId()); - assertEquals("1aea74ac-b737-477a-99d3-728011fbae3f", reports.get(0).getFormSubmissionId()); - - assertTrue(reportsRepository.findByBaseEntityAndType("678343544-nhj7-jghdfgfd-mkjdkfg", "HIA4").isEmpty()); - } - - @Test - public void testFindByEmptyServerVersion() { - List reports = reportsRepository.findByEmptyServerVersion(); - assertEquals(1, reports.size()); - assertEquals("60ab7d5c-a051-4633-b0b3-f52b701cb261", reports.get(0).getId()); - assertEquals("03b5d0b8-4f72-4415-9909-ce03b5802c75", reports.get(0).getFormSubmissionId()); - - reports.get(0).setServerVersion(System.currentTimeMillis()); - reportsRepository.update(reports.get(0)); - - assertTrue(reportsRepository.findByEmptyServerVersion().isEmpty()); - } - - @Test - public void testFindByServerVersion() { - List reports = reportsRepository.findByServerVersion(1503312366264l); - assertEquals(1, reports.size()); - assertEquals("07271855-4018-497a-b180-6af01f0fa62b", reports.get(0).getId()); - - reports = reportsRepository.findByServerVersion(1500307579515l); - assertEquals(3, reports.size()); - for (Report report : reports) - assertTrue(report.getServerVersion() >= 1500307579516l); - assertTrue(reportsRepository.findByServerVersion(System.currentTimeMillis()).isEmpty()); - } - - @Test - public void testFindByBaseEntityAndFormSubmissionId() { - List reports = reportsRepository.findByBaseEntityAndFormSubmissionId("6654kk-mnj45-mmnfgd-l45645", - "03b5d0b8-4f72-4415-9909-ce03b5802c75"); - assertEquals(1, reports.size()); - assertEquals("60ab7d5c-a051-4633-b0b3-f52b701cb261", reports.get(0).getId()); - - assertTrue(reportsRepository - .findByBaseEntityAndFormSubmissionId("6654kk-mnj45-mmnfgd-l45645", "d78a8105-f808-488a-b67a-0c4c46845194") - .isEmpty()); - } - - @Test - public void testFindReports() { - assertEquals(2, - reportsRepository.findReports(null, "biddemo", "", "6654kk-mnj45-mmnfgd-l45645", null, null, null, 20).size()); - - List reports = reportsRepository.findReports(null, "biddemo", "", "6654kk-mnj45-mmnfgd-l45645", 0l, null, - null, 20); - assertEquals(1, reports.size()); - - assertEquals("07271855-4018-497a-b180-6af01f0fa62b", reports.get(0).getId()); - - assertEquals(1, reportsRepository.findReports(null, "biddemo", "9e4fc064-d8e7-4fcb-942e-cbcf6524fb24", - "6654kk-mnj45-mmnfgd-l45645", null, null, null, 20).size()); - - assertEquals(4, reportsRepository.findReports("", "biddemo", null, null, 0l, null, null, 20).size()); - - assertEquals(5, reportsRepository.findReports("", "biddemo", null, null, null, null, null, 20).size()); - - assertEquals(3, reportsRepository.findReports("", "biddemo", null, null, 1500307579515l, null, null, 20).size()); - - assertEquals(2, reportsRepository.findReports("", "biddemo", null, null, 0l, null, null, 2).size()); - - assertTrue(reportsRepository.findReports("ATeam", "biddemo", "9e4fc064-d8e7-4fcb-942e-cbcf6524fb24", - "6654kk-mnj45-mmnfgd-l45645", System.currentTimeMillis(), null, null, 20).isEmpty()); - } - - @Test(expected = IllegalArgumentException.class) - public void testFindReportsNoParams() { - reportsRepository.findReports("", null, null, null, null, null, null, 2); - } - - @Test - public void testFindReportsV2() { - assertEquals(2, reportsRepository.findReports("6654kk-mnj45-mmnfgd-l45645", new DateTime("2017-05-01"), - new DateTime(), "HIA2", "biddemo", null, null, null).size()); - - assertEquals(5, reportsRepository - .findReports(null, new DateTime("2017-05-01"), new DateTime(), "HIA2", "biddemo", null, null, null).size()); - - assertEquals(4, reportsRepository.findReports(null, new DateTime("2017-05-01"), new DateTime(), "HIA2", "biddemo", - "9e4fc064-d8e7-4fcb-942e-cbcf6524fb24", new DateTime("2017-07-17"), new DateTime()).size()); - - assertEquals(2, reportsRepository.findReports(null, new DateTime("2017-05-01"), new DateTime(), "HIA2", "biddemo", - "9e4fc064-d8e7-4fcb-942e-cbcf6524fb24", new DateTime("2017-07-18"), new DateTime()).size()); - - List reports = reportsRepository.findReports("678343544-nhj7-jghdfgfd-mkjdkfg", new DateTime("2017-05-01"), - new DateTime(), "HIA2", "biddemo", "9e4fc064-d8e7-4fcb-942e-cbcf6524fb24", new DateTime("2017-07-17"), - new DateTime()); - - assertEquals(1, reports.size()); - - assertEquals("ecafd20f-c95b-4046-9355-9512e1908da4", reports.get(0).getId()); - - assertTrue( - reportsRepository.findReports("6654kk-mnj45-mmnfgd-l45645", new DateTime("2017-05-01"), new DateTime(), "HIA2", - "biddemo", "9e4fc064-d8e7-4fcb-942e-cbcf6524fb24", new DateTime("2017-07-31"), new DateTime()).isEmpty()); - } - - @Test(expected = IllegalArgumentException.class) - public void testFindReportsV2NoParams() { - reportsRepository.findReports(null, null, null, null, null, null, null, null); - } - - @Test(expected = IllegalArgumentException.class) - public void testFindReportsByDynamicQuery() { - reportsRepository.findReportsByDynamicQuery("reportType:HIA2"); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/SearchRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/SearchRepositoryTest.java deleted file mode 100644 index c3646633bd..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/SearchRepositoryTest.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.joda.time.DateTime; -import org.junit.Test; -import org.opensrp.domain.Client; -import org.opensrp.repository.SearchRepository; -import org.opensrp.search.ClientSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -public class SearchRepositoryTest extends BaseRepositoryTest { - - @Autowired - @Qualifier("searchRepositoryPostgres") - private SearchRepository searchRepository; - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet(); - scripts.add("client.sql"); - return scripts; - } - - @Test - public void testFindByCriteria() { - ClientSearchBean clientSearchBean = new ClientSearchBean(); - List clients = searchRepository.findByCriteria(clientSearchBean, "Jan", null, null, 20); - - assertEquals(5, clients.size()); - - clients = searchRepository.findByCriteria(clientSearchBean, "Jan", null, "Bab", 20); - - assertEquals(5, clients.size()); - - clients = searchRepository.findByCriteria(clientSearchBean, "Jan", null, "Baby", 20); - - assertEquals(4, clients.size()); - - clients = searchRepository.findByCriteria(clientSearchBean, "Janu", null, "Baby", 3); - - assertEquals(3, clients.size()); - - for (Client client : clients) { - assertTrue(client.getFirstName().contains("Janu")); - assertTrue(client.getLastName().contains("Baby")); - } - - clients = searchRepository.findByCriteria(clientSearchBean, "JAnu", null, "BABY", 3); - - assertEquals(3, clients.size()); - - for (Client client : clients) { - assertTrue(client.getFirstName().contains("Janu")); - assertTrue(client.getLastName().contains("Baby")); - } - - clients = searchRepository.findByCriteria(clientSearchBean, "Janu", null, "Babyfive", 3); - - assertEquals(1, clients.size()); - assertEquals("05934ae338431f28bf6793b241693a2f", clients.get(0).getId()); - assertEquals("aabcd2cc-c111-41c6-85e6-cb5d9e350d08", clients.get(0).getBaseEntityId()); - - ClientSearchBean searchBean = new ClientSearchBean(); - - assertEquals(20, searchRepository.findByCriteria(searchBean, null, null, null, 20).size()); - - searchBean.setNameLike("Jan"); - assertEquals(4, searchRepository.findByCriteria(searchBean, "Janu", null, null, 20).size()); - - searchBean.setNameLike("Baby"); - searchBean.setGender("Male"); - assertEquals(2, searchRepository.findByCriteria(searchBean, "Jan", null, "Baby", 20).size()); - - searchBean.setBirthdateFrom(new DateTime("2016-04-13")); - searchBean.setBirthdateTo(new DateTime()); - assertEquals(2, searchRepository.findByCriteria(searchBean, "Jan", null, "Baby", 20).size()); - - searchBean.setDeathdateFrom(new DateTime("2018-01-01")); - searchBean.setDeathdateTo(new DateTime()); - assertEquals(1, searchRepository.findByCriteria(searchBean, "Jan", null, "Baby", 20).size()); - - searchBean = new ClientSearchBean(); - searchBean.setAttributeType("Home_Facility"); - searchBean.setAttributeValue("Happy Kids Clinic"); - assertEquals(9, searchRepository.findByCriteria(searchBean, null, null, null, 20).size()); - - searchBean.setAttributeType("CHW_Name"); - searchBean.setAttributeValue("Hellen"); - clients = searchRepository.findByCriteria(searchBean, null, null, null, 20); - assertEquals(1, clients.size()); - assertEquals("05934ae338431f28bf6793b24164cbd9", clients.get(0).getId()); - - searchBean = new ClientSearchBean(); - searchBean.setLastEditFrom(new DateTime("2018-03-13T12:57:05.652")); - searchBean.setLastEditTo(new DateTime()); - assertEquals(6, searchRepository.findByCriteria(searchBean, null, null, null, 20).size()); - - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/SettingRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/SettingRepositoryTest.java deleted file mode 100644 index 5e05e9e171..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/SettingRepositoryTest.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.junit.Test; -import org.opensrp.domain.postgres.Settings; -import org.opensrp.domain.postgres.SettingsMetadata; -import org.opensrp.domain.setting.SettingConfiguration; -import org.opensrp.repository.SettingRepository; -import org.opensrp.search.SettingSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -public class SettingRepositoryTest extends BaseRepositoryTest { - - @Autowired - @Qualifier("settingRepositoryPostgres") - private SettingRepository settingRepository; - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet(); - scripts.add("setting.sql"); - return scripts; - } - - @Test - public void testFindAllSettings() { - - List settings = settingRepository.findAllSettings(); - assertEquals(9, settings.size()); - - } - - @Test - public void testFindByEmptyServerVersion() { - - List settings = settingRepository.findByEmptyServerVersion(); - assertEquals(3, settings.size()); - - } - - @Test - public void testGetSettingById() { - - Settings setting = settingRepository.getSettingById(1L); - assertNotNull(setting); - assertNotNull(setting.getJson()); - - SettingConfiguration settingConfiguration = settingRepository.get("settings-document-id-2"); - assertNotNull(settingConfiguration); - assertEquals("population_characteristics", settingConfiguration.getIdentifier()); - - } - - @Test - public void testFindByCriteria() { - SettingSearchBean settingQueryBean = new SettingSearchBean(); - settingQueryBean.setServerVersion(0L); - - List settings = settingRepository.findSettings(settingQueryBean); - assertEquals(6, settings.size()); - - settingQueryBean.setTeamId("7e104eee-ec8a-4733-bcf7-c02c51cf43f4"); - settingQueryBean.setServerVersion(0L); - settings = settingRepository.findSettings(settingQueryBean); - - assertEquals(1, settings.size()); - - settingQueryBean = new SettingSearchBean(); - settingQueryBean.setServerVersion(0L); - settingQueryBean.setLocationId("44de66fb-e6c6-4bae-92bb-386dfe626eba"); - settings = settingRepository.findSettings(settingQueryBean); - - assertEquals(1, settings.size()); - - settingQueryBean = new SettingSearchBean(); - settingQueryBean.setServerVersion(0L); - settingQueryBean.setProviderId("demo"); - settings = settingRepository.findSettings(settingQueryBean); - - assertEquals(2, settings.size()); - - settingQueryBean = new SettingSearchBean(); - settingQueryBean.setServerVersion(0L); - settingQueryBean.setProviderId("demo"); - settingQueryBean.setTeamId("7e104eee-ec8a-4733-bcf7-c02c51cf43f4"); - settings = settingRepository.findSettings(settingQueryBean); - - assertEquals(1, settings.size()); - - settingQueryBean = new SettingSearchBean(); - settingQueryBean.setServerVersion(0L); - settingQueryBean.setTeam("my-team"); - settings = settingRepository.findSettings(settingQueryBean); - - assertEquals(1, settings.size()); - - } - - @Test - public void testGetAllSettings() { - - List settings = settingRepository.getAll(); - assertEquals(9, settings.size()); - - } - - @Test - public void testGetSettingMetadataByDocumentId() { - String documentId = "affc7614-a51b-4b5f-877a-ad932b38bf4b"; - SettingsMetadata settingMetadata = settingRepository.getSettingMetadataByDocumentId(documentId); - assertNotNull(settingMetadata); - assertEquals(documentId, settingMetadata.getDocumentId()); - assertEquals("lion_king_cast_2", settingMetadata.getIdentifier()); - - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/StocksRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/StocksRepositoryTest.java deleted file mode 100644 index 9b4392e136..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/StocksRepositoryTest.java +++ /dev/null @@ -1,211 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.junit.Test; -import org.opensrp.common.AllConstants.BaseEntity; -import org.opensrp.domain.Stock; -import org.opensrp.repository.StocksRepository; -import org.opensrp.search.StockSearchBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -public class StocksRepositoryTest extends BaseRepositoryTest { - - @Autowired - @Qualifier("stocksRepositoryPostgres") - private StocksRepository stocksRepository; - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet(); - scripts.add("stock.sql"); - return scripts; - } - - @Test - public void testGet() { - Stock stock = stocksRepository.get("05934ae338431f28bf6793b241978ad9"); - assertEquals(5l, stock.getIdentifier().longValue()); - assertEquals(20, stock.getValue()); - assertEquals("1", stock.getVaccine_type_id()); - assertEquals(1521009418783l, stock.getServerVersion().longValue()); - assertNull(stocksRepository.get("07271855-4018-497a-b180-6af")); - } - - @Test - public void testAdd() { - Stock stock = new Stock(521l, "VC1", "received", "tester1", 31, 1521499800000l, "VCC1", 1521536143239l, - 1521536179443l); - stocksRepository.add(stock); - assertEquals(16, stocksRepository.getAll().size()); - - List stocks = stocksRepository.findAllByIdentifier("vaccine_type", "VC1"); - - assertEquals(1, stocks.size()); - assertEquals("tester1", stocks.get(0).getProviderid()); - assertEquals(31, stock.getValue()); - assertEquals("VC1", stock.getVaccine_type_id()); - } - - @Test - public void testUpdate() { - Stock stock = stocksRepository.get("05934ae338431f28bf6793b241b2daa6"); - long now = System.currentTimeMillis(); - stock.setDate_updated(now); - stock.setValue(23); - stocksRepository.update(stock); - - Stock updatedStock = stocksRepository.get("05934ae338431f28bf6793b241b2daa6"); - assertEquals(now, updatedStock.getDate_updated().longValue()); - assertEquals(23, stock.getValue()); - - } - - @Test - public void testGetAll() { - assertEquals(15, stocksRepository.getAll().size()); - stocksRepository.safeRemove(stocksRepository.get("05934ae338431f28bf6793b241b2daa6")); - List stocks = stocksRepository.getAll(); - assertEquals(14, stocks.size()); - for (Stock stock : stocks) - assertNotEquals("05934ae338431f28bf6793b241b2daa6", stock.getId()); - - } - - @Test - public void testSafeRemove() { - stocksRepository.safeRemove(stocksRepository.get("05934ae338431f28bf6793b2419a606f")); - List stocks = stocksRepository.getAll(); - assertEquals(14, stocks.size()); - for (Stock stock : stocks) - assertNotEquals("05934ae338431f28bf6793b2419a606f", stock.getId()); - - assertNull(stocksRepository.get("05934ae338431f28bf6793b2419a606f")); - } - - @Test - public void testFindAllByProviderid() { - assertEquals(12, stocksRepository.findAllByProviderid("biddemo").size()); - - List stocks = stocksRepository.findAllByProviderid("biddemo1"); - assertEquals(3, stocks.size()); - for (Stock stock : stocks) - assertEquals("biddemo1", stock.getProviderid()); - - assertTrue(stocksRepository.findAllByProviderid("biddemo2").isEmpty()); - } - - @Test - public void testFindAllByIdentifier() { - assertEquals(11, stocksRepository.findAllByIdentifier("vaccine_type", "1").size()); - - List stocks = stocksRepository.findAllByIdentifier("vaccine_type", "2"); - assertEquals(4, stocks.size()); - for (Stock stock : stocks) - assertEquals("2", stock.getVaccine_type_id()); - - assertTrue(stocksRepository.findAllByIdentifier("vaccine_type", "19").isEmpty()); - } - - @Test - public void testFindById() { - Stock stock = stocksRepository.findById("05934ae338431f28bf6793b241b2df09"); - assertEquals(12l, stock.getIdentifier().longValue()); - assertEquals(-2, stock.getValue()); - assertEquals("1", stock.getVaccine_type_id()); - assertEquals("Physical_recount", stock.getTo_from()); - assertEquals("loss_adjustment", stock.getTransaction_type()); - assertNull(stocksRepository.findById("07271855-4018-497a-b180-6af")); - } - - @Test - public void testFindStocksWithOrder() { - StockSearchBean searchBean = new StockSearchBean(); - - searchBean.setStockTypeId("1"); - List stocks = stocksRepository.findStocks(searchBean, BaseEntity.SERVER_VERSIOIN, "asc", 5); - assertEquals(5, stocks.size()); - long previousVersion = 0; - for (Stock stock : stocks) { - assertEquals("1", stock.getVaccine_type_id()); - assertTrue(stock.getServerVersion() >= previousVersion); - previousVersion = stock.getServerVersion(); - } - - } - - @Test - public void testFindStocksStockbeanOnly() { - StockSearchBean searchBean = new StockSearchBean(); - - searchBean.setIdentifier("10"); - List stocks = stocksRepository.findStocks(searchBean); - assertEquals(1, stocks.size()); - - assertEquals(-19, stocks.get(0).getValue()); - assertEquals("2", stocks.get(0).getVaccine_type_id()); - assertEquals("C/C", stocks.get(0).getTo_from()); - assertEquals("issued", stocks.get(0).getTransaction_type()); - - searchBean = new StockSearchBean(); - searchBean.setStockTypeId("1"); - assertEquals(11, stocksRepository.findStocks(searchBean).size()); - - searchBean.setTransactionType("issued"); - searchBean.setProviderId("biddemo"); - assertEquals(3, stocksRepository.findStocks(searchBean).size()); - - searchBean = new StockSearchBean(); - searchBean.setValue("10"); - assertEquals(2, stocksRepository.findStocks(searchBean).size()); - - searchBean.setValue("2"); - stocks = stocksRepository.findStocks(searchBean); - assertEquals(1, stocks.size()); - assertEquals(14l, stocks.get(0).getIdentifier().longValue()); - assertEquals("1", stocks.get(0).getVaccine_type_id()); - assertEquals("DHO", stocks.get(0).getTo_from()); - assertEquals("received", stocks.get(0).getTransaction_type()); - - searchBean = new StockSearchBean(); - searchBean.setDateCreated("1518559200000"); - assertEquals(4, stocksRepository.findStocks(searchBean).size()); - - searchBean.setToFrom("DHO"); - assertEquals(2, stocksRepository.findStocks(searchBean).size()); - - searchBean.setDateUpdated("1521007053945"); - stocks = stocksRepository.findStocks(searchBean); - assertEquals(1, stocks.size()); - assertEquals(2l, stocks.get(0).getIdentifier().longValue()); - assertEquals("1", stocks.get(0).getVaccine_type_id()); - assertEquals("DHO", stocks.get(0).getTo_from()); - assertEquals("received", stocks.get(0).getTransaction_type()); - - searchBean = new StockSearchBean(); - searchBean.setServerVersion(1521009418783l); - assertEquals(11, stocksRepository.findStocks(searchBean).size()); - - searchBean.setServerVersion(1521023046990l); - assertEquals(8, stocksRepository.findStocks(searchBean).size()); - - } - - @Test - public void testFindAllStocks() { - assertEquals(15, stocksRepository.findAllStocks().size()); - stocksRepository.safeRemove(stocksRepository.get("05934ae338431f28bf6793b241b2df09")); - List stocks = stocksRepository.findAllStocks(); - assertEquals(14, stocks.size()); - for (Stock stock : stocks) - assertNotEquals("05934ae338431f28bf6793b241b2df09", stock.getId()); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/TaskRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/TaskRepositoryTest.java deleted file mode 100644 index 22366b7e3f..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/TaskRepositoryTest.java +++ /dev/null @@ -1,211 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.joda.time.DateTime; -import org.junit.Test; -import org.opensrp.domain.Task; -import org.opensrp.domain.Task.TaskStatus; -import org.opensrp.repository.TaskRepository; -import org.springframework.beans.factory.annotation.Autowired; - -public class TaskRepositoryTest extends BaseRepositoryTest { - - private String dateFormat = "yyyy-MM-dd'T'HHmm"; - - @Autowired - private TaskRepository taskRepository; - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet(); - scripts.add("task.sql"); - return scripts; - } - - @Test - public void testGet() { - Task task = taskRepository.get("tsk11231jh22"); - assertEquals("tsk11231jh22", task.getIdentifier()); - assertEquals("2018_IRS-3734", task.getGroupIdentifier()); - assertEquals(TaskStatus.READY, task.getStatus()); - assertEquals("Not Visited", task.getBusinessStatus()); - assertEquals(3, task.getPriority()); - assertEquals("IRS", task.getCode()); - assertEquals("Spray House", task.getDescription()); - assertEquals("IRS Visit", task.getFocus()); - assertEquals("location.properties.uid:41587456-b7c8-4c4e-b433-23a786f742fc", task.getForEntity()); - assertEquals("2018-11-10T2200", task.getExecutionStartDate().toString(dateFormat)); - assertNull(task.getExecutionEndDate()); - assertEquals("2018-10-31T0700", task.getAuthoredOn().toString(dateFormat)); - assertEquals("2018-11-12T1550", task.getLastModified().toString(dateFormat)); - assertEquals("demouser", task.getOwner()); - assertEquals(1, task.getNotes().size()); - assertEquals("demouser", task.getNotes().get(0).getAuthorString()); - assertEquals("2018-01-01T0800", task.getNotes().get(0).getTime().toString(dateFormat)); - assertEquals("This should be assigned to patrick.", task.getNotes().get(0).getText()); - } - - @Test - public void testGetWithNoIdentifier() { - - Task task = taskRepository.get(""); - assertNull(task); - - } - - @Test - public void testSafeRemove() { - assertEquals(2, taskRepository.getAll().size()); - Task task = taskRepository.get("iyr-998njoo"); - taskRepository.safeRemove(task); - - assertEquals(1, taskRepository.getAll().size()); - assertNull(taskRepository.get("iyr-998njoo")); - } - - @Test - public void testSafeRemoveNonExistentCampaign() { - taskRepository.safeRemove(null); - taskRepository.safeRemove(new Task()); - assertEquals(2, taskRepository.getAll().size()); - - taskRepository.safeRemove(taskRepository.get("iyr-998njoo")); - assertEquals(1, taskRepository.getAll().size()); - - taskRepository.safeRemove(taskRepository.get("iyr-998njoo")); - assertEquals(1, taskRepository.getAll().size()); - - } - - @Test - public void testAdd() { - Task task = new Task(); - task.setIdentifier("tsk-2332-j"); - task.setPlanIdentifier("2018-IRS-S4"); - task.setGroupIdentifier("7633hk-dsadsa"); - task.setDescription("Visit Mwangala household"); - task.setBusinessStatus("Not Visited"); - task.setStatus(TaskStatus.READY); - task.setOwner("worker12"); - taskRepository.add(task); - - assertEquals(3, taskRepository.getAll().size()); - Task addedTask = taskRepository.get("tsk-2332-j"); - assertNotNull(addedTask); - assertEquals("2018-IRS-S4", addedTask.getPlanIdentifier()); - assertEquals("7633hk-dsadsa", addedTask.getGroupIdentifier()); - assertEquals("Not Visited", addedTask.getBusinessStatus()); - assertEquals(TaskStatus.READY, addedTask.getStatus()); - assertEquals("worker12", addedTask.getOwner()); - - } - - @Test - public void testAddInvalidObject() { - assertEquals(2, taskRepository.getAll().size()); - Task task = new Task(); - taskRepository.add(task); - assertEquals(2, taskRepository.getAll().size()); - - taskRepository.add(null); - assertEquals(2, taskRepository.getAll().size()); - - } - - @Test - public void testAddExistingObject() { - assertEquals(2, taskRepository.getAll().size()); - Task task = taskRepository.get("iyr-998njoo"); - taskRepository.add(task); - assertEquals(2, taskRepository.getAll().size()); - - } - - @Test - public void testEdit() { - Task task = taskRepository.get("iyr-998njoo"); - task.setStatus(TaskStatus.FAILED); - task.setBusinessStatus("Non Residential"); - DateTime now = new DateTime(); - task.setLastModified(now); - taskRepository.update(task); - - Task updatedTask = taskRepository.get("iyr-998njoo"); - assertNotNull(updatedTask); - assertEquals("Non Residential", updatedTask.getBusinessStatus()); - assertEquals(TaskStatus.FAILED, updatedTask.getStatus()); - assertEquals(now, updatedTask.getLastModified()); - } - - @Test - public void testEditInvalidObject() { - assertEquals(2, taskRepository.getAll().size()); - Task task = new Task(); - taskRepository.update(task); - assertEquals(2, taskRepository.getAll().size()); - - taskRepository.update(null); - assertEquals(2, taskRepository.getAll().size()); - - } - - @Test - public void testEditNonExistingObject() { - Task task = taskRepository.get("iyr-998njoo"); - - taskRepository.safeRemove(task); - - taskRepository.update(task); - assertNull(taskRepository.get("iyr-998njoo")); - - } - - public void testGetTasksByCampaignAndGroup() { - List tasks = taskRepository.getTasksByPlanAndGroup("IRS_2018_S1", "2018_IRS-3734", 0); - assertEquals(1, tasks.size()); - assertEquals("tsk11231jh22", tasks.get(0).getIdentifier()); - - Task task = new Task(); - task.setIdentifier("tsk-2332-j"); - task.setPlanIdentifier("IRS_2018_S"); - task.setGroupIdentifier("2018_IRS-3734"); - task.setBusinessStatus("Not Visited"); - task.setStatus(TaskStatus.DRAFT); - task.setServerVersion(System.currentTimeMillis()); - taskRepository.add(task); - - assertEquals(2, taskRepository.getTasksByPlanAndGroup("IRS_2018_S1", "2018_IRS", 0)); - - assertTrue(taskRepository.getTasksByPlanAndGroup("IRS_2018_S1", "2018_IRS", 0).isEmpty()); - - assertTrue(taskRepository.getTasksByPlanAndGroup("IRS_201", "2018_IRS-373", 0).isEmpty()); - - assertTrue(taskRepository.getTasksByPlanAndGroup("IRS_2018_S1", "2018_IRS-373", System.currentTimeMillis()) - .isEmpty()); - - } - - @Test - public void testGetCampaignsByServerVersion() { - List tasks = taskRepository.findByEmptyServerVersion(); - assertTrue(tasks.isEmpty()); - - Task task = taskRepository.get("iyr-998njoo"); - task.setServerVersion(null); - taskRepository.update(task); - - tasks = taskRepository.findByEmptyServerVersion(); - assertEquals(1, tasks.size()); - assertEquals("iyr-998njoo", tasks.get(0).getIdentifier()); - - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/repository/postgres/ViewConfigurationRepositoryTest.java b/opensrp-core/src/test/java/org/opensrp/repository/postgres/ViewConfigurationRepositoryTest.java deleted file mode 100644 index 00511dc932..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/repository/postgres/ViewConfigurationRepositoryTest.java +++ /dev/null @@ -1,164 +0,0 @@ -package org.opensrp.repository.postgres; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.junit.Test; -import org.opensrp.domain.viewconfiguration.LoginConfiguration; -import org.opensrp.domain.viewconfiguration.View; -import org.opensrp.domain.viewconfiguration.ViewConfiguration; -import org.opensrp.repository.ViewConfigurationRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -public class ViewConfigurationRepositoryTest extends BaseRepositoryTest { - - @Autowired - @Qualifier("viewConfigurationRepositoryPostgres") - private ViewConfigurationRepository viewConfigurationRepository; - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet<>(); - scripts.add("view_configuration.sql"); - return scripts; - } - - @Test - public void testGet() { - ViewConfiguration view = viewConfigurationRepository.get("19a2e8aa6739d77a2b780199c6122867"); - assertEquals("main", view.getIdentifier()); - assertEquals(1516890951253l, view.getServerVersion().longValue()); - - assertNull(viewConfigurationRepository.get("19a2e8aa6739d22867")); - - } - - @Test - public void testAdd() { - long now = System.currentTimeMillis(); - - ViewConfiguration viewConfiguration = new ViewConfiguration(); - viewConfiguration.setIdentifier("help"); - View view = new View(); - view.setIdentifier("faq"); - view.setLabel("FAQ"); - view.setVisible(true); - view.setOrientation("vertical"); - viewConfiguration.setViews(new ArrayList()); - viewConfiguration.getViews().add(view); - - viewConfigurationRepository.add(viewConfiguration); - - assertEquals(6, viewConfigurationRepository.getAll().size()); - - List savedViews = viewConfigurationRepository.findViewConfigurationsByVersion(now); - assertEquals(1, savedViews.size()); - assertEquals(1, savedViews.get(0).getViews().size()); - assertEquals("faq", savedViews.get(0).getViews().get(0).getIdentifier()); - } - - @Test - public void testUpdate() { - ViewConfiguration view = viewConfigurationRepository.get("92141b17040021a7ce326194ff0029f7"); - LoginConfiguration configuration = (LoginConfiguration) view.getMetadata(); - configuration.setShowPasswordCheckbox(false); - configuration.setLanguage("fr_cn"); - configuration.setLogoUrl("http://localhost:98778/test.jpg"); - view.setMetadata(configuration); - viewConfigurationRepository.update(view); - - LoginConfiguration updatedView = (LoginConfiguration) viewConfigurationRepository - .get("92141b17040021a7ce326194ff0029f7").getMetadata(); - assertEquals("fr_cn", updatedView.getLanguage()); - assertEquals("http://localhost:98778/test.jpg", updatedView.getLogoUrl()); - assertFalse(updatedView.getShowPasswordCheckbox()); - - } - - @Test - public void testGetAll() { - assertEquals(5, viewConfigurationRepository.getAll().size()); - - viewConfigurationRepository.safeRemove(viewConfigurationRepository.get("3a065d7c3354eb2bc23c8a3bc303ef62")); - - assertEquals(4, viewConfigurationRepository.getAll().size()); - } - - @Test - public void testSafeRemove() { - - ViewConfiguration view = viewConfigurationRepository.get("3a065d7c3354eb2bc23c8a3bc303ef62"); - viewConfigurationRepository.safeRemove(view); - - assertNull(viewConfigurationRepository.get(view.getId())); - - List views = viewConfigurationRepository.getAll(); - for (ViewConfiguration v : views) { - assertNotEquals(view.getId(), v.getId()); - assertNotEquals(view.getIdentifier(), v.getIdentifier()); - } - } - - @Test - public void testFindAllViewConfigurations() { - assertEquals(5, viewConfigurationRepository.getAll().size()); - - ViewConfiguration viewConfiguration = new ViewConfiguration(); - viewConfiguration.setIdentifier("bmi"); - - viewConfigurationRepository.add(viewConfiguration); - - assertEquals(6, viewConfigurationRepository.getAll().size()); - } - - @Test - public void testFindViewConfigurationsByVersion() { - assertEquals(5, viewConfigurationRepository.findViewConfigurationsByVersion(0l).size()); - - List views = viewConfigurationRepository.findViewConfigurationsByVersion(1516614392971l); - assertEquals(2, views.size()); - - for (ViewConfiguration view : views) { - assertTrue(view.getServerVersion() >= 1516614392971l); - assertTrue(view.getIdentifier().equals("positive_register_header") || view.getIdentifier().equals("main")); - } - - } - - @Test - public void testFindByEmptyServerVersion() { - assertTrue(viewConfigurationRepository.findByEmptyServerVersion().isEmpty()); - - ViewConfiguration view = viewConfigurationRepository.get("d243bc5737fb389e52601cb850299541"); - view.setServerVersion(null); - viewConfigurationRepository.update(view); - - List views = viewConfigurationRepository.findByEmptyServerVersion(); - assertEquals(1, views.size()); - assertEquals("lang_sw", views.get(0).getIdentifier()); - assertEquals("d243bc5737fb389e52601cb850299541", views.get(0).getId()); - - ViewConfiguration view2 = viewConfigurationRepository.get("3a065d7c3354eb2bc23c8a3bc303ba20"); - view2.setServerVersion(0l); - viewConfigurationRepository.update(view2); - - views = viewConfigurationRepository.findByEmptyServerVersion(); - assertEquals(2, views.size()); - - for (ViewConfiguration v : views) { - assertTrue(v.getIdentifier().equals(view.getIdentifier()) || v.getIdentifier().equals(view2.getIdentifier())); - assertTrue(v.getId().equals(view.getId()) || v.getId().equals(view2.getId())); - } - - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/ActionTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/ActionTest.java deleted file mode 100644 index 49988dd7b0..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/ActionTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.opensrp.scheduler; - -import org.junit.Test; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -public class ActionTest { - - @Test - public void testEqualityAndHashCode() { - EqualsVerifier.forClass(Action.class).withIgnoredFields("id", "timeStamp", "revision") - .suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testGetterAndSetter() { - Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(Action.class)); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/AlertTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/AlertTest.java deleted file mode 100644 index bd8ba85eed..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/AlertTest.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.opensrp.scheduler; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import java.util.HashMap; - -import org.joda.time.DateTime; -import org.junit.Test; -import org.opensrp.dto.AlertStatus; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.rule.impl.GetterMustExistRule; -import com.openpojo.validation.rule.impl.SetterMustExistRule; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -public class AlertTest { - - @Test - public void testEqualityAndHashCode() { - EqualsVerifier.forClass(Alert.class).withIgnoredFields("timeStamp", "revision").suppress(Warning.NONFINAL_FIELDS) - .verify(); - } - - @Test - public void testConstructorGetterAndSetter() { - Validator validator = ValidatorBuilder.create() - // Add Rules to validate structure for POJO_PACKAGE - // See com.openpojo.validation.rule.impl for more ... - .with(new GetterMustExistRule()).with(new SetterMustExistRule()) - // Add Testers to validate behaviour for POJO_PACKAGE - // See com.openpojo.validation.test.impl for more ... - .with(new SetterTester()).with(new GetterTester()).build(); - - validator.validate(PojoClassFactory.getPojoClass(Alert.class)); - } - - @Test(expected = IllegalStateException.class) - public void testExceptionMarkAsClosedWithClosedAlert() { - Alert alert = new Alert("pr", "en", "ben", Alert.AlertType.notification, Alert.TriggerType.event, "", "", - new DateTime(1l), new DateTime(2l), AlertStatus.closed, new HashMap()); - - alert.markAlertAsClosed("reason"); - } - - @Test(expected = IllegalStateException.class) - public void testExceptionMarkAsClosedWithCompletedAlert() { - Alert alert = new Alert("pr", "en", "ben", Alert.AlertType.notification, Alert.TriggerType.event, "", "", - new DateTime(1l), new DateTime(2l), AlertStatus.complete, new HashMap()); - - alert.markAlertAsClosed("reason"); - } - - @Test - public void testMarkAsClosed() { - Alert alert = new Alert("pr", "en", "ben", Alert.AlertType.notification, Alert.TriggerType.event, "", "", - new DateTime(1l), new DateTime(2l), AlertStatus.normal, new HashMap()); - - Alert spyAlert = spy(alert); - when(spyAlert.getCurrentDateTime()).thenReturn(new DateTime(1l)); - spyAlert.markAlertAsClosed("reason"); - - assertEquals("reason", spyAlert.reasonClosed()); - assertEquals(AlertStatus.normal.name(), spyAlert.closingPeriod()); - assertEquals(AlertStatus.closed.name(), spyAlert.alertStatus()); - assertEquals(new DateTime(1l).toLocalDate().toString(), spyAlert.dateClosed()); - assertFalse(spyAlert.isActive()); - } - - @Test(expected = IllegalStateException.class) - public void testExceptionMarkAsCompletedWithCompletedAlert() { - Alert alert = new Alert("pr", "en", "ben", Alert.AlertType.notification, Alert.TriggerType.event, "", "", - new DateTime(1l), new DateTime(2l), AlertStatus.complete, new HashMap()); - - alert.markAlertAsComplete("reason"); - } - - @Test(expected = IllegalStateException.class) - public void testExceptionMarkAsCompletedWithClosedAlert() { - Alert alert = new Alert("pr", "en", "ben", Alert.AlertType.notification, Alert.TriggerType.event, "", "", - new DateTime(1l), new DateTime(2l), AlertStatus.closed, new HashMap()); - - alert.markAlertAsComplete("reason"); - } - - @Test - public void testMarkAsCompleted() { - Alert alert = new Alert("pr", "en", "ben", Alert.AlertType.notification, Alert.TriggerType.event, "", "", - new DateTime(1l), new DateTime(2l), AlertStatus.normal, new HashMap()); - - Alert spyAlert = spy(alert); - when(spyAlert.getCurrentDateTime()).thenReturn(new DateTime(1l)); - spyAlert.markAlertAsComplete("date"); - - assertEquals("date", spyAlert.getDateComplete()); - assertEquals(AlertStatus.normal.name(), spyAlert.closingPeriod()); - assertEquals(AlertStatus.complete.name(), spyAlert.alertStatus()); - assertEquals(new DateTime(1l).toLocalDate().toString(), spyAlert.dateClosed()); - assertFalse(spyAlert.isActive()); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/FormEventListenerTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/FormEventListenerTest.java deleted file mode 100644 index 4c21d9f825..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/FormEventListenerTest.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.opensrp.scheduler; - -import static java.util.Arrays.asList; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; -import static org.opensrp.common.util.EasyMap.mapOf; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.motechproject.scheduler.domain.MotechEvent; -import org.opensrp.common.AllConstants.Config; -import org.opensrp.common.AllConstants.OpenSRPEvent; -import org.opensrp.domain.AppStateToken; -import org.opensrp.dto.form.FormSubmissionDTO; -import org.opensrp.form.domain.FormData; -import org.opensrp.form.domain.FormField; -import org.opensrp.form.domain.FormInstance; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.service.FormSubmissionService; -import org.opensrp.service.ConfigService; -import org.opensrp.service.ErrorTraceService; -import org.opensrp.service.formSubmission.FormSubmissionListener; -import org.opensrp.service.formSubmission.FormSubmissionProcessor; - -import com.google.gson.Gson; - -public class FormEventListenerTest { - - @Mock - private FormSubmissionService formSubmissionService; - - @Mock - private FormSubmissionProcessor fsp; - - @Mock - private ConfigService configService; - - @Mock - private ErrorTraceService errorTraceService; - - private FormSubmissionListener listener; - - @Before - public void setUp() throws Exception { - initMocks(this); - listener = new FormSubmissionListener(formSubmissionService, fsp, configService, errorTraceService); - } - - @Test - public void shouldDelegateFormSubmissionToSubmissionService() throws Exception { - List formSubmissions = asList( - new FormSubmissionDTO("anm id 1", "instance id 1", "entity id 1", "form name", null, "0", "1"), - new FormSubmissionDTO("anm id 2", "instance id 2", "entity id 2", "form name", null, "0", "1")); - - listener.submitForms( - new MotechEvent(OpenSRPEvent.FORM_SUBMISSION, mapOf("data", (Object) new Gson().toJson(formSubmissions)))); - - verify(formSubmissionService).submit(formSubmissions); - } - - @Test - public void shouldFetchFormSubmissionsFromSubmissionService() throws Exception { - FormSubmission fs1 = new FormSubmission("anm id 1", "instance id 1", "form name", "entity id 1", "1.0", 0L, - new FormInstance(new FormData("test", "def/bindpath", new ArrayList(), null))), - fs2 = new FormSubmission("anm id 2", "instance id 2", "form name", "entity id 2", "1.0", 0L, - new FormInstance(new FormData("test", "def/bindpath", new ArrayList(), null))); - List formSubmissions = asList(fs1, fs2); - when(configService.getAppStateTokenByName(Config.FORM_ENTITY_PARSER_LAST_SYNCED_FORM_SUBMISSION)) - .thenReturn(new AppStateToken("token", 1L, 0)); - when(formSubmissionService.getAllSubmissions(1L, null)).thenReturn(formSubmissions); - - listener.parseForms(); - - verify(fsp).processFormSubmission(fs1); - verify(fsp).processFormSubmission(fs2); - verify(configService, atLeast(2)).updateAppStateToken(eq(Config.FORM_ENTITY_PARSER_LAST_SYNCED_FORM_SUBMISSION), - any(Long.class)); - verifyNoMoreInteractions(fsp); - } - - @Test - public void shouldNotDoAnythingIfFetchFromSubmissionServiceReturnsEmptyList() throws Exception { - when(configService.getAppStateTokenByName(Config.FORM_ENTITY_PARSER_LAST_SYNCED_FORM_SUBMISSION)) - .thenReturn(new AppStateToken("token", 1L, 0)); - when(formSubmissionService.getAllSubmissions(1L, null)).thenReturn(Collections.EMPTY_LIST); - - listener.parseForms(); - - verifyZeroInteractions(fsp); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/RepeatingCornScheduleTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/RepeatingCornScheduleTest.java deleted file mode 100644 index 2d6bd6c540..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/RepeatingCornScheduleTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.opensrp.scheduler; - -import static org.junit.Assert.assertEquals; - -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.junit.Test; - -public class RepeatingCornScheduleTest { - - public static final String CRON_EXPRESSION = "cornexpression"; - - public static final int START_DELAY = 100; - - public static final String SUBJECT = "Subject"; - - RepeatingCronSchedule repeatingCronSchedule = new RepeatingCronSchedule(SUBJECT, START_DELAY, TimeUnit.HOURS, - CRON_EXPRESSION); - - @Test - public void testMillisConverter() { - assertEquals(1 / 1000000l, repeatingCronSchedule.millisConverter(TimeUnit.NANOSECONDS)); - assertEquals(1 / 1000l, repeatingCronSchedule.millisConverter(TimeUnit.MICROSECONDS)); - assertEquals(1l, repeatingCronSchedule.millisConverter(TimeUnit.MILLISECONDS)); - assertEquals(1000l, repeatingCronSchedule.millisConverter(TimeUnit.SECONDS)); - assertEquals(1000 * 60, repeatingCronSchedule.millisConverter(TimeUnit.MINUTES)); - assertEquals(1000 * 60 * 60l, repeatingCronSchedule.millisConverter(TimeUnit.HOURS)); - assertEquals(1000 * 60 * 60 * 24, repeatingCronSchedule.millisConverter(TimeUnit.DAYS)); - } - - @Test - public void testConstructor() { - Map extraData = new HashMap<>(); - extraData.put("key1", "value1"); - RepeatingCronSchedule repeatingCronSchedule = new RepeatingCronSchedule(SUBJECT, START_DELAY, TimeUnit.MILLISECONDS, - CRON_EXPRESSION, new Date(0l), extraData); - - assertEquals(extraData, repeatingCronSchedule.getData()); - assertEquals(new Date(0l), repeatingCronSchedule.getEndTime()); - assertEquals(START_DELAY, repeatingCronSchedule.getStartDelayMilis()); - - repeatingCronSchedule.addData("key2", "value2"); - extraData.put("key2", "value2"); - assertEquals(extraData, repeatingCronSchedule.getData()); - - repeatingCronSchedule.withData(Collections.EMPTY_MAP); - assertEquals(Collections.EMPTY_MAP, repeatingCronSchedule.getData()); - - repeatingCronSchedule.withEndTime(new Date(1l)); - assertEquals(new Date(1l), repeatingCronSchedule.getEndTime()); - - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/RepeatingScheduleTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/RepeatingScheduleTest.java deleted file mode 100644 index 59a8e8ffcf..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/RepeatingScheduleTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.opensrp.scheduler; - -import static org.junit.Assert.assertEquals; - -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.junit.Test; - -public class RepeatingScheduleTest { - - public static final int START_DELAY = 100; - - public static final String SUBJECT = "Subject"; - - public static final int REPEAT_INTERVAL = 5; - - RepeatingSchedule repeatingSchedule = new RepeatingSchedule(SUBJECT, START_DELAY, TimeUnit.HOURS, REPEAT_INTERVAL, - TimeUnit.MILLISECONDS); - - @Test - public void testMillisConverter() { - assertEquals(1 / 1000000l, repeatingSchedule.millisConverter(TimeUnit.NANOSECONDS)); - assertEquals(1 / 1000l, repeatingSchedule.millisConverter(TimeUnit.MICROSECONDS)); - assertEquals(1l, repeatingSchedule.millisConverter(TimeUnit.MILLISECONDS)); - assertEquals(1000l, repeatingSchedule.millisConverter(TimeUnit.SECONDS)); - assertEquals(1000 * 60, repeatingSchedule.millisConverter(TimeUnit.MINUTES)); - assertEquals(1000 * 60 * 60l, repeatingSchedule.millisConverter(TimeUnit.HOURS)); - assertEquals(1000 * 60 * 60 * 24, repeatingSchedule.millisConverter(TimeUnit.DAYS)); - } - - @Test - public void testConstructor() { - Map extraData = new HashMap<>(); - extraData.put("key1", "value1"); - RepeatingSchedule repeatingSchedule = new RepeatingSchedule(SUBJECT, START_DELAY, TimeUnit.MILLISECONDS, - REPEAT_INTERVAL, TimeUnit.MILLISECONDS, new Date(0l), extraData); - - assertEquals(extraData, repeatingSchedule.getData()); - assertEquals(new Date(0l), repeatingSchedule.getEndTime()); - assertEquals(START_DELAY, repeatingSchedule.getStartDelayMilis()); - assertEquals(REPEAT_INTERVAL, repeatingSchedule.getRepeatIntervalMilis()); - - repeatingSchedule.addData("key2", "value2"); - extraData.put("key2", "value2"); - assertEquals(extraData, repeatingSchedule.getData()); - - repeatingSchedule.withData(Collections.EMPTY_MAP); - assertEquals(Collections.EMPTY_MAP, repeatingSchedule.getData()); - - repeatingSchedule.withEndTime(new Date(1l)); - assertEquals(new Date(1l), repeatingSchedule.getEndTime()); - - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/ScheduleConfigTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/ScheduleConfigTest.java deleted file mode 100644 index 8d1a6eef1d..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/ScheduleConfigTest.java +++ /dev/null @@ -1,221 +0,0 @@ -package org.opensrp.scheduler; - -import static org.hamcrest.Matchers.anything; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasItem; -import static org.hamcrest.Matchers.hasItems; -import static org.hamcrest.Matchers.not; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.hamcrest.Matchers; -import org.json.JSONException; -import org.junit.Test; -import org.opensrp.scheduler.Schedule.ActionType; - -public class ScheduleConfigTest { - - private ScheduleConfig schconfig; - - public ScheduleConfigTest() throws IOException, JSONException { - schconfig = new ScheduleConfig("/schedules/schedule-config.xls"); - } - - @SuppressWarnings("unchecked") - @Test - public void shouldReadAllPropertiesForSingleTriggerSingleForm() throws JSONException { - Schedule sch = new Schedule( - "{\"milestone\":\"pentavalent_1\",\"passLogic\":\"${fs.pentavalent_1} == empty && ${fs.pentavalent_1_retro} == empty\",\"schedule\":\"PENTAVALENT 1\",\"form\":\"child_enrollment\",\"triggerDateField\":\"child_birth_date\",\"action\":\"enroll\",\"entityType\":\"pkchild\"}"); - assertThat(sch, - Matchers. allOf(Matchers. hasProperty("schedule", equalTo("PENTAVALENT 1")), - Matchers. hasProperty("milestone", equalTo("pentavalent_1")), - Matchers. hasProperty("action", equalTo(ActionType.enroll)), - Matchers. hasProperty("entityType", equalTo("pkchild")), - Matchers. hasProperty("triggerDateFields", hasItem("child_birth_date")), - Matchers. hasProperty("forms", hasItem("child_enrollment")))); - - assertEquals("PENTAVALENT 1", sch.schedule()); - assertEquals("pentavalent_1", sch.milestone()); - assertEquals(ActionType.enroll, sch.action()); - assertEquals("pkchild", sch.entityType()); - assertThat(sch.triggerDateFields(), hasItem("child_birth_date")); - assertThat(sch.forms(), hasItem("child_enrollment")); - } - - @SuppressWarnings("unchecked") - @Test - public void shouldReadAllPropertiesForMultipleTriggerMultipleForm() throws JSONException { - Schedule sch = new Schedule("{\"milestone\":\"pentavalent_2\"," - + "\"passLogic\":\"${fs.pentavalent_2} == empty && ${fs.pentavalent_2_retro} == empty\"," - + "\"schedule\":\"PENTAVALENT 2\",\"form\":\"child_enrollment,child_followup\"," - + "\"triggerDateField\":\"pentavalent_1, pentavalent_1_retro\"," - + "\"action\":\"enroll\",\"entityType\":\"pkchild\"}"); - assertThat(sch, - Matchers. allOf(Matchers. hasProperty("schedule", equalTo("PENTAVALENT 2")), - Matchers. hasProperty("milestone", equalTo("pentavalent_2")), - Matchers. hasProperty("action", equalTo(ActionType.enroll)), - Matchers. hasProperty("entityType", equalTo("pkchild")), - Matchers. hasProperty("passLogic", anything()), - Matchers. hasProperty("triggerDateFields", hasItems("pentavalent_1", "pentavalent_1_retro")), - Matchers. hasProperty("forms", hasItems("child_enrollment", "child_followup")))); - - assertEquals("PENTAVALENT 2", sch.schedule()); - assertEquals("pentavalent_2", sch.milestone()); - assertEquals(ActionType.enroll, sch.action()); - assertEquals("pkchild", sch.entityType()); - assertThat(sch.triggerDateFields(), hasItems("pentavalent_1", "pentavalent_1_retro")); - assertThat(sch.forms(), hasItems("child_enrollment", "child_followup")); - } - - @SuppressWarnings("unchecked") - @Test - public void shouldLoadScheduleByFormName() { - List sch = schconfig.searchSchedules("child_enrollment"); - assertThat(sch, - hasItem(Matchers. allOf(Matchers. hasProperty("schedule", equalTo("PENTAVALENT 1")), - Matchers. hasProperty("milestone", equalTo("penta1")), - Matchers. hasProperty("action", equalTo(ActionType.enroll)), - Matchers. hasProperty("entityType", equalTo("pkchild")), - Matchers. hasProperty("passLogic", anything()), - Matchers. hasProperty("triggerDateFields", hasItem("dob"))))); - - assertThat(sch, - hasItem(Matchers. allOf(Matchers. hasProperty("schedule", equalTo("PENTAVALENT 2")), - Matchers. hasProperty("milestone", equalTo("penta2")), - Matchers. hasProperty("action", equalTo(ActionType.enroll)), - Matchers. hasProperty("entityType", equalTo("pkchild")), - Matchers. hasProperty("passLogic", anything()), - Matchers. hasProperty("triggerDateFields", hasItems("pentavalent_1", "pentavalent_1_retro")), - Matchers. hasProperty("forms", hasItems("child_enrollment"))))); - - List schf = schconfig.searchSchedules("child_followup"); - assertThat(schf, - hasItem(Matchers. allOf(Matchers. hasProperty("schedule", equalTo("PENTAVALENT 2")), - Matchers. hasProperty("milestone", equalTo("penta2")), - Matchers. hasProperty("action", equalTo(ActionType.enroll)), - Matchers. hasProperty("entityType", equalTo("pkchild")), - Matchers. hasProperty("passLogic", anything()), - Matchers. hasProperty("triggerDateFields", hasItems("pentavalent_1", "pentavalent_1_retro")), - Matchers. hasProperty("forms", hasItems("child_followup"))))); - assertThat(schf, - not(hasItem(Matchers. allOf(Matchers. hasProperty("schedule", equalTo("PENTAVALENT 1")), - Matchers. hasProperty("milestone", equalTo("penta1")), - Matchers. hasProperty("action", equalTo(ActionType.enroll)), - Matchers. hasProperty("entityType", equalTo("pkchild")), - Matchers. hasProperty("passLogic", anything()), - Matchers. hasProperty("triggerDateFields", hasItem("dob")))))); - } - - @Test - public void shouldReturnCorrectResultForValidation() { - List sch = schconfig.searchSchedules("child_enrollment", "PENTAVALENT 2", "penta2", ActionType.enroll); - assertEquals(1, sch.size()); - - Schedule s = sch.get(0); - - Map flvl = new HashMap<>(); - flvl.put("pentavalent_2", null); - flvl.put("pentavalent_2_retro", null); - assertTrue(s.passesValidations(flvl)); - - flvl.put("pentavalent_2", ""); - flvl.put("pentavalent_2_retro", ""); - assertTrue(s.passesValidations(flvl)); - - flvl.put("pentavalent_2", "a val"); - flvl.put("pentavalent_2_retro", ""); - assertFalse(s.passesValidations(flvl)); - - flvl.put("pentavalent_2", "a val"); - flvl.put("pentavalent_2_retro", "a vale"); - assertFalse(s.passesValidations(flvl)); - - sch = schconfig.searchSchedules("pnc_reg_form", "Boosters", "REMINDER", ActionType.enroll); - assertEquals(1, sch.size()); - - s = sch.get(0); - - flvl = new HashMap<>(); - - assertTrue(s.passesValidations(flvl)); - - flvl.put("pentavalent_2", null); - flvl.put("pentavalent_2_retro", null); - assertTrue(s.passesValidations(flvl)); - - flvl.put("pentavalent_2", ""); - flvl.put("pentavalent_2_retro", ""); - assertTrue(s.passesValidations(flvl)); - - flvl.put("pentavalent_2", "a val"); - flvl.put("pentavalent_2_retro", ""); - assertTrue(s.passesValidations(flvl)); - - flvl.put("pentavalent_2", "a val"); - flvl.put("pentavalent_2_retro", "a vale"); - assertTrue(s.passesValidations(flvl)); - } - - @Test - public void shouldReturnCorrectResultForApplicableEntity() { - List sch = schconfig.searchSchedules("child_enrollment", "PENTAVALENT 2", "penta2", ActionType.enroll); - assertEquals(1, sch.size()); - - Schedule s = sch.get(0); - assertTrue(s.applicableForEntity("pkchild")); - assertTrue(s.applicableForEntity(" pkchild ")); - assertFalse(s.applicableForEntity("pk child")); - assertFalse(s.applicableForEntity("otherstring")); - } - - @Test - public void shouldReturnCorrectResultForApplicableForm() { - List sch = schconfig.searchSchedules("child_enrollment", "PENTAVALENT 2", "penta2", ActionType.enroll); - assertEquals(1, sch.size()); - - Schedule s = sch.get(0); - assertTrue(s.hasForm("child_enrollment")); - assertFalse(s.hasForm("other form")); - } - - @Test - public void shouldReturnCorrectResultForLogicPresent() { - List sch = schconfig.searchSchedules("child_enrollment", "PENTAVALENT 2", "penta2", ActionType.enroll); - assertEquals(1, sch.size()); - - Schedule s = sch.get(0); - assertTrue(s.haspassLogic()); - - sch = schconfig.searchSchedules("pnc_reg_form", "Boosters", "REMINDER", ActionType.enroll); - assertEquals(1, sch.size()); - - s = sch.get(0); - assertFalse(s.haspassLogic()); - } - - @Test - public void shouldAddSchedule() { - List sch = schconfig.searchSchedules("child_enrollment", "PENTAVALENT 2", "penta2", ActionType.enroll); - Schedule s = sch.get(0); - - List actual = schconfig.getSchedules(); - Schedule lastSchedule = actual.get(actual.size() - 1); - assertNotEquals(s, lastSchedule); - - schconfig.addSchedule(s); - - actual = schconfig.getSchedules(); - lastSchedule = actual.get(actual.size() - 1); - - assertEquals(s, lastSchedule); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/ScheduleTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/ScheduleTest.java deleted file mode 100644 index e67d5dbcaa..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/ScheduleTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.opensrp.scheduler; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.junit.Test; -import org.opensrp.util.Utils; -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.ResourceLoader; - -public class ScheduleTest { - - @Test(expected = JSONException.class) - public void testConstructorInvalidString() throws JSONException { - new Schedule(" dsf"); - } - - @Test(expected = JSONException.class) - public void testWithInvalidJsonObject() throws JSONException { - new Schedule(new JSONObject()); - } - - @Test(expected = Exception.class) - public void testCompilerExceptionInPassesValidation() throws IOException, JSONException { - String scheduleConfigPath = "/schedules/schedule-config.xls"; - ResourceLoader loader = new DefaultResourceLoader(); - scheduleConfigPath = loader.getResource(scheduleConfigPath).getURI().getPath(); - - JSONArray xlsToJsonScheduleArray = Utils.getXlsToJson(scheduleConfigPath); - - String duplicatePassLogic = "${fs.pentavalent_2} !=s ${fs.pentavalent_2}"; - Schedule schedule = new Schedule(xlsToJsonScheduleArray.getJSONObject(0).put("passLogic", duplicatePassLogic)); - - Map flvl = new HashMap<>(); - - flvl.put("pentavalent_2", null); - schedule.passesValidations(flvl); - - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/SystemEventTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/SystemEventTest.java deleted file mode 100644 index b9663d71f8..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/SystemEventTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.opensrp.scheduler; - -import static org.junit.Assert.assertEquals; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.motechproject.scheduler.domain.MotechEvent; -import org.opensrp.common.FormEntityConstants; - -import com.google.gson.Gson; - -public class SystemEventTest { - - @Test - public void testMotechEventCreation() { - SystemEvent systemEvent = new SystemEvent("subject", "data"); - Map parameters = new HashMap<>(); - parameters.put(SystemEvent.DATA, new Gson().toJson("data")); - MotechEvent expected = new MotechEvent("subject", parameters); - - assertEquals(expected, systemEvent.toMotechEvent()); - - } - - @Test - public void testMotechEventCreationWintEnum() { - SystemEvent systemEvent = new SystemEvent(FormEntityConstants.Person.first_name, "data"); - Map parameters = new HashMap<>(); - parameters.put(SystemEvent.DATA, new Gson().toJson("data")); - MotechEvent expected = new MotechEvent(FormEntityConstants.Person.first_name.name(), parameters); - - assertEquals(expected, systemEvent.toMotechEvent()); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/TaskSchedulerServiceTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/TaskSchedulerServiceTest.java deleted file mode 100644 index 5d49fe4cd0..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/TaskSchedulerServiceTest.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.opensrp.scheduler; - -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.motechproject.scheduler.MotechSchedulerService; -import org.motechproject.scheduler.domain.CronSchedulableJob; -import org.motechproject.scheduler.domain.MotechEvent; -import org.motechproject.scheduler.gateway.OutboundEventGateway; - -public class TaskSchedulerServiceTest { - - public static final String SUBJECT = "subject"; - - @Mock - MotechSchedulerService motechSchedulerService; - - @Mock - OutboundEventGateway outboundEventGateway; - - @Mock - AlertRouter alertRouter; - - @InjectMocks - TaskSchedulerService taskSchedulerService = new TaskSchedulerService(motechSchedulerService, outboundEventGateway, - alertRouter); - - @Before - public void setUp() { - initMocks(this); - } - - @Test - public void testStartJobWithRepeatingSchedule() { - Map extraData = new HashMap<>(); - extraData.put("key1", "value1"); - RepeatingSchedule repeatingSchedule = new RepeatingSchedule(SUBJECT, 5, TimeUnit.MILLISECONDS, 4, - TimeUnit.MILLISECONDS, new Date(1l), extraData); - TaskSchedulerService spyTaskSchedulingService = spy(taskSchedulerService); - when(spyTaskSchedulingService.getCurrentTime()).thenReturn(new DateTime(0l)); - - spyTaskSchedulingService.startJob(repeatingSchedule); - - MotechEvent motechEvent = new MotechEvent(SUBJECT, extraData); - verify(spyTaskSchedulingService).createRepeatingSchedulableJob(motechEvent, new DateTime(0l).plusMillis(5).toDate(), - new Date(1l), 4l); - } - - @Test - public void testStartJobWithRepeatingScheduleWithNullData() { - RepeatingSchedule repeatingSchedule = new RepeatingSchedule(SUBJECT, 5, TimeUnit.MILLISECONDS, 4, - TimeUnit.MILLISECONDS, new Date(1l), null); - TaskSchedulerService spyTaskSchedulingService = spy(taskSchedulerService); - when(spyTaskSchedulingService.getCurrentTime()).thenReturn(new DateTime(0l)); - - spyTaskSchedulingService.startJob(repeatingSchedule); - - MotechEvent motechEvent = new MotechEvent(SUBJECT, new HashMap()); - verify(spyTaskSchedulingService).createRepeatingSchedulableJob(motechEvent, new DateTime(0l).plusMillis(5).toDate(), - new Date(1l), 4l); - } - - @Test - public void testStartJobWithCornSchedule() { - Map extraData = new HashMap<>(); - extraData.put("key1", "value1"); - String cronExpression = "corn"; - RepeatingCronSchedule repeatingCronSchedule = new RepeatingCronSchedule(SUBJECT, 5, TimeUnit.MILLISECONDS, - cronExpression, new Date(1l), extraData); - TaskSchedulerService spyTaskSchedulingService = spy(taskSchedulerService); - when(spyTaskSchedulingService.getCurrentTime()).thenReturn(new DateTime(0l)); - - spyTaskSchedulingService.startJob(repeatingCronSchedule); - - MotechEvent motechEvent = new MotechEvent(SUBJECT, extraData); - CronSchedulableJob cronSchedulableJob = new CronSchedulableJob(motechEvent, cronExpression, - new DateTime(0l).plusMillis(5).toDate(), new Date(1l)); - - verify(motechSchedulerService).safeScheduleJob(cronSchedulableJob); - } - - @Test - public void testStartJobWithCornScheduleWithNullData() { - String cronExpression = "corn"; - RepeatingCronSchedule repeatingCronSchedule = new RepeatingCronSchedule(SUBJECT, 5, TimeUnit.MILLISECONDS, - cronExpression, new Date(1l), null); - TaskSchedulerService spyTaskSchedulingService = spy(taskSchedulerService); - when(spyTaskSchedulingService.getCurrentTime()).thenReturn(new DateTime(0l)); - - spyTaskSchedulingService.startJob(repeatingCronSchedule); - - MotechEvent motechEvent = new MotechEvent(SUBJECT, new HashMap()); - CronSchedulableJob cronSchedulableJob = new CronSchedulableJob(motechEvent, cronExpression, - new DateTime(0l).plusMillis(5).toDate(), new Date(1l)); - - verify(motechSchedulerService).safeScheduleJob(cronSchedulableJob); - } - - @Test - public void testNotifyEvent() { - SystemEvent systemEvent = new SystemEvent(SUBJECT, "data"); - - taskSchedulerService.notifyEvent(systemEvent); - - verify(outboundEventGateway).sendEventMessage(systemEvent.toMotechEvent()); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/router/AlertCreationActionTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/router/AlertCreationActionTest.java deleted file mode 100644 index 89de4787ea..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/router/AlertCreationActionTest.java +++ /dev/null @@ -1,128 +0,0 @@ -package org.opensrp.scheduler.router; - -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; -import static org.opensrp.util.ScheduleBuilder.enrollment; -import static org.opensrp.util.ScheduleBuilder.event; - -import java.io.IOException; - -import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.motechproject.scheduletracking.api.domain.EnrollmentStatus; -import org.motechproject.scheduletracking.api.domain.WindowName; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.service.FormSubmissionService; -import org.opensrp.scheduler.AlertCreationAction; -import org.opensrp.scheduler.HealthSchedulerService; -import org.opensrp.util.TestResourceLoader; - -public class AlertCreationActionTest extends TestResourceLoader { - - public AlertCreationActionTest() throws IOException { - super(); - } - - @Mock - private HealthSchedulerService scheduler; - - private DateTime dueWindowStart; - - private DateTime lateWindowStart; - - private DateTime maxWindowStart; - - private AlertCreationAction reminderAction; - - @Mock - private FormSubmissionService formSubmissionService; - - private FormSubmission fs; - - @Before - public void setUp() throws Exception { - initMocks(this); - reminderAction = new AlertCreationAction(scheduler, formSubmissionService); - - dueWindowStart = DateTime.now(); - lateWindowStart = DateTime.now().plusDays(10); - maxWindowStart = DateTime.now().plusDays(20); - - fs = getFormSubmissionFor("child_enrollment", 1); - when(formSubmissionService.findByInstanceId(fs.instanceId())).thenReturn(fs); - when(scheduler.getEnrollment(fs.entityId(), "PENTAVALENT 1")).thenReturn(enrollment(fs.entityId(), "PENTAVALENT 1", - "pentavalent_1", null, null, EnrollmentStatus.ACTIVE, fs.instanceId())); - } - - @Test - public void shouldRaiseUpcomingAlertActionsForDueWindowAlerts() throws Exception { - reminderAction.invoke(event(fs.entityId(), "PENTAVALENT 1", "pentavalent_1", WindowName.earliest, dueWindowStart, - lateWindowStart, maxWindowStart), null); - - verify(scheduler).alertFor(WindowName.earliest.toString(), "pkchild", fs.entityId(), "demotest", "PENTAVALENT 1", - "pentavalent_1", dueWindowStart, lateWindowStart, maxWindowStart); - } - - @Test - public void shouldRaiseNormalAlertActionsForDueWindowAlerts() throws Exception { - reminderAction.invoke(event(fs.entityId(), "PENTAVALENT 1", "pentavalent_1", WindowName.due, dueWindowStart, - lateWindowStart, maxWindowStart), null); - - verify(scheduler).alertFor(WindowName.due.toString(), "pkchild", fs.entityId(), "demotest", "PENTAVALENT 1", - "pentavalent_1", dueWindowStart, lateWindowStart, maxWindowStart); - } - - @Test - public void shouldRaiseUrgentAlertActionsForLateWindowAlerts() throws Exception { - reminderAction.invoke(event(fs.entityId(), "PENTAVALENT 1", "pentavalent_1", WindowName.late, dueWindowStart, - lateWindowStart, maxWindowStart), null); - - verify(scheduler).alertFor(WindowName.late.toString(), "pkchild", fs.entityId(), "demotest", "PENTAVALENT 1", - "pentavalent_1", dueWindowStart, lateWindowStart, maxWindowStart); - } - - @Test - public void shouldRaiseExpiredAlertActionsForMaxWindowAlerts() throws Exception { - reminderAction.invoke(event(fs.entityId(), "PENTAVALENT 1", "pentavalent_1", WindowName.max, dueWindowStart, - lateWindowStart, maxWindowStart), null); - - verify(scheduler).alertFor(WindowName.max.toString(), "pkchild", fs.entityId(), "demotest", "PENTAVALENT 1", - "pentavalent_1", dueWindowStart, lateWindowStart, maxWindowStart); - } - - @Test - public void shouldUseUnknownIfEntityIdDoesntMatch() { - String invalidId = "11"; - when(scheduler.getEnrollment(invalidId, "PENTAVALENT 1")).thenReturn( - enrollment(invalidId, "PENTAVALENT 1", "pentavalent_1", null, null, EnrollmentStatus.ACTIVE, fs.instanceId())); - - reminderAction.invoke(event(invalidId, "PENTAVALENT 1", "pentavalent_1", WindowName.earliest, dueWindowStart, - lateWindowStart, maxWindowStart), null); - - verify(scheduler).alertFor(WindowName.earliest.toString(), AlertCreationAction.UNKNOWN_ENTITY_TYPE, invalidId, - "demotest", "PENTAVALENT 1", "pentavalent_1", dueWindowStart, lateWindowStart, maxWindowStart); - } - - @Test - public void shouldUseSubFormEntityTypeIfSubFormIdGiven() throws IOException { - //Following variables mirror to the form fetched from directory - String subFormId = "ce71572a-8oc5-u32f-9d3b-4a6b568d5g77"; - String subFormBindType = "elco"; - String providerId = "opensrp"; - fs = getFormSubmissionFor("new_household_registration_with_grouped_subform_data", 1); - - when(formSubmissionService.findByInstanceId(fs.instanceId())).thenReturn(fs); - when(scheduler.getEnrollment(subFormId, "PENTAVALENT 1")).thenReturn( - enrollment(subFormId, "PENTAVALENT 1", "pentavalent_1", null, null, EnrollmentStatus.ACTIVE, fs.instanceId())); - - reminderAction.invoke(event(subFormId, "PENTAVALENT 1", "pentavalent_1", WindowName.earliest, dueWindowStart, - lateWindowStart, maxWindowStart), null); - - verify(scheduler).alertFor(WindowName.earliest.toString(), subFormBindType, subFormId, providerId, "PENTAVALENT 1", - "pentavalent_1", dueWindowStart, lateWindowStart, maxWindowStart); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/router/AlertHandlerRoutesTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/router/AlertHandlerRoutesTest.java deleted file mode 100644 index aa8a5ec782..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/router/AlertHandlerRoutesTest.java +++ /dev/null @@ -1,311 +0,0 @@ -package org.opensrp.scheduler.router; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.motechproject.scheduletracking.api.domain.WindowName.max; -import static org.motechproject.scheduletracking.api.events.constants.EventDataKeys.EXTERNAL_ID; -import static org.motechproject.scheduletracking.api.events.constants.EventDataKeys.MILESTONE_NAME; -import static org.motechproject.scheduletracking.api.events.constants.EventDataKeys.SCHEDULE_NAME; -import static org.motechproject.scheduletracking.api.events.constants.EventDataKeys.WINDOW_NAME; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.motechproject.scheduler.domain.MotechEvent; -import org.motechproject.scheduletracking.api.domain.MilestoneAlert; -import org.motechproject.scheduletracking.api.domain.WindowName; -import org.opensrp.scheduler.AlertHandler; -import org.opensrp.scheduler.AlertRouter; -import org.opensrp.scheduler.ECAlertCreationAction; -import org.opensrp.scheduler.HookedEvent; -import org.opensrp.scheduler.MilestoneEvent; -import org.opensrp.scheduler.TaskSchedulerService; - -public class AlertHandlerRoutesTest { - - public static final String SCHEDULE_LAB = "EC EVENT"; - - @Test - public void shouldRouteToProperEcHandeler() { - Event.of(SCHEDULE_LAB, "Milestone", max).shouldRouteToECAlertCreation(); - } - - /* - @Test - public void shouldSendMaxEventsOfANCNormalScheduleToForceFulfillAction() { - Event.of(SCHEDULE_ANC, "ANC 1", max).shouldRouteToForceFulfillAction(); - Event.of(SCHEDULE_ANC, "ANC 3", max).shouldRouteToForceFulfillAction(); - } - - @Test - public void shouldSendMaxEventsOfLabRemindersScheduleToForceFulfillAction() { - Event.of(SCHEDULE_LAB, "EDD", max).shouldRouteToForceFulfillAction(); - } - @Test - public void shouldSendDueRemindersOfAllMotherSchedulesToCaptureRemindersAction() throws Exception { - Event.of(SCHEDULE_ANC, "ANC 1", due).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_ANC, "ANC 1", late).shouldRouteToAlertCreationActionForMother(); - - Event.of(SCHEDULE_LAB, "Reminder", due).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_LAB, "Reminder", late).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_EDD, "Reminder", due).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_EDD, "Reminder", late).shouldRouteToAlertCreationActionForMother(); - - Event.of(SCHEDULE_IFA_1, "IFA 1", earliest).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_IFA_1, "IFA 1", due).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_IFA_1, "IFA 1", late).shouldRouteToAlertCreationActionForMother(); - - Event.of(SCHEDULE_IFA_1, "IFA 2", earliest).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_IFA_1, "IFA 2", due).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_IFA_1, "IFA 2", late).shouldRouteToAlertCreationActionForMother(); - - Event.of(SCHEDULE_IFA_1, "IFA 3", earliest).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_IFA_1, "IFA 3", due).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_IFA_1, "IFA 3", late).shouldRouteToAlertCreationActionForMother(); - - Event.of(SCHEDULE_TT_1, "TT 1", earliest).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_TT_1, "TT 1", due).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_TT_1, "TT 1", late).shouldRouteToAlertCreationActionForMother(); - - Event.of(SCHEDULE_TT_2, "TT 2", earliest).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_TT_2, "TT 2", due).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_TT_2, "TT 2", late).shouldRouteToAlertCreationActionForMother(); - - Event.of(SCHEDULE_HB_TEST_1, "Hb Test 1", earliest).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_HB_TEST_1, "Hb Test 1", due).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_HB_TEST_1, "Hb Test 1", late).shouldRouteToAlertCreationActionForMother(); - - Event.of(SCHEDULE_HB_TEST_2, "Hb Test 2", earliest).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_HB_TEST_2, "Hb Test 2", due).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_HB_TEST_2, "Hb Test 2", late).shouldRouteToAlertCreationActionForMother(); - - Event.of(SCHEDULE_HB_FOLLOWUP_TEST, "Hb Followup Test", earliest).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_HB_FOLLOWUP_TEST, "Hb Followup Test", due).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_HB_FOLLOWUP_TEST, "Hb Followup Test", late).shouldRouteToAlertCreationActionForMother(); - - Event.of(SCHEDULE_DELIVERY_PLAN, "Delivery Plan", earliest).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_DELIVERY_PLAN, "Delivery Plan", due).shouldRouteToAlertCreationActionForMother(); - Event.of(SCHEDULE_DELIVERY_PLAN, "Delivery Plan", late).shouldRouteToAlertCreationActionForMother(); - } - */ - /* @Test - public void shouldSendReminderForAllChildSchedulesToCaptureRemindersAction() throws Exception { - Event.of(CHILD_SCHEDULE_BCG, "BCG", earliest).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_BCG, "BCG", due).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_BCG, "BCG", late).shouldRouteToAlertCreationActionForChild(); - - Event.of(CHILD_SCHEDULE_MEASLES, "Measles", earliest).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_MEASLES, "Measles", due).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_MEASLES, "Measles", late).shouldRouteToAlertCreationActionForChild(); - - Event.of(CHILD_SCHEDULE_MEASLES_BOOSTER, "Measles Booster", earliest).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_MEASLES_BOOSTER, "Measles Booster", due).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_MEASLES_BOOSTER, "Measles Booster", late).shouldRouteToAlertCreationActionForChild(); - - Event.of(CHILD_SCHEDULE_DPT_BOOSTER1, "dptbooster_1", earliest).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_DPT_BOOSTER1, "dptbooster_1", due).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_DPT_BOOSTER1, "dptbooster_1", late).shouldRouteToAlertCreationActionForChild(); - - Event.of(CHILD_SCHEDULE_DPT_BOOSTER2, "dptbooster_2", earliest).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_DPT_BOOSTER2, "dptbooster_2", due).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_DPT_BOOSTER2, "dptbooster_2", late).shouldRouteToAlertCreationActionForChild(); - - Event.of(CHILD_SCHEDULE_OPV_0_AND_1, "opv_0", earliest).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_OPV_0_AND_1, "opv_0", due).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_OPV_0_AND_1, "opv_0", late).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_OPV_0_AND_1, "opv_0", max).shouldRouteToAlertCreationActionForChild(); - - Event.of(CHILD_SCHEDULE_OPV_0_AND_1, "opv_1", earliest).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_OPV_0_AND_1, "opv_1", due).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_OPV_0_AND_1, "opv_1", late).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_OPV_0_AND_1, "opv_1", max).shouldRouteToAlertCreationActionForChild(); - - Event.of(CHILD_SCHEDULE_OPV_2, "opv_2", earliest).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_OPV_2, "opv_2", due).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_OPV_2, "opv_2", late).shouldRouteToAlertCreationActionForChild(); - - Event.of(CHILD_SCHEDULE_OPV_3, "opv_3", earliest).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_OPV_3, "opv_3", due).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_OPV_3, "opv_3", late).shouldRouteToAlertCreationActionForChild(); - - Event.of(CHILD_SCHEDULE_OPV_BOOSTER, "opvbooster", earliest).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_OPV_BOOSTER, "opvbooster", due).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_OPV_BOOSTER, "opvbooster", late).shouldRouteToAlertCreationActionForChild(); - - Event.of(CHILD_SCHEDULE_PENTAVALENT_1, "pentavalent_1", earliest).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_PENTAVALENT_1, "pentavalent_1", due).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_PENTAVALENT_1, "pentavalent_1", late).shouldRouteToAlertCreationActionForChild(); - - Event.of(CHILD_SCHEDULE_PENTAVALENT_2, "pentavalent_2", earliest).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_PENTAVALENT_2, "pentavalent_2", due).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_PENTAVALENT_2, "pentavalent_2", late).shouldRouteToAlertCreationActionForChild(); - - Event.of(CHILD_SCHEDULE_PENTAVALENT_3, "pentavalent_3", earliest).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_PENTAVALENT_3, "pentavalent_3", due).shouldRouteToAlertCreationActionForChild(); - Event.of(CHILD_SCHEDULE_PENTAVALENT_3, "pentavalent_3", late).shouldRouteToAlertCreationActionForChild(); - } - - @Test - public void shouldSendDueRemindersOfAllEcsToCaptureRemindersAction() throws Exception { - Event.of(EC_SCHEDULE_DMPA_INJECTABLE_REFILL, "DMPA Injectable Refill", earliest).shouldRouteToAlertCreationActionForEC(); - Event.of(EC_SCHEDULE_DMPA_INJECTABLE_REFILL, "DMPA Injectable Refill", due).shouldRouteToAlertCreationActionForEC(); - Event.of(EC_SCHEDULE_DMPA_INJECTABLE_REFILL, "DMPA Injectable Refill", late).shouldRouteToAlertCreationActionForEC(); - - Event.of(EC_SCHEDULE_OCP_REFILL, "OCP Refill", earliest).shouldRouteToAlertCreationActionForEC(); - Event.of(EC_SCHEDULE_OCP_REFILL, "OCP Refill", due).shouldRouteToAlertCreationActionForEC(); - Event.of(EC_SCHEDULE_OCP_REFILL, "OCP Refill", late).shouldRouteToAlertCreationActionForEC(); - - Event.of(EC_SCHEDULE_CONDOM_REFILL, "Condom Refill", earliest).shouldRouteToAlertCreationActionForEC(); - Event.of(EC_SCHEDULE_CONDOM_REFILL, "Condom Refill", due).shouldRouteToAlertCreationActionForEC(); - Event.of(EC_SCHEDULE_CONDOM_REFILL, "Condom Refill", late).shouldRouteToAlertCreationActionForEC(); - - Event.of(EC_SCHEDULE_FEMALE_STERILIZATION_FOLLOWUP, "Female sterilization followup", earliest).shouldRouteToAlertCreationActionForEC(); - Event.of(EC_SCHEDULE_FEMALE_STERILIZATION_FOLLOWUP, "Female sterilization followup", due).shouldRouteToAlertCreationActionForEC(); - Event.of(EC_SCHEDULE_FEMALE_STERILIZATION_FOLLOWUP, "Female sterilization followup", late).shouldRouteToAlertCreationActionForEC(); - - Event.of(EC_SCHEDULE_MALE_STERILIZATION_FOLLOWUP, "Male sterilization followup", earliest).shouldRouteToAlertCreationActionForEC(); - Event.of(EC_SCHEDULE_MALE_STERILIZATION_FOLLOWUP, "Male sterilization followup", due).shouldRouteToAlertCreationActionForEC(); - Event.of(EC_SCHEDULE_MALE_STERILIZATION_FOLLOWUP, "Male sterilization followup", late).shouldRouteToAlertCreationActionForEC(); - - Event.of(EC_SCHEDULE_IUD_FOLLOWUP, "IUD followup", earliest).shouldRouteToAlertCreationActionForEC(); - Event.of(EC_SCHEDULE_IUD_FOLLOWUP, "IUD followup", due).shouldRouteToAlertCreationActionForEC(); - Event.of(EC_SCHEDULE_IUD_FOLLOWUP, "IUD followup", late).shouldRouteToAlertCreationActionForEC(); - - Event.of(EC_SCHEDULE_FP_FOLLOWUP, "FP Referral Followup", earliest).shouldRouteToAlertCreationActionForEC(); - Event.of(EC_SCHEDULE_FP_FOLLOWUP, "FP Referral Followup", due).shouldRouteToAlertCreationActionForEC(); - Event.of(EC_SCHEDULE_FP_FOLLOWUP, "FP Referral Followup", late).shouldRouteToAlertCreationActionForEC(); - } - - @Test - public void shouldSendDueRemindersOfPNCCloseToAutoClosePNCAction() throws Exception { - Event.of(SCHEDULE_AUTO_CLOSE_PNC, "PNC Close", due).shouldRouteToAutoClosePNCAction(); - }*/ - - public static class Event { - - private final String schedule; - - private final String milestone; - - private final WindowName window; - - private String externalId; - - private Event(String schedule, String milestone, WindowName window) { - this.schedule = schedule; - this.milestone = milestone; - this.window = window; - } - - public static Event of(String schedule, String milestone, WindowName window) { - return new Event(schedule, milestone, window); - } - - public static Event of(String externalId, String schedule, String milestone, WindowName window) { - Event event = new Event(schedule, milestone, window); - event.externalId = externalId; - return event; - } - - public void shouldRouteToECAlertCreation() { - expectCallsToECAlertCreation(Expectation.of(1)); - } - - public void expectCallsToECAlertCreation(Expectation fulfillActionCallsExpected) { - ECAlertCreationAction ecAlertCreationAction = mock(ECAlertCreationAction.class); - - MotechEvent event = routeEvent(ecAlertCreationAction, null, null); - - verify(ecAlertCreationAction, times(fulfillActionCallsExpected.numberOfCallsExpected)) - .invoke(new MilestoneEvent(event), fulfillActionCallsExpected.extraDataExpected); - } - - /* - public void shouldRouteToForceFulfillAction() { - expectCalls(Expectation.of(1), Expectation.of(0), Expectation.of(0)); - } - - public void shouldRouteToAlertCreationActionForMother() { - Map extraData = new HashMap<>(); - extraData.put("beneficiaryType", "mother"); - expectCalls(Expectation.of(0), Expectation.of(1, extraData), Expectation.of(0)); - } - - public void shouldRouteToAlertCreationActionForChild() { - Map extraData = new HashMap<>(); - extraData.put("beneficiaryType", "child"); - expectCalls(Expectation.of(0), Expectation.of(1, extraData), Expectation.of(0)); - } - - public void shouldRouteToAlertCreationActionForEC() { - Map extraData = new HashMap<>(); - extraData.put("beneficiaryType", "ec"); - expectCalls(Expectation.of(0), Expectation.of(1, extraData), Expectation.of(0)); - } - - public void shouldRouteToAutoClosePNCAction() { - expectCalls(Expectation.of(0), Expectation.of(0), Expectation.of(1)); - } - - private void expectCalls(Expectation fulfillActionCallsExpected, Expectation captureReminderActionCallsExpected, Expectation autoClosePNCActionCallsExpected) { - HookedEvent forceFulfillAction = mock(ECAlertCreationAction.class); - HookedEvent captureANCReminderAction = mock(HookedEvent.class); - HookedEvent autoClosePNCAction = mock(HookedEvent.class); - - MotechEvent event = routeEvent(forceFulfillAction, captureANCReminderAction, autoClosePNCAction); - - verify(forceFulfillAction, times(fulfillActionCallsExpected.numberOfCallsExpected)).invoke(new MilestoneEvent(event), fulfillActionCallsExpected.extraDataExpected); - verify(captureANCReminderAction, times(captureReminderActionCallsExpected.numberOfCallsExpected)).invoke(new MilestoneEvent(event), captureReminderActionCallsExpected.extraDataExpected); - verify(autoClosePNCAction, times(autoClosePNCActionCallsExpected.numberOfCallsExpected)).invoke(new MilestoneEvent(event), autoClosePNCActionCallsExpected.extraDataExpected); - }*/ - - public MotechEvent routeEvent(HookedEvent ancMissedAction, HookedEvent captureANCReminderAction, - HookedEvent autoClosePNCAction) { - AlertRouter router = new AlertRouter(); - TaskSchedulerService sf = new TaskSchedulerService(null, null, router); - new AlertHandler(sf, ancMissedAction); - MotechEvent event = createMotechEvent(); - - router.handleAlerts(event); - - return event; - } - - public MotechEvent createMotechEvent() { - MilestoneAlert alert = mock(MilestoneAlert.class); - when(alert.getMilestoneName()).thenReturn(milestone); - - Map parameters = new HashMap<>(); - - parameters.put(EXTERNAL_ID, externalId); - parameters.put(SCHEDULE_NAME, schedule); - parameters.put(MILESTONE_NAME, alert); - parameters.put(WINDOW_NAME, window.toString()); - - return new MotechEvent("Subject", parameters); - } - - public static class Expectation { - - private final int numberOfCallsExpected; - - private final Map extraDataExpected; - - public static Expectation of(int numberOfCallsExpected) { - return new Expectation(numberOfCallsExpected, new HashMap()); - } - - public static Expectation of(int numberOfCallsExpected, Map extraDataExpected) { - return new Expectation(numberOfCallsExpected, extraDataExpected); - } - - public Expectation(int numberOfCallsExpected, Map extraDataExpected) { - this.numberOfCallsExpected = numberOfCallsExpected; - this.extraDataExpected = extraDataExpected; - } - } - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/router/AlertRouterTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/router/AlertRouterTest.java deleted file mode 100644 index b597438ffa..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/router/AlertRouterTest.java +++ /dev/null @@ -1,230 +0,0 @@ -package org.opensrp.scheduler.router; - -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; -import static org.motechproject.scheduletracking.api.events.constants.EventDataKeys.ENROLLMENT_ID; -import static org.motechproject.scheduletracking.api.events.constants.EventDataKeys.EXTERNAL_ID; -import static org.opensrp.scheduler.Matcher.any; -import static org.opensrp.scheduler.Matcher.eq; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.motechproject.scheduler.domain.MotechEvent; -import org.motechproject.scheduletracking.api.domain.Enrollment; -import org.motechproject.scheduletracking.api.domain.MilestoneAlert; -import org.motechproject.scheduletracking.api.domain.WindowName; -import org.motechproject.scheduletracking.api.events.constants.EventDataKeys; -import org.opensrp.domain.Event; -import org.opensrp.dto.ActionData; -import org.opensrp.dto.AlertStatus; -import org.opensrp.scheduler.Action; -import org.opensrp.scheduler.AlertRouter; -import org.opensrp.scheduler.HealthSchedulerService; -import org.opensrp.scheduler.HookedEvent; -import org.opensrp.scheduler.MilestoneEvent; -import org.opensrp.scheduler.NoRoutesMatchException; -import org.opensrp.scheduler.service.ActionService; -import org.opensrp.scheduler.service.ScheduleService; -import org.opensrp.service.EventService; - -public class AlertRouterTest { - - public static final String SAMPLE_ID = "11"; - - public static final String SCHEDULE_NAME = "scheduleName"; - - public static final String MILESTONE_NAME = "milestoneName"; - - public static final String WINDOW_NAME = "windowName"; - - @Mock - private HookedEvent firstAction; - - @Mock - private HookedEvent secondAction; - - @Mock - private HookedEvent thirdAction; - - @Mock - private ScheduleService scheduleService; - - @Mock - private EventService eventService; - - @Mock - private ActionService actionService; - - @InjectMocks - private AlertRouter router = new AlertRouter(); - - @Before - public void setUp() throws Exception { - initMocks(this); - } - - @Test - public void shouldBeAbleToSetACatchAllRoute() { - router.addRoute(any(), any(), any(), firstAction); - - assertRouteMatches("someSchedule", "someMilestone", "someWindow", firstAction, new HashMap()); - assertRouteMatches("someOtherSchedule", "someOtherMilestone", "someOtherWindow", firstAction, - new HashMap()); - } - - @Test - public void shouldBeAbleToSetARouteWhichMatchesBasedOnScheduleNameOnly() { - router.addRoute(eq("Schedule X"), any(), any(), firstAction); - - assertNoRoutesMatch("someSchedule", "someMilestone", "someWindow"); - assertRouteMatches("Schedule X", "someMilestone", "someWindow", firstAction, new HashMap()); - } - - @Test - public void shouldBeAbleToSetARouteWhichMatchesBasedOnMilestoneNameOnly() { - router.addRoute(any(), eq("Milestone X"), any(), firstAction); - - assertNoRoutesMatch("someSchedule", "someMilestone", "someWindow"); - assertRouteMatches("someOtherSchedule", "Milestone X", "someWindow", firstAction, new HashMap()); - } - - @Test - public void shouldBeAbleToSetARouteWhichMatchesBasedOnWindowNameOnly() { - router.addRoute(any(), any(), eq("Window X"), firstAction); - - assertNoRoutesMatch("someSchedule", "someMilestone", "someWindow"); - assertRouteMatches("someOtherSchedule", "someOtherMilestone", "Window X", firstAction, - new HashMap()); - } - - @Test - public void shouldBeAbleToSetARouteWhichMatchesBasedOnACombinationOfMatchers() { - router.addRoute(eq("Milestone X"), any(), eq("Window X"), firstAction); - - assertNoRoutesMatch("someSchedule", "someMilestone", "someWindow"); - assertNoRoutesMatch("Milestone X", "someMilestone", "someWindow"); - assertNoRoutesMatch("someSchedule", "someMilestone", "Window X"); - assertRouteMatches("Milestone X", "someOtherMilestone", "Window X", firstAction, new HashMap()); - } - - @Test - public void shouldBeAbleToSetARouteWithExtraData() { - router.addRoute(eq("Milestone X"), any(), eq("Window X"), firstAction).addExtraData("Unicorns", "AreFun"); - - assertNoRoutesMatch("someSchedule", "someMilestone", "someWindow"); - assertNoRoutesMatch("Milestone X", "someMilestone", "someWindow"); - assertNoRoutesMatch("someSchedule", "someMilestone", "Window X"); - - HashMap extraData = new HashMap<>(); - extraData.put("Unicorns", "AreFun"); - assertRouteMatches("Milestone X", "someOtherMilestone", "Window X", firstAction, extraData); - } - - @Test - public void shouldInvokeTheActionOfOnlyTheFirstRouteWhichMatchesInTheOrderInWhichTheyWereAdded() { - router.addRoute(any(), any(), eq("Window X"), firstAction); - router.addRoute(any(), any(), any(), secondAction); - - assertRouteMatches("someSchedule", "someMilestone", "Window X", firstAction, new HashMap()); - verifyZeroInteractions(secondAction); - - assertRouteMatches("someSchedule", "someMilestone", "someOtherWindow", secondAction, new HashMap()); - verifyZeroInteractions(firstAction); - } - - @Test - public void shouldNotTryAndLookAtTheBestMatchButJustTheFirstProperMatch() { - router.addRoute(any(), any(), eq("Window X"), firstAction); - router.addRoute(eq("Milestone X"), any(), eq("Window X"), secondAction); - - assertRouteMatches("Milestone X", "someMilestone", "Window X", firstAction, new HashMap()); - verifyZeroInteractions(secondAction); - } - - @Test(expected = NoRoutesMatchException.class) - public void shouldFailIfNoRoutesMatch() { - router.handleAlerts(event("scheduleName", "milestoneName", "windowName")); - } - - @Test - public void shouldManuallyCallActionServiceIfExceptionHappen() throws IOException { - String entityType = "eT"; - String providerId = "PI"; - String enrollmentId = SAMPLE_ID; - String eventId = SAMPLE_ID; - DateTime sampleDate = new DateTime(0l); - - Map metaData = new HashMap<>(); - metaData.put(HealthSchedulerService.MetadataField.enrollmentEvent.name(), SAMPLE_ID); - - Event event = new Event(); - event.setEntityType(entityType); - event.setProviderId(providerId); - - Enrollment enrollment = mock(Enrollment.class); - - when(scheduleService.getEnrollment(enrollmentId)).thenReturn(enrollment); - when(enrollment.getMetadata()).thenReturn(metaData); - when(enrollment.getScheduleName()).thenReturn(SCHEDULE_NAME); - when(enrollment.getCurrentMilestoneName()).thenReturn(MILESTONE_NAME); - when(enrollment.getCurrentMilestoneStartDate()).thenReturn(sampleDate); - when(enrollment.getStartOfWindowForCurrentMilestone(WindowName.max)).thenReturn(sampleDate); - when(eventService.getById(eventId)).thenReturn(event); - - ActionData actionData = ActionData.createAlert(entityType, SCHEDULE_NAME, MILESTONE_NAME, AlertStatus.defaulted, - sampleDate, sampleDate); - Action action = new Action(SAMPLE_ID, providerId, actionData); - - router.addRoute(null); - router.handleAlerts(event(SCHEDULE_NAME, MILESTONE_NAME, WINDOW_NAME)); - - verify(actionService).alertForBeneficiary(action); - - } - - private void assertRouteMatches(String schedule, String milestone, String window, HookedEvent action, - HashMap extraData) { - MotechEvent event = handleEvent(schedule, milestone, window); - verify(action, times(1)).invoke(new MilestoneEvent(event), extraData); - } - - private void assertNoRoutesMatch(String schedule, String milestone, String window) { - try { - handleEvent(schedule, milestone, window); - fail("Expected no routes to match! It matched a route."); - } - catch (NoRoutesMatchException e) {} - } - - private MotechEvent handleEvent(String schedule, String milestone, String window) { - MotechEvent event = event(schedule, milestone, window); - router.handleAlerts(event); - return event; - } - - private MotechEvent event(String scheduleName, String milestoneName, String windowName) { - MilestoneAlert alert = mock(MilestoneAlert.class); - when(alert.getMilestoneName()).thenReturn(milestoneName); - - Map parameters = new HashMap(); - parameters.put(EventDataKeys.SCHEDULE_NAME, scheduleName); - parameters.put(EventDataKeys.MILESTONE_NAME, alert); - parameters.put(EventDataKeys.WINDOW_NAME, windowName); - parameters.put(EXTERNAL_ID, SAMPLE_ID); - parameters.put(ENROLLMENT_ID, SAMPLE_ID); - - return new MotechEvent("Subject", parameters); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/router/HealthSchedulesTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/router/HealthSchedulesTest.java deleted file mode 100644 index c602b92934..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/router/HealthSchedulesTest.java +++ /dev/null @@ -1,253 +0,0 @@ -package org.opensrp.scheduler.router; - -import static java.util.Arrays.asList; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasItem; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; -import static org.motechproject.scheduletracking.api.domain.WindowName.due; -import static org.motechproject.scheduletracking.api.domain.WindowName.earliest; -import static org.motechproject.scheduletracking.api.domain.WindowName.late; -import static org.motechproject.scheduletracking.api.domain.WindowName.max; -import static org.opensrp.dto.AlertStatus.expired; -import static org.opensrp.dto.AlertStatus.normal; -import static org.opensrp.dto.AlertStatus.upcoming; -import static org.opensrp.dto.AlertStatus.urgent; - -import java.io.IOException; -import java.util.List; - -import org.hamcrest.Matchers; -import org.joda.time.DateTime; -import org.json.JSONException; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.motechproject.scheduletracking.api.domain.Enrollment; -import org.opensrp.dto.BeneficiaryType; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.scheduler.HealthSchedulerService; -import org.opensrp.scheduler.Schedule; -import org.opensrp.scheduler.Schedule.ActionType; -import org.opensrp.scheduler.ScheduleConfig; -import org.opensrp.scheduler.service.ActionService; -import org.opensrp.scheduler.service.ScheduleService; -import org.opensrp.util.TestResourceLoader; - -import com.google.gson.JsonIOException; - -public class HealthSchedulesTest extends TestResourceLoader { - - public static final String BENIFICIARY_TYPE = "benificiaryType"; - - public static final String ENTITY_ID = "entityId"; - - public static final String PROVIDER_ID = "providerId"; - - public static final String SCHEDULE_NAME = "schedule"; - - public static final String MILESTONE = "milestone"; - - public static final String REASONFOR_CLOSE = "reasonforClose"; - - public static final String FORM_SUBMISSION_ID = "formSubmissionId"; - - DateTime startOfDueWindow = new DateTime(0l); - - DateTime startOfLateWindow = new DateTime(1l); - - DateTime startOfMaxWindow = new DateTime(2l); - - public HealthSchedulesTest() throws IOException { - super(); - } - - private HealthSchedulerService sch; - - private ScheduleConfig scheduleConfig; - - @Mock - private ScheduleService schService; - - @Mock - private ActionService actionService; - - @Before - public void setUp() throws IOException, JSONException { - initMocks(this); - - scheduleConfig = new ScheduleConfig("/schedules/schedule-config.xls"); - sch = new HealthSchedulerService(actionService, schService, scheduleConfig); - } - - @SuppressWarnings("unchecked") - @Test - public void testFindAutomatedSchedules() throws JsonIOException, IOException { - FormSubmission fs = getFormSubmissionFor("child_enrollment", 3); - List s = sch.findAutomatedSchedules(fs.formName()); - assertThat(s, - hasItem(Matchers. allOf(Matchers. hasProperty("schedule", equalTo("PENTAVALENT 1")), - Matchers. hasProperty("milestone", equalTo("penta1")), - Matchers. hasProperty("action", equalTo(ActionType.enroll)), - Matchers. hasProperty("entityType", equalTo("pkchild")), - Matchers. hasProperty("triggerDateFields", hasItem("dob"))))); - } - - @Test - public void testProperAlertRouting() { - - sch.alertFor(late.name(), BENIFICIARY_TYPE, ENTITY_ID, PROVIDER_ID, SCHEDULE_NAME, MILESTONE, startOfDueWindow, - startOfLateWindow, startOfMaxWindow); - verify(actionService).alertForBeneficiary(BENIFICIARY_TYPE, ENTITY_ID, PROVIDER_ID, SCHEDULE_NAME, MILESTONE, urgent, - startOfLateWindow, startOfMaxWindow); - - sch.alertFor(earliest.name(), BENIFICIARY_TYPE, ENTITY_ID, PROVIDER_ID, SCHEDULE_NAME, MILESTONE, startOfDueWindow, - startOfLateWindow, startOfMaxWindow); - verify(actionService).alertForBeneficiary(BENIFICIARY_TYPE, ENTITY_ID, PROVIDER_ID, SCHEDULE_NAME, MILESTONE, - upcoming, startOfDueWindow, startOfLateWindow); - - sch.alertFor(due.name(), BENIFICIARY_TYPE, ENTITY_ID, PROVIDER_ID, SCHEDULE_NAME, MILESTONE, startOfDueWindow, - startOfLateWindow, startOfMaxWindow); - verify(actionService).alertForBeneficiary(BENIFICIARY_TYPE, ENTITY_ID, PROVIDER_ID, SCHEDULE_NAME, MILESTONE, normal, - startOfDueWindow, startOfLateWindow); - - sch.alertFor(max.name(), BENIFICIARY_TYPE, ENTITY_ID, PROVIDER_ID, SCHEDULE_NAME, MILESTONE, startOfDueWindow, - startOfLateWindow, startOfMaxWindow); - verify(actionService).alertForBeneficiary(BENIFICIARY_TYPE, ENTITY_ID, PROVIDER_ID, SCHEDULE_NAME, MILESTONE, - expired, startOfMaxWindow, startOfMaxWindow); - } - - @Test - public void testAlertRoutingWithAlertStatus() { - sch.alertFor(BENIFICIARY_TYPE, ENTITY_ID, PROVIDER_ID, SCHEDULE_NAME, MILESTONE, upcoming, startOfDueWindow, - startOfLateWindow, startOfMaxWindow); - verify(actionService).alertForBeneficiary(BENIFICIARY_TYPE, ENTITY_ID, PROVIDER_ID, SCHEDULE_NAME, MILESTONE, - upcoming, startOfLateWindow, startOfMaxWindow); - } - - @Test - public void testGettingEnrollmentRecord() { - sch.getEnrollmentRecord(ENTITY_ID, SCHEDULE_NAME); - verify(schService).getEnrollmentRecord(ENTITY_ID, SCHEDULE_NAME); - } - - @Test - public void testGettingEnrollment() { - sch.getEnrollment(ENTITY_ID, SCHEDULE_NAME); - verify(schService).getEnrollment(ENTITY_ID, SCHEDULE_NAME); - } - - @Test - public void testActiveEnrollment() { - sch.getActiveEnrollment(ENTITY_ID, SCHEDULE_NAME); - verify(schService).getActiveEnrollment(ENTITY_ID, SCHEDULE_NAME); - } - - @Test - public void testIsNotEnrolled() { - Enrollment enrollment = mock(Enrollment.class); - when(schService.getEnrollment(ENTITY_ID, SCHEDULE_NAME)).thenReturn(enrollment); - boolean actual = sch.isNotEnrolled(ENTITY_ID, SCHEDULE_NAME); - assertFalse(actual); - - when(schService.getEnrollment(ENTITY_ID, SCHEDULE_NAME)).thenReturn(null); - actual = sch.isNotEnrolled(ENTITY_ID, SCHEDULE_NAME); - assertTrue(actual); - - } - - @Test - public void testFindActiveSchedules() { - sch.findActiveSchedules(ENTITY_ID); - verify(schService).findOpenEnrollmentNames(ENTITY_ID); - } - - @Test - public void testFindActiveEnrollments() { - sch.findActiveEnrollments(ENTITY_ID); - verify(schService).findOpenEnrollments(ENTITY_ID); - } - - @Test - public void testCloseBeneficiary() { - sch.closeBeneficiary(BeneficiaryType.mother, ENTITY_ID, PROVIDER_ID, REASONFOR_CLOSE); - verify(actionService).closeBeneficiary(BeneficiaryType.mother, ENTITY_ID, PROVIDER_ID, REASONFOR_CLOSE); - } - - @Test - public void testUnEnrollFromAllSchedules() { - List activeSchedules = asList("1", "2"); - when(schService.findOpenEnrollmentNames(ENTITY_ID)).thenReturn(activeSchedules); - sch.unEnrollFromAllSchedules(ENTITY_ID, FORM_SUBMISSION_ID); - - verify(schService).unenroll(ENTITY_ID, activeSchedules, FORM_SUBMISSION_ID); - verify(actionService).markAllAlertsAsInactive(ENTITY_ID); - } - - @Test - public void testUnEnrollAndCloeSchedule() { - sch.unEnrollAndCloseSchedule(ENTITY_ID, PROVIDER_ID, SCHEDULE_NAME, startOfDueWindow.toLocalDate(), - FORM_SUBMISSION_ID); - verify(schService).unenroll(ENTITY_ID, SCHEDULE_NAME, FORM_SUBMISSION_ID); - verify(actionService).markAlertAsClosed(PROVIDER_ID, ENTITY_ID, SCHEDULE_NAME, - startOfDueWindow.toLocalDate().toString()); - } - - @Test - public void testUnEnrollFroSchedule() { - sch.unEnrollFromSchedule(ENTITY_ID, PROVIDER_ID, SCHEDULE_NAME, FORM_SUBMISSION_ID); - verify(schService).unenroll(ENTITY_ID, SCHEDULE_NAME, FORM_SUBMISSION_ID); - verify(actionService).markAlertAsInactive(PROVIDER_ID, ENTITY_ID, SCHEDULE_NAME); - } - - @Test - public void testForceFullfillMilestonesAndCloseAlert() { - sch.forceFullfillMilestonesAndCloseAlert(ENTITY_ID, SCHEDULE_NAME, startOfDueWindow.toLocalDate()); - verify(schService).fulfillMilestone(ENTITY_ID, SCHEDULE_NAME, startOfDueWindow.toLocalDate(), ""); - verify(actionService).markAlertAsClosed(ENTITY_ID, SCHEDULE_NAME, startOfDueWindow.toLocalDate().toString()); - } - - @Test - public void testFullFillMilestoneAndCloseAlert() { - sch.fullfillMilestoneAndCloseAlert(ENTITY_ID, PROVIDER_ID, SCHEDULE_NAME, startOfDueWindow.toLocalDate(), - FORM_SUBMISSION_ID); - verify(schService).fulfillMilestone(ENTITY_ID, SCHEDULE_NAME, startOfDueWindow.toLocalDate(), FORM_SUBMISSION_ID); - verify(actionService).markAlertAsClosed(ENTITY_ID, PROVIDER_ID, SCHEDULE_NAME, - startOfDueWindow.toLocalDate().toString()); - } - - @Test - public void testFullFillMilestoneAndCloseAlertWithMilestone() { - sch.fullfillMilestoneAndCloseAlert(ENTITY_ID, PROVIDER_ID, SCHEDULE_NAME, MILESTONE, startOfDueWindow.toLocalDate(), - FORM_SUBMISSION_ID); - verify(schService).fulfillMilestone(ENTITY_ID, SCHEDULE_NAME, startOfDueWindow.toLocalDate(), FORM_SUBMISSION_ID); - verify(actionService).markAlertAsClosed(ENTITY_ID, PROVIDER_ID, MILESTONE, - startOfDueWindow.toLocalDate().toString()); - } - - @Test - public void testEnrollmentIntoSchedule() { - sch.enrollIntoSchedule(ENTITY_ID, SCHEDULE_NAME, MILESTONE, "", FORM_SUBMISSION_ID); - verify(schService).enroll(ENTITY_ID, SCHEDULE_NAME, MILESTONE, "", FORM_SUBMISSION_ID); - - testEnrollmentWithOutMilestone(); - } - - @Test - public void testEnrollmentWithOutMilestone() { - sch.enrollIntoSchedule(ENTITY_ID, SCHEDULE_NAME, "", FORM_SUBMISSION_ID); - verify(schService).enroll(ENTITY_ID, SCHEDULE_NAME, "", FORM_SUBMISSION_ID); - } - - @Test - public void testEnrollmentWithOutMilestoneAndLocalDate() { - sch.enrollIntoSchedule(ENTITY_ID, SCHEDULE_NAME, startOfLateWindow.toLocalDate(), FORM_SUBMISSION_ID); - verify(schService).enroll(ENTITY_ID, SCHEDULE_NAME, startOfLateWindow.toLocalDate().toString(), FORM_SUBMISSION_ID); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/router/MatcherTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/router/MatcherTest.java deleted file mode 100644 index e23b4eaf3e..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/router/MatcherTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.opensrp.scheduler.router; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.opensrp.scheduler.Matcher; - -public class MatcherTest { - - @Test - public void shouldMatchUsingStringEquality() { - Matcher matcher = Matcher.eq("abc"); - - assertTrue(matcher.matches("abc")); - assertFalse(matcher.matches("abcd")); - assertFalse(matcher.matches("ab")); - assertFalse(matcher.matches("dabcd")); - assertFalse(matcher.matches("dabc")); - assertFalse(matcher.matches("dddd")); - assertFalse(matcher.matches(null)); - } - - @Test - public void shouldMatchAnyValues() { - Matcher matcher = Matcher.any(); - - assertTrue(matcher.matches("abcd")); - assertTrue(matcher.matches("defg")); - assertTrue(matcher.matches("xyza")); - assertTrue(matcher.matches("zzzz")); - } - - @Test - public void shouldMatchAGivenSetOfValues() { - Matcher matcher = Matcher.anyOf("abc", "def"); - - assertTrue(matcher.matches("abc")); - assertTrue(matcher.matches("def")); - assertFalse(matcher.matches("abcdef")); - assertFalse(matcher.matches("xyz")); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/service/ActionServiceTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/service/ActionServiceTest.java deleted file mode 100644 index 4f5c4057f5..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/service/ActionServiceTest.java +++ /dev/null @@ -1,224 +0,0 @@ -package org.opensrp.scheduler.service; - -import static java.util.Arrays.asList; -import static junit.framework.Assert.assertEquals; -import static org.mockito.Mockito.verify; -import static org.mockito.MockitoAnnotations.initMocks; -import static org.opensrp.dto.AlertStatus.normal; -import static org.opensrp.scheduler.service.ActionService.ALL_PROVIDERS; -import static org.powermock.api.mockito.PowerMockito.mock; -import static org.powermock.api.mockito.PowerMockito.when; - -import java.util.Arrays; -import java.util.List; - -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.opensrp.dto.ActionData; -import org.opensrp.dto.AlertStatus; -import org.opensrp.dto.BeneficiaryType; -import org.opensrp.dto.MonthSummaryDatum; -import org.opensrp.scheduler.Action; -import org.opensrp.scheduler.Alert; -import org.opensrp.scheduler.repository.couch.AllActions; -import org.opensrp.scheduler.repository.couch.AllAlerts; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import com.google.gson.Gson; - -@RunWith(PowerMockRunner.class) -@PrepareForTest({ DateTime.class, org.motechproject.util.DateUtil.class }) -public class ActionServiceTest { - - public static final String ANM_1 = "ANM 1"; - - public static final String CASE_X = "Case X"; - - public static final String REASON_FOR_CLOSE = "reason for close"; - - public static final DateTime DATE_TIME = new DateTime(0l); - - public static final String SCHDEDULE = "schdedule"; - - @Mock - private AllActions allActions; - - @Mock - private AllAlerts allAlerts; - - private ActionService service; - - @Before - public void setUp() throws Exception { - initMocks(this); - allActions.removeAll(); - allAlerts.removeAll(); - service = new ActionService(allActions, allAlerts); - } - - @Test - public void shouldSaveAlertActionForEntity() throws Exception { - DateTime dueDate = DateTime.now().minusDays(1); - DateTime expiryDate = dueDate.plusWeeks(2); - - service.alertForBeneficiary("mother", "Case X", "ANM ID M", "Ante Natal Care - Normal", "ANC 1", normal, dueDate, - expiryDate); - Action action = new Action("Case X", "ANM ID M", - ActionData.createAlert("mother", "Ante Natal Care - Normal", "ANC 1", normal, dueDate, expiryDate)); - - verify(allActions).addOrUpdateAlert(action); - verify(allAlerts).addOrUpdateScheduleNotificationAlert("mother", "Case X", "ANM ID M", "Ante Natal Care - Normal", - "ANC 1", normal, dueDate, expiryDate); - } - - @Test - public void shouldSaveAlertActionForEntityWithActionObject() throws Exception { - DateTime dueDate = DateTime.now().minusDays(1); - DateTime expiryDate = dueDate.plusWeeks(2); - - Action action = new Action("Case X", "ANM ID M", - ActionData.createAlert("mother", "Ante Natal Care - Normal", "ANC 1", normal, dueDate, expiryDate)); - - service.alertForBeneficiary(action); - - verify(allActions).addOrUpdateAlert(action); - // verify(allAlerts).addOrUpdateScheduleNotificationAlert("mother", "Case X", "ANM ID M", "Ante Natal Care - Normal", "ANC 1", normal, dueDate, expiryDate); - } - - @Test - public void shouldCreateACloseActionForAVisitOfAChild() throws Exception { - service.markAlertAsClosed("Case X", "ANM 1", "OPV 1", "2012-01-01"); - - verify(allActions).add(new Action("Case X", "ANM 1", ActionData.markAlertAsClosed("OPV 1", "2012-01-01"))); - } - - @Test - public void shouldCreateADeleteAllActionForAMother() throws Exception { - service.markAllAlertsAsInactive("Case X"); - - verify(allActions).markAllAsInActiveFor("Case X"); - } - - @Test - public void shouldMarkAnAlertAsInactive() throws Exception { - service.markAlertAsInactive("ANM 1", "Case X", "Schedule 1"); - - verify(allActions).markAlertAsInactiveFor("ANM 1", "Case X", "Schedule 1"); - } - - @Test - public void shouldReportForIndicator() { - ActionData summaryActionData = ActionData.reportForIndicator("ANC", "30", - new Gson().toJson(asList(new MonthSummaryDatum("3", "2012", "2", "2", asList("CASE 5", "CASE 6"))))); - - service.reportForIndicator("ANM X", summaryActionData); - - verify(allActions).add(new Action("", "ANM X", summaryActionData)); - } - - @Test - public void shouldDeleteAllActionsWithTargetReport() { - service.deleteReportActions(); - - verify(allActions).deleteAllByTarget("report"); - } - - @Test - public void shouldCreateACloseActionForAVisitOfAMother() throws Exception { - service.markAlertAsClosed("Case X", "ANM ID 1", "ANC 1", "2012-12-12"); - - Action action = new Action("Case X", "ANM ID 1", ActionData.markAlertAsClosed("ANC 1", "2012-12-12")); - verify(allActions).add(action); - verify(allAlerts).markAlertAsCompleteFor("ANM ID 1", "Case X", "ANC 1", "2012-12-12"); - } - - @Test - public void shouldCloseAlertBasedOnCaseId() throws Exception { - service.markAlertAsClosed(CASE_X, "ANC 1", "2012-12-12"); - - Action action = new Action(CASE_X, ALL_PROVIDERS, ActionData.markAlertAsClosed("ANC 1", "2012-12-12")); - verify(allActions).add(action); - verify(allAlerts).markAlertAsCompleteFor(CASE_X, "ANC 1", "2012-12-12"); - } - - @Test - public void shouldCloseBeneficiary() throws Exception { - PowerMockito.mockStatic(org.motechproject.util.DateUtil.class); - DateTime dateTime = mock(DateTime.class); - - when(org.motechproject.util.DateUtil.now()).thenReturn(new DateTime(0l)); - PowerMockito.whenNew(DateTime.class).withNoArguments().thenReturn(dateTime); - when(dateTime.toLocalDate()).thenReturn(new LocalDate(0l)); - - service.closeBeneficiary(BeneficiaryType.mother, CASE_X, ANM_1, REASON_FOR_CLOSE); - - Action action = new Action(CASE_X, ANM_1, - ActionData.closeBeneficiary(BeneficiaryType.mother.name(), REASON_FOR_CLOSE)); - DateTime defaultDate = service.getCurrentDateTime(); - Alert alert = new Alert(ANM_1, CASE_X, BeneficiaryType.mother.name(), Alert.AlertType.notification, - Alert.TriggerType.caseClosed, null, null, defaultDate, defaultDate, AlertStatus.urgent, null); - - verify(allActions).add(action); - verify(allAlerts).add(alert); - } - - @Test - public void shouldReturnAlertsBasedOnANMIDAndTimeStamp() throws Exception { - List alertActions = Arrays.asList(new Action("Case X", "ANM 1", ActionData.createAlert("mother", - "Ante Natal Care - Normal", "ANC 1", normal, DateTime.now(), DateTime.now().plusDays(3)))); - when(allActions.findByProviderIdAndTimeStamp("ANM 1", 1010101)).thenReturn(alertActions); - - List alerts = service.getNewAlertsForANM("ANM 1", 1010101); - - assertEquals(1, alerts.size()); - assertEquals(alertActions, alerts); - } - - @Test - public void shouldFindAllByCriteria() { - List alerts = service.findByCriteria("team", "ANM 1", 1010101, "sortBy", "sortOrder", 1); - verify(allActions).findByCriteria("team", "ANM 1", 1010101, "sortBy", "sortOrder", 1); - - } - - @Test - public void shouldGetAlertsForProvider() { - service.getAlertsForProvider(ANM_1, 200l); - verify(allAlerts).findByProviderAndTimestamp(ANM_1, 200l); - } - - @Test - public void shouldGetAlertsActiveForProvider() { - service.getAlertsActiveForProvider(ANM_1, DATE_TIME.getMillis()); - - verify(allAlerts).findActiveByProviderAndTimestamp(ANM_1, new DateTime(0l).getMillis()); - } - - @Test - public void shouldFindByCaseIdScheduleAndTimeStamp() { - service.findByCaseIdScheduleAndTimeStamp(CASE_X, SCHDEDULE, DATE_TIME, DATE_TIME); - - verify(allActions).findByCaseIdScheduleAndTimeStamp(CASE_X, SCHDEDULE, DATE_TIME, DATE_TIME); - } - - @Test - public void shouldFindByCaseIdAndTimeStamp() { - service.findByCaseIdAndTimeStamp(CASE_X, DATE_TIME.getMillis()); - - verify(allActions).findByCaseIdAndTimeStamp(CASE_X, DATE_TIME.getMillis()); - } - - @Test - public void shouldFindAlertByEntityIdScheduleAndTimeStamp() { - service.findAlertByEntityIdScheduleAndTimeStamp(CASE_X, SCHDEDULE, DATE_TIME, DATE_TIME); - - verify(allAlerts).findByEntityIdTriggerAndTimeStamp(CASE_X, SCHDEDULE, DATE_TIME, DATE_TIME); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/service/ECAlertCreationTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/service/ECAlertCreationTest.java deleted file mode 100644 index ee5d77b316..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/service/ECAlertCreationTest.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.opensrp.scheduler.service; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.motechproject.scheduler.domain.MotechEvent; -import org.motechproject.scheduletracking.api.domain.Enrollment; -import org.motechproject.scheduletracking.api.domain.WindowName; -import org.opensrp.domain.Event; -import org.opensrp.scheduler.ECAlertCreationAction; -import org.opensrp.scheduler.HealthSchedulerService; -import org.opensrp.scheduler.MilestoneEvent; -import org.opensrp.scheduler.router.AlertHandlerRoutesTest; -import org.opensrp.service.EventService; - -public class ECAlertCreationTest { - - @Mock - HealthSchedulerService healthSchedulerService; - - @Mock - EventService eventService; - - @InjectMocks - ECAlertCreationAction ecAlertCreationAction = new ECAlertCreationAction(healthSchedulerService, eventService); - - @Before - public void setUp() { - initMocks(this); - } - - @Test - public void test() { - String externalId = "sss"; - String scheduleBCG = "BCG"; - String milestone = "milestone"; - MotechEvent motechEvent = AlertHandlerRoutesTest.Event.of(externalId, scheduleBCG, milestone, WindowName.max) - .createMotechEvent(); - MilestoneEvent milestoneEvent = new MilestoneEvent(motechEvent); - String entityType = "type"; - String providerId = "anm 1"; - Enrollment enrollment = mock(Enrollment.class); - Map metaData = new HashMap<>(); - String entityId = "entityId"; - metaData.put(HealthSchedulerService.MetadataField.enrollmentEvent.name(), entityId); - - when(healthSchedulerService.getEnrollment(externalId, scheduleBCG)).thenReturn(enrollment); - when(enrollment.getMetadata()).thenReturn(metaData); - when(eventService.getById(entityId)).thenReturn(new Event().withEntityType(entityType).withProviderId(providerId)); - - ecAlertCreationAction.invoke(milestoneEvent, Collections.EMPTY_MAP); - - verify(healthSchedulerService).alertFor(milestoneEvent.windowName(), entityType, milestoneEvent.externalId(), - providerId, milestoneEvent.scheduleName(), milestoneEvent.milestoneName(), milestoneEvent.startOfDueWindow(), - milestoneEvent.startOfLateWindow(), milestoneEvent.startOfMaxWindow()); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/scheduler/service/ScheduleServiceTest.java b/opensrp-core/src/test/java/org/opensrp/scheduler/service/ScheduleServiceTest.java deleted file mode 100644 index 2efb0d96e4..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/scheduler/service/ScheduleServiceTest.java +++ /dev/null @@ -1,294 +0,0 @@ -package org.opensrp.scheduler.service; - -import static java.util.Arrays.asList; -import static junit.framework.Assert.assertEquals; -import static org.joda.time.LocalDate.parse; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.joda.time.DateTime; -import org.joda.time.LocalTime; -import org.joda.time.Period; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InOrder; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.motechproject.model.Time; -import org.motechproject.scheduletracking.api.domain.Enrollment; -import org.motechproject.scheduletracking.api.domain.EnrollmentStatus; -import org.motechproject.scheduletracking.api.domain.Milestone; -import org.motechproject.scheduletracking.api.domain.Schedule; -import org.motechproject.scheduletracking.api.repository.AllSchedules; -import org.motechproject.scheduletracking.api.service.EnrollmentRecord; -import org.motechproject.scheduletracking.api.service.EnrollmentsQuery; -import org.motechproject.scheduletracking.api.service.ScheduleTrackingService; -import org.opensrp.common.util.DateUtil; -import org.opensrp.scheduler.HealthSchedulerService; -import org.opensrp.util.ScheduleBuilder; -import org.powermock.api.mockito.PowerMockito; - -public class ScheduleServiceTest { - - public static final String ENTITY_ID = "entity_id"; - - public static final String MY_SCHEDULE = "my_schedule"; - - public static final String ENROLLMENT_ID = "enrollment_di"; - - @Mock - private ScheduleTrackingService scheduleTrackingService; - - @Mock - private AllSchedules allSchedules; - - @Mock - private AllEnrollmentWrapper allEnrollments; - - private ScheduleService scheduleService; - - private Milestone firstMilestone; - - private Milestone secondMilestone; - - private Milestone thirdMilestone; - - private Schedule schedule; - - @Before - public void setUp() throws Exception { - initMocks(this); - firstMilestone = new Milestone("firstMilestone", weeks(1), weeks(1), weeks(1), weeks(1)); - secondMilestone = new Milestone("secondMilestone", weeks(5), weeks(1), weeks(1), weeks(1)); - thirdMilestone = new Milestone("thirdMilestone", weeks(8), weeks(1), weeks(1), weeks(1)); - schedule = new Schedule("my_schedule"); - schedule.addMilestones(firstMilestone); - schedule.addMilestones(secondMilestone); - schedule.addMilestones(thirdMilestone); - scheduleService = new ScheduleService(scheduleTrackingService, allSchedules, 14, allEnrollments); - } - - @Test - public void shouldEnrollToFirstMilestoneBasedOnScheduleDatesAndReferenceDate() { - DateUtil.fakeIt(parse("2012-01-01")); - when(allSchedules.getByName("my_schedule")).thenReturn(schedule); - - scheduleService.enroll("entity_1", "my_schedule", "2012-01-01", "formsubmission1"); - - verify(scheduleTrackingService) - .enroll(ScheduleBuilder.enrollmentFor("entity_1", "my_schedule", firstMilestone.getName(), "2012-01-01")); - } - - @Test - public void shouldEnrollToSecondMilestoneBasedOnScheduleDatesAndReferenceDate() { - DateUtil.fakeIt(parse("2012-02-07")); - when(allSchedules.getByName("my_schedule")).thenReturn(schedule); - - scheduleService.enroll("entity_1", "my_schedule", "2012-01-01", "formsubmission2"); - - verify(scheduleTrackingService) - .enroll(ScheduleBuilder.enrollmentFor("entity_1", "my_schedule", secondMilestone.getName(), "2012-01-01")); - } - - @Test - public void shouldEnrollToThirdMilestoneBasedOnScheduleDatesAndReferenceDate() { - DateUtil.fakeIt(parse("2012-03-01")); - when(allSchedules.getByName("my_schedule")).thenReturn(schedule); - - scheduleService.enroll("entity_1", "my_schedule", "2012-01-01", "formsubmission3"); - - verify(scheduleTrackingService) - .enroll(ScheduleBuilder.enrollmentFor("entity_1", "my_schedule", thirdMilestone.getName(), "2012-01-01")); - } - - @Test - public void testEnrollIntoNullMilestone() { - DateUtil.fakeIt(parse("2018-03-01")); - when(allSchedules.getByName("my_schedule")).thenReturn(schedule); - - scheduleService.enroll("entity_1", "my_schedule", "2012-01-01", "formsubmission3"); - - verify(scheduleTrackingService).enroll(ScheduleBuilder.enrollmentFor("entity_1", "my_schedule", null, "2012-01-01")); - } - - @Test(expected = NullPointerException.class) - public void shouldThrowNullPointerExceptionIfSchduleIsNotFound() { - scheduleService.enroll("entity_1", "my_schedule", "2012-01-01", "formsubmission2"); - } - - @Test - public void shouldSuccessfullyFulfilMilestone() { - Enrollment enrollment = ScheduleBuilder.enrollment("entity_1", "my_schedule", "milestone", new DateTime(0l), - new DateTime(1l), EnrollmentStatus.ACTIVE, "formSubmission3"); - when(allEnrollments.getActiveEnrollment("entity_1", "my_schedule")).thenReturn(enrollment); - LocalTime localTime = new DateTime(3l).toLocalTime(); - - ScheduleService spyScheduleService = spy(scheduleService); - when(spyScheduleService.getCurrentTime()).thenReturn(new Time(localTime)); - - spyScheduleService.fulfillMilestone("entity_1", "my_schedule", new DateTime(0l).toLocalDate(), "formSubmission3"); - - Map metaData = enrollment.getMetadata(); - metaData.put(HealthSchedulerService.MetadataField.fulfillmentEvent.name(), "formSubmission3"); - enrollment.setMetadata(metaData); - InOrder inOrder = Mockito.inOrder(allEnrollments, scheduleTrackingService); - inOrder.verify(allEnrollments).update(enrollment); - inOrder.verify(scheduleTrackingService).fulfillCurrentMilestone("entity_1", "my_schedule", - new DateTime(1l).toLocalDate(), new Time(localTime)); - } - - @Test - public void shouldNotTryToFulfilMilestoneIfNoEnrollmentFound() { - scheduleService.fulfillMilestone("entity_1", "my_schedule", new DateTime(0l).toLocalDate(), "formSubmission3"); - verify(allEnrollments, never()).update(any(Enrollment.class)); - verifyNoMoreInteractions(scheduleTrackingService); - } - - @Test - public void shouldUnEnroll() { - Enrollment enrollment = ScheduleBuilder.enrollment("entity_1", "my_schedule", "milestone", new DateTime(0l), - new DateTime(1l), EnrollmentStatus.ACTIVE, "formSubmission3"); - when(allEnrollments.getActiveEnrollment("entity_1", "my_schedule")).thenReturn(enrollment); - - scheduleService.unenroll("entity_1", "my_schedule", "formSubmission3"); - - Map metaData = enrollment.getMetadata(); - metaData.put(HealthSchedulerService.MetadataField.unenrollmentEvent.name(), "formSubmission3"); - enrollment.setMetadata(metaData); - - InOrder inOrder = Mockito.inOrder(allEnrollments, scheduleTrackingService); - inOrder.verify(allEnrollments).update(enrollment); - inOrder.verify(scheduleTrackingService).unenroll("entity_1", asList("my_schedule")); - } - - @Test - public void shouldNotTryToUnEnrollIfNoEnrollmentFound() { - scheduleService.fulfillMilestone("entity_1", "my_schedule", new DateTime(0l).toLocalDate(), "formSubmission3"); - verify(allEnrollments, never()).update(any(Enrollment.class)); - verifyNoMoreInteractions(scheduleTrackingService); - } - - @Test - public void shouldUnEnrollGivenScheduleList() { - Enrollment enrollment_1 = ScheduleBuilder.enrollment("entity_1", "my_schedule", "milestone", new DateTime(0l), - new DateTime(1l), EnrollmentStatus.ACTIVE, "formSubmission3"); - Enrollment enrollment_2 = ScheduleBuilder.enrollment("entity_1", "my_schedule", "milestone", new DateTime(0l), - new DateTime(1l), EnrollmentStatus.ACTIVE, "formSubmission3"); - when(allEnrollments.getActiveEnrollment("entity_1", "schedule_1")).thenReturn(enrollment_1); - when(allEnrollments.getActiveEnrollment("entity_1", "schedule_2")).thenReturn(enrollment_2); - - scheduleService.unenroll("entity_1", asList("schedule_1", "schedule_2"), "formSubmission3"); - - Map metaData = enrollment_1.getMetadata(); - metaData.put(HealthSchedulerService.MetadataField.unenrollmentEvent.name(), "formSubmission3"); - enrollment_1.setMetadata(metaData); - enrollment_2.setMetadata(metaData); - - InOrder inOrder = Mockito.inOrder(allEnrollments, scheduleTrackingService); - inOrder.verify(allEnrollments).update(enrollment_1); - inOrder.verify(allEnrollments).update(enrollment_2); - inOrder.verify(scheduleTrackingService).unenroll("entity_1", asList("schedule_1", "schedule_2")); - } - - @Test - public void findOpenEnrollments() throws Exception { - EnrollmentsQuery enrollmentsQuery = mock(EnrollmentsQuery.class); - when(enrollmentsQuery.havingExternalId(ENTITY_ID)).thenReturn(enrollmentsQuery); - when(enrollmentsQuery.havingState(EnrollmentStatus.ACTIVE)).thenReturn(enrollmentsQuery); - - ScheduleService spyScheduleService = spy(scheduleService); - when(spyScheduleService.createEnrollmentQueryWithActiveExternalId(ENTITY_ID)).thenReturn(enrollmentsQuery); - - spyScheduleService.findOpenEnrollments(ENTITY_ID); - - verify(scheduleTrackingService).search(enrollmentsQuery); - } - - @Test - public void shouldFindAllEnrollmentByStatusAndEnrollmentDate() { - scheduleService.findEnrollmentByStatusAndEnrollmentDate("active", new DateTime(0l), new DateTime(1l)); - verify(allEnrollments).findByEnrollmentDate("active", new DateTime(0l), new DateTime(1l)); - } - - @Test - public void shouldFindEnrollmentByLastUpDate() { - scheduleService.findEnrollmentByLastUpDate(new DateTime(0l), new DateTime(1l)); - verify(allEnrollments).findByLastUpDate(new DateTime(0l), new DateTime(1l)); - } - - @Test - public void shouldUpdateEnrollmentWithMetadata() { - Enrollment enrollment = ScheduleBuilder.enrollment("entity_1", "my_schedule", "milestone", new DateTime(0l), - new DateTime(1l), EnrollmentStatus.ACTIVE, "formSubmission3"); - when(allEnrollments.get("enrollment_id")).thenReturn(enrollment); - - scheduleService.updateEnrollmentWithMetadata("enrollment_id", "key", "value"); - - Map metaData = enrollment.getMetadata(); - metaData.put("key", "value"); - enrollment.setMetadata(metaData); - - verify(allEnrollments).update(enrollment); - - } - - @Test - public void shouldFindOpenEnrollmentNames() throws Exception { - EnrollmentsQuery enrollmentsQuery = PowerMockito.mock(EnrollmentsQuery.class); - when(enrollmentsQuery.havingExternalId(ENTITY_ID)).thenReturn(enrollmentsQuery); - when(enrollmentsQuery.havingState(EnrollmentStatus.ACTIVE)).thenReturn(enrollmentsQuery); - - ScheduleService spyScheduleService = spy(scheduleService); - when(spyScheduleService.createEnrollmentQueryWithActiveExternalId(ENTITY_ID)).thenReturn(enrollmentsQuery); - - List enrollmentRecords = new ArrayList<>(); - List expected = new ArrayList<>(); - for (int i = 0; i < 10; i++) { - enrollmentRecords.add(ScheduleBuilder.enrollmentRecord(ENTITY_ID, "schedule" + i, "milestone")); - expected.add("schedule" + i); - } - - when(scheduleTrackingService.search(enrollmentsQuery)).thenReturn(enrollmentRecords); - List actual = spyScheduleService.findOpenEnrollmentNames(ENTITY_ID); - - assertEquals(expected, actual); - } - - @Test - public void shouldGetActiveEnrollment() { - scheduleService.getActiveEnrollment(ENTITY_ID, MY_SCHEDULE); - verify(allEnrollments).getActiveEnrollment(ENTITY_ID, MY_SCHEDULE); - } - - @Test - public void shouldGetEnrollment() { - scheduleService.getEnrollment(ENTITY_ID, MY_SCHEDULE); - verify(allEnrollments).getEnrollment(ENTITY_ID, MY_SCHEDULE); - } - - @Test - public void shouldGetEnrollmentRecord() { - scheduleService.getEnrollmentRecord(ENTITY_ID, MY_SCHEDULE); - verify(scheduleTrackingService).getEnrollment(ENTITY_ID, MY_SCHEDULE); - } - - @Test - public void shouldGetEnrollmentById() { - scheduleService.getEnrollment(ENROLLMENT_ID); - verify(allEnrollments).get(ENROLLMENT_ID); - } - - private Period weeks(int numberOfWeeks) { - return new Period(0, 0, numberOfWeeks, 0, 0, 0, 0, 0); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/CampaignServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/CampaignServiceTest.java deleted file mode 100644 index 537934fb17..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/CampaignServiceTest.java +++ /dev/null @@ -1,153 +0,0 @@ -package org.opensrp.service; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - -import org.joda.time.LocalDate; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.domain.Campaign; -import org.opensrp.domain.ExecutionPeriod; -import org.opensrp.domain.Task.TaskStatus; -import org.opensrp.repository.CampaignRepository; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -public class CampaignServiceTest { - - private CampaignService campaignService; - - private CampaignRepository campaignRepository; - - @Before - public void setUp() { - campaignRepository = mock(CampaignRepository.class); - campaignService = new CampaignService(); - campaignService.setCampaignRepository(campaignRepository); - } - - @Test - public void testGetAllCampaigns() { - List expected = new ArrayList<>(); - Campaign campaign = new Campaign(); - campaign.setIdentifier("ITN_2018_S1"); - campaign.setDescription("ITN for 2018 Season 1"); - expected.add(campaign); - when(campaignRepository.getAll()).thenReturn(expected); - List campaigns = campaignService.getAllCampaigns(); - verify(campaignRepository).getAll(); - assertEquals(1, campaigns.size()); - assertEquals("ITN_2018_S1", campaigns.get(0).getIdentifier()); - } - - @Test(expected = IllegalArgumentException.class) - public void testaAddOrUpdateCampaignWithoutIdentifier() { - Campaign campaign = new Campaign(); - campaignService.addOrUpdateCampaign(campaign); - } - - @Test - public void testExistingCampaignAddOrUpdateCampaignShouldUpdate() { - Campaign campaign = getCampaign(); - when(campaignRepository.get("ITN_2018_S1")).thenReturn(campaign); - campaignService.addOrUpdateCampaign(campaign); - verify(campaignRepository).update(campaign); - - } - - @Test - public void testNonExistingCampaignAddOrUpdateCampaignShouldAdd() { - Campaign campaign = getCampaign(); - when(campaignRepository.get("ITN_2018_S1")).thenReturn(null); - campaignService.addOrUpdateCampaign(campaign); - verify(campaignRepository).add(campaign); - - } - - @Test - public void testaAddCampaign() { - Campaign campaign = getCampaign(); - campaignService.addCampaign(campaign); - verify(campaignRepository).add(campaign); - - } - - @Test(expected = IllegalArgumentException.class) - public void testAddCampaignWithoutIdentifier() { - Campaign campaign = new Campaign(); - campaignService.addCampaign(campaign); - } - - @Test - public void testUpdateCampaign() { - Campaign campaign = getCampaign(); - campaignService.updateCampaign(campaign); - verify(campaignRepository).update(campaign); - - } - - @Test(expected = IllegalArgumentException.class) - public void testUpdateCampaignWithoutIdentifier() { - Campaign campaign = new Campaign(); - campaignService.updateCampaign(campaign); - - } - - @Test - public void testGetCampaign() { - when(campaignRepository.get("ITN_2018_S1")).thenReturn(getCampaign()); - Campaign campaign = campaignService.getCampaign("ITN_2018_S1"); - verify(campaignRepository).get("ITN_2018_S1"); - assertEquals("ITN for 2018 Season 1", campaign.getDescription()); - assertEquals(TaskStatus.READY, campaign.getStatus()); - assertEquals(1542115657234l, campaign.getServerVersion()); - - } - - @Test - public void testGetCampaignWithNoIdentifier() { - Campaign campaign = campaignService.getCampaign(""); - verify(campaignRepository, never()).get(anyString()); - assertNull(campaign); - - } - - @Test - public void testGetCampaigns() { - List expected = new ArrayList<>(); - expected.add(getCampaign()); - when(campaignRepository.getCampaignsByServerVersion(1542115657234l)).thenReturn(expected); - List campaigns = campaignService.getCampaignsByServerVersion(1542115657234l); - verify(campaignRepository).getCampaignsByServerVersion(1542115657234l); - assertEquals(1, campaigns.size()); - assertEquals("ITN_2018_S1", campaigns.get(0).getIdentifier()); - assertEquals("ITN for 2018 Season 1", campaigns.get(0).getDescription()); - assertEquals(TaskStatus.READY, campaigns.get(0).getStatus()); - assertEquals(1542115657234l, campaigns.get(0).getServerVersion()); - - } - - private Campaign getCampaign() { - Campaign campaign = new Campaign(); - campaign.setIdentifier("ITN_2018_S1"); - campaign.setDescription("ITN for 2018 Season 1"); - campaign.setStatus(TaskStatus.READY); - ExecutionPeriod executionPeriod = new ExecutionPeriod(); - executionPeriod.setStart(new LocalDate("2018-01-01")); - executionPeriod.setStart(new LocalDate("2018-03-31")); - campaign.setExecutionPeriod(executionPeriod); - campaign.setOwner("superAdmin23"); - campaign.setServerVersion(1542115657234l); - return campaign; - - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/ClientServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/ClientServiceTest.java deleted file mode 100644 index 0ec85ca5ab..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/ClientServiceTest.java +++ /dev/null @@ -1,204 +0,0 @@ -package org.opensrp.service; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.opensrp.common.AllConstants.Client.OPENMRS_UUID_IDENTIFIER_TYPE; - -import java.util.HashSet; -import java.util.Set; - -import org.joda.time.DateTime; -import org.json.JSONException; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.domain.Address; -import org.opensrp.domain.Client; -import org.opensrp.repository.ClientsRepository; -import org.opensrp.repository.postgres.BaseRepositoryTest; -import org.opensrp.repository.postgres.ClientsRepositoryImpl; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -public class ClientServiceTest extends BaseRepositoryTest { - - private ClientService clientService; - - @Autowired - @Qualifier("clientsRepositoryPostgres") - private ClientsRepository clientsRepository; - - @Before - public void setUpPostgresRepository() { - clientService = new ClientService(clientsRepository); - } - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet(); - scripts.add("client.sql"); - return scripts; - } - - @Test - public void testAddClient() { - Client client = new Client("f67823b0-378e-4a35-93fc-bb00def74e2f").withBirthdate(new DateTime("2017-03-31"), true) - .withGender("Male").withFirstName("xobili").withLastName("mbangwa"); - client.withIdentifier("ZEIR_ID", "233864-8").withAttribute("Home_Facility", "Linda"); - clientService.addClient(client); - assertEquals(22, clientService.findAllClients().size()); - - Client savedClient = clientService.find("f67823b0-378e-4a35-93fc-bb00def74e2f"); - assertNotNull(savedClient.getId()); - assertEquals(new DateTime("2017-03-31"), client.getBirthdate()); - assertEquals("xobili", client.getFirstName()); - assertEquals("mbangwa", client.getLastName()); - assertEquals("233864-8", client.getIdentifier("ZEIR_ID")); - - //test adding existing client is updated - DateTime timeBeforeUpdate = new DateTime(); - savedClient.withMiddleName("Rustus"); - clientService.addClient(savedClient); - - Client updatedClient = clientService.find(savedClient.getBaseEntityId()); - assertEquals("Rustus", updatedClient.getMiddleName()); - assertEquals(ClientsRepositoryImpl.REVISION_PREFIX + 2, updatedClient.getRevision()); - assertTrue(timeBeforeUpdate.isBefore(updatedClient.getDateEdited())); - - } - - @Test - public void testFindClient() { - Client client = new Client("33d9a17f-d729-4276-9891-b43e8b60fd12"); - assertEquals("05934ae338431f28bf6793b24159c647", clientService.findClient(client).getId()); - - client.withIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE, "9c4260f2-d296-4af1-b771-debda1b6cfd1").withIdentifier( - "ZEIR_ID", "218220-2"); - assertEquals("05934ae338431f28bf6793b24159c647", clientService.findClient(client).getId()); - - client = new Client(""); - client.withIdentifier("ZEIR_ID", "218220-211"); - assertNull(clientService.findClient(client)); - - client.withBaseEntityId("3423fdsf-23423-hjh23423"); - - assertNull(clientService.findClient(client)); - - client = new Client(""); - assertNull(clientService.findClient(client)); - - client.withIdentifier("ZEIR_ID", "218225-1"); - assertEquals("05934ae338431f28bf6793b24167817d", clientService.findClient(client).getId()); - } - - @Test - public void testFind() { - assertEquals("05934ae338431f28bf6793b24159c647", clientService.find("33d9a17f-d729-4276-9891-b43e8b60fd12").getId()); - - assertNull(clientService.find("3423fdsf-23423-hjh23423")); - } - - @Test(expected = IllegalArgumentException.class) - public void testUpdateClientNewClient() throws JSONException { - Client client = new Client("33d9a17f-d729-4276-9891-b43e8b60fd12"); - clientService.updateClient(client); - } - - @Test(expected = IllegalArgumentException.class) - public void testUpdateClientClientNotExists() throws JSONException { - Client client = clientService.find("67007c17-97bb-4732-a1b8-3a0c292b5432"); - clientsRepository.safeRemove(client); - client.setFirstName("Conses"); - clientService.updateClient(client); - } - - @Test() - public void testUpdateClient() throws JSONException { - Client client = clientService.find("67007c17-97bb-4732-a1b8-3a0c292b5432"); - client.withFirstName("Conses").withMiddleName("Divens") - .withIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE, "2321312-dsfsd"); - clientService.updateClient(client); - - Client updatedClient = clientService.find("67007c17-97bb-4732-a1b8-3a0c292b5432"); - assertEquals("Conses", updatedClient.getFirstName()); - assertEquals("Divens", updatedClient.getMiddleName()); - assertEquals("2321312-dsfsd", updatedClient.getIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE)); - } - - @Test - public void testMergeClient() { - Client client = clientService.find("cc127350-c1cd-4c3a-99d4-4d632882f522"); - Address address = new Address().withCountry("KE").withStateProvince("Punja").withAddressType("home"); - - client.withFirstName("Conses").withMiddleName("Divens") - .withIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE, "2321312-dsfsd").withAttribute("Zone", "Zone3") - .withAddress(address); - - Client mergedClient = clientService.mergeClient(client); - assertEquals("Conses", mergedClient.getFirstName()); - assertEquals("Divens", mergedClient.getMiddleName()); - assertEquals("2321312-dsfsd", mergedClient.getIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE)); - assertEquals("Zone3", mergedClient.getAttribute("Zone")); - assertEquals(address, mergedClient.getAddress(address.getAddressType())); - - } - - @Test - public void testAddorUpdate() { - Client client = new Client("f67823b0-378e-4a35-93fc-bb00def74e2f").withBirthdate(new DateTime("2017-03-31"), true) - .withGender("Male").withFirstName("xobili").withLastName("mbangwa"); - client.withIdentifier("ZEIR_ID", "233864-8").withAttribute("Home_Facility", "Linda"); - clientService.addorUpdate(client); - assertEquals(22, clientService.findAllClients().size()); - - Client savedClient = clientService.find("f67823b0-378e-4a35-93fc-bb00def74e2f"); - assertNotNull(savedClient.getId()); - assertEquals(new DateTime("2017-03-31"), client.getBirthdate()); - assertEquals("xobili", client.getFirstName()); - assertEquals("mbangwa", client.getLastName()); - assertEquals("233864-8", client.getIdentifier("ZEIR_ID")); - - //test adding existing client is updated - DateTime timeBeforeUpdate = new DateTime(); - savedClient.withMiddleName("Rustus"); - clientService.addorUpdate(savedClient); - - Client updatedClient = clientService.find(savedClient.getBaseEntityId()); - assertEquals("Rustus", updatedClient.getMiddleName()); - assertEquals(ClientsRepositoryImpl.REVISION_PREFIX + 2, updatedClient.getRevision()); - assertTrue(timeBeforeUpdate.isBefore(updatedClient.getDateEdited())); - } - - @Test - public void testAddorUpdateWithServerVersionFlag() { - Client client = new Client("f67823b0-378e-4a35-93fc-bb00def74e2f").withBirthdate(new DateTime("2017-03-31"), true) - .withGender("Male").withFirstName("xobili").withLastName("mbangwa"); - client.withIdentifier("ZEIR_ID", "233864-8").withAttribute("Home_Facility", "Linda"); - clientService.addorUpdate(client, false); - assertEquals(22, clientService.findAllClients().size()); - - Client savedClient = clientService.find("f67823b0-378e-4a35-93fc-bb00def74e2f"); - assertNotNull(savedClient.getId()); - assertEquals(new DateTime("2017-03-31"), client.getBirthdate()); - assertEquals("xobili", client.getFirstName()); - assertEquals("mbangwa", client.getLastName()); - assertEquals("233864-8", client.getIdentifier("ZEIR_ID")); - - long existingServerVesion = savedClient.getServerVersion(); - //test adding existing client is updated - DateTime timeBeforeUpdate = new DateTime(); - savedClient.withMiddleName("Rustus"); - clientService.addorUpdate(savedClient, false); - - Client updatedClient = clientService.find(savedClient.getBaseEntityId()); - assertEquals("Rustus", updatedClient.getMiddleName()); - assertEquals(ClientsRepositoryImpl.REVISION_PREFIX + 2, updatedClient.getRevision()); - assertTrue(timeBeforeUpdate.isBefore(updatedClient.getDateEdited())); - assertEquals(existingServerVesion, updatedClient.getServerVersion().longValue()); - - clientService.addorUpdate(savedClient, true); - assertTrue(clientService.find(savedClient.getBaseEntityId()).getServerVersion() > existingServerVesion); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/EventServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/EventServiceTest.java deleted file mode 100644 index 36521742d8..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/EventServiceTest.java +++ /dev/null @@ -1,403 +0,0 @@ -package org.opensrp.service; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.opensrp.common.AllConstants.Event.OPENMRS_UUID_IDENTIFIER_TYPE; - -import java.sql.SQLException; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; - -import org.codehaus.jackson.Version; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.module.SimpleModule; -import org.joda.time.DateTime; -import org.joda.time.Minutes; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.common.AllConstants.Client; -import org.opensrp.domain.Event; -import org.opensrp.domain.Obs; -import org.opensrp.repository.ClientsRepository; -import org.opensrp.repository.EventsRepository; -import org.opensrp.repository.postgres.BaseRepositoryTest; -import org.opensrp.repository.postgres.EventsRepositoryImpl; -import org.opensrp.repository.postgres.handler.BaseTypeHandler; -import org.opensrp.util.DateTimeDeserializer; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.dao.DuplicateKeyException; - -public class EventServiceTest extends BaseRepositoryTest { - - private EventService eventService; - - @Autowired - @Qualifier("eventsRepositoryPostgres") - private EventsRepository eventsRepository; - - @Autowired - @Qualifier("clientsRepositoryPostgres") - private ClientsRepository clientsRepository; - - private Set scripts = new HashSet();; - - @Before - public void setUpPostgresRepository() { - eventService = new EventService(eventsRepository, new ClientService(clientsRepository)); - } - - @Override - protected Set getDatabaseScripts() { - scripts.add("event.sql"); - scripts.add("client.sql"); - return scripts; - } - - @Test - public void testFindByUniqueId() { - assertEquals("05934ae338431f28bf6793b241be69a5", eventService.find("4aecc0c1-e008-4227-938d-66db17236a3d").getId()); - - assertEquals("05934ae338431f28bf6793b241bdb88c", eventService.find("06c8644b-b560-45fd-9af5-b6b1484e3504").getId()); - - assertNull(eventService.find("50102f0a-a9c9-1d-a6c476433b3c")); - - //deleted event - eventsRepository.safeRemove(eventService.find("06c8644b-b560-45fd-9af5-b6b1484e3504")); - assertNull(eventService.find("06c8644b-b560-45fd-9af5-b6b1484e3504")); - } - - @Test - public void testFindByEvent() { - Event event = new Event(); - assertNull(eventService.find(event)); - - event.withIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE, "94ec8561-14ab-48d1-a6d4-4ae05191f6e6"); - - assertEquals("05934ae338431f28bf6793b241bdbc55", eventService.find(event).getId()); - - //deleted event - eventsRepository.safeRemove(eventService.find(event)); - assertNull(eventService.find(event)); - } - - @Test - public void testFindByEventId() { - Event event = eventService.findById("05934ae338431f28bf6793b2419c319a"); - assertEquals("ea1f9439-a663-4073-93b9-6ef2b8bca3c1", event.getBaseEntityId()); - assertEquals("d960046a-e2a0-4bbf-b687-d41c2a52d8c8", event.getFormSubmissionId()); - assertEquals("Vaccination", event.getEventType()); - - assertNull(eventService.findById("50102f0a-a9c9-1d-a6c476433b3c")); - - //deleted event - eventsRepository.safeRemove(event); - assertNull(eventService.findById(event.getId())); - } - - @Test - public void testAddEvent() { - Obs obs = new Obs("concept", "decimal", "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", null, "3.5", null, "weight"); - Event event = new Event().withBaseEntityId("435534534543").withEventType("Growth Monitoring") - .withFormSubmissionId("gjhg34534 nvbnv3345345__4").withEventDate(new DateTime()).withObs(obs); - - eventService.addEvent(event); - - event = eventService.findByFormSubmissionId("gjhg34534 nvbnv3345345__4"); - assertEquals("435534534543", event.getBaseEntityId()); - assertEquals("Growth Monitoring", event.getEventType()); - assertEquals(1, event.getObs().size()); - assertEquals("3.5", event.getObs(null, "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getValue()); - - //test if an event with voided date add event as deleted - event = new Event().withBaseEntityId("2423nj-sdfsd-sf2dfsd-2399d").withEventType("Vaccination") - .withFormSubmissionId("hshj2342_jsjs-jhjsdfds-23").withEventDate(new DateTime()).withObs(obs); - event.setDateVoided(new DateTime()); - eventService.addEvent(event); - assertNull(eventService.findByFormSubmissionId(event.getFormSubmissionId())); - } - - @Test(expected = IllegalArgumentException.class) - public void testAddEventForExistingEvent() { - Event event = eventService.findById("05934ae338431f28bf6793b241bdc44a"); - eventService.addEvent(event); - } - - @Test(expected = IllegalArgumentException.class) - public void testAddEventDuplicateIdentifiers() { - Event event = new Event().withIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE, "4aecc0c1-e008-4227-938d-66db17236a3d"); - eventService.addEvent(event); - } - - @Test(expected = IllegalArgumentException.class) - public void testAddEventDuplicateBaseEntityFormSubmission() { - Event event = new Event().withBaseEntityId("58b33379-dab2-4f5c-8f09-6d2bd63023d8").withFormSubmissionId( - "5f1b201d-2132-4eb9-8fa1-3169a61cc50a"); - eventService.addEvent(event); - } - - @Test(expected = DuplicateKeyException.class) - public void testAddEventDuplicateFormSubmission() { - Event event = new Event().withBaseEntityId("58b33379-dab2-4f").withFormSubmissionId( - "5f1b201d-2132-4eb9-8fa1-3169a61cc50a"); - eventService.addEvent(event); - - } - - @Test - public void testProcessOutOfArea() throws SQLException { - scripts.add("client.sql"); - populateDatabase(); - Event event = new Event().withEventType("Vaccination").withProviderId("tester111") - .withLocationId("2242342-23dsfsdfds").withIdentifier(Client.ZEIR_ID, "218229-3"); - Event outOfAreaEvent = eventService.processOutOfArea(event); - - assertNotNull(outOfAreaEvent); - assertNotNull(outOfAreaEvent.getDetails()); - assertEquals(1, outOfAreaEvent.getDetails().size()); - assertEquals("biddemo", outOfAreaEvent.getDetails().get("out_of_catchment_provider_id")); - assertEquals("42abc582-6658-488b-922e-7be500c070f3", outOfAreaEvent.getLocationId()); - assertEquals("biddemo", outOfAreaEvent.getProviderId()); - - event = new Event().withEventType("Out of Area Service").withProviderId("tester111") - .withLocationId("2242342-23dsfsdfds").withIdentifier(Client.ZEIR_ID, "218229-3"); - - outOfAreaEvent = eventService.processOutOfArea(event); - assertEquals(event, outOfAreaEvent); - assertEquals(20, eventService.getAll().size()); - - //Test with card identifier type - event = new Event().withEventType("Out of Area Service").withProviderId("tester112") - .withLocationId("2242342-23dsfsdfds").withIdentifier(Client.ZEIR_ID, "c_2182291985"); - - outOfAreaEvent = eventService.processOutOfArea(event); - assertNotNull(outOfAreaEvent); - assertEquals(event, outOfAreaEvent); - assertEquals(20, eventService.getAll().size()); - - Obs obs = new Obs("concept", "decimal", "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", null, "3.5", null, "weight"); - event = new Event().withEventType("Out of Area Service - Growth Monitoring") - .withFormSubmissionId("gjhg34534 nvbnv3345345__4").withEventDate(new DateTime()).withObs(obs) - .withIdentifier(Client.ZEIR_ID, "218229-3"); - - outOfAreaEvent = eventService.processOutOfArea(event); - assertEquals(event, outOfAreaEvent); - - assertEquals(21, eventService.getAll().size()); - - } - - @Test - public void testAddorUpdateEvent() { - Obs obs = new Obs("concept", "decimal", "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", null, "3.5", null, "weight"); - Event event = new Event().withBaseEntityId("435534534543").withEventType("Growth Monitoring") - .withFormSubmissionId("gjhg34534 nvbnv3345345__4").withEventDate(new DateTime()).withObs(obs); - - eventService.addorUpdateEvent(event); - - Event updatedEvent = eventService.findByFormSubmissionId("gjhg34534 nvbnv3345345__4"); - assertEquals("435534534543", updatedEvent.getBaseEntityId()); - assertEquals("Growth Monitoring", updatedEvent.getEventType()); - assertEquals(1, updatedEvent.getObs().size()); - assertEquals("3.5", updatedEvent.getObs(null, "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getValue()); - assertNull(updatedEvent.getDateEdited()); - event.setTeam("ATeam"); - event.setProviderId("tester11"); - event.setLocationId("321312-fsff-2328"); - eventService.addorUpdateEvent(event); - - updatedEvent = eventService.findByFormSubmissionId("gjhg34534 nvbnv3345345__4"); - assertEquals("ATeam", updatedEvent.getTeam()); - assertEquals("tester11", updatedEvent.getProviderId()); - assertEquals("321312-fsff-2328", updatedEvent.getLocationId()); - assertEquals(EventsRepositoryImpl.REVISION_PREFIX + 2, updatedEvent.getRevision()); - assertNotNull(updatedEvent.getDateEdited()); - - //test if an event with voided date add event as deleted - event = new Event().withBaseEntityId("2423nj-sdfsd-sf2dfsd-2399d").withEventType("Vaccination") - .withFormSubmissionId("hshj2342_jsjs-jhjsdfds-23").withEventDate(new DateTime()).withObs(obs); - event.setDateVoided(new DateTime()); - eventService.addorUpdateEvent(event); - assertNull(eventService.findByFormSubmissionId(event.getFormSubmissionId())); - } - - @Test - public void testAddorUpdateEventWithMissingEventIdUpdatesEvent() throws Exception { - String baseEntityId = UUID.randomUUID().toString(); - Obs obs = new Obs("concept", "decimal", "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", null, "3.5", null, "weight"); - Event event = new Event().withBaseEntityId(baseEntityId).withEventType("Growth Monitoring") - .withFormSubmissionId("gjhg34534 nvbnv3345345__4").withEventDate(new DateTime()).withObs(obs); - ObjectMapper mapper = BaseTypeHandler.mapper; - SimpleModule dateTimeModule = new SimpleModule("DateTimeModule", new Version(0, 0, 0, null)); - dateTimeModule.addDeserializer(DateTime.class, new DateTimeDeserializer()); - mapper.registerModule(dateTimeModule); - String jsonString = mapper.writeValueAsString(event); - eventService.addorUpdateEvent(event); - - Event updatedEvent = eventService.findByFormSubmissionId("gjhg34534 nvbnv3345345__4"); - String eventId = updatedEvent.getId(); - assertEquals(baseEntityId, updatedEvent.getBaseEntityId()); - assertEquals("Growth Monitoring", updatedEvent.getEventType()); - assertEquals(1, updatedEvent.getObs().size()); - assertEquals("3.5", updatedEvent.getObs(null, "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getValue()); - assertNull(updatedEvent.getDateEdited()); - - Event originalEventWithoutId = mapper.readValue(jsonString, Event.class); - originalEventWithoutId.setTeam("ATeam"); - originalEventWithoutId.setProviderId("tester11"); - originalEventWithoutId.setLocationId("321312-fsff-2328"); - eventService.addorUpdateEvent(originalEventWithoutId); - - updatedEvent = eventService.findByFormSubmissionId("gjhg34534 nvbnv3345345__4"); - assertEquals(eventId, updatedEvent.getId()); - assertEquals("ATeam", updatedEvent.getTeam()); - assertEquals("tester11", updatedEvent.getProviderId()); - assertEquals("321312-fsff-2328", updatedEvent.getLocationId()); - assertEquals(EventsRepositoryImpl.REVISION_PREFIX + 2, updatedEvent.getRevision()); - assertNotNull(updatedEvent.getDateEdited()); - - List events = eventService.findByBaseEntityId(baseEntityId); - assertEquals(1, events.size()); - assertEquals(eventId, events.get(0).getId()); - - } - - @Test(expected = IllegalArgumentException.class) - public void testUpdateEventNonExistingEvent() { - Obs obs = new Obs("concept", "decimal", "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", null, "3.5", null, "weight"); - Event event = new Event().withBaseEntityId("435534534543").withEventType("Growth Monitoring") - .withFormSubmissionId("gjhg34534 nvbnv3345345__4").withEventDate(new DateTime()).withObs(obs); - - eventService.updateEvent(event); - } - - @Test - public void testUpdateEvent() { - DateTime timebeforeUpdate = DateTime.now(); - Event event = eventService.findById("05934ae338431f28bf6793b24177a1dc"); - Obs obs = new Obs("concept", "decimal", "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", null, "3.5", null, "weight"); - event.withIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE, "62242n-223423-2332").addObs(obs); - eventService.updateEvent(event); - - Event updatedEvent = eventService.findById(event.getId()); - assertEquals(0, Minutes.minutesBetween(timebeforeUpdate, updatedEvent.getDateEdited()).getMinutes()); - assertEquals("3.5", updatedEvent.getObs(null, "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getValue()); - assertEquals("62242n-223423-2332", updatedEvent.getIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE)); - - } - - @Test(expected = IllegalArgumentException.class) - public void testMergeEventMissingIdentifiers() { - Event event = new Event().withBaseEntityId("435534534543").withEventType("Growth Monitoring"); - eventService.mergeEvent(event); - } - - @Test(expected = IllegalArgumentException.class) - public void testMergeEventNonExistingIdentifiers() { - Event event = new Event().withBaseEntityId("435534534543").withEventType("Growth Monitoring") - .withIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE, "242332-hgfhfh-dfg8d"); - eventService.mergeEvent(event); - } - - @Test - public void testMergeEvent() { - Obs obs = new Obs("concept", "decimal", "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", null, "3.5", null, "weight"); - Event event = new Event().withEventType("Growth Monitoring") - .withIdentifier(OPENMRS_UUID_IDENTIFIER_TYPE, "4aecc0c1-e008-4227-938d-66db17236a3d") - .withEventDate(new DateTime()).withObs(obs); - - eventService.mergeEvent(event); - - Event updatedEvent = eventService.find("4aecc0c1-e008-4227-938d-66db17236a3d"); - - assertEquals("05934ae338431f28bf6793b241be69a5", updatedEvent.getId()); - assertEquals("Growth Monitoring", updatedEvent.getEventType()); - assertEquals(1, updatedEvent.getObs().size()); - assertEquals("3.5", updatedEvent.getObs(null, "1730AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getValue()); - assertEquals(0, Minutes.minutesBetween(DateTime.now(), updatedEvent.getDateEdited()).getMinutes()); - } - - @Test - public void testFindAllEventIds() { - List actualEventIds = eventService.findAllIdsByEventType(null, null); - - assertNotNull(actualEventIds); - assertEquals(20, actualEventIds.size()); - } - - @Test - public void testFindAllIdsByEventType() { - - String growthMonitoringEventype = "Growth Monitoring"; - List actualEventIds = eventService.findAllIdsByEventType(growthMonitoringEventype, null); - - assertNotNull(actualEventIds); - assertEquals(4, actualEventIds.size()); - - Map expectedIdMap = new HashMap<>(); - expectedIdMap.put("05934ae338431f28bf6793b24177a1dc", true); - expectedIdMap.put("05934ae338431f28bf6793b241780bac", true); - expectedIdMap.put("05934ae338431f28bf6793b241781149", true); - expectedIdMap.put("05934ae338431f28bf6793b241781a1e", true); - - assertTrue(expectedIdMap.containsKey(actualEventIds.get(0))); - assertTrue(expectedIdMap.containsKey(actualEventIds.get(1))); - assertTrue(expectedIdMap.containsKey(actualEventIds.get(2))); - assertTrue(expectedIdMap.containsKey(actualEventIds.get(3))); - - } - - @Test - public void testFindAllDeletedIdsByEventType() { - - String growthMonitoringEventype = "Growth Monitoring"; - - String string = "January 1, 2018"; - DateFormat format = new SimpleDateFormat("MMMM d, yyyy"); - Date date = null; - try { - date = format.parse(string); - } - catch (ParseException e) { - e.printStackTrace(); - } - - List actualEventIds = eventService.findAllIdsByEventType(growthMonitoringEventype, date); - - assertNotNull(actualEventIds); - assertEquals(1, actualEventIds.size()); - - assertEquals("cfcc0e7e3cef11eab77f2e728ce88125", actualEventIds.get(0)); - } - - @Test - public void testFindAllDeletedIds() { - - String string = "January 1, 1970"; - DateFormat format = new SimpleDateFormat("MMMM d, yyyy"); - Date date = null; - try { - date = format.parse(string); - } - catch (ParseException e) { - e.printStackTrace(); - } - - List actualEventIds = eventService.findAllIdsByEventType(null, date); - - assertNotNull(actualEventIds); - assertEquals(1, actualEventIds.size()); - assertEquals("cfcc0e7e3cef11eab77f2e728ce88125", actualEventIds.get(0)); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/MultiMediaServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/MultiMediaServiceTest.java deleted file mode 100644 index 6918b2f1f3..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/MultiMediaServiceTest.java +++ /dev/null @@ -1,120 +0,0 @@ -package org.opensrp.service; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.opensrp.service.MultimediaService.IMAGES_DIR; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.HashSet; -import java.util.Set; - -import org.joda.time.DateTime; -import org.joda.time.Minutes; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.service.multimedia.BaseMultimediaFileManager; -import org.opensrp.domain.Client; -import org.opensrp.domain.Multimedia; -import org.opensrp.dto.form.MultimediaDTO; -import org.opensrp.repository.ClientsRepository; -import org.opensrp.repository.MultimediaRepository; -import org.opensrp.repository.postgres.BaseRepositoryTest; -import org.powermock.reflect.Whitebox; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.mock.web.MockMultipartFile; -import org.springframework.web.multipart.MultipartFile; - -public class MultiMediaServiceTest extends BaseRepositoryTest { - - private MultimediaService multimediaService; - - private ClientService clientService; - - @Autowired - @Qualifier("multimediaRepositoryPostgres") - private MultimediaRepository multimediaRepository; - - @Autowired - @Qualifier("clientsRepositoryPostgres") - private ClientsRepository clientsRepository; - - @Value("#{opensrp['multimedia.directory.name']}") - private String baseMultimediaDirPath; - - @Autowired - @Qualifier("FileSystemMultimediaFileManager") - private BaseMultimediaFileManager fileManager; - - @Before - public void setUp() { - clientService = new ClientService(clientsRepository); - multimediaService = new MultimediaService(multimediaRepository, clientService); - Whitebox.setInternalState(fileManager, "baseMultimediaDirPath", baseMultimediaDirPath); - Whitebox.setInternalState(fileManager, "clientService", clientService); - } - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet(); - scripts.add("multimedia.sql"); - scripts.add("client.sql"); - return scripts; - } - - @Test - public void testUploadFile() throws IOException { - String content = "876nsfsdfs-sdfsfsdf"; - String baseEntityId = "67007c17-97bb-4732-a1b8-3a0c292b5432"; - MultipartFile multimediaFile = new MockMultipartFile("mockFile", "test.jpg", "image/jpeg", content.getBytes()); - MultimediaDTO multimediaDTO = new MultimediaDTO(baseEntityId, "biddemo", multimediaFile.getContentType(), "", - "profilepic"); - - assertTrue(fileManager.uploadFile(multimediaDTO, multimediaFile)); - - //assertEquals(multimediaFile, multimediaService.findByCaseId("469597f0-eefe-4171-afef-f7234cbb2859")); - - File file = new File(baseMultimediaDirPath + File.separator + IMAGES_DIR + File.separator - + baseEntityId + ".jpg"); - System.out.println(file.getAbsolutePath()); - assertTrue(file.exists()); - assertTrue(file.canRead()); - - assertEquals(content, new String(Files.readAllBytes(Paths.get(file.getAbsolutePath())))); - } - - @Test - public void testSaveMultimediaFile() throws IOException { - String baseEntityId = "040d4f18-8140-479c-aa21-725612073490"; - String content = "876nsfsdfs-sdfsfsdf"; - - MultipartFile multimediaFile = new MockMultipartFile("mockFile", "test1.jpg", "image/jpeg", content.getBytes()); - MultimediaDTO multimediaDTO = new MultimediaDTO(baseEntityId, "biddemo", multimediaFile.getContentType(), "", - "profilepic"); - - assertEquals("success", fileManager.saveMultimediaFile(multimediaDTO, multimediaFile)); - - File file = new File(baseMultimediaDirPath + File.separator + IMAGES_DIR + File.separator - + baseEntityId + ".jpg"); - System.out.println(file.getAbsolutePath()); - assertTrue(file.exists()); - assertTrue(file.canRead()); - - assertEquals(content, new String(Files.readAllBytes(Paths.get(file.getAbsolutePath())))); - Client client = clientService.find(baseEntityId); - Multimedia savedMultimedia = multimediaService.findByCaseId(baseEntityId); - assertEquals(multimediaDTO.getFilePath(), savedMultimedia.getFilePath()); - assertEquals(file.getAbsolutePath(), savedMultimedia.getFilePath()); - assertEquals(multimediaDTO.getContentType(), savedMultimedia.getContentType()); - assertEquals(multimediaDTO.getFileCategory(), savedMultimedia.getFileCategory()); - - assertEquals(4, multimediaService.getMultimediaFiles("biddemo").size()); - assertEquals(5, multimediaRepository.getAll().size()); - assertEquals(baseEntityId + ".jpg", client.getAttribute("Patient Image")); - assertEquals(0, Minutes.minutesBetween(client.getDateEdited(), DateTime.now()).getMinutes()); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/OpenmrsIDServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/OpenmrsIDServiceTest.java deleted file mode 100644 index 03d60df751..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/OpenmrsIDServiceTest.java +++ /dev/null @@ -1,227 +0,0 @@ -package org.opensrp.service; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.anyInt; -import static org.opensrp.service.OpenmrsIDService.CHILD_REGISTER_CARD_NUMBER; - -import java.sql.SQLException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.joda.time.DateTime; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mockito; -import org.opensrp.SpringApplicationContextProvider; -import org.opensrp.domain.Address; -import org.opensrp.domain.Client; -import org.opensrp.domain.UniqueId; -import org.opensrp.repository.UniqueIdRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; - -public class OpenmrsIDServiceTest extends SpringApplicationContextProvider { - - @Autowired - OpenmrsIDService openmrsIDService; - - @Autowired - JdbcTemplate jdbcTemplate; - - @Autowired - UniqueIdRepository uniqueIdRepository; - - @Before - public void setUp() { - String dropDbSql = "DROP TABLE IF EXISTS `unique_ids`;"; - jdbcTemplate.execute(dropDbSql); - String tableCreationString = "CREATE TABLE `unique_ids` (\n" + " `_id` bigint(20) NOT NULL AUTO_INCREMENT,\n" - + " `created_at` datetime DEFAULT NULL,\n" + " `location` varchar(255) DEFAULT NULL,\n" - + " `openmrs_id` varchar(255) DEFAULT NULL,\n" + " `status` varchar(255) DEFAULT NULL,\n" - + " `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n" - + " `used_by` varchar(255) DEFAULT NULL,\n" + " PRIMARY KEY (`_id`)\n" - + ") ENGINE=InnoDB DEFAULT CHARSET=utf8;"; - jdbcTemplate.execute(tableCreationString); - } - - @After - public void tearDown() { - String dropDbSql = "DROP TABLE IF EXISTS `unique_ids`;"; - // jdbcTemplate.execute(dropDbSql); - - } - - public Client createClient(String baseEntityId, String firstName, String lastName, String gender, - String childRegisterCardNumber) { - DateTime dateOfBirth = new DateTime(); - Map addressFields = new HashMap<>(); - addressFields.put("address4", "birthFacilityName"); - addressFields.put("address3", "resolvedResidentialAddress"); - addressFields.put("address2", "residentialAddress"); - addressFields.put("address1", "physicalLandmark"); - - Address address = new Address("usual_residence", new DateTime(), new DateTime(), addressFields, null, null, null, - "homeFacility", null); - ArrayList
addressList = new ArrayList
(); - addressList.add(address); - - Client client = new Client(baseEntityId, firstName, "", lastName, dateOfBirth, null, false, false, gender, - addressList, null, null); - client.addAttribute(CHILD_REGISTER_CARD_NUMBER, childRegisterCardNumber); - return client; - } - - @Test - public void testAssignOpenmrsIdToClient() throws SQLException { - Client client = this.createClient("12345", "First", "Last", "Male", "454/16"); - - openmrsIDService.assignOpenmrsIdToClient("12345-1", client); - assertNotNull(client.getIdentifier(OpenmrsIDService.ZEIR_IDENTIFIER)); - } - - @Test - public void testExistingClientsDoNotReceiveNewOpenmrsId() throws Exception { - Client client = this.createClient("45678", "Jane", "Doe", "Female", "102/17"); - Client duplicateClient = this.createClient("45677", "Jane", "Doe", "Female", "102/17"); - - openmrsIDService.assignOpenmrsIdToClient("12345-1", client); - assertNotNull(client.getIdentifier(OpenmrsIDService.ZEIR_IDENTIFIER)); - - openmrsIDService.assignOpenmrsIdToClient("12345-1", duplicateClient); - assertTrue(openmrsIDService.checkIfClientExists(duplicateClient)); - assertNull(duplicateClient.getIdentifier(OpenmrsIDService.ZEIR_IDENTIFIER)); - } - - @Test - public void testCheckClient() throws SQLException { - Client client = this.createClient("45678", "Jane", "Doe", "Female", "102/17"); - openmrsIDService.assignOpenmrsIdToClient("12345-1", client); - assertTrue(openmrsIDService.checkIfClientExists(client)); - } - - @Test - public void testCheckClientWithFalseData() throws SQLException { - Client client = this.createClient("45678", "Jane", "Doe", "Female", "102/17"); - assertFalse(openmrsIDService.checkIfClientExists(client)); - } - - @Test - public void testCheckClientWithInvalidData() throws SQLException { - Client client = this.createClient("*", "Jane", "Doe", "Female", "*"); - assertNull(openmrsIDService.checkIfClientExists(null)); - } - - @Test - public void testDownloadAndSaveIds() { - List downloadedIds = new ArrayList<>(); - downloadedIds.add("1"); - downloadedIds.add("2"); - OpenmrsIDService openmrsIDServiceSpy = Mockito.spy(openmrsIDService); - Mockito.doReturn(downloadedIds).when(openmrsIDServiceSpy).downloadOpenmrsIds(anyInt()); - - openmrsIDServiceSpy.downloadAndSaveIds(2, "test"); - - List uniqueIds = uniqueIdRepository.getNotUsedIds(2); - List actualList = new ArrayList<>(); - for (UniqueId uniqueId : uniqueIds) { - assertEquals("test", uniqueId.getUsedBy()); - actualList.add(uniqueId.getOpenmrsId()); - } - - assertEquals(2, (int) uniqueIdRepository.totalUnUsedIds()); - assertEquals(downloadedIds, actualList); - } - - @Test - public void testClearRecord() throws SQLException { - Client client = this.createClient("12345", "First", "Last", "Male", "454/16"); - openmrsIDService.assignOpenmrsIdToClient("12345-1", client); - - assertTrue(openmrsIDService.checkIfClientExists(client)); - - openmrsIDService.clearRecords(); - - assertFalse(openmrsIDService.checkIfClientExists(client)); - } - - @Test - public void testGetNotUsedId() throws Exception { - int size = 10; - List expectedList = createNotUsedUniqIdEntries(size); - List actualList = openmrsIDService.getNotUsedIds(100); - assertEquals(size, actualList.size()); - - for (int i = 0; i < size; i++) { - UniqueId expected = expectedList.get(i); - UniqueId actual = actualList.get(i); - assertUniqueId(expected, actual); - } - - } - - @Test - public void testGetNotUsedIdAsString() throws Exception { - int size = 10; - List ids = createNotUsedUniqIdEntries(size); - List expectedList = new ArrayList<>(); - List actualList = openmrsIDService.getNotUsedIdsAsString(100); - for (int i = 0; i < size; i++) { - expectedList.add(ids.get(i).getOpenmrsId()); - } - - assertEquals(size, actualList.size()); - assertEquals(expectedList, actualList); - } - - @Test - public void testMarkIdAsUsed() throws Exception { - int size = 10; - List ids = createNotUsedUniqIdEntries(size); - List idListAsString = new ArrayList<>(); - - for (int i = 0; i < size; i++) { - idListAsString.add(ids.get(i).getOpenmrsId()); - } - - int[] actualIds = openmrsIDService.markIdsAsUsed(idListAsString); - List actualList = openmrsIDService.getNotUsedIdsAsString(100); - - assertEquals(size, actualIds.length); - assertEquals(0, actualList.size()); - - } - - private List createNotUsedUniqIdEntries(int size) throws Exception { - List notUsedUniqueIds = new ArrayList<>(); - for (int i = 0; i < size; i++) { - UniqueId uniqueId = new UniqueId(); - uniqueId.setOpenmrsId(String.valueOf(i)); - uniqueId.setStatus(UniqueId.STATUS_NOT_USED); - uniqueId.setUsedBy("test" + i); - uniqueId.setCreatedAt(new Date()); - uniqueId.setLocation("test"); - notUsedUniqueIds.add(uniqueId); - uniqueIdRepository.save(uniqueId); - } - return notUsedUniqueIds; - } - - private void assertUniqueId(UniqueId expected, UniqueId actual) { - SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-mm-hh hh:MM"); - assertEquals(dateFormat.format(expected.getCreatedAt()), dateFormat.format(actual.getCreatedAt())); - assertEquals(expected.getLocation(), actual.getLocation()); - assertEquals(expected.getId(), actual.getId()); - assertEquals(expected.getOpenmrsId(), actual.getOpenmrsId()); - assertEquals(expected.getStatus(), actual.getStatus()); - assertEquals(expected.getUsedBy(), actual.getUsedBy()); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/OpenmrsIDServiceUsingMockTest.java b/opensrp-core/src/test/java/org/opensrp/service/OpenmrsIDServiceUsingMockTest.java deleted file mode 100644 index d52c48a752..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/OpenmrsIDServiceUsingMockTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.opensrp.service; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; -import static org.junit.Assert.assertNull; -import static org.mockito.Matchers.any; - -import java.io.IOException; -import java.util.List; - -import org.apache.http.HttpEntity; -import org.apache.http.util.EntityUtils; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.BDDMockito; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -@PrepareForTest(EntityUtils.class) -@PowerMockIgnore({ "org.apache.http.ssl.*", "javax.net.ssl.*", "org.apache.http.conn.ssl.*" }) -public class OpenmrsIDServiceUsingMockTest { - - OpenmrsIDService openmrsIDService; - - @Before - public void setUp() { - PowerMockito.mockStatic(EntityUtils.class); - - } - - @Ignore - @Test - public void testDownloadsOpenmrsIds() throws IOException { - openmrsIDService = OpenmrsIDService.createInstanceWithOpenMrsUrl("http://localhost/"); - String jsonResponse = "{\"identifiers\":[\"1\",\"2\"]}"; - BDDMockito.when(EntityUtils.toString(any(HttpEntity.class))).thenReturn(jsonResponse); - List ids = openmrsIDService.downloadOpenmrsIds(2); - assertEquals(2, ids.size()); - assertTrue(ids.contains("1")); - assertTrue(ids.contains("2")); - assertFalse(ids.contains("3")); - } - - @Ignore - @Test - public void testDownloadOpenmrsIdsWithInvalidUrl() { - openmrsIDService = OpenmrsIDService.createInstanceWithOpenMrsUrl(""); - List ids = openmrsIDService.downloadOpenmrsIds(2); - assertNull(ids); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/OrganizationServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/OrganizationServiceTest.java deleted file mode 100644 index 617fcce26c..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/OrganizationServiceTest.java +++ /dev/null @@ -1,283 +0,0 @@ -/** - * - */ -package org.opensrp.service; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.opensrp.domain.AssignedLocations; -import org.opensrp.domain.Organization; -import org.opensrp.domain.PhysicalLocation; -import org.opensrp.repository.LocationRepository; -import org.opensrp.repository.OrganizationRepository; -import org.opensrp.repository.PlanRepository; -import org.powermock.modules.junit4.PowerMockRunner; - -/** - * @author Samuel Githengi created on 09/17/19 - */ -@RunWith(PowerMockRunner.class) -public class OrganizationServiceTest { - - private OrganizationService organizationService; - - private OrganizationRepository organizationRepository; - - private PlanRepository planRepository; - - private LocationRepository locationRepository; - - private Organization organization; - - private String identifier = UUID.randomUUID().toString(); - - private ArgumentCaptor dateCaptor = ArgumentCaptor.forClass(Date.class); - - @Before - public void setUp() { - organizationRepository = mock(OrganizationRepository.class); - planRepository = mock(PlanRepository.class); - locationRepository = mock(LocationRepository.class); - organizationService = new OrganizationService(); - organizationService.setOrganizationRepository(organizationRepository); - organizationService.setPlanRepository(planRepository); - organizationService.setLocationRepository(locationRepository); - organization = new Organization(); - organization.setIdentifier(identifier); - - } - - @Test - public void testGetAllOrganizations() { - List expected = Collections.singletonList(organization); - when(organizationRepository.getAll()).thenReturn(expected); - List organizations = organizationService.getAllOrganizations(); - verify(organizationRepository).getAll(); - assertEquals(expected, organizations); - } - - @Test - public void testGetOrganization() { - when(organizationRepository.get(identifier)).thenReturn(organization); - Organization actual = organizationService.getOrganization(identifier); - verify(organizationRepository).get(identifier); - assertEquals(organization, actual); - } - - @Test - public void testGetOrganizationById() { - when(organizationRepository.getByPrimaryKey(1l)).thenReturn(organization); - Organization actual = organizationService.getOrganization(1l); - verify(organizationRepository).getByPrimaryKey(1l); - assertEquals(organization, actual); - } - - @Test - public void testAddOrUpdateOrganizationShouldAdd() { - organizationService.addOrUpdateOrganization(organization); - verify(organizationRepository).add(organization); - } - - @Test - public void testAddOrUpdateOrganizationShouldUpdate() { - when(organizationRepository.get(identifier)).thenReturn(organization); - organizationService.addOrUpdateOrganization(organization); - verify(organizationRepository).update(organization); - } - - @Test - public void testAddOrganization() { - organizationService.addOrganization(organization); - verify(organizationRepository).add(organization); - } - - @Test - public void testUpdateOrganization() { - organizationService.updateOrganization(organization); - verify(organizationRepository).update(organization); - } - - @Test(expected = IllegalArgumentException.class) - public void testUpdateOrganizationWithoutIdnetifier() { - organizationService.updateOrganization(new Organization()); - verify(organizationRepository, never()).update(organization); - } - - @Test(expected = IllegalArgumentException.class) - public void testAssignLocationAndPlanWithoutOrgId() { - organizationService.assignLocationAndPlan(null, "jurisdictionId", "planId", null, null); - verify(organizationRepository, never()).assignLocationAndPlan(anyLong(), anyString(), anyLong(), anyString(), - anyLong(), any(Date.class), any(Date.class)); - } - - @Test(expected = IllegalArgumentException.class) - public void testAssignLocationAndPlanWithoutJurisdictionAndPlan() { - organizationService.assignLocationAndPlan(identifier, null, null, null, null); - verify(organizationRepository, never()).assignLocationAndPlan(anyLong(), anyString(), anyLong(), anyString(), - anyLong(), any(Date.class), any(Date.class)); - } - - @Test - public void testAssignLocationAndPlan() { - when(organizationRepository.get(identifier)).thenReturn(organization); - organization.setId(1233l); - String planIdentifier = UUID.randomUUID().toString(); - String jurisdictionIdentifier = UUID.randomUUID().toString(); - Long planId = 54311l; - Long locationId = 123l; - PhysicalLocation location = new PhysicalLocation(); - location.setId(jurisdictionIdentifier); - when(locationRepository.retrievePrimaryKey(jurisdictionIdentifier, true)).thenReturn(locationId); - when(planRepository.retrievePrimaryKey(planIdentifier)).thenReturn(planId); - organizationService.assignLocationAndPlan(identifier, jurisdictionIdentifier, planIdentifier, null, null); - Date date = new Date(); - verify(organizationRepository).assignLocationAndPlan(eq(1233l), eq(jurisdictionIdentifier), eq(locationId), - eq(planIdentifier), eq(planId), dateCaptor.capture(), dateCaptor.capture()); - - assertEquals(date.toInstant().getEpochSecond(), dateCaptor.getAllValues().get(0).toInstant().getEpochSecond()); - - assertNull(dateCaptor.getAllValues().get(1)); - - Date dateFrom = new Date(); - Date dateTo = new Date(); - organizationService.assignLocationAndPlan(identifier, jurisdictionIdentifier, planIdentifier, dateFrom, dateTo); - verify(organizationRepository).assignLocationAndPlan(eq(1233l), eq(jurisdictionIdentifier), eq(locationId), - eq(planIdentifier), eq(planId), eq(dateFrom), eq(dateTo)); - - } - - @Test - public void testAssignLocationAndPlanWithoutPlan() { - when(organizationRepository.get(identifier)).thenReturn(organization); - organization.setId(1233l); - String planIdentifier = null; - String jurisdictionIdentifier = UUID.randomUUID().toString(); - Long locationId = 123l; - Long planId = null; - PhysicalLocation location = new PhysicalLocation(); - location.setId(jurisdictionIdentifier); - when(locationRepository.retrievePrimaryKey(jurisdictionIdentifier, true)).thenReturn(locationId); - when(planRepository.retrievePrimaryKey(planIdentifier)).thenReturn(planId); - Date dateFrom = new Date(); - Date dateTo = null; - organizationService.assignLocationAndPlan(identifier, jurisdictionIdentifier, planIdentifier, dateFrom, dateTo); - verify(organizationRepository).assignLocationAndPlan(eq(1233l), eq(jurisdictionIdentifier), eq(locationId), - eq(planIdentifier), eq(planId), eq(dateFrom), eq(dateTo)); - } - - @Test - public void testAssignLocationAndPlanWithoutJurisdiction() { - when(organizationRepository.get(identifier)).thenReturn(organization); - organization.setId(1233l); - String planIdentifier = UUID.randomUUID().toString(); - String jurisdictionIdentifier = null; - Long locationId = null; - Long planId = 19871l; - PhysicalLocation location = new PhysicalLocation(); - location.setId(jurisdictionIdentifier); - when(locationRepository.retrievePrimaryKey(jurisdictionIdentifier, true)).thenReturn(locationId); - when(planRepository.retrievePrimaryKey(planIdentifier)).thenReturn(planId); - Date dateFrom = new Date(); - Date dateTo = null; - organizationService.assignLocationAndPlan(identifier, jurisdictionIdentifier, planIdentifier, dateFrom, dateTo); - verify(organizationRepository).assignLocationAndPlan(eq(1233l), eq(jurisdictionIdentifier), eq(locationId), - eq(planIdentifier), eq(planId), eq(dateFrom), eq(dateTo)); - } - - - @Test(expected = IllegalArgumentException.class) - public void testAssignLocationAndPlanWithoutIdentifier() { - String planIdentifier = UUID.randomUUID().toString(); - String jurisdictionIdentifier = null; - organizationService.assignLocationAndPlan(null, jurisdictionIdentifier, planIdentifier, null, null); - verify(organizationRepository,never()).assignLocationAndPlan(anyLong(), eq(jurisdictionIdentifier), anyLong(), - eq(planIdentifier), anyLong(), any(Date.class), any(Date.class)); - } - - - @Test(expected = IllegalArgumentException.class) - public void testAssignLocationAndMissingOrganization() { - String planIdentifier = UUID.randomUUID().toString(); - String jurisdictionIdentifier = UUID.randomUUID().toString(); - when(organizationRepository.get(identifier)).thenReturn(null); - organizationService.assignLocationAndPlan(identifier, jurisdictionIdentifier, planIdentifier, null, null); - verify(organizationRepository,never()).assignLocationAndPlan(anyLong(), eq(jurisdictionIdentifier), anyLong(), - eq(planIdentifier), anyLong(), any(Date.class), any(Date.class)); - } - - @Test - public void testFindAssignedLocationsAndPlans() { - organization.setId(12l); - AssignedLocations assigment = new AssignedLocations("loc1", "plan1"); - List expected = Collections.singletonList(assigment); - when(organizationRepository.findAssignedLocations(12l)).thenReturn(expected); - when(organizationRepository.get(identifier)).thenReturn(organization); - List assigned = organizationService.findAssignedLocationsAndPlans(identifier); - assertEquals(expected, assigned); - verify(organizationRepository).findAssignedLocations(12l); - } - - @Test(expected = IllegalArgumentException.class) - public void testFindAssignedLocationsAndPlansOrganitionMissing() { - organization.setId(12l); - organizationService.findAssignedLocationsAndPlans(identifier); - verify(organizationRepository, never()).findAssignedLocations(anyLong()); - - } - - @Test - public void testFindAssignedLocationsAndPlansWithMultipleIds() { - List organizationIds = Arrays.asList(12l, 34l, 45l); - AssignedLocations assigment = new AssignedLocations("loc1", "plan1"); - List expected = Collections.singletonList(assigment); - when(organizationRepository.findAssignedLocations(organizationIds)).thenReturn(expected); - List assigned = organizationService.findAssignedLocationsAndPlans(organizationIds); - assertEquals(expected, assigned); - verify(organizationRepository).findAssignedLocations(organizationIds); - } - - @Test - public void testFindAssignedLocationsAndPlansByPlanIdentifier() { - AssignedLocations assigment = new AssignedLocations("loc1", "plan1"); - List expected = Collections.singletonList(assigment); - when(planRepository.retrievePrimaryKey(anyString())).thenReturn(1l); - when(organizationRepository.findAssignedLocationsByPlanId(1l)).thenReturn(expected); - List assigned = organizationService.findAssignedLocationsAndPlansByPlanIdentifier(identifier); - assertEquals(expected, assigned); - verify(organizationRepository).findAssignedLocationsByPlanId(1l); - } - - @Test(expected = IllegalArgumentException.class) - public void testFindAssignedLocationsAndPlansByPlanIdentifierWithNullParam() { - organizationService.findAssignedLocationsAndPlansByPlanIdentifier(null); - verify(organizationRepository, never()).findAssignedLocations(anyLong()); - } - - @Test(expected = IllegalArgumentException.class) - public void testFindAssignedLocationsAndPlansByPlanIdentifierMissingPlan() { - when(planRepository.retrievePrimaryKey(anyString())).thenReturn(null); - - organizationService.findAssignedLocationsAndPlansByPlanIdentifier("plan-id-1"); - verify(organizationRepository, never()).findAssignedLocations(anyLong()); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/PhysicalLocationServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/PhysicalLocationServiceTest.java deleted file mode 100644 index 3c7c0879ef..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/PhysicalLocationServiceTest.java +++ /dev/null @@ -1,525 +0,0 @@ -package org.opensrp.service; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import org.opensrp.domain.Geometry.GeometryType; -import org.opensrp.domain.LocationDetail; -import org.opensrp.domain.LocationProperty.PropertyStatus; -import org.opensrp.domain.PhysicalLocation; -import org.opensrp.domain.PhysicalLocationTest; -import org.opensrp.domain.StructureDetails; -import org.opensrp.repository.LocationRepository; -import org.powermock.modules.junit4.PowerMockRunner; - -import com.google.gson.JsonArray; - -@RunWith(PowerMockRunner.class) -public class PhysicalLocationServiceTest { - - private PhysicalLocationService locationService; - - private LocationRepository locationRepository; - - private ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(PhysicalLocation.class); - - @Before - public void setUp() { - locationRepository = mock(LocationRepository.class); - locationService = new PhysicalLocationService(); - locationService.setLocationRepository(locationRepository); - } - - @Test - public void testGetLocation() { - when(locationRepository.get("3734", true)).thenReturn(createLocation()); - PhysicalLocation parentLocation = locationService.getLocation("3734", true); - verify(locationRepository).get("3734", true); - verifyNoMoreInteractions(locationRepository); - - assertEquals("3734", parentLocation.getId()); - assertEquals("Feature", parentLocation.getType()); - assertEquals(GeometryType.MULTI_POLYGON, parentLocation.getGeometry().getType()); - - assertEquals("21", parentLocation.getProperties().getParentId()); - assertEquals("01_5", parentLocation.getProperties().getName()); - assertEquals("41587456-b7c8-4c4e-b433-23a786f742fc", parentLocation.getProperties().getUid()); - assertEquals("3734", parentLocation.getProperties().getCode()); - - assertFalse(parentLocation.getGeometry().getCoordinates().isJsonNull()); - JsonArray coordinates = parentLocation.getGeometry().getCoordinates().get(0).getAsJsonArray().get(0) - .getAsJsonArray(); - assertEquals(267, coordinates.size()); - - JsonArray coordinate1 = coordinates.get(0).getAsJsonArray(); - assertEquals(32.59989007736522, coordinate1.get(0).getAsDouble(), 0); - assertEquals(-14.167432040756012, coordinate1.get(1).getAsDouble(), 0); - - JsonArray coordinate67 = coordinates.get(66).getAsJsonArray(); - assertEquals(32.5988341383848, coordinate67.get(0).getAsDouble(), 0); - assertEquals(-14.171814074659776, coordinate67.get(1).getAsDouble(), 0); - - } - - @Test - public void testGetStructure() throws ParseException { - - when(locationRepository.getStructure("90397", true)).thenReturn(createStructure()); - PhysicalLocation structure = locationService.getStructure("90397", true); - verify(locationRepository).getStructure("90397", true); - verifyNoMoreInteractions(locationRepository); - - assertEquals("Feature", structure.getType()); - assertEquals("90397", structure.getId()); - - assertEquals(GeometryType.POLYGON, structure.getGeometry().getType()); - assertFalse(structure.getGeometry().getCoordinates().isJsonNull()); - - assertEquals("41587456-b7c8-4c4e-b433-23a786f742fc", structure.getProperties().getUid()); - assertEquals("21384443", structure.getProperties().getCode()); - assertEquals("Residential Structure", structure.getProperties().getType()); - assertEquals(PropertyStatus.ACTIVE, structure.getProperties().getStatus()); - assertEquals("3734", structure.getProperties().getParentId()); - assertNull(structure.getProperties().getName()); - assertEquals(5, structure.getProperties().getGeographicLevel()); - assertEquals(new SimpleDateFormat("yyyy-MM-dd").parse("2017-01-10"), - structure.getProperties().getEffectiveStartDate()); - assertNull(structure.getProperties().getEffectiveEndDate()); - assertEquals(0, structure.getProperties().getVersion()); - } - - @Test - public void testGetAllLocations() { - List expected = new ArrayList<>(); - expected.add(createLocation()); - when(locationRepository.getAll()).thenReturn(expected); - List locations = locationService.getAllLocations(); - verify(locationRepository).getAll(); - verifyNoMoreInteractions(locationRepository); - - assertEquals(1, locations.size()); - PhysicalLocation parentLocation = locations.get(0); - assertEquals("3734", parentLocation.getId()); - assertEquals("Feature", parentLocation.getType()); - assertEquals(GeometryType.MULTI_POLYGON, parentLocation.getGeometry().getType()); - - assertEquals("21", parentLocation.getProperties().getParentId()); - assertEquals("01_5", parentLocation.getProperties().getName()); - assertEquals("41587456-b7c8-4c4e-b433-23a786f742fc", parentLocation.getProperties().getUid()); - assertEquals("3734", parentLocation.getProperties().getCode()); - } - - @Test - public void testAddOrUpdateShouldAddLocation() { - when(locationRepository.get("3734")).thenReturn(null); - locationService.addOrUpdate(createLocation()); - verify(locationRepository).add(argumentCaptor.capture()); - - PhysicalLocation parentLocation = argumentCaptor.getValue(); - assertEquals("3734", parentLocation.getId()); - assertEquals("Feature", parentLocation.getType()); - assertEquals(GeometryType.MULTI_POLYGON, parentLocation.getGeometry().getType()); - - assertEquals("21", parentLocation.getProperties().getParentId()); - assertEquals("01_5", parentLocation.getProperties().getName()); - assertEquals("41587456-b7c8-4c4e-b433-23a786f742fc", parentLocation.getProperties().getUid()); - assertEquals("3734", parentLocation.getProperties().getCode()); - - } - - @Test - public void testAddOrUpdateShouldUpdateLocation() { - PhysicalLocation physicalLocation = createLocation(); - when(locationRepository.get("3734", true)).thenReturn(physicalLocation); - locationService.addOrUpdate(createLocation()); - verify(locationRepository).update(argumentCaptor.capture()); - - PhysicalLocation parentLocation = argumentCaptor.getValue(); - assertEquals("3734", parentLocation.getId()); - assertEquals("Feature", parentLocation.getType()); - assertEquals(GeometryType.MULTI_POLYGON, parentLocation.getGeometry().getType()); - - assertEquals("21", parentLocation.getProperties().getParentId()); - assertEquals("01_5", parentLocation.getProperties().getName()); - assertEquals("41587456-b7c8-4c4e-b433-23a786f742fc", parentLocation.getProperties().getUid()); - assertEquals("3734", parentLocation.getProperties().getCode()); - - } - - @Test(expected = IllegalArgumentException.class) - public void testAddOrUpdateWithNullId() { - PhysicalLocation physicalLocation = createLocation(); - physicalLocation.setId(null); - locationService.addOrUpdate(physicalLocation); - - } - - @Test - public void testAddOrUpdateShouldAddStructure() throws ParseException { - when(locationRepository.getStructure("90397", true)).thenReturn(null); - locationService.addOrUpdate(createStructure()); - verify(locationRepository).add(argumentCaptor.capture()); - - PhysicalLocation structure = argumentCaptor.getValue(); - - assertEquals(GeometryType.POLYGON, structure.getGeometry().getType()); - assertFalse(structure.getGeometry().getCoordinates().isJsonNull()); - - assertEquals("41587456-b7c8-4c4e-b433-23a786f742fc", structure.getProperties().getUid()); - assertEquals("21384443", structure.getProperties().getCode()); - assertEquals("Residential Structure", structure.getProperties().getType()); - assertEquals(PropertyStatus.ACTIVE, structure.getProperties().getStatus()); - assertEquals("3734", structure.getProperties().getParentId()); - assertNull(structure.getProperties().getName()); - assertEquals(5, structure.getProperties().getGeographicLevel()); - assertEquals(new SimpleDateFormat("yyyy-MM-dd").parse("2017-01-10"), - structure.getProperties().getEffectiveStartDate()); - assertNull(structure.getProperties().getEffectiveEndDate()); - assertEquals(0, structure.getProperties().getVersion()); - } - - @Test - public void testAddOrUpdateShouldUpdateStructure() throws ParseException { - PhysicalLocation physicalLocation = createStructure(); - when(locationRepository.getStructure("90397", true)).thenReturn(physicalLocation); - locationService.addOrUpdate(physicalLocation); - verify(locationRepository).update(argumentCaptor.capture()); - - PhysicalLocation structure = argumentCaptor.getValue(); - - assertEquals(GeometryType.POLYGON, structure.getGeometry().getType()); - assertFalse(structure.getGeometry().getCoordinates().isJsonNull()); - - assertEquals("41587456-b7c8-4c4e-b433-23a786f742fc", structure.getProperties().getUid()); - assertEquals("21384443", structure.getProperties().getCode()); - assertEquals("Residential Structure", structure.getProperties().getType()); - assertEquals(PropertyStatus.ACTIVE, structure.getProperties().getStatus()); - assertEquals("3734", structure.getProperties().getParentId()); - assertNull(structure.getProperties().getName()); - assertEquals(5, structure.getProperties().getGeographicLevel()); - assertEquals(new SimpleDateFormat("yyyy-MM-dd").parse("2017-01-10"), - structure.getProperties().getEffectiveStartDate()); - assertNull(structure.getProperties().getEffectiveEndDate()); - assertEquals(0, structure.getProperties().getVersion()); - - } - - @Test - public void testAdd() { - PhysicalLocation expected = createStructure(); - locationService.add(expected); - verify(locationRepository).add(argumentCaptor.capture()); - assertNull(argumentCaptor.getValue().getServerVersion()); - - PhysicalLocation structure = argumentCaptor.getValue(); - - assertEquals(GeometryType.POLYGON, structure.getGeometry().getType()); - assertFalse(structure.getGeometry().getCoordinates().isJsonNull()); - - assertEquals("41587456-b7c8-4c4e-b433-23a786f742fc", structure.getProperties().getUid()); - assertEquals("21384443", structure.getProperties().getCode()); - assertEquals("Residential Structure", structure.getProperties().getType()); - - } - - @Test(expected = IllegalArgumentException.class) - public void testAddWithNullId() { - PhysicalLocation physicalLocation = new PhysicalLocation(); - locationService.add(physicalLocation); - } - - @Test - public void testUpdate() { - - PhysicalLocation expected = createLocation(); - locationService.update(expected); - verify(locationRepository).update(argumentCaptor.capture()); - assertNull(argumentCaptor.getValue().getServerVersion()); - - PhysicalLocation parentLocation = argumentCaptor.getValue(); - assertEquals("3734", parentLocation.getId()); - assertEquals("Feature", parentLocation.getType()); - assertEquals(GeometryType.MULTI_POLYGON, parentLocation.getGeometry().getType()); - - assertEquals("21", parentLocation.getProperties().getParentId()); - assertEquals("01_5", parentLocation.getProperties().getName()); - assertEquals("41587456-b7c8-4c4e-b433-23a786f742fc", parentLocation.getProperties().getUid()); - assertEquals("3734", parentLocation.getProperties().getCode()); - - } - - @Test(expected = IllegalArgumentException.class) - public void testUpdateWithNullId() { - PhysicalLocation physicalLocation = new PhysicalLocation(); - locationService.update(physicalLocation); - } - - @Test - public void testFindLocationsByServerVersion() { - List expected = new ArrayList<>(); - expected.add(createLocation()); - when(locationRepository.findLocationsByServerVersion(123l)).thenReturn(expected); - - List locations = locationService.findLocationsByServerVersion(123l); - verify(locationRepository).findLocationsByServerVersion(123l); - verifyNoMoreInteractions(locationRepository); - - assertEquals(1, locations.size()); - PhysicalLocation parentLocation = locations.get(0); - assertEquals("3734", parentLocation.getId()); - assertEquals("Feature", parentLocation.getType()); - assertEquals(GeometryType.MULTI_POLYGON, parentLocation.getGeometry().getType()); - - assertEquals("21", parentLocation.getProperties().getParentId()); - assertEquals("01_5", parentLocation.getProperties().getName()); - assertEquals("41587456-b7c8-4c4e-b433-23a786f742fc", parentLocation.getProperties().getUid()); - assertEquals("3734", parentLocation.getProperties().getCode()); - - } - - @Test - public void testFindLocationsByNames() { - String locationNames = "01_5"; - List expected = new ArrayList<>(); - List locations; - - locations = locationService.findLocationsByNames(locationNames, 0l); - assertEquals(0, locations.size()); - - expected.add(createLocation()); - when(locationService.findLocationsByNames(locationNames, 0l)).thenReturn(expected); - locations = locationService.findLocationsByNames(locationNames, 0l); - assertEquals(1, locations.size()); - PhysicalLocation location = locations.get(0); - assertEquals("01_5", location.getProperties().getName()); - assertEquals("Feature", location.getType()); - assertEquals("3734", location.getId()); - assertEquals(GeometryType.MULTI_POLYGON, location.getGeometry().getType()); - -// search with more than one name - locationNames = "01_5,other_location_name"; - when(locationService.findLocationsByNames(locationNames, 0l)).thenReturn(expected); - locations = locationService.findLocationsByNames(locationNames, 0l); - assertEquals(1, locations.size()); - location = locations.get(0); - assertEquals("01_5", location.getProperties().getName()); - assertEquals("Feature", location.getType()); - assertEquals("3734", location.getId()); - assertEquals(GeometryType.MULTI_POLYGON, location.getGeometry().getType()); - - } - - @Test - public void testFindStructuresByParentAndServerVersion() { - - List expected = new ArrayList<>(); - expected.add(createStructure()); - - when(locationRepository.findStructuresByParentAndServerVersion("3734", 15622112121L)).thenReturn(expected); - - List locations = locationService.findStructuresByParentAndServerVersion("3734", 15622112121L); - verify(locationRepository).findStructuresByParentAndServerVersion("3734", 15622112121L); - verifyNoMoreInteractions(locationRepository); - - assertEquals(1, locations.size()); - PhysicalLocation structure = locations.get(0); - - assertEquals("41587456-b7c8-4c4e-b433-23a786f742fc", structure.getProperties().getUid()); - assertEquals("21384443", structure.getProperties().getCode()); - assertEquals("Residential Structure", structure.getProperties().getType()); - - when(locationRepository.findStructuresByParentAndServerVersion("3734,001", 15622112121L)).thenReturn(expected); - locations = locationService.findStructuresByParentAndServerVersion("3734,001", 15622112121L); - verify(locationRepository).findStructuresByParentAndServerVersion("3734,001", 15622112121L); - verifyNoMoreInteractions(locationRepository); - assertEquals(1, locations.size()); - structure = locations.get(0); - assertEquals("41587456-b7c8-4c4e-b433-23a786f742fc", structure.getProperties().getUid()); - assertEquals("21384443", structure.getProperties().getCode()); - assertEquals("Residential Structure", structure.getProperties().getType()); - - } - - @Test(expected = IllegalArgumentException.class) - public void testFindStructuresByParentAndServerVersionWithoutParentID() { - - locationService.findStructuresByParentAndServerVersion("", 15622112121L); - - } - - @Test - public void testAddServerVersion() { - - List expectedLocations = new ArrayList<>(); - expectedLocations.add(createLocation()); - - List expectedStructures = new ArrayList<>(); - expectedStructures.add(createStructure()); - - when(locationRepository.findByEmptyServerVersion()).thenReturn(expectedLocations); - when(locationRepository.findStructuresByEmptyServerVersion()).thenReturn(expectedStructures); - - long now = System.currentTimeMillis(); - locationService.addServerVersion(); - - verify(locationRepository).findByEmptyServerVersion(); - verify(locationRepository).findStructuresByEmptyServerVersion(); - - verify(locationRepository, times(2)).update(argumentCaptor.capture()); - assertEquals(2, argumentCaptor.getAllValues().size()); - for (PhysicalLocation location : argumentCaptor.getAllValues()) - assertTrue(location.getServerVersion() >= now); - - } - - @Test - public void testSaveLocations() { - - List expectedLocations = new ArrayList<>(); - PhysicalLocation physicalLocation = createStructure(); - physicalLocation.setId("12323"); - expectedLocations.add(physicalLocation); - expectedLocations.add(createStructure()); - expectedLocations.add(createStructure()); - - when(locationRepository.get("12323", true)).thenReturn(physicalLocation); - locationService.saveLocations(expectedLocations, true); - - verify(locationRepository, times(2)).add(argumentCaptor.capture()); - verify(locationRepository, times(1)).update(argumentCaptor.capture()); - for (PhysicalLocation location : argumentCaptor.getAllValues()) { - assertTrue(location.isJurisdiction()); - assertNull(location.getServerVersion()); - } - - } - - @Test - public void testFindStructuresWithinRadius() { - - double latitude = -14.1619809; - double longitude = 32.5978597; - - Collection expectedDetails = new ArrayList<>(); - - StructureDetails structure = new StructureDetails(UUID.randomUUID().toString(), "3221", "Mosquito Point"); - expectedDetails.add(structure); - - when(locationRepository.findStructureAndFamilyDetails(Mockito.anyDouble(), Mockito.anyDouble(), - Mockito.anyDouble())).thenReturn(expectedDetails); - Collection detailsFromService = locationService.findStructuresWithinRadius(latitude, - longitude, 1000); - - assertEquals(expectedDetails, detailsFromService); - verify(locationRepository).findStructureAndFamilyDetails(latitude, longitude, 1000); - - } - - @Test - public void testFindLocationsByProperties() { - List expectedLocations = Collections.singletonList(createLocation()); - - String parentId = UUID.randomUUID().toString(); - Map properties = new HashMap<>(); - when(locationRepository.findLocationsByProperties(true, parentId, properties)).thenReturn(expectedLocations); - List locations = locationService.findLocationsByProperties(true, parentId, properties); - verify(locationRepository).findLocationsByProperties(true, parentId, properties); - assertEquals(1, locations.size()); - assertEquals(expectedLocations, locations); - - } - - @Test - public void testFindStructuresByProperties() { - List expectedLocations = Collections.singletonList(createStructure()); - String parentId = UUID.randomUUID().toString(); - Map properties = new HashMap<>(); - when(locationRepository.findStructuresByProperties(false, parentId, properties)).thenReturn(expectedLocations); - List locations = locationService.findStructuresByProperties(false, parentId, properties); - verify(locationRepository).findStructuresByProperties(false, parentId, properties); - assertEquals(1, locations.size()); - assertEquals(expectedLocations, locations); - } - - @Test - public void testFindLocationsById() { - List expectedLocations = Collections.singletonList(createLocation()); - - List locationIds = new ArrayList<>(); - when(locationRepository.findLocationsByIds(true, locationIds)).thenReturn(expectedLocations); - List locations = locationService.findLocationsByIds(true, locationIds); - verify(locationRepository).findLocationsByIds(true, locationIds); - assertEquals(1, locations.size()); - assertEquals(expectedLocations, locations); - - } - - @Test - public void testFindAllStructureIds() { - List expectedStructureIds = new ArrayList<>(); - expectedStructureIds.add("Structure-1"); - expectedStructureIds.add("Structure-2"); - - when(locationRepository.findAllStructureIds()).thenReturn(expectedStructureIds); - List actualStructureIds = locationService.findAllStructureIds(); - - verify(locationRepository).findAllStructureIds(); - assertEquals(2, actualStructureIds.size()); - assertEquals(expectedStructureIds.get(0).toString(), actualStructureIds.get(0).toString()); - assertEquals(expectedStructureIds.get(1).toString(), actualStructureIds.get(1).toString()); - - } - - @Test - public void testFindLocationDetailsByPlanId() { - List expectedLocationDetails = new ArrayList<>(); - LocationDetail locationDetail = new LocationDetail(); - locationDetail.setIdentifier("identifier-1"); - locationDetail.setName("location-one"); - expectedLocationDetails.add(locationDetail); - - when(locationRepository.findLocationDetailsByPlanId("identifier-1")).thenReturn(expectedLocationDetails); - List actualLocationDetails = locationService.findLocationDetailsByPlanId("identifier-1"); - - verify(locationRepository).findLocationDetailsByPlanId(anyString()); - assertEquals(1, actualLocationDetails.size()); - assertEquals(actualLocationDetails.get(0).getIdentifier(), "identifier-1"); - assertEquals(actualLocationDetails.get(0).getName(), "location-one"); - - } - - private PhysicalLocation createLocation() { - PhysicalLocation parentLocation = PhysicalLocationTest.gson.fromJson(PhysicalLocationTest.parentJson, - PhysicalLocation.class); - parentLocation.setJurisdiction(true); - return parentLocation; - } - - private PhysicalLocation createStructure() { - return PhysicalLocationTest.gson.fromJson(PhysicalLocationTest.structureJson, PhysicalLocation.class); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/PlanServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/PlanServiceTest.java deleted file mode 100644 index ca620db48d..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/PlanServiceTest.java +++ /dev/null @@ -1,184 +0,0 @@ -package org.opensrp.service; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnit; -import org.mockito.junit.MockitoRule; -import org.opensrp.domain.AssignedLocations; -import org.opensrp.domain.PlanDefinition; -import org.opensrp.domain.postgres.PractitionerRole; -import org.opensrp.repository.PlanRepository; - -/** - * Created by Vincent Karuri on 06/05/2019 - */ -public class PlanServiceTest { - - @Rule - public MockitoRule rule = MockitoJUnit.rule(); - - private PlanService planService; - - @Mock - private PlanRepository planRepository; - - @Mock - private PractitionerService practitionerService; - - @Mock - private PractitionerRoleService practitionerRoleService; - - @Mock - private OrganizationService organizationService; - - @Before - public void setUp() { - planService = new PlanService(planRepository, practitionerService, practitionerRoleService, organizationService); - } - - @Test - public void testGetAllPlansShouldCallRepositoryGetAllMethod() { - planService.getAllPlans(); - verify(planRepository).getAll(); - } - - @Test - public void testAddOrUpdatePlanShouldCallRepositoryAddMethod() { - when(planRepository.get(anyString())).thenReturn(null); - PlanDefinition plan = new PlanDefinition(); - plan.setIdentifier("identifier"); - planService.addOrUpdatePlan(plan); - verify(planRepository).add(eq(plan)); - } - - @Test - public void testAddOrUpdatePlanShouldCallRepositoryUpdateMethod() { - when(planRepository.get(anyString())).thenReturn(new PlanDefinition()); - PlanDefinition plan = new PlanDefinition(); - plan.setIdentifier("identifier"); - planService.addOrUpdatePlan(plan); - verify(planRepository).update(eq(plan)); - } - - @Test - public void testAddPlanShouldCallRepositoryAddMethod() { - when(planRepository.get(anyString())).thenReturn(null); - PlanDefinition plan = new PlanDefinition(); - plan.setIdentifier("identifier"); - planService.addPlan(plan); - verify(planRepository).add(eq(plan)); - } - - @Test - public void updatePlanShouldCallRepositoryUpdateMethod() { - when(planRepository.get(anyString())).thenReturn(new PlanDefinition()); - PlanDefinition plan = new PlanDefinition(); - plan.setIdentifier("identifier"); - planService.updatePlan(plan); - verify(planRepository).update(eq(plan)); - } - - @Test - public void testGetPlanShouldCallRepositoryGetMethod() { - when(planRepository.get(anyString())).thenReturn(new PlanDefinition()); - planService.getPlan("identifier"); - verify(planRepository).get(eq("identifier")); - } - - @Test - public void testGetPlansByServerVersionAndOperationalAreaShouldCallRepositoryGetPlansByServerVersionAndOperationalAreaMethod() { - when(planRepository.getPlansByServerVersionAndOperationalAreas(anyLong(), any(List.class))) - .thenReturn(new ArrayList()); - List operationalAreaIds = new ArrayList<>(); - operationalAreaIds.add("operation_area_1"); - planService.getPlansByServerVersionAndOperationalArea(0l, operationalAreaIds); - verify(planRepository).getPlansByServerVersionAndOperationalAreas(eq(0l), eq(operationalAreaIds)); - } - - @Test - public void testGetPlansByIdsReturnOptionalFields() { - List ids = Arrays.asList("plan1", "plan2"); - List fields = Arrays.asList("name", "action"); - List expected = Collections.singletonList(new PlanDefinition()); - when(planRepository.getPlansByIdsReturnOptionalFields(ids, fields)).thenReturn(expected); - List plans = planService.getPlansByIdsReturnOptionalFields(ids, fields); - verify(planRepository).getPlansByIdsReturnOptionalFields(ids, fields); - assertEquals(expected, plans); - } - - @Test - public void testGetPlansByOrganizationsAndServerVersion() { - - List planIdentifiers = Arrays.asList("plan1", "plan2"); - List assignedLocations = new ArrayList(); - for (String id : planIdentifiers) { - AssignedLocations assignedLocation = new AssignedLocations(); - assignedLocation.setPlanId(id); - assignedLocations.add(assignedLocation); - } - List organizationIds = Arrays.asList(1l, 40l); - long serverVersion = 1234l; - List expected = Collections.singletonList(new PlanDefinition()); - when(organizationService.findAssignedLocationsAndPlans(organizationIds)) - .thenReturn(assignedLocations); - when(planRepository.getPlansByIdentifiersAndServerVersion(planIdentifiers, serverVersion)) - .thenReturn(expected); - List plans = planService.getPlansByOrganizationsAndServerVersion(organizationIds, serverVersion); - verify(planRepository).getPlansByIdentifiersAndServerVersion(planIdentifiers, serverVersion); - verify(organizationService).findAssignedLocationsAndPlans(organizationIds); - assertEquals(expected, plans); - } - - - - @Test - public void testGetPlansByUsernameAndServerVersion() { - - List planIdentifiers = Arrays.asList("plan1", "plan2"); - List assignedLocations = new ArrayList(); - for (String id : planIdentifiers) { - AssignedLocations assignedLocation = new AssignedLocations(); - assignedLocation.setPlanId(id); - assignedLocations.add(assignedLocation); - } - List organizationIds = Arrays.asList(11l, 40l,7667l); - long serverVersion = 1234l; - - org.opensrp.domain.Practitioner practitioner = new org.opensrp.domain.Practitioner(); - practitioner.setIdentifier("practioner-1"); - - List roles = new ArrayList<>(); - for(long id:organizationIds) { - PractitionerRole role = new PractitionerRole(); - role.setOrganizationId(id); - roles.add(role); - } - - List expected = Collections.singletonList(new PlanDefinition()); - when(organizationService.findAssignedLocationsAndPlans(organizationIds)) - .thenReturn(assignedLocations); - when(planRepository.getPlansByIdentifiersAndServerVersion(planIdentifiers, serverVersion)) - .thenReturn(expected); - when(practitionerService.getPractionerByUsername("janedoe")).thenReturn(practitioner); - when(practitionerRoleService.getPgRolesForPractitioner(practitioner.getIdentifier())).thenReturn(roles); - List plans = planService.getPlansByUsernameAndServerVersion("janedoe", serverVersion); - verify(planRepository).getPlansByIdentifiersAndServerVersion(planIdentifiers, serverVersion); - verify(organizationService).findAssignedLocationsAndPlans(organizationIds); - assertEquals(expected, plans); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/PractitionerRoleServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/PractitionerRoleServiceTest.java deleted file mode 100644 index 9e443c0e7f..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/PractitionerRoleServiceTest.java +++ /dev/null @@ -1,208 +0,0 @@ -package org.opensrp.service; - -import java.util.Collections; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.domain.Organization; -import org.opensrp.domain.PractitionerRole; -import org.opensrp.domain.PractitionerRoleCode; -import org.opensrp.repository.PractitionerRoleRepository; -import org.powermock.modules.junit4.PowerMockRunner; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -@RunWith(PowerMockRunner.class) -public class PractitionerRoleServiceTest { - - private PractitionerRoleService practitionerRoleService; - - private PractitionerRoleRepository practitionerRoleRepository; - - private OrganizationService organizationService; - - private PractitionerService practitionerService; - - @Before - public void setUp() { - practitionerRoleRepository = mock(PractitionerRoleRepository.class); - practitionerRoleService = new PractitionerRoleService(); - practitionerRoleService.setPractitionerRoleRepository(practitionerRoleRepository); - organizationService = mock(OrganizationService.class); - practitionerRoleService.setOrganizationService(organizationService); - practitionerService = mock(PractitionerService.class); - practitionerRoleService.setPractitionerService(practitionerService); - } - - @Test - public void testGetAllPractitionerRoles() { - List expectedPractitionerRoles = new ArrayList<>(); - expectedPractitionerRoles.add(initTestPractitionerRole()); - when(practitionerRoleRepository.getAll()).thenReturn(expectedPractitionerRoles); - - List actutalPractitionerRoles = practitionerRoleService.getAllPractitionerRoles(); - verify(practitionerRoleRepository).getAll(); - assertEquals(1, actutalPractitionerRoles.size()); - assertEquals("pr1-identifier", actutalPractitionerRoles.get(0).getIdentifier()); - } - - @Test - public void testGetPractitionerRoleByIdentifier() { - PractitionerRole expectedPractitionerRole = initTestPractitionerRole(); - when(practitionerRoleRepository.get(anyString())).thenReturn(expectedPractitionerRole); - - PractitionerRole actutalPractitionerRole = practitionerRoleService.getPractitionerRole(expectedPractitionerRole.getIdentifier()); - verify(practitionerRoleRepository).get(anyString()); - assertNotNull(actutalPractitionerRole); - assertEquals("pr1-identifier", actutalPractitionerRole.getIdentifier()); - } - - @Test - public void testAddOrUpdateShouldCallRepostoryAddMethod() { - when(practitionerRoleRepository.get(anyString())).thenReturn(null); - PractitionerRole practitionerRole = initTestPractitionerRole(); - practitionerRoleService.addOrUpdatePractitionerRole(practitionerRole); - verify(practitionerRoleRepository).add(eq(practitionerRole)); - } - - @Test - public void testAddOrUpdateShouldCallRepostoryUpdateMethod() { - when(practitionerRoleRepository.get(anyString())).thenReturn(initTestPractitionerRole()); - PractitionerRole practitionerRole = initTestPractitionerRole(); - practitionerRoleService.addOrUpdatePractitionerRole(practitionerRole); - verify(practitionerRoleRepository).update(eq(practitionerRole)); - } - - @Test(expected = IllegalArgumentException.class) - public void testAddOrUpdateWithNullIdentifier() { - when(practitionerRoleRepository.get(anyString())).thenReturn(initTestPractitionerRole()); - PractitionerRole practitionerRole = initTestPractitionerRole(); - practitionerRole.setIdentifier(null); - practitionerRoleService.addOrUpdatePractitionerRole(practitionerRole); - verify(practitionerRoleRepository, never()).update(eq(practitionerRole)); - } - - @Test - public void testDeleteShouldCallRepostorySafeRemoveMethod() { - when(practitionerRoleRepository.get(anyString())).thenReturn(initTestPractitionerRole()); - PractitionerRole practitionerRole = initTestPractitionerRole(); - practitionerRoleService.deletePractitionerRole(practitionerRole); - verify(practitionerRoleRepository).safeRemove(eq(practitionerRole)); - } - - @Test(expected = IllegalArgumentException.class) - public void testDeleteWithNullIdentifier() { - PractitionerRole practitionerRole = initTestPractitionerRole(); - practitionerRole.setIdentifier(null); - practitionerRoleService.deletePractitionerRole(practitionerRole); - verify(practitionerRoleRepository, never()).safeRemove(eq(practitionerRole)); - } - - @Test(expected = IllegalArgumentException.class) - public void testDeleteByIdentifierWithEmptyIdentifier() { - practitionerRoleService.deletePractitionerRole(""); - verify(practitionerRoleRepository, never()).safeRemove(eq(any(String.class))); - } - - @Test - public void testDeleteByIdentifierShouldCallRepostorySafeRemoveMethod() { - when(practitionerRoleRepository.get(anyString())).thenReturn(initTestPractitionerRole()); - PractitionerRole practitionerRole = initTestPractitionerRole(); - practitionerRoleService.deletePractitionerRole(practitionerRole.getIdentifier()); - verify(practitionerRoleRepository).safeRemove(eq(practitionerRole.getIdentifier())); - } - - @Test(expected = IllegalArgumentException.class) - public void testDeleteByOrganizationAndPractitionerWithNullValues() { - practitionerRoleService.deletePractitionerRole(null, null); - verify(practitionerRoleRepository, never()).safeRemove(any(Long.class), any(Long.class)); - } - - @Test - public void testDeleteByOrganizationAndPractitionerShouldCallRepostorySafeRemoveMethod() { - - when(practitionerRoleRepository.getPractitionerRole(anyLong(), anyLong() )) - .thenReturn(Collections.singletonList(new org.opensrp.domain.postgres.PractitionerRole())); - - Organization organization = new Organization(); - organization.setId(1l); - when(organizationService.getOrganization(anyString())).thenReturn(organization); - - org.opensrp.domain.postgres.Practitioner pgPractitioner = new org.opensrp.domain.postgres.Practitioner(); - pgPractitioner.setId(2l); - - when(practitionerService.getPgPractitioner(anyString())).thenReturn(pgPractitioner); - - PractitionerRole practitionerRole = initTestPractitionerRole(); - practitionerRoleService.deletePractitionerRole(practitionerRole.getIdentifier(), practitionerRole.getOrganizationIdentifier()); - verify(practitionerRoleRepository).safeRemove(anyLong(), anyLong()); - } - - - @Test - public void testGetRolesForPractitionerShouldCallGetRolesForPractitionerMethod() { - List expectedPractitionerRoles = new ArrayList<>(); - expectedPractitionerRoles.add(initTestPractitionerRole()); - when(practitionerRoleRepository.getRolesForPractitioner(anyString())).thenReturn(expectedPractitionerRoles); - - List actutalPractitionerRoles = practitionerRoleService.getRolesForPractitioner("identifier"); - verify(practitionerRoleRepository).getRolesForPractitioner(anyString()); - assertEquals(1, actutalPractitionerRoles.size()); - assertEquals("pr1-identifier", actutalPractitionerRoles.get(0).getIdentifier()); - } - - @Test(expected = IllegalArgumentException.class) - public void testGetRolesForPractitionerWithNullIdentifier() { - - List actutalPractitionerRoles = practitionerRoleService.getRolesForPractitioner(null); - assertTrue(actutalPractitionerRoles.isEmpty()); - verify(practitionerRoleRepository, never()).getRolesForPractitioner(anyString()); - } - - @Test - public void testGetPgRolesForPractitionerShouldCallGetPgRolesForPractitionerMethod() { - List expectedPractitionerRoles = new ArrayList<>(); - org.opensrp.domain.postgres.PractitionerRole practitionerRole = new org.opensrp.domain.postgres.PractitionerRole(); - practitionerRole.setIdentifier("pr1-identifier"); - expectedPractitionerRoles.add(practitionerRole); - when(practitionerRoleRepository.getPgRolesForPractitioner(anyString())).thenReturn(expectedPractitionerRoles); - - List actutalPractitionerRoles = practitionerRoleService.getPgRolesForPractitioner("identifier"); - verify(practitionerRoleRepository).getPgRolesForPractitioner(anyString()); - assertEquals(1, actutalPractitionerRoles.size()); - assertEquals("pr1-identifier", actutalPractitionerRoles.get(0).getIdentifier()); - } - - @Test(expected = IllegalArgumentException.class) - public void testGetPgRolesForPractitionerWithNullIdentifier() { - - List actutalPractitionerRoles = practitionerRoleService.getPgRolesForPractitioner(null); - assertTrue(actutalPractitionerRoles.isEmpty()); - verify(practitionerRoleRepository, never()).getPgRolesForPractitioner(anyString()); - } - - private static PractitionerRole initTestPractitionerRole(){ - PractitionerRole practitionerRole = new PractitionerRole(); - practitionerRole.setIdentifier("pr1-identifier"); - practitionerRole.setActive(true); - practitionerRole.setOrganizationIdentifier("org-identifier"); - practitionerRole.setPractitionerIdentifier("p1-identifier"); - PractitionerRoleCode code = new PractitionerRoleCode(); - code.setText("pr1Code"); - practitionerRole.setCode(code); - return practitionerRole; - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/PractitionerServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/PractitionerServiceTest.java deleted file mode 100644 index fef5bebea1..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/PractitionerServiceTest.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.opensrp.service; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.domain.Organization; -import org.opensrp.domain.Practitioner; -import org.opensrp.repository.PractitionerRepository; -import org.powermock.modules.junit4.PowerMockRunner; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -@RunWith(PowerMockRunner.class) -public class PractitionerServiceTest { - - private PractitionerService practitionerService; - - private PractitionerRepository practitionerRepository; - - private PractitionerRoleService practitionerRoleService; - - private OrganizationService organizationService; - - @Before - public void setUp() { - practitionerRepository = mock(PractitionerRepository.class); - practitionerService = new PractitionerService(); - practitionerService.setPractitionerRepository(practitionerRepository); - practitionerRoleService = mock(PractitionerRoleService.class); - practitionerService.setPractitionerRoleService(practitionerRoleService); - organizationService = mock(OrganizationService.class); - practitionerService.setOrganizationService(organizationService); - } - - @Test - public void testgetAllPractitioners() { - List expectedPractitioners = new ArrayList<>(); - expectedPractitioners.add(initTestPractitioner()); - when(practitionerRepository.getAll()).thenReturn(expectedPractitioners); - - List actutalPractitioners = practitionerService.getAllPractitioners(); - verify(practitionerRepository).getAll(); - assertEquals(1, actutalPractitioners.size()); - assertEquals("practitoner-1-identifier", actutalPractitioners.get(0).getIdentifier()); - } - - @Test - public void testGetPractitionerByIdentifier() { - Practitioner expectedPractitioner = initTestPractitioner(); - when(practitionerRepository.get(anyString())).thenReturn(expectedPractitioner); - - Practitioner actutalPractitioner = practitionerService.getPractitioner(expectedPractitioner.getIdentifier()); - verify(practitionerRepository).get(anyString()); - assertNotNull(actutalPractitioner); - assertEquals("practitoner-1-identifier", actutalPractitioner.getIdentifier()); - } - - @Test - public void testAddOrUpdateShouldCallRepostoryAddMethod() { - when(practitionerRepository.get(anyString())).thenReturn(null); - Practitioner practitioner = initTestPractitioner(); - practitionerService.addOrUpdatePractitioner(practitioner); - verify(practitionerRepository).add(eq(practitioner)); - } - - @Test - public void testAddOrUpdateShouldCallRepostoryUpdateMethod() { - when(practitionerRepository.get(anyString())).thenReturn(initTestPractitioner()); - Practitioner practitioner = initTestPractitioner(); - practitionerService.addOrUpdatePractitioner(practitioner); - verify(practitionerRepository).update(eq(practitioner)); - } - - @Test(expected = IllegalArgumentException.class) - public void testAddOrUpdateWithoutPractitionerIdentifier() { - Practitioner practitioner = initTestPractitioner(); - practitioner.setIdentifier(null); - practitionerService.addOrUpdatePractitioner(practitioner); - verify(practitionerRepository, never()).update(eq(practitioner)); - } - - - @Test - public void testDeleteShouldCallRepostorySafeRemoveMethod() { - when(practitionerRepository.get(anyString())).thenReturn(initTestPractitioner()); - Practitioner practitioner = initTestPractitioner(); - practitionerService.deletePractitioner(practitioner); - verify(practitionerRepository).safeRemove(eq(practitioner)); - } - - @Test(expected = IllegalArgumentException.class) - public void testDeleteWithoutPlanIdentifier() { - Practitioner practitioner = initTestPractitioner(); - practitioner.setIdentifier(null); - practitionerService.deletePractitioner(practitioner); - verify(practitionerRepository, never()).safeRemove(eq(practitioner)); - } - - @Test - public void testGetOrganizationByUserIdShouldCallGetPgRolesForPractitionerMethod() { - Practitioner practitioner = initTestPractitioner(); - when(practitionerRepository.getPractitionerByUserId(anyString())).thenReturn(practitioner); - - practitionerService.getOrganizationsByUserId("user-id"); - verify(practitionerRepository).getPractitionerByUserId(eq("user-id")); - verify(practitionerRoleService).getPgRolesForPractitioner(eq(practitioner.getIdentifier())); - } - - @Test - public void testGetPractitionersByOrgIdentifier() { - - Practitioner practitioner = initTestPractitioner(); - when(practitionerRepository.getPractitionersByOrgId(anyLong())) - .thenReturn(Collections.singletonList(practitioner)); - - Organization organization = new Organization(); - organization.setId(1l); - organization.setIdentifier("org1"); - when(organizationService.getOrganization("org1")).thenReturn(organization); - - practitionerService.getPractitionersByOrgIdentifier("org1"); - - verify(organizationService).validateIdentifier(anyString()); - verify(organizationService).getOrganization(anyString()); - verify(practitionerRepository).getPractitionersByOrgId(anyLong()); - - } - - @Test - public void testGetPractionerByUsername() { - String username = "janedoe"; - Practitioner practitioner = initTestPractitioner(); - when(practitionerRepository.getPractitionerByUsername(username)).thenReturn(practitioner); - - Practitioner actual = practitionerService.getPractionerByUsername("janedoe"); - - verify(practitionerRepository).getPractitionerByUsername(username); - assertEquals(practitioner, actual); - - } - - private Practitioner initTestPractitioner(){ - Practitioner practitioner = new Practitioner(); - practitioner.setIdentifier("practitoner-1-identifier"); - practitioner.setActive(true); - practitioner.setName("Practitioner"); - practitioner.setUsername("Practioner1"); - practitioner.setUserId("user1"); - return practitioner; - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/StockServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/StockServiceTest.java deleted file mode 100644 index 766c28aaf4..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/StockServiceTest.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.opensrp.service; - -import java.sql.SQLException; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.joda.time.DateTime; -import org.joda.time.Minutes; -import org.junit.Assert; -import org.junit.Test; -import org.opensrp.domain.Stock; -import org.opensrp.repository.StocksRepository; -import org.opensrp.repository.postgres.BaseRepositoryTest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -/** - * Integration Tests for {@link StockService}. - */ -public class StockServiceTest extends BaseRepositoryTest { - - private StockService stockService; - - @Autowired - @Qualifier("stocksRepositoryPostgres") - private StocksRepository stocksRepository; - - @Override - protected Set getDatabaseScripts() { - Set scripts = new HashSet<>(); - scripts.add("stock.sql"); - return scripts; - } - - @Override - public void populateDatabase() throws SQLException { - super.populateDatabase(); - stockService = new StockService(stocksRepository); - Stock stock1 = new Stock(Long.parseLong("123"), "VT", "TT", "4-2", 10, Long.parseLong("20062017"), "TF", - Long.parseLong("20062017"), Long.parseLong("12345")); - Stock stock2 = new Stock(Long.parseLong("123"), "VT", "TT", "4-2", 10, Long.parseLong("20062017"), "TF", - Long.parseLong("20062017"), Long.parseLong("12345")); - stockService.addStock(stock1); - stockService.addStock(stock2); - } - - @Test - public void shouldSaveStock() { - Stock stock = new Stock(Long.parseLong("124"), "VT1", "TT1", "4-2", 10, Long.parseLong("20062017"), " TF", - Long.parseLong("20062017"), Long.parseLong("12345")); - - Stock savedStock = stockService.addorUpdateStock(stock); - Assert.assertNotNull(savedStock.getServerVersion()); - Assert.assertEquals(savedStock.getProviderid(), stock.getProviderid()); - - } - - @Test - public void shouldUpdateStockWithSaveorUpdate() { - List stocks = stockService.findAllByProviderid("4-2"); - for (Stock stock : stocks) { - stock.setVaccine_type_id("12334"); - stock.setTransaction_type("Restocking_1"); - stock.setValue(stock.getValue() * 2); - stockService.addorUpdateStock(stock); - } - stocks = stockService.findAllByProviderid("4-2"); - for (Stock savedStock : stocks) { - Assert.assertEquals(0, Minutes.minutesBetween(savedStock.getDateEdited(), DateTime.now()).getMinutes()); - Assert.assertEquals("12334", savedStock.getVaccine_type_id()); - Assert.assertEquals("Restocking_1", savedStock.getTransaction_type()); - Assert.assertEquals(20, savedStock.getValue()); - } - } - - @Test - public void shouldUpdateStock() { - List stocks = stockService.findAllByProviderid("4-2"); - for (Stock stock : stocks) { - stock.setVaccine_type_id("12334"); - stock.setTransaction_type("Restocking_1"); - stock.setValue(stock.getValue() * 2); - stockService.updateStock(stock); - } - stocks = stockService.findAllByProviderid("4-2"); - for (Stock savedStock : stocks) { - Assert.assertEquals(0, Minutes.minutesBetween(savedStock.getDateEdited(), DateTime.now()).getMinutes()); - Assert.assertEquals("12334", savedStock.getVaccine_type_id()); - Assert.assertEquals("Restocking_1", savedStock.getTransaction_type()); - Assert.assertEquals(20, savedStock.getValue()); - } - } - - @Test(expected = IllegalArgumentException.class) - public void shouldNotUpdateStockForNewStock() { - Stock stock = new Stock(Long.parseLong("124"), "VT1", "TT1", "4-2", 10, Long.parseLong("20062017"), " TF", - Long.parseLong("20062017"), Long.parseLong("12345")); - stockService.updateStock(stock); - } - - @Test - public void shouldFetchStocksByProcider() throws Exception { - List fecthedListByProviderid = stockService.findAllByProviderid("4-2"); - for (Stock stock : fecthedListByProviderid) - Assert.assertEquals("4-2", stock.getProviderid()); - } - - @Test - public void shouldFetchAll() throws Exception { - List fecthedListAll = stockService.getAll(); - Assert.assertEquals(17, fecthedListAll.size()); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/TaskServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/TaskServiceTest.java deleted file mode 100644 index 4527934180..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/TaskServiceTest.java +++ /dev/null @@ -1,227 +0,0 @@ -package org.opensrp.service; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.opensrp.domain.Task; -import org.opensrp.domain.Task.TaskStatus; -import org.opensrp.domain.TaskUpdate; -import org.opensrp.repository.TaskRepository; -import org.opensrp.util.TaskDateTimeTypeConverter; -import org.powermock.modules.junit4.PowerMockRunner; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.*; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.*; - -@RunWith(PowerMockRunner.class) -public class TaskServiceTest { - - private static String dateFormat = "yyyy-MM-dd'T'HHmm"; - - private TaskService taskService; - - private TaskRepository taskRepository; - - @Before - public void setUp() { - taskRepository = mock(TaskRepository.class); - taskService = new TaskService(); - taskService.setTaskRepository(taskRepository); - } - - @Test - public void testGetAllTasks() { - List expected = new ArrayList<>(); - expected.add(initializeTask()); - when(taskRepository.getAll()).thenReturn(expected); - List tasks = taskService.getAllTasks(); - verify(taskRepository).getAll(); - assertEquals(1, tasks.size()); - assertEquals("tsk11231jh22", tasks.get(0).getIdentifier()); - } - - @Test - public void testAddOrUpdateTaskShouldUpdate() { - Task task = initializeTask(); - when(taskRepository.get("tsk11231jh22")).thenReturn(task); - taskService.addOrUpdateTask(task); - verify(taskRepository).update(task); - } - - @Test - public void testAddOrUpdateTaskShouldAdd() { - Task task = initializeTask(); - when(taskRepository.get("tsk11231jh22")).thenReturn(null); - taskService.addOrUpdateTask(task); - verify(taskRepository).add(task); - - } - - @Test(expected = IllegalArgumentException.class) - public void testAddOrUpdateTaskWithoutIdentifier() { - Task task = new Task(); - taskService.addOrUpdateTask(task); - - } - - @Test - public void testAddTask() { - Task task = initializeTask(); - taskService.addTask(task); - verify(taskRepository).add(task); - } - - @Test(expected = IllegalArgumentException.class) - public void testAddTaskWithoutIdentifier() { - Task task = new Task(); - taskService.addTask(task); - } - - @Test - public void testUpdateTask() { - Task task = initializeTask(); - taskService.updateTask(task); - verify(taskRepository).update(task); - } - - @Test(expected = IllegalArgumentException.class) - public void testUpdateTaskWithoutIdentifier() { - Task task = new Task(); - taskService.updateTask(task); - } - - @Test - public void testGetTask() { - Task expected = initializeTask(); - when(taskRepository.get("tsk11231jh22")).thenReturn(expected); - Task task = taskService.getTask("tsk11231jh22"); - - assertEquals("tsk11231jh22", task.getIdentifier()); - assertEquals("2018_IRS-3734{", task.getGroupIdentifier()); - assertEquals(TaskStatus.READY, task.getStatus()); - assertEquals("Not Visited", task.getBusinessStatus()); - assertEquals(3, task.getPriority()); - assertEquals("IRS", task.getCode()); - assertEquals("Spray House", task.getDescription()); - assertEquals("IRS Visit", task.getFocus()); - assertEquals("location.properties.uid:41587456-b7c8-4c4e-b433-23a786f742fc", task.getForEntity()); - assertEquals("2018-11-10T2200", task.getExecutionStartDate().toString(dateFormat)); - assertNull(task.getExecutionEndDate()); - assertEquals("2018-10-31T0700", task.getAuthoredOn().toString(dateFormat)); - assertEquals("2018-10-31T0700", task.getLastModified().toString(dateFormat)); - assertEquals("demouser", task.getOwner()); - assertEquals(1, task.getNotes().size()); - assertEquals("demouser", task.getNotes().get(0).getAuthorString()); - assertEquals("2018-01-01T0800", task.getNotes().get(0).getTime().toString(dateFormat)); - assertEquals("This should be assigned to patrick.", task.getNotes().get(0).getText()); - } - - @Test - public void testGetTaskWithoutIdentifier() { - Task task = taskService.getTask(""); - verify(taskRepository, never()).get(anyString()); - assertNull(task); - } - - @Test - public void testGetTasksByCampaignAndGroup() { - Task task = initializeTask(); - List expected = new ArrayList<>(); - expected.add(task); - when(taskRepository.getTasksByPlanAndGroup("IRS_2018_S1", "2018_IRS-3734", 15421904649873l)) - .thenReturn(expected); - List tasks = taskService.getTasksByTaskAndGroup("IRS_2018_S1", "2018_IRS-3734", 15421904649873l); - verify(taskRepository).getTasksByPlanAndGroup("IRS_2018_S1", "2018_IRS-3734", 15421904649873l); - assertEquals(task, tasks.get(0)); - } - - @Test - public void addServerVersion() { - - List expected = new ArrayList<>(); - Task task = initializeTask(); - task.setServerVersion(null); - expected.add(task); - when(taskRepository.findByEmptyServerVersion()).thenReturn(expected); - - long now = System.currentTimeMillis(); - taskService.addServerVersion(); - verify(taskRepository).findByEmptyServerVersion(); - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Task.class); - verify(taskRepository).update(argumentCaptor.capture()); - assertNotNull(argumentCaptor.getValue().getServerVersion()); - assertTrue(argumentCaptor.getValue().getServerVersion() >= now); - - } - - private Task initializeTask() { - Gson gson = new GsonBuilder().registerTypeAdapter(DateTime.class, new TaskDateTimeTypeConverter()) - .serializeNulls().create(); - return gson.fromJson( - "{\"identifier\":\"tsk11231jh22\",\"campaignIdentifier\":\"IRS_2018_S1\",\"groupIdentifier\":\"2018_IRS-3734{\",\"status\":\"Ready\",\"businessStatus\":\"Not Visited\",\"priority\":3,\"code\":\"IRS\",\"description\":\"Spray House\",\"focus\":\"IRS Visit\",\"for\":\"location.properties.uid:41587456-b7c8-4c4e-b433-23a786f742fc\",\"executionStartDate\":\"2018-11-10T2200\",\"executionEndDate\":null,\"authoredOn\":\"2018-10-31T0700\",\"lastModified\":\"2018-10-31T0700\",\"owner\":\"demouser\",\"note\":[{\"authorString\":\"demouser\",\"time\":\"2018-01-01T0800\",\"text\":\"This should be assigned to patrick.\"}],\"serverVersion\":0}", - Task.class); - - } - - @Test - public void updateTaskStatus() { - - long now = System.currentTimeMillis(); - Task task = initializeTask(); - List updates = new ArrayList<>(); - TaskUpdate taskUpdate = new TaskUpdate(); - taskUpdate.setIdentifier("tsk11231jh22"); - taskUpdate.setBusinessStatus("Not Sprayable"); - taskUpdate.setServerVersion(now); - taskUpdate.setStatus(TaskStatus.COMPLETED.name()); - updates.add(taskUpdate); - when(taskRepository.get("tsk11231jh22")).thenReturn(task); - taskService.updateTaskStatus(updates); - assertEquals(now, taskUpdate.getServerVersion().longValue()); - - ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(Task.class); - verify(taskRepository).update(argumentCaptor.capture()); - assertNull(argumentCaptor.getValue().getServerVersion()); - assertEquals("Not Sprayable", argumentCaptor.getValue().getBusinessStatus()); - - assertEquals("tsk11231jh22", task.getIdentifier()); - assertEquals("2018_IRS-3734{", task.getGroupIdentifier()); - assertEquals(3, task.getPriority()); - assertEquals("IRS", task.getCode()); - assertEquals("Spray House", task.getDescription()); - assertEquals("IRS Visit", task.getFocus()); - assertEquals("location.properties.uid:41587456-b7c8-4c4e-b433-23a786f742fc", task.getForEntity()); - assertEquals("2018-11-10T2200", task.getExecutionStartDate().toString(dateFormat)); - assertNull(task.getExecutionEndDate()); - assertEquals("2018-10-31T0700", task.getAuthoredOn().toString(dateFormat)); - assertEquals("demouser", task.getOwner()); - assertEquals(1, task.getNotes().size()); - assertEquals("demouser", task.getNotes().get(0).getAuthorString()); - assertEquals("2018-01-01T0800", task.getNotes().get(0).getTime().toString(dateFormat)); - assertEquals("This should be assigned to patrick.", task.getNotes().get(0).getText()); - } - - @Test - public void testFindAllTaskIds() { - List expectedTaskIds = new ArrayList<>(); - expectedTaskIds.add("task1"); - expectedTaskIds.add("task2"); - - when(taskRepository.findAllIds()).thenReturn(expectedTaskIds); - List actualTaskIds = taskService.findAllTaskIds(); - - verify(taskRepository).findAllIds(); - assertEquals(2, actualTaskIds.size()); - assertEquals(expectedTaskIds.get(0).toString(), actualTaskIds.get(0).toString()); - assertEquals(expectedTaskIds.get(1).toString(), actualTaskIds.get(1).toString()); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/formSubmission/EventListenerTest.java b/opensrp-core/src/test/java/org/opensrp/service/formSubmission/EventListenerTest.java deleted file mode 100644 index d734ba6745..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/formSubmission/EventListenerTest.java +++ /dev/null @@ -1,120 +0,0 @@ -package org.opensrp.service.formSubmission; - -import static java.util.Arrays.asList; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.json.JSONObject; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InOrder; -import org.mockito.Matchers; -import org.mockito.Mock; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.AppStateToken; -import org.opensrp.domain.Client; -import org.opensrp.domain.Event; -import org.opensrp.repository.couch.AllClients; -import org.opensrp.repository.couch.AllEvents; -import org.opensrp.service.ClientService; -import org.opensrp.service.ConfigService; -import org.opensrp.service.ErrorTraceService; -import org.opensrp.service.EventService; -import org.opensrp.service.formSubmission.handler.EventsHandler; -import org.opensrp.service.formSubmission.handler.EventsRouter; -import org.opensrp.service.formSubmission.handler.IHandlerMapper; - -public class EventListenerTest { - - @Mock - private ConfigService configService; - - @Mock - private AllEvents allEvents; - - @Mock - private AllClients allClients; - - @Mock - private ErrorTraceService errorTraceService; - - @Mock - private ClientService clientService; - - IHandlerMapper handlerMapper; - - private EventService eventService; - - private EventsRouter eventsRouter; - - private EventsListener eventsListener; - - @Before - public void setUp() { - configService = mock(ConfigService.class); - allEvents = mock(AllEvents.class); - clientService = mock(ClientService.class); - allClients = mock(AllClients.class); - handlerMapper = mock(IHandlerMapper.class); - - when(configService.registerAppStateToken(any(AllConstants.Config.class), Matchers.anyObject(), anyString(), - anyBoolean())).thenReturn(new AppStateToken("token", 01l, 02l)); - eventsRouter = new EventsRouter(handlerMapper, "/schedules/schedule-configs"); - eventService = new EventService(allEvents, clientService); - eventsListener = new EventsListener(eventsRouter, configService, allEvents, eventService, errorTraceService, - allClients); - } - - @Test - public void shouldHandleNewEvent() throws Exception { - EventsHandler eventHandler = mock(EventsHandler.class); - Map handlerMap = new HashMap<>(); - handlerMap.put("VaccinesScheduleHandler", eventHandler); - - List clients = asList(new Client("2222")); - List events = asList( - new Event().withIdentifier(AllConstants.Client.ZEIR_ID.toUpperCase(), "2").withEventType("Vaccination"), - new Event()); - - when(allClients.findByEmptyServerVersion()).thenReturn(clients, Collections. emptyList()); - when(configService.getAppStateTokenByName(AllConstants.Config.EVENTS_PARSER_LAST_PROCESSED_EVENT)) - .thenReturn(new AppStateToken("token", 1l, 0l)); - when(allEvents.findByEmptyServerVersion()).thenReturn(events, Collections.EMPTY_LIST); - when(allEvents.findByServerVersion(1l)).thenReturn(events); - when(clientService.findAllByIdentifier(AllConstants.Client.ZEIR_ID.toUpperCase(), "2")).thenReturn(clients); - when(allEvents.findByBaseEntityAndType("222", "Birth Registration")).thenReturn(events); - - when(handlerMapper.handlerMap()).thenReturn(handlerMap); - - EventsListener spyEventListener = spy(eventsListener); - when(spyEventListener.getCurrentMilliseconds()).thenReturn(0l); - - spyEventListener.processEvent(); - - InOrder inOrder = inOrder(allClients, allEvents, eventHandler); - clients.get(0).setServerVersion(System.currentTimeMillis()); - events.get(0).setServerVersion(System.currentTimeMillis()); - inOrder.verify(allClients).update(clients.get(0)); - inOrder.verify(allEvents).update(events.get(0)); - inOrder.verify(eventHandler, atLeastOnce()).handle(eq(events.get(0)), any(JSONObject.class), eq("BCG")); - - } - - @Test - public void testComparator() { - - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/formSubmission/FormEntityConverterTest.java b/opensrp-core/src/test/java/org/opensrp/service/formSubmission/FormEntityConverterTest.java deleted file mode 100644 index f448890c4c..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/formSubmission/FormEntityConverterTest.java +++ /dev/null @@ -1,203 +0,0 @@ -package org.opensrp.service.formSubmission; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNull; -import static junit.framework.Assert.assertTrue; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -import java.io.IOException; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPathExpressionException; - -import org.joda.time.DateTime; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.common.FormEntityConstants; -import org.opensrp.domain.Address; -import org.opensrp.domain.Client; -import org.opensrp.domain.Event; -import org.opensrp.domain.Obs; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.service.FormAttributeParser; -import org.opensrp.form.service.FormSubmissionMap; -import org.springframework.beans.factory.annotation.Autowired; -import org.xml.sax.SAXException; - -import com.google.gson.Gson; - -public class FormEntityConverterTest extends BaseIntegrationTest { - - @Autowired - FormAttributeParser formAttributeParser; - - @Autowired - private FormEntityConverter formEntityConverter; - - private Gson gson = new Gson(); - - @Test - public void test() throws Exception { - FormSubmission fs = getFormSubmissionFor("new_household_registration", 1); - System.out.println("************************form submission ************************"); - System.out.println(gson.toJson(fs)); - System.out.println("************************form submission ************************"); - System.out.println("************************ client ************************"); - Client client = formEntityConverter.getClientFromFormSubmission(fs); - System.out.println(gson.toJson(client)); - System.out.println("************************ client ************************"); - } - - //TODO: test date approximation check - @Test - public void testCreateBaseClient() throws Exception { - String addressString = " {\n" + " \"addressType\": \"usual_residence\",\n" + " \"addressFields\": {\n" - + " \"landmark\": \"nothing\"\n" + " },\n" + " \"latitude\": \"34\",\n" - + " \"longitude\": \"34\",\n" + " \"geopoint\": \"34 34 0 0\"\n" + " }"; - Client expectedClient = new Client("a3f2abf4-2699-4761-819a-cea739224164"); - expectedClient.withFirstName("test").withLastName(".").withGender("male") - .withBirthdate(new DateTime("1900-01-01").withTimeAtStartOfDay(), false) - .withAddress(new Gson().fromJson(addressString, Address.class)).withIdentifier("JiVita HHID", "1234") - .withIdentifier("GOB HHID", "1234"); - FormSubmission fsubmission = getFormSubmissionFor("new_household_registration", 1); - FormSubmissionMap formSubmissionMap = formAttributeParser.createFormSubmissionMap(fsubmission); - - Client client = formEntityConverter.createBaseClient(formSubmissionMap); - - assertEquals(expectedClient.fullName(), client.fullName()); - assertEquals(expectedClient.getBirthdate(), client.getBirthdate()); - assertEquals(expectedClient.getBirthdateApprox(), client.getBirthdateApprox()); - assertEquals(expectedClient.getGender(), client.getGender()); - assertEquals(expectedClient.getIdentifier("JiVita HHID"), client.getIdentifier("JiVita HHID")); - assertEquals(expectedClient.getIdentifier("GOB HHID"), client.getIdentifier("GOB HHID")); - - } - - @Test - public void testValidOpenmrsForm() - throws IOException, XPathExpressionException, SAXException, ParserConfigurationException { - FormSubmission fsubmission = getFormSubmissionFor("new_household_registration", 1); - FormSubmissionMap formSubmissionMap = formAttributeParser.createFormSubmissionMap(fsubmission); - - boolean expectedValue = formEntityConverter.isOpenmrsForm(formSubmissionMap); - - assertTrue(expectedValue); - } - - @Test - public void testInvalidOpenmrsForm() - throws IOException, XPathExpressionException, SAXException, ParserConfigurationException { - FormSubmission fsubmission = getFormSubmissionFor("new_household_registration", 1); - FormSubmissionMap formSubmissionMap = formAttributeParser.createFormSubmissionMap(fsubmission); - formSubmissionMap.formAttributes().remove("encounter_type"); - - boolean expectedValue = formEntityConverter.isOpenmrsForm(formSubmissionMap); - - assertFalse(expectedValue); - } - - @Test - public void testCreateEvent() - throws ParserConfigurationException, SAXException, XPathExpressionException, IOException, ParseException { - FormSubmission fsubmission = getFormSubmissionFor("new_household_registration", 1); - FormSubmissionMap formSubmissionMap = formAttributeParser.createFormSubmissionMap(fsubmission); - Event expectedEvent = new Event().withBaseEntityId(fsubmission.entityId()) - .withEventDate(new DateTime(FormEntityConstants.FORM_DATE.parse("2015-05-07"))) - .withEventType(formSubmissionMap.formAttributes().get("encounter_type")).withLocationId("KUPTALA") - .withProviderId(formSubmissionMap.providerId()).withEntityType(formSubmissionMap.bindType()) - .withFormSubmissionId(formSubmissionMap.instanceId()); - - List values = new ArrayList<>(); - values.add("2015-05-07"); - - Obs obs1 = new Obs("concept", "DateTime", "160753AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", null, values, null, "FWNHREGDATE"); - values.clear(); - values.add(2); - Obs obs2 = new Obs("concept", "Integer", "5611AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", null, values, null, "FWNHHMBRNUM"); - expectedEvent.addObs(obs1); - expectedEvent.addObs(obs2); - - Event event = formEntityConverter.getEventFromFormSubmission(fsubmission); - - assertEvents(expectedEvent, event); - } - - @Test(expected = IllegalStateException.class) - public void testExceptionWhileCreatingEventFromFromSubmission() { - FormSubmission fsubmission = new FormSubmission(); - formEntityConverter.getEventFromFormSubmission(fsubmission); - } - - @Test - public void testGetFieldName() throws IOException, XPathExpressionException, SAXException, ParserConfigurationException { - String expected = "FWHOHGENDER"; - FormSubmission fsubmission = getFormSubmissionFor("new_household_registration", 1); - FormSubmissionMap formSubmissionMap = formAttributeParser.createFormSubmissionMap(fsubmission); - String actual = formEntityConverter.getFieldName(FormEntityConstants.Person.gender, formSubmissionMap); - - assertEquals(expected, actual); - } - - @Test - public void testGetFieldNameInSubForm() - throws IOException, XPathExpressionException, SAXException, ParserConfigurationException { - String expected = "FWGENDER"; - FormSubmission fsubmission = getFormSubmissionFor("new_household_registration", 1); - FormSubmissionMap formSubmissionMap = formAttributeParser.createFormSubmissionMap(fsubmission); - String actual = formEntityConverter.getFieldName(FormEntityConstants.Person.gender, - formSubmissionMap.subforms().get(0)); - - assertEquals(expected, actual); - } - - @Test - public void testInvalidFieldNameInForm() - throws IOException, XPathExpressionException, SAXException, ParserConfigurationException { - FormSubmission fsubmission = getFormSubmissionFor("new_household_registration", 1); - FormSubmissionMap formSubmissionMap = formAttributeParser.createFormSubmissionMap(fsubmission); - String actual = formEntityConverter.getFieldName(FormEntityConstants.Encounter.encounter_date, - formSubmissionMap.subforms().get(0)); - assertNull(actual); - } - - @Test - public void testGetFieldNameUsingEntity() - throws IOException, XPathExpressionException, SAXException, ParserConfigurationException { - String expected = "FWNHHMBRNUM"; - FormSubmission fsubmission = getFormSubmissionFor("new_household_registration", 1); - FormSubmissionMap formSubmissionMap = formAttributeParser.createFormSubmissionMap(fsubmission); - String actual = formEntityConverter.getFieldName("concept", "5611AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", null, - formSubmissionMap); - - assertEquals(expected, actual); - } - - @Test - public void testGetFieldNameUsingEnitityWithInvalidData() - throws IOException, XPathExpressionException, SAXException, ParserConfigurationException { - FormSubmission fsubmission = getFormSubmissionFor("new_household_registration", 1); - FormSubmissionMap formSubmissionMap = formAttributeParser.createFormSubmissionMap(fsubmission); - String actual = formEntityConverter.getFieldName("concept", "5611AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", null, - formSubmissionMap.subforms().get(0)); - assertNull(actual); - } - - private void assertEvents(Event expected, Event actual) { - assertEquals(expected.getBaseEntityId(), actual.getBaseEntityId()); - assertEquals(expected.getEntityType(), actual.getEntityType()); - assertEquals(expected.getDetails(), actual.getDetails()); - assertEquals(expected.getEventDate(), actual.getEventDate()); - assertEquals(expected.getFormSubmissionId(), actual.getFormSubmissionId()); - assertEquals(expected.getId(), actual.getId()); - assertEquals(expected.getIdentifiers(), expected.getIdentifiers()); - assertThat(actual.getObs(), is(actual.getObs())); - assertEquals(expected.getLocationId(), actual.getLocationId()); - assertEquals(expected.getProviderId(), actual.getProviderId()); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/formSubmission/FormEntityServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/formSubmission/FormEntityServiceTest.java deleted file mode 100644 index 7cdbf4465a..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/formSubmission/FormEntityServiceTest.java +++ /dev/null @@ -1,194 +0,0 @@ -package org.opensrp.service.formSubmission; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -import java.io.IOException; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InOrder; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; -import org.opensrp.domain.Client; -import org.opensrp.domain.Event; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.service.FormAttributeParser; -import org.opensrp.repository.couch.AllClients; -import org.opensrp.repository.couch.AllEvents; -import org.opensrp.scheduler.HealthSchedulerService; -import org.opensrp.scheduler.ScheduleConfig; -import org.opensrp.scheduler.service.ActionService; -import org.opensrp.scheduler.service.ScheduleService; -import org.opensrp.service.ClientService; -import org.opensrp.service.EventService; -import org.opensrp.service.formSubmission.handler.FormSubmissionRouter; -import org.opensrp.service.formSubmission.ziggy.ZiggyService; -import org.opensrp.util.TestResourceLoader; -import org.opensrp.util.Utils; - -import com.google.gson.Gson; - -public class FormEntityServiceTest extends TestResourceLoader { - - @Mock - private ZiggyService ziggyService; - - @Mock - private FormSubmissionRouter formSubmissionRouter; - - @Mock - private FormSubmissionProcessor fsp; - - @Mock - private FormEntityConverter formEntityConverter; - - @Mock - private ClientService clientService; - - @Mock - private EventService eventService; - - @Spy - private ScheduleConfig scheduleConfig; - - @Mock - private ScheduleService schService; - - @Mock - private ActionService actionService; - - @Mock - private AllClients allClients; - - @Mock - private AllEvents allEvents; - - @InjectMocks - private HealthSchedulerService scheduleService; - - @Mock - private FormEntityConverter fec; - - public FormEntityServiceTest() throws IOException { - super(); - } - - @Before - public void setUp() throws Exception { - scheduleConfig = new ScheduleConfig("/schedules/schedule-config.xls"); - initMocks(this); - fsp = new FormSubmissionProcessor(ziggyService, formSubmissionRouter, formEntityConverter, scheduleService, - clientService, allClients, eventService, allEvents); - fec = new FormEntityConverter(new FormAttributeParser("/form")); - } - - @Test - public void shouldProcessNonZiggySubmission() throws Exception { - FormSubmission fs = getFormSubmissionFor("new_household_registration", 1); - - fsp.processFormSubmission(fs); - - InOrder inOrder = inOrder(formEntityConverter, clientService, eventService, schService, ziggyService, - formSubmissionRouter); - inOrder.verify(formEntityConverter).getClientFromFormSubmission(fs); - inOrder.verify(formEntityConverter).getEventFromFormSubmission(fs); - inOrder.verify(formEntityConverter).getDependentClientsFromFormSubmission(fs); - inOrder.verify(clientService, atLeastOnce()).addClient(any(Client.class)); - inOrder.verify(eventService, atLeastOnce()).addEvent(any(Event.class)); - inOrder.verify(schService).enroll(fs.entityId(), "FW CENSUS", "FW CENSUS", "2015-05-07", fs.instanceId()); - inOrder.verify(ziggyService).isZiggyCompliant(fs.bindType()); - inOrder.verify(formSubmissionRouter).route(fs); - - verifyNoMoreInteractions(formEntityConverter); - //verifyNoMoreInteractions(clientService); - //verifyNoMoreInteractions(eventService); - //verifyNoMoreInteractions(schService); - verifyNoMoreInteractions(ziggyService); - verifyNoMoreInteractions(formSubmissionRouter); - } - - @Test - public void shouldProcessNonZiggyWomanTTEnrollmentSubmission() throws Exception { - FormSubmission fs = getFormSubmissionFor("woman_enrollment"); - - fsp.processFormSubmission(fs); - - InOrder inOrder = inOrder(formEntityConverter, clientService, eventService, schService, ziggyService, - formSubmissionRouter); - inOrder.verify(formEntityConverter).getClientFromFormSubmission(fs); - inOrder.verify(formEntityConverter).getEventFromFormSubmission(fs); - inOrder.verify(formEntityConverter).getDependentClientsFromFormSubmission(fs); - inOrder.verify(clientService, atLeastOnce()).addClient(any(Client.class)); - inOrder.verify(eventService, atLeastOnce()).addEvent(any(Event.class)); - inOrder.verify(schService).enroll(fs.entityId(), "TT 4", "tt4", "2016-03-25", fs.instanceId()); - inOrder.verify(ziggyService).isZiggyCompliant(fs.bindType()); - inOrder.verify(formSubmissionRouter).route(fs); - - verifyNoMoreInteractions(formEntityConverter); - //verifyNoMoreInteractions(clientService); - //verifyNoMoreInteractions(eventService); - //verifyNoMoreInteractions(schService); - verifyNoMoreInteractions(ziggyService); - verifyNoMoreInteractions(formSubmissionRouter); - } - - @Test - public void shouldProcessZiggySubmission() throws Exception { - FormSubmission fs = getFormSubmissionFor("new_household_registration", 1); - - when(ziggyService.isZiggyCompliant("household")).thenReturn(true); - - fsp.processFormSubmission(fs); - - InOrder inOrder = inOrder(formEntityConverter, clientService, eventService, schService, ziggyService, - formSubmissionRouter); - inOrder.verify(formEntityConverter).getClientFromFormSubmission(fs); - inOrder.verify(formEntityConverter).getEventFromFormSubmission(fs); - inOrder.verify(formEntityConverter).getDependentClientsFromFormSubmission(fs); - inOrder.verify(clientService, atLeastOnce()).addClient(any(Client.class)); - inOrder.verify(eventService, atLeastOnce()).addEvent(any(Event.class)); - inOrder.verify(schService).enroll(fs.entityId(), "FW CENSUS", "FW CENSUS", "2015-05-07", fs.instanceId()); - inOrder.verify(ziggyService).isZiggyCompliant(fs.bindType()); - inOrder.verify(ziggyService).saveForm(Utils.getZiggyParams(fs), new Gson().toJson(fs.instance())); - - verifyZeroInteractions(formSubmissionRouter); - verifyNoMoreInteractions(formEntityConverter); - // verifyNoMoreInteractions(clientService); - // verifyNoMoreInteractions(eventService); - // verifyNoMoreInteractions(schService); - verifyNoMoreInteractions(ziggyService); - } - - /*TODO - @Test - public void shouldSortAllSubmissionsAndSaveEachOne() throws Exception { - long baseTimeStamp = DateUtil.now().getMillis(); - String paramsForEarlierFormSubmission = new Gson().toJson(create(ANM_ID, "anm id 1").put(INSTANCE_ID, "instance id 1").put(ENTITY_ID, "entity id 1").put(FORM_NAME, "form name 1").put(CLIENT_VERSION, String.valueOf(baseTimeStamp)).put(SERVER_VERSION, String.valueOf(1L)).map()); - String paramsForLaterFormSubmission = new Gson().toJson(create(ANM_ID, "anm id 2").put(INSTANCE_ID, "instance id 2").put(ENTITY_ID, "entity id 2").put(FORM_NAME, "form name 1").put(CLIENT_VERSION, String.valueOf(baseTimeStamp + 1)).put(SERVER_VERSION, String.valueOf(2L)).map()); - String paramsForVeryLateFormSubmission = new Gson().toJson(create(ANM_ID, "anm id 2").put(INSTANCE_ID, "instance id 3").put(ENTITY_ID, "entity id 3").put(FORM_NAME, "form name 1").put(CLIENT_VERSION, String.valueOf(baseTimeStamp + 2)).put(SERVER_VERSION, String.valueOf(3L)).map()); - FormSubmission earlierFormSubmission = FormSubmissionBuilder.create().withANMId("anm id 1").addFormField("field 1", "value 1").withTimeStamp(baseTimeStamp).withServerVersion(1L).build(); - FormSubmission laterFormSubmission = FormSubmissionBuilder.create().withANMId("anm id 2").withInstanceId("instance id 2").withEntityId("entity id 2").addFormField("field 1", "value 2").withTimeStamp(baseTimeStamp + 1).withServerVersion(2L).build(); - FormSubmission veryLateFormSubmission = FormSubmissionBuilder.create().withANMId("anm id 2").withInstanceId("instance id 3").withEntityId("entity id 3").addFormField("field 1", "value 3").withTimeStamp(baseTimeStamp + 2).withServerVersion(3L).build(); - List formSubmissions = asList(laterFormSubmission, earlierFormSubmission, veryLateFormSubmission); - FormExportToken formExportToken = new FormExportToken(0L); - when(allFormExportTokens.getAll()).thenReturn(asList(formExportToken)); - - submissionService.process(formSubmissions); - - InOrder inOrder = inOrder(ziggyService, allFormExportTokens); - inOrder.verify(ziggyService).saveForm(paramsForEarlierFormSubmission, new Gson().toJson(earlierFormSubmission.instance())); - inOrder.verify(allFormExportTokens).update(formExportToken.withVersion(1L)); - inOrder.verify(ziggyService).saveForm(paramsForLaterFormSubmission, new Gson().toJson(laterFormSubmission.instance())); - inOrder.verify(allFormExportTokens).update(formExportToken.withVersion(2L)); - inOrder.verify(ziggyService).saveForm(paramsForVeryLateFormSubmission, new Gson().toJson(veryLateFormSubmission.instance())); - inOrder.verify(allFormExportTokens).update(formExportToken.withVersion(3L)); - verifyNoMoreInteractions(ziggyService); - }*/ -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/formSubmission/FormSubmissionDataMigrationIntegrationTest.java b/opensrp-core/src/test/java/org/opensrp/service/formSubmission/FormSubmissionDataMigrationIntegrationTest.java deleted file mode 100644 index d3accdef36..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/formSubmission/FormSubmissionDataMigrationIntegrationTest.java +++ /dev/null @@ -1,114 +0,0 @@ -package org.opensrp.service.formSubmission; - -import java.net.MalformedURLException; -import java.util.List; - -import org.ektorp.CouchDbInstance; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.common.AllConstants; -import org.opensrp.domain.AppStateToken; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.repository.AllFormSubmissions; -import org.opensrp.repository.couch.AllAppStateTokens; -import org.opensrp.service.FormSubmissionDataMigrationService; -import org.opensrp.util.Utils; -import org.opensrp.util.Utils.DatabaseConnectionParams; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; - -public class FormSubmissionDataMigrationIntegrationTest extends BaseIntegrationTest { - - @Autowired - FormSubmissionDataMigrationService dataMigrationService; - - @Autowired - @Qualifier("couchAppStateTokensRepository") - AllAppStateTokens allAppStateTokens; - - @Autowired - private FormSubmissionProcessor fsp; - - @Autowired - AllFormSubmissions allFormSubmissions; - - StubAllFormSubmission stubAllFormSubmission; - - DatabaseConnectionParams sourceDb = new Utils.DatabaseConnectionParams(); - - DatabaseConnectionParams targetDb = new Utils.DatabaseConnectionParams(); - - @Value("#{opensrp['couchdb.username']}") - String username; - - @Value("#{opensrp['couchdb.password']}") - String password; - - @Before - public void oneTimeSetUp() throws MalformedURLException { - sourceDb.password = password; - sourceDb.dbName = "opensrp-form-test"; - sourceDb.portNumber = "5984"; - sourceDb.url = "http://localhost"; - sourceDb.userName = username; - - targetDb.password = password; - targetDb.dbName = "opensrp-form-test-targetdb"; - targetDb.portNumber = "5984"; - targetDb.url = "http://localhost"; - targetDb.userName = username; - - stubAllFormSubmission = new StubAllFormSubmission(Utils.connectToDB(sourceDb)); - new StubAllAppStateToken(Utils.connectToDB(sourceDb)); - new StubAllFormSubmission(Utils.connectToDB(targetDb)); - new StubAllAppStateToken(Utils.connectToDB(targetDb)); - } - - @After - public void oneTimeTearDown() throws MalformedURLException { - CouchDbInstance couchDbInstance = Utils.getDbInstance(sourceDb); - couchDbInstance.deleteDatabase(sourceDb.dbName); - couchDbInstance.deleteDatabase(targetDb.dbName); - targetDb = null; - sourceDb = null; - - } - - @Test - public void shouldMigrateFormSubmissions() throws Exception { - FormSubmission fs = getFormSubmissionFor("new_household_registration", 1); - - allFormSubmissions.add(fs); - - dataMigrationService.migrateFormSubmissions(); - List ol = allAppStateTokens - .findByName(AllConstants.Config.FORM_ENTITY_PARSER_LAST_MIGRATED_FORM_SUBMISSION.name()); - - Assert.assertTrue("AppStateToken shouldn't be empty after a successful migration", !ol.isEmpty()); - Assert.assertTrue("AppStateToken should be greater than 0 all the times after a successful migration", - ol.get(0).longValue() > 0); - - } - - @Test - public void shouldMigrateFormSubmissionsAndPopulateTargetDB() throws Exception { - FormSubmission fs = getFormSubmissionFor("new_household_registration", 1); - - stubAllFormSubmission.add(fs); - - dataMigrationService.migrateFormSubmissions(sourceDb, targetDb); - - List ol = allAppStateTokens.findByName(Utils.connectToDB(sourceDb), - AllConstants.Config.FORM_ENTITY_PARSER_LAST_MIGRATED_FORM_SUBMISSION.name()); - - Assert.assertTrue("AppStateToken shouldn't be empty after a successful migration", !ol.isEmpty()); - Assert.assertTrue("AppStateToken should be greater than 0 all the times after a successful migration", - ol.get(0).longValue() > 0); - - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/formSubmission/FormSubmissionProcessorScheduleTest.java b/opensrp-core/src/test/java/org/opensrp/service/formSubmission/FormSubmissionProcessorScheduleTest.java deleted file mode 100644 index 742aff183e..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/formSubmission/FormSubmissionProcessorScheduleTest.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.opensrp.service.formSubmission; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -import java.io.IOException; - -import org.joda.time.LocalDate; -import org.json.JSONException; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.scheduler.HealthSchedulerService; -import org.opensrp.scheduler.ScheduleConfig; -import org.opensrp.scheduler.service.ScheduleService; -import org.opensrp.util.TestResourceLoader; - -import com.google.gson.JsonIOException; - -public class FormSubmissionProcessorScheduleTest extends TestResourceLoader { - - public FormSubmissionProcessorScheduleTest() throws IOException { - super(); - } - - @Mock - private FormSubmissionProcessor fsp; - - @Mock - private HealthSchedulerService scheduleService; - - @Mock - private ScheduleService schService; - - @Before - public void setup() throws IOException, JSONException { - initMocks(this); - - ScheduleConfig scheduleConfig = new ScheduleConfig("/schedules/schedule-config.xls"); - scheduleService = new HealthSchedulerService(null, schService, scheduleConfig); - fsp = new FormSubmissionProcessor(null, null, null, scheduleService, null, null, null, null); - } - - @Test - public void shouldScheduleP1WhenNoneGivenOnEnrollment() throws JsonIOException, IOException, JSONException { - FormSubmission fs = getFormSubmissionFor("child_enrollment", 3); - - spy(fsp).handleSchedules(fs); - - verify(schService).enroll("8cc8cbca-7c39-4c57-b8c7-5ccd5cf88af7", "PENTAVALENT 1", "penta1", "2014-12-13", - "1996b940-181e-46d5-bf8f-630bef2880a9"); - } - - @Test - public void shouldEnrollScheduleProperly() throws IOException, JSONException { - FormSubmission fs = getFormSubmissionFor("child_followup"); - HealthSchedulerService mockScheduleService = mock(HealthSchedulerService.class); - when(mockScheduleService.findAutomatedSchedules(fs.formName())) - .thenReturn(scheduleService.findAutomatedSchedules(fs.formName())); - fsp = new FormSubmissionProcessor(null, null, null, mockScheduleService, null, null, null, null); - - fsp.handleSchedules(fs); - - verify(mockScheduleService).fullfillMilestoneAndCloseAlert("101aab44-5377-4846-95ad-442b857b54d2", fs.anmId(), - "PENTAVALENT 1", new LocalDate("2016-09-20"), fs.instanceId()); - verify(mockScheduleService).unEnrollFromSchedule("101aab44-5377-4846-95ad-442b857b54d2", fs.anmId(), "PENTAVALENT 1", - fs.instanceId()); - verify(mockScheduleService).enrollIntoSchedule("101aab44-5377-4846-95ad-442b857b54d2", "PENTAVALENT 2", "penta2", - "2016-09-20", fs.instanceId()); - } - - @Test - public void shouldEnrollScheduleForSubforms() throws IOException, JSONException { - FormSubmission fs = getFormSubmissionFor("new_household_registration", 2); - HealthSchedulerService mockScheduleService = mock(HealthSchedulerService.class); - when(mockScheduleService.findAutomatedSchedules(fs.formName())) - .thenReturn(scheduleService.findAutomatedSchedules(fs.formName())); - fsp = new FormSubmissionProcessor(null, null, null, mockScheduleService, null, null, null, null); - - fsp.handleSchedules(fs); - - verify(mockScheduleService).enrollIntoSchedule("0aac6d81-b51f-4096-b354-5a5786e406c8", "FW CENSUS", "FW CENSUS", - "2015-05-06", fs.instanceId()); - verify(mockScheduleService).enrollIntoSchedule("b19db74f-6e96-4652-a765-5078beb12434", "Psrf", "psrf", "2000-12-12", - fs.instanceId()); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/formSubmission/StubAllAppStateToken.java b/opensrp-core/src/test/java/org/opensrp/service/formSubmission/StubAllAppStateToken.java deleted file mode 100644 index 59ca123e94..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/formSubmission/StubAllAppStateToken.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.opensrp.service.formSubmission; - -import org.ektorp.CouchDbConnector; -import org.opensrp.repository.couch.AllAppStateTokens; - -public class StubAllAppStateToken extends AllAppStateTokens { - - public StubAllAppStateToken(CouchDbConnector db) { - super(db); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/formSubmission/StubAllFormSubmission.java b/opensrp-core/src/test/java/org/opensrp/service/formSubmission/StubAllFormSubmission.java deleted file mode 100644 index 76e4730895..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/formSubmission/StubAllFormSubmission.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.opensrp.service.formSubmission; - -import org.ektorp.CouchDbConnector; -import org.opensrp.form.repository.AllFormSubmissions; - -public class StubAllFormSubmission extends AllFormSubmissions { - - public StubAllFormSubmission(CouchDbConnector db) { - super(db); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/it/BaseEntityServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/it/BaseEntityServiceTest.java deleted file mode 100644 index db7af1f7c6..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/it/BaseEntityServiceTest.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.opensrp.service.it; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.opensrp.util.SampleFullDomainObject.BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.DIFFERENT_BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.IDENTIFIER_TYPE; -import static org.opensrp.util.SampleFullDomainObject.IDENTIFIER_VALUE; -import static org.opensrp.util.SampleFullDomainObject.getBaseEntity; -import static org.opensrp.util.SampleFullDomainObject.identifier; -import static org.utils.AssertionUtil.assertTwoListAreSameIgnoringOrder; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.domain.BaseEntity; -import org.opensrp.repository.couch.AllBaseEntities; -import org.opensrp.service.BaseEntityService; -import org.springframework.beans.factory.annotation.Autowired; - -public class BaseEntityServiceTest extends BaseIntegrationTest { - - @Autowired - public AllBaseEntities allBaseEntities; - - @Autowired - public BaseEntityService baseEntityService; - - @Before - public void setUp() { - allBaseEntities.removeAll(); - } - - @After - public void cleanUp() { - allBaseEntities.removeAll(); - } - - @Test - public void shouldGetAllBaseEntities() { - BaseEntity baseEntity = getBaseEntity(); - BaseEntity baseEntity1 = getBaseEntity(); - baseEntity1.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - List expectedBaseEntities = asList(baseEntity, baseEntity1); - addObjectToRepository(expectedBaseEntities, allBaseEntities); - - List actualBaseEntities = baseEntityService.getAllBaseEntities(); - - assertTwoListAreSameIgnoringOrder(expectedBaseEntities, actualBaseEntities); - } - - @Test - public void shouldFindByEntityId() { - BaseEntity expectedBaseEntity = getBaseEntity(); - BaseEntity invalidBaseEntity = getBaseEntity(); - invalidBaseEntity.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - addObjectToRepository(asList(expectedBaseEntity, invalidBaseEntity), allBaseEntities); - - BaseEntity actualBaseEntity = baseEntityService.findByBaseEntityId(BASE_ENTITY_ID); - - assertEquals(expectedBaseEntity, actualBaseEntity); - } - - @Test - public void shouldFindByIdentifierValue() { - BaseEntity expectedBaseEntity = getBaseEntity(); - BaseEntity expectedBaseEntity1 = getBaseEntity(); - BaseEntity invalidBaseEntity = getBaseEntity(); - Map differentIdentifiers = new HashMap<>(identifier); - differentIdentifiers.put(IDENTIFIER_TYPE, DIFFERENT_BASE_ENTITY_ID); - invalidBaseEntity.setIdentifiers(differentIdentifiers); - List expectedBaseEntities = asList(expectedBaseEntity, expectedBaseEntity1); - addObjectToRepository(asList(expectedBaseEntity, expectedBaseEntity1, invalidBaseEntity), allBaseEntities); - - List actualBaseEntities = baseEntityService.findByIdentifier(IDENTIFIER_VALUE); - - assertTwoListAreSameIgnoringOrder(expectedBaseEntities, actualBaseEntities); - } - - @Test - public void shouldFindByIdentifierTypeAndValue() { - BaseEntity expectedBaseEntity = getBaseEntity(); - BaseEntity expectedBaseEntity1 = getBaseEntity(); - BaseEntity invalidBaseEntity = getBaseEntity(); - Map differentIdentifiers = new HashMap<>(); - differentIdentifiers.put(DIFFERENT_BASE_ENTITY_ID, DIFFERENT_BASE_ENTITY_ID); - invalidBaseEntity.setIdentifiers(differentIdentifiers); - List expectedBaseEntities = asList(expectedBaseEntity, expectedBaseEntity1); - addObjectToRepository(asList(expectedBaseEntity, expectedBaseEntity1, invalidBaseEntity), allBaseEntities); - - List actualBaseEntities = baseEntityService.findByIdentifier(IDENTIFIER_TYPE, IDENTIFIER_VALUE); - - assertTwoListAreSameIgnoringOrder(expectedBaseEntities, actualBaseEntities); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/it/ClientServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/it/ClientServiceTest.java deleted file mode 100644 index a06105a584..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/it/ClientServiceTest.java +++ /dev/null @@ -1,532 +0,0 @@ -package org.opensrp.service.it; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; -import static org.opensrp.util.SampleFullDomainObject.BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.DIFFERENT_BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.IDENTIFIER_TYPE; -import static org.opensrp.util.SampleFullDomainObject.IDENTIFIER_VALUE; -import static org.opensrp.util.SampleFullDomainObject.LAST_NAME; -import static org.opensrp.util.SampleFullDomainObject.getClient; -import static org.opensrp.util.SampleFullDomainObject.identifier; -import static org.utils.AssertionUtil.assertNewObjectCreation; -import static org.utils.AssertionUtil.assertObjectUpdate; -import static org.utils.AssertionUtil.assertTwoListAreSameIgnoringOrder; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.joda.time.DateTime; -import org.joda.time.DateTimeZone; -import org.json.JSONException; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.domain.Client; -import org.opensrp.domain.postgres.HouseholdClient; -import org.opensrp.repository.couch.AllClients; -import org.opensrp.search.AddressSearchBean; -import org.opensrp.search.ClientSearchBean; -import org.opensrp.service.ClientService; -import org.springframework.beans.factory.annotation.Autowired; - -//TODO: Write couch-lucene related method test cases e.g: findByCriteria -public class ClientServiceTest extends BaseIntegrationTest { - - @Autowired - private AllClients allClients; - - @Autowired - private ClientService clientService; - - @Before - public void setUp() { - allClients.removeAll(); - } - - @After - public void cleanUp() { - allClients.removeAll(); - } - - @Test - public void shouldFindByBaeEntityId() { - String baseEntityId = "baseEntityId"; - Client expectedClient = new Client(baseEntityId); - Client invalidClient = new Client("b2"); - Client invalidClientSecond = new Client("b3"); - List clientList = asList(expectedClient, invalidClient, invalidClientSecond); - addObjectToRepository(clientList, allClients); - - Client actualClient = clientService.getByBaseEntityId(baseEntityId); - - assertEquals(expectedClient, actualClient); - } - - @Test - public void shouldFindAllClient() { - Client expectedClient = new Client("b1"); - Client expectedClient2 = new Client("b2"); - Client expectedClient3 = new Client("b3"); - List expectedClientList = asList(expectedClient, expectedClient2, expectedClient3); - addObjectToRepository(expectedClientList, allClients); - - List actualClientList = clientService.findAllClients(); - - assertTwoListAreSameIgnoringOrder(expectedClientList, actualClientList); - - } - - @Test - public void shouldFindAllClientsByIdentifierValue() { - Client expectedClient = new Client("b1"); - expectedClient.addIdentifier("type", "value"); - Client expectedClient2 = new Client("b2"); - expectedClient2.addIdentifier("type", "value"); - Client invalidClient = new Client("b3"); - invalidClient.addIdentifier("type2", "value2"); - addObjectToRepository(asList(expectedClient, expectedClient2, invalidClient), allClients); - List expectedClientList = asList(expectedClient, expectedClient2); - - List actualClientList = clientService.findAllByIdentifier("value"); - - assertTwoListAreSameIgnoringOrder(expectedClientList, actualClientList); - } - - @Test - public void shouldFindAllClientsByIdentifierTypeAndValue() { - Client expectedClient = new Client("b1"); - expectedClient.addIdentifier("type", "value"); - Client expectedClient2 = new Client("b2"); - expectedClient2.addIdentifier("type", "value"); - Client invalidClient = new Client("b3"); - invalidClient.addIdentifier("type2", "value2"); - addObjectToRepository(asList(expectedClient, expectedClient2, invalidClient), allClients); - List expectedClientList = asList(expectedClient, expectedClient2); - - List actualClientList = clientService.findAllByIdentifier("type", "value"); - assertTwoListAreSameIgnoringOrder(expectedClientList, actualClientList); - } - - @Test - public void shouldFindAllClientsByRelationIdAndDateCreated() { - Client expectedClient = new Client("b1"); - expectedClient.addRelationship("mother", "id"); - expectedClient.setDateCreated(new DateTime(100L, DateTimeZone.UTC)); - Client expectedClient2 = new Client("b2"); - expectedClient2.addRelationship("mother", "id"); - expectedClient2.setDateCreated(new DateTime(200L, DateTimeZone.UTC)); - Client invalidClient = new Client("b3"); - invalidClient.addRelationship("mother", "id2"); - expectedClient.setDateCreated(new DateTime(300L, DateTimeZone.UTC)); - addObjectToRepository(asList(expectedClient, expectedClient2, invalidClient), allClients); - List expectedClientList = asList(expectedClient, expectedClient2); - - List actualClientList = clientService.findByRelationshipIdAndDateCreated("id", new DateTime(100L, - DateTimeZone.UTC).toLocalDate().toString(), new DateTime(200L, DateTimeZone.UTC).toLocalDate().toString()); - - assertTwoListAreSameIgnoringOrder(expectedClientList, actualClientList); - } - - //TODO: Couch-lucene query error - @Test - @Ignore - public void shouldFindByRelationShip() { - Client expectedClient = getClient(); - expectedClient.addRelationship("mother", "id"); - expectedClient.setDateCreated(new DateTime(DateTimeZone.UTC)); - Client expectedClient2 = getClient(); - expectedClient2.setBaseEntityId("dd"); - expectedClient2.addRelationship("mother", "id"); - expectedClient2.setDateCreated(new DateTime(DateTimeZone.UTC)); - Client invalidClient = getClient(); - invalidClient.setBaseEntityId("ddss"); - invalidClient.addRelationship("mother", "id2"); - expectedClient.setDateCreated(new DateTime(DateTimeZone.UTC)); - addObjectToRepository(asList(expectedClient, expectedClient2, invalidClient), allClients); - List expectedClientList = asList(expectedClient, expectedClient2); - - List actualClientList = clientService.findByRelationship("id"); - - assertTwoListAreSameIgnoringOrder(expectedClientList, actualClientList); - } - - @Test - public void shouldFindByAttributeTypeAndValue() { - Client expectedClient = new Client("b1"); - expectedClient.addAttribute("type", "value"); - Client expectedClient2 = new Client("b2"); - expectedClient2.addAttribute("type", "value"); - Client invalidClient = new Client("b3"); - invalidClient.addAttribute("type2", "value2"); - addObjectToRepository(asList(expectedClient, expectedClient2, invalidClient), allClients); - List expectedClientList = asList(expectedClient, expectedClient2); - - List actualClientList = clientService.findAllByAttribute("type", "value"); - assertTwoListAreSameIgnoringOrder(expectedClientList, actualClientList); - } - - @Test - public void shouldFindAllMatchingName() { - Client expectedClient = new Client("b1"); - expectedClient.setFirstName("first"); - expectedClient.setLastName("last"); - Client expectedClient2 = new Client("b2"); - expectedClient2.setFirstName("first"); - expectedClient2.setLastName("last"); - Client invalidClient = new Client("b3"); - invalidClient.setFirstName("invalid"); - invalidClient.setLastName("invalid"); - addObjectToRepository(asList(expectedClient, expectedClient2, invalidClient), allClients); - List expectedClientList = asList(expectedClient, expectedClient2); - - List actualClientList = clientService.findAllByMatchingName("first"); - assertTwoListAreSameIgnoringOrder(expectedClientList, actualClientList); - } - - /*@Test - @Ignore - public void shouldFindByAllCriteria() { - Client expectedClient = SampleFullDomainObject.client; - Client invalidClient = new Client(SampleFullDomainObject.BASE_ENTITY_ID); - invalidClient.setFirstName("invalid"); - invalidClient.setLastName("invalid"); - addObjectToRepository(asList(expectedClient, invalidClient), allClients); - List expectedClientList = asList(expectedClient); - - List actualClientList = clientService.findByCriteria(FIRST_NAME, ); - assertTwoListAreSameIgnoringOrder(expectedClientList, actualClientList); - }*/ - //TODO: Repository is returning time in UTC format. - //TODO: TEST value of Date created field. - @Test - public void shouldAdd() { - Client expectedClient = getClient(); - - Client actualClient = clientService.addClient(expectedClient); - - List dbClients = allClients.getAll(); - assertEquals(1, dbClients.size()); - - assertEquals(expectedClient, actualClient); - assertNewObjectCreation(expectedClient, dbClients.get(0)); - } - - @Test(expected = RuntimeException.class) - public void shouldThrowRuntimeExceptionWhileAddIfNoBaseEntityIdFound() { - Client expectedClient = getClient(); - expectedClient.setBaseEntityId(null); - - clientService.addClient(expectedClient); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowIllegalArgumentExceptionIfAClientAlreadyExistWithSameIdentifier() { - - addObjectToRepository(Collections.singletonList(getClient()), allClients); - Client expectedClient = allClients.getAll().get(0); - expectedClient.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - - clientService.addClient(expectedClient); - } - - //TODO: Repository is returning time in UTC format. - //TODO: TEST value of Date created field. - @Test - public void shouldAddWithCouchDbConnector() throws IOException { - Client expectedClient = getClient(); - - Client actualClient = clientService.addClient(expectedClient); - - List dbClients = allClients.getAll(); - assertEquals(1, dbClients.size()); - assertNewObjectCreation(expectedClient, dbClients.get(0)); - assertEquals(expectedClient, actualClient); - - } - - @Test(expected = RuntimeException.class) - public void shouldThrowRuntimeExceptionWhileAddIfNoBaseEntityIdFoundWithCouchDbConnector() throws IOException { - Client expectedClient = getClient(); - expectedClient.setBaseEntityId(null); - clientService.addClient(expectedClient); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowIllegalArgumentExceptionIfAClientAlreadyExistWithSameIdentifierWithCouchDbConnector() - throws IOException { - Client expectedClient = getClient(); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - expectedClient.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - clientService.addClient(expectedClient); - } - - @Test - public void shouldFindFromClientObjectWithBaseIdentifier() { - Client expectedClient = getClient(); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - Client actualClient = clientService.findClient(expectedClient); - - assertEquals(expectedClient, actualClient); - } - - @Test - public void shouldFindFromClientWithIdentifiers() { - Client expectedClient = getClient(); - expectedClient.setBaseEntityId(null); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - Client actualClient = clientService.findClient(expectedClient); - - assertEquals(expectedClient, actualClient); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfMultipleClientFoundWithSameIdentifier() { - Client expectedClient = getClient(); - Client sameClient = getClient(); - sameClient.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - addObjectToRepository(asList(expectedClient, sameClient), allClients); - expectedClient.setBaseEntityId(null); - - clientService.findClient(expectedClient); - - } - - @Test - public void shouldReturnNullIfNoClientFound() { - Client expectedClient = getClient(); - - Client actualClient = clientService.findClient(expectedClient); - - assertNull(actualClient); - } - - @Test - public void shouldFindFromClientObjectWithBaseIdentifierWithCouchDbConnector() throws IOException { - Client expectedClient = getClient(); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - Client actualClient = clientService.findClient(expectedClient); - - assertEquals(expectedClient, actualClient); - } - - @Test - public void shouldFindFromClientWithIdentifiersWithCouchDbConnector() throws IOException { - Client expectedClient = getClient(); - expectedClient.setBaseEntityId(null); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - - Client actualClient = clientService.findClient(expectedClient); - - assertEquals(expectedClient, actualClient); - } - - public void shouldReturnNullIfMultipleClientFoundWithSameIdentifierWithCouchDbConnector() throws IOException { - Client expectedClient = getClient(); - Client sameClient = getClient(); - sameClient.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - addObjectToRepository(asList(expectedClient, sameClient), allClients); - expectedClient.setBaseEntityId(null); - - Client client = clientService.findClient(expectedClient); - - assertNull(client); - - } - - @Test - public void shouldReturnNullIfNoClientFoundWithCouchDbConnector() throws IOException { - Client expectedClient = getClient(); - - Client actualClient = clientService.findClient(expectedClient); - - assertNull(actualClient); - } - - @Test - public void shouldFindByUniqueIdBaseEntityId() { - Client expectedClient = getClient(); - Client invalidClient = getClient(); - invalidClient.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - addObjectToRepository(asList(expectedClient, invalidClient), allClients); - - Client actualClient = clientService.find(BASE_ENTITY_ID); - - assertEquals(expectedClient, actualClient); - - } - - @Test - public void shouldFindByUniqueIdIdentifier() { - Client expectedClient = getClient(); - Client invalidClient = getClient(); - Map differentIdentifiers = new HashMap<>(identifier); - differentIdentifiers.put(IDENTIFIER_TYPE, "differentValue"); - invalidClient.setIdentifiers(differentIdentifiers); - addObjectToRepository(asList(expectedClient, invalidClient), allClients); - - Client actualClient = clientService.find(IDENTIFIER_VALUE); - - assertEquals(expectedClient, actualClient); - - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfMultipleClientFoundWithSameIdentifierUsingUniqueId() { - Client expectedClient = getClient(); - Client sameClient = getClient(); - sameClient.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - addObjectToRepository(asList(expectedClient, sameClient), allClients); - - clientService.find(IDENTIFIER_VALUE); - - } - - @Test - public void shouldReturnNullIfNoClientFoundUsingUniqueId() { - Client expectedClient = getClient(); - addObjectToRepository(Collections.singletonList(expectedClient), allClients); - Client actualClient = clientService.find(DIFFERENT_BASE_ENTITY_ID); - - assertNull(actualClient); - } - - //TODO: Repository is returning time in UTC format. - //TODO: TEST value of Date edited field. - @Test - public void shouldUpdateClient() throws JSONException { - Client client = getClient(); - addObjectToRepository(Collections.singletonList(client), allClients); - Client updatedClient = allClients.getAll().get(0); - updatedClient.setFirstName(LAST_NAME); - - clientService.updateClient(updatedClient); - - List actualClientList = allClients.getAll(); - assertEquals(1, actualClientList.size()); - assertObjectUpdate(updatedClient, actualClientList.get(0)); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionWhileUpdateIfNewClient() throws JSONException { - Client client = getClient(); - - clientService.updateClient(client); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionWhileUpdateIfClientIsNotFound() throws JSONException { - addObjectToRepository(Collections.singletonList(getClient()), allClients); - Client updatedClient = allClients.getAll().get(0); - allClients.removeAll(); - - clientService.updateClient(updatedClient); - } - - @Test - public void shouldFindByServerVersion() { - addObjectToRepository(Collections.singletonList(getClient()), allClients); - Client expectedClient = allClients.getAll().get(0); - - List actualClientList = clientService.findByServerVersion(expectedClient.getServerVersion() - 1); - - assertEquals(1, actualClientList.size()); - assertEquals(expectedClient, actualClientList.get(0)); - } - - @Test - public void shouldAddIfNewEntityInAddOrUpdateMethod() { - Client expectedClient = getClient(); - - Client actualClient = clientService.addorUpdate(expectedClient); - - List dbClients = allClients.getAll(); - assertEquals(1, dbClients.size()); - - assertEquals(expectedClient, actualClient); - assertNewObjectCreation(expectedClient, dbClients.get(0)); - - } - - @Test - public void shouldUpdateIfExistingEntityInAddOrUpdateMethodRes() { - addObjectToRepository(Collections.singletonList(getClient()), allClients); - Client expectedClient = allClients.getAll().get(0); - expectedClient.setFirstName(LAST_NAME); - Long expectedServerVersion = expectedClient.getServerVersion(); - - Client actualClient = clientService.addorUpdate(expectedClient); - - List dbClients = allClients.getAll(); - assertEquals(1, dbClients.size()); - assertEquals(expectedClient, actualClient); - - actualClient = dbClients.get(0); - assertNotEquals(expectedServerVersion, actualClient.getServerVersion()); - assertEquals(expectedClient.getFirstName(), actualClient.getFirstName()); - assertEquals(expectedClient.getLastName(), actualClient.getLastName()); - assertEquals(expectedClient.getMiddleName(), actualClient.getMiddleName()); - assertEquals(expectedClient.getBirthdate(), actualClient.getBirthdate()); - assertEquals(expectedClient.getDeathdate(), actualClient.getDeathdate()); - assertEquals(expectedClient.getFirstName(), actualClient.getFirstName()); - assertEquals(expectedClient.getBaseEntityId(), actualClient.getBaseEntityId()); - } - - @Test(expected = RuntimeException.class) - public void shouldThrowErrorIfBaseEntityIdNotFound() { - addObjectToRepository(Collections.singletonList(getClient()), allClients); - Client expectedClient = allClients.getAll().get(0); - expectedClient.setBaseEntityId(null); - clientService.addorUpdate(expectedClient); - } - - @Test - public void shouldUpdateIfExistingEntityInAddOrUpdateMethodWithOutResettingServerVersion() { - addObjectToRepository(Collections.singletonList(getClient()), allClients); - Client expectedClient = allClients.getAll().get(0); - expectedClient.setFirstName(LAST_NAME); - Client actualClient = clientService.addorUpdate(expectedClient, false); - - List dbClients = allClients.getAll(); - assertEquals(1, dbClients.size()); - - assertEquals(expectedClient, actualClient); - assertObjectUpdate(expectedClient, dbClients.get(0)); - } - - @Test - public void shouldFindMembersByRelationshipId() { - List expectedClient = clientService.findMembersByRelationshipId("0154839f-8766-4eda-b729-89067c7a8c5d"); - assertNull(expectedClient); - } - - @Test - public void shouldGetHouseholdList() { - List ids = new ArrayList(); - ids.add("0154839f-8766-4eda-b729-89067c7a8c5d"); - List clients = new ArrayList(); - List expectedClients = clientService.getHouseholdList(ids, "ec_member", new AddressSearchBean(), - new ClientSearchBean(), clients); - assertEquals(expectedClients.size(), 0); - } - - @Test - public void shouldGetMemberCountHouseholdHeadProviderByClients() { - List id = new ArrayList(); - id.add("28caef27-d1b3-497b-8a55-954f2f0f6e24"); - Map results = clientService.getMemberCountHouseholdHeadProviderByClients(id, "ec_member"); - assertEquals(results.size(), 0); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/it/ConfigServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/it/ConfigServiceTest.java deleted file mode 100644 index a887888df5..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/it/ConfigServiceTest.java +++ /dev/null @@ -1,193 +0,0 @@ -package org.opensrp.service.it; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; -import static org.opensrp.util.SampleFullDomainObject.APP_STATE_TOKEN_DESCRIPTION; -import static org.opensrp.util.SampleFullDomainObject.DIFFERENT_BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.LAST_EDIT_DATE; -import static org.opensrp.util.SampleFullDomainObject.VALUE; -import static org.opensrp.util.SampleFullDomainObject.getAppStateToken; -import static org.opensrp.util.SampleFullDomainObject.AppStateTokenName.APP_STATE_TOKEN_NAME; -import static org.opensrp.util.SampleFullDomainObject.AppStateTokenName.DIFFERENT_APP_STATE_TOKEN_NAME; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; -import static org.utils.CouchDbAccessUtils.getCouchDbConnector; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.domain.AppStateToken; -import org.opensrp.repository.couch.AllAppStateTokens; -import org.opensrp.service.ConfigService; -import org.springframework.beans.factory.annotation.Autowired; - -public class ConfigServiceTest extends BaseIntegrationTest { - - @Autowired - AllAppStateTokens allAppStateTokens; - - @Autowired - ConfigService configService; - - @Before - public void setUp() { - allAppStateTokens.removeAll(); - } - - @After - public void cleanUp() { - allAppStateTokens.removeAll(); - } - - @Test - public void shouldFindAppStateTokenByName() { - AppStateToken expectedAppStateToken = getAppStateToken(); - AppStateToken invalidAppStateToken = getAppStateToken(); - invalidAppStateToken.setName(DIFFERENT_APP_STATE_TOKEN_NAME.name()); - addObjectToRepository(asList(expectedAppStateToken, invalidAppStateToken), allAppStateTokens); - - AppStateToken actualAppStateToken = configService.getAppStateTokenByName(APP_STATE_TOKEN_NAME); - - assertEquals(expectedAppStateToken, actualAppStateToken); - } - - @Test(expected = IllegalStateException.class) - public void shouldThrowExceptionIfMultipleAppStateTokenWithSameNameFound() { - AppStateToken expectedAppStateToken = getAppStateToken(); - AppStateToken invalidAppStateToken = getAppStateToken(); - addObjectToRepository(asList(expectedAppStateToken, invalidAppStateToken), allAppStateTokens); - - configService.getAppStateTokenByName(APP_STATE_TOKEN_NAME); - - } - - @Test - public void shouldReturnNullIfNoTokenFound() { - assertNull(configService.getAppStateTokenByName(APP_STATE_TOKEN_NAME)); - } - - @Test - public void shouldFindAppStateTokenByNameUsingCouchdbConnector() throws IOException { - AppStateToken expectedAppStateToken = getAppStateToken(); - AppStateToken invalidAppStateToken = getAppStateToken(); - invalidAppStateToken.setName(DIFFERENT_APP_STATE_TOKEN_NAME.name()); - addObjectToRepository(asList(expectedAppStateToken, invalidAppStateToken), allAppStateTokens); - - AppStateToken actualAppStateToken = allAppStateTokens.getAppStateTokenByName(getCouchDbConnector("opensrp"), - APP_STATE_TOKEN_NAME); - - assertEquals(expectedAppStateToken, actualAppStateToken); - } - - @Test - public void shouldUpdate() { - AppStateToken expectedAppStateToken = getAppStateToken(); - addObjectToRepository(Collections.singletonList(expectedAppStateToken), allAppStateTokens); - - expectedAppStateToken.setValue(DIFFERENT_BASE_ENTITY_ID); - - configService.updateAppStateToken(APP_STATE_TOKEN_NAME, DIFFERENT_BASE_ENTITY_ID); - - List allTokens = allAppStateTokens.getAll(); - assertEquals(1, allTokens.size()); - assertNotEquals(expectedAppStateToken.getLastEditDate(), allTokens.get(0).getLastEditDate()); - - allTokens.get(0).setLastEditDate(LAST_EDIT_DATE); - assertEquals(expectedAppStateToken, allTokens.get(0)); - } - - @Test(expected = IllegalStateException.class) - public void shouldThrowExceptionIfMultipleTokenFoundWithSameNameWhileUpdate() { - AppStateToken expectedAppStateToken = getAppStateToken(); - AppStateToken invalidAppStateToken = getAppStateToken(); - addObjectToRepository(asList(expectedAppStateToken, invalidAppStateToken), allAppStateTokens); - - configService.updateAppStateToken(APP_STATE_TOKEN_NAME, DIFFERENT_BASE_ENTITY_ID); - } - - @Test - public void shouldThrowExceptionIfTokenNotFound() { - - } - - @Test - public void shouldUpdateWithCouchDbConnector() throws IOException { - AppStateToken expectedAppStateToken = getAppStateToken(); - addObjectToRepository(Collections.singletonList(expectedAppStateToken), allAppStateTokens); - - expectedAppStateToken.setValue(DIFFERENT_BASE_ENTITY_ID); - - allAppStateTokens.updateAppStateToken(getCouchDbConnector("opensrp"), APP_STATE_TOKEN_NAME, - DIFFERENT_BASE_ENTITY_ID); - - List allTokens = allAppStateTokens.getAll(); - assertEquals(1, allTokens.size()); - assertNotEquals(expectedAppStateToken.getLastEditDate(), allTokens.get(0).getLastEditDate()); - - allTokens.get(0).setLastEditDate(LAST_EDIT_DATE); - assertEquals(expectedAppStateToken, allTokens.get(0)); - } - - @Test - public void shouldRegisterNewAppStateToken() { - AppStateToken expectedAppStateToken = getAppStateToken(); - expectedAppStateToken.setLastEditDate(0L); - - AppStateToken actualAppStateToken = configService.registerAppStateToken(APP_STATE_TOKEN_NAME, VALUE, - APP_STATE_TOKEN_DESCRIPTION, true); - - List allTokens = allAppStateTokens.getAll(); - assertEquals(1, allTokens.size()); - assertEquals(expectedAppStateToken, allTokens.get(0)); - assertEquals(expectedAppStateToken, actualAppStateToken); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionInRegisterIfNameIsNull() { - configService.registerAppStateToken(null, VALUE, APP_STATE_TOKEN_DESCRIPTION, true); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionInRegisterIfDescriptionIsEmpty() { - configService.registerAppStateToken(APP_STATE_TOKEN_NAME, VALUE, "", true); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionInRegisterIfTokenAlreadyExistAndSuppressWaringIsOff() { - AppStateToken expectedAppStateToken = getAppStateToken(); - addObjectToRepository(Collections.singletonList(expectedAppStateToken), allAppStateTokens); - - configService.registerAppStateToken(APP_STATE_TOKEN_NAME, VALUE, APP_STATE_TOKEN_DESCRIPTION, false); - } - - @Test - public void shouldReturnExistingTokenIfSuppressWarningIsOn() { - AppStateToken expectedAppStateToken = getAppStateToken(); - addObjectToRepository(Collections.singletonList(expectedAppStateToken), allAppStateTokens); - - AppStateToken actualAppStateToken = configService.registerAppStateToken(APP_STATE_TOKEN_NAME, VALUE, - APP_STATE_TOKEN_DESCRIPTION, true); - - assertEquals(expectedAppStateToken, actualAppStateToken); - } - - @Test - public void shouldRegisterNewTokenWithCouchdbConnector() throws IOException { - AppStateToken expectedAppStateToken = getAppStateToken(); - expectedAppStateToken.setLastEditDate(0L); - - AppStateToken actualAppStateToken = allAppStateTokens.registerAppStateToken(getCouchDbConnector("opensrp"), - APP_STATE_TOKEN_NAME, VALUE, APP_STATE_TOKEN_DESCRIPTION, true); - - List allTokens = allAppStateTokens.getAll(); - assertEquals(1, allTokens.size()); - assertEquals(expectedAppStateToken, allTokens.get(0)); - assertEquals(expectedAppStateToken, actualAppStateToken); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/it/ErrorTraceTest.java b/opensrp-core/src/test/java/org/opensrp/service/it/ErrorTraceTest.java deleted file mode 100644 index 11bfd24d57..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/it/ErrorTraceTest.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.opensrp.service.it; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.opensrp.util.SampleFullDomainObject.EPOCH_DATE_TIME; -import static org.opensrp.util.SampleFullDomainObject.getErrorTrace; -import static org.utils.AssertionUtil.assertTwoListAreSameIgnoringOrder; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; - -import java.util.Collections; -import java.util.List; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.domain.ErrorTrace; -import org.opensrp.repository.couch.AllErrorTrace; -import org.opensrp.service.ErrorTraceService; -import org.springframework.beans.factory.annotation.Autowired; - -public class ErrorTraceTest extends BaseIntegrationTest { - - @Autowired - public AllErrorTrace allErrorTrace; - - @Autowired - public ErrorTraceService errorTraceService; - - @Before - public void setUp() { - allErrorTrace.removeAll(); - } - - @After - public void cleanUp() { - allErrorTrace.removeAll(); - } - - @Test - public void shouldGetErrorTraceById() { - addObjectToRepository(Collections.singletonList(getErrorTrace()), allErrorTrace); - ErrorTrace expectedErrorTrace = allErrorTrace.getAll().get(0); - - ErrorTrace actualErrorTrace = errorTraceService.getError(expectedErrorTrace.getId()); - - assertEquals(expectedErrorTrace, actualErrorTrace); - } - - @Test - public void shouldGetAllUnsolvedErrors() { - ErrorTrace errorTrace = getErrorTrace(); - errorTrace.setStatus("unsolved"); - ErrorTrace errorTrace1 = getErrorTrace(); - errorTrace1.setStatus("unsolved"); - ErrorTrace invalidErrorTrace = getErrorTrace(); - invalidErrorTrace.setStatus("solved"); - addObjectToRepository(asList(errorTrace, errorTrace1, invalidErrorTrace), allErrorTrace); - List expectedErrorTraces = asList(errorTrace, errorTrace1); - - List actualErrorTraces = errorTraceService.getAllUnsolvedErrors(); - - assertTwoListAreSameIgnoringOrder(expectedErrorTraces, actualErrorTraces); - } - - @Test - public void shouldReturnNullIfNoUnsolvedErrorFound() { - assertNull(errorTraceService.getAllUnsolvedErrors()); - } - - @Test - public void shouldGetAllSolvedErrors() { - ErrorTrace errorTrace = getErrorTrace(); - errorTrace.setStatus("solved"); - ErrorTrace errorTrace1 = getErrorTrace(); - errorTrace1.setStatus("solved"); - ErrorTrace invalidErrorTrace = getErrorTrace(); - invalidErrorTrace.setStatus("unsolved"); - addObjectToRepository(asList(errorTrace, errorTrace1, invalidErrorTrace), allErrorTrace); - List expectedErrorTraces = asList(errorTrace, errorTrace1); - - List actualErrorTraces = errorTraceService.getAllSolvedErrors(); - - assertTwoListAreSameIgnoringOrder(expectedErrorTraces, actualErrorTraces); - } - - @Test - public void shouldReturnNullIfNoSolvedErrorFound() { - assertNull(errorTraceService.getAllSolvedErrors()); - } - - @Test - public void shouldGetAllAllErrors() { - ErrorTrace errorTrace = getErrorTrace(); - errorTrace.setStatus("unsolved"); - ErrorTrace errorTrace1 = getErrorTrace(); - errorTrace1.setStatus("unsolved"); - ErrorTrace errorTrace2 = getErrorTrace(); - errorTrace2.setStatus("solved"); - List expectedErrorTraces = asList(errorTrace, errorTrace1, errorTrace2); - - assertEquals(0, allErrorTrace.getAll().size()); - addObjectToRepository(expectedErrorTraces, allErrorTrace); - List actualErrorTraces = errorTraceService.getAllErrors(); - - assertTwoListAreSameIgnoringOrder(expectedErrorTraces, actualErrorTraces); - } - - @Test - public void shouldReturnNullIfNoErrorFound() { - assertNull(errorTraceService.getAllErrors()); - } - - @Test - public void shouldAddErrorTrace() { - ErrorTrace expectedErrorTrace = getErrorTrace(); - - errorTraceService.addError(expectedErrorTrace); - - List actualErrorTraces = allErrorTrace.getAll(); - - assertEquals(1, actualErrorTraces.size()); - assertEquals(expectedErrorTrace, actualErrorTraces.get(0)); - } - - @Test - public void shouldLogError() { - ErrorTrace expectedErrorTrace = getErrorTrace(); - expectedErrorTrace.setOccurredAt(null); - expectedErrorTrace.setStatus(null); - expectedErrorTrace.setRetryUrl("retryUrl"); - - errorTraceService.log(expectedErrorTrace.getErrorType(), expectedErrorTrace.getDocumentType(), - expectedErrorTrace.getRecordId(), expectedErrorTrace.getStackTrace(), "retryUrl"); - - List actualErrorTraces = allErrorTrace.getAll(); - - assertEquals(1, actualErrorTraces.size()); - assertNotNull(actualErrorTraces.get(0).getDateOccurred()); - actualErrorTraces.get(0).setDateOccurred(EPOCH_DATE_TIME); - assertEquals(expectedErrorTrace, actualErrorTraces.get(0)); - - } - - @Test - public void shouldUpdateError() { - addObjectToRepository(Collections.singletonList(getErrorTrace()), allErrorTrace); - ErrorTrace updatedErrorTrace = allErrorTrace.getAll().get(0); - updatedErrorTrace.setRetryUrl("retryUrl"); - updatedErrorTrace.setStatus("solved"); - - errorTraceService.updateError(updatedErrorTrace); - - List actualErrorTraces = allErrorTrace.getAll(); - - assertEquals(1, actualErrorTraces.size()); - assertEquals(updatedErrorTrace, actualErrorTraces.get(0)); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/it/EventServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/it/EventServiceTest.java deleted file mode 100644 index 94f6152c08..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/it/EventServiceTest.java +++ /dev/null @@ -1,596 +0,0 @@ -package org.opensrp.service.it; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.opensrp.common.AllConstants.OpenSRPEvent.Client.ZEIR_ID; -import static org.opensrp.util.SampleFullDomainObject.BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.DIFFERENT_BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.EVENT_TYPE; -import static org.opensrp.util.SampleFullDomainObject.FIELD_CODE; -import static org.opensrp.util.SampleFullDomainObject.FORM_SUBMISSION_ID; -import static org.opensrp.util.SampleFullDomainObject.IDENTIFIER_TYPE; -import static org.opensrp.util.SampleFullDomainObject.IDENTIFIER_VALUE; -import static org.opensrp.util.SampleFullDomainObject.PROVIDER_ID; -import static org.opensrp.util.SampleFullDomainObject.VALUE; -import static org.opensrp.util.SampleFullDomainObject.getClient; -import static org.opensrp.util.SampleFullDomainObject.getEvent; -import static org.opensrp.util.SampleFullDomainObject.getObs; -import static org.opensrp.util.SampleFullDomainObject.identifier; -import static org.utils.AssertionUtil.assertNewObjectCreation; -import static org.utils.AssertionUtil.assertObjectUpdate; -import static org.utils.AssertionUtil.assertTwoListAreSameIgnoringOrder; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; -import static org.utils.CouchDbAccessUtils.getCouchDbConnector; - -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.joda.time.DateTime; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.domain.Client; -import org.opensrp.domain.Event; -import org.opensrp.repository.couch.AllClients; -import org.opensrp.repository.couch.AllEvents; -import org.opensrp.service.EventService; -import org.springframework.beans.factory.annotation.Autowired; - -public class EventServiceTest extends BaseIntegrationTest { - - @Autowired - private AllEvents allEvents; - - @Autowired - private AllClients allClients; - - @Autowired - private EventService eventService; - - @Before - public void setUp() { - allClients.removeAll(); - allEvents.removeAll(); - } - - @Before - public void cleanUp() { - allClients.removeAll(); - allEvents.removeAll(); - } - - @Test - public void shouldFindAllByIdentifier() { - Event expectedEvent = getEvent(); - Event expectedEvent2 = getEvent(); - expectedEvent2.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - Event invalidEvent = getEvent(); - Map identifiers = new HashMap<>(identifier); - identifiers.put(IDENTIFIER_TYPE, "invalidValue"); - invalidEvent.setIdentifiers(identifiers); - List expectedEventList = asList(expectedEvent, expectedEvent2); - - addObjectToRepository(asList(expectedEvent, expectedEvent2, invalidEvent), allEvents); - - List actualEventList = eventService.findAllByIdentifier(IDENTIFIER_VALUE); - - assertTwoListAreSameIgnoringOrder(expectedEventList, actualEventList); - } - - @Test - public void shouldFindAllByIdentifierTypeAndValue() { - Event expectedEvent = getEvent(); - Event expectedEvent2 = getEvent(); - expectedEvent2.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - Event invalidEvent = getEvent(); - Map identifiers = new HashMap<>(identifier); - identifiers.put(IDENTIFIER_TYPE, "invalidValue"); - invalidEvent.setIdentifiers(identifiers); - List expectedEventList = asList(expectedEvent, expectedEvent2); - - addObjectToRepository(asList(expectedEvent, expectedEvent2, invalidEvent), allEvents); - - List actualEventList = eventService.findAllByIdentifier(IDENTIFIER_TYPE, IDENTIFIER_VALUE); - - assertTwoListAreSameIgnoringOrder(expectedEventList, actualEventList); - } - - @Test - public void shouldFindByDocumentId() { - addObjectToRepository(asList(getEvent()), allEvents); - Event expectedEvent = allEvents.getAll().get(0); - - Event actualEvent = eventService.getById(expectedEvent.getId()); - - assertEquals(expectedEvent, actualEvent); - } - - @Test - public void shouldFindByBaseEntityAndFormSubmissionId() { - Event expectedEvent = getEvent(); - Event invalidEvent = getEvent(); - invalidEvent.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - - addObjectToRepository(asList(expectedEvent, invalidEvent), allEvents); - - Event actualEvent = eventService.getByBaseEntityAndFormSubmissionId(BASE_ENTITY_ID, FORM_SUBMISSION_ID); - - assertEquals(expectedEvent, actualEvent); - } - - @Test(expected = IllegalStateException.class) - public void shouldThrowExceptionIfMultipleFound() { - addObjectToRepository(asList(getEvent(), getEvent()), allEvents); - - eventService.getByBaseEntityAndFormSubmissionId(BASE_ENTITY_ID, FORM_SUBMISSION_ID); - } - - @Test - public void shouldReturnNullIfNoEventFound() { - Event actualEvent = eventService.getByBaseEntityAndFormSubmissionId(BASE_ENTITY_ID, FORM_SUBMISSION_ID); - - assertNull(actualEvent); - } - - @Test - public void shouldFindByBaseEntityIdAndFormSubmissionIdUsingCouchDbConnector() throws IOException { - Event expectedEvent = getEvent(); - Event invalidEvent = getEvent(); - invalidEvent.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - - addObjectToRepository(asList(expectedEvent, invalidEvent), allEvents); - - Event actualEvent = allEvents.getByBaseEntityAndFormSubmissionId(getCouchDbConnector("opensrp"), BASE_ENTITY_ID, - FORM_SUBMISSION_ID); - - assertEquals(expectedEvent, actualEvent); - } - - @Test - public void shouldFindByBaseEntityId() { - Event expectedEvent = getEvent(); - Event expectedEvent2 = getEvent(); - Event invalidEvent = getEvent(); - invalidEvent.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - List expectedEvents = asList(expectedEvent, expectedEvent2); - - addObjectToRepository(asList(expectedEvent, expectedEvent2, invalidEvent), allEvents); - - List actualEvents = eventService.findByBaseEntityId(BASE_ENTITY_ID); - - assertTwoListAreSameIgnoringOrder(expectedEvents, actualEvents); - } - - @Test - public void shouldFindByFormSubmissionId() { - Event expectedEvent = getEvent(); - - addObjectToRepository(asList(expectedEvent), allEvents); - - Event actualEvent = eventService.findByFormSubmissionId(FORM_SUBMISSION_ID); - - assertEquals(expectedEvent, actualEvent); - } - - @Test - public void shouldFindByUniqueIdIdentifier() { - Event expectedEvent = getEvent(); - Event invalidEvent = getEvent(); - Map identifiers = new HashMap<>(identifier); - identifiers.put(IDENTIFIER_TYPE, "invalidValue"); - invalidEvent.setIdentifiers(identifiers); - - addObjectToRepository(asList(expectedEvent, invalidEvent), allEvents); - - Event actualEvent = eventService.find(IDENTIFIER_VALUE); - - assertEquals(expectedEvent, actualEvent); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfMultipleFoundWithSameIdentifierValue() { - Event expectedEvent = getEvent(); - Event expectedEvent2 = getEvent(); - expectedEvent2.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - Event invalidEvent = getEvent(); - Map identifiers = new HashMap<>(identifier); - identifiers.put(IDENTIFIER_TYPE, "invalidValue"); - invalidEvent.setIdentifiers(identifiers); - - addObjectToRepository(asList(expectedEvent, expectedEvent2, invalidEvent), allEvents); - - eventService.find(IDENTIFIER_VALUE); - } - - @Test - public void shouldReturnNullIfNothingFoundWithIdentifier() { - assertNull(eventService.find(IDENTIFIER_VALUE)); - } - - @Test - public void shouldFindByEventObject() { - Event expectedEvent = getEvent(); - - Event invalidEvent = getEvent(); - Map identifiers = new HashMap<>(identifier); - identifiers.put(IDENTIFIER_TYPE, "invalidValue"); - invalidEvent.setIdentifiers(identifiers); - - addObjectToRepository(asList(expectedEvent, invalidEvent), allEvents); - - Event actualEvent = eventService.find(expectedEvent); - - assertEquals(expectedEvent, actualEvent); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfMultipleFoundWithSameEvent() { - Event expectedEvent = getEvent(); - Event expectedEvent2 = getEvent(); - expectedEvent2.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - Event invalidEvent = getEvent(); - Map identifiers = new HashMap<>(identifier); - identifiers.put(IDENTIFIER_TYPE, "invalidValue"); - invalidEvent.setIdentifiers(identifiers); - - addObjectToRepository(asList(expectedEvent, expectedEvent2, invalidEvent), allEvents); - - eventService.find(expectedEvent); - } - - @Test - public void shouldReturnNullIfNothingFoundWithSameEvent() { - Event expectedEvent = getEvent(); - assertNull(eventService.find(expectedEvent)); - } - - @Test - public void shouldFindByEventOrDocumentId() { - addObjectToRepository(asList(getEvent()), allEvents); - Event expectedEvent = allEvents.getAll().get(0); - - Event actualEvent = eventService.findById(expectedEvent.getId()); - - assertEquals(expectedEvent, actualEvent); - } - - @Test - public void shouldReturnNullForNullOrEmptyIdInFindById() { - Event actualEvent = eventService.findById(""); - assertNull(actualEvent); - actualEvent = eventService.findById(null); - assertNull(actualEvent); - } - - @Test - public void shouldReturnNullIfEventNotFound() { - addObjectToRepository(asList(getEvent()), allEvents); - - Event actualEvent = eventService.findById(DIFFERENT_BASE_ENTITY_ID); - - assertNull(actualEvent); - } - - @Test - public void shouldAddEvent() { - Event expectedEvent = getEvent(); - - Event actualEvent = eventService.addEvent(expectedEvent); - - List dbEvents = allEvents.getAll(); - assertEquals(1, dbEvents.size()); - assertEquals(expectedEvent, actualEvent); - assertNewObjectCreation(expectedEvent, dbEvents.get(0)); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfAnEventAlreadyExistWithSameIdentifier() { - Event expectedEvent = getEvent(); - Event expectedEvent2 = getEvent(); - expectedEvent2.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - Event invalidEvent = getEvent(); - Map identifiers = new HashMap<>(identifier); - identifiers.put(IDENTIFIER_TYPE, "invalidValue"); - invalidEvent.setIdentifiers(identifiers); - - addObjectToRepository(asList(expectedEvent, expectedEvent2, invalidEvent), allEvents); - - eventService.addEvent(expectedEvent); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfAnEventAlreadyExistWithSameBaseEntityIdAndFormSumbissionId() { - Event expectedEvent = getEvent(); - Event invalidEvent = getEvent(); - Map identifiers = new HashMap<>(identifier); - identifiers.put(IDENTIFIER_TYPE, "invalidValue"); - invalidEvent.setIdentifiers(identifiers); - - addObjectToRepository(asList(expectedEvent, invalidEvent), allEvents); - - eventService.addEvent(expectedEvent); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfNullFormSubmissionId() { - Event expectedEvent = getEvent(); - Event invalidEvent = getEvent(); - Map identifiers = new HashMap<>(identifier); - identifiers.put(IDENTIFIER_TYPE, "invalidValue"); - invalidEvent.setIdentifiers(identifiers); - - addObjectToRepository(asList(expectedEvent, invalidEvent), allEvents); - - expectedEvent.setFormSubmissionId(null); - eventService.addEvent(expectedEvent); - } - - @Test - public void shouldAddEventWithCouchDbConnector() throws IOException { - Event expectedEvent = getEvent(); - - Event actualEvent = allEvents.addEvent(getCouchDbConnector("opensrp"), expectedEvent); - - List dbEvents = allEvents.getAll(); - assertEquals(1, dbEvents.size()); - assertEquals(expectedEvent, actualEvent); - assertNewObjectCreation(expectedEvent, dbEvents.get(0)); - } - - @Test(expected = IllegalStateException.class) - public void shouldThrowExceptionIfAnEventAlreadyExistWithSameBaseEntityIdAndFormSumbissionIdWithCouchDbConector() - throws IOException { - Event expectedEvent = getEvent(); - Event invalidEvent = getEvent(); - Map identifiers = new HashMap<>(identifier); - identifiers.put(IDENTIFIER_TYPE, "invalidValue"); - invalidEvent.setIdentifiers(identifiers); - - addObjectToRepository(asList(expectedEvent, invalidEvent), allEvents); - - allEvents.addEvent(getCouchDbConnector("opensrp"), expectedEvent); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfNullFormSubmissionIdWithCouchDbConnector() throws IOException { - Event expectedEvent = getEvent(); - Event invalidEvent = getEvent(); - Map identifiers = new HashMap<>(identifier); - identifiers.put(IDENTIFIER_TYPE, "invalidValue"); - invalidEvent.setIdentifiers(identifiers); - - addObjectToRepository(asList(expectedEvent, invalidEvent), allEvents); - - expectedEvent.setFormSubmissionId(null); - allEvents.addEvent(getCouchDbConnector("opensrrp"), expectedEvent); - } - - @Test - public void shouldAddIfNewEntityInAddOrUpdate() { - Event expectedEvent = getEvent(); - - Event actualEvent = eventService.addorUpdateEvent(expectedEvent); - - List dbEvents = eventService.getAll(); - assertEquals(1, dbEvents.size()); - assertEquals(expectedEvent, actualEvent); - - assertNewObjectCreation(expectedEvent, dbEvents.get(0)); - } - - @Test - public void shouldUpdateIfExistingEntityInAddOrUpdate() { - addObjectToRepository(Collections.singletonList(getEvent()), allEvents); - Event expectedEvent = allEvents.getAll().get(0); - - Event actualEvent = eventService.addorUpdateEvent(expectedEvent); - - List dbEvents = eventService.getAll(); - assertEquals(1, dbEvents.size()); - assertEquals(expectedEvent, actualEvent); - - dbEvents.get(0).setServerVersion(null); - assertObjectUpdate(expectedEvent, dbEvents.get(0)); - } - - @Test - public void shouldUpdateEvent() { - addObjectToRepository(Collections.singletonList(getEvent()), allEvents); - Event expectedEvent = allEvents.getAll().get(0); - - eventService.updateEvent(expectedEvent); - - List dbEvents = eventService.getAll(); - assertEquals(1, dbEvents.size()); - assertObjectUpdate(expectedEvent, dbEvents.get(0)); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfNewEventInUpdate() { - Event event = getEvent(); - - eventService.updateEvent(event); - } - - @Test - public void shouldFindBySeverVersion() { - addObjectToRepository(Collections.singletonList(getEvent()), allEvents); - - Event expectedEvent = allEvents.getAll().get(0); - - List actualEvents = allEvents.findByServerVersion(expectedEvent.getServerVersion() - 1); - - assertEquals(1, actualEvents.size()); - assertEquals(expectedEvent, actualEvents.get(0)); - } - - @Test - public void shouldGeAllEvents() { - Event expectedEvent = getEvent(); - Event expectedEvent2 = getEvent(); - expectedEvent2.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - Map identifiers = new HashMap<>(identifier); - identifiers.put(IDENTIFIER_TYPE, "invalidValue"); - expectedEvent2.setIdentifiers(identifiers); - List expectedEvents = asList(expectedEvent, expectedEvent2); - - addObjectToRepository(expectedEvents, allEvents); - - List actualEvents = eventService.getAll(); - - assertTwoListAreSameIgnoringOrder(expectedEvents, actualEvents); - } - - @Test - public void shouldFindByObsFieldCodeKeyAndValue() { - Event expectedEvent = getEvent(); - - addObjectToRepository(Collections.singletonList(expectedEvent), allEvents); - - List actualEvents = eventService.findEventsByConceptAndValue(FIELD_CODE, VALUE); - - assertEquals(1, actualEvents.size()); - assertEquals(expectedEvent, actualEvents.get(0)); - } - - @Test - public void shouldFindByBaseEntityAndEventType() { - Event expectedEvent = getEvent(); - Event invalidEvent = getEvent(); - invalidEvent.setEventType("diff"); - - addObjectToRepository(asList(expectedEvent, invalidEvent), allEvents); - - List actualEvents = eventService.findByBaseEntityAndType(BASE_ENTITY_ID, EVENT_TYPE); - - assertEquals(1, actualEvents.size()); - assertEquals(expectedEvent, actualEvents.get(0)); - } - - @Test - public void shouldProcessOutOfArea() { - Client client = getClient(); - client.addIdentifier(ZEIR_ID.toUpperCase(), "zeirId"); - addObjectToRepository(Collections.singletonList(client), allClients); - Event existingEvent = getEvent(); - existingEvent.setBaseEntityId(client.getBaseEntityId()); - existingEvent.setEventType("Birth Registration"); - addObjectToRepository(Collections.singletonList(existingEvent), allEvents); - - //For null baseEntityId - Event expectedEvent = getEvent(); - expectedEvent.setBaseEntityId(null); - expectedEvent.addIdentifier(ZEIR_ID.toUpperCase(), "zeirId"); - Event actualEvent = eventService.processOutOfArea(expectedEvent); - - assertNull(actualEvent.getIdentifier(ZEIR_ID.toUpperCase())); - assertEquals(BASE_ENTITY_ID, actualEvent.getBaseEntityId()); - assertEquals(PROVIDER_ID, actualEvent.getDetails().get("out_of_catchment_provider_id")); - assertEquals(expectedEvent, actualEvent); - - //For empty baseEntityId - expectedEvent = getEvent(); - expectedEvent.setBaseEntityId(""); - expectedEvent.addIdentifier(ZEIR_ID.toUpperCase(), "zeirId"); - actualEvent = eventService.processOutOfArea(expectedEvent); - - assertNull(actualEvent.getIdentifier(ZEIR_ID.toUpperCase())); - assertEquals(BASE_ENTITY_ID, actualEvent.getBaseEntityId()); - assertEquals(PROVIDER_ID, actualEvent.getDetails().get("out_of_catchment_provider_id")); - assertEquals(expectedEvent, actualEvent); - } - - @Test - public void shouldNotProcessOutOfAreaIfEventHasBaseEntityId() { - Client client = getClient(); - client.addIdentifier(ZEIR_ID.toUpperCase(), "zeirId"); - addObjectToRepository(Collections.singletonList(client), allClients); - Event existingEvent = getEvent(); - existingEvent.setBaseEntityId(client.getBaseEntityId()); - existingEvent.setEventType("Birth Registration"); - addObjectToRepository(Collections.singletonList(existingEvent), allEvents); - - Event expectedEvent = getEvent(); - expectedEvent.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - expectedEvent.addIdentifier(ZEIR_ID.toUpperCase(), "zeirId"); - - Event actualEvent = eventService.processOutOfArea(expectedEvent); - - assertEquals("zeirId", actualEvent.getIdentifier(ZEIR_ID.toUpperCase())); - assertEquals(DIFFERENT_BASE_ENTITY_ID, actualEvent.getBaseEntityId()); - assertNull(actualEvent.getDetails().get("out_of_catchment_provider_id")); - assertEquals(expectedEvent, actualEvent); - } - - @Test - public void shouldNotProcessOutAreaIfNoClientFound() { - Event existingEvent = getEvent(); - existingEvent.setBaseEntityId(BASE_ENTITY_ID); - existingEvent.setEventType("Birth Registration"); - addObjectToRepository(Collections.singletonList(existingEvent), allEvents); - - Event expectedEvent = getEvent(); - expectedEvent.setBaseEntityId(null); - expectedEvent.addIdentifier(ZEIR_ID.toUpperCase(), "zeirId"); - - Event actualEvent = eventService.processOutOfArea(expectedEvent); - - assertEquals("zeirId", actualEvent.getIdentifier(ZEIR_ID.toUpperCase())); - assertNull(actualEvent.getBaseEntityId()); - assertNull(actualEvent.getDetails().get("out_of_catchment_provider_id")); - assertEquals(expectedEvent, actualEvent); - } - - @Test - public void shouldNotProcessOutOfAreaIfNoExistingBirthRegistrationEventFound() { - Client client = getClient(); - client.addIdentifier(ZEIR_ID.toUpperCase(), "zeirId"); - addObjectToRepository(Collections.singletonList(client), allClients); - Event existingEvent = getEvent(); - existingEvent.setBaseEntityId(client.getBaseEntityId()); - addObjectToRepository(Collections.singletonList(existingEvent), allEvents); - - //For null baseEntityId - Event expectedEvent = getEvent(); - expectedEvent.setBaseEntityId(null); - expectedEvent.addIdentifier(ZEIR_ID.toUpperCase(), "zeirId"); - Event actualEvent = eventService.processOutOfArea(expectedEvent); - - assertEquals("zeirId", actualEvent.getIdentifier(ZEIR_ID.toUpperCase())); - assertNull(actualEvent.getBaseEntityId()); - assertNull(actualEvent.getDetails().get("out_of_catchment_provider_id")); - assertEquals(expectedEvent, actualEvent); - } - - @Test - public void shouldMergeAndUpdateExistingEvent() { - addObjectToRepository(Collections.singletonList(getEvent()), allEvents); - Event updatedEvent = allEvents.getAll().get(0); - - updatedEvent.addIdentifier("Second_Identifier", DIFFERENT_BASE_ENTITY_ID); - updatedEvent.addObs(getObs().withComments("comments").withFieldCode(DIFFERENT_BASE_ENTITY_ID)); - - Event actualEvent = eventService.mergeEvent(updatedEvent); - List dbEvents = allEvents.getAll(); - - DateTime updatedEventDate = updatedEvent.getEventDate(); - updatedEvent.setEventDate(null); - actualEvent.setEventDate(null); - actualEvent.setDateEdited(null); - assertEquals(1, dbEvents.size()); - assertEquals(updatedEvent, actualEvent); - updatedEvent.setEventDate(updatedEventDate); - assertObjectUpdate(updatedEvent, dbEvents.get(0)); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfExistingClientNotFound() { - Event updatedEvent = getEvent(); - - eventService.mergeEvent(updatedEvent); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/it/LocationServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/it/LocationServiceTest.java deleted file mode 100644 index 5c1d68600d..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/it/LocationServiceTest.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.opensrp.service.it; - -import static org.junit.Assert.assertEquals; -import static org.opensrp.util.SampleFullDomainObject.getApiLocation; -import static org.opensrp.util.SampleFullDomainObject.getDomainLocation; -import static org.utils.AssertionUtil.assertTwoDifferentTypeLocationSame; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; - -import java.util.Collections; -import java.util.List; - -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.domain.Location; -import org.opensrp.repository.couch.AllLocations; -import org.opensrp.service.LocationService; -import org.springframework.beans.factory.annotation.Autowired; - -public class LocationServiceTest extends BaseIntegrationTest { - - @Autowired - public AllLocations allLocations; - - @Autowired - public LocationService locationService; - - @Before - public void setUp() { - allLocations.removeAll(); - } - - @After - public void cleanUp() { - allLocations.removeAll(); - } - - @Test - public void shouldGetAllLocation() { - Location location = getDomainLocation(); - Location expectedLocation = getDomainLocation(); - expectedLocation.setParentLocation(location); - List expectedLocations = Collections.singletonList(expectedLocation); - addObjectToRepository(expectedLocations, allLocations); - - List actualLocations = locationService.getAllLocations(); - - assertEquals(1, actualLocations.size()); - assertTwoDifferentTypeLocationSame(expectedLocation, actualLocations.get(0)); - - } - - @Test - public void shouldAddLocation() { - org.opensrp.api.domain.Location expectedLocation = getApiLocation(); - - locationService.addLocation(expectedLocation); - - List actualLocations = allLocations.getAll(); - assertEquals(1, actualLocations.size()); - assertTwoDifferentTypeLocationSame(actualLocations.get(0), expectedLocation); - } - - @Test - @Ignore - public void shouldUpdateLocation() { - allLocations.add(getDomainLocation().withParentLocation(getDomainLocation())); - org.opensrp.api.domain.Location expectedLocation = locationService.getAllLocations().get(0); - expectedLocation.addAttribute("name", "value"); - - locationService.updateLocation(expectedLocation); - - List actualLocations = allLocations.getAll(); - assertEquals(1, actualLocations.size()); - assertTwoDifferentTypeLocationSame(actualLocations.get(0), expectedLocation); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/it/MultimediaServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/it/MultimediaServiceTest.java deleted file mode 100644 index 7f2461dea9..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/it/MultimediaServiceTest.java +++ /dev/null @@ -1,237 +0,0 @@ -package org.opensrp.service.it; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.domain.Multimedia; -import org.opensrp.dto.form.MultimediaDTO; -import org.opensrp.repository.couch.MultimediaRepositoryImpl; -import org.opensrp.service.MultimediaService; -import org.opensrp.service.multimedia.BaseMultimediaFileManager; -import org.opensrp.service.multimedia.FileSystemMultimediaFileManager; -import org.opensrp.service.multimedia.MultimediaFileManager; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.web.multipart.MultipartFile; - -import java.io.File; -import java.io.IOException; -import java.util.List; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.opensrp.service.MultimediaService.IMAGES_DIR; -import static org.opensrp.util.SampleFullDomainObject.CASE_ID; -import static org.opensrp.util.SampleFullDomainObject.DIFFERENT_BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.PROVIDER_ID; -import static org.opensrp.util.SampleFullDomainObject.getMultimedia; -import static org.opensrp.util.SampleFullDomainObject.getMultimediaDTO; -import static org.utils.AssertionUtil.assertTwoListAreSameIgnoringOrder; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; - -/** - * If tests fail check property `'multimedia.directory.name` in `opensrp.properties`. - */ -public class MultimediaServiceTest extends BaseIntegrationTest { - - @Autowired - private MultimediaRepositoryImpl multimediaRepository; - - @Autowired - private MultimediaService multimediaService; - - @Value("#{opensrp['multimedia.directory.name']}") - private String baseMultimediaDirPath; - - private String BASE_IMAGE_PATH = baseMultimediaDirPath + File.separator + IMAGES_DIR+ File.separator; - - @Autowired - @Qualifier("multimedia_file_manager") - private BaseMultimediaFileManager fileManager; - - @Before - public void setUp() { - multimediaRepository.removeAll(); - deleteFolders("../multimedia"); - fileManager = (BaseMultimediaFileManager) multimediaService.getFileManager(); - BASE_IMAGE_PATH = baseMultimediaDirPath + File.separator + IMAGES_DIR+ File.separator; - } - - @After - public void cleanUp() { - multimediaRepository.removeAll(); - deleteFolders("../multimedia"); - } - - public void deleteFolders(String path) { - File multimediaFile = new File(path); - if (multimediaFile.exists()) { - String[] entries = multimediaFile.list(); - for (String s : entries) { - File currentFile = new File(multimediaFile.getPath(), s); - if (currentFile.isDirectory()) { - deleteFolders(currentFile.getPath()); - } - } - multimediaFile.delete(); - } - } - - @Test - public void shouldFindByCaseId() { - Multimedia expectedMultimedia = getMultimedia(); - Multimedia invalidMultimedia = getMultimedia(); - invalidMultimedia.setCaseId(DIFFERENT_BASE_ENTITY_ID); - addObjectToRepository(asList(expectedMultimedia, invalidMultimedia), multimediaRepository); - - Multimedia actualMultimedia = multimediaService.findByCaseId(CASE_ID); - - assertEquals(expectedMultimedia, actualMultimedia); - } - - @Test - public void shouldFindAllByProviderId() { - Multimedia expectedMultimedia = getMultimedia(); - Multimedia expectedMultimedia1 = getMultimedia(); - List expectedMultimedias = asList(expectedMultimedia, expectedMultimedia1); - Multimedia invalidMultimedia = getMultimedia(); - invalidMultimedia.setProviderId(DIFFERENT_BASE_ENTITY_ID); - addObjectToRepository(asList(expectedMultimedia, expectedMultimedia1, invalidMultimedia), multimediaRepository); - - List actualMultimedias = multimediaService.getMultimediaFiles(PROVIDER_ID); - - assertTwoListAreSameIgnoringOrder(expectedMultimedias, actualMultimedias); - } - - @Test - public void shouldUploadJpegFile() throws IOException { - String pathname = BASE_IMAGE_PATH + File.separator + CASE_ID + ".jpg"; - MultimediaDTO multimediaDTO = getMultimediaDTO("image/jpeg"); - MultipartFile mockMultipartFile = mock(MultipartFile.class); - - Boolean result = fileManager.uploadFile(multimediaDTO, mockMultipartFile); - - assertTrue(result); - assertTrue(new File(BASE_IMAGE_PATH).exists()); - verify(mockMultipartFile, times(1)).transferTo(new File(pathname)); - } - - @Test - public void shouldUploadGifFile() throws IOException { - String pathname = BASE_IMAGE_PATH + File.separator + CASE_ID + ".gif"; - MultimediaDTO multimediaDTO = getMultimediaDTO("image/gif"); - MultipartFile mockMultipartFile = mock(MultipartFile.class); - - Boolean result = fileManager.uploadFile(multimediaDTO, mockMultipartFile); - - assertTrue(result); - assertTrue(new File(BASE_IMAGE_PATH).exists()); - verify(mockMultipartFile, times(1)).transferTo(new File(pathname)); - } - - @Test - public void shouldUploadPngFile() throws IOException { - String pathname = BASE_IMAGE_PATH + CASE_ID + ".png"; - MultimediaDTO multimediaDTO = getMultimediaDTO("image/png"); - MultipartFile mockMultipartFile = mock(MultipartFile.class); - - Boolean result = fileManager.uploadFile(multimediaDTO, mockMultipartFile); - - assertTrue(result); - assertTrue(new File(BASE_IMAGE_PATH).exists()); - verify(mockMultipartFile, times(1)).transferTo(new File(pathname)); - } - - @Test - public void shouldUploadVideoOctetStreamFile() throws IOException { - String BASE_IMAGE_PATH = baseMultimediaDirPath + "/" + "videos/"; - String pathname = BASE_IMAGE_PATH + CASE_ID + ".mp4"; - MultimediaDTO multimediaDTO = getMultimediaDTO("application/octet-stream"); - MultipartFile mockMultipartFile = mock(MultipartFile.class); - - Boolean result = fileManager.uploadFile(multimediaDTO, mockMultipartFile); - - assertTrue(result); - assertTrue(new File(BASE_IMAGE_PATH).exists()); - verify(mockMultipartFile, times(1)).transferTo(new File(pathname)); - } - - @Test - public void shouldReturnFalseUnknownContentType() throws IOException { - MultimediaDTO multimediaDTO = getMultimediaDTO("unknown"); - MultipartFile mockMultipartFile = mock(MultipartFile.class); - - assertFalse(fileManager.uploadFile(multimediaDTO, mockMultipartFile)); - } - - @Test - public void shouldReturnFalseFormEmptyMultiPartFile() { - MultimediaDTO multimediaDTO = getMultimediaDTO("image/jpeg"); - MultipartFile mockMultipartFile = mock(MultipartFile.class); - - when(mockMultipartFile.isEmpty()).thenReturn(true); - assertFalse(fileManager.uploadFile(multimediaDTO, mockMultipartFile)); - } - - @Test - public void shouldSaveMultimediaForSuccessfulUpdate() { - MultimediaDTO multimediaDTO = getMultimediaDTO("image/png"); - MultipartFile mockMultipartFile = mock(MultipartFile.class); - Multimedia expectedMultimedia = getMultimedia(); - expectedMultimedia.setContentType("image/png"); - expectedMultimedia.setFilePath(BASE_IMAGE_PATH + CASE_ID + ".png"); - - String result = fileManager.saveMultimediaFile(multimediaDTO, mockMultipartFile); - - assertEquals("success", result); - List dbFiles = multimediaRepository.getAll(); - assertEquals(1, dbFiles.size()); - - Multimedia actualMultimedia = dbFiles.get(0); - assertEquals(expectedMultimedia.getFilePath(), actualMultimedia.getFilePath()); - assertEquals(expectedMultimedia.getProviderId(), actualMultimedia.getProviderId()); - assertEquals(expectedMultimedia.getContentType(), actualMultimedia.getContentType()); - assertEquals(expectedMultimedia.getFileCategory(), actualMultimedia.getFileCategory()); - assertEquals(expectedMultimedia.getCaseId(), actualMultimedia.getCaseId()); - } - - @Test - public void shouldReturnFailForUnsuccessfulUpdate() { - MultimediaDTO multimediaDTO = getMultimediaDTO("unknown"); - MultipartFile mockMultipartFile = mock(MultipartFile.class); - - String result = fileManager.saveMultimediaFile(multimediaDTO, mockMultipartFile); - - assertEquals("fail", result); - List dbFiles = multimediaRepository.getAll(); - assertEquals(0, dbFiles.size()); - } - - @Test - public void testRetrieveFileShouldCallFileManager() { - MultimediaFileManager fileManager = mock(FileSystemMultimediaFileManager.class); - multimediaService.setFileManager(fileManager); - multimediaService.retrieveFile("file_path"); - verify(fileManager).retrieveFile(eq("file_path")); - } - - @Test - public void testSaveFileShouldCallFileManager() { - MultimediaFileManager fileManager = mock(FileSystemMultimediaFileManager.class); - multimediaService.setFileManager(fileManager); - - MultipartFile multipartFile = mock(MultipartFile.class); - MultimediaDTO multimediaDTO = mock(MultimediaDTO.class); - multimediaService.saveFile(multimediaDTO, multipartFile); - verify(fileManager).saveFile(eq(multimediaDTO), eq(multipartFile)); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/it/ProviderServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/it/ProviderServiceTest.java deleted file mode 100644 index 7ea3a24df0..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/it/ProviderServiceTest.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.opensrp.service.it; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.opensrp.util.SampleFullDomainObject.BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.DIFFERENT_BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.getProvider; -import static org.utils.AssertionUtil.assertTwoListAreSameIgnoringOrder; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; - -import java.util.Collections; -import java.util.List; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.domain.Provider; -import org.opensrp.repository.couch.AllProviders; -import org.opensrp.service.ProviderService; -import org.springframework.beans.factory.annotation.Autowired; - -public class ProviderServiceTest extends BaseIntegrationTest { - - @Autowired - public AllProviders allProviders; - - @Autowired - public ProviderService providerService; - - @Before - public void setUp() { - allProviders.removeAll(); - } - - @After - public void cleanUp() { - allProviders.removeAll(); - } - - @Test - public void shouldGetProviderByBaseEntityId() { - Provider expectedProvider = getProvider(); - addObjectToRepository(Collections.singletonList(expectedProvider), allProviders); - - Provider actualProvider = providerService.getProviderByBaseEntityId(BASE_ENTITY_ID); - - assertEquals(expectedProvider, actualProvider); - } - - @Test - public void shouldGetAllTheProvider() { - Provider provider = getProvider(); - Provider provider1 = getProvider(); - provider1.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - List expectedProviders = asList(provider, provider1); - - addObjectToRepository(expectedProviders, allProviders); - - List actualProviders = providerService.getAllProviders(); - - assertTwoListAreSameIgnoringOrder(expectedProviders, actualProviders); - } - - @Test - public void shouldAddProvider() { - Provider expectedProvider = getProvider(); - - providerService.addProvider(expectedProvider); - - List actualProviders = allProviders.getAll(); - assertEquals(1, actualProviders.size()); - assertEquals(expectedProvider, actualProviders.get(0)); - } - - @Test - public void shouldUpdateProvider() { - addObjectToRepository(Collections.singletonList(getProvider()), allProviders); - - Provider updatedProvider = allProviders.getAll().get(0); - updatedProvider.setFullName(DIFFERENT_BASE_ENTITY_ID); - - providerService.updateProvider(updatedProvider); - - List actualProviders = allProviders.getAll(); - assertEquals(1, actualProviders.size()); - assertEquals(updatedProvider, actualProviders.get(0)); - - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/it/ReportServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/it/ReportServiceTest.java deleted file mode 100644 index b5b33a9d49..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/it/ReportServiceTest.java +++ /dev/null @@ -1,307 +0,0 @@ -package org.opensrp.service.it; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.opensrp.util.SampleFullDomainObject.BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.DIFFERENT_BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.FORM_SUBMISSION_ID; -import static org.opensrp.util.SampleFullDomainObject.IDENTIFIER_TYPE; -import static org.opensrp.util.SampleFullDomainObject.IDENTIFIER_VALUE; -import static org.opensrp.util.SampleFullDomainObject.getReport; -import static org.opensrp.util.SampleFullDomainObject.identifier; -import static org.utils.AssertionUtil.assertNewObjectCreation; -import static org.utils.AssertionUtil.assertObjectUpdate; -import static org.utils.AssertionUtil.assertTwoListAreSameIgnoringOrder; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.domain.Report; -import org.opensrp.repository.couch.AllReports; -import org.opensrp.service.ReportService; -import org.springframework.beans.factory.annotation.Autowired; - -public class ReportServiceTest extends BaseIntegrationTest { - - @Autowired - private AllReports allReports; - - @Autowired - private ReportService reportService; - - @Before - public void setUp() { - allReports.removeAll(); - } - - @After - public void cleanUp() { - allReports.removeAll(); - } - - @Test - public void shouldFindById() { - addObjectToRepository(Collections.singletonList(getReport()), allReports); - Report expectedReport = allReports.getAll().get(0); - - Report actualReport = reportService.getById(expectedReport.getId()); - - assertEquals(expectedReport, actualReport); - } - - @Test - public void shouldFindByBaseEntityIdAndFormSubmissionId() { - Report expectedReport = getReport(); - Report invalidReport = getReport(); - invalidReport.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - addObjectToRepository(asList(expectedReport, invalidReport), allReports); - - Report actualReport = reportService.getByBaseEntityAndFormSubmissionId(BASE_ENTITY_ID, FORM_SUBMISSION_ID); - - assertEquals(expectedReport, actualReport); - } - - @Test - public void shouldFindByBaseEntityId() { - Report report = getReport(); - Report report1 = getReport(); - List expectedReports = asList(report, report1); - Report invalidReport = getReport(); - invalidReport.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - addObjectToRepository(asList(report, report1, invalidReport), allReports); - - List actualReports = reportService.findByBaseEntityId(BASE_ENTITY_ID); - - assertTwoListAreSameIgnoringOrder(expectedReports, actualReports); - } - - @Test(expected = IllegalStateException.class) - public void shouldThrowExceptionIfMultipleFound() { - Report report = getReport(); - Report report1 = getReport(); - addObjectToRepository(asList(report, report1), allReports); - - reportService.getByBaseEntityAndFormSubmissionId(BASE_ENTITY_ID, FORM_SUBMISSION_ID); - } - - @Test - public void shouldReturnNullIfNoneFound() { - assertNull(reportService.getByBaseEntityAndFormSubmissionId(BASE_ENTITY_ID, FORM_SUBMISSION_ID)); - } - - @Test - public void shouldFindByUniqueIdentifier() { - Report expectedReport = getReport(); - Report invalidReport = getReport(); - Map differentIdentifiers = new HashMap<>(identifier); - differentIdentifiers.put(IDENTIFIER_TYPE, DIFFERENT_BASE_ENTITY_ID); - invalidReport.setIdentifiers(differentIdentifiers); - addObjectToRepository(asList(expectedReport, invalidReport), allReports); - - Report actualReport = reportService.find(IDENTIFIER_VALUE); - - assertEquals(expectedReport, actualReport); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfMultipleFoundWhileFindByUniqueId() { - Report report = getReport(); - Report report1 = getReport(); - addObjectToRepository(asList(report, report1), allReports); - - reportService.find(IDENTIFIER_VALUE); - } - - @Test - public void shouldReturnNullIfNoneFoundWhileFindByIdentifier() { - assertNull(reportService.find(IDENTIFIER_VALUE)); - } - - @Test - public void shouldFindByReportObject() { - Report expectedReport = getReport(); - Report invalidReport = getReport(); - Map differentIdentifiers = new HashMap<>(identifier); - differentIdentifiers.put(IDENTIFIER_TYPE, DIFFERENT_BASE_ENTITY_ID); - invalidReport.setIdentifiers(differentIdentifiers); - addObjectToRepository(asList(expectedReport, invalidReport), allReports); - - Report actualReport = reportService.find(expectedReport); - - assertEquals(expectedReport, actualReport); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfMultipleFoundWhileFindByReportObject() { - Report report = getReport(); - Report report1 = getReport(); - addObjectToRepository(asList(report, report1), allReports); - - reportService.find(report); - } - - @Test - public void shouldReturnNullIfNoneFoundWhileFindByReportObject() { - assertNull(reportService.find(getReport())); - } - - @Test - public void shouldFindByReportId() { - addObjectToRepository(Collections.singletonList(getReport()), allReports); - Report expectedReport = allReports.getAll().get(0); - - Report actualReport = reportService.findById(expectedReport.getId()); - - assertEquals(expectedReport, actualReport); - } - - @Test(expected = Exception.class) - public void shouldThrowErrorIfMultipleRecordFoundWhileFindById() { - addObjectToRepository(Collections.singletonList(getReport()), allReports); - Report expectedReport = allReports.getAll().get(0); - addObjectToRepository(Collections.singletonList(expectedReport), allReports); - - reportService.findById(expectedReport.getId()); - - } - - @Test - public void shouldReturnNullIfNoneFoundUsingDocumentId() { - addObjectToRepository(Collections.singletonList(getReport()), allReports); - assertNull(reportService.findById(DIFFERENT_BASE_ENTITY_ID)); - } - - @Test - public void shouldReturnNullForNullOrEmptyId() { - assertNull(reportService.findById(null)); - assertNull(reportService.findById("")); - } - - @Test - public void shouldGetAllReport() { - Report report = getReport(); - Report report1 = getReport(); - List expectedReports = asList(report, report1); - addObjectToRepository(expectedReports, allReports); - - List actualReports = reportService.getAll(); - - assertTwoListAreSameIgnoringOrder(expectedReports, actualReports); - } - - @Test - public void shouldFindByServerVersion() { - Report report = getReport(); - Report report1 = getReport(); - List expectedReports = asList(report, report1); - addObjectToRepository(expectedReports, allReports); - - List actualReports = reportService.findByServerVersion(0); - - assertTwoListAreSameIgnoringOrder(expectedReports, actualReports); - } - - @Test - public void shouldFindByIdentifier() { - Report report1 = getReport(); - Report report = getReport(); - Report invalidReport = getReport(); - Map differentIdentifiers = new HashMap<>(identifier); - differentIdentifiers.put(IDENTIFIER_TYPE, DIFFERENT_BASE_ENTITY_ID); - invalidReport.setIdentifiers(differentIdentifiers); - List expectedReports = asList(report1, report); - addObjectToRepository(asList(report1, report, invalidReport), allReports); - - List actualReports = reportService.findAllByIdentifier(IDENTIFIER_VALUE); - - assertTwoListAreSameIgnoringOrder(expectedReports, actualReports); - } - - @Test - public void shouldAddReport() { - Report expectedReport = getReport(); - - Report actualReport = reportService.addReport(expectedReport); - List dbReports = allReports.getAll(); - - assertEquals(1, dbReports.size()); - assertEquals(expectedReport, actualReport); - assertNewObjectCreation(expectedReport, dbReports.get(0)); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionWhileAddingExistingReport() { - Report report = getReport(); - - addObjectToRepository(Collections.singletonList(report), allReports); - - reportService.addReport(report); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfExistingReportFoundByBaseEntityIdAndFormSubmissionId() { - Report report = getReport(); - addObjectToRepository(Collections.singletonList(report), allReports); - report.setIdentifiers(null); - reportService.addReport(report); - } - - @Test - public void shouldUpdateExistingReport() { - addObjectToRepository(Collections.singletonList(getReport()), allReports); - Report updatedReport = allReports.getAll().get(0); - updatedReport.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - - reportService.updateReport(updatedReport); - - List actualReports = allReports.getAll(); - - assertEquals(1, actualReports.size()); - assertObjectUpdate(updatedReport, actualReports.get(0)); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfNewObjectWhileUpdate() { - reportService.updateReport(getReport()); - } - - @Test - public void shouldAddIfNewInAddOrUpdate() { - Report expectedReport = getReport(); - - Report actualReport = reportService.addorUpdateReport(expectedReport); - List dbReports = allReports.getAll(); - - assertEquals(1, dbReports.size()); - assertEquals(expectedReport, actualReport); - assertNewObjectCreation(expectedReport, dbReports.get(0)); - } - - @Test - public void shouldUpdateReportIfExistInAddOrUpdate() { - addObjectToRepository(Collections.singletonList(getReport()), allReports); - Report updatedReport = allReports.getAll().get(0); - updatedReport.setBaseEntityId(DIFFERENT_BASE_ENTITY_ID); - - Report actualReport = reportService.addorUpdateReport(updatedReport); - List dbReports = allReports.getAll(); - - assertEquals(1, dbReports.size()); - assertEquals(updatedReport, actualReport); - - assertNotNull(dbReports.get(0).getServerVersion()); - updatedReport.setServerVersion(null); - dbReports.get(0).setServerVersion(null); - - assertObjectUpdate(updatedReport, dbReports.get(0)); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/it/SearchServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/it/SearchServiceTest.java deleted file mode 100644 index 0752e82d42..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/it/SearchServiceTest.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.opensrp.service.it; - -import static java.util.Arrays.asList; -import static org.opensrp.common.AllConstants.BaseEntity.BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.ATTRIBUTES_TYPE; -import static org.opensrp.util.SampleFullDomainObject.ATTRIBUTES_VALUE; -import static org.opensrp.util.SampleFullDomainObject.EPOCH_DATE_TIME; -import static org.opensrp.util.SampleFullDomainObject.FEMALE; -import static org.opensrp.util.SampleFullDomainObject.FIRST_NAME; -import static org.opensrp.util.SampleFullDomainObject.LAST_NAME; -import static org.opensrp.util.SampleFullDomainObject.MIDDLE_NAME; -import static org.opensrp.util.SampleFullDomainObject.attributes; -import static org.opensrp.util.SampleFullDomainObject.getAddress; -import static org.opensrp.util.SampleFullDomainObject.identifier; -import static org.utils.AssertionUtil.assertTwoListAreSameIgnoringOrder; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.joda.time.DateTime; -import org.joda.time.DateTimeZone; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.domain.Client; -import org.opensrp.repository.couch.AllClients; -import org.opensrp.search.ClientSearchBean; -import org.opensrp.service.SearchService; -import org.springframework.beans.factory.annotation.Autowired; - -public class SearchServiceTest extends BaseIntegrationTest { - - @Autowired - public AllClients allClients; - - @Autowired - public SearchService searchService; - - @Before - public void setUp() { - allClients.removeAll(); - } - - @After - public void cleanUp() { - allClients.removeAll(); - } - - @Test - public void shouldSearchClient() { - Client expectedClient = createExpectedClient(); - expectedClient.setAttributes(attributes); - Client expectedClient2 = createExpectedClient(); - expectedClient2.addAttribute("inactive", true); - Client expectedClient3 = createExpectedClient(); - expectedClient3.addAttribute("lost_to_follow_up", true); - Client expectedClient4 = createExpectedClient(); - expectedClient4.addAttribute("inactive", false); - List expectedClients = asList(expectedClient, expectedClient2, expectedClient3, expectedClient4); - addObjectToRepository(expectedClients, allClients); - - Map queryAttributes = new HashMap<>(); - queryAttributes.put(ATTRIBUTES_TYPE, ATTRIBUTES_VALUE); - queryAttributes.put("inactive", "true"); - queryAttributes.put("inactive", "false"); - queryAttributes.put("lost_to_follow_up", "true"); - - ClientSearchBean clientSearchBean = new ClientSearchBean(); - clientSearchBean.setNameLike("first"); - clientSearchBean.setGender(expectedClient.getGender()); - clientSearchBean.setBirthdateFrom(EPOCH_DATE_TIME); - clientSearchBean.setBirthdateTo(new DateTime(DateTimeZone.UTC)); - clientSearchBean.setLastEditFrom(EPOCH_DATE_TIME); - clientSearchBean.setLastEditTo(new DateTime(DateTimeZone.UTC)); - List actualClients = searchService.searchClient(clientSearchBean, "first", "middle", "last", 10); - assertTwoListAreSameIgnoringOrder(expectedClients, actualClients); - } - - private Client createExpectedClient() { - Client expectedClient = new Client(BASE_ENTITY_ID); - expectedClient.setFirstName(FIRST_NAME); - expectedClient.setMiddleName(MIDDLE_NAME); - expectedClient.setLastName(LAST_NAME); - expectedClient.setBirthdate(EPOCH_DATE_TIME); - expectedClient.setAddresses(asList(getAddress())); - expectedClient.setDateCreated(EPOCH_DATE_TIME); - expectedClient.setGender(FEMALE); - expectedClient.setDateEdited(EPOCH_DATE_TIME); - expectedClient.setIdentifiers(identifier); - return expectedClient; - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/service/it/UserServiceTest.java b/opensrp-core/src/test/java/org/opensrp/service/it/UserServiceTest.java deleted file mode 100644 index 7803de09bf..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/service/it/UserServiceTest.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.opensrp.service.it; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.opensrp.util.SampleFullDomainObject.BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.DIFFERENT_BASE_ENTITY_ID; -import static org.opensrp.util.SampleFullDomainObject.getUser; -import static org.utils.AssertionUtil.assertTwoListAreSameIgnoringOrder; -import static org.utils.CouchDbAccessUtils.addObjectToRepository; - -import java.util.Collections; -import java.util.List; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.BaseIntegrationTest; -import org.opensrp.domain.User; -import org.opensrp.repository.couch.AllUsers; -import org.opensrp.service.UserService; -import org.springframework.beans.factory.annotation.Autowired; - -public class UserServiceTest extends BaseIntegrationTest { - - @Autowired - public AllUsers allUsers; - - @Autowired - public UserService userService; - - @Before - public void setUp() { - allUsers.removeAll(); - } - - @After - public void cleanUp() { - allUsers.removeAll(); - } - - @Test - public void shouldFindByBaseEntityId() { - User expectedUser = getUser(); - addObjectToRepository(Collections.singletonList(expectedUser), allUsers); - - User actualUser = userService.getUserByEntityId(BASE_ENTITY_ID); - - assertEquals(expectedUser, actualUser); - } - - @Test - public void shouldReturnAllUser() { - User user = getUser(); - User user1 = getUser(); - user1.setUsername(DIFFERENT_BASE_ENTITY_ID); - List expectedUsers = asList(user, user1); - addObjectToRepository(expectedUsers, allUsers); - - List actualUsers = userService.getAllUsers(); - - assertTwoListAreSameIgnoringOrder(expectedUsers, actualUsers); - - } - - @Test - public void shouldAddNewUser() { - User expectedUser = getUser(); - - userService.addUser(expectedUser); - - List actualUsers = allUsers.getAll(); - assertEquals(1, actualUsers.size()); - assertEquals(expectedUser, actualUsers.get(0)); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfExistingUser() { - addObjectToRepository(Collections.singletonList(getUser()), allUsers); - userService.addUser(allUsers.getAll().get(0)); - } - - @Test - public void shouldUpdateExistingUser() { - addObjectToRepository(Collections.singletonList(getUser()), allUsers); - User updatedUser = allUsers.getAll().get(0); - updatedUser.setUsername(DIFFERENT_BASE_ENTITY_ID); - - userService.updateUser(updatedUser); - - List actualUsers = allUsers.getAll(); - assertEquals(1, actualUsers.size()); - assertEquals(updatedUser, actualUsers.get(0)); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionIfNewWhileUpdate() { - userService.updateUser(getUser()); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/services/RapidProServiceTest.java b/opensrp-core/src/test/java/org/opensrp/services/RapidProServiceTest.java deleted file mode 100644 index 7f5b89a55c..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/services/RapidProServiceTest.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.opensrp.services; - -import static org.mockito.Matchers.anyMap; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Matchers; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.opensrp.SpringApplicationContextProvider; -import org.opensrp.service.RapidProService; -import org.springframework.beans.factory.annotation.Autowired; - -public class RapidProServiceTest extends SpringApplicationContextProvider { - - @Autowired - RapidProService rapidproService; - - List urns; - - List contacts; - - List groups; - - Map contact; - - @Mock - RapidProService mockRapidProService; - - String addFieldResponse; - - String sendMessageResponse; - - String createContactResponse; - - @SuppressWarnings("unchecked") - @Before - public void setup() { - urns = new ArrayList(); - urns.add("tel:+250788123123"); - groups = new ArrayList(); - contacts = new ArrayList(); - contacts.add("09d23a05-47fe-11e4-bfe9-b8f6b119e9ab"); - contact = new HashMap(); - Map fields = new HashMap(); - fields.put("lmp", "2016-09-30"); - fields.put("anc1", "2016-10-10"); - fields.put("anc2", "2016-10-20"); - fields.put("anc3", "2016-10-30"); - fields.put("anc4", "2016-11-10"); - contact.put("name", "Woman Three"); - List urns = new ArrayList(); - List groups = new ArrayList(); - groups.add("Pregnant Women"); - urns.add("telegram:207355745"); - contact.put("urns", urns); - contact.put("groups", groups); - contact.put("fields", fields); - MockitoAnnotations.initMocks(this); - addFieldResponse = "{\"key\": \"anc3\",\"label\": \"anc3\",\"value_type\": \"T\"}"; - sendMessageResponse = "{\"id\": 21170,\"urns\": [\"telegram:207355745\"],\"contacts\": [],\"groups\": [],\"text\": \"rapidpro test text2\",\"created_on\": \"2016-11-01T12:46:28.107Z\",\"status\": \"I\"}"; - createContactResponse = "{\"uuid\": \"4686bf60-a241-4b42-8102-27d9221aad5b\",\"name\": \"Xcv\",\"language\": null,\"group_uuids\": [\"bc5ef0d0-ce9d-4b52-adee-649a99927c8b\"]\"urns\": [\"tel:+254727812024\"]," - + "\"fields\": {\"anc1\": \"2016-10-27\",\"anc2\": \"2017-02-16\",\"anc3\": \"2017-04-13\",\"anc4\": \"2017-05-11\",},\"blocked\": false,\"failed\": false,\"modified_on\": \"2016-11-03T07:36:41.494Z\"," - + "\"phone\": \"+254727812024\",\"groups\": [\"Pregnant Women\"]}"; - - when(mockRapidProService.addField("anc3", "T")).thenReturn(addFieldResponse); - when(mockRapidProService.sendMessage(Matchers.anyListOf(String.class), Matchers.anyListOf(String.class), - Matchers.anyListOf(String.class), anyString(), anyString())).thenReturn(sendMessageResponse); - when(mockRapidProService.createContact(anyMap())).thenReturn(createContactResponse); - - } - - @After - public void tearDown() { - urns.clear(); - groups.clear(); - contacts.clear(); - contact.clear(); - } - - @Test - public void sendMessageShouldFailIfTextisNull() throws Exception { - String response = rapidproService.sendMessage(urns, contacts, groups, null, ""); - Assert.assertEquals("Empty text or text longer than 480 characters not allowed", response); - } - - @Test - public void sendMessageShouldFailIfTextisEmpty() throws Exception { - String response = rapidproService.sendMessage(urns, contacts, groups, "", ""); - Assert.assertEquals("Empty text or text longer than 480 characters not allowed", response); - } - - @Test - public void sendMessageShouldFailIfTextisTooLong() throws Exception { - String text = "When Aklima Begum was initially registered in OpenSRP during a census / enumeration round, her mobile phone (or family member’s phone) number was collected as part of her personal profile. Aklima Begum is found to be pregnant in week 20 of her pregnancy. As her pregnancy is recorded in OpenSRP, her health worker, Rokeya, receives a prompt asking whether Aklima would like to receive motivational messages and/or reminders. Aklima agrees, and this is recorded in the OpenSRP system. The server sends her a ‘test’ message to welcome her to the system and ensure the phone number is correct. Every week,"; - String response = rapidproService.sendMessage(urns, contacts, groups, text, ""); - Assert.assertEquals("Empty text or text longer than 480 characters not allowed", response); - } - - @Test - public void sendMessageShouldReturnJsonStringOnSuccess() throws Exception { - String response = mockRapidProService.sendMessage(urns, contacts, groups, "Test rapidpro text", ""); - Assert.assertEquals(sendMessageResponse, response); - - } - - @Test - public void sendMessageShouldFailIfEmptyUrnsAndContactsAndGroups() throws Exception { - tearDown(); - String response = rapidproService.sendMessage(urns, contacts, groups, "Test rapidpro text", ""); - Assert.assertEquals("No recipients specified", response); - } - - @Test - public void sendMessageShouldFailIfNullUrnsAndContactsAndGroups() throws Exception { - String response = rapidproService.sendMessage(null, null, null, "Test rapidpro text", ""); - Assert.assertEquals("No recipients specified", response); - } - - @Test - public void createContactShouldFailIfEmptyFieldValues() throws Exception { - tearDown(); - String response = rapidproService.createContact(contact); - Assert.assertEquals("Field values cannot be empty and must have urns", response); - } - - @Test - public void createContactShouldFailIfNullFieldValues() throws Exception { - String response = rapidproService.createContact(null); - Assert.assertEquals("Field values cannot be empty and must have urns", response); - } - - @Test - public void createContactShouldFailIfNullUrns() throws Exception { - contact.remove("urns"); - String response = rapidproService.createContact(contact); - Assert.assertEquals("Field values cannot be empty and must have urns", response); - } - - @Test - public void createContactShouldReturnJsonStringOnSuccess() throws Exception { - String response = mockRapidProService.createContact(contact); - Assert.assertEquals(createContactResponse, response); - } - - @Test - public void addFieldShouldFailIfNullLabel() throws Exception { - String response = rapidproService.addField(null, "T"); - Assert.assertEquals("Field label is required", response); - } - - @Test - public void addFieldShouldFailIfEmptyLabel() throws Exception { - String response = rapidproService.addField("", "T"); - Assert.assertEquals("Field label is required", response); - } - - @Test - public void addFieldShouldReturnJsonStringOnSuccess() throws Exception { - String response = mockRapidProService.addField("anc3", "T"); - Assert.assertEquals(addFieldResponse, response); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/services/it/RapidProServiceIntegrationTest.java b/opensrp-core/src/test/java/org/opensrp/services/it/RapidProServiceIntegrationTest.java deleted file mode 100644 index cdbaf48b56..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/services/it/RapidProServiceIntegrationTest.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.opensrp.services.it; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.json.JSONException; -import org.json.JSONObject; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.opensrp.SpringApplicationContextProvider; -import org.opensrp.service.RapidProService; -import org.springframework.beans.factory.annotation.Autowired; - -@Ignore -public class RapidProServiceIntegrationTest extends SpringApplicationContextProvider { - - @Autowired - RapidProService rapidproService; - - Map contact = new HashMap(); - - List urns = new ArrayList(); - - List groups = new ArrayList(); - - @Before - public void setup() { - Map fields = new HashMap(); - fields.put("lmp", "2016-09-30"); - fields.put("anc1", "2016-10-10"); - fields.put("anc2", "2016-10-20"); - fields.put("anc3", "2016-10-30"); - fields.put("anc4", "2016-11-10"); - // set contact name - contact.put("name", "Test Woman"); - groups.add("Pregnant Women"); - urns.add("telegram:207355745"); - contact.put("urns", urns); - contact.put("groups", groups); - contact.put("fields", fields); - } - - @Test - public void shouldCreateContactAndReceiveContactObjectResponse() throws Exception { - String response = rapidproService.createContact(contact); - JSONObject jsonResponse = new JSONObject(response); - verify(jsonResponse); - Assert.assertEquals(204, rapidproService.deleteContact(jsonResponse.getString("uuid"))); - - } - - @Test - public void shouldUpdateContactAndReceiveContactObjectResponse() throws Exception { - String response = rapidproService.createContact(contact); - JSONObject jsonResponse = new JSONObject(response); - contact.put("uuid", jsonResponse.getString("uuid")); - contact.put("name", "Test Woman Updated"); - response = rapidproService.createContact(contact); - jsonResponse = new JSONObject(response); - Assert.assertEquals("Test Woman Updated", jsonResponse.getString("name")); - Assert.assertEquals(204, rapidproService.deleteContact(jsonResponse.getString("uuid"))); - - } - - @Test - public void shouldDeleteContactAndReceiveStatusResponse() throws Exception { - String response = rapidproService.createContact(contact); - JSONObject jsonResponse = new JSONObject(response); - Assert.assertEquals(204, rapidproService.deleteContact(jsonResponse.getString("uuid"))); - - } - - @Test - @Ignore // FIXME We might need a generic mobile no to test this one out - public void shouldSendMessageAndReceiveMessageBroadcastResponse() throws Exception { - // rapidproService.sendMessage(urns, contacts, groups, text, channel); - } - - @Test - public void shouldCreateFieldAndReceiveFieldKeyResponse() throws Exception { - String response = rapidproService.addField("Test Field", "T"); - JSONObject jsonResponse = new JSONObject(response); - Assert.assertEquals("test_field", jsonResponse.getString("key")); - Assert.assertEquals("Test Field", jsonResponse.getString("label")); - Assert.assertEquals("T", jsonResponse.getString("value_type")); - - } - - private void verify(JSONObject jsonResponse) throws JSONException { - Assert.assertTrue(jsonResponse.has("uuid")); - Assert.assertTrue(jsonResponse.has("name")); - Assert.assertTrue(jsonResponse.has("group_uuids")); - Assert.assertTrue(jsonResponse.has("urns")); - Assert.assertTrue(jsonResponse.has("fields")); - Assert.assertTrue(jsonResponse.has("groups")); - Assert.assertEquals("Test Woman", jsonResponse.getString("name")); - Assert.assertEquals("2016-10-10", jsonResponse.getJSONObject("fields").getString("anc1")); - Assert.assertEquals("2016-10-20", jsonResponse.getJSONObject("fields").getString("anc2")); - Assert.assertEquals("2016-10-30", jsonResponse.getJSONObject("fields").getString("anc3")); - Assert.assertEquals("2016-11-10", jsonResponse.getJSONObject("fields").getString("anc4")); - Assert.assertEquals("Pregnant Women", jsonResponse.getJSONArray("groups").getString(0)); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/util/Event.java b/opensrp-core/src/test/java/org/opensrp/util/Event.java deleted file mode 100644 index 6015fd199e..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/util/Event.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.opensrp.util; - -public class Event { - - public static EventBuilder create() { - return new EventBuilder(); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/util/EventBuilder.java b/opensrp-core/src/test/java/org/opensrp/util/EventBuilder.java deleted file mode 100644 index 58a690a2c1..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/util/EventBuilder.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.opensrp.util; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import static org.motechproject.scheduletracking.api.events.constants.EventDataKeys.EXTERNAL_ID; -import static org.motechproject.scheduletracking.api.events.constants.EventDataKeys.MILESTONE_NAME; -import static org.motechproject.scheduletracking.api.events.constants.EventDataKeys.SCHEDULE_NAME; -import static org.motechproject.scheduletracking.api.events.constants.EventDataKeys.WINDOW_NAME; - -import java.util.HashMap; -import java.util.Map; - -import org.joda.time.DateTime; -import org.motechproject.scheduler.domain.MotechEvent; -import org.motechproject.scheduletracking.api.domain.MilestoneAlert; -import org.motechproject.scheduletracking.api.domain.WindowName; - -public class EventBuilder { - - private String scheduleName; - - private String milestone; - - private WindowName window; - - private String externalID; - - private DateTime maxWindowStartDate; - - private DateTime lateWindowStartDate; - - private DateTime dueWindowStartDate; - - public EventBuilder withSchedule(String scheduleName) { - this.scheduleName = scheduleName; - return this; - } - - public EventBuilder withMilestone(String milestone) { - this.milestone = milestone; - return this; - } - - public EventBuilder withWindow(WindowName window) { - this.window = window; - return this; - } - - public EventBuilder withExternalId(String externalID) { - this.externalID = externalID; - return this; - } - - public EventBuilder withDueWindowStartDate(DateTime dueWindowStartDate) { - this.dueWindowStartDate = dueWindowStartDate; - return this; - } - - public EventBuilder withLateWindowStartDate(DateTime lateWindowStartDate) { - this.lateWindowStartDate = lateWindowStartDate; - return this; - } - - public EventBuilder withMaxWindowStartDate(DateTime maxWindowStartDate) { - this.maxWindowStartDate = maxWindowStartDate; - return this; - } - - public MotechEvent build() { - MilestoneAlert alert = mock(MilestoneAlert.class); - when(alert.getMilestoneName()).thenReturn(milestone); - when(alert.getDueDateTime()).thenReturn(dueWindowStartDate); - when(alert.getLateDateTime()).thenReturn(lateWindowStartDate); - when(alert.getDefaultmentDateTime()).thenReturn(maxWindowStartDate); - - Map parameters = new HashMap<>(); - - parameters.put(SCHEDULE_NAME, scheduleName); - parameters.put(MILESTONE_NAME, alert); - parameters.put(WINDOW_NAME, window.toString()); - parameters.put(EXTERNAL_ID, externalID); - - return new MotechEvent("Subject", parameters); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/util/Matcher.java b/opensrp-core/src/test/java/org/opensrp/util/Matcher.java deleted file mode 100644 index 9c7a87119c..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/util/Matcher.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.opensrp.util; - -import static org.mockito.Matchers.argThat; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.hamcrest.Description; -import org.mockito.ArgumentMatcher; - -public class Matcher { - - public static T objectWithSameFieldsAs(final T other) { - return argThat(hasSameFieldsAs(other)); - } - - public static ArgumentMatcher hasSameFieldsAs(final T other) { - return new ArgumentMatcher() { - - @Override - public boolean matches(Object o) { - return EqualsBuilder.reflectionEquals(other, o); - } - - @Override - public void describeTo(Description description) { - description.appendValue(other); - } - }; - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/util/PropertiesConverterTest.java b/opensrp-core/src/test/java/org/opensrp/util/PropertiesConverterTest.java deleted file mode 100644 index 8acdbd7471..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/util/PropertiesConverterTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.opensrp.util; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import org.joda.time.LocalDate; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.domain.LocationProperty; -import org.powermock.modules.junit4.PowerMockRunner; - -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.assertEquals; - -@RunWith(PowerMockRunner.class) -public class PropertiesConverterTest { - - private String parentJson = "{\"name\":\"MKB_5\",\"status\":\"Active\",\"version\":0,\"parentId\":\"2953\",\"geographicLevel\":2}"; - private Gson gson = new GsonBuilder().registerTypeAdapter(LocalDate.class, new DateTypeConverter()).serializeNulls() - .registerTypeAdapter(LocationProperty.class, new PropertiesConverter()).create(); - @Test - public void testSerializeCustomProperties() { - - LocationProperty locationProperty = gson.fromJson(parentJson, LocationProperty.class); - Map customProperties = new HashMap<>(); - customProperties.put("taskIdentifier", "0d15fcac-df64-4f53-b01a-b650d1e45252"); - customProperties.put("taskBusinessStatus", "Not Visited"); - customProperties.put("taskStatus", "In Progress"); - locationProperty.setCustomProperties(customProperties); - String expected = "{\"status\":\"Active\",\"parentId\":\"2953\",\"name\":\"MKB_5\",\"geographicLevel\":2,\"version\":0,\"taskBusinessStatus\":\"Not Visited\",\"taskIdentifier\":\"0d15fcac-df64-4f53-b01a-b650d1e45252\",\"taskStatus\":\"In Progress\"}"; - assertEquals(expected, gson.toJson(locationProperty)); - - } - - - @Test - public void testDeserializeCustomProperties() { - - LocationProperty locationProperty = gson.fromJson("{\"status\":\"Active\",\"parentId\":\"2953\",\"name\":\"MKB_5\",\"geographicLevel\":2,\"version\":0,\"taskBusinessStatus\":\"Not Visited\",\"taskIdentifier\":\"0d15fcac-df64-4f53-b01a-b650d1e45252\",\"taskStatus\":\"In Progress\"}" - , LocationProperty.class); - Map customProperties = locationProperty.getCustomProperties(); - assertEquals(3, customProperties.size()); - assertEquals("0d15fcac-df64-4f53-b01a-b650d1e45252", customProperties.get("taskIdentifier")); - assertEquals("Not Visited", customProperties.get("taskBusinessStatus")); - assertEquals("In Progress", customProperties.get("taskStatus")); - - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/util/SampleFullDomainObject.java b/opensrp-core/src/test/java/org/opensrp/util/SampleFullDomainObject.java deleted file mode 100644 index 7af17d4f82..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/util/SampleFullDomainObject.java +++ /dev/null @@ -1,305 +0,0 @@ -package org.opensrp.util; - -import static java.util.Arrays.asList; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.joda.time.DateTime; -import org.joda.time.DateTimeZone; -import org.opensrp.domain.Address; -import org.opensrp.domain.AppStateToken; -import org.opensrp.domain.BaseEntity; -import org.opensrp.domain.Client; -import org.opensrp.domain.ErrorTrace; -import org.opensrp.domain.Event; -import org.opensrp.domain.Hia2Indicator; -import org.opensrp.domain.Location; -import org.opensrp.domain.Multimedia; -import org.opensrp.domain.Obs; -import org.opensrp.domain.Provider; -import org.opensrp.domain.Report; -import org.opensrp.domain.User; -import org.opensrp.dto.form.MultimediaDTO; - -public class SampleFullDomainObject { - - //*** ADDRESS RELATED - public static final String addressType = "addressType"; - - public static final String country = "country"; - - public static final String stateProvince = "stateProvince"; - - public static final String cityVillage = "cityVillage"; - - public static final String countryDistrict = "countryDistrict"; - - public static final String subDistrict = "subDistrict"; - - public static final String town = "town"; - //** - - public static final String name = "name"; - - public static final String male = "male"; - - public static final DateTime birthDate = new DateTime(0l, DateTimeZone.UTC); - - public static final DateTime deathDate = new DateTime(1l, DateTimeZone.UTC); - - public static final String FULL_NAME = "full name"; - - public static final String LOCATION_NAME = "locationName"; - - public static Map identifier = new HashMap<>(); - - public static final Map attributes = new HashMap<>(); - - public static final String IDENTIFIER_TYPE = "identifierType"; - - public static final String IDENTIFIER_VALUE = "identifierValue"; - - public static final String ATTRIBUTES_VALUE = "attributesValue"; - - public static final String ATTRIBUTES_TYPE = "attributesType"; - - static { - identifier.put(IDENTIFIER_TYPE, IDENTIFIER_VALUE); - attributes.put(ATTRIBUTES_TYPE, ATTRIBUTES_VALUE); - } - - public static final String BASE_ENTITY_ID = "baseEntityId"; - - public static final String DIFFERENT_BASE_ENTITY_ID = "differentBaseEntityId"; - - public static final String FIRST_NAME = "firstName"; - - public static final String MIDDLE_NAME = "middleName"; - - public static final String LAST_NAME = "lastName"; - - public static final boolean BIRTH_DATE_APPROX = true; - - public static final boolean DEATH_DATE_APPROX = false; - - public static final String FEMALE = "female"; - - //** EVENT RELATED - public static final String EVENT_TYPE = "eventType"; - - public static final DateTime EVENT_DATE = new DateTime(0l, DateTimeZone.UTC); - - public static final String ENTITY_TYPE = "entityType"; - - public static final String PROVIDER_ID = "providerId"; - - public static final String LOCATION_ID = "locationId"; - - public static final String FORM_SUBMISSION_ID = "formSubmissionId"; - - public static final Map DETAILS = new HashMap<>(); - - public static final String DETAIL_KEY = "detailKey"; - - public static final String DETAIL_VALUE = "detailValue"; - - static { - DETAILS.put(DETAIL_KEY, DETAIL_VALUE); - } - //** - - //** OBS RELATED - public static final String CONCEPT = "concept"; - - public static final String FIELD_DATA_TYPE = "fieldDataTyp"; - - public static final String FIELD_CODE = "fieldCode"; - - public static final String PARENT_CODE = null; - - public static final String VALUE = "value"; - - public static final String COMMENTS_TEST = "commentsTest"; - - public static final String FORM_SUBMISSION_FIELD = "formSubmissionField"; - //** - - //** ERROR TRACE RELATED - public static final String RECORD_ID = "recordId"; - - public static final DateTime EPOCH_DATE_TIME = new DateTime(0l, DateTimeZone.UTC); - - public static final String ERROR_NAME = "errorName"; - - public static final String OCCURED_AT = "occuredAt"; - - public static final String STACK_TRACE = "stackTrace"; - - public static final String SOLVED = "solved"; - - //** APP STATE TOKEN RELATED - public enum AppStateTokenName { - APP_STATE_TOKEN_NAME("appStateTokenName"), - DIFFERENT_APP_STATE_TOKEN_NAME("differentAppStateToken"); - - String value; - - AppStateTokenName(String value) { - this.value = value; - } - - } - - public static final int LAST_EDIT_DATE = 1222; - - public static final String APP_STATE_TOKEN_DESCRIPTION = "description"; - //** - - //** LOCATION RELATED - public static Set locationTags = new HashSet<>(asList("tags1", "tags2")); - //** - - //** HIA2 INDICATOR RELATED - public static final String INDICATOR_CODE = "indicatorCode"; - - public static final String HIA2_INDICATOR_LABEL = "hia2IndicatorLabel"; - - public static final String DHIS_ID = "dhisId"; - - public static final String HIA_2_DESCRIPTION = "hia2Description"; - - public static final String HIA2_CATEGORY = "hia2Category"; - - public static final String HIA2_VALUE = "hia2Value"; - - public static final String HIA2_UPDATED_AT = "hia2UpdatedAt"; - //** - - //** REPORT RELATED - public static final String REPORT_TYPE = "reportType"; - - public static final String REPORT_STATUS = "reportStatus"; - - public static final int REPORT_VERSION = 222; - - public static final int REPORT_DURATION = 3434; - //** - - //** USER RELATED - public static final String USER_NAME = "userName"; - - public static final String PASSWORD = "password"; - - public static final String SALT = "salt"; - - public static final String USER_STATUS = "userStatus"; - - public static final List ROLES = asList("role1", "role2"); - - public static final List PERMISSIONS = asList("permission1", "permission2"); - //** - - //** MULTIMEDIA RELATED - public static final String FILE_CATEGORY = "fileCategory"; - - public static final String FILE_PATH = "filePath"; - - public static final String CONTENT_TYPE = "contentType"; - - public static final String CASE_ID = "caseId"; - //** - - public static Address getAddress() { - Address address = new Address().withAddressType(addressType).withCountry(country).withStateProvince(stateProvince) - .withCityVillage(cityVillage).withCountyDistrict(countryDistrict).withSubDistrict(subDistrict) - .withTown(town); - return address; - } - - public static Client getClient() { - Client client = new Client(BASE_ENTITY_ID, FIRST_NAME, MIDDLE_NAME, LAST_NAME, birthDate, deathDate, - BIRTH_DATE_APPROX, DEATH_DATE_APPROX, FEMALE, Collections.singletonList(getAddress()), identifier, - attributes); - return client; - } - - public static Obs getObs() { - Obs obs = new Obs(CONCEPT, FIELD_DATA_TYPE, FIELD_CODE, PARENT_CODE, VALUE, COMMENTS_TEST, FORM_SUBMISSION_FIELD); - return obs; - } - - public static Event getEvent() { - Event event = new Event(BASE_ENTITY_ID, EVENT_TYPE, EVENT_DATE, ENTITY_TYPE, PROVIDER_ID, LOCATION_ID, - FORM_SUBMISSION_ID); - event.setIdentifiers(identifier); - event.setDetails(DETAILS); - event.addObs(getObs()); - return event; - } - - public static AppStateToken getAppStateToken() { - AppStateToken appStateToken = new AppStateToken(AppStateTokenName.APP_STATE_TOKEN_NAME.name(), VALUE, LAST_EDIT_DATE, - APP_STATE_TOKEN_DESCRIPTION); - return appStateToken; - } - - public static ErrorTrace getErrorTrace() { - ErrorTrace errorTrace = new ErrorTrace(RECORD_ID, EPOCH_DATE_TIME, ERROR_NAME, OCCURED_AT, STACK_TRACE, SOLVED); - return errorTrace; - } - - public static Provider getProvider() { - Provider provider = new Provider(BASE_ENTITY_ID, FULL_NAME); - return provider; - } - - public static Location getDomainLocation() { - Location location = new Location(LOCATION_ID, LOCATION_NAME, getAddress(), identifier, null, locationTags, - attributes); - return location; - } - - public static org.opensrp.api.domain.Location getApiLocation() { - org.opensrp.api.domain.Location location = new org.opensrp.api.domain.Location(LOCATION_ID, LOCATION_NAME, null, - identifier, null, locationTags, attributes); - return location; - } - - public static Hia2Indicator getHia2Indicator() { - Hia2Indicator hia2Indicator = new Hia2Indicator(INDICATOR_CODE, HIA2_INDICATOR_LABEL, DHIS_ID, HIA_2_DESCRIPTION, - HIA2_CATEGORY, HIA2_VALUE, PROVIDER_ID, HIA2_UPDATED_AT); - return hia2Indicator; - } - - public static Report getReport() { - Report report = new Report(BASE_ENTITY_ID, LOCATION_ID, EPOCH_DATE_TIME, REPORT_TYPE, FORM_SUBMISSION_ID, - PROVIDER_ID, REPORT_STATUS, REPORT_VERSION, REPORT_DURATION, asList(getHia2Indicator())); - report.setIdentifiers(identifier); - return report; - } - - public static User getUser() { - User user = new User(BASE_ENTITY_ID, USER_NAME, PASSWORD, SALT, USER_STATUS, ROLES, PERMISSIONS); - return user; - } - - public static BaseEntity getBaseEntity() { - BaseEntity baseEntity = new BaseEntity(BASE_ENTITY_ID, identifier, attributes, asList(getAddress())); - return baseEntity; - } - - public static Multimedia getMultimedia() { - Multimedia multimedia = new Multimedia(CASE_ID, PROVIDER_ID, CONTENT_TYPE, FILE_PATH, FILE_CATEGORY); - return multimedia; - } - - public static MultimediaDTO getMultimediaDTO(String contentType) { - MultimediaDTO multimediaDTO = new MultimediaDTO(CASE_ID, PROVIDER_ID, contentType, FILE_PATH, FILE_CATEGORY); - return multimediaDTO; - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/util/ScheduleBuilder.java b/opensrp-core/src/test/java/org/opensrp/util/ScheduleBuilder.java deleted file mode 100644 index 73ce6123a4..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/util/ScheduleBuilder.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.opensrp.util; - -import static org.joda.time.LocalDate.parse; -import static org.mockito.Matchers.argThat; - -import java.util.HashMap; -import java.util.Map; - -import org.joda.time.DateTime; -import org.mockito.ArgumentMatcher; -import org.motechproject.scheduletracking.api.domain.Enrollment; -import org.motechproject.scheduletracking.api.domain.EnrollmentStatus; -import org.motechproject.scheduletracking.api.domain.Schedule; -import org.motechproject.scheduletracking.api.domain.WindowName; -import org.motechproject.scheduletracking.api.service.EnrollmentRecord; -import org.motechproject.scheduletracking.api.service.EnrollmentRequest; -import org.opensrp.scheduler.HealthSchedulerService.MetadataField; -import org.opensrp.scheduler.MilestoneEvent; - -public class ScheduleBuilder { - - public static EnrollmentRequest enrollmentFor(final String entityId, final String scheduleName, final String name, - final String referenceDate) { - return argThat(new ArgumentMatcher() { - - @Override - public boolean matches(Object o) { - EnrollmentRequest request = (EnrollmentRequest) o; - return entityId.equals(request.getExternalId()) && parse(referenceDate).equals(request.getReferenceDate()) - && scheduleName.equals(request.getScheduleName()) - && (name == null ? request.getStartingMilestoneName() == null - : name.equals(request.getStartingMilestoneName())); - } - }); - } - - public static EnrollmentRecord enrollmentRecord(String entityId, String scheduleName, String currentMilestone) { - return new EnrollmentRecord(entityId, scheduleName, currentMilestone, null, null, null, null, null, null, null); - } - - public static Enrollment enrollment(String entityId, String scheduleName, String currentMilestone, - DateTime startOfSchedule, DateTime enrolledOn, EnrollmentStatus enrollmentStatus, String formSubmissionId) { - Schedule schedule = new Schedule(scheduleName); - Map map = new HashMap<>(); - - map.put(MetadataField.lastUpdate.name(), new DateTime().toString()); - map.put(MetadataField.enrollmentEvent.name(), formSubmissionId); - return new Enrollment(entityId, schedule, currentMilestone, startOfSchedule, enrolledOn, null, enrollmentStatus, - map); - } - - public static MilestoneEvent event(String externalID, String scheduleName, String milestone, WindowName window, - DateTime dueWindowStart, DateTime lateWindowStart, DateTime maxWindowStart) { - return new MilestoneEvent(Event.create().withSchedule(scheduleName).withMilestone(milestone).withWindow(window) - .withExternalId(externalID).withDueWindowStartDate(dueWindowStart).withLateWindowStartDate(lateWindowStart) - .withMaxWindowStartDate(maxWindowStart).build()); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/util/TestResourceLoader.java b/opensrp-core/src/test/java/org/opensrp/util/TestResourceLoader.java deleted file mode 100644 index f6f569eae9..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/util/TestResourceLoader.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.opensrp.util; - -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.Properties; - -import org.json.JSONObject; -import org.opensrp.form.domain.FormSubmission; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.Resource; -import org.springframework.core.io.ResourceLoader; -import org.springframework.core.io.support.PropertiesLoaderUtils; - -import com.google.gson.Gson; -import com.google.gson.JsonIOException; -import com.ibm.icu.impl.Assert; - -public class TestResourceLoader { - - protected String openmrsOpenmrsUrl; - - protected String openmrsUsername; - - protected String openmrsPassword; - - protected String formDirPath; - - protected boolean pushToOpenmrsForTest; - - public TestResourceLoader() { - try { - Resource resource = new ClassPathResource("/opensrp.properties"); - Properties props = PropertiesLoaderUtils.loadProperties(resource); - formDirPath = props.getProperty("form.directory.name"); - } - catch (IOException e) { - Assert.fail(e); - } - - } - - protected FormSubmission getFormSubmissionFor(String formName, Integer number) throws JsonIOException, IOException { - ResourceLoader loader = new DefaultResourceLoader(); - String path = loader.getResource(formDirPath).getURI().getPath(); - File fsfile = new File(path + "/" + formName + "/form_submission" + (number == null ? "" : number) + ".json"); - return new Gson().fromJson(new FileReader(fsfile), FormSubmission.class); - } - - protected JSONObject getJsonFormSubmissionFor(String formName, Integer number) throws IOException { - ResourceLoader loader = new DefaultResourceLoader(); - String path = loader.getResource(formDirPath).getURI().getPath(); - File fsfile = new File(path + "/" + formName + "/form_submission" + (number == null ? "" : number) + ".json"); - return new JSONObject(new FileReader(fsfile)); - } - - protected String getFullPath(String fileName) throws IOException { - ResourceLoader loader = new DefaultResourceLoader(); - String path = loader.getResource(fileName).getURI().getPath(); - return path; - } - - protected FormSubmission getFormSubmissionFor(String formName) throws JsonIOException, IOException { - return getFormSubmissionFor(formName, null); - } -} diff --git a/opensrp-core/src/test/java/org/opensrp/util/UtilTest.java b/opensrp-core/src/test/java/org/opensrp/util/UtilTest.java deleted file mode 100644 index d1f4d24bfa..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/util/UtilTest.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.opensrp.util; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNull; - -import java.io.IOException; -import java.util.List; -import java.util.Map; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.junit.Test; -import org.opensrp.form.domain.FormSubmission; - -public class UtilTest extends TestResourceLoader { - - public String declaredFieldOne; - - public int declaredFieldTwo; - - @Test - public void testGetStringFromJson() throws IOException { - String formSubmission = "{\"_id\": \"1\",\n" + " \"_rev\": \"2\"}"; - Map map = Utils.getStringMapFromJSON(formSubmission); - assertFalse(map.isEmpty()); - assertEquals(map.size(), 2); - assertEquals(map.get("_id"), "1"); - assertEquals(map.get("_rev"), "2"); - assertNull(map.get("sdf")); - } - - @Test(expected = Exception.class) - public void testErrorForInvalidJsonInGetStringFromJson() { - String formSubmission = "Invalid JSON"; - Map map = Utils.getStringMapFromJSON(formSubmission); - } - - @Test - public void testGetFieldsAsList() { - List fieldList = Utils.getFieldsAsList(UtilTest.class); - assertEquals(2, fieldList.size()); - assertEquals("declaredFieldOne", fieldList.get(0)); - assertEquals("declaredFieldTwo", fieldList.get(1)); - } - - @Test - public void testGetZiggyParam() throws IOException, JSONException { - FormSubmission formSubmission = getFormSubmissionFor("new_household_registration", 1); - String ziggyParams = Utils.getZiggyParams(formSubmission); - JSONObject jsonObject = new JSONObject(ziggyParams); - - assertEquals(formSubmission.anmId(), jsonObject.get("anmId")); - assertEquals(formSubmission.formName(), jsonObject.get("formName")); - assertEquals(formSubmission.serverVersion(), Long.parseLong((String) jsonObject.get("serverVersion"))); - assertEquals(formSubmission.entityId(), jsonObject.get("entityId")); - assertEquals(formSubmission.instanceId(), jsonObject.get("instanceId")); - assertEquals(formSubmission.clientVersion(), Long.parseLong((String) jsonObject.get("clientVersion"))); - } - - @Test - public void testGetXlsToJson() throws IOException, JSONException { - String path = getFullPath("sampleXLS/validXLS.xls"); - JSONArray jsonArray = Utils.getXlsToJson(path); - JSONObject jsonObject = jsonArray.getJSONObject(0); - assertEquals(2, jsonArray.length()); - assertEquals("f", jsonObject.get("first")); - assertEquals("s", jsonObject.get("second")); - assertEquals("t", jsonObject.get("third")); - - } - - @Test - public void testGetXlsToJsonForEmptyXls() throws IOException, JSONException { - String path = getFullPath("sampleXLS/emptyXLS.xls"); - JSONArray jsonArray = Utils.getXlsToJson(path); - assertEquals(0, jsonArray.length()); - } - - @Test(expected = Exception.class) - public void testGetXlsToJsonForInvalidXls() throws IOException, JSONException { - String path = getFullPath("sampleXLS/invalidXLS.xls"); - JSONArray jsonArray = Utils.getXlsToJson(path); - } - -} diff --git a/opensrp-core/src/test/java/org/opensrp/util/it/UtilsIntegrationTest.java b/opensrp-core/src/test/java/org/opensrp/util/it/UtilsIntegrationTest.java deleted file mode 100644 index 2346c1a943..0000000000 --- a/opensrp-core/src/test/java/org/opensrp/util/it/UtilsIntegrationTest.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.opensrp.util.it; - -import static junit.framework.Assert.assertEquals; - -import java.net.MalformedURLException; - -import org.ektorp.CouchDbConnector; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.util.Utils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:test-applicationContext-opensrp.xml") -public class UtilsIntegrationTest { - - @Value("#{opensrp['couchdb.server']}") - String url; - - @Value("#{opensrp['couchdb.username']}") - String userName; - - @Value("#{opensrp['couchdb.password']}") - String password; - - @Value("#{opensrp['couchdb.port']}") - String portNumber; - - @Test - public void testConnectToDb() throws MalformedURLException { - Utils.DatabaseConnectionParams databaseConnectionParams = new Utils.DatabaseConnectionParams(); - databaseConnectionParams.url = "http://" + url; - databaseConnectionParams.dbName = "opensrp"; - databaseConnectionParams.password = password; - databaseConnectionParams.userName = userName; - databaseConnectionParams.portNumber = portNumber; - - CouchDbConnector couchDbConnector = Utils.connectToDB(databaseConnectionParams); - - assertEquals("opensrp", couchDbConnector.getDatabaseName()); - } - - @Test(expected = MalformedURLException.class) - public void testConnectDbMalFormedURLException() throws MalformedURLException { - Utils.DatabaseConnectionParams databaseConnectionParams = new Utils.DatabaseConnectionParams(); - databaseConnectionParams.url = "127.0.0.1"; - databaseConnectionParams.portNumber = portNumber; - - CouchDbConnector couchDbConnector = Utils.connectToDB(databaseConnectionParams); - } - - @Test(expected = NullPointerException.class) - public void testConnectDbNullPointerException() throws MalformedURLException { - Utils.DatabaseConnectionParams databaseConnectionParams = new Utils.DatabaseConnectionParams(); - CouchDbConnector couchDbConnector = Utils.connectToDB(databaseConnectionParams); - } - - @Test - public void testConnectDbWithOutUserNameAndPassword() throws MalformedURLException { - Utils.DatabaseConnectionParams databaseConnectionParams = new Utils.DatabaseConnectionParams(); - databaseConnectionParams.url = "http://" + url; - databaseConnectionParams.portNumber = portNumber; - databaseConnectionParams.dbName = "opensrp"; - - CouchDbConnector couchDbConnector = Utils.connectToDB(databaseConnectionParams); - assertEquals("opensrp", couchDbConnector.getDatabaseName()); - } -} diff --git a/opensrp-core/src/test/java/org/utils/AssertionUtil.java b/opensrp-core/src/test/java/org/utils/AssertionUtil.java deleted file mode 100644 index c0dc55139d..0000000000 --- a/opensrp-core/src/test/java/org/utils/AssertionUtil.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.utils; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.utils.CouchDbAccessUtils.purgeDateCreatedEditedAndVoidedField; - -import java.util.List; - -import org.opensrp.domain.BaseDataObject; -import org.opensrp.domain.Location; - -public final class AssertionUtil { - - private AssertionUtil() { - - } - - public static void assertTwoListAreSameIgnoringOrder(List expectedList, List actualList) { - assertEquals(expectedList.size(), actualList.size()); - assertTrue("expected: " + expectedList.toString() + "\n" + "actual: " + actualList.toString(), - expectedList.containsAll(actualList) && actualList.containsAll(expectedList)); - } - - public static void assertNewObjectCreation(T expectedObject, T actualObject) { - assertNotNull(actualObject.getDateCreated()); - - purgeDateCreatedEditedAndVoidedField(asList(expectedObject, actualObject)); - - assertEquals(expectedObject, actualObject); - - } - - public static void assertObjectUpdate(T expectedObject, T actualObject) { - assertNotNull(actualObject.getDateEdited()); - - purgeDateCreatedEditedAndVoidedField(asList(expectedObject, actualObject)); - assertEquals(expectedObject, actualObject); - - } - - public static void assertTwoDifferentTypeLocationSame(Location expectedLocation, - org.opensrp.api.domain.Location actualLocation) { - assertEquals(expectedLocation.getLocationId(), actualLocation.getLocationId()); - assertEquals(expectedLocation.getTags(), actualLocation.getTags()); - assertEquals(expectedLocation.getAttributes(), actualLocation.getAttributes()); - //assertEquals(expectedLocation.getAddress(), actualLocation.getAddress()); - assertEquals(expectedLocation.getName(), actualLocation.getName()); - assertEquals(expectedLocation.getIdentifiers(), actualLocation.getIdentifiers()); - if (expectedLocation.getParentLocation() != null) { - assertNotNull(actualLocation.getParentLocation()); - assertTwoDifferentTypeLocationSame(expectedLocation.getParentLocation(), actualLocation.getParentLocation()); - } - } - -} diff --git a/opensrp-core/src/test/java/org/utils/CouchDbAccessUtils.java b/opensrp-core/src/test/java/org/utils/CouchDbAccessUtils.java deleted file mode 100644 index bd7266f3b3..0000000000 --- a/opensrp-core/src/test/java/org/utils/CouchDbAccessUtils.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.utils; - -import java.io.IOException; -import java.util.List; - -import org.ektorp.CouchDbConnector; -import org.ektorp.CouchDbInstance; -import org.ektorp.http.StdHttpClient; -import org.ektorp.impl.StdCouchDbInstance; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.domain.BaseDataObject; - -import com.github.ldriscoll.ektorplucene.LuceneAwareCouchDbConnector; - -public final class CouchDbAccessUtils { - - public static final String TEST_REMOTE_URL = "http://localhost:5984"; - - private CouchDbAccessUtils() { - - } - - public static void addObjectToRepository(List objectList, R repository) { - for (T object : objectList) { - repository.add(object); - } - } - - public static CouchDbConnector getCouchDbConnector(String dbName) throws IOException { - org.ektorp.http.HttpClient httpClient = new StdHttpClient.Builder().url(TEST_REMOTE_URL).build(); - CouchDbInstance couchDbInstance = new StdCouchDbInstance(httpClient); - CouchDbConnector couchDbConnector = new LuceneAwareCouchDbConnector(dbName, couchDbInstance); - return couchDbConnector; - } - - public static void purgeDateCreatedEditedAndVoidedField(List objecstToPurge) { - for (T objectToPurge : objecstToPurge) { - objectToPurge.setDateCreated(null); - objectToPurge.setDateEdited(null); - objectToPurge.setDateVoided(null); - } - } -} diff --git a/opensrp-core/src/test/java/org/utils/TestUtils.java b/opensrp-core/src/test/java/org/utils/TestUtils.java deleted file mode 100644 index 5b92277e38..0000000000 --- a/opensrp-core/src/test/java/org/utils/TestUtils.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.utils; - -import java.nio.file.Paths; - -/** - * Created by Vincent Karuri on 30/10/2019 - */ -public class TestUtils { - public static String getBasePackageFilePath() { - return Paths.get(".").toAbsolutePath().normalize().toString(); - } -} diff --git a/opensrp-core/src/test/resources/form/basic_reg/form.json b/opensrp-core/src/test/resources/form/basic_reg/form.json deleted file mode 100644 index 1dcfa303dc..0000000000 --- a/opensrp-core/src/test/resources/form/basic_reg/form.json +++ /dev/null @@ -1,653 +0,0 @@ -{ - "default_language": "default", - "id_string": "patient_basic_reg", - "children": [ - { - "name": "woman_name", - "label": "First name", - "instance": { - "openmrs_entity_id": "first_name", - "openmrs_entity": "person" - }, - "type": "text" - }, - { - "name": "last_name", - "label": "Last name", - "instance": { - "openmrs_entity_id": "last_name", - "openmrs_entity": "person" - }, - "type": "text" - }, - { - "name": "gender", - "default": "female", - "label": "Gender", - "instance": { - "openmrs_entity_id": "gender", - "openmrs_entity": "person" - }, - "type": "text" - }, - { - "name": "birthdate", - "label": "DOB", - "instance": { - "openmrs_entity_id": "birthdate", - "openmrs_entity": "person" - }, - "type": "date" - }, - { - "children": [ - { - "name": "karachi", - "label": "Karachi", - "instance": { - "openmrs_code": "karachi" - } - }, - { - "name": "lahore", - "label": "Lahore", - "instance": { - "openmrs_code": "lahore" - } - } - ], - "name": "location", - "bind": { - "required": "yes" - }, - "label": "Location of ANC", - "instance": { - "openmrs_entity_id": "location_id", - "openmrs_entity": "encounter" - }, - "type": "select one" - }, - { - "name": "anc_visit_date", - "bind": { - "required": "yes", - "constraint": ".<=${today}" - }, - "label": "ANC visit date?", - "instance": { - "openmrs_entity_id": "encounter_date", - "openmrs_entity": "encounter" - }, - "type": "date" - }, - { - "name": "pulse_rate", - "bind": { - "constraint": ".>0" - }, - "label": "Pulse rate", - "instance": { - "openmrs_entity_id": "5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "integer" - }, - { - "name": "temperature", - "bind": { - "constraint": ".>0" - }, - "label": "Temperature (C)", - "instance": { - "openmrs_entity_id": "5088AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "decimal" - }, - { - "children": [ - { - "name": "birthplace_lat", - "label": "Latitude", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "latitude", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_lon", - "label": "Longitude", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "longitute", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_postcode", - "label": "postalCode / postal_code", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "postalcode", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_house", - "label": "HOUSE_NUMBER / HOUSE / HOUSE_NO / UNIT / UNIT_NUMBER / UNIT_NO", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "house_number", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_street", - "label": "STREET / STREET_NUMBER / LANE", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "street", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_area", - "label": "SECTOR / AREA", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "area", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_town", - "label": "MUNICIPALITY / TOWN / LOCALITY / REGION", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "town", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_busroute", - "label": "Bus route custom field", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "bus_route", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_district", - "label": "COUNTY / DISTRICT", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "district", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_city", - "label": "CITY / VILLAGE", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "city", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_state", - "label": "state / state_province / stateProvince/ province", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "state", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_country", - "label": "country", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "country", - "openmrs_entity": "person_address" - }, - "type": "text" - } - ], - "name": "birthplace_address", - "label": "Birthplace", - "type": "group" - }, - { - "children": [ - { - "name": "usual_residence_start", - "label": "When started (startDate / start_date)", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "startdate", - "openmrs_entity": "person_address" - }, - "type": "date" - }, - { - "name": "usual_residence_lat", - "label": "Latitude", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "latitude", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_lon", - "label": "Longitude", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "longitute", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_postcode", - "label": "postalCode / postal_code", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "postalcode", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_house", - "label": "HOUSE_NUMBER / HOUSE / HOUSE_NO / UNIT / UNIT_NUMBER / UNIT_NO", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "uniit", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_street", - "label": "STREET / STREET_NUMBER / LANE", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "lane", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_area", - "label": "SECTOR / AREA", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "sector", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_town", - "label": "MUNICIPALITY / TOWN / LOCALITY / REGION", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "municipality", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_district", - "label": "COUNTY / DISTRICT", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "district", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_city", - "label": "CITY / VILLAGE", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "city", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_state", - "label": "state / state_province / stateProvince/ province", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "province", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_country", - "label": "country", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "country", - "openmrs_entity": "person_address" - }, - "type": "text" - } - ], - "name": "usual_residence_address", - "label": "Usual Residence", - "type": "group" - }, - { - "children": [ - { - "name": "previous_residence_start", - "label": "When started (startDate / start_date)", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "startdate", - "openmrs_entity": "person_address" - }, - "type": "date" - }, - { - "name": "previous_residence_end", - "label": "When ended (endDate/end_date)", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "enddate", - "openmrs_entity": "person_address" - }, - "type": "date" - }, - { - "name": "previous_residence_lat", - "label": "Latitude", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "latitude", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_lon", - "label": "Longitude", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "longitute", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_postcode", - "label": "postalCode / postal_code", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "postalcode", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_house", - "label": "HOUSE_NUMBER / HOUSE / HOUSE_NO / UNIT / UNIT_NUMBER / UNIT_NO", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "house", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_street", - "label": "STREET / STREET_NUMBER / LANE", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "street", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_area", - "label": "SECTOR / AREA", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "area", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_town", - "label": "MUNICIPALITY / TOWN / LOCALITY / REGION", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "region", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_district", - "label": "COUNTY / DISTRICT", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "county", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_city", - "label": "CITY / VILLAGE", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "village", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_state", - "label": "state / state_province / stateProvince/ province", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "state", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_country", - "label": "country", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "country", - "openmrs_entity": "person_address" - }, - "type": "text" - } - ], - "name": "previous_residence_address", - "label": "Previous Residence", - "type": "group" - }, - { - "children": [ - { - "name": "deathplace_lat", - "label": "Latitude", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "latitude", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_lon", - "label": "Longitude", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "longitute", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_postcode", - "label": "postalCode / postal_code", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "postal_code", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_house", - "label": "HOUSE_NUMBER / HOUSE / HOUSE_NO / UNIT / UNIT_NUMBER / UNIT_NO", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "unit", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_street", - "label": "STREET / STREET_NUMBER / LANE", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "lane", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_area", - "label": "SECTOR / AREA", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "area", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_town", - "label": "MUNICIPALITY / TOWN / LOCALITY / REGION", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "region", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_district", - "label": "COUNTY / DISTRICT", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "district", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_city", - "label": "CITY / VILLAGE", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "city", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_state", - "label": "state / state_province / stateProvince/ province", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "state_province", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_country", - "label": "country", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "country", - "openmrs_entity": "person_address" - }, - "type": "text" - } - ], - "name": "deathplace_address", - "label": "Death Place", - "type": "group" - }, - { - "name": "today", - "type": "today" - }, - { - "name": "start", - "type": "start" - }, - { - "name": "end", - "type": "end" - }, - { - "control": { - "bodyless": true - }, - "children": [ - { - "name": "instanceID", - "bind": { - "readonly": "true()", - "calculate": "concat('uuid:', uuid())" - }, - "type": "calculate" - } - ], - "name": "meta", - "type": "group" - } - ], - "instance": { - "encounter_type": "patient_register" - }, - "version": "201504030905", - "type": "survey", - "name": "register_with_address", - "sms_keyword": "patient_basic_reg", - "title": "Patient Registration" -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/basic_reg/form.xml b/opensrp-core/src/test/resources/form/basic_reg/form.xml deleted file mode 100644 index 8926f192ec..0000000000 --- a/opensrp-core/src/test/resources/form/basic_reg/form.xml +++ /dev/null @@ -1,287 +0,0 @@ - - - -

Register with address

- - - - -
-
- - Location of ANC - * - -
- - -
-
-
- - - -
-

- Birthplace -

- - - - - - - - - - - - -
- -
-

- Usual Residence -

- - - - - - - - - - - - -
- -
-

- Previous Residence -

- - - - - - - - - - - - - -
- -
-

- Death Place -

- - - - - - - - - - - -
- - - - \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/basic_reg/form_definition.json b/opensrp-core/src/test/resources/form/basic_reg/form_definition.json deleted file mode 100644 index c6be057f92..0000000000 --- a/opensrp-core/src/test/resources/form/basic_reg/form_definition.json +++ /dev/null @@ -1,245 +0,0 @@ -{ - "form_data_definition_version": "1", - "form": { - "bind_type": "register_with_address", - "default_bind_path": "/model/instance/register_with_address/", - "fields": [ - { - "name": "woman_name", - "bind": "/model/instance/register_with_address/woman_name" - }, - { - "name": "last_name", - "bind": "/model/instance/register_with_address/last_name" - }, - { - "name": "gender", - "bind": "/model/instance/register_with_address/gender" - }, - { - "name": "birthdate", - "bind": "/model/instance/register_with_address/birthdate" - }, - { - "name": "location", - "bind": "/model/instance/register_with_address/location" - }, - { - "name": "anc_visit_date", - "bind": "/model/instance/register_with_address/anc_visit_date" - }, - { - "name": "pulse_rate", - "bind": "/model/instance/register_with_address/pulse_rate" - }, - { - "name": "temperature", - "bind": "/model/instance/register_with_address/temperature" - }, - { - "name": "birthplace_lat", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_lat" - }, - { - "name": "birthplace_lon", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_lon" - }, - { - "name": "birthplace_postcode", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_postcode" - }, - { - "name": "birthplace_house", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_house" - }, - { - "name": "birthplace_street", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_street" - }, - { - "name": "birthplace_area", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_area" - }, - { - "name": "birthplace_town", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_town" - }, - { - "name": "birthplace_busroute", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_busroute" - }, - { - "name": "birthplace_district", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_district" - }, - { - "name": "birthplace_city", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_city" - }, - { - "name": "birthplace_state", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_state" - }, - { - "name": "birthplace_country", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_country" - }, - { - "name": "usual_residence_start", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_start" - }, - { - "name": "usual_residence_lat", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_lat" - }, - { - "name": "usual_residence_lon", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_lon" - }, - { - "name": "usual_residence_postcode", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_postcode" - }, - { - "name": "usual_residence_house", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_house" - }, - { - "name": "usual_residence_street", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_street" - }, - { - "name": "usual_residence_area", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_area" - }, - { - "name": "usual_residence_town", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_town" - }, - { - "name": "usual_residence_district", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_district" - }, - { - "name": "usual_residence_city", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_city" - }, - { - "name": "usual_residence_state", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_state" - }, - { - "name": "usual_residence_country", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_country" - }, - { - "name": "previous_residence_start", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_start" - }, - { - "name": "previous_residence_end", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_end" - }, - { - "name": "previous_residence_lat", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_lat" - }, - { - "name": "previous_residence_lon", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_lon" - }, - { - "name": "previous_residence_postcode", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_postcode" - }, - { - "name": "previous_residence_house", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_house" - }, - { - "name": "previous_residence_street", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_street" - }, - { - "name": "previous_residence_area", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_area" - }, - { - "name": "previous_residence_town", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_town" - }, - { - "name": "previous_residence_district", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_district" - }, - { - "name": "previous_residence_city", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_city" - }, - { - "name": "previous_residence_state", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_state" - }, - { - "name": "previous_residence_country", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_country" - }, - { - "name": "deathplace_lat", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_lat" - }, - { - "name": "deathplace_lon", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_lon" - }, - { - "name": "deathplace_postcode", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_postcode" - }, - { - "name": "deathplace_house", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_house" - }, - { - "name": "deathplace_street", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_street" - }, - { - "name": "deathplace_area", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_area" - }, - { - "name": "deathplace_town", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_town" - }, - { - "name": "deathplace_district", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_district" - }, - { - "name": "deathplace_city", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_city" - }, - { - "name": "deathplace_state", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_state" - }, - { - "name": "deathplace_country", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_country" - }, - { - "name": "today", - "bind": "/model/instance/register_with_address/today" - }, - { - "name": "start", - "bind": "/model/instance/register_with_address/start" - }, - { - "name": "end", - "bind": "/model/instance/register_with_address/end" - } - ] - } -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/basic_reg/form_submission.json b/opensrp-core/src/test/resources/form/basic_reg/form_submission.json deleted file mode 100644 index 84c463821c..0000000000 --- a/opensrp-core/src/test/resources/form/basic_reg/form_submission.json +++ /dev/null @@ -1,254 +0,0 @@ -{ - "anmId": "admin", - "instanceId": "88ceee24-10b4-44c2-9429-754b8d823776", - "clientVersion": "1426830449320", - "entityId": "b716d938-1aea-40ae-a081-9ddddddcccc9", - "formDataDefinitionVersion": "1", - "formName": "basic_reg", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "register_with_address", - "default_bind_path": "/model/instance/register_with_address/", - "fields": [ - { - "name": "woman_name", - "value": "test woman_name" - }, - { - "name": "last_name", - "value": "test last_name" - }, - { - "name": "gender", - "value": "FEMALE" - }, - { - "name": "birthdate", - "value": "2015-02-01" - }, - { - "name": "location", - "value": "unknown location" - }, - { - "name": "anc_visit_date", - "value": "2015-02-01" - }, - { - "name": "pulse_rate", - "value": "55" - }, - { - "name": "temperature", - "value": "37" - }, - { - "name": "birthplace_lat", - "value": "test birthplace_lat" - }, - { - "name": "birthplace_lon", - "value": "test birthplace_lon" - }, - { - "name": "birthplace_postcode", - "value": "test birthplace_postcode" - }, - { - "name": "birthplace_house", - "value": "test birthplace_house" - }, - { - "name": "birthplace_street", - "value": "test birthplace_street" - }, - { - "name": "birthplace_area", - "value": "test birthplace_area" - }, - { - "name": "birthplace_town", - "value": "test birthplace_town" - }, - { - "name": "birthplace_busroute", - "value": "test birthplace_busroute" - }, - { - "name": "birthplace_district", - "value": "test birthplace_district" - }, - { - "name": "birthplace_city", - "value": "test birthplace_city" - }, - { - "name": "birthplace_state", - "value": "test birthplace_state" - }, - { - "name": "birthplace_country", - "value": "test birthplace_country" - }, - { - "name": "usual_residence_start", - "value": "2015-02-01" - }, - { - "name": "usual_residence_lat", - "value": "test usual_residence_lat" - }, - { - "name": "usual_residence_lon", - "value": "test usual_residence_lon" - }, - { - "name": "usual_residence_postcode", - "value": "test usual_residence_postcode" - }, - { - "name": "usual_residence_house", - "value": "test usual_residence_house" - }, - { - "name": "usual_residence_street", - "value": "test usual_residence_street" - }, - { - "name": "usual_residence_area", - "value": "test usual_residence_area" - }, - { - "name": "usual_residence_town", - "value": "test usual_residence_town" - }, - { - "name": "usual_residence_district", - "value": "test usual_residence_district" - }, - { - "name": "usual_residence_city", - "value": "test usual_residence_city" - }, - { - "name": "usual_residence_state", - "value": "test usual_residence_state" - }, - { - "name": "usual_residence_country", - "value": "test usual_residence_country" - }, - { - "name": "previous_residence_start", - "value": "2015-02-01" - }, - { - "name": "previous_residence_end", - "value": "2015-02-01" - }, - { - "name": "previous_residence_lat", - "value": "test previous_residence_lat" - }, - { - "name": "previous_residence_lon", - "value": "test previous_residence_lon" - }, - { - "name": "previous_residence_postcode", - "value": "test previous_residence_postcode" - }, - { - "name": "previous_residence_house", - "value": "test previous_residence_house" - }, - { - "name": "previous_residence_street", - "value": "test previous_residence_street" - }, - { - "name": "previous_residence_area", - "value": "test previous_residence_area" - }, - { - "name": "previous_residence_town", - "value": "test previous_residence_town" - }, - { - "name": "previous_residence_district", - "value": "test previous_residence_district" - }, - { - "name": "previous_residence_city", - "value": "test previous_residence_city" - }, - { - "name": "previous_residence_state", - "value": "test previous_residence_state" - }, - { - "name": "previous_residence_country", - "value": "test previous_residence_country" - }, - { - "name": "deathplace_lat", - "value": "test deathplace_lat" - }, - { - "name": "deathplace_lon", - "value": "test deathplace_lon" - }, - { - "name": "deathplace_postcode", - "value": "test deathplace_postcode" - }, - { - "name": "deathplace_house", - "value": "test deathplace_house" - }, - { - "name": "deathplace_street", - "value": "test deathplace_street" - }, - { - "name": "deathplace_area", - "value": "test deathplace_area" - }, - { - "name": "deathplace_town", - "value": "test deathplace_town" - }, - { - "name": "deathplace_district", - "value": "test deathplace_district" - }, - { - "name": "deathplace_city", - "value": "test deathplace_city" - }, - { - "name": "deathplace_state", - "value": "test deathplace_state" - }, - { - "name": "deathplace_country", - "value": "test deathplace_country" - }, - { - "name": "today", - "value": "2015-02-01" - }, - { - "name": "start", - "value": "2015-02-01" - }, - { - "name": "end", - "value": "2015-02-01" - } - ] - } - }, - "serverVersion": 1430998001293 -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/basic_reg/model.xml b/opensrp-core/src/test/resources/form/basic_reg/model.xml deleted file mode 100644 index 06822afad1..0000000000 --- a/opensrp-core/src/test/resources/form/basic_reg/model.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - female - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/child_enrollment/form.json b/opensrp-core/src/test/resources/form/child_enrollment/form.json deleted file mode 100644 index 98878c7e0e..0000000000 --- a/opensrp-core/src/test/resources/form/child_enrollment/form.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"Child_Vaccination_Enrollment","title":"بچّوں کا انرولمنٹ رجسٹر برائے ٹیکاجات - Child Enrollment Vaccination Register","sms_keyword":"child_vaccination_enrollment","default_language":"English","choices":{"provinces":[{"name":"kpk","label":{"Urdu":"خیبر پختون خواہ","English":"Khyber Pakhtunkhwa","Roman Urdu":"Khyber Pakhtunkhwa"}},{"name":"sindh","label":{"Urdu":"سندھ","English":"Sindh","Roman Urdu":"Sindh"}},{"name":"balochistan","label":{"Urdu":"بلوچستان","English":"Balochistan","Roman Urdu":"Balochistan"}},{"name":"punjab","label":{"Urdu":"پنجاب","English":"Punjab","Roman Urdu":"Punjab"}},{"name":"gilgit_baltistan","label":{"Urdu":"گلگت بلتستان","English":"Gilgit Baltistan","Roman Urdu":"Gilgit Baltistan"}},{"name":"kashmir","label":{"Urdu":"کشمیر","English":"Kashmir","Roman Urdu":"Kashmir"}},{"name":"fata","label":{"Urdu":"فاٹا","English":"FATA","Roman Urdu":"FATA"}},{"name":"out_of_country","label":{"Urdu":"ملک سے باہر","English":"Out of Country","Roman Urdu":"Mulk se baahir"}}],"ucs":[{"province":"sindh","city":"karachi","town":"korangi","name":"bilal_colony","label":{"Urdu":"بلال کالونی","Roman Urdu":"Bilal Colony","English":"Bilal Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"nasir_colony","label":{"Urdu":"ناصر کالونی","Roman Urdu":"Nasir Colony","English":"Nasir Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"chakra_goth","label":{"Urdu":"چکرا گوٹھ","Roman Urdu":"Chakra Goth","English":"Chakra Goth"}},{"province":"sindh","city":"karachi","town":"korangi","name":"mustafa_taj_colony","label":{"Urdu":"مصطفی تاج کالونی","Roman Urdu":"Mustafa Taj Colony","English":"Mustafa Taj Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"hundred_quarters","label":{"Urdu":"ہنڈریڈ کوارٹر","Roman Urdu":"Hundred Quarters","English":"Hundred Quarters"}},{"province":"sindh","city":"karachi","town":"korangi","name":"gulzar_colony","label":{"Urdu":"گلزار کالونی","Roman Urdu":"Gulzar Colony","English":"Gulzar Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"korangi_sector_33","label":{"Urdu":"کورنگی سیکٹر 33","Roman Urdu":"Korangi Sector 33","English":"Korangi Sector 33"}},{"province":"sindh","city":"karachi","town":"korangi","name":"zaman_town","label":{"Urdu":"زمان ٹاوَن","Roman Urdu":"Zaman Town","English":"Zaman Town"}},{"province":"sindh","city":"karachi","town":"korangi","name":"hasrat_mohani_colony","label":{"Urdu":"حسرت موہانی کالونی","Roman Urdu":"Hasrat Mohani Colony","English":"Hasrat Mohani Colony"}},{"province":"sindh","city":"karachi","town":"baldia","name":"gulshan_e_ghazi","label":{"Urdu":"گلشن غازی","Roman Urdu":"Gulshan-e-Ghazi","English":"Gulshan-e-Ghazi"}},{"province":"sindh","city":"karachi","town":"baldia","name":"ittehad_town","label":{"Urdu":"اتحاد ٹاوَن","Roman Urdu":"Ittehad Town","English":"Ittehad Town"}},{"province":"sindh","city":"karachi","town":"baldia","name":"islam_nagar","label":{"Urdu":"اسلام نگر","Roman Urdu":"Islam Nagar","English":"Islam Nagar"}},{"province":"sindh","city":"karachi","town":"baldia","name":"nai_abadi","label":{"Urdu":"نئی آبادی","Roman Urdu":"Nai Abadi","English":"Nai Abadi"}},{"province":"sindh","city":"karachi","town":"baldia","name":"saeedabad","label":{"Urdu":"سعید آباد","Roman Urdu":"Saeedabad","English":"Saeedabad"}},{"province":"sindh","city":"karachi","town":"baldia","name":"muslim_mujahid_colony","label":{"Urdu":"مسلم مجاہد کالونی","Roman Urdu":"Muslim Mujahid Colony","English":"Muslim Mujahid Colony"}},{"province":"sindh","city":"karachi","town":"baldia","name":"muhajir_camp","label":{"Urdu":"مہاجر کیمپ","Roman Urdu":"Muhajir Camp","English":"Muhajir Camp"}},{"province":"sindh","city":"karachi","town":"baldia","name":"rasheedabad","label":{"Urdu":"رشید آباد","Roman Urdu":"Rasheedabad","English":"Rasheedabad"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"ibrahim_hyderi","label":{"Urdu":"ابراہیم حیدری","Roman Urdu":"Ibrahim Hyderi","English":"Ibrahim Hyderi"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"rehri","label":{"Urdu":"رہڑی","Roman Urdu":"Rehri","English":"Rehri"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"cattle_colony","label":{"Urdu":"کیٹل کالونی","Roman Urdu":"Cattle Colony","English":"Cattle Colony"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"qaidabad","label":{"Urdu":"قائدآباد","Roman Urdu":"Qaidabad","English":"Qaidabad"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"landhi_colony","label":{"Urdu":"لانڈھی کالونی","Roman Urdu":"Landhi Colony","English":"Landhi Colony"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"gulshan_e_hadeed","label":{"Urdu":"گلشن حدید","Roman Urdu":"Gulshan-e-Hadeed","English":"Gulshan-e-Hadeed"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"gaghar","label":{"Urdu":"گگر","Roman Urdu":"Gaghar","English":"Gaghar"}},{"province":"sindh","city":"karachi","town":"gadap","name":"murad_memon_goth","label":{"Urdu":"مراد میمن گوٹھ","Roman Urdu":"Murad Memon Goth","English":"Murad Memon Goth"}},{"province":"sindh","city":"karachi","town":"gadap","name":"darsano_chana","label":{"Urdu":"درشانو شنو","Roman Urdu":"Darsano Chana","English":"Darsano Chana"}},{"province":"sindh","city":"karachi","town":"gadap","name":"gujro","label":{"Urdu":"گجرو","Roman Urdu":"Gujro","English":"Gujro"}},{"province":"sindh","city":"karachi","town":"gadap","name":"songal","label":{"Urdu":"سنگل","Roman Urdu":"Songal","English":"Songal"}},{"province":"sindh","city":"karachi","town":"gadap","name":"maymarabad","label":{"Urdu":"معمار آباد","Roman Urdu":"Maymarabad","English":"Maymarabad"}},{"province":"sindh","city":"karachi","town":"gadap","name":"yousuf_goth","label":{"Urdu":"یوسف گوٹھ","Roman Urdu":"Yousuf Goth","English":"Yousuf Goth"}},{"province":"sindh","city":"karachi","town":"gadap","name":"manghopir","label":{"Urdu":"منگھوپیر","Roman Urdu":"Manghopir","English":"Manghopir"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"azizabad","label":{"Urdu":"عزیز آباد","Roman Urdu":"Azizabad","English":"Azizabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"karimabad","label":{"Urdu":"کریم آباد","Roman Urdu":"Karimabad","English":"Karimabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"aisha_manzil","label":{"Urdu":"عائشہ منزل","Roman Urdu":"Aisha Manzil","English":"Aisha Manzil"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"ancholi","label":{"Urdu":"انچولی","Roman Urdu":"Ancholi","English":"Ancholi"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"naseerabad","label":{"Urdu":"نصیرآباد","Roman Urdu":"Naseerabad","English":"Naseerabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"yaseenabad","label":{"Urdu":"یاسین آباد","Roman Urdu":"Yaseenabad","English":"Yaseenabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"water_pump","label":{"Urdu":"واٹرپمپ","Roman Urdu":"Water Pump","English":"Water Pump"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"shafiq_mill_colony","label":{"Urdu":"شفیق مل کالونی","Roman Urdu":"Shafiq Mill Colony","English":"Shafiq Mill Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"delhi_mercantile_society","label":{"Urdu":"دہلی مرچنٹائل سوسائٹی","Roman Urdu":"Delhi Mercantile Society","English":"Delhi Mercantile Society"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"civic_centre","label":{"Urdu":"سوک سینٹر","Roman Urdu":"Civic Centre","English":"Civic Centre"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"pir_ilahi_buksh_colony","label":{"Urdu":"پیر الہی بخش کالونی","Roman Urdu":"Pir Ilahi Buksh Colony","English":"Pir Ilahi Buksh Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"essa_nagri","label":{"Urdu":"عیسی نگری","Roman Urdu":"Essa Nagri","English":"Essa Nagri"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gulshan_e_iqbal","label":{"Urdu":"گلشن اقبال","Roman Urdu":"Gulshan-e-Iqbal","English":"Gulshan-e-Iqbal"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gillani_railway_station","label":{"Urdu":"گیلانی ریلوے اسٹیشن","Roman Urdu":"Gillani Railway Station","English":"Gillani Railway Station"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"shanti_nagar","label":{"Urdu":"شانتی نگر","Roman Urdu":"Shanti Nagar","English":"Shanti Nagar"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"jamali_colony","label":{"Urdu":"جمالی کالونی","Roman Urdu":"Jamali Colony","English":"Jamali Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gulshan_e_iqbal_ii","label":{"Urdu":"گلشن اقبال 2","Roman Urdu":"Gulshan-e-Iqbal II","English":"Gulshan-e-Iqbal II"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"pehlwan_goth","label":{"Urdu":"پہلوان گوٹھ","Roman Urdu":"Pehlwan Goth","English":"Pehlwan Goth"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"matrovil_colony","label":{"Urdu":"میٹروویل کالونی","Roman Urdu":"Matrovil Colony","English":"Matrovil Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gulzar_e_hijri","label":{"Urdu":"گلزار ہجری","Roman Urdu":"Gulzar-e-Hijri","English":"Gulzar-e-Hijri"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"safooran_goth","label":{"Urdu":"صفورا گوٹھ","Roman Urdu":"Safooran Goth","English":"Safooran Goth"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"akhtar_colony","label":{"Urdu":"اختر کالونی","Roman Urdu":"Akhtar Colony","English":"Akhtar Colony"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"manzoor_colony","label":{"Urdu":"منظور کالونی","Roman Urdu":"Manzoor Colony","English":"Manzoor Colony"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"azam_basti","label":{"Urdu":"اعظم بستی","Roman Urdu":"Azam Basti","English":"Azam Basti"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"chanesar_goth","label":{"Urdu":"چنیسر گوٹھ","Roman Urdu":"Chanesar Goth","English":"Chanesar Goth"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"mahmudabad","label":{"Urdu":"محمودآباد","Roman Urdu":"Mahmudabad","English":"Mahmudabad"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"pechs","label":{"Urdu":"پی۔ای۔سی۔ایچ۔ایس","Roman Urdu":"P.E.C.H.S.","English":"P.E.C.H.S."}},{"province":"sindh","city":"karachi","town":"jamshed","name":"pechs_ii","label":{"Urdu":"پی۔ای۔سی۔ایچ۔ایس 2","Roman Urdu":"P.E.C.H.S. II","English":"P.E.C.H.S. II"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"jut_line","label":{"Urdu":"جٹ لائن","Roman Urdu":"Jut Line","English":"Jut Line"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"central_jacob_lines","label":{"Urdu":"سینٹرل جیکب لائن","Roman Urdu":"Central Jacob Lines","English":"Central Jacob Lines"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"jamshed_quarters","label":{"Urdu":"جمشید کوارٹر","Roman Urdu":"Jamshed Quarters","English":"Jamshed Quarters"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"garden_east","label":{"Urdu":"گارڈن ایسٹ","Roman Urdu":"Garden East","English":"Garden East"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"soldier_bazar","label":{"Urdu":"سولجر بازار","Roman Urdu":"Soldier Bazar","English":"Soldier Bazar"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"pakistan_quarters","label":{"Urdu":"پاکستان کوارٹر","Roman Urdu":"Pakistan Quarters","English":"Pakistan Quarters"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"bhutta_village","label":{"Urdu":"بھٹا ولیج","Roman Urdu":"Bhutta Village","English":"Bhutta Village"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"sultanabad","label":{"Urdu":"سلطان آباد","Roman Urdu":"Sultanabad","English":"Sultanabad"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"kiamari_uc","label":{"Urdu":"کیماری یو- سی","Roman Urdu":"Kiamari UC","English":"Kiamari UC"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"baba_bhit","label":{"Urdu":"بابا بھٹ","Roman Urdu":"Baba Bhit","English":"Baba Bhit"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"machar_colony","label":{"Urdu":"مچھر کالونی","Roman Urdu":"Machar Colony","English":"Machar Colony"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"maripur","label":{"Urdu":"ماڑی پور","Roman Urdu":"Maripur","English":"Maripur"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"shershah","label":{"Urdu":"شیرشاہ","Roman Urdu":"SherShah","English":"SherShah"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"gabo_pat","label":{"Urdu":"گابو پٹ","Roman Urdu":"Gabo Pat","English":"Gabo Pat"}},{"province":"sindh","city":"karachi","town":"landhi","name":"muzafarabad","label":{"Urdu":"مظفرآباد","Roman Urdu":"Muzafarabad","English":"Muzafarabad"}},{"province":"sindh","city":"karachi","town":"landhi","name":"muslimabad","label":{"Urdu":"مسلم آباد","Roman Urdu":"Muslimabad","English":"Muslimabad"}},{"province":"sindh","city":"karachi","town":"landhi","name":"dawood_chowrangi","label":{"Urdu":"داوَد چورنگی","Roman Urdu":"Dawood Chowrangi","English":"Dawood Chowrangi"}},{"province":"sindh","city":"karachi","town":"landhi","name":"moinabad","label":{"Urdu":"معین آباد","Roman Urdu":"Moinabad","English":"Moinabad"}},{"province":"sindh","city":"karachi","town":"landhi","name":"sharafi_goth","label":{"Urdu":"شرافی گوٹھ","Roman Urdu":"Sharafi Goth","English":"Sharafi Goth"}},{"province":"sindh","city":"karachi","town":"landhi","name":"bhutto_nagar","label":{"Urdu":"بھٹو نگر","Roman Urdu":"Bhutto Nagar","English":"Bhutto Nagar"}},{"province":"sindh","city":"karachi","town":"landhi","name":"khawaja_ajmeer_colony","label":{"Urdu":"خواجہ اجمیر کالونی","Roman Urdu":"Khawaja Ajmeer Colony","English":"Khawaja Ajmeer Colony"}},{"province":"sindh","city":"karachi","town":"landhi","name":"landhi_uc","label":{"Urdu":"لانڈھی یوسی","Roman Urdu":"Landhi UC","English":"Landhi UC"}},{"province":"sindh","city":"karachi","town":"landhi","name":"awami_colony","label":{"Urdu":"عوامی کالونی","Roman Urdu":"Awami Colony","English":"Awami Colony"}},{"province":"sindh","city":"karachi","town":"landhi","name":"burmee_colony","label":{"Urdu":"برمی کالونی","Roman Urdu":"Burmee Colony","English":"Burmee Colony"}},{"province":"sindh","city":"karachi","town":"landhi","name":"korangi_uc","label":{"Urdu":"کورنگی یوسی","Roman Urdu":"Korangi UC","English":"Korangi UC"}},{"province":"sindh","city":"karachi","town":"landhi","name":"sherabad","label":{"Urdu":"شیرآباد","Roman Urdu":"Sherabad","English":"Sherabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"rizvia_society","label":{"Urdu":"رضویہ سوسائٹی","Roman Urdu":"Rizvia Society","English":"Rizvia Society"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"firdous_colony","label":{"Urdu":"فردوس کالونی","Roman Urdu":"Firdous Colony","English":"Firdous Colony"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"super_market","label":{"Urdu":"سپر مارکیٹ","Roman Urdu":"Super Market","English":"Super Market"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"dak_khana","label":{"Urdu":"دک کھانہ","Roman Urdu":"Dak Khana","English":"Dak Khana"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"qasimabad","label":{"Urdu":"قاسم آباد","Roman Urdu":"Qasimabad","English":"Qasimabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"bandhani_colony","label":{"Urdu":"بندھانی کالونی","Roman Urdu":"Bandhani Colony","English":"Bandhani Colony"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"sharifabad","label":{"Urdu":"شریف آباد","Roman Urdu":"Sharifabad","English":"Sharifabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"commercial_area","label":{"Urdu":"کمرشل ایریا","Roman Urdu":"Commercial Area","English":"Commercial Area"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"mujahid_colony","label":{"Urdu":"مجاہد کالونی","Roman Urdu":"Mujahid Colony","English":"Mujahid Colony"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"nazimabad","label":{"Urdu":"ناظم آباد","Roman Urdu":"Nazimabad","English":"Nazimabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"abbasi_shaheed","label":{"Urdu":"عباسی شہید","Roman Urdu":"Abbasi Shaheed","English":"Abbasi Shaheed"}},{"province":"sindh","city":"karachi","town":"lyari","name":"agra_taj_colony","label":{"Urdu":"آگرہ تاج کالونی","Roman Urdu":"Agra Taj Colony","English":"Agra Taj Colony"}},{"province":"sindh","city":"karachi","town":"lyari","name":"daryaabad","label":{"Urdu":"دریاآباد","Roman Urdu":"Daryaabad","English":"Daryaabad"}},{"province":"sindh","city":"karachi","town":"lyari","name":"nawabad","label":{"Urdu":"نواآباد","Roman Urdu":"Nawabad","English":"Nawabad"}},{"province":"sindh","city":"karachi","town":"lyari","name":"khada_memon_society","label":{"Urdu":"خدا- میمن- سوساَٹی","Roman Urdu":"Khada Memon Society","English":"Khada Memon Society"}},{"province":"sindh","city":"karachi","town":"lyari","name":"baghdadi","label":{"Urdu":"بغدادی","Roman Urdu":"Baghdadi","English":"Baghdadi"}},{"province":"sindh","city":"karachi","town":"lyari","name":"shah_baig_line","label":{"Urdu":"شاھ باغ لائن","Roman Urdu":"Shah Baig Line","English":"Shah Baig Line"}},{"province":"sindh","city":"karachi","town":"lyari","name":"bihar_colony","label":{"Urdu":"بہار کالونی","Roman Urdu":"Bihar Colony","English":"Bihar Colony"}},{"province":"sindh","city":"karachi","town":"lyari","name":"ragiwara","label":{"Urdu":"راگی واڑا","Roman Urdu":"Ragiwara","English":"Ragiwara"}},{"province":"sindh","city":"karachi","town":"lyari","name":"singo_line","label":{"Urdu":"سنگولائن","Roman Urdu":"Singo Line","English":"Singo Line"}},{"province":"sindh","city":"karachi","town":"lyari","name":"chakiwara","label":{"Urdu":"چاکی واڑا","Roman Urdu":"Chakiwara","English":"Chakiwara"}},{"province":"sindh","city":"karachi","town":"lyari","name":"allama_iqbal_colony","label":{"Urdu":"علامہ اقبال کالونی","Roman Urdu":"Allama Iqbal Colony","English":"Allama Iqbal Colony"}},{"province":"sindh","city":"karachi","town":"malir","name":"model_colony","label":{"Urdu":"موڈل کالونی","Roman Urdu":"Model Colony","English":"Model Colony"}},{"province":"sindh","city":"karachi","town":"malir","name":"kala_board","label":{"Urdu":"کالا بورڈ","Roman Urdu":"Kala Board","English":"Kala Board"}},{"province":"sindh","city":"karachi","town":"malir","name":"saudabad","label":{"Urdu":"سعودآباد","Roman Urdu":"Saudabad","English":"Saudabad"}},{"province":"sindh","city":"karachi","town":"malir","name":"khokhra_par","label":{"Urdu":"کھوکھرا پار","Roman Urdu":"Khokhra Par","English":"Khokhra Par"}},{"province":"sindh","city":"karachi","town":"malir","name":"jafar_e_tayyar","label":{"Urdu":"جعفر تیار","Roman Urdu":"Jafar-e-Tayyar","English":"Jafar-e-Tayyar"}},{"province":"sindh","city":"karachi","town":"malir","name":"gharibabad","label":{"Urdu":"غریب آباد","Roman Urdu":"Gharibabad","English":"Gharibabad"}},{"province":"sindh","city":"karachi","town":"malir","name":"ghazi_brohi_goth","label":{"Urdu":"غازی بروہی گوٹھ","Roman Urdu":"Ghazi Brohi Goth","English":"Ghazi Brohi Goth"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"kalyana","label":{"Urdu":"کالیانہ","Roman Urdu":"Kalyana","English":"Kalyana"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"sir_syed_colony","label":{"Urdu":"سر سید کالونی","Roman Urdu":"Sir Syed Colony","English":"Sir Syed Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"fatima_jinnah_colony","label":{"Urdu":"فاطمہ جناح کالونی","Roman Urdu":"Fatima Jinnah Colony","English":"Fatima Jinnah Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"godhra","label":{"Urdu":"گودھرا","Roman Urdu":"Godhra","English":"Godhra"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"abu_zar_ghaffari","label":{"Urdu":"ابو زر غفاری","Roman Urdu":"Abu Zar Ghaffari","English":"Abu Zar Ghaffari"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"hakim_ahsan","label":{"Urdu":"حاکم احسان","Roman Urdu":"Hakim Ahsan","English":"Hakim Ahsan"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"madina_colony","label":{"Urdu":"مدینہ کالونی","Roman Urdu":"Madina Colony","English":"Madina Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"faisal_colony","label":{"Urdu":"فیصل کالونی","Roman Urdu":"Faisal Colony","English":"Faisal Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"khamiso_goth","label":{"Urdu":"خمیسو گوٹھ","Roman Urdu":"Khamiso Goth","English":"Khamiso Goth"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"mustufa_colony","label":{"Urdu":"مصطفی کالونی","Roman Urdu":"Mustufa Colony","English":"Mustufa Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"khawaja_ajmeer_nagri","label":{"Urdu":"خواجہ اجمیر نگری","Roman Urdu":"Khawaja Ajmeer Nagri","English":"Khawaja Ajmeer Nagri"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"gulshan_e_saeed","label":{"Urdu":"گلشن سعید","Roman Urdu":"Gulshan-e-Saeed","English":"Gulshan-e-Saeed"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"shah_nawaz_bhutto_colony","label":{"Urdu":"شاہ نواز بھٹو کالونی","Roman Urdu":"Shah Nawaz Bhutto Colony","English":"Shah Nawaz Bhutto Colony"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"paposh_nagar","label":{"Urdu":"پاپوش نگر","Roman Urdu":"Paposh Nagar","English":"Paposh Nagar"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"pahar_ganj","label":{"Urdu":"پہاڑ گنج","Roman Urdu":"Pahar Ganj","English":"Pahar Ganj"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"khandu_goth","label":{"Urdu":"کھنڑو گوٹھ","Roman Urdu":"Khandu Goth","English":"Khandu Goth"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"hyderi","label":{"Urdu":"حیدری","Roman Urdu":"Hyderi","English":"Hyderi"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"sakhi_hassan","label":{"Urdu":"سخی حسن","Roman Urdu":"Sakhi Hassan","English":"Sakhi Hassan"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"farooq_e_azam","label":{"Urdu":"فاروق اعظم","Roman Urdu":"Farooq-e-Azam","English":"Farooq-e-Azam"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"nusrat_bhutto_colony","label":{"Urdu":"نصرت بھٹو کالونی","Roman Urdu":"Nusrat Bhutto Colony","English":"Nusrat Bhutto Colony"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"shadman_town","label":{"Urdu":"شادمان ٹاوَن","Roman Urdu":"Shadman Town","English":"Shadman Town"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"buffer_zone","label":{"Urdu":"بفرزون","Roman Urdu":"Buffer Zone","English":"Buffer Zone"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"buffer_zone_ii","label":{"Urdu":"بفرزون 2","Roman Urdu":"Buffer Zone II","English":"Buffer Zone II"}},{"province":"sindh","city":"karachi","town":"orangi","name":"mominabad","label":{"Urdu":"مومن آباد","Roman Urdu":"Mominabad","English":"Mominabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"haryana_colony","label":{"Urdu":"حریانہ کالونی","Roman Urdu":"Haryana Colony","English":"Haryana Colony"}},{"province":"sindh","city":"karachi","town":"orangi","name":"hanifabad","label":{"Urdu":"حنیف آباد","Roman Urdu":"Hanifabad","English":"Hanifabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"mohammad_nagar","label":{"Urdu":"محمد نگر","Roman Urdu":"Mohammad Nagar","English":"Mohammad Nagar"}},{"province":"sindh","city":"karachi","town":"orangi","name":"madina_colony_orangi","label":{"Urdu":"مدینہ کالونی اورنگی","Roman Urdu":"Madina Colony Orangi","English":"Madina Colony Orangi"}},{"province":"sindh","city":"karachi","town":"orangi","name":"ghaziabad","label":{"Urdu":"غازی آباد","Roman Urdu":"Ghaziabad","English":"Ghaziabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"chisti_nagar","label":{"Urdu":"چشتی نگر","Roman Urdu":"Chisti Nagar","English":"Chisti Nagar"}},{"province":"sindh","city":"karachi","town":"orangi","name":"bilal_colony_orangi","label":{"Urdu":"بلال کالونی اورنگی","Roman Urdu":"Bilal Colony Orangi","English":"Bilal Colony Orangi"}},{"province":"sindh","city":"karachi","town":"orangi","name":"iqbal_baloch_colony","label":{"Urdu":"اقبال بلوچ کالونی","Roman Urdu":"Iqbal Baloch Colony","English":"Iqbal Baloch Colony"}},{"province":"sindh","city":"karachi","town":"orangi","name":"ghabool_town","label":{"Urdu":"گبول ٹاوَن","Roman Urdu":"Ghabool Town","English":"Ghabool Town"}},{"province":"sindh","city":"karachi","town":"orangi","name":"data_nagar","label":{"Urdu":"داتا نگر","Roman Urdu":"Data Nagar","English":"Data Nagar"}},{"province":"sindh","city":"karachi","town":"orangi","name":"mujahidabad","label":{"Urdu":"مجاہد آباد","Roman Urdu":"Mujahidabad","English":"Mujahidabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"baloch_goth","label":{"Urdu":"بلوچ گوٹھ","Roman Urdu":"Baloch Goth","English":"Baloch Goth"}},{"province":"sindh","city":"karachi","town":"saddar","name":"old_haji_camp","label":{"Urdu":"پرانہ حاجی کیمپ","Roman Urdu":"Old Haji Camp","English":"Old Haji Camp"}},{"province":"sindh","city":"karachi","town":"saddar","name":"garden","label":{"Urdu":"گارڈن","Roman Urdu":"Garden","English":"Garden"}},{"province":"sindh","city":"karachi","town":"saddar","name":"kharadar","label":{"Urdu":"کھارادر","Roman Urdu":"Kharadar","English":"Kharadar"}},{"province":"sindh","city":"karachi","town":"saddar","name":"city_railway_colony","label":{"Urdu":"سٹی ریلوے کالونی","Roman Urdu":"City Railway Colony","English":"City Railway Colony"}},{"province":"sindh","city":"karachi","town":"saddar","name":"nanak_wara","label":{"Urdu":"ناناک واڑا","Roman Urdu":"Nanak Wara","English":"Nanak Wara"}},{"province":"sindh","city":"karachi","town":"saddar","name":"gazdarabad","label":{"Urdu":"گزدرآباد","Roman Urdu":"Gazdarabad","English":"Gazdarabad"}},{"province":"sindh","city":"karachi","town":"saddar","name":"millat_nagar_islam_pura","label":{"Urdu":"ملت نگر اسلام پورا","Roman Urdu":"Millat Nagar/Islam Pura","English":"Millat Nagar/Islam Pura"}},{"province":"sindh","city":"karachi","town":"saddar","name":"saddar_uc","label":{"Urdu":"صدر یو سی","Roman Urdu":"Saddar UC","English":"Saddar UC"}},{"province":"sindh","city":"karachi","town":"saddar","name":"civil_line","label":{"Urdu":"سول لائن","Roman Urdu":"Civil Line","English":"Civil Line"}},{"province":"sindh","city":"karachi","town":"saddar","name":"clifton","label":{"Urdu":"کلفٹن","Roman Urdu":"Clifton","English":"Clifton"}},{"province":"sindh","city":"karachi","town":"saddar","name":"kehkashan","label":{"Urdu":"کہکشان","Roman Urdu":"Kehkashan","English":"Kehkashan"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"natha_khan_goth","label":{"Urdu":"ناتھا خان گوٹھ","Roman Urdu":"Natha Khan Goth","English":"Natha Khan Goth"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"pak_sadat_colony","label":{"Urdu":"پاک صدر کالونی","Roman Urdu":"Pak Sadat Colony","English":"Pak Sadat Colony"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"drigh_colony","label":{"Urdu":"ڈرگ کالونی","Roman Urdu":"Drigh Colony","English":"Drigh Colony"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"raita_plot","label":{"Urdu":"رائتا پلاٹ","Roman Urdu":"Raita Plot","English":"Raita Plot"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"moria_khan_goth","label":{"Urdu":"موریا خان گوٹھ","Roman Urdu":"Moria Khan Goth","English":"Moria Khan Goth"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"rafa_e_aam_society","label":{"Urdu":"رفا عام سوسا ئٹی","Roman Urdu":"Rafa-e-Aam Society","English":"Rafa-e-Aam Society"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"al_falah_society","label":{"Urdu":"الفلاح سوسا ئٹی","Roman Urdu":"Al-Falah Society","English":"Al-Falah Society"}},{"province":"sindh","city":"karachi","town":"site","name":"pak_colony","label":{"Urdu":"پاک کالونی","Roman Urdu":"Pak Colony","English":"Pak Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"old_golimar","label":{"Urdu":"پرانہ گولی مار","Roman Urdu":"Old Golimar","English":"Old Golimar"}},{"province":"sindh","city":"karachi","town":"site","name":"jahanabad","label":{"Urdu":"جہان آباد","Roman Urdu":"Jahanabad","English":"Jahanabad"}},{"province":"sindh","city":"karachi","town":"site","name":"metrovil","label":{"Urdu":"میٹروویل","Roman Urdu":"Metrovil","English":"Metrovil"}},{"province":"sindh","city":"karachi","town":"site","name":"bhawani_chali","label":{"Urdu":"بہوانی چالی","Roman Urdu":"Bhawani Chali","English":"Bhawani Chali"}},{"province":"sindh","city":"karachi","town":"site","name":"frontier_colony","label":{"Urdu":"فرونٹر کالونی","Roman Urdu":"Frontier Colony","English":"Frontier Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"banaras_colony","label":{"Urdu":"بنارس کالونی","Roman Urdu":"Banaras Colony","English":"Banaras Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"qasba_colony","label":{"Urdu":"قصبہ کالونی","Roman Urdu":"Qasba Colony","English":"Qasba Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"islamia_colony","label":{"Urdu":"اسلامیہ کالونی","Roman Urdu":"Islamia Colony","English":"Islamia Colony"}},{"province":"na","city":"na","town":"na","name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}},{"province":"na","city":"na","town":"na","name":"not_applicable","label":{"Urdu":"قابل اطلاق نہیں","Roman Urdu":"Qaabil-e-atlaaq nahi","English":"Not Applicable"}}],"gender":[{"instance":{"openmrs_code":"1534AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"male","label":{"Urdu":"مرد/ لڑکا","Roman Urdu":"Mard/larka","English":"Male"}},{"instance":{"openmrs_code":"1535AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"female","label":{"Urdu":"عورت/لڑکی","Roman Urdu":"Aurat/larki","English":"Female"}},{"instance":{"openmrs_code":"163163AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"transgender","label":{"Urdu":"خواجہ سرہ","Roman Urdu":"Khwaja sira","English":"Transgender"}}],"vaccines":[{"instance":{"openmrs_code":"1570AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"bcg","label":{"Urdu":"بی سی جی","Roman Urdu":"BCG","English":"BCG"}},{"instance":{"openmrs_code":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv0","label":{"Urdu":"او پی وی 0","Roman Urdu":"OPV 0","English":"OPV 0"}},{"instance":{"openmrs_code":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pcv1","label":{"Urdu":"پی سی وی 1","Roman Urdu":"PCV 1","English":"PCV 1"}},{"instance":{"openmrs_code":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv1","label":{"Urdu":"او پی وی 1","Roman Urdu":"OPV 1","English":"OPV 1"}},{"instance":{"openmrs_code":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"penta1","label":{"Urdu":"پینٹا ویلنٹ 1","Roman Urdu":"Pentavalent 1","English":"Pentavalent 1"}},{"instance":{"openmrs_code":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pcv2","label":{"Urdu":"پی سی وی 2","Roman Urdu":"PCV 2","English":"PCV 2"}},{"instance":{"openmrs_code":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv2","label":{"Urdu":"او پی وی 2","Roman Urdu":"OPV 2","English":"OPV 2"}},{"instance":{"openmrs_code":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"penta2","label":{"Urdu":"پینٹا ویلنٹ 2","Roman Urdu":"Pentavalent 2","English":"Pentavalent 2"}},{"instance":{"openmrs_code":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pcv3","label":{"Urdu":"پی سی وی 3","Roman Urdu":"PCV 3","English":"PCV 3"}},{"instance":{"openmrs_code":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv3","label":{"Urdu":"او پی وی 3","Roman Urdu":"OPV 3","English":"OPV 3"}},{"instance":{"openmrs_code":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"penta3","label":{"Urdu":"پینٹا ویلنٹ 3","Roman Urdu":"Pentavalent 3","English":"Pentavalent 3"}},{"instance":{"openmrs_code":"82242AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"ipv","label":{"Urdu":"آئی پی وی","Roman Urdu":"IPV","English":"IPV"}},{"instance":{"openmrs_code":"79409AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"measles1","label":{"Urdu":"خسرہ 1","Roman Urdu":"Khasra 1","English":"Measles 1"}},{"instance":{"openmrs_code":"79409AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"measles2","label":{"Urdu":"خسرہ 2","Roman Urdu":"Khasra 2","English":"Measles 2"}}],"towns":[{"province":"sindh","city":"karachi","name":"korangi","label":{"Urdu":"کورنگی","Roman Urdu":"Korangi","English":"Korangi"}},{"province":"sindh","city":"karachi","name":"landhi","label":{"Urdu":"لانڈھی","Roman Urdu":"Landhi","English":"Landhi"}},{"province":"sindh","city":"karachi","name":"baldia","label":{"Urdu":"بلدیہ","Roman Urdu":"Baldia","English":"Baldia"}},{"province":"sindh","city":"karachi","name":"bin_qasim","label":{"Urdu":"بن قاسم","Roman Urdu":"Bin Qasim","English":"Bin Qasim"}},{"province":"sindh","city":"karachi","name":"gadap","label":{"Urdu":"گڈاپ","Roman Urdu":"Gadap","English":"Gadap"}},{"province":"sindh","city":"karachi","name":"gulberg","label":{"Urdu":"گلبرگ","Roman Urdu":"Gulberg","English":"Gulberg"}},{"province":"sindh","city":"karachi","name":"gulshan","label":{"Urdu":"گلشن","Roman Urdu":"Gulshan","English":"Gulshan"}},{"province":"sindh","city":"karachi","name":"jamshed","label":{"Urdu":"جمشید","Roman Urdu":"Jamshed","English":"Jamshed"}},{"province":"sindh","city":"karachi","name":"kiamari","label":{"Urdu":"کیماری","Roman Urdu":"Kiamari","English":"Kiamari"}},{"province":"sindh","city":"karachi","name":"liaquatabad","label":{"Urdu":"لیاقت آباد","Roman Urdu":"Liaquatabad","English":"Liaquatabad"}},{"province":"sindh","city":"karachi","name":"lyari","label":{"Urdu":"لیاری","Roman Urdu":"Lyari","English":"Lyari"}},{"province":"sindh","city":"karachi","name":"malir","label":{"Urdu":"ملیر","Roman Urdu":"Malir","English":"Malir"}},{"province":"sindh","city":"karachi","name":"new_karachi","label":{"Urdu":"نیو کراچی","Roman Urdu":"New Karachi","English":"New Karachi"}},{"province":"sindh","city":"karachi","name":"north_nazimabad","label":{"Urdu":"نارتھ ناظم آباد","Roman Urdu":"North Nazimabad","English":"North Nazimabad"}},{"province":"sindh","city":"karachi","name":"orangi","label":{"Urdu":"اورنگی","Roman Urdu":"Orangi","English":"Orangi"}},{"province":"sindh","city":"karachi","name":"saddar","label":{"Urdu":"صدر","Roman Urdu":"Saddar","English":"Saddar"}},{"province":"sindh","city":"karachi","name":"shah_faisal","label":{"Urdu":"شاہ فیصل","Roman Urdu":"Shah Faisal","English":"Shah Faisal"}},{"province":"sindh","city":"karachi","name":"site","label":{"Urdu":"سائٹ","Roman Urdu":"S.I.T.E.","English":"S.I.T.E."}},{"province":"na","city":"na","name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}},{"province":"na","city":"na","name":"not_applicable","label":{"Urdu":"قابل اطلاق نہیں","Roman Urdu":"Qaabil-e-atlaaq nahi","English":"Not Applicable"}}],"cities":[{"province":"sindh","name":"karachi","label":{"Urdu":"کراچی","Roman Urdu":"Karachi","English":"Karachi"}},{"province":"punjab","name":"hafizabad","label":{"Urdu":"حافظ آباد","Roman Urdu":"Hafizabad","English":"Hafizabad"}},{"province":"punjab","name":"muzaffargarh","label":{"Urdu":"مظفر گڑھ","Roman Urdu":"Muzaffargarh","English":"Muzaffargarh"}},{"province":"na","name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}},{"province":"na","name":"not_applicable","label":{"Urdu":"قابل اطلاق نہیں","Roman Urdu":"Not Applicable","English":"Not Applicable"}}],"ethnicity":[{"instance":{"openmrs_code":"163215AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"punjabi","label":{"Urdu":"پنجابی","Roman Urdu":"Punjabi","English":"Punjabi"}},{"instance":{"openmrs_code":"163216AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pushtuns","label":{"Urdu":"پشتون","Roman Urdu":"Pushtun","English":"Pushtun"}},{"instance":{"openmrs_code":"163217AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"sindhi","label":{"Urdu":"سندھی","Roman Urdu":"Sindhi","English":"Sindhi"}},{"instance":{"openmrs_code":"163218AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"saraiki","label":{"Urdu":"سرائیکی","Roman Urdu":"Saraiki","English":"Saraiki"}},{"instance":{"openmrs_code":"163219AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"muhajir","label":{"Urdu":"مہاجر","Roman Urdu":"Muhajir","English":"Muhajir"}},{"instance":{"openmrs_code":"163220AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"balochi","label":{"Urdu":"بلوچی","Roman Urdu":"Balochi","English":"Balochi"}},{"instance":{"openmrs_code":"5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}}],"yes_no":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}]},"instance":{"encounter_type":"Child Vaccination Enrollment"},"version":"201604080617","id_string":"child_vaccination_enrollment","type":"survey","children":[{"type":"hidden","name":"provider_uc"},{"type":"hidden","name":"provider_town"},{"type":"hidden","name":"provider_city"},{"type":"hidden","name":"provider_province"},{"type":"hidden","name":"provider_id"},{"instance":{"openmrs_entity_id":"location_id","openmrs_entity":"encounter"},"type":"hidden","name":"provider_location_id"},{"instance":{"openmrs_entity_id":"Program Client ID","openmrs_entity":"person_identifier"},"type":"hidden","name":"existing_program_client_id"},{"type":"hidden","name":"provider_location_name"},{"type":"note","name":"provider_location_note","label":{"Urdu":"شہر: ${provider_city} ; ٹائون: ${provider_town} ; یوسی: ${provider_uc} ; سینٹرکا نام: ${provider_location_name}","English":"City: ${provider_city} ; Town: ${provider_town} ; UC: ${provider_uc} ; Center Name: ${provider_location_name}","Roman Urdu":"Shehr: ${provider_city} ; Town: ${provider_town} ; UC: ${provider_uc} ; Center ka naam: ${provider_location_name}"}},{"instance":{"openmrs_entity_id":"163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"start","name":"start"},{"instance":{"openmrs_entity_id":"163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"end","name":"end"},{"instance":{"openmrs_entity_id":"163286AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"today","name":"today"},{"instance":{"openmrs_entity_id":"163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"deviceid","name":"deviceid"},{"instance":{"openmrs_entity_id":"163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"subscriberid","name":"subscriberid"},{"instance":{"openmrs_entity_id":"163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"simserial","name":"simserial"},{"instance":{"openmrs_entity_id":"163152AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"phonenumber","name":"phonenumber"},{"name":"client_reg_date","hint":{"Urdu":"بچے کو ویکسین لگنے کی تاریخ","English":"Date on which child was vaccinated","Roman Urdu":"Bachay ko vaccine lagnay ki tareekh"},"bind":{"jr:constraintMsg":{"Urdu":"بچے کی پروگرام میں اندراج کی تاریخ مستقبل کی نہیں ہوسکتی","English":"Child registration date cannot be in the future","Roman Urdu":"Bachay ki program mai andraaj ki tareekh mustaqbil ki nahi hosakti"},"required":"yes","constraint":".<=${today}"},"label":{"Urdu":"بچے کی پروگرام میں اندراج کی تاریخ","English":"Child Registration date","Roman Urdu":"Bachay ki Program mai andraj ki tareekh"},"instance":{"openmrs_entity_id":"encounter_date","openmrs_entity":"encounter"},"type":"date"},{"bind":{"required":"yes"},"type":"note","name":"program_client_id","label":{"Urdu":"کلائنٹ کی پروگرام آئی ڈی {existing_program_client_id}$","Roman Urdu":"Client ki program ID ${existing_program_client_id}","English":"Program Client ID ${existing_program_client_id}"}},{"bind":{"jr:constraintMsg":{"Urdu":"نمبر آٹھ ہندسوں پر مشتمل ہونا چاہئے","English":"Number should be 8 digits","Roman Urdu":"Number 8 hindason par mushtamil hona chahiye"},"required":"yes","constraint":"string-length(.) = 8"},"type":"integer","instance":{"openmrs_entity_id":"EPI Card Number","openmrs_entity":"person_attribute"},"name":"epi_card_number","label":{"Urdu":"کارڈ نمبر","English":"EPI Card Number","Roman Urdu":"EPI Card Number"}},{"bind":{"jr:constraintMsg":{"Urdu":"نام تین سے پچیس حروف پر مشتمل ہونا چاہئے","English":"Name should be 3 to 25 characters long","Roman Urdu":"Naam 3 say 25 huroof par mushtamil hona chahiye"},"required":"yes","constraint":"regex(., '^[a-zA-Z\\s\\.\\-]{3,25}$')"},"type":"text","instance":{"openmrs_entity_id":"first_name","openmrs_entity":"person"},"name":"first_name","label":{"Urdu":"نام","English":"First Name","Roman Urdu":"Naam"}},{"bind":{"jr:constraintMsg":{"Urdu":"نام تین سے پچیس حروف پر مشتمل ہونا چاہئے","English":"Name should be 3 to 25 characters long","Roman Urdu":"Naam 3 say 25 huroof par mushtamil hona chahiye"},"required":"yes","constraint":"regex(., '^[a-zA-Z\\s\\.\\-]{3,25}$')"},"type":"text","instance":{"openmrs_entity_id":"last_name","openmrs_entity":"person"},"name":"last_name","label":{"Urdu":"والد کا نام","English":"Last name","Roman Urdu":"Waalid ka naam"}},{"default":"yes","label":{"Urdu":"کیا تاریخ پیدائش معلوم ہے؟","Roman Urdu":"Kya tareekh-e-pedaaish maloom hai?","English":"Is birthdate known?"},"type":"select one","children":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}],"name":"member_birth_date_known"},{"bind":{"jr:constraintMsg":{"Urdu":"یہ تاریخ مستقبل کی نہیں ہو سکتی۔\nاندراج کے لیے بچے کی عمر پانچ سال سے کم ہونی چاہئے۔","Roman Urdu":"Ye tareekh mustaqbil ki nahi ho sakti.\nAndraaj ke liye bachay ki umar paanch saal se kam honi chahiye.","English":"This cannot be a date in the future.\nChild's age must be less than five years for enrollment."},"relevant":"selected(${member_birth_date_known}, 'yes')","constraint":".<=${today} and (int((${today} - ${member_birth_date}) div 365) < 5)"},"type":"date","name":"member_birth_date","label":{"Urdu":"تاریخ پیدائش","Roman Urdu":"Tareekh-e-pedaaish","English":"Birth date"}},{"bind":{"jr:constraintMsg":{"Urdu":"اندراج کے لیے بچے کی عمر پانچ سال سے کم ہونی چاہئے","Roman Urdu":"Andraaj ke liye bachay ki umar paanch saal se kam honi chahiye","English":"Child's age must be less than five years for enrollment"},"relevant":"selected(${member_birth_date_known}, 'no')","constraint":".<=60"},"type":"integer","name":"age","label":{"Urdu":"عمر (مہینوں میں)","Roman Urdu":"Umar (mahinon main)","English":"Age (months)"}},{"bind":{"calculate":"int((${today} - ${member_birth_date}) div 30.44)"},"type":"calculate","name":"calc_age"},{"bind":{"calculate":"date(${today} - int(${age} * 30.44))"},"type":"calculate","name":"calc_dob"},{"bind":{"calculate":"if(${member_birth_date_known}='yes', ${member_birth_date}, ${calc_dob})"},"type":"calculate","name":"calc_dob_confirm","instance":{"openmrs_entity_id":"birthdate","openmrs_entity":"person"}},{"bind":{"calculate":"if(${member_birth_date_known} = 'yes', '0', '1')"},"type":"calculate","name":"calc_dob_estimated","instance":{"openmrs_entity_id":"birthdate_estimated","openmrs_entity":"person"}},{"bind":{"calculate":"if(${member_birth_date_known}='yes', ${calc_age}, ${age})"},"type":"calculate","name":"calc_age_confirm","instance":{"openmrs_entity_id":"154384AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"}},{"type":"note","name":"member_birth_date_note","label":{"Urdu":"کلائنٹ کی تاریخ پیدائش:${calc_dob_confirm}","English":"Member Date of Birth: ${calc_dob_confirm}","Roman Urdu":"Member ki Tareekh-e-pedaaish: ${calc_dob_confirm}"}},{"type":"note","name":"note_age","label":{"Urdu":"عمر :{calc_age_confirm}$ مہینے","English":"Age: ${calc_age_confirm} months","Roman Urdu":"Umar: ${calc_age_confirm} mahinay"}},{"control":{"appearance":"minimal"},"name":"gender","bind":{"required":"yes"},"label":{"Urdu":"جنس","English":"Gender","Roman Urdu":"Jins"},"instance":{"openmrs_entity_id":"gender","openmrs_entity":"person"},"type":"select one","children":[{"instance":{"openmrs_code":"1534AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"male","label":{"Urdu":"مرد/ لڑکا","Roman Urdu":"Mard/larka","English":"Male"}},{"instance":{"openmrs_code":"1535AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"female","label":{"Urdu":"عورت/لڑکی","Roman Urdu":"Aurat/larki","English":"Female"}},{"instance":{"openmrs_code":"163163AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"transgender","label":{"Urdu":"خواجہ سرہ","Roman Urdu":"Khwaja sira","English":"Transgender"}}]},{"bind":{"jr:constraintMsg":{"Urdu":"نام تین سے پچیس حروف پر مشتمل ہونا چاہئے","English":"Name should be 3 to 25 characters long","Roman Urdu":"Naam 3 say 25 huroof par mushtamil hona chahiye"},"constraint":"regex(., '^[a-zA-Z\\s\\.\\-]{3,25}$')"},"type":"text","instance":{"openmrs_entity_id":"1593AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"name":"mother_name","label":{"Urdu":"والدہ کا نام","English":"Mother's Name","Roman Urdu":"Waaldah ka naam"}},{"control":{"appearance":"minimal"},"name":"ethnicity","bind":{"required":"yes"},"label":{"Urdu":"قومیت","English":"Ethnicity","Roman Urdu":"Qomiat"},"instance":{"openmrs_entity_id":"163153AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"select one","children":[{"instance":{"openmrs_code":"163215AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"punjabi","label":{"Urdu":"پنجابی","Roman Urdu":"Punjabi","English":"Punjabi"}},{"instance":{"openmrs_code":"163216AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pushtuns","label":{"Urdu":"پشتون","Roman Urdu":"Pushtun","English":"Pushtun"}},{"instance":{"openmrs_code":"163217AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"sindhi","label":{"Urdu":"سندھی","Roman Urdu":"Sindhi","English":"Sindhi"}},{"instance":{"openmrs_code":"163218AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"saraiki","label":{"Urdu":"سرائیکی","Roman Urdu":"Saraiki","English":"Saraiki"}},{"instance":{"openmrs_code":"163219AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"muhajir","label":{"Urdu":"مہاجر","Roman Urdu":"Muhajir","English":"Muhajir"}},{"instance":{"openmrs_code":"163220AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"balochi","label":{"Urdu":"بلوچی","Roman Urdu":"Balochi","English":"Balochi"}},{"instance":{"openmrs_code":"5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}}]},{"bind":{"relevant":"selected(${ethnicity}, 'other')"},"type":"text","instance":{"openmrs_entity":"concept","openmrs_entity_id":"160632AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"163330AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"ethnicity_other","label":{"Urdu":"وضاحت کریں","Roman Urdu":"Wazaahat karain","English":"Please specify:"}},{"control":{"appearance":"minimal"},"name":"province","default":"${provider_province}","bind":{"required":"yes"},"label":{"Urdu":"صوبہ","Roman Urdu":"Suba","English":"Province"},"instance":{"openmrs_entity":"person_address","openmrs_entity_id":"stateProvince","openmrs_entity_parent":"usual_residence"},"type":"select one","children":[{"name":"kpk","label":{"Urdu":"خیبر پختون خواہ","English":"Khyber Pakhtunkhwa","Roman Urdu":"Khyber Pakhtunkhwa"}},{"name":"sindh","label":{"Urdu":"سندھ","English":"Sindh","Roman Urdu":"Sindh"}},{"name":"balochistan","label":{"Urdu":"بلوچستان","English":"Balochistan","Roman Urdu":"Balochistan"}},{"name":"punjab","label":{"Urdu":"پنجاب","English":"Punjab","Roman Urdu":"Punjab"}},{"name":"gilgit_baltistan","label":{"Urdu":"گلگت بلتستان","English":"Gilgit Baltistan","Roman Urdu":"Gilgit Baltistan"}},{"name":"kashmir","label":{"Urdu":"کشمیر","English":"Kashmir","Roman Urdu":"Kashmir"}},{"name":"fata","label":{"Urdu":"فاٹا","English":"FATA","Roman Urdu":"FATA"}},{"name":"out_of_country","label":{"Urdu":"ملک سے باہر","English":"Out of Country","Roman Urdu":"Mulk se baahir"}}]},{"control":{"appearance":"minimal"},"name":"city_village","choice_filter":"province=${province} or province='na'","default":"${provider_city}","bind":{"required":"yes"},"label":{"Urdu":"شہر","Roman Urdu":"Shehr","English":"City"},"itemset":"cities","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"cityVillage","openmrs_entity_parent":"usual_residence"},"type":"select one"},{"control":{"appearance":"minimal"},"name":"town","choice_filter":"(province=${province} and city=${city_village} ) or city='na'","bind":{"required":"yes"},"label":{"Urdu":"ٹاٰئون/ قصبہ/ بستی","Roman Urdu":"Town / Qasbah / Basti","English":"Town"},"itemset":"towns","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"town","openmrs_entity_parent":"usual_residence"},"type":"select one"},{"control":{"appearance":"minimal"},"name":"union_council","choice_filter":"(province=${province} and city=${city_village} and town=${town}) or town='na'","bind":{"required":"yes"},"label":{"Urdu":"یونین کونسل","Roman Urdu":"Union Council","English":"Union Council"},"itemset":"ucs","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"subTown","openmrs_entity_parent":"usual_residence"},"type":"select one"},{"bind":{"required":"yes"},"type":"text","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"house","openmrs_entity_parent":"usual_residence"},"name":"house_number","label":{"Urdu":"گھر کا نمبر","Roman Urdu":"Ghar ka number","English":"House Number"}},{"bind":{"required":"yes"},"type":"text","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"street","openmrs_entity_parent":"usual_residence"},"name":"street","label":{"Urdu":"گلی/کالونی/محلہ","Roman Urdu":"Gali/Colony/Mohalla","English":"Street"}},{"bind":{"required":"yes"},"type":"text","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"landmark","openmrs_entity_parent":"usual_residence"},"name":"landmark","label":{"Urdu":"گھر کے قریب کوئی مشہور جگہ","Roman Urdu":"Ghar ke qareeb koi mashoor jagah","English":"Land Mark"}},{"bind":{"calculate":"jr:choice-name(${province}, '${province}')"},"type":"calculate","name":"provincename"},{"bind":{"calculate":"jr:choice-name(${city_village}, '${city_village}')"},"type":"calculate","name":"city_villagename"},{"bind":{"calculate":"jr:choice-name(${town}, '${town}')"},"type":"calculate","name":"townname"},{"bind":{"calculate":"jr:choice-name(${union_council}, '${union_council}')"},"type":"calculate","name":"union_councilname"},{"type":"note","name":"address","label":{"Urdu":"پتہ: ${house_number}, ${street}, ${landmark}, ${union_councilname}, ${townname}, ${city_villagename}, ${provincename}","English":"Address: ${house_number}, ${street}, ${landmark}, ${union_councilname}, ${townname}, ${city_villagename}, ${provincename}","Roman Urdu":"Pata: ${house_number}, ${street}, ${landmark}, ${union_councilname}, ${townname}, ${city_villagename}, ${provincename}"}},{"instance":{"openmrs_entity_id":"163277AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"geopoint","name":"centre_gps","label":{"Urdu":"حاصل کردہ معلومات کی جگہ کے GPS کارڈینیٹس درج کریں","English":"Collect GPS coordinates of data entry location","Roman Urdu":"Hasil karda malomaat ki jaga ke GPS coordinates darj karain"}},{"control":{"appearance":"minimal"},"name":"child_was_suffering_from_a_disease_at_birth","bind":{"required":"yes"},"label":{"Urdu":"کیا بچہ پیدائش کے وقت کسی مرض میں مبتلا تھا؟","English":"Was the child suffering from a disease at birth?","Roman Urdu":"Kya bacha pedaaish ke waqt kissi marz mai mubtila tha?"},"instance":{"openmrs_entity_id":"159926AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"select one","children":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}]},{"name":"reminders_approval","bind":{"required":"yes"},"label":{"Urdu":"کیا آپ اپنے بچے کی اگلی ویکسین کی تاریخ کے لیے SMS موصول کرنا چاہتے ہیں؟","English":"Are you willing to receive SMS reminders for your next visit?","Roman Urdu":"Kya aap apnay bachay ki agli vaccine ki tareekh ke liye SMS mausool karna chahtay hain?"},"instance":{"openmrs_entity_id":"163089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"select one","children":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}]},{"bind":{"jr:constraintMsg":{"Urdu":"فون نمبر گیارہ ہندسوں پر مشتمل اور مندرجہ ذیل شکل میں ہونا چاہئے: *********03","English":"Phone number should be 11 digits in the following format: 03*********","Roman Urdu":"Phone number 11 hindason par mushtamil aur mundarja zail shakal main hona chahiey: 03*********"},"relevant":"${reminders_approval}='yes'","constraint":"regex(., '^03[0-9]{9}$')"},"type":"text","instance":{"openmrs_entity_id":"159635AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"name":"contact_phone_number","label":{"Urdu":"موبائل نمبر:","English":"Mobile Number:","Roman Urdu":"Mobile number:"}},{"bind":{"calculate":"${calc_dob_confirm} + 42"},"type":"calculate","name":"six_weeks"},{"bind":{"calculate":"${calc_dob_confirm} + 70"},"type":"calculate","name":"ten_weeks"},{"bind":{"calculate":"${calc_dob_confirm} + 98"},"type":"calculate","name":"forteen_weeks"},{"bind":{"calculate":"${calc_dob_confirm} + 245"},"type":"calculate","name":"nine_months"},{"bind":{"calculate":"${calc_dob_confirm} + 458"},"type":"calculate","name":"fifteen_months"},{"control":{"appearance":"minimal"},"name":"vaccines","label":{"Urdu":"پچھلی تاریخ جب کسی اور سینٹر پر ٹیکے لگواِے گیے یا قطرے پلائے گئے","Roman Urdu":"Pichli tareekh jab kissi aur center par teekay lagwaye gaye ya katray pilaey gaye","English":"Retro vaccines"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"984AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1421AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"select all that apply","children":[{"instance":{"openmrs_code":"1570AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"bcg","label":{"Urdu":"بی سی جی","Roman Urdu":"BCG","English":"BCG"}},{"instance":{"openmrs_code":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv0","label":{"Urdu":"او پی وی 0","Roman Urdu":"OPV 0","English":"OPV 0"}},{"instance":{"openmrs_code":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pcv1","label":{"Urdu":"پی سی وی 1","Roman Urdu":"PCV 1","English":"PCV 1"}},{"instance":{"openmrs_code":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv1","label":{"Urdu":"او پی وی 1","Roman Urdu":"OPV 1","English":"OPV 1"}},{"instance":{"openmrs_code":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"penta1","label":{"Urdu":"پینٹا ویلنٹ 1","Roman Urdu":"Pentavalent 1","English":"Pentavalent 1"}},{"instance":{"openmrs_code":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pcv2","label":{"Urdu":"پی سی وی 2","Roman Urdu":"PCV 2","English":"PCV 2"}},{"instance":{"openmrs_code":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv2","label":{"Urdu":"او پی وی 2","Roman Urdu":"OPV 2","English":"OPV 2"}},{"instance":{"openmrs_code":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"penta2","label":{"Urdu":"پینٹا ویلنٹ 2","Roman Urdu":"Pentavalent 2","English":"Pentavalent 2"}},{"instance":{"openmrs_code":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pcv3","label":{"Urdu":"پی سی وی 3","Roman Urdu":"PCV 3","English":"PCV 3"}},{"instance":{"openmrs_code":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv3","label":{"Urdu":"او پی وی 3","Roman Urdu":"OPV 3","English":"OPV 3"}},{"instance":{"openmrs_code":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"penta3","label":{"Urdu":"پینٹا ویلنٹ 3","Roman Urdu":"Pentavalent 3","English":"Pentavalent 3"}},{"instance":{"openmrs_code":"82242AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"ipv","label":{"Urdu":"آئی پی وی","Roman Urdu":"IPV","English":"IPV"}},{"instance":{"openmrs_code":"79409AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"measles1","label":{"Urdu":"خسرہ 1","Roman Urdu":"Khasra 1","English":"Measles 1"}},{"instance":{"openmrs_code":"79409AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"measles2","label":{"Urdu":"خسرہ 2","Roman Urdu":"Khasra 2","English":"Measles 2"}}]},{"bind":{"relevant":"${vaccines} != ''"},"type":"group","children":[{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'bcg')","constraint":".>= ${calc_dob_confirm} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"bcg_retro","label":{"Urdu":"بی سی جی","Roman Urdu":"BCG","English":"BCG"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'opv0')","constraint":".>= ${calc_dob_confirm} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv0_retro","label":{"Urdu":"او پی وی 0","Roman Urdu":"OPV 0","English":"OPV 0"}},{"bind":{"relevant":"selected(${vaccines}, 'opv0')","calculate":"0"},"type":"calculate","name":"opv0_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'pcv1')","constraint":".>= ${calc_dob_confirm} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pcv1_retro","label":{"Urdu":"پی سی وی 1","Roman Urdu":"PCV1","English":"PCV1"}},{"bind":{"relevant":"selected(${vaccines}, 'pcv1')","calculate":"1"},"type":"calculate","name":"pcv1_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'opv1')","constraint":".>= ${calc_dob_confirm} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv1_retro","label":{"Urdu":"او پی وی1","Roman Urdu":"OPV 1","English":"OPV 1"}},{"bind":{"relevant":"selected(${vaccines}, 'opv1')","calculate":"1"},"type":"calculate","name":"opv1_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'penta1')","constraint":".>= ${calc_dob_confirm} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"penta1_retro","label":{"Urdu":"پینٹا ویلنٹ 1","Roman Urdu":"Pentavalent 1","English":"Pentavalent 1"}},{"bind":{"relevant":"selected(${vaccines}, 'penta1')","calculate":"1"},"type":"calculate","name":"penta1_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'pcv2')","constraint":".>= ${calc_dob_confirm} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pcv2_retro","label":{"Urdu":"پی سی وی 2","Roman Urdu":"PCV2","English":"PCV2"}},{"bind":{"relevant":"selected(${vaccines}, 'pcv2')","calculate":"2"},"type":"calculate","name":"pcv2_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'opv2')","constraint":".>= ${calc_dob_confirm} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv2_retro","label":{"Urdu":"او پی وی 2","Roman Urdu":"OPV 2","English":"OPV 2"}},{"bind":{"relevant":"selected(${vaccines}, 'opv2')","calculate":"2"},"type":"calculate","name":"opv2_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'penta2')","constraint":".>= ${calc_dob_confirm} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"penta2_retro","label":{"Urdu":"پینٹا ویلنٹ 2","Roman Urdu":"Pentavalent 2","English":"Pentavalent 2"}},{"bind":{"relevant":"selected(${vaccines}, 'penta2')","calculate":"2"},"type":"calculate","name":"penta2_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'pcv3')","constraint":".>= ${calc_dob_confirm} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pcv3_retro","label":{"Urdu":"پی سی وی 3","Roman Urdu":"PCV3","English":"PCV3"}},{"bind":{"relevant":"selected(${vaccines}, 'pcv3')","calculate":"3"},"type":"calculate","name":"pcv3_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'opv3')","constraint":".>= ${calc_dob_confirm} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv3_retro","label":{"Urdu":"او پی وی3","Roman Urdu":"OPV 3","English":"OPV 3"}},{"bind":{"relevant":"selected(${vaccines}, 'opv3')","calculate":"3"},"type":"calculate","name":"opv3_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'penta3')","constraint":".>= ${calc_dob_confirm} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"penta3_retro","label":{"Urdu":"پینٹا ویلنٹ 3","Roman Urdu":"Pentavalent 3","English":"Pentavalent 3"}},{"bind":{"relevant":"selected(${vaccines}, 'penta3')","calculate":"3"},"type":"calculate","name":"penta3_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'ipv')","constraint":".>= ${calc_dob_confirm} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1422AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"ipv_retro","label":{"Urdu":"آئی پی وی","Roman Urdu":"IPV","English":"IPV"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'measles1')","constraint":".>= ${calc_dob_confirm} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"measles1_retro","label":{"Urdu":"خسرہ 1","Roman Urdu":"Measles 1","English":"Measles 1"}},{"bind":{"relevant":"selected(${vaccines}, 'measles1')","calculate":"1"},"type":"calculate","name":"measles1_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'measles2')","constraint":".>= ${calc_dob_confirm} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"measles2_retro","label":{"Urdu":"خسرہ 2","Roman Urdu":"Measles2","English":"Measles2"}},{"bind":{"relevant":"selected(${vaccines}, 'measles2')","calculate":"2"},"type":"calculate","name":"measles2_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}}],"name":"vaccines_group"},{"name":"vaccines_2","choice_filter":"name = if(selected(${vaccines}, 'bcg'), '', 'bcg') or \nname = if(selected(${vaccines}, 'opv0'), '', 'opv0') or \nname = if(selected(${vaccines}, 'penta1'), '', 'penta1') or \nname = if(selected(${vaccines}, 'opv1'), '', 'opv1') or \nname = if(selected(${vaccines}, 'pcv1'), '', 'pcv1') or \nname = if(selected(${vaccines}, 'penta2'), '', 'penta2') or \nname = if(selected(${vaccines}, 'opv2'), '', 'opv2') or \nname = if(selected(${vaccines}, 'pcv2'), '', 'pcv2') or \nname = if(selected(${vaccines}, 'penta3'), '', 'penta3') or \nname = if(selected(${vaccines}, 'pcv3'), '', 'pcv3') or \nname = if(selected(${vaccines}, 'opv3'), '', 'opv3') or \nname = if(selected(${vaccines}, 'ipv'), '', 'ipv') or \nname = if(selected(${vaccines}, 'measles1'), '', 'measles1') or \nname = if(selected(${vaccines}, 'measles2'), '', 'measles2')","bind":{"required":"yes"},"label":{"Urdu":"آج کون کون سی ویکسین دی گئی ہیں؟","Roman Urdu":"Aaj kon kon si vaccine di gai hain?","English":"Vaccines administered today"},"itemset":"vaccines","instance":{"openmrs_entity":"concept","openmrs_entity_id":"984AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1441AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"select all that apply"},{"bind":{"calculate":"if(selected(${vaccines_2}, 'bcg'),${client_reg_date},'')"},"type":"calculate","name":"bcg","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'opv0'),${client_reg_date},'')"},"type":"calculate","name":"opv0","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'opv0')","calculate":"0"},"type":"calculate","name":"opv0_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'pcv1'),${client_reg_date},'')"},"type":"calculate","name":"pcv1","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'pcv1')","calculate":"1"},"type":"calculate","name":"pcv1_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'opv1'),${client_reg_date},'')"},"type":"calculate","name":"opv1","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'opv1')","calculate":"1"},"type":"calculate","name":"opv1_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'penta1'),${client_reg_date},'')"},"type":"calculate","name":"penta1","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'penta1')","calculate":"1"},"type":"calculate","name":"penta1_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'pcv2'),${client_reg_date},'')"},"type":"calculate","name":"pcv2","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'pcv2')","calculate":"2"},"type":"calculate","name":"pcv2_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'opv2'),${client_reg_date},'')"},"type":"calculate","name":"opv2","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'opv2')","calculate":"2"},"type":"calculate","name":"opv2_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'penta2'),${client_reg_date},'')"},"type":"calculate","name":"penta2","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'penta2')","calculate":"2"},"type":"calculate","name":"penta2_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'pcv3'),${client_reg_date},'')"},"type":"calculate","name":"pcv3","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'pcv3')","calculate":"3"},"type":"calculate","name":"pcv3_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'opv3'),${client_reg_date},'')"},"type":"calculate","name":"opv3","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'opv3')","calculate":"3"},"type":"calculate","name":"opv3_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'penta3'),${client_reg_date},'')"},"type":"calculate","name":"penta3","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'penta3')","calculate":"3"},"type":"calculate","name":"penta3_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines}, 'ipv')","calculate":"if(selected(${vaccines_2}, 'ipv'),${client_reg_date},'')"},"type":"calculate","name":"ipv","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1422AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'measles1'),${client_reg_date},'')"},"type":"calculate","name":"measles1","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'measles1')","calculate":"1"},"type":"calculate","name":"measles1_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'measles2'),${client_reg_date},'')"},"type":"calculate","name":"measles2","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'measles2')","calculate":"2"},"type":"calculate","name":"measles2_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"control":{"bodyless":true},"type":"group","children":[{"bind":{"readonly":"true()","calculate":"concat('uuid:', uuid())"},"type":"calculate","name":"instanceID"}],"name":"meta"}]} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/child_enrollment/form.xml b/opensrp-core/src/test/resources/form/child_enrollment/form.xml deleted file mode 100644 index f2bf538694..0000000000 --- a/opensrp-core/src/test/resources/form/child_enrollment/form.xml +++ /dev/null @@ -1,1699 +0,0 @@ -
- - -

بچّوں کا انرولمنٹ رجسٹر برائے ٹیکاجات - Child Enrollment Vaccination Register

-
-
- - کیا تاریخ پیدائش معلوم ہے؟ - Is birthdate known? - - Kya tareekh-e-pedaaish maloom hai? -
- - -
-
-
-
- - کیا آپ اپنے بچے کی اگلی ویکسین کی تاریخ کے لیے SMS موصول کرنا چاہتے ہیں؟ - Are you willing to receive SMS reminders for your next visit? - - Kya aap apnay bachay ki agli vaccine ki tareekh ke liye SMS mausool karna chahtay hain? - * -
- - -
-
-
- - - - - - - - - - - - - -
-
-
- - آج کون کون سی ویکسین دی گئی ہیں؟ - Vaccines administered today - - Aaj kon kon si vaccine di gai hain? - * -
- - - بی سی جی - BCG - - BCG - او پی وی 0 - OPV 0 - - OPV 0 - پی سی وی 1 - PCV 1 - - PCV 1 - او پی وی 1 - OPV 1 - - OPV 1 - پینٹا ویلنٹ 1 - Pentavalent 1 - - Pentavalent 1 - پی سی وی 2 - PCV 2 - - PCV 2 - او پی وی 2 - OPV 2 - - OPV 2 - پینٹا ویلنٹ 2 - Pentavalent 2 - - Pentavalent 2 - پی سی وی 3 - PCV 3 - - PCV 3 - او پی وی 3 - OPV 3 - - OPV 3 - پینٹا ویلنٹ 3 - Pentavalent 3 - - Pentavalent 3 - آئی پی وی - IPV - - IPV - خسرہ 1 - Measles 1 - - Khasra 1 - خسرہ 2 - Measles 2 - - Khasra 2 -
-
-
- -
diff --git a/opensrp-core/src/test/resources/form/child_enrollment/form_definition.json b/opensrp-core/src/test/resources/form/child_enrollment/form_definition.json deleted file mode 100644 index 1ce99a2b64..0000000000 --- a/opensrp-core/src/test/resources/form/child_enrollment/form_definition.json +++ /dev/null @@ -1,346 +0,0 @@ -{ - "form_data_definition_version" : "1", - "form" : { - "bind_type" : "pkchild", - "default_bind_path" : "/model/instance/Child_Vaccination_Enrollment/", - "fields" : [ { - "name" : "id", - "shouldLoadValue" : true - }, { - "name" : "provider_uc", - "bind" : "/model/instance/Child_Vaccination_Enrollment/provider_uc", - "shouldLoadValue" : true - }, { - "name" : "provider_town", - "bind" : "/model/instance/Child_Vaccination_Enrollment/provider_town", - "shouldLoadValue" : true - }, { - "name" : "provider_city", - "bind" : "/model/instance/Child_Vaccination_Enrollment/provider_city", - "shouldLoadValue" : true - }, { - "name" : "provider_province", - "bind" : "/model/instance/Child_Vaccination_Enrollment/provider_province", - "shouldLoadValue" : true - }, { - "name" : "provider_id", - "bind" : "/model/instance/Child_Vaccination_Enrollment/provider_id", - "shouldLoadValue" : true - }, { - "name" : "provider_location_id", - "bind" : "/model/instance/Child_Vaccination_Enrollment/provider_location_id", - "shouldLoadValue" : true - }, { - "name" : "existing_program_client_id", - "bind" : "/model/instance/Child_Vaccination_Enrollment/existing_program_client_id", - "shouldLoadValue" : true - }, { - "name" : "provider_location_name", - "bind" : "/model/instance/Child_Vaccination_Enrollment/provider_location_name", - "shouldLoadValue" : true - }, { - "name" : "provider_location_note", - "bind" : "/model/instance/Child_Vaccination_Enrollment/provider_location_note" - }, { - "name" : "start", - "bind" : "/model/instance/Child_Vaccination_Enrollment/start" - }, { - "name" : "end", - "bind" : "/model/instance/Child_Vaccination_Enrollment/end" - }, { - "name" : "today", - "bind" : "/model/instance/Child_Vaccination_Enrollment/today" - }, { - "name" : "deviceid", - "bind" : "/model/instance/Child_Vaccination_Enrollment/deviceid" - }, { - "name" : "subscriberid", - "bind" : "/model/instance/Child_Vaccination_Enrollment/subscriberid" - }, { - "name" : "simserial", - "bind" : "/model/instance/Child_Vaccination_Enrollment/simserial" - }, { - "name" : "phonenumber", - "bind" : "/model/instance/Child_Vaccination_Enrollment/phonenumber" - }, { - "name" : "client_reg_date", - "bind" : "/model/instance/Child_Vaccination_Enrollment/client_reg_date" - }, { - "name" : "program_client_id", - "bind" : "/model/instance/Child_Vaccination_Enrollment/program_client_id" - }, { - "name" : "epi_card_number", - "bind" : "/model/instance/Child_Vaccination_Enrollment/epi_card_number" - }, { - "name" : "first_name", - "bind" : "/model/instance/Child_Vaccination_Enrollment/first_name" - }, { - "name" : "last_name", - "bind" : "/model/instance/Child_Vaccination_Enrollment/last_name" - }, { - "name" : "birth_date_known", - "bind" : "/model/instance/Child_Vaccination_Enrollment/member_birth_date_known" - }, { - "name" : "birth_date", - "bind" : "/model/instance/Child_Vaccination_Enrollment/member_birth_date" - }, { - "name" : "age", - "bind" : "/model/instance/Child_Vaccination_Enrollment/age" - }, { - "name" : "calc_age", - "bind" : "/model/instance/Child_Vaccination_Enrollment/calc_age" - }, { - "name" : "calc_dob", - "bind" : "/model/instance/Child_Vaccination_Enrollment/calc_dob" - }, { - "name" : "dob", - "bind" : "/model/instance/Child_Vaccination_Enrollment/calc_dob_confirm" - }, { - "name" : "calc_dob_estimated", - "bind" : "/model/instance/Child_Vaccination_Enrollment/calc_dob_estimated" - }, { - "name" : "calc_age_confirm", - "bind" : "/model/instance/Child_Vaccination_Enrollment/calc_age_confirm" - }, { - "name" : "gender", - "bind" : "/model/instance/Child_Vaccination_Enrollment/gender" - }, { - "name" : "mother_name", - "bind" : "/model/instance/Child_Vaccination_Enrollment/mother_name" - }, { - "name" : "ethnicity", - "bind" : "/model/instance/Child_Vaccination_Enrollment/ethnicity" - }, { - "name" : "ethnicity_other", - "bind" : "/model/instance/Child_Vaccination_Enrollment/ethnicity_other" - }, { - "name" : "province", - "bind" : "/model/instance/Child_Vaccination_Enrollment/province" - }, { - "name" : "city_village", - "bind" : "/model/instance/Child_Vaccination_Enrollment/city_village" - }, { - "name" : "town", - "bind" : "/model/instance/Child_Vaccination_Enrollment/town" - }, { - "name" : "union_council", - "bind" : "/model/instance/Child_Vaccination_Enrollment/union_council" - }, { - "name" : "house_number", - "bind" : "/model/instance/Child_Vaccination_Enrollment/house_number" - }, { - "name" : "street", - "bind" : "/model/instance/Child_Vaccination_Enrollment/street" - }, { - "name" : "landmark", - "bind" : "/model/instance/Child_Vaccination_Enrollment/landmark" - }, { - "name" : "provincename", - "bind" : "/model/instance/Child_Vaccination_Enrollment/provincename" - }, { - "name" : "city_villagename", - "bind" : "/model/instance/Child_Vaccination_Enrollment/city_villagename" - }, { - "name" : "townname", - "bind" : "/model/instance/Child_Vaccination_Enrollment/townname" - }, { - "name" : "union_councilname", - "bind" : "/model/instance/Child_Vaccination_Enrollment/union_councilname" - }, { - "name" : "address", - "bind" : "/model/instance/Child_Vaccination_Enrollment/address" - }, { - "name" : "centre_gps", - "bind" : "/model/instance/Child_Vaccination_Enrollment/centre_gps" - }, { - "name" : "child_was_suffering_from_a_disease_at_birth", - "bind" : "/model/instance/Child_Vaccination_Enrollment/child_was_suffering_from_a_disease_at_birth" - }, { - "name" : "reminders_approval", - "bind" : "/model/instance/Child_Vaccination_Enrollment/reminders_approval" - }, { - "name" : "contact_phone_number", - "bind" : "/model/instance/Child_Vaccination_Enrollment/contact_phone_number" - }, { - "name" : "six_weeks", - "bind" : "/model/instance/Child_Vaccination_Enrollment/six_weeks" - }, { - "name" : "ten_weeks", - "bind" : "/model/instance/Child_Vaccination_Enrollment/ten_weeks" - }, { - "name" : "forteen_weeks", - "bind" : "/model/instance/Child_Vaccination_Enrollment/forteen_weeks" - }, { - "name" : "nine_months", - "bind" : "/model/instance/Child_Vaccination_Enrollment/nine_months" - }, { - "name" : "fifteen_months", - "bind" : "/model/instance/Child_Vaccination_Enrollment/fifteen_months" - }, { - "name" : "vaccines", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines" - }, { - "name" : "bcg_retro", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/bcg_retro" - }, { - "name" : "opv0_retro", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/opv0_retro" - }, { - "name" : "opv0_dose", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/opv0_dose" - }, { - "name" : "pcv1_retro", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/pcv1_retro" - }, { - "name" : "pcv1_dose", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/pcv1_dose" - }, { - "name" : "opv1_retro", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/opv1_retro" - }, { - "name" : "opv1_dose", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/opv1_dose" - }, { - "name" : "penta1_retro", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/penta1_retro" - }, { - "name" : "penta1_dose", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/penta1_dose" - }, { - "name" : "pcv2_retro", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/pcv2_retro" - }, { - "name" : "pcv2_dose", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/pcv2_dose" - }, { - "name" : "opv2_retro", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/opv2_retro" - }, { - "name" : "opv2_dose", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/opv2_dose" - }, { - "name" : "penta2_retro", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/penta2_retro" - }, { - "name" : "penta2_dose", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/penta2_dose" - }, { - "name" : "pcv3_retro", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/pcv3_retro" - }, { - "name" : "pcv3_dose", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/pcv3_dose" - }, { - "name" : "opv3_retro", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/opv3_retro" - }, { - "name" : "opv3_dose", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/opv3_dose" - }, { - "name" : "penta3_retro", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/penta3_retro" - }, { - "name" : "penta3_dose", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/penta3_dose" - }, { - "name" : "ipv_retro", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/ipv_retro" - }, { - "name" : "measles1_retro", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/measles1_retro" - }, { - "name" : "measles1_dose", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/measles1_dose" - }, { - "name" : "measles2_retro", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/measles2_retro" - }, { - "name" : "measles2_dose", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_group/measles2_dose" - }, { - "name" : "vaccines_2", - "bind" : "/model/instance/Child_Vaccination_Enrollment/vaccines_2" - }, { - "name" : "bcg", - "bind" : "/model/instance/Child_Vaccination_Enrollment/bcg" - }, { - "name" : "opv0", - "bind" : "/model/instance/Child_Vaccination_Enrollment/opv0" - }, { - "name" : "opv0_dose_today", - "bind" : "/model/instance/Child_Vaccination_Enrollment/opv0_dose_today" - }, { - "name" : "pcv1", - "bind" : "/model/instance/Child_Vaccination_Enrollment/pcv1" - }, { - "name" : "pcv1_dose_today", - "bind" : "/model/instance/Child_Vaccination_Enrollment/pcv1_dose_today" - }, { - "name" : "opv1", - "bind" : "/model/instance/Child_Vaccination_Enrollment/opv1" - }, { - "name" : "opv1_dose_today", - "bind" : "/model/instance/Child_Vaccination_Enrollment/opv1_dose_today" - }, { - "name" : "penta1", - "bind" : "/model/instance/Child_Vaccination_Enrollment/penta1" - }, { - "name" : "penta1_dose_today", - "bind" : "/model/instance/Child_Vaccination_Enrollment/penta1_dose_today" - }, { - "name" : "pcv2", - "bind" : "/model/instance/Child_Vaccination_Enrollment/pcv2" - }, { - "name" : "pcv2_dose_today", - "bind" : "/model/instance/Child_Vaccination_Enrollment/pcv2_dose_today" - }, { - "name" : "opv2", - "bind" : "/model/instance/Child_Vaccination_Enrollment/opv2" - }, { - "name" : "opv2_dose_today", - "bind" : "/model/instance/Child_Vaccination_Enrollment/opv2_dose_today" - }, { - "name" : "penta2", - "bind" : "/model/instance/Child_Vaccination_Enrollment/penta2" - }, { - "name" : "penta2_dose_today", - "bind" : "/model/instance/Child_Vaccination_Enrollment/penta2_dose_today" - }, { - "name" : "pcv3", - "bind" : "/model/instance/Child_Vaccination_Enrollment/pcv3" - }, { - "name" : "pcv3_dose_today", - "bind" : "/model/instance/Child_Vaccination_Enrollment/pcv3_dose_today" - }, { - "name" : "opv3", - "bind" : "/model/instance/Child_Vaccination_Enrollment/opv3" - }, { - "name" : "opv3_dose_today", - "bind" : "/model/instance/Child_Vaccination_Enrollment/opv3_dose_today" - }, { - "name" : "penta3", - "bind" : "/model/instance/Child_Vaccination_Enrollment/penta3" - }, { - "name" : "penta3_dose_today", - "bind" : "/model/instance/Child_Vaccination_Enrollment/penta3_dose_today" - }, { - "name" : "ipv", - "bind" : "/model/instance/Child_Vaccination_Enrollment/ipv" - }, { - "name" : "measles1", - "bind" : "/model/instance/Child_Vaccination_Enrollment/measles1" - }, { - "name" : "measles1_dose_today", - "bind" : "/model/instance/Child_Vaccination_Enrollment/measles1_dose_today" - }, { - "name" : "measles2", - "bind" : "/model/instance/Child_Vaccination_Enrollment/measles2" - }, { - "name" : "measles2_dose_today", - "bind" : "/model/instance/Child_Vaccination_Enrollment/measles2_dose_today" - }, { - "name" : "instanceID", - "bind" : "/model/instance/Child_Vaccination_Enrollment/meta/instanceID" - } ] - } -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/child_enrollment/form_submission1.json b/opensrp-core/src/test/resources/form/child_enrollment/form_submission1.json deleted file mode 100644 index bb4e03776f..0000000000 --- a/opensrp-core/src/test/resources/form/child_enrollment/form_submission1.json +++ /dev/null @@ -1,427 +0,0 @@ -{ - "_id": "ff5311680dfc931b443c435e1703d8a8", - "_rev": "1-f0e0db153894af4d10be9b0217ac8c68", - "type": "FormSubmission", - "anmId": "demotest", - "instanceId": "bb9a9683-018a-41b7-9dc6-af2fa88aba12", - "formName": "child_enrollment", - "entityId": "7976dc69-d749-4ec7-82ce-bda37f466f59", - "clientVersion": 1447133829039, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "pkchild", - "default_bind_path": "/model/instance/Child_Enrollment_Vaccination_Register", - "fields": [ - { - "name": "id", - "value": "7976dc69-d749-4ec7-82ce-bda37f466f59", - "source": "vaccine_child.id" - }, - { - "name": "provider_uc", - "value": "korangi", - "source": "vaccine_child.provider_uc" - }, - { - "name": "provider_town", - "value": "korangi", - "source": "vaccine_child.provider_town" - }, - { - "name": "provider_city", - "value": "karachi", - "source": "vaccine_child.provider_city" - }, - { - "name": "provider_province", - "value": "sindh", - "source": "vaccine_child.provider_province" - }, - { - "name": "existing_location", - "source": "vaccine_child.existing_location" - }, - { - "name": "location_name", - "source": "vaccine_child.location_name" - }, - { - "name": "provider_location_note", - "source": "vaccine_child.provider_location_note" - }, - { - "name": "child_reg_date", - "value": "2015-11-10", - "source": "vaccine_child.child_reg_date" - }, - { - "name": "existing_program_client_id", - "value": "0149-5", - "source": "vaccine_child.existing_program_client_id" - }, - { - "name": "epi_card_number", - "value": "12345", - "source": "vaccine_child.epi_card_number" - }, - { - "name": "first_name", - "value": "syed saad", - "source": "vaccine_child.first_name" - }, - { - "name": "last_name", - "value": "dddd", - "source": "vaccine_child.last_name" - }, - { - "name": "child_birth_date_known", - "value": "yes", - "source": "vaccine_child.child_birth_date_known" - }, - { - "name": "dob", - "value": "2015-11-10", - "source": "vaccine_child.child_birth_date" - }, - { - "name": "age", - "source": "vaccine_child.age" - }, - { - "name": "child_age", - "value": "0", - "source": "vaccine_child.child_age" - }, - { - "name": "child_dob", - "value": "2015-10-10", - "source": "vaccine_child.child_dob" - }, - { - "name": "chid_dob_confirm", - "value": "2015-10-10", - "source": "vaccine_child.chid_dob_confirm" - }, - { - "name": "child_dob_estimated", - "value": "0", - "source": "vaccine_child.child_dob_estimated" - }, - { - "name": "child_birth_date_note", - "source": "vaccine_child.child_birth_date_note" - }, - { - "name": "gender", - "value": "male", - "source": "vaccine_child.gender" - }, - { - "name": "father_name", - "value": "shamsher", - "source": "vaccine_child.father_name" - }, - { - "name": "mother_name", - "value": "ghbn", - "source": "vaccine_child.mother_name" - }, - { - "name": "ethnicity", - "value": "hhggg", - "source": "vaccine_child.ethnicity" - }, - { - "name": "province", - "value": "sindh", - "source": "vaccine_child.province" - }, - { - "name": "city_village", - "source": "vaccine_child.city_village" - }, - { - "name": "town", - "source": "vaccine_child.town" - }, - { - "name": "union_council", - "source": "vaccine_child.union_council" - }, - { - "name": "house_number", - "value": "152", - "source": "vaccine_child.house_number" - }, - { - "name": "street", - "value": "uhhh", - "source": "vaccine_child.street" - }, - { - "name": "landmark", - "source": "vaccine_child.landmark" - }, - { - "name": "center_gps", - "value": "24.8637 67.0757 0 30", - "source": "vaccine_child.center_gps" - }, - { - "name": "vaccines", - "source": "vaccine_child.vaccines" - }, - { - "name": "bcg", - "source": "vaccine_child.bcg" - }, - { - "name": "opv_0_retro", - "source": "vaccine_child.opv_0_retro" - }, - { - "name": "opv_0_dose", - "value": "0", - "source": "vaccine_child.opv_0_dose" - }, - { - "name": "pcv_1_retro", - "source": "vaccine_child.pcv_1_retro" - }, - { - "name": "pcv_1_dose", - "value": "1", - "source": "vaccine_child.pcv_1_dose" - }, - { - "name": "opv_1_retro", - "source": "vaccine_child.opv_1_retro" - }, - { - "name": "opv_1_dose", - "value": "1", - "source": "vaccine_child.opv_1_dose" - }, - { - "name": "pentavalent_1_retro", - "source": "vaccine_child.pentavalent_1_retro" - }, - { - "name": "pentavalent_1_dose", - "value": "1", - "source": "vaccine_child.pentavalent_1_dose" - }, - { - "name": "pcv_2_retro", - "source": "vaccine_child.pcv_2_retro" - }, - { - "name": "pcv_2_dose", - "value": "2", - "source": "vaccine_child.pcv_2_dose" - }, - { - "name": "opv_2_retro", - "source": "vaccine_child.opv_2_retro" - }, - { - "name": "opv_2_dose", - "value": "2", - "source": "vaccine_child.opv_2_dose" - }, - { - "name": "pentavalent_2_retro", - "source": "vaccine_child.pentavalent_2_retro" - }, - { - "name": "pentavalent_2_dose", - "value": "2", - "source": "vaccine_child.pentavalent_2_dose" - }, - { - "name": "pcv_3_retro", - "source": "vaccine_child.pcv_3_retro" - }, - { - "name": "pcv_3_dose", - "value": "3", - "source": "vaccine_child.pcv_3_dose" - }, - { - "name": "opv_3_retro", - "source": "vaccine_child.opv_3_retro" - }, - { - "name": "opv_3_dose", - "value": "3", - "source": "vaccine_child.opv_3_dose" - }, - { - "name": "pentavalent_3_retro", - "source": "vaccine_child.pentavalent_3_retro" - }, - { - "name": "pentavalent_3_dose", - "value": "3", - "source": "vaccine_child.pentavalent_3_dose" - }, - { - "name": "measles_1_retro", - "source": "vaccine_child.measles_1_retro" - }, - { - "name": "measles_1_dose", - "value": "1", - "source": "vaccine_child.measles_1_dose" - }, - { - "name": "measles_2_retro", - "source": "vaccine_child.measles_2_retro" - }, - { - "name": "measles_2_dose", - "value": "2", - "source": "vaccine_child.measles_2_dose" - }, - { - "name": "vaccines_2", - "value": "opv_0 pcv_1", - "source": "vaccine_child.vaccines_2" - }, - { - "name": "child_was_suffering_from_a_disease_at_birth", - "value": "no", - "source": "vaccine_child.child_was_suffering_from_a_disease_at_birth" - }, - { - "name": "reminders_approval", - "value": "no", - "source": "vaccine_child.reminders_approval" - }, - { - "name": "contact_phone_number", - "source": "vaccine_child.contact_phone_number" - }, - { - "name": "bcg_today", - "source": "vaccine_child.bcg_today" - }, - { - "name": "opv_0", - "value": "2015-11-10", - "source": "vaccine_child.opv_0" - }, - { - "name": "opv_0_dose_today", - "value": "0", - "source": "vaccine_child.opv_0_dose_today" - }, - { - "name": "pcv_1", - "value": "2015-11-10", - "source": "vaccine_child.pcv_1" - }, - { - "name": "pcv_1_dose_today", - "value": "1", - "source": "vaccine_child.pcv_1_dose_today" - }, - { - "name": "opv_1", - "source": "vaccine_child.opv_1" - }, - { - "name": "opv_1_dose_today", - "value": "1", - "source": "vaccine_child.opv_1_dose_today" - }, - { - "name": "pentavalent_1", - "source": "vaccine_child.pentavalent_1" - }, - { - "name": "pentavalent_1_dose_today", - "value": "1", - "source": "vaccine_child.pentavalent_1_dose_today" - }, - { - "name": "pcv_2", - "source": "vaccine_child.pcv_2" - }, - { - "name": "pcv_2_dose_today", - "value": "2", - "source": "vaccine_child.pcv_2_dose_today" - }, - { - "name": "opv_2", - "source": "vaccine_child.opv_2" - }, - { - "name": "opv_2_dose_today", - "value": "2", - "source": "vaccine_child.opv_2_dose_today" - }, - { - "name": "pentavalent_2", - "source": "vaccine_child.pentavalent_2" - }, - { - "name": "pentavalent_2_dose_today", - "value": "2", - "source": "vaccine_child.pentavalent_2_dose_today" - }, - { - "name": "pcv_3", - "source": "vaccine_child.pcv_3" - }, - { - "name": "pcv_3_dose_today", - "value": "3", - "source": "vaccine_child.pcv_3_dose_today" - }, - { - "name": "opv_3", - "source": "vaccine_child.opv_3" - }, - { - "name": "opv_3_dose_today", - "value": "3", - "source": "vaccine_child.opv_3_dose_today" - }, - { - "name": "pentavalent_3", - "source": "vaccine_child.pentavalent_3" - }, - { - "name": "pentavalent_3_dose_today", - "value": "3", - "source": "vaccine_child.pentavalent_3_dose_today" - }, - { - "name": "measles_1", - "source": "vaccine_child.measles_1" - }, - { - "name": "measles_1_dose_today", - "value": "1", - "source": "vaccine_child.measles_1_dose_today" - }, - { - "name": "measles_2", - "source": "vaccine_child.measles_2" - }, - { - "name": "measles_2_dose_today", - "value": "2", - "source": "vaccine_child.measles_2_dose_today" - } - ] - } - }, - "serverVersion": 1447133792547 -} - diff --git a/opensrp-core/src/test/resources/form/child_enrollment/form_submission2.json b/opensrp-core/src/test/resources/form/child_enrollment/form_submission2.json deleted file mode 100644 index f4bd30636a..0000000000 --- a/opensrp-core/src/test/resources/form/child_enrollment/form_submission2.json +++ /dev/null @@ -1,428 +0,0 @@ -{ - "_id": "ff5311680dfc931b443c435e1703d8a8", - "_rev": "1-f0e0db153894af4d10be9b0217ac8c68", - "type": "FormSubmission", - "anmId": "demotest", - "instanceId": "bb9a9683-018a-41b7-9dc6-af2fa88aba12", - "formName": "child_enrollment", - "entityId": "7976dc69-d749-4ec7-82ce-bda37f466f59", - "clientVersion": 1447133829039, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "pkchild", - "default_bind_path": "/model/instance/Child_Enrollment_Vaccination_Register", - "fields": [ - { - "name": "id", - "value": "7976dc69-d749-4ec7-82ce-bda37f466f59", - "source": "vaccine_child.id" - }, - { - "name": "provider_uc", - "value": "korangi", - "source": "vaccine_child.provider_uc" - }, - { - "name": "provider_town", - "value": "korangi", - "source": "vaccine_child.provider_town" - }, - { - "name": "provider_city", - "value": "karachi", - "source": "vaccine_child.provider_city" - }, - { - "name": "provider_province", - "value": "sindh", - "source": "vaccine_child.provider_province" - }, - { - "name": "existing_location", - "source": "vaccine_child.existing_location" - }, - { - "name": "location_name", - "source": "vaccine_child.location_name" - }, - { - "name": "provider_location_note", - "source": "vaccine_child.provider_location_note" - }, - { - "name": "child_reg_date", - "value": "2015-11-10", - "source": "vaccine_child.child_reg_date" - }, - { - "name": "existing_program_client_id", - "value": "0149-5", - "source": "vaccine_child.existing_program_client_id" - }, - { - "name": "epi_card_number", - "value": "12345", - "source": "vaccine_child.epi_card_number" - }, - { - "name": "first_name", - "value": "syed saad", - "source": "vaccine_child.first_name" - }, - { - "name": "last_name", - "value": "dddd", - "source": "vaccine_child.last_name" - }, - { - "name": "child_birth_date_known", - "value": "yes", - "source": "vaccine_child.child_birth_date_known" - }, - { - "name": "dob", - "value": "2015-11-10", - "source": "vaccine_child.child_birth_date" - }, - { - "name": "age", - "source": "vaccine_child.age" - }, - { - "name": "child_age", - "value": "0", - "source": "vaccine_child.child_age" - }, - { - "name": "child_dob", - "value": "2015-10-10", - "source": "vaccine_child.child_dob" - }, - { - "name": "chid_dob_confirm", - "value": "2015-10-10", - "source": "vaccine_child.chid_dob_confirm" - }, - { - "name": "child_dob_estimated", - "value": "0", - "source": "vaccine_child.child_dob_estimated" - }, - { - "name": "child_birth_date_note", - "source": "vaccine_child.child_birth_date_note" - }, - { - "name": "gender", - "value": "male", - "source": "vaccine_child.gender" - }, - { - "name": "father_name", - "value": "shamsher", - "source": "vaccine_child.father_name" - }, - { - "name": "mother_name", - "value": "ghbn", - "source": "vaccine_child.mother_name" - }, - { - "name": "ethnicity", - "value": "hhggg", - "source": "vaccine_child.ethnicity" - }, - { - "name": "province", - "value": "sindh", - "source": "vaccine_child.province" - }, - { - "name": "city_village", - "source": "vaccine_child.city_village" - }, - { - "name": "town", - "source": "vaccine_child.town" - }, - { - "name": "union_council", - "source": "vaccine_child.union_council" - }, - { - "name": "house_number", - "value": "152", - "source": "vaccine_child.house_number" - }, - { - "name": "street", - "value": "uhhh", - "source": "vaccine_child.street" - }, - { - "name": "landmark", - "source": "vaccine_child.landmark" - }, - { - "name": "center_gps", - "value": "24.8637 67.0757 0 30", - "source": "vaccine_child.center_gps" - }, - { - "name": "vaccines", - "source": "vaccine_child.vaccines" - }, - { - "name": "bcg", - "source": "vaccine_child.bcg" - }, - { - "name": "opv_0_retro", - "source": "vaccine_child.opv_0_retro" - }, - { - "name": "opv_0_dose", - "value": "0", - "source": "vaccine_child.opv_0_dose" - }, - { - "name": "pcv_1_retro", - "source": "vaccine_child.pcv_1_retro" - }, - { - "name": "pcv_1_dose", - "value": "1", - "source": "vaccine_child.pcv_1_dose" - }, - { - "name": "opv_1_retro", - "source": "vaccine_child.opv_1_retro" - }, - { - "name": "opv_1_dose", - "value": "1", - "source": "vaccine_child.opv_1_dose" - }, - { - "name": "pentavalent_1_retro", - "value": "2015-11-09", - "source": "vaccine_child.pentavalent_1_retro" - }, - { - "name": "pentavalent_1_dose", - "value": "1", - "source": "vaccine_child.pentavalent_1_dose" - }, - { - "name": "pcv_2_retro", - "source": "vaccine_child.pcv_2_retro" - }, - { - "name": "pcv_2_dose", - "value": "2", - "source": "vaccine_child.pcv_2_dose" - }, - { - "name": "opv_2_retro", - "source": "vaccine_child.opv_2_retro" - }, - { - "name": "opv_2_dose", - "value": "2", - "source": "vaccine_child.opv_2_dose" - }, - { - "name": "pentavalent_2_retro", - "source": "vaccine_child.pentavalent_2_retro" - }, - { - "name": "pentavalent_2_dose", - "value": "2", - "source": "vaccine_child.pentavalent_2_dose" - }, - { - "name": "pcv_3_retro", - "source": "vaccine_child.pcv_3_retro" - }, - { - "name": "pcv_3_dose", - "value": "3", - "source": "vaccine_child.pcv_3_dose" - }, - { - "name": "opv_3_retro", - "source": "vaccine_child.opv_3_retro" - }, - { - "name": "opv_3_dose", - "value": "3", - "source": "vaccine_child.opv_3_dose" - }, - { - "name": "pentavalent_3_retro", - "source": "vaccine_child.pentavalent_3_retro" - }, - { - "name": "pentavalent_3_dose", - "value": "3", - "source": "vaccine_child.pentavalent_3_dose" - }, - { - "name": "measles_1_retro", - "source": "vaccine_child.measles_1_retro" - }, - { - "name": "measles_1_dose", - "value": "1", - "source": "vaccine_child.measles_1_dose" - }, - { - "name": "measles_2_retro", - "source": "vaccine_child.measles_2_retro" - }, - { - "name": "measles_2_dose", - "value": "2", - "source": "vaccine_child.measles_2_dose" - }, - { - "name": "vaccines_2", - "value": "opv_0 pcv_1", - "source": "vaccine_child.vaccines_2" - }, - { - "name": "child_was_suffering_from_a_disease_at_birth", - "value": "no", - "source": "vaccine_child.child_was_suffering_from_a_disease_at_birth" - }, - { - "name": "reminders_approval", - "value": "no", - "source": "vaccine_child.reminders_approval" - }, - { - "name": "contact_phone_number", - "source": "vaccine_child.contact_phone_number" - }, - { - "name": "bcg_today", - "source": "vaccine_child.bcg_today" - }, - { - "name": "opv_0", - "value": "2015-11-10", - "source": "vaccine_child.opv_0" - }, - { - "name": "opv_0_dose_today", - "value": "0", - "source": "vaccine_child.opv_0_dose_today" - }, - { - "name": "pcv_1", - "value": "2015-11-10", - "source": "vaccine_child.pcv_1" - }, - { - "name": "pcv_1_dose_today", - "value": "1", - "source": "vaccine_child.pcv_1_dose_today" - }, - { - "name": "opv_1", - "source": "vaccine_child.opv_1" - }, - { - "name": "opv_1_dose_today", - "value": "1", - "source": "vaccine_child.opv_1_dose_today" - }, - { - "name": "pentavalent_1", - "source": "vaccine_child.pentavalent_1" - }, - { - "name": "pentavalent_1_dose_today", - "value": "1", - "source": "vaccine_child.pentavalent_1_dose_today" - }, - { - "name": "pcv_2", - "source": "vaccine_child.pcv_2" - }, - { - "name": "pcv_2_dose_today", - "value": "2", - "source": "vaccine_child.pcv_2_dose_today" - }, - { - "name": "opv_2", - "source": "vaccine_child.opv_2" - }, - { - "name": "opv_2_dose_today", - "value": "2", - "source": "vaccine_child.opv_2_dose_today" - }, - { - "name": "pentavalent_2", - "source": "vaccine_child.pentavalent_2" - }, - { - "name": "pentavalent_2_dose_today", - "value": "2", - "source": "vaccine_child.pentavalent_2_dose_today" - }, - { - "name": "pcv_3", - "source": "vaccine_child.pcv_3" - }, - { - "name": "pcv_3_dose_today", - "value": "3", - "source": "vaccine_child.pcv_3_dose_today" - }, - { - "name": "opv_3", - "source": "vaccine_child.opv_3" - }, - { - "name": "opv_3_dose_today", - "value": "3", - "source": "vaccine_child.opv_3_dose_today" - }, - { - "name": "pentavalent_3", - "source": "vaccine_child.pentavalent_3" - }, - { - "name": "pentavalent_3_dose_today", - "value": "3", - "source": "vaccine_child.pentavalent_3_dose_today" - }, - { - "name": "measles_1", - "source": "vaccine_child.measles_1" - }, - { - "name": "measles_1_dose_today", - "value": "1", - "source": "vaccine_child.measles_1_dose_today" - }, - { - "name": "measles_2", - "source": "vaccine_child.measles_2" - }, - { - "name": "measles_2_dose_today", - "value": "2", - "source": "vaccine_child.measles_2_dose_today" - } - ] - } - }, - "serverVersion": 1447133792547 -} - diff --git a/opensrp-core/src/test/resources/form/child_enrollment/form_submission3.json b/opensrp-core/src/test/resources/form/child_enrollment/form_submission3.json deleted file mode 100644 index 495ef2b1cd..0000000000 --- a/opensrp-core/src/test/resources/form/child_enrollment/form_submission3.json +++ /dev/null @@ -1,261 +0,0 @@ -{ - "type": "FormSubmission", - "anmId": "demotest", - "instanceId": "1996b940-181e-46d5-bf8f-630bef2880a9", - "formName": "child_enrollment", - "entityId": "8cc8cbca-7c39-4c57-b8c7-5ccd5cf88af7", - "clientVersion": 1449572774009, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "pkchild", - "default_bind_path": "/model/instance/Child_Enrollment_Vaccination_Register", - "fields": [ - { - "name": "id", - "value": "8cc8cbca-7c39-4c57-b8c7-5ccd5cf88af7", - "source": "pkchild.id" - }, - { - "name": "child_reg_date", - "value": "2015-11-02", - "source": "pkchild.child_reg_date" - }, - { - "name": "dob", - "value": "2014-12-13", - "source": "pkchild.child_birth_date" - }, - { - "name": "age", - "value": "12", - "source": "pkchild.age" - }, - { - "name": "child_dob_estimated", - "value": "1", - "source": "pkchild.child_dob_estimated" - }, - { - "name": "vaccines", - "source": "pkchild.vaccines" - }, - { - "name": "bcg_retro", - "source": "pkchild.bcg_retro" - }, - { - "name": "opv_0_retro", - "source": "pkchild.opv_0_retro" - }, - { - "name": "opv_0_dose", - "source": "pkchild.opv_0_dose" - }, - { - "name": "pcv_1_retro", - "source": "pkchild.pcv_1_retro" - }, - { - "name": "pcv_1_dose", - "source": "pkchild.pcv_1_dose" - }, - { - "name": "opv_1_retro", - "source": "pkchild.opv_1_retro" - }, - { - "name": "opv_1_dose", - "source": "pkchild.opv_1_dose" - }, - { - "name": "pentavalent_1_retro", - "source": "pkchild.pentavalent_1_retro" - }, - { - "name": "pentavalent_1_dose", - "source": "pkchild.pentavalent_1_dose" - }, - { - "name": "pcv_2_retro", - "source": "pkchild.pcv_2_retro" - }, - { - "name": "pcv_2_dose", - "source": "pkchild.pcv_2_dose" - }, - { - "name": "opv_2_retro", - "source": "pkchild.opv_2_retro" - }, - { - "name": "opv_2_dose", - "source": "pkchild.opv_2_dose" - }, - { - "name": "pentavalent_2_retro", - "source": "pkchild.pentavalent_2_retro" - }, - { - "name": "pentavalent_2_dose", - "source": "pkchild.pentavalent_2_dose" - }, - { - "name": "pcv_3_retro", - "source": "pkchild.pcv_3_retro" - }, - { - "name": "pcv_3_dose", - "source": "pkchild.pcv_3_dose" - }, - { - "name": "opv_3_retro", - "source": "pkchild.opv_3_retro" - }, - { - "name": "opv_3_dose", - "source": "pkchild.opv_3_dose" - }, - { - "name": "pentavalent_3_retro", - "source": "pkchild.pentavalent_3_retro" - }, - { - "name": "pentavalent_3_dose", - "source": "pkchild.pentavalent_3_dose" - }, - { - "name": "measles_1_retro", - "source": "pkchild.measles_1_retro" - }, - { - "name": "measles_1_dose", - "source": "pkchild.measles_1_dose" - }, - { - "name": "measles_2_retro", - "source": "pkchild.measles_2_retro" - }, - { - "name": "measles_2_dose", - "source": "pkchild.measles_2_dose" - }, - { - "name": "vaccines2", - "value": "bcg opv_0", - "source": "pkchild.vaccines2" - }, - { - "name": "contact_phone_number", - "value": "3332525252", - "source": "pkchild.contact_phone_number" - }, - { - "name": "bcg", - "value": "2015-11-02", - "source": "pkchild.bcg" - }, - { - "name": "opv_0", - "value": "2015-11-02", - "source": "pkchild.opv_0" - }, - { - "name": "opv_0_dose_today", - "value": "0", - "source": "pkchild.opv_0_dose_today" - }, - { - "name": "pcv_1", - "source": "pkchild.pcv_1" - }, - { - "name": "pcv_1_dose_today", - "source": "pkchild.pcv_1_dose_today" - }, - { - "name": "opv_1", - "source": "pkchild.opv_1" - }, - { - "name": "opv_1_dose_today", - "source": "pkchild.opv_1_dose_today" - }, - { - "name": "pentavalent_1", - "source": "pkchild.pentavalent_1" - }, - { - "name": "pentavalent_1_dose_today", - "source": "pkchild.pentavalent_1_dose_today" - }, - { - "name": "pcv_2", - "source": "pkchild.pcv_2" - }, - { - "name": "pcv_2_dose_today", - "source": "pkchild.pcv_2_dose_today" - }, - { - "name": "opv_2", - "source": "pkchild.opv_2" - }, - { - "name": "opv_2_dose_today", - "source": "pkchild.opv_2_dose_today" - }, - { - "name": "pentavalent_2", - "source": "pkchild.pentavalent_2" - }, - { - "name": "pentavalent_2_dose_today", - "source": "pkchild.pentavalent_2_dose_today" - }, - { - "name": "pcv_3", - "source": "pkchild.pcv_3" - }, - { - "name": "pcv_3_dose_today", - "source": "pkchild.pcv_3_dose_today" - }, - { - "name": "opv_3", - "source": "pkchild.opv_3" - }, - { - "name": "opv_3_dose_today", - "source": "pkchild.opv_3_dose_today" - }, - { - "name": "pentavalent_3", - "source": "pkchild.pentavalent_3" - }, - { - "name": "pentavalent_3_dose_today", - "source": "pkchild.pentavalent_3_dose_today" - }, - { - "name": "measles_1", - "source": "pkchild.measles_1" - }, - { - "name": "measles_1_dose_today", - "source": "pkchild.measles_1_dose_today" - }, - { - "name": "measles_2", - "source": "pkchild.measles_2" - }, - { - "name": "measles_2_dose_today", - "source": "pkchild.measles_2_dose_today" - } - ] - } - }, - "serverVersion": 1449572944907 -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/child_enrollment/model.xml b/opensrp-core/src/test/resources/form/child_enrollment/model.xml deleted file mode 100644 index 8a0f23a838..0000000000 --- a/opensrp-core/src/test/resources/form/child_enrollment/model.xml +++ /dev/null @@ -1,1691 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - yes - - - - - - - - - - - - - - ${provider_province} - ${provider_city} - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - static_instance-provinces-0 - kpk - - - static_instance-provinces-1 - sindh - - - static_instance-provinces-2 - balochistan - - - static_instance-provinces-3 - punjab - - - static_instance-provinces-4 - gilgit_baltistan - - - static_instance-provinces-5 - kashmir - - - static_instance-provinces-6 - fata - - - static_instance-provinces-7 - out_of_country - - - - - - - static_instance-ucs-0 - sindh - karachi - korangi - bilal_colony - - - static_instance-ucs-1 - sindh - karachi - korangi - nasir_colony - - - static_instance-ucs-2 - sindh - karachi - korangi - chakra_goth - - - static_instance-ucs-3 - sindh - karachi - korangi - mustafa_taj_colony - - - static_instance-ucs-4 - sindh - karachi - korangi - hundred_quarters - - - static_instance-ucs-5 - sindh - karachi - korangi - gulzar_colony - - - static_instance-ucs-6 - sindh - karachi - korangi - korangi_sector_33 - - - static_instance-ucs-7 - sindh - karachi - korangi - zaman_town - - - static_instance-ucs-8 - sindh - karachi - korangi - hasrat_mohani_colony - - - static_instance-ucs-9 - sindh - karachi - baldia - gulshan_e_ghazi - - - static_instance-ucs-10 - sindh - karachi - baldia - ittehad_town - - - static_instance-ucs-11 - sindh - karachi - baldia - islam_nagar - - - static_instance-ucs-12 - sindh - karachi - baldia - nai_abadi - - - static_instance-ucs-13 - sindh - karachi - baldia - saeedabad - - - static_instance-ucs-14 - sindh - karachi - baldia - muslim_mujahid_colony - - - static_instance-ucs-15 - sindh - karachi - baldia - muhajir_camp - - - static_instance-ucs-16 - sindh - karachi - baldia - rasheedabad - - - static_instance-ucs-17 - sindh - karachi - bin_qasim - ibrahim_hyderi - - - static_instance-ucs-18 - sindh - karachi - bin_qasim - rehri - - - static_instance-ucs-19 - sindh - karachi - bin_qasim - cattle_colony - - - static_instance-ucs-20 - sindh - karachi - bin_qasim - qaidabad - - - static_instance-ucs-21 - sindh - karachi - bin_qasim - landhi_colony - - - static_instance-ucs-22 - sindh - karachi - bin_qasim - gulshan_e_hadeed - - - static_instance-ucs-23 - sindh - karachi - bin_qasim - gaghar - - - static_instance-ucs-24 - sindh - karachi - gadap - murad_memon_goth - - - static_instance-ucs-25 - sindh - karachi - gadap - darsano_chana - - - static_instance-ucs-26 - sindh - karachi - gadap - gujro - - - static_instance-ucs-27 - sindh - karachi - gadap - songal - - - static_instance-ucs-28 - sindh - karachi - gadap - maymarabad - - - static_instance-ucs-29 - sindh - karachi - gadap - yousuf_goth - - - static_instance-ucs-30 - sindh - karachi - gadap - manghopir - - - static_instance-ucs-31 - sindh - karachi - gulberg - azizabad - - - static_instance-ucs-32 - sindh - karachi - gulberg - karimabad - - - static_instance-ucs-33 - sindh - karachi - gulberg - aisha_manzil - - - static_instance-ucs-34 - sindh - karachi - gulberg - ancholi - - - static_instance-ucs-35 - sindh - karachi - gulberg - naseerabad - - - static_instance-ucs-36 - sindh - karachi - gulberg - yaseenabad - - - static_instance-ucs-37 - sindh - karachi - gulberg - water_pump - - - static_instance-ucs-38 - sindh - karachi - gulberg - shafiq_mill_colony - - - static_instance-ucs-39 - sindh - karachi - gulshan - delhi_mercantile_society - - - static_instance-ucs-40 - sindh - karachi - gulshan - civic_centre - - - static_instance-ucs-41 - sindh - karachi - gulshan - pir_ilahi_buksh_colony - - - static_instance-ucs-42 - sindh - karachi - gulshan - essa_nagri - - - static_instance-ucs-43 - sindh - karachi - gulshan - gulshan_e_iqbal - - - static_instance-ucs-44 - sindh - karachi - gulshan - gillani_railway_station - - - static_instance-ucs-45 - sindh - karachi - gulshan - shanti_nagar - - - static_instance-ucs-46 - sindh - karachi - gulshan - jamali_colony - - - static_instance-ucs-47 - sindh - karachi - gulshan - gulshan_e_iqbal_ii - - - static_instance-ucs-48 - sindh - karachi - gulshan - pehlwan_goth - - - static_instance-ucs-49 - sindh - karachi - gulshan - matrovil_colony - - - static_instance-ucs-50 - sindh - karachi - gulshan - gulzar_e_hijri - - - static_instance-ucs-51 - sindh - karachi - gulshan - safooran_goth - - - static_instance-ucs-52 - sindh - karachi - jamshed - akhtar_colony - - - static_instance-ucs-53 - sindh - karachi - jamshed - manzoor_colony - - - static_instance-ucs-54 - sindh - karachi - jamshed - azam_basti - - - static_instance-ucs-55 - sindh - karachi - jamshed - chanesar_goth - - - static_instance-ucs-56 - sindh - karachi - jamshed - mahmudabad - - - static_instance-ucs-57 - sindh - karachi - jamshed - pechs - - - static_instance-ucs-58 - sindh - karachi - jamshed - pechs_ii - - - static_instance-ucs-59 - sindh - karachi - jamshed - jut_line - - - static_instance-ucs-60 - sindh - karachi - jamshed - central_jacob_lines - - - static_instance-ucs-61 - sindh - karachi - jamshed - jamshed_quarters - - - static_instance-ucs-62 - sindh - karachi - jamshed - garden_east - - - static_instance-ucs-63 - sindh - karachi - jamshed - soldier_bazar - - - static_instance-ucs-64 - sindh - karachi - jamshed - pakistan_quarters - - - static_instance-ucs-65 - sindh - karachi - kiamari - bhutta_village - - - static_instance-ucs-66 - sindh - karachi - kiamari - sultanabad - - - static_instance-ucs-67 - sindh - karachi - kiamari - kiamari_uc - - - static_instance-ucs-68 - sindh - karachi - kiamari - baba_bhit - - - static_instance-ucs-69 - sindh - karachi - kiamari - machar_colony - - - static_instance-ucs-70 - sindh - karachi - kiamari - maripur - - - static_instance-ucs-71 - sindh - karachi - kiamari - shershah - - - static_instance-ucs-72 - sindh - karachi - kiamari - gabo_pat - - - static_instance-ucs-73 - sindh - karachi - landhi - muzafarabad - - - static_instance-ucs-74 - sindh - karachi - landhi - muslimabad - - - static_instance-ucs-75 - sindh - karachi - landhi - dawood_chowrangi - - - static_instance-ucs-76 - sindh - karachi - landhi - moinabad - - - static_instance-ucs-77 - sindh - karachi - landhi - sharafi_goth - - - static_instance-ucs-78 - sindh - karachi - landhi - bhutto_nagar - - - static_instance-ucs-79 - sindh - karachi - landhi - khawaja_ajmeer_colony - - - static_instance-ucs-80 - sindh - karachi - landhi - landhi_uc - - - static_instance-ucs-81 - sindh - karachi - landhi - awami_colony - - - static_instance-ucs-82 - sindh - karachi - landhi - burmee_colony - - - static_instance-ucs-83 - sindh - karachi - landhi - korangi_uc - - - static_instance-ucs-84 - sindh - karachi - landhi - sherabad - - - static_instance-ucs-85 - sindh - karachi - liaquatabad - rizvia_society - - - static_instance-ucs-86 - sindh - karachi - liaquatabad - firdous_colony - - - static_instance-ucs-87 - sindh - karachi - liaquatabad - super_market - - - static_instance-ucs-88 - sindh - karachi - liaquatabad - dak_khana - - - static_instance-ucs-89 - sindh - karachi - liaquatabad - qasimabad - - - static_instance-ucs-90 - sindh - karachi - liaquatabad - bandhani_colony - - - static_instance-ucs-91 - sindh - karachi - liaquatabad - sharifabad - - - static_instance-ucs-92 - sindh - karachi - liaquatabad - commercial_area - - - static_instance-ucs-93 - sindh - karachi - liaquatabad - mujahid_colony - - - static_instance-ucs-94 - sindh - karachi - liaquatabad - nazimabad - - - static_instance-ucs-95 - sindh - karachi - liaquatabad - abbasi_shaheed - - - static_instance-ucs-96 - sindh - karachi - lyari - agra_taj_colony - - - static_instance-ucs-97 - sindh - karachi - lyari - daryaabad - - - static_instance-ucs-98 - sindh - karachi - lyari - nawabad - - - static_instance-ucs-99 - sindh - karachi - lyari - khada_memon_society - - - static_instance-ucs-100 - sindh - karachi - lyari - baghdadi - - - static_instance-ucs-101 - sindh - karachi - lyari - shah_baig_line - - - static_instance-ucs-102 - sindh - karachi - lyari - bihar_colony - - - static_instance-ucs-103 - sindh - karachi - lyari - ragiwara - - - static_instance-ucs-104 - sindh - karachi - lyari - singo_line - - - static_instance-ucs-105 - sindh - karachi - lyari - chakiwara - - - static_instance-ucs-106 - sindh - karachi - lyari - allama_iqbal_colony - - - static_instance-ucs-107 - sindh - karachi - malir - model_colony - - - static_instance-ucs-108 - sindh - karachi - malir - kala_board - - - static_instance-ucs-109 - sindh - karachi - malir - saudabad - - - static_instance-ucs-110 - sindh - karachi - malir - khokhra_par - - - static_instance-ucs-111 - sindh - karachi - malir - jafar_e_tayyar - - - static_instance-ucs-112 - sindh - karachi - malir - gharibabad - - - static_instance-ucs-113 - sindh - karachi - malir - ghazi_brohi_goth - - - static_instance-ucs-114 - sindh - karachi - new_karachi - kalyana - - - static_instance-ucs-115 - sindh - karachi - new_karachi - sir_syed_colony - - - static_instance-ucs-116 - sindh - karachi - new_karachi - fatima_jinnah_colony - - - static_instance-ucs-117 - sindh - karachi - new_karachi - godhra - - - static_instance-ucs-118 - sindh - karachi - new_karachi - abu_zar_ghaffari - - - static_instance-ucs-119 - sindh - karachi - new_karachi - hakim_ahsan - - - static_instance-ucs-120 - sindh - karachi - new_karachi - madina_colony - - - static_instance-ucs-121 - sindh - karachi - new_karachi - faisal_colony - - - static_instance-ucs-122 - sindh - karachi - new_karachi - khamiso_goth - - - static_instance-ucs-123 - sindh - karachi - new_karachi - mustufa_colony - - - static_instance-ucs-124 - sindh - karachi - new_karachi - khawaja_ajmeer_nagri - - - static_instance-ucs-125 - sindh - karachi - new_karachi - gulshan_e_saeed - - - static_instance-ucs-126 - sindh - karachi - new_karachi - shah_nawaz_bhutto_colony - - - static_instance-ucs-127 - sindh - karachi - north_nazimabad - paposh_nagar - - - static_instance-ucs-128 - sindh - karachi - north_nazimabad - pahar_ganj - - - static_instance-ucs-129 - sindh - karachi - north_nazimabad - khandu_goth - - - static_instance-ucs-130 - sindh - karachi - north_nazimabad - hyderi - - - static_instance-ucs-131 - sindh - karachi - north_nazimabad - sakhi_hassan - - - static_instance-ucs-132 - sindh - karachi - north_nazimabad - farooq_e_azam - - - static_instance-ucs-133 - sindh - karachi - north_nazimabad - nusrat_bhutto_colony - - - static_instance-ucs-134 - sindh - karachi - north_nazimabad - shadman_town - - - static_instance-ucs-135 - sindh - karachi - north_nazimabad - buffer_zone - - - static_instance-ucs-136 - sindh - karachi - north_nazimabad - buffer_zone_ii - - - static_instance-ucs-137 - sindh - karachi - orangi - mominabad - - - static_instance-ucs-138 - sindh - karachi - orangi - haryana_colony - - - static_instance-ucs-139 - sindh - karachi - orangi - hanifabad - - - static_instance-ucs-140 - sindh - karachi - orangi - mohammad_nagar - - - static_instance-ucs-141 - sindh - karachi - orangi - madina_colony_orangi - - - static_instance-ucs-142 - sindh - karachi - orangi - ghaziabad - - - static_instance-ucs-143 - sindh - karachi - orangi - chisti_nagar - - - static_instance-ucs-144 - sindh - karachi - orangi - bilal_colony_orangi - - - static_instance-ucs-145 - sindh - karachi - orangi - iqbal_baloch_colony - - - static_instance-ucs-146 - sindh - karachi - orangi - ghabool_town - - - static_instance-ucs-147 - sindh - karachi - orangi - data_nagar - - - static_instance-ucs-148 - sindh - karachi - orangi - mujahidabad - - - static_instance-ucs-149 - sindh - karachi - orangi - baloch_goth - - - static_instance-ucs-150 - sindh - karachi - saddar - old_haji_camp - - - static_instance-ucs-151 - sindh - karachi - saddar - garden - - - static_instance-ucs-152 - sindh - karachi - saddar - kharadar - - - static_instance-ucs-153 - sindh - karachi - saddar - city_railway_colony - - - static_instance-ucs-154 - sindh - karachi - saddar - nanak_wara - - - static_instance-ucs-155 - sindh - karachi - saddar - gazdarabad - - - static_instance-ucs-156 - sindh - karachi - saddar - millat_nagar_islam_pura - - - static_instance-ucs-157 - sindh - karachi - saddar - saddar_uc - - - static_instance-ucs-158 - sindh - karachi - saddar - civil_line - - - static_instance-ucs-159 - sindh - karachi - saddar - clifton - - - static_instance-ucs-160 - sindh - karachi - saddar - kehkashan - - - static_instance-ucs-161 - sindh - karachi - shah_faisal - natha_khan_goth - - - static_instance-ucs-162 - sindh - karachi - shah_faisal - pak_sadat_colony - - - static_instance-ucs-163 - sindh - karachi - shah_faisal - drigh_colony - - - static_instance-ucs-164 - sindh - karachi - shah_faisal - raita_plot - - - static_instance-ucs-165 - sindh - karachi - shah_faisal - moria_khan_goth - - - static_instance-ucs-166 - sindh - karachi - shah_faisal - rafa_e_aam_society - - - static_instance-ucs-167 - sindh - karachi - shah_faisal - al_falah_society - - - static_instance-ucs-168 - sindh - karachi - site - pak_colony - - - static_instance-ucs-169 - sindh - karachi - site - old_golimar - - - static_instance-ucs-170 - sindh - karachi - site - jahanabad - - - static_instance-ucs-171 - sindh - karachi - site - metrovil - - - static_instance-ucs-172 - sindh - karachi - site - bhawani_chali - - - static_instance-ucs-173 - sindh - karachi - site - frontier_colony - - - static_instance-ucs-174 - sindh - karachi - site - banaras_colony - - - static_instance-ucs-175 - sindh - karachi - site - qasba_colony - - - static_instance-ucs-176 - sindh - karachi - site - islamia_colony - - - static_instance-ucs-177 - na - na - na - other - - - static_instance-ucs-178 - na - na - na - not_applicable - - - - - - - static_instance-gender-0 - male - - - static_instance-gender-1 - female - - - static_instance-gender-2 - transgender - - - - - - - static_instance-vaccines-0 - bcg - - - static_instance-vaccines-1 - opv0 - - - static_instance-vaccines-2 - pcv1 - - - static_instance-vaccines-3 - opv1 - - - static_instance-vaccines-4 - penta1 - - - static_instance-vaccines-5 - pcv2 - - - static_instance-vaccines-6 - opv2 - - - static_instance-vaccines-7 - penta2 - - - static_instance-vaccines-8 - pcv3 - - - static_instance-vaccines-9 - opv3 - - - static_instance-vaccines-10 - penta3 - - - static_instance-vaccines-11 - ipv - - - static_instance-vaccines-12 - measles1 - - - static_instance-vaccines-13 - measles2 - - - - - - - static_instance-towns-0 - sindh - karachi - korangi - - - static_instance-towns-1 - sindh - karachi - landhi - - - static_instance-towns-2 - sindh - karachi - baldia - - - static_instance-towns-3 - sindh - karachi - bin_qasim - - - static_instance-towns-4 - sindh - karachi - gadap - - - static_instance-towns-5 - sindh - karachi - gulberg - - - static_instance-towns-6 - sindh - karachi - gulshan - - - static_instance-towns-7 - sindh - karachi - jamshed - - - static_instance-towns-8 - sindh - karachi - kiamari - - - static_instance-towns-9 - sindh - karachi - liaquatabad - - - static_instance-towns-10 - sindh - karachi - lyari - - - static_instance-towns-11 - sindh - karachi - malir - - - static_instance-towns-12 - sindh - karachi - new_karachi - - - static_instance-towns-13 - sindh - karachi - north_nazimabad - - - static_instance-towns-14 - sindh - karachi - orangi - - - static_instance-towns-15 - sindh - karachi - saddar - - - static_instance-towns-16 - sindh - karachi - shah_faisal - - - static_instance-towns-17 - sindh - karachi - site - - - static_instance-towns-18 - na - na - other - - - static_instance-towns-19 - na - na - not_applicable - - - - - - - static_instance-cities-0 - sindh - karachi - - - static_instance-cities-1 - punjab - hafizabad - - - static_instance-cities-2 - punjab - muzaffargarh - - - static_instance-cities-3 - na - other - - - static_instance-cities-4 - na - not_applicable - - - - - - - static_instance-ethnicity-0 - punjabi - - - static_instance-ethnicity-1 - pushtuns - - - static_instance-ethnicity-2 - sindhi - - - static_instance-ethnicity-3 - saraiki - - - static_instance-ethnicity-4 - muhajir - - - static_instance-ethnicity-5 - balochi - - - static_instance-ethnicity-6 - other - - - - - - - static_instance-yes_no-0 - yes - - - static_instance-yes_no-1 - no - - - - diff --git a/opensrp-core/src/test/resources/form/child_followup/form.json b/opensrp-core/src/test/resources/form/child_followup/form.json deleted file mode 100644 index 2b0c04a8e9..0000000000 --- a/opensrp-core/src/test/resources/form/child_followup/form.json +++ /dev/null @@ -1,4165 +0,0 @@ -{ - "name": "Child_Vaccination_Followup", - "title": "بچّوں کا فالو اپ رجسٹر برائے ٹیکاجات - Child Follow Up Vaccination Register", - "sms_keyword": "child_vaccination_followup", - "default_language": "English", - "choices": { - "provinces": [ - { - "name": "kpk", - "label": { - "Urdu": "خیبر پختون خواہ", - "English": "Khyber Pakhtunkhwa", - "Roman Urdu": "Khyber Pakhtunkhwa" - } - }, - { - "name": "sindh", - "label": { - "Urdu": "سندھ", - "English": "Sindh", - "Roman Urdu": "Sindh" - } - }, - { - "name": "balochistan", - "label": { - "Urdu": "بلوچستان", - "English": "Balochistan", - "Roman Urdu": "Balochistan" - } - }, - { - "name": "punjab", - "label": { - "Urdu": "پنجاب", - "English": "Punjab", - "Roman Urdu": "Punjab" - } - }, - { - "name": "gilgit_baltistan", - "label": { - "Urdu": "گلگت بلتستان", - "English": "Gilgit Baltistan", - "Roman Urdu": "Gilgit Baltistan" - } - }, - { - "name": "kashmir", - "label": { - "Urdu": "کشمیر", - "English": "Kashmir", - "Roman Urdu": "Kashmir" - } - }, - { - "name": "fata", - "label": { - "Urdu": "فاٹا", - "English": "FATA", - "Roman Urdu": "FATA" - } - }, - { - "name": "out_of_country", - "label": { - "Urdu": "ملک سے باہر", - "English": "Out of Country", - "Roman Urdu": "Out of Country" - } - } - ], - "ucs": [ - { - "province": "sindh", - "city": "karachi", - "town": "korangi", - "name": "bilal_colony", - "label": { - "Urdu": "بلال کالونی", - "Roman Urdu": "Bilal Colony", - "English": "Bilal Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "korangi", - "name": "nasir_colony", - "label": { - "Urdu": "ناصر کالونی", - "Roman Urdu": "Nasir Colony", - "English": "Nasir Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "korangi", - "name": "chakra_goth", - "label": { - "Urdu": "چکرا گوٹھ", - "Roman Urdu": "Chakra Goth", - "English": "Chakra Goth" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "korangi", - "name": "mustafa_taj_colony", - "label": { - "Urdu": "مصطفی تاج کالونی", - "Roman Urdu": "Mustafa Taj Colony", - "English": "Mustafa Taj Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "korangi", - "name": "hundred_quarters", - "label": { - "Urdu": "ہنڈریڈ کوارٹر", - "Roman Urdu": "Hundred Quarters", - "English": "Hundred Quarters" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "korangi", - "name": "gulzar_colony", - "label": { - "Urdu": "گلزار کالونی", - "Roman Urdu": "Gulzar Colony", - "English": "Gulzar Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "korangi", - "name": "korangi_sector_33", - "label": { - "Urdu": "کورنگی سیکٹر 33", - "Roman Urdu": "Korangi Sector 33", - "English": "Korangi Sector 33" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "korangi", - "name": "zaman_town", - "label": { - "Urdu": "زمان ٹاوَن", - "Roman Urdu": "Zaman Town", - "English": "Zaman Town" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "korangi", - "name": "hasrat_mohani_colony", - "label": { - "Urdu": "حسرت موہانی کالونی", - "Roman Urdu": "Hasrat Mohani Colony", - "English": "Hasrat Mohani Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "baldia", - "name": "gulshan_e_ghazi", - "label": { - "Urdu": "گلشن غازی", - "Roman Urdu": "Gulshan-e-Ghazi", - "English": "Gulshan-e-Ghazi" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "baldia", - "name": "ittehad_town", - "label": { - "Urdu": "اتحاد ٹاوَن", - "Roman Urdu": "Ittehad Town", - "English": "Ittehad Town" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "baldia", - "name": "islam_nagar", - "label": { - "Urdu": "اسلام نگر", - "Roman Urdu": "Islam Nagar", - "English": "Islam Nagar" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "baldia", - "name": "nai_abadi", - "label": { - "Urdu": "نئی آبادی", - "Roman Urdu": "Nai Abadi", - "English": "Nai Abadi" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "baldia", - "name": "saeedabad", - "label": { - "Urdu": "سعید آباد", - "Roman Urdu": "Saeedabad", - "English": "Saeedabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "baldia", - "name": "muslim_mujahid_colony", - "label": { - "Urdu": "مسلم مجاہد کالونی", - "Roman Urdu": "Muslim Mujahid Colony", - "English": "Muslim Mujahid Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "baldia", - "name": "muhajir_camp", - "label": { - "Urdu": "مہاجر کیمپ", - "Roman Urdu": "Muhajir Camp", - "English": "Muhajir Camp" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "baldia", - "name": "rasheedabad", - "label": { - "Urdu": "رشید آباد", - "Roman Urdu": "Rasheedabad", - "English": "Rasheedabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "bin_qasim", - "name": "ibrahim_hyderi", - "label": { - "Urdu": "ابراہیم حیدری", - "Roman Urdu": "Ibrahim Hyderi", - "English": "Ibrahim Hyderi" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "bin_qasim", - "name": "rehri", - "label": { - "Urdu": "رہڑی", - "Roman Urdu": "Rehri", - "English": "Rehri" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "bin_qasim", - "name": "cattle_colony", - "label": { - "Urdu": "کیٹل کالونی", - "Roman Urdu": "Cattle Colony", - "English": "Cattle Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "bin_qasim", - "name": "qaidabad", - "label": { - "Urdu": "قائدآباد", - "Roman Urdu": "Qaidabad", - "English": "Qaidabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "bin_qasim", - "name": "landhi_colony", - "label": { - "Urdu": "لانڈھی کالونی", - "Roman Urdu": "Landhi Colony", - "English": "Landhi Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "bin_qasim", - "name": "gulshan_e_hadeed", - "label": { - "Urdu": "گلشن حدید", - "Roman Urdu": "Gulshan-e-Hadeed", - "English": "Gulshan-e-Hadeed" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "bin_qasim", - "name": "gaghar", - "label": { - "Urdu": "گگر", - "Roman Urdu": "Gaghar", - "English": "Gaghar" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gadap", - "name": "murad_memon_goth", - "label": { - "Urdu": "مراد میمن گوٹھ", - "Roman Urdu": "Murad Memon Goth", - "English": "Murad Memon Goth" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gadap", - "name": "darsano_chana", - "label": { - "Urdu": "درشانو شنو", - "Roman Urdu": "Darsano Chana", - "English": "Darsano Chana" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gadap", - "name": "gujro", - "label": { - "Urdu": "گجرو", - "Roman Urdu": "Gujro", - "English": "Gujro" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gadap", - "name": "songal", - "label": { - "Urdu": "سنگل", - "Roman Urdu": "Songal", - "English": "Songal" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gadap", - "name": "maymarabad", - "label": { - "Urdu": "معمار آباد", - "Roman Urdu": "Maymarabad", - "English": "Maymarabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gadap", - "name": "yousuf_goth", - "label": { - "Urdu": "یوسف گوٹھ", - "Roman Urdu": "Yousuf Goth", - "English": "Yousuf Goth" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gadap", - "name": "manghopir", - "label": { - "Urdu": "منگھوپیر", - "Roman Urdu": "Manghopir", - "English": "Manghopir" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulberg", - "name": "azizabad", - "label": { - "Urdu": "عزیز آباد", - "Roman Urdu": "Azizabad", - "English": "Azizabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulberg", - "name": "karimabad", - "label": { - "Urdu": "کریم آباد", - "Roman Urdu": "Karimabad", - "English": "Karimabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulberg", - "name": "aisha_manzil", - "label": { - "Urdu": "عائشہ منزل", - "Roman Urdu": "Aisha Manzil", - "English": "Aisha Manzil" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulberg", - "name": "ancholi", - "label": { - "Urdu": "انچولی", - "Roman Urdu": "Ancholi", - "English": "Ancholi" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulberg", - "name": "naseerabad", - "label": { - "Urdu": "نصیرآباد", - "Roman Urdu": "Naseerabad", - "English": "Naseerabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulberg", - "name": "yaseenabad", - "label": { - "Urdu": "یاسین آباد", - "Roman Urdu": "Yaseenabad", - "English": "Yaseenabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulberg", - "name": "water_pump", - "label": { - "Urdu": "واٹرپمپ", - "Roman Urdu": "Water Pump", - "English": "Water Pump" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulberg", - "name": "shafiq_mill_colony", - "label": { - "Urdu": "شفیق مل کالونی", - "Roman Urdu": "Shafiq Mill Colony", - "English": "Shafiq Mill Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulshan", - "name": "delhi_mercantile_society", - "label": { - "Urdu": "دہلی مرچنٹائل سوسائٹی", - "Roman Urdu": "Delhi Mercantile Society", - "English": "Delhi Mercantile Society" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulshan", - "name": "civic_centre", - "label": { - "Urdu": "سوک سینٹر", - "Roman Urdu": "Civic Centre", - "English": "Civic Centre" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulshan", - "name": "pir_ilahi_buksh_colony", - "label": { - "Urdu": "پیر الہی بخش کالونی", - "Roman Urdu": "Pir Ilahi Buksh Colony", - "English": "Pir Ilahi Buksh Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulshan", - "name": "essa_nagri", - "label": { - "Urdu": "عیسی نگری", - "Roman Urdu": "Essa Nagri", - "English": "Essa Nagri" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulshan", - "name": "gulshan_e_iqbal", - "label": { - "Urdu": "گلشن اقبال", - "Roman Urdu": "Gulshan-e-Iqbal", - "English": "Gulshan-e-Iqbal" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulshan", - "name": "gillani_railway_station", - "label": { - "Urdu": "گیلانی ریلوے اسٹیشن", - "Roman Urdu": "Gillani Railway Station", - "English": "Gillani Railway Station" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulshan", - "name": "shanti_nagar", - "label": { - "Urdu": "شانتی نگر", - "Roman Urdu": "Shanti Nagar", - "English": "Shanti Nagar" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulshan", - "name": "jamali_colony", - "label": { - "Urdu": "جمالی کالونی", - "Roman Urdu": "Jamali Colony", - "English": "Jamali Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulshan", - "name": "gulshan_e_iqbal_ii", - "label": { - "Urdu": "گلشن اقبال 2", - "Roman Urdu": "Gulshan-e-Iqbal II", - "English": "Gulshan-e-Iqbal II" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulshan", - "name": "pehlwan_goth", - "label": { - "Urdu": "پہلوان گوٹھ", - "Roman Urdu": "Pehlwan Goth", - "English": "Pehlwan Goth" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulshan", - "name": "matrovil_colony", - "label": { - "Urdu": "میٹروویل کالونی", - "Roman Urdu": "Matrovil Colony", - "English": "Matrovil Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulshan", - "name": "gulzar_e_hijri", - "label": { - "Urdu": "گلزار ہجری", - "Roman Urdu": "Gulzar-e-Hijri", - "English": "Gulzar-e-Hijri" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "gulshan", - "name": "safooran_goth", - "label": { - "Urdu": "صفورا گوٹھ", - "Roman Urdu": "Safooran Goth", - "English": "Safooran Goth" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "jamshed", - "name": "akhtar_colony", - "label": { - "Urdu": "اختر کالونی", - "Roman Urdu": "Akhtar Colony", - "English": "Akhtar Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "jamshed", - "name": "manzoor_colony", - "label": { - "Urdu": "منظور کالونی", - "Roman Urdu": "Manzoor Colony", - "English": "Manzoor Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "jamshed", - "name": "azam_basti", - "label": { - "Urdu": "اعظم بستی", - "Roman Urdu": "Azam Basti", - "English": "Azam Basti" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "jamshed", - "name": "chanesar_goth", - "label": { - "Urdu": "چنیسر گوٹھ", - "Roman Urdu": "Chanesar Goth", - "English": "Chanesar Goth" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "jamshed", - "name": "mahmudabad", - "label": { - "Urdu": "محمودآباد", - "Roman Urdu": "Mahmudabad", - "English": "Mahmudabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "jamshed", - "name": "pechs", - "label": { - "Urdu": "پی۔ای۔سی۔ایچ۔ایس", - "Roman Urdu": "P.E.C.H.S.", - "English": "P.E.C.H.S." - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "jamshed", - "name": "pechs_ii", - "label": { - "Urdu": "پی۔ای۔سی۔ایچ۔ایس 2", - "Roman Urdu": "P.E.C.H.S. II", - "English": "P.E.C.H.S. II" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "jamshed", - "name": "jut_line", - "label": { - "Urdu": "جٹ لائن", - "Roman Urdu": "Jut Line", - "English": "Jut Line" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "jamshed", - "name": "central_jacob_lines", - "label": { - "Urdu": "سینٹرل جیکب لائن", - "Roman Urdu": "Central Jacob Lines", - "English": "Central Jacob Lines" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "jamshed", - "name": "jamshed_quarters", - "label": { - "Urdu": "جمشید کوارٹر", - "Roman Urdu": "Jamshed Quarters", - "English": "Jamshed Quarters" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "jamshed", - "name": "garden_east", - "label": { - "Urdu": "گارڈن ایسٹ", - "Roman Urdu": "Garden East", - "English": "Garden East" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "jamshed", - "name": "soldier_bazar", - "label": { - "Urdu": "سولجر بازار", - "Roman Urdu": "Soldier Bazar", - "English": "Soldier Bazar" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "jamshed", - "name": "pakistan_quarters", - "label": { - "Urdu": "پاکستان کوارٹر", - "Roman Urdu": "Pakistan Quarters", - "English": "Pakistan Quarters" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "kiamari", - "name": "bhutta_village", - "label": { - "Urdu": "بھٹا ولیج", - "Roman Urdu": "Bhutta Village", - "English": "Bhutta Village" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "kiamari", - "name": "sultanabad", - "label": { - "Urdu": "سلطان آباد", - "Roman Urdu": "Sultanabad", - "English": "Sultanabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "kiamari", - "name": "kiamari_uc", - "label": { - "Urdu": "کیماری یو- سی", - "Roman Urdu": "Kiamari UC", - "English": "Kiamari UC" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "kiamari", - "name": "baba_bhit", - "label": { - "Urdu": "بابا بھٹ", - "Roman Urdu": "Baba Bhit", - "English": "Baba Bhit" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "kiamari", - "name": "machar_colony", - "label": { - "Urdu": "مچھر کالونی", - "Roman Urdu": "Machar Colony", - "English": "Machar Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "kiamari", - "name": "maripur", - "label": { - "Urdu": "ماڑی پور", - "Roman Urdu": "Maripur", - "English": "Maripur" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "kiamari", - "name": "shershah", - "label": { - "Urdu": "شیرشاہ", - "Roman Urdu": "SherShah", - "English": "SherShah" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "kiamari", - "name": "gabo_pat", - "label": { - "Urdu": "گابو پٹ", - "Roman Urdu": "Gabo Pat", - "English": "Gabo Pat" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "landhi", - "name": "muzafarabad", - "label": { - "Urdu": "مظفرآباد", - "Roman Urdu": "Muzafarabad", - "English": "Muzafarabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "landhi", - "name": "muslimabad", - "label": { - "Urdu": "مسلم آباد", - "Roman Urdu": "Muslimabad", - "English": "Muslimabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "landhi", - "name": "dawood_chowrangi", - "label": { - "Urdu": "داوَد چورنگی", - "Roman Urdu": "Dawood Chowrangi", - "English": "Dawood Chowrangi" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "landhi", - "name": "moinabad", - "label": { - "Urdu": "معین آباد", - "Roman Urdu": "Moinabad", - "English": "Moinabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "landhi", - "name": "sharafi_goth", - "label": { - "Urdu": "شرافی گوٹھ", - "Roman Urdu": "Sharafi Goth", - "English": "Sharafi Goth" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "landhi", - "name": "bhutto_nagar", - "label": { - "Urdu": "بھٹو نگر", - "Roman Urdu": "Bhutto Nagar", - "English": "Bhutto Nagar" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "landhi", - "name": "khawaja_ajmeer_colony", - "label": { - "Urdu": "خواجہ اجمیر کالونی", - "Roman Urdu": "Khawaja Ajmeer Colony", - "English": "Khawaja Ajmeer Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "landhi", - "name": "landhi_uc", - "label": { - "Urdu": "لانڈھی یوسی", - "Roman Urdu": "Landhi UC", - "English": "Landhi UC" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "landhi", - "name": "awami_colony", - "label": { - "Urdu": "عوامی کالونی", - "Roman Urdu": "Awami Colony", - "English": "Awami Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "landhi", - "name": "burmee_colony", - "label": { - "Urdu": "برمی کالونی", - "Roman Urdu": "Burmee Colony", - "English": "Burmee Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "landhi", - "name": "korangi_uc", - "label": { - "Urdu": "کورنگی یوسی", - "Roman Urdu": "Korangi UC", - "English": "Korangi UC" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "landhi", - "name": "sherabad", - "label": { - "Urdu": "شیرآباد", - "Roman Urdu": "Sherabad", - "English": "Sherabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "liaquatabad", - "name": "rizvia_society", - "label": { - "Urdu": "رضویہ سوسائٹی", - "Roman Urdu": "Rizvia Society", - "English": "Rizvia Society" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "liaquatabad", - "name": "firdous_colony", - "label": { - "Urdu": "فردوس کالونی", - "Roman Urdu": "Firdous Colony", - "English": "Firdous Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "liaquatabad", - "name": "super_market", - "label": { - "Urdu": "سپر مارکیٹ", - "Roman Urdu": "Super Market", - "English": "Super Market" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "liaquatabad", - "name": "dak_khana", - "label": { - "Urdu": "دک کھانہ", - "Roman Urdu": "Dak Khana", - "English": "Dak Khana" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "liaquatabad", - "name": "qasimabad", - "label": { - "Urdu": "قاسم آباد", - "Roman Urdu": "Qasimabad", - "English": "Qasimabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "liaquatabad", - "name": "bandhani_colony", - "label": { - "Urdu": "بندھانی کالونی", - "Roman Urdu": "Bandhani Colony", - "English": "Bandhani Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "liaquatabad", - "name": "sharifabad", - "label": { - "Urdu": "شریف آباد", - "Roman Urdu": "Sharifabad", - "English": "Sharifabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "liaquatabad", - "name": "commercial_area", - "label": { - "Urdu": "کمرشل ایریا", - "Roman Urdu": "Commercial Area", - "English": "Commercial Area" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "liaquatabad", - "name": "mujahid_colony", - "label": { - "Urdu": "مجاہد کالونی", - "Roman Urdu": "Mujahid Colony", - "English": "Mujahid Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "liaquatabad", - "name": "nazimabad", - "label": { - "Urdu": "ناظم آباد", - "Roman Urdu": "Nazimabad", - "English": "Nazimabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "liaquatabad", - "name": "abbasi_shaheed", - "label": { - "Urdu": "عباسی شہید", - "Roman Urdu": "Abbasi Shaheed", - "English": "Abbasi Shaheed" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "lyari", - "name": "agra_taj_colony", - "label": { - "Urdu": "آگرہ تاج کالونی", - "Roman Urdu": "Agra Taj Colony", - "English": "Agra Taj Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "lyari", - "name": "daryaabad", - "label": { - "Urdu": "دریاآباد", - "Roman Urdu": "Daryaabad", - "English": "Daryaabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "lyari", - "name": "nawabad", - "label": { - "Urdu": "نواآباد", - "Roman Urdu": "Nawabad", - "English": "Nawabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "lyari", - "name": "khada_memon_society", - "label": { - "Urdu": "خدا- میمن- سوساَٹی", - "Roman Urdu": "Khada Memon Society", - "English": "Khada Memon Society" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "lyari", - "name": "baghdadi", - "label": { - "Urdu": "بغدادی", - "Roman Urdu": "Baghdadi", - "English": "Baghdadi" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "lyari", - "name": "shah_baig_line", - "label": { - "Urdu": "شاھ باغ لائن", - "Roman Urdu": "Shah Baig Line", - "English": "Shah Baig Line" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "lyari", - "name": "bihar_colony", - "label": { - "Urdu": "بہار کالونی", - "Roman Urdu": "Bihar Colony", - "English": "Bihar Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "lyari", - "name": "ragiwara", - "label": { - "Urdu": "راگی واڑا", - "Roman Urdu": "Ragiwara", - "English": "Ragiwara" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "lyari", - "name": "singo_line", - "label": { - "Urdu": "سنگولائن", - "Roman Urdu": "Singo Line", - "English": "Singo Line" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "lyari", - "name": "chakiwara", - "label": { - "Urdu": "چاکی واڑا", - "Roman Urdu": "Chakiwara", - "English": "Chakiwara" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "lyari", - "name": "allama_iqbal_colony", - "label": { - "Urdu": "علامہ اقبال کالونی", - "Roman Urdu": "Allama Iqbal Colony", - "English": "Allama Iqbal Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "malir", - "name": "model_colony", - "label": { - "Urdu": "موڈل کالونی", - "Roman Urdu": "Model Colony", - "English": "Model Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "malir", - "name": "kala_board", - "label": { - "Urdu": "کالا بورڈ", - "Roman Urdu": "Kala Board", - "English": "Kala Board" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "malir", - "name": "saudabad", - "label": { - "Urdu": "سعودآباد", - "Roman Urdu": "Saudabad", - "English": "Saudabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "malir", - "name": "khokhra_par", - "label": { - "Urdu": "کھوکھرا پار", - "Roman Urdu": "Khokhra Par", - "English": "Khokhra Par" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "malir", - "name": "jafar_e_tayyar", - "label": { - "Urdu": "جعفر تیار", - "Roman Urdu": "Jafar-e-Tayyar", - "English": "Jafar-e-Tayyar" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "malir", - "name": "gharibabad", - "label": { - "Urdu": "غریب آباد", - "Roman Urdu": "Gharibabad", - "English": "Gharibabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "malir", - "name": "ghazi_brohi_goth", - "label": { - "Urdu": "غازی بروہی گوٹھ", - "Roman Urdu": "Ghazi Brohi Goth", - "English": "Ghazi Brohi Goth" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "new_karachi", - "name": "kalyana", - "label": { - "Urdu": "کالیانہ", - "Roman Urdu": "Kalyana", - "English": "Kalyana" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "new_karachi", - "name": "sir_syed_colony", - "label": { - "Urdu": "سر سید کالونی", - "Roman Urdu": "Sir Syed Colony", - "English": "Sir Syed Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "new_karachi", - "name": "fatima_jinnah_colony", - "label": { - "Urdu": "فاطمہ جناح کالونی", - "Roman Urdu": "Fatima Jinnah Colony", - "English": "Fatima Jinnah Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "new_karachi", - "name": "godhra", - "label": { - "Urdu": "گودھرا", - "Roman Urdu": "Godhra", - "English": "Godhra" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "new_karachi", - "name": "abu_zar_ghaffari", - "label": { - "Urdu": "ابو زر غفاری", - "Roman Urdu": "Abu Zar Ghaffari", - "English": "Abu Zar Ghaffari" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "new_karachi", - "name": "hakim_ahsan", - "label": { - "Urdu": "حاکم احسان", - "Roman Urdu": "Hakim Ahsan", - "English": "Hakim Ahsan" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "new_karachi", - "name": "madina_colony", - "label": { - "Urdu": "مدینہ کالونی", - "Roman Urdu": "Madina Colony", - "English": "Madina Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "new_karachi", - "name": "faisal_colony", - "label": { - "Urdu": "فیصل کالونی", - "Roman Urdu": "Faisal Colony", - "English": "Faisal Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "new_karachi", - "name": "khamiso_goth", - "label": { - "Urdu": "خمیسو گوٹھ", - "Roman Urdu": "Khamiso Goth", - "English": "Khamiso Goth" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "new_karachi", - "name": "mustufa_colony", - "label": { - "Urdu": "مصطفی کالونی", - "Roman Urdu": "Mustufa Colony", - "English": "Mustufa Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "new_karachi", - "name": "khawaja_ajmeer_nagri", - "label": { - "Urdu": "خواجہ اجمیر نگری", - "Roman Urdu": "Khawaja Ajmeer Nagri", - "English": "Khawaja Ajmeer Nagri" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "new_karachi", - "name": "gulshan_e_saeed", - "label": { - "Urdu": "گلشن سعید", - "Roman Urdu": "Gulshan-e-Saeed", - "English": "Gulshan-e-Saeed" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "new_karachi", - "name": "shah_nawaz_bhutto_colony", - "label": { - "Urdu": "شاہ نواز بھٹو کالونی", - "Roman Urdu": "Shah Nawaz Bhutto Colony", - "English": "Shah Nawaz Bhutto Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "north_nazimabad", - "name": "paposh_nagar", - "label": { - "Urdu": "پاپوش نگر", - "Roman Urdu": "Paposh Nagar", - "English": "Paposh Nagar" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "north_nazimabad", - "name": "pahar_ganj", - "label": { - "Urdu": "پہاڑ گنج", - "Roman Urdu": "Pahar Ganj", - "English": "Pahar Ganj" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "north_nazimabad", - "name": "khandu_goth", - "label": { - "Urdu": "کھنڑو گوٹھ", - "Roman Urdu": "Khandu Goth", - "English": "Khandu Goth" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "north_nazimabad", - "name": "hyderi", - "label": { - "Urdu": "حیدری", - "Roman Urdu": "Hyderi", - "English": "Hyderi" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "north_nazimabad", - "name": "sakhi_hassan", - "label": { - "Urdu": "سخی حسن", - "Roman Urdu": "Sakhi Hassan", - "English": "Sakhi Hassan" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "north_nazimabad", - "name": "farooq_e_azam", - "label": { - "Urdu": "فاروق اعظم", - "Roman Urdu": "Farooq-e-Azam", - "English": "Farooq-e-Azam" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "north_nazimabad", - "name": "nusrat_bhutto_colony", - "label": { - "Urdu": "نصرت بھٹو کالونی", - "Roman Urdu": "Nusrat Bhutto Colony", - "English": "Nusrat Bhutto Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "north_nazimabad", - "name": "shadman_town", - "label": { - "Urdu": "شادمان ٹاوَن", - "Roman Urdu": "Shadman Town", - "English": "Shadman Town" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "north_nazimabad", - "name": "buffer_zone", - "label": { - "Urdu": "بفرزون", - "Roman Urdu": "Buffer Zone", - "English": "Buffer Zone" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "north_nazimabad", - "name": "buffer_zone_ii", - "label": { - "Urdu": "بفرزون 2", - "Roman Urdu": "Buffer Zone II", - "English": "Buffer Zone II" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "orangi", - "name": "mominabad", - "label": { - "Urdu": "مومن آباد", - "Roman Urdu": "Mominabad", - "English": "Mominabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "orangi", - "name": "haryana_colony", - "label": { - "Urdu": "حریانہ کالونی", - "Roman Urdu": "Haryana Colony", - "English": "Haryana Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "orangi", - "name": "hanifabad", - "label": { - "Urdu": "حنیف آباد", - "Roman Urdu": "Hanifabad", - "English": "Hanifabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "orangi", - "name": "mohammad_nagar", - "label": { - "Urdu": "محمد نگر", - "Roman Urdu": "Mohammad Nagar", - "English": "Mohammad Nagar" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "orangi", - "name": "madina_colony_orangi", - "label": { - "Urdu": "مدینہ کالونی اورنگی", - "Roman Urdu": "Madina Colony Orangi", - "English": "Madina Colony Orangi" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "orangi", - "name": "ghaziabad", - "label": { - "Urdu": "غازی آباد", - "Roman Urdu": "Ghaziabad", - "English": "Ghaziabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "orangi", - "name": "chisti_nagar", - "label": { - "Urdu": "چشتی نگر", - "Roman Urdu": "Chisti Nagar", - "English": "Chisti Nagar" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "orangi", - "name": "bilal_colony_orangi", - "label": { - "Urdu": "بلال کالونی اورنگی", - "Roman Urdu": "Bilal Colony Orangi", - "English": "Bilal Colony Orangi" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "orangi", - "name": "iqbal_baloch_colony", - "label": { - "Urdu": "اقبال بلوچ کالونی", - "Roman Urdu": "Iqbal Baloch Colony", - "English": "Iqbal Baloch Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "orangi", - "name": "ghabool_town", - "label": { - "Urdu": "گبول ٹاوَن", - "Roman Urdu": "Ghabool Town", - "English": "Ghabool Town" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "orangi", - "name": "data_nagar", - "label": { - "Urdu": "داتا نگر", - "Roman Urdu": "Data Nagar", - "English": "Data Nagar" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "orangi", - "name": "mujahidabad", - "label": { - "Urdu": "مجاہد آباد", - "Roman Urdu": "Mujahidabad", - "English": "Mujahidabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "orangi", - "name": "baloch_goth", - "label": { - "Urdu": "بلوچ گوٹھ", - "Roman Urdu": "Baloch Goth", - "English": "Baloch Goth" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "saddar", - "name": "old_haji_camp", - "label": { - "Urdu": "پرانہ حاجی کیمپ", - "Roman Urdu": "Old Haji Camp", - "English": "Old Haji Camp" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "saddar", - "name": "garden", - "label": { - "Urdu": "گارڈن", - "Roman Urdu": "Garden", - "English": "Garden" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "saddar", - "name": "kharadar", - "label": { - "Urdu": "کھارادر", - "Roman Urdu": "Kharadar", - "English": "Kharadar" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "saddar", - "name": "city_railway_colony", - "label": { - "Urdu": "سٹی ریلوے کالونی", - "Roman Urdu": "City Railway Colony", - "English": "City Railway Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "saddar", - "name": "nanak_wara", - "label": { - "Urdu": "ناناک واڑا", - "Roman Urdu": "Nanak Wara", - "English": "Nanak Wara" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "saddar", - "name": "gazdarabad", - "label": { - "Urdu": "گزدرآباد", - "Roman Urdu": "Gazdarabad", - "English": "Gazdarabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "saddar", - "name": "millat_nagar_islam_pura", - "label": { - "Urdu": "ملت نگر اسلام پورا", - "Roman Urdu": "Millat Nagar/Islam Pura", - "English": "Millat Nagar/Islam Pura" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "saddar", - "name": "saddar_uc", - "label": { - "Urdu": "صدر یو سی", - "Roman Urdu": "Saddar UC", - "English": "Saddar UC" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "saddar", - "name": "civil_line", - "label": { - "Urdu": "سول لائن", - "Roman Urdu": "Civil Line", - "English": "Civil Line" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "saddar", - "name": "clifton", - "label": { - "Urdu": "کلفٹن", - "Roman Urdu": "Clifton", - "English": "Clifton" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "saddar", - "name": "kehkashan", - "label": { - "Urdu": "کہکشان", - "Roman Urdu": "Kehkashan", - "English": "Kehkashan" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "shah_faisal", - "name": "natha_khan_goth", - "label": { - "Urdu": "ناتھا خان گوٹھ", - "Roman Urdu": "Natha Khan Goth", - "English": "Natha Khan Goth" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "shah_faisal", - "name": "pak_sadat_colony", - "label": { - "Urdu": "پاک صدر کالونی", - "Roman Urdu": "Pak Sadat Colony", - "English": "Pak Sadat Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "shah_faisal", - "name": "drigh_colony", - "label": { - "Urdu": "ڈرگ کالونی", - "Roman Urdu": "Drigh Colony", - "English": "Drigh Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "shah_faisal", - "name": "raita_plot", - "label": { - "Urdu": "رائتا پلاٹ", - "Roman Urdu": "Raita Plot", - "English": "Raita Plot" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "shah_faisal", - "name": "moria_khan_goth", - "label": { - "Urdu": "موریا خان گوٹھ", - "Roman Urdu": "Moria Khan Goth", - "English": "Moria Khan Goth" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "shah_faisal", - "name": "rafa_e_aam_society", - "label": { - "Urdu": "رفا عام سوسا ئٹی", - "Roman Urdu": "Rafa-e-Aam Society", - "English": "Rafa-e-Aam Society" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "shah_faisal", - "name": "al_falah_society", - "label": { - "Urdu": "الفلاح سوسا ئٹی", - "Roman Urdu": "Al-Falah Society", - "English": "Al-Falah Society" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "site", - "name": "pak_colony", - "label": { - "Urdu": "پاک کالونی", - "Roman Urdu": "Pak Colony", - "English": "Pak Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "site", - "name": "old_golimar", - "label": { - "Urdu": "پرانہ گولی مار", - "Roman Urdu": "Old Golimar", - "English": "Old Golimar" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "site", - "name": "jahanabad", - "label": { - "Urdu": "جہان آباد", - "Roman Urdu": "Jahanabad", - "English": "Jahanabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "site", - "name": "metrovil", - "label": { - "Urdu": "میٹروویل", - "Roman Urdu": "Metrovil", - "English": "Metrovil" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "site", - "name": "bhawani_chali", - "label": { - "Urdu": "بہوانی چالی", - "Roman Urdu": "Bhawani Chali", - "English": "Bhawani Chali" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "site", - "name": "frontier_colony", - "label": { - "Urdu": "فرونٹر کالونی", - "Roman Urdu": "Frontier Colony", - "English": "Frontier Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "site", - "name": "banaras_colony", - "label": { - "Urdu": "بنارس کالونی", - "Roman Urdu": "Banaras Colony", - "English": "Banaras Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "site", - "name": "qasba_colony", - "label": { - "Urdu": "قصبہ کالونی", - "Roman Urdu": "Qasba Colony", - "English": "Qasba Colony" - } - }, - { - "province": "sindh", - "city": "karachi", - "town": "site", - "name": "islamia_colony", - "label": { - "Urdu": "اسلامیہ کالونی", - "Roman Urdu": "Islamia Colony", - "English": "Islamia Colony" - } - }, - { - "province": "na", - "city": "na", - "town": "na", - "name": "other", - "label": { - "Urdu": "دیگر", - "Roman Urdu": "Deegar", - "English": "Other" - } - }, - { - "province": "na", - "city": "na", - "town": "na", - "name": "not_applicable", - "label": { - "Urdu": "قابل اطلاق نہیں", - "Roman Urdu": "Qaabil-e-atlaaq nahi", - "English": "Not Applicable" - } - } - ], - "gender": [ - { - "instance": { - "openmrs_code": "1534AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "male", - "label": { - "Urdu": "مرد/ لڑکا", - "Roman Urdu": "Mard/larka", - "English": "Male" - } - }, - { - "instance": { - "openmrs_code": "1535AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "female", - "label": { - "Urdu": "عورت/لڑکی", - "Roman Urdu": "Aurat/larki", - "English": "Female" - } - }, - { - "instance": { - "openmrs_code": "163163AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "transgender", - "label": { - "Urdu": "خواجہ سرہ", - "Roman Urdu": "Khwaja sira", - "English": "Transgender" - } - } - ], - "vaccines": [ - { - "instance": { - "openmrs_code": "1570AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "bcg", - "label": { - "Urdu": "بی سی جی", - "Roman Urdu": "BCG", - "English": "BCG" - } - }, - { - "instance": { - "openmrs_code": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "opv0", - "label": { - "Urdu": "او پی وی 0", - "Roman Urdu": "OPV 0", - "English": "OPV 0" - } - }, - { - "instance": { - "openmrs_code": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "pcv1", - "label": { - "Urdu": "پی سی وی 1", - "Roman Urdu": "PCV 1", - "English": "PCV 1" - } - }, - { - "instance": { - "openmrs_code": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "opv1", - "label": { - "Urdu": "او پی وی 1", - "Roman Urdu": "OPV 1", - "English": "OPV 1" - } - }, - { - "instance": { - "openmrs_code": "162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "penta1", - "label": { - "Urdu": "پینٹا ویلنٹ 1", - "Roman Urdu": "Pentavalent 1", - "English": "Pentavalent 1" - } - }, - { - "instance": { - "openmrs_code": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "pcv2", - "label": { - "Urdu": "پی سی وی 2", - "Roman Urdu": "PCV 2", - "English": "PCV 2" - } - }, - { - "instance": { - "openmrs_code": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "opv2", - "label": { - "Urdu": "او پی وی 2", - "Roman Urdu": "OPV 2", - "English": "OPV 2" - } - }, - { - "instance": { - "openmrs_code": "162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "penta2", - "label": { - "Urdu": "پینٹا ویلنٹ 2", - "Roman Urdu": "Pentavalent 2", - "English": "Pentavalent 2" - } - }, - { - "instance": { - "openmrs_code": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "pcv3", - "label": { - "Urdu": "پی سی وی 3", - "Roman Urdu": "PCV 3", - "English": "PCV 3" - } - }, - { - "instance": { - "openmrs_code": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "opv3", - "label": { - "Urdu": "او پی وی 3", - "Roman Urdu": "OPV 3", - "English": "OPV 3" - } - }, - { - "instance": { - "openmrs_code": "162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "penta3", - "label": { - "Urdu": "پینٹا ویلنٹ 3", - "Roman Urdu": "Pentavalent 3", - "English": "Pentavalent 3" - } - }, - { - "instance": { - "openmrs_code": "82242AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "ipv", - "label": { - "Urdu": "آئی پی وی", - "Roman Urdu": "IPV", - "English": "IPV" - } - }, - { - "instance": { - "openmrs_code": "79409AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "measles1", - "label": { - "Urdu": "خسرہ 1", - "Roman Urdu": "Khasra 1", - "English": "Measles 1" - } - }, - { - "instance": { - "openmrs_code": "79409AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "measles2", - "label": { - "Urdu": "خسرہ 2", - "Roman Urdu": "Khasra 2", - "English": "Measles 2" - } - } - ], - "towns": [ - { - "province": "sindh", - "city": "karachi", - "name": "korangi", - "label": { - "Urdu": "کورنگی", - "Roman Urdu": "Korangi", - "English": "Korangi" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "landhi", - "label": { - "Urdu": "لانڈھی", - "Roman Urdu": "Landhi", - "English": "Landhi" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "baldia", - "label": { - "Urdu": "بلدیہ", - "Roman Urdu": "Baldia", - "English": "Baldia" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "bin_qasim", - "label": { - "Urdu": "بن قاسم", - "Roman Urdu": "Bin Qasim", - "English": "Bin Qasim" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "gadap", - "label": { - "Urdu": "گڈاپ", - "Roman Urdu": "Gadap", - "English": "Gadap" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "gulberg", - "label": { - "Urdu": "گلبرگ", - "Roman Urdu": "Gulberg", - "English": "Gulberg" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "gulshan", - "label": { - "Urdu": "گلشن", - "Roman Urdu": "Gulshan", - "English": "Gulshan" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "jamshed", - "label": { - "Urdu": "جمشید", - "Roman Urdu": "Jamshed", - "English": "Jamshed" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "kiamari", - "label": { - "Urdu": "کیماری", - "Roman Urdu": "Kiamari", - "English": "Kiamari" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "liaquatabad", - "label": { - "Urdu": "لیاقت آباد", - "Roman Urdu": "Liaquatabad", - "English": "Liaquatabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "lyari", - "label": { - "Urdu": "لیاری", - "Roman Urdu": "Lyari", - "English": "Lyari" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "malir", - "label": { - "Urdu": "ملیر", - "Roman Urdu": "Malir", - "English": "Malir" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "new_karachi", - "label": { - "Urdu": "نیو کراچی", - "Roman Urdu": "New Karachi", - "English": "New Karachi" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "north_nazimabad", - "label": { - "Urdu": "نارتھ ناظم آباد", - "Roman Urdu": "North Nazimabad", - "English": "North Nazimabad" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "orangi", - "label": { - "Urdu": "اورنگی", - "Roman Urdu": "Orangi", - "English": "Orangi" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "saddar", - "label": { - "Urdu": "صدر", - "Roman Urdu": "Saddar", - "English": "Saddar" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "shah_faisal", - "label": { - "Urdu": "شاہ فیصل", - "Roman Urdu": "Shah Faisal", - "English": "Shah Faisal" - } - }, - { - "province": "sindh", - "city": "karachi", - "name": "site", - "label": { - "Urdu": "سائٹ", - "Roman Urdu": "S.I.T.E.", - "English": "S.I.T.E." - } - }, - { - "province": "na", - "city": "na", - "name": "other", - "label": { - "Urdu": "دیگر", - "Roman Urdu": "Deegar", - "English": "Other" - } - }, - { - "province": "na", - "city": "na", - "name": "not_applicable", - "label": { - "Urdu": "قابل اطلاق نہیں", - "Roman Urdu": "Qaabil-e-atlaaq nahi", - "English": "Not Applicable" - } - } - ], - "cities": [ - { - "province": "sindh", - "name": "karachi", - "label": { - "Urdu": "کراچی", - "Roman Urdu": "Karachi", - "English": "Karachi" - } - }, - { - "province": "punjab", - "name": "hafizabad", - "label": { - "Urdu": "حافظ آباد", - "Roman Urdu": "Hafizabad", - "English": "Hafizabad" - } - }, - { - "province": "punjab", - "name": "muzaffargarh", - "label": { - "Urdu": "مظفر گڑھ", - "Roman Urdu": "Muzaffargarh", - "English": "Muzaffargarh" - } - }, - { - "province": "na", - "name": "other", - "label": { - "Urdu": "دیگر", - "Roman Urdu": "Deegar", - "English": "Other" - } - }, - { - "province": "na", - "name": "not_applicable", - "label": { - "Urdu": "قابل اطلاق نہیں", - "Roman Urdu": "Qaabil-e-atlaaq nahi", - "English": "Not Applicable" - } - } - ], - "yes_no": [ - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "yes", - "label": { - "Urdu": "ہاں", - "Roman Urdu": "Yes", - "English": "Yes" - } - }, - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "no", - "label": { - "Urdu": "نہیں", - "Roman Urdu": "No", - "English": "No" - } - } - ] - }, - "instance": { - "encounter_type": "Child Vaccination Followup" - }, - "version": "201604080501", - "id_string": "child_vaccination_followup", - "type": "survey", - "children": [ - { - "type": "hidden", - "name": "provider_uc" - }, - { - "type": "hidden", - "name": "provider_town" - }, - { - "type": "hidden", - "name": "provider_city" - }, - { - "type": "hidden", - "name": "provider_province" - }, - { - "type": "hidden", - "name": "existing_first_name" - }, - { - "type": "hidden", - "name": "existing_last_name" - }, - { - "type": "hidden", - "name": "existing_mother_name" - }, - { - "type": "hidden", - "name": "existing_gender" - }, - { - "type": "hidden", - "name": "existing_client_birth_date" - }, - { - "type": "hidden", - "name": "existing_client_reg_date" - }, - { - "type": "hidden", - "name": "existing_landmark" - }, - { - "type": "hidden", - "name": "existing_house_number" - }, - { - "type": "hidden", - "name": "existing_street" - }, - { - "type": "hidden", - "name": "existing_union_council" - }, - { - "type": "hidden", - "name": "existing_town" - }, - { - "type": "hidden", - "name": "existing_city_village" - }, - { - "type": "hidden", - "name": "existing_province" - }, - { - "type": "hidden", - "name": "existing_union_councilname" - }, - { - "type": "hidden", - "name": "existing_townname" - }, - { - "type": "hidden", - "name": "existing_city_villagename" - }, - { - "type": "hidden", - "name": "existing_provincename" - }, - { - "type": "hidden", - "name": "existing_ethnicity" - }, - { - "type": "hidden", - "name": "existing_program_client_id" - }, - { - "type": "hidden", - "name": "existing_epi_card_number" - }, - { - "type": "hidden", - "name": "existing_child_was_suffering_from_a_disease_at_birth" - }, - { - "type": "hidden", - "name": "existing_reminders_approval" - }, - { - "type": "hidden", - "name": "existing_contact_phone_number" - }, - { - "type": "hidden", - "name": "e_bcg" - }, - { - "type": "hidden", - "name": "e_opv0" - }, - { - "type": "hidden", - "name": "e_penta2" - }, - { - "type": "hidden", - "name": "e_penta1" - }, - { - "type": "hidden", - "name": "e_penta3" - }, - { - "type": "hidden", - "name": "e_opv1" - }, - { - "type": "hidden", - "name": "e_opv2" - }, - { - "type": "hidden", - "name": "e_opv3" - }, - { - "type": "hidden", - "name": "e_pcv1" - }, - { - "type": "hidden", - "name": "e_pcv2" - }, - { - "type": "hidden", - "name": "e_pcv3" - }, - { - "type": "hidden", - "name": "e_ipv" - }, - { - "type": "hidden", - "name": "e_measles1" - }, - { - "type": "hidden", - "name": "e_measles2" - }, - { - "type": "hidden", - "name": "provider_id" - }, - { - "instance": { - "openmrs_entity_id": "location_id", - "openmrs_entity": "encounter" - }, - "type": "hidden", - "name": "provider_location_id" - }, - { - "type": "hidden", - "name": "provider_location_name" - }, - { - "type": "note", - "name": "provider_location_note", - "label": { - "Urdu": "شہر: ${provider_city} ; ٹائون: ${provider_town} ; یوسی: ${provider_uc} ; سینٹرکا نام: ${provider_location_name}", - "English": "City: ${provider_city} ; Town: ${provider_town} ; UC: ${provider_uc} ; Center Name: ${provider_location_name}", - "Roman Urdu": "Shehr: ${provider_city} ; Town: ${provider_town} ; UC: ${provider_uc} ; Center ka Naam: ${provider_location_name}" - } - }, - { - "instance": { - "openmrs_entity_id": "163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "start", - "name": "start" - }, - { - "instance": { - "openmrs_entity_id": "163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "end", - "name": "end" - }, - { - "instance": { - "openmrs_entity_id": "163286AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "today", - "name": "today" - }, - { - "instance": { - "openmrs_entity_id": "163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "deviceid", - "name": "deviceid" - }, - { - "instance": { - "openmrs_entity_id": "163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "subscriberid", - "name": "subscriberid" - }, - { - "instance": { - "openmrs_entity_id": "163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "simserial", - "name": "simserial" - }, - { - "instance": { - "openmrs_entity_id": "163152AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "phonenumber", - "name": "phonenumber" - }, - { - "bind": { - "required": "yes" - }, - "label": { - "Urdu": "بچے کی پروگرام میں اندراج کی تاریخ: {existing_client_reg_date}$", - "Roman Urdu": "Bachay ki Program mai andraj ki tareekh: ${existing_client_reg_date}", - "English": "Child Registration date: ${existing_client_reg_date}" - }, - "type": "note", - "name": "existing_client_reg_date_note", - "hint": { - "Urdu": "بچے کو ویکسین لگنے کی تاریخ", - "Roman Urdu": "Bachay ko vaccine lagnay ki tareekh", - "English": "Date on which child was vaccinated" - } - }, - { - "bind": { - "required": "yes" - }, - "type": "note", - "name": "program_client_id_note", - "label": { - "Urdu": "کلائنٹ کی پروگرام ائی ڈی: {existing_program_client_id}$", - "Roman Urdu": "Client ki program ID: ${existing_program_client_id}", - "English": "Program Client ID: ${existing_program_client_id}" - } - }, - { - "bind": { - "required": "yes" - }, - "type": "note", - "instance": { - "openmrs_entity_id": "EPI Card Number", - "openmrs_entity": "person_attribute" - }, - "name": "epi_card_number_note", - "label": { - "Urdu": "کارڈ نمبر: {existing_epi_card_number}$", - "English": "Card Number: ${existing_epi_card_number}", - "Roman Urdu": "Card Number: ${existing_epi_card_number}" - } - }, - { - "bind": { - "required": "yes" - }, - "type": "note", - "name": "first_name_note", - "label": { - "Urdu": "نام: {existing_first_name}$", - "Roman Urdu": "Naam: ${existing_first_name}", - "English": "First Name: ${existing_first_name}" - } - }, - { - "bind": { - "required": "yes" - }, - "type": "note", - "name": "last_name_note", - "label": { - "Urdu": "والد کا نام: {existing_last_name}$", - "Roman Urdu": "Waalid ka naam: ${existing_last_name}", - "English": "Last name: ${existing_last_name}" - } - }, - { - "bind": { - "calculate": "int((${today} - ${existing_client_birth_date}) div 30.42)" - }, - "type": "calculate", - "name": "child_age", - "instance": { - "openmrs_entity_id": "154384AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - } - }, - { - "type": "note", - "name": "calc_dob_note", - "label": { - "Urdu": "بچے کی تاریخ پیدائش: {existing_client_birth_date}$ ({child_age}$) مہینے", - "English": "Child dob: ${existing_client_birth_date} (${child_age}) months", - "Roman Urdu": "Bachay ki tareekh-e-paidaish: ${existing_client_birth_date} (${child_age}) mahinay" - } - }, - { - "bind": { - "required": "yes" - }, - "type": "note", - "name": "gender_note", - "label": { - "Urdu": "جنس: {existing_gender}$", - "Roman Urdu": "Jins:${existing_gender}", - "English": "Gender: ${existing_gender}" - } - }, - { - "type": "note", - "name": "mother_name_note", - "label": { - "Urdu": "ماں کا نام: {existing_mother_name}$", - "English": "Mother's Name: ${existing_mother_name}", - "Roman Urdu": "Maa ka naam: ${existing_mother_name}" - } - }, - { - "bind": { - "required": "yes" - }, - "type": "note", - "name": "exisiting_ethnicity_note", - "label": { - "Urdu": "قومیت: {existing_ethnicity}$", - "Roman Urdu": "Qomiat: ${existing_ethnicity}", - "English": "Ethnicity: ${existing_ethnicity}" - } - }, - { - "type": "note", - "name": "address", - "label": { - "Urdu": "موجودہ پتہ: ${existing_house_number}, ${existing_street}, ${existing_landmark}, ${existing_union_councilname}, ${existing_townname}, ${existing_city_villagename}, ${existing_provincename}", - "English": "Current Address: ${existing_house_number}, ${existing_street}, ${existing_landmark}, ${existing_union_councilname}, ${existing_townname}, ${existing_city_villagename}, ${existing_provincename}", - "Roman Urdu": "Mojooda Address: ${existing_house_number}, ${existing_street}, ${existing_landmark}, ${existing_union_councilname}, ${existing_townname}, ${existing_city_villagename}, ${existing_provincename}" - } - }, - { - "label": { - "Urdu": "کیا آپ کا گھر کا پتہ بدلا ہے؟", - "English": "Has your home address changed?", - "Roman Urdu": "Kya aap ka ghar ka pata badla hai?" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "yes", - "label": { - "Urdu": "ہاں", - "Roman Urdu": "Yes", - "English": "Yes" - } - }, - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "no", - "label": { - "Urdu": "نہیں", - "Roman Urdu": "No", - "English": "No" - } - } - ], - "name": "address_change" - }, - { - "control": { - "appearance": "minimal" - }, - "name": "province", - "default": "${provider_province}", - "bind": { - "relevant": "selected(${address_change}, 'yes')", - "required": "yes" - }, - "label": { - "Urdu": "صوبہ", - "Roman Urdu": "Suba", - "English": "Province" - }, - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "stateProvince", - "openmrs_entity_parent": "usual_residence" - }, - "type": "select one", - "children": [ - { - "name": "kpk", - "label": { - "Urdu": "خیبر پختون خواہ", - "English": "Khyber Pakhtunkhwa", - "Roman Urdu": "Khyber Pakhtunkhwa" - } - }, - { - "name": "sindh", - "label": { - "Urdu": "سندھ", - "English": "Sindh", - "Roman Urdu": "Sindh" - } - }, - { - "name": "balochistan", - "label": { - "Urdu": "بلوچستان", - "English": "Balochistan", - "Roman Urdu": "Balochistan" - } - }, - { - "name": "punjab", - "label": { - "Urdu": "پنجاب", - "English": "Punjab", - "Roman Urdu": "Punjab" - } - }, - { - "name": "gilgit_baltistan", - "label": { - "Urdu": "گلگت بلتستان", - "English": "Gilgit Baltistan", - "Roman Urdu": "Gilgit Baltistan" - } - }, - { - "name": "kashmir", - "label": { - "Urdu": "کشمیر", - "English": "Kashmir", - "Roman Urdu": "Kashmir" - } - }, - { - "name": "fata", - "label": { - "Urdu": "فاٹا", - "English": "FATA", - "Roman Urdu": "FATA" - } - }, - { - "name": "out_of_country", - "label": { - "Urdu": "ملک سے باہر", - "English": "Out of Country", - "Roman Urdu": "Out of Country" - } - } - ] - }, - { - "control": { - "appearance": "minimal" - }, - "name": "city_village", - "choice_filter": "province=${province} or province='na'", - "default": "${provider_city}", - "bind": { - "relevant": "selected(${address_change}, 'yes')", - "required": "yes" - }, - "label": { - "Urdu": "شہر", - "Roman Urdu": "Shehr", - "English": "City" - }, - "itemset": "cities", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "cityVillage", - "openmrs_entity_parent": "usual_residence" - }, - "type": "select one" - }, - { - "control": { - "appearance": "minimal" - }, - "name": "town", - "choice_filter": "(province=${province} and city=${city_village} ) or city='na'", - "bind": { - "relevant": "selected(${address_change}, 'yes')", - "required": "yes" - }, - "label": { - "Urdu": "ٹاٰئون/ قصبہ/ بستی", - "Roman Urdu": "Town / Qasbah / Basti", - "English": "Town" - }, - "itemset": "towns", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "town", - "openmrs_entity_parent": "usual_residence" - }, - "type": "select one" - }, - { - "control": { - "appearance": "minimal" - }, - "name": "union_council", - "choice_filter": "(province=${province} and city=${city_village} and town=${town}) or town='na'", - "bind": { - "relevant": "selected(${address_change}, 'yes')", - "required": "yes" - }, - "label": { - "Urdu": "یونین کونسل", - "Roman Urdu": "Union Council", - "English": "Union Council" - }, - "itemset": "ucs", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "subTown", - "openmrs_entity_parent": "usual_residence" - }, - "type": "select one" - }, - { - "bind": { - "relevant": "selected(${address_change}, 'yes')", - "required": "yes" - }, - "type": "text", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "house", - "openmrs_entity_parent": "usual_residence" - }, - "name": "house_number", - "label": { - "Urdu": "گھر کا نمبر", - "Roman Urdu": "Ghar ka number", - "English": "House Number" - } - }, - { - "bind": { - "relevant": "selected(${address_change}, 'yes')", - "required": "yes" - }, - "type": "text", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "street", - "openmrs_entity_parent": "usual_residence" - }, - "name": "street", - "label": { - "Urdu": "گلی/کالونی/محلہ", - "Roman Urdu": "Gali/Colony/Mohalla", - "English": "Street" - } - }, - { - "bind": { - "relevant": "selected(${address_change}, 'yes')", - "required": "yes" - }, - "type": "text", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "landmark", - "openmrs_entity_parent": "usual_residence" - }, - "name": "landmark", - "label": { - "Urdu": "گھر کے قریب کوئی مشہور جگہ", - "Roman Urdu": "Ghar ke qareeb koi mashoor jagah", - "English": "Land Mark" - } - }, - { - "instance": { - "openmrs_entity_id": "163277AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "geopoint", - "name": "center_gps", - "label": { - "Urdu": "حاصل کردہ معلومات کی جگہ کے GPS کارڈینیٹس درج کریں", - "English": "Collect GPS coordinates of data entry location:", - "Roman Urdu": "Hasil karda malomaat ki jaga ke GPS coordinates darj karain" - } - }, - { - "control": { - "appearance": "minimal" - }, - "bind": { - "required": "yes" - }, - "type": "note", - "name": "child_was_suffering_from_a_disease_at_birth_note", - "label": { - "Urdu": "کیا بچہ پیدائش کے وقت کسی مرض میں مبتلا تھا؟ {existing_child_was_suffering_from_a_disease_at_birth}$", - "Roman Urdu": "Kya bacha pedaaish k waqt kissi marz mai mubtila tha? ${existing_child_was_suffering_from_a_disease_at_birth}", - "English": "Child was suffering from a disease at birth: ${existing_child_was_suffering_from_a_disease_at_birth}" - } - }, - { - "instance": { - "openmrs_entity_id": "163162AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "text", - "name": "aefi", - "label": { - "Urdu": "حفاظتی ٹیکوں کے مضر اثرات", - "English": "The temporary side-effects of immunization shots", - "Roman Urdu": "Hifazati teekon ke muzr asraat" - } - }, - { - "control": { - "appearance": "minimal" - }, - "name": "reminders_approval", - "bind": { - "required": "yes" - }, - "label": { - "Urdu": "کیا آپ اپنے بچے کی اگلی ویکسین کی تاریخ کے لیے SMS موصول کرنا چاہتے ہیں؟ {existing_reminders_approval}$", - "English": "Are you willing to receive SMS reminders for your next visit? ${existing_reminders_approval}", - "Roman Urdu": "Kya aap apnay bachay ki agli vaccine ki tareekh ke liye SMS mausool karna chahtay hain? ${existing_reminders_approval}" - }, - "instance": { - "openmrs_entity_id": "163089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "yes", - "label": { - "Urdu": "ہاں", - "Roman Urdu": "Yes", - "English": "Yes" - } - }, - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "no", - "label": { - "Urdu": "نہیں", - "Roman Urdu": "No", - "English": "No" - } - } - ] - }, - { - "bind": { - "jr:constraintMsg": { - "Urdu": "فون نمبر گیارہ ہندسوں پر مشتمل اور مندرجہ ذیل شکل میں ہونا چاہئے: *********03", - "English": "Phone number should be 11 digits in the following format: 03*********", - "Roman Urdu": "Phone number 11 hindason par mushtamil aur mundarja zail shakal main hona chahiey: 03*********" - }, - "relevant": "${existing_reminders_approval}='yes'", - "constraint": "regex(., '^03[0-9]{9}$')" - }, - "type": "text", - "instance": { - "openmrs_entity_id": "159635AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "name": "contact_phone_number", - "label": { - "Urdu": "موبائل نمبر:{existing_contact_phone_number}$", - "English": "Mobile Number: ${existing_contact_phone_number}", - "Roman Urdu": "Mobile Number: ${existing_contact_phone_number}" - } - }, - { - "bind": { - "calculate": "${existing_client_birth_date} + 42" - }, - "type": "calculate", - "name": "six_weeks" - }, - { - "bind": { - "calculate": "${existing_client_birth_date} + 70" - }, - "type": "calculate", - "name": "ten_weeks" - }, - { - "bind": { - "calculate": "${existing_client_birth_date} + 98" - }, - "type": "calculate", - "name": "forteen_weeks" - }, - { - "bind": { - "calculate": "${existing_client_birth_date} + 245" - }, - "type": "calculate", - "name": "nine_months" - }, - { - "bind": { - "calculate": "${existing_client_birth_date} + 458" - }, - "type": "calculate", - "name": "fifteen_months" - }, - { - "control": { - "appearance": "minimal" - }, - "name": "vaccines", - "choice_filter": "name != if( ${e_bcg} != '', 'bcg' , '') and \nname != if( ${e_opv0} != '', 'opv0' , '') and \nname != if( ${e_penta1} != '', 'penta1' , '') and \nname != if( ${e_penta2} != '', 'penta2' , '') and \nname != if( ${e_penta3} != '', 'penta3' , '') and \nname != if( ${e_opv1} != '', 'opv1' , '') and \nname != if( ${e_opv2} != '', 'opv2' , '') and \nname != if( ${e_opv3} != '', 'opv3' , '') and \nname != if( ${e_pcv1} != '', 'pcv1' , '') and \nname != if( ${e_pcv2} != '', 'pcv2' , '') and \nname != if( ${e_pcv3} != '', 'pcv3' , '') and \nname != if( ${e_ipv} != '', 'ipv' , '') and \nname != if( ${e_measles1} != '', 'measles1' , '') and \nname != if( ${e_measles2} != '', 'measles2' , '')", - "label": { - "Urdu": "پچھلی تاریخ جب کسی اور سینٹر پر ٹیکے لگواِے گیے یا قطرے پلائے گئے", - "Roman Urdu": "Pichli tareekh jab kissi aur center par teekay lagwaye gaye ya katray pilaey gaye", - "English": "Retro vaccines" - }, - "itemset": "vaccines", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "984AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "1421AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "type": "select all that apply" - }, - { - "type": "group", - "children": [ - { - "bind": { - "jr:constraintMsg": { - "Urdu": "حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے", - "English": "The date of vaccination must be greater than the child's birthdate and less than today.", - "Roman Urdu": "Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye." - }, - "relevant": "selected(${vaccines}, 'bcg')", - "constraint": ".>= ${existing_client_birth_date} and .<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "bcg_retro", - "label": { - "Urdu": "بی سی جی", - "Roman Urdu": "BCG", - "English": "BCG" - } - }, - { - "bind": { - "jr:constraintMsg": { - "Urdu": "حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے", - "English": "The date of vaccination must be greater than the child's birthdate and less than today.", - "Roman Urdu": "Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye." - }, - "relevant": "selected(${vaccines}, 'opv0')", - "constraint": ".>= ${existing_client_birth_date} and .<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "opv0_retro", - "label": { - "Urdu": "او پی وی 0", - "Roman Urdu": "OPV 0", - "English": "OPV 0" - } - }, - { - "bind": { - "relevant": "selected(${vaccines}, 'opv0')", - "calculate": "0" - }, - "type": "calculate", - "name": "opv0_dose", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "jr:constraintMsg": { - "Urdu": "حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے", - "English": "The date of vaccination must be greater than the child's birthdate and less than today.", - "Roman Urdu": "Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye." - }, - "relevant": "selected(${vaccines}, 'pcv1')", - "constraint": ".>= ${existing_client_birth_date} and .<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "pcv1_retro", - "label": { - "Urdu": "پی سی وی 1", - "Roman Urdu": "PCV1", - "English": "PCV1" - } - }, - { - "bind": { - "relevant": "selected(${vaccines}, 'pcv1')", - "calculate": "1" - }, - "type": "calculate", - "name": "pcv1_dose", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "jr:constraintMsg": { - "Urdu": "حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے", - "English": "The date of vaccination must be greater than the child's birthdate and less than today.", - "Roman Urdu": "Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye." - }, - "relevant": "selected(${vaccines}, 'opv1')", - "constraint": ".>= ${existing_client_birth_date} and .<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "opv1_retro", - "label": { - "Urdu": "او پی وی1", - "Roman Urdu": "OPV 1", - "English": "OPV 1" - } - }, - { - "bind": { - "relevant": "selected(${vaccines}, 'opv1')", - "calculate": "1" - }, - "type": "calculate", - "name": "opv1_dose", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "jr:constraintMsg": { - "Urdu": "حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے", - "English": "The date of vaccination must be greater than the child's birthdate and less than today.", - "Roman Urdu": "Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye." - }, - "relevant": "selected(${vaccines}, 'penta1')", - "constraint": ".>= ${existing_client_birth_date} and .<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "penta1_retro", - "label": { - "Urdu": "پینٹا ویلنٹ 1", - "Roman Urdu": "Pentavalent 1", - "English": "Pentavalent 1" - } - }, - { - "bind": { - "relevant": "selected(${vaccines}, 'penta1')", - "calculate": "1" - }, - "type": "calculate", - "name": "penta1_dose", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "jr:constraintMsg": { - "Urdu": "حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے", - "English": "The date of vaccination must be greater than the child's birthdate and less than today.", - "Roman Urdu": "Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye." - }, - "relevant": "selected(${vaccines}, 'pcv2')", - "constraint": ".>= ${existing_client_birth_date} and .<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "pcv2_retro", - "label": { - "Urdu": "پی سی وی 2", - "Roman Urdu": "PCV2", - "English": "PCV2" - } - }, - { - "bind": { - "relevant": "selected(${vaccines}, 'pcv2')", - "calculate": "2" - }, - "type": "calculate", - "name": "pcv2_dose", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "jr:constraintMsg": { - "Urdu": "حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے", - "English": "The date of vaccination must be greater than the child's birthdate and less than today.", - "Roman Urdu": "Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye." - }, - "relevant": "selected(${vaccines}, 'opv2')", - "constraint": ".>= ${existing_client_birth_date} and .<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "opv2_retro", - "label": { - "Urdu": "او پی وی 2", - "Roman Urdu": "OPV 2", - "English": "OPV 2" - } - }, - { - "bind": { - "relevant": "selected(${vaccines}, 'opv2')", - "calculate": "2" - }, - "type": "calculate", - "name": "opv2_dose", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "jr:constraintMsg": { - "Urdu": "حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے", - "English": "The date of vaccination must be greater than the child's birthdate and less than today.", - "Roman Urdu": "Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye." - }, - "relevant": "selected(${vaccines}, 'penta2')", - "constraint": ".>= ${existing_client_birth_date} and .<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "penta2_retro", - "label": { - "Urdu": "پینٹا ویلنٹ 2", - "Roman Urdu": "Pentavalent 2", - "English": "Pentavalent 2" - } - }, - { - "bind": { - "relevant": "selected(${vaccines}, 'penta2')", - "calculate": "2" - }, - "type": "calculate", - "name": "penta2_dose", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "jr:constraintMsg": { - "Urdu": "حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے", - "English": "The date of vaccination must be greater than the child's birthdate and less than today.", - "Roman Urdu": "Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye." - }, - "relevant": "selected(${vaccines}, 'pcv3')", - "constraint": ".>= ${existing_client_birth_date} and .<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "pcv3_retro", - "label": { - "Urdu": "پی سی وی 3", - "Roman Urdu": "PCV3", - "English": "PCV3" - } - }, - { - "bind": { - "relevant": "selected(${vaccines}, 'penta2')", - "calculate": "3" - }, - "type": "calculate", - "name": "pcv3_dose", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "jr:constraintMsg": { - "Urdu": "حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے", - "English": "The date of vaccination must be greater than the child's birthdate and less than today.", - "Roman Urdu": "Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye." - }, - "relevant": "selected(${vaccines}, 'opv3')", - "constraint": ".>= ${existing_client_birth_date} and .<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "opv3_retro", - "label": { - "Urdu": "او پی وی3", - "Roman Urdu": "OPV 3", - "English": "OPV 3" - } - }, - { - "bind": { - "relevant": "selected(${vaccines}, 'opv3')", - "calculate": "3" - }, - "type": "calculate", - "name": "opv3_dose", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "jr:constraintMsg": { - "Urdu": "حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے", - "English": "The date of vaccination must be greater than the child's birthdate and less than today.", - "Roman Urdu": "Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye." - }, - "relevant": "selected(${vaccines}, 'penta3')", - "constraint": ".>= ${existing_client_birth_date} and .<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "penta3_retro", - "label": { - "Urdu": "پینٹا ویلنٹ 3", - "Roman Urdu": "Pentavalent 3", - "English": "Pentavalent 3" - } - }, - { - "bind": { - "relevant": "selected(${vaccines}, 'penta3')", - "calculate": "3" - }, - "type": "calculate", - "name": "penta3_dose", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "jr:constraintMsg": { - "Urdu": "حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے", - "English": "The date of vaccination must be greater than the child's birthdate and less than today.", - "Roman Urdu": "Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye." - }, - "relevant": "selected(${vaccines}, 'ipv')", - "constraint": ".>= ${existing_client_birth_date} and .<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "1422AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "ipv_retro", - "label": { - "Urdu": "آئی پی وی", - "Roman Urdu": "IPV", - "English": "IPV" - } - }, - { - "bind": { - "jr:constraintMsg": { - "Urdu": "حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے", - "English": "The date of vaccination must be greater than the child's birthdate and less than today.", - "Roman Urdu": "Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye." - }, - "relevant": "selected(${vaccines}, 'measles1')", - "constraint": ".>= ${existing_client_birth_date} and .<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "measles1_retro", - "label": { - "Urdu": "خسرہ 1", - "Roman Urdu": "Measles 1", - "English": "Measles 1" - } - }, - { - "bind": { - "relevant": "selected(${vaccines}, 'measles1')", - "calculate": "1" - }, - "type": "calculate", - "name": "measles1_dose", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "jr:constraintMsg": { - "Urdu": "حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے", - "English": "The date of vaccination must be greater than the child's birthdate and less than today.", - "Roman Urdu": "Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye." - }, - "relevant": "selected(${vaccines}, 'measles2')", - "constraint": ".>= ${existing_client_birth_date} and .<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "measles2_retro", - "label": { - "Urdu": "خسرہ 2", - "Roman Urdu": "Measles2", - "English": "Measles2" - } - }, - { - "bind": { - "relevant": "selected(${vaccines}, 'measles2')", - "calculate": "2" - }, - "type": "calculate", - "name": "measles2_dose", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - } - ], - "name": "vaccines_group" - }, - { - "control": { - "appearance": "minimal" - }, - "name": "vaccines_2", - "choice_filter": "name != if( ${e_bcg} != '', 'bcg' , '') and \nname != if( ${e_opv0} != '', 'opv0' , '') and \nname != if( ${e_penta2} != '', 'penta2' , '') and \nname != if( ${e_penta1} != '', 'penta1' , '') and \nname != if( ${e_penta3} != '', 'penta3' , '') and \nname != if( ${e_opv1} != '', 'opv1' , '') and \nname != if( ${e_opv2} != '', 'opv2' , '') and \nname != if( ${e_opv3} != '', 'opv3' , '') and \nname != if( ${e_pcv1} != '', 'pcv1' , '') and \nname != if( ${e_pcv2} != '', 'pcv2' , '') and \nname != if( ${e_pcv3} != '', 'pcv3' , '') and \nname != if( ${e_measles1} != '', 'measles1' , '') and \nname != if( ${e_measles2} != '', 'measles2' , '') and \nname != if(selected(${vaccines}, 'bcg'), 'bcg', '') and \nname != if(selected(${vaccines}, 'opv0'), 'opv0', '') and \nname != if(selected(${vaccines}, 'penta1'), 'penta1', '') and \nname != if(selected(${vaccines}, 'opv1'), 'opv1', '') and \nname != if(selected(${vaccines}, 'pcv1'), 'pcv1', '') and \nname != if(selected(${vaccines}, 'penta2'), 'penta2', '') and \nname != if(selected(${vaccines}, 'opv2'), 'opv2', '') and \nname != if(selected(${vaccines}, 'pcv2'), 'pcv2', '') and \nname != if(selected(${vaccines}, 'penta3'), 'penta3', '') and \nname != if(selected(${vaccines}, 'opv3'), 'opv3', '') and \nname != if(selected(${vaccines}, 'pcv3'), 'pcv3', '') and\nname != if(selected(${vaccines}, 'ipv'), 'ipv', '') and \nname != if(selected(${vaccines}, 'measles1'), 'measles1', '') and \nname != if(selected(${vaccines}, 'measles2'), 'measles2', '')", - "bind": { - "required": "yes", - "constraint": "if(selected(${vaccines_2}, 'bcg') or selected(${vaccines_2}, 'opv0') , .>= ${existing_client_birth_date} and .<=${today}, if(selected(${vaccines_2}, 'opv1') or selected(${vaccines_2}, 'penta1'), .>= ${six_weeks} and .<=${today}, if(selected(${vaccines_2}, 'opv2') or selected(${vaccines_2}, 'penta2'), .>=${ten_weeks} and .<=${today}, if(selected(${vaccines_2}, 'opv3') or selected(${vaccines_2}, 'penta3'), .>=${forteen_weeks} and .<=${today}, if(selected(${vaccines_2}, 'measles1'), .>=${nine_months} and .<=${today}, if(selected(${vaccines_2}, 'measles2'), .>= ${fifteen_months} and .<=${today}))))))" - }, - "label": { - "Urdu": "آج کون کون سی ویکسین دی گئی ہیں؟", - "Roman Urdu": "Aaj kon kon si vaccine di gai hain?", - "English": "Vaccines administered" - }, - "itemset": "vaccines", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "984AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "1441AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "type": "select all that apply" - }, - { - "name": "vaccination_date", - "default": "${today}", - "bind": { - "required": "yes", - "constraint": "if(selected(${vaccines_2}, 'bcg') or selected(${vaccines_2}, 'opv0') , .>= ${existing_client_birth_date} and .<=${today}, if(selected(${vaccines_2}, 'opv1') or selected(${vaccines_2}, 'penta1'), .>= ${six_weeks} and .<=${today}, if(selected(${vaccines_2}, 'opv2') or selected(${vaccines_2}, 'penta2'), .>=${ten_weeks} and .<=${today}, if(selected(${vaccines_2}, 'opv3') or selected(${vaccines_2}, 'penta3'), .>=${forteen_weeks} and .<=${today}, if(selected(${vaccines_2}, 'measles1'), .>=${nine_months} and .<=${today}, if(selected(${vaccines_2}, 'measles2'), .>= ${fifteen_months} and .<=${today}))))))" - }, - "label": { - "Urdu": "تاریخ", - "English": "Vaccination date", - "Roman Urdu": "Tareekh" - }, - "instance": { - "openmrs_entity_id": "encounter_date", - "openmrs_entity": "encounter" - }, - "type": "date" - }, - { - "bind": { - "calculate": "if(selected(${vaccines_2}, 'bcg'),${vaccination_date},'')" - }, - "type": "calculate", - "name": "bcg", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "calculate": "if(selected(${vaccines_2}, 'opv0'),${vaccination_date},'')" - }, - "type": "calculate", - "name": "opv0", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "relevant": "selected(${vaccines_2}, 'opv0')", - "calculate": "0" - }, - "type": "calculate", - "name": "opv0_dose_today", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "calculate": "if(selected(${vaccines_2}, 'pcv1'),${vaccination_date},'')" - }, - "type": "calculate", - "name": "pcv1", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "relevant": "selected(${vaccines_2}, 'pcv1')", - "calculate": "1" - }, - "type": "calculate", - "name": "pcv1_dose_today", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "calculate": "if(selected(${vaccines_2}, 'opv1'),${vaccination_date},'')" - }, - "type": "calculate", - "name": "opv1", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "relevant": "selected(${vaccines_2}, 'opv1')", - "calculate": "1" - }, - "type": "calculate", - "name": "opv1_dose_today", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "calculate": "if(selected(${vaccines_2}, 'penta1'),${vaccination_date},'')" - }, - "type": "calculate", - "name": "penta1", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "relevant": "selected(${vaccines_2}, 'penta1')", - "calculate": "1" - }, - "type": "calculate", - "name": "penta1_dose_today", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "calculate": "if(selected(${vaccines_2}, 'pcv2'),${vaccination_date},'')" - }, - "type": "calculate", - "name": "pcv2", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "relevant": "selected(${vaccines_2}, 'pcv2')", - "calculate": "2" - }, - "type": "calculate", - "name": "pcv2_dose_today", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "calculate": "if(selected(${vaccines_2}, 'opv2'),${vaccination_date},'')" - }, - "type": "calculate", - "name": "opv2", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "relevant": "selected(${vaccines_2}, 'opv2')", - "calculate": "2" - }, - "type": "calculate", - "name": "opv2_dose_today", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "calculate": "if(selected(${vaccines_2}, 'penta2'),${vaccination_date},'')" - }, - "type": "calculate", - "name": "penta2", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "relevant": "selected(${vaccines_2}, 'penta2')", - "calculate": "2" - }, - "type": "calculate", - "name": "penta2_dose_today", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "calculate": "if(selected(${vaccines_2}, 'pcv3'),${vaccination_date},'')" - }, - "type": "calculate", - "name": "pcv3", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "relevant": "selected(${vaccines_2}, 'pcv3')", - "calculate": "3" - }, - "type": "calculate", - "name": "pcv3_dose_today", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "calculate": "if(selected(${vaccines_2}, 'opv3'),${vaccination_date},'')" - }, - "type": "calculate", - "name": "opv3", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "relevant": "selected(${vaccines_2}, 'opv3')", - "calculate": "3" - }, - "type": "calculate", - "name": "opv3_dose_today", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "calculate": "if(selected(${vaccines_2}, 'penta3'),${vaccination_date},'')" - }, - "type": "calculate", - "name": "penta3", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "relevant": "selected(${vaccines_2}, 'penta3')", - "calculate": "3" - }, - "type": "calculate", - "name": "penta3_dose_today", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "relevant": "selected(${vaccines}, 'ipv')", - "calculate": "if(selected(${vaccines_2}, 'ipv'),${vaccination_date},'')" - }, - "type": "calculate", - "name": "ipv", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "1422AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "calculate": "if(selected(${vaccines_2}, 'measles1'),${vaccination_date},'')" - }, - "type": "calculate", - "name": "measles1", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "relevant": "selected(${vaccines_2}, 'measles1')", - "calculate": "1" - }, - "type": "calculate", - "name": "measles1_dose_today", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "calculate": "if(selected(${vaccines_2}, 'measles2'),${vaccination_date},'')" - }, - "type": "calculate", - "name": "measles2", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "bind": { - "relevant": "selected(${vaccines_2}, 'measles2')", - "calculate": "2" - }, - "type": "calculate", - "name": "measles2_dose_today", - "instance": { - "openmrs_entity": "concept", - "openmrs_entity_id": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity_parent": "36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "control": { - "bodyless": true - }, - "type": "group", - "children": [ - { - "bind": { - "readonly": "true()", - "calculate": "concat('uuid:', uuid())" - }, - "type": "calculate", - "name": "instanceID" - } - ], - "name": "meta" - } - ] -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/child_followup/form.xml b/opensrp-core/src/test/resources/form/child_followup/form.xml deleted file mode 100644 index 88fbcb3586..0000000000 --- a/opensrp-core/src/test/resources/form/child_followup/form.xml +++ /dev/null @@ -1,2276 +0,0 @@ - -
- - -

بچّوں کا فالو اپ رجسٹر برائے ٹیکاجات - Child Follow Up Vaccination Register

- - - - - - - - - - - - -
-
- - کیا آپ کا گھر کا پتہ بدلا ہے؟ - - Has your home address changed? - - - Kya aap ka ghar ka pata badla - hai? - - -
- - -
-
-
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - -
diff --git a/opensrp-core/src/test/resources/form/child_followup/form_definition.json b/opensrp-core/src/test/resources/form/child_followup/form_definition.json deleted file mode 100644 index 38d578690e..0000000000 --- a/opensrp-core/src/test/resources/form/child_followup/form_definition.json +++ /dev/null @@ -1,466 +0,0 @@ -{ - "form_data_definition_version" : "1", - "form" : { - "bind_type" : "pkchild", - "default_bind_path" : "/model/instance/Child_Vaccination_Followup/", - "fields" : [ { - "name" : "id", - "shouldLoadValue" : true - }, { - "name" : "provider_uc", - "bind" : "/model/instance/Child_Vaccination_Followup/provider_uc", - "shouldLoadValue" : true - }, { - "name" : "provider_town", - "bind" : "/model/instance/Child_Vaccination_Followup/provider_town", - "shouldLoadValue" : true - }, { - "name" : "provider_city", - "bind" : "/model/instance/Child_Vaccination_Followup/provider_city", - "shouldLoadValue" : true - }, { - "name" : "provider_province", - "bind" : "/model/instance/Child_Vaccination_Followup/provider_province", - "shouldLoadValue" : true - }, { - "name" : "existing_first_name", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_first_name", - "shouldLoadValue" : true - }, { - "name" : "existing_last_name", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_last_name", - "shouldLoadValue" : true - }, { - "name" : "existing_mother_name", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_mother_name", - "shouldLoadValue" : true - }, { - "name" : "existing_gender", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_gender", - "shouldLoadValue" : true - }, { - "name" : "existing_birth_date", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_client_birth_date", - "shouldLoadValue" : true - }, { - "name" : "existing_client_reg_date", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_client_reg_date", - "shouldLoadValue" : true - }, { - "name" : "existing_landmark", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_landmark", - "shouldLoadValue" : true - }, { - "name" : "existing_house_number", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_house_number", - "shouldLoadValue" : true - }, { - "name" : "existing_street", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_street", - "shouldLoadValue" : true - }, { - "name" : "existing_union_council", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_union_council", - "shouldLoadValue" : true - }, { - "name" : "existing_town", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_town", - "shouldLoadValue" : true - }, { - "name" : "existing_city_village", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_city_village", - "shouldLoadValue" : true - }, { - "name" : "existing_province", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_province", - "shouldLoadValue" : true - }, { - "name" : "existing_union_councilname", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_union_councilname", - "shouldLoadValue" : true - }, { - "name" : "existing_townname", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_townname", - "shouldLoadValue" : true - }, { - "name" : "existing_city_villagename", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_city_villagename", - "shouldLoadValue" : true - }, { - "name" : "existing_provincename", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_provincename", - "shouldLoadValue" : true - }, { - "name" : "existing_ethnicity", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_ethnicity", - "shouldLoadValue" : true - }, { - "name" : "existing_program_client_id", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_program_client_id", - "shouldLoadValue" : true - }, { - "name" : "existing_epi_card_number", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_epi_card_number", - "shouldLoadValue" : true - }, { - "name" : "existing_child_was_suffering_from_a_disease_at_birth", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_child_was_suffering_from_a_disease_at_birth", - "shouldLoadValue" : true - }, { - "name" : "existing_reminders_approval", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_reminders_approval", - "shouldLoadValue" : true - }, { - "name" : "existing_contact_phone_number", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_contact_phone_number", - "shouldLoadValue" : true - }, { - "name" : "e_bcg", - "bind" : "/model/instance/Child_Vaccination_Followup/e_bcg", - "shouldLoadValue" : true - }, { - "name" : "e_opv0", - "bind" : "/model/instance/Child_Vaccination_Followup/e_opv0", - "shouldLoadValue" : true - }, { - "name" : "e_penta2", - "bind" : "/model/instance/Child_Vaccination_Followup/e_penta2", - "shouldLoadValue" : true - }, { - "name" : "e_penta1", - "bind" : "/model/instance/Child_Vaccination_Followup/e_penta1", - "shouldLoadValue" : true - }, { - "name" : "e_penta3", - "bind" : "/model/instance/Child_Vaccination_Followup/e_penta3", - "shouldLoadValue" : true - }, { - "name" : "e_opv1", - "bind" : "/model/instance/Child_Vaccination_Followup/e_opv1", - "shouldLoadValue" : true - }, { - "name" : "e_opv2", - "bind" : "/model/instance/Child_Vaccination_Followup/e_opv2", - "shouldLoadValue" : true - }, { - "name" : "e_opv3", - "bind" : "/model/instance/Child_Vaccination_Followup/e_opv3", - "shouldLoadValue" : true - }, { - "name" : "e_pcv1", - "bind" : "/model/instance/Child_Vaccination_Followup/e_pcv1", - "shouldLoadValue" : true - }, { - "name" : "e_pcv2", - "bind" : "/model/instance/Child_Vaccination_Followup/e_pcv2", - "shouldLoadValue" : true - }, { - "name" : "e_pcv3", - "bind" : "/model/instance/Child_Vaccination_Followup/e_pcv3", - "shouldLoadValue" : true - }, { - "name" : "e_ipv", - "bind" : "/model/instance/Child_Vaccination_Followup/e_ipv", - "shouldLoadValue" : true - }, { - "name" : "e_measles1", - "bind" : "/model/instance/Child_Vaccination_Followup/e_measles1", - "shouldLoadValue" : true - }, { - "name" : "e_measles2", - "bind" : "/model/instance/Child_Vaccination_Followup/e_measles2", - "shouldLoadValue" : true - }, { - "name" : "provider_id", - "bind" : "/model/instance/Child_Vaccination_Followup/provider_id", - "shouldLoadValue" : true - }, { - "name" : "provider_location_id", - "bind" : "/model/instance/Child_Vaccination_Followup/provider_location_id", - "shouldLoadValue" : true - }, { - "name" : "provider_location_name", - "bind" : "/model/instance/Child_Vaccination_Followup/provider_location_name", - "shouldLoadValue" : true - }, { - "name" : "provider_location_note", - "bind" : "/model/instance/Child_Vaccination_Followup/provider_location_note" - }, { - "name" : "start", - "bind" : "/model/instance/Child_Vaccination_Followup/start" - }, { - "name" : "end", - "bind" : "/model/instance/Child_Vaccination_Followup/end" - }, { - "name" : "today", - "bind" : "/model/instance/Child_Vaccination_Followup/today" - }, { - "name" : "deviceid", - "bind" : "/model/instance/Child_Vaccination_Followup/deviceid" - }, { - "name" : "subscriberid", - "bind" : "/model/instance/Child_Vaccination_Followup/subscriberid" - }, { - "name" : "simserial", - "bind" : "/model/instance/Child_Vaccination_Followup/simserial" - }, { - "name" : "phonenumber", - "bind" : "/model/instance/Child_Vaccination_Followup/phonenumber" - }, { - "name" : "existing_client_reg_date_note", - "bind" : "/model/instance/Child_Vaccination_Followup/existing_client_reg_date_note" - }, { - "name" : "program_client_id_note", - "bind" : "/model/instance/Child_Vaccination_Followup/program_client_id_note" - }, { - "name" : "epi_card_number_note", - "bind" : "/model/instance/Child_Vaccination_Followup/epi_card_number_note" - }, { - "name" : "first_name_note", - "bind" : "/model/instance/Child_Vaccination_Followup/first_name_note" - }, { - "name" : "last_name_note", - "bind" : "/model/instance/Child_Vaccination_Followup/last_name_note" - }, { - "name" : "child_age", - "bind" : "/model/instance/Child_Vaccination_Followup/child_age" - }, { - "name" : "calc_dob_note", - "bind" : "/model/instance/Child_Vaccination_Followup/calc_dob_note" - }, { - "name" : "gender_note", - "bind" : "/model/instance/Child_Vaccination_Followup/gender_note" - }, { - "name" : "mother_name_note", - "bind" : "/model/instance/Child_Vaccination_Followup/mother_name_note" - }, { - "name" : "exisiting_ethnicity_note", - "bind" : "/model/instance/Child_Vaccination_Followup/exisiting_ethnicity_note" - }, { - "name" : "address", - "bind" : "/model/instance/Child_Vaccination_Followup/address" - }, { - "name" : "address_change", - "bind" : "/model/instance/Child_Vaccination_Followup/address_change" - }, { - "name" : "province", - "bind" : "/model/instance/Child_Vaccination_Followup/province" - }, { - "name" : "city_village", - "bind" : "/model/instance/Child_Vaccination_Followup/city_village" - }, { - "name" : "town", - "bind" : "/model/instance/Child_Vaccination_Followup/town" - }, { - "name" : "union_council", - "bind" : "/model/instance/Child_Vaccination_Followup/union_council" - }, { - "name" : "house_number", - "bind" : "/model/instance/Child_Vaccination_Followup/house_number" - }, { - "name" : "street", - "bind" : "/model/instance/Child_Vaccination_Followup/street" - }, { - "name" : "landmark", - "bind" : "/model/instance/Child_Vaccination_Followup/landmark" - }, { - "name" : "center_gps", - "bind" : "/model/instance/Child_Vaccination_Followup/center_gps" - }, { - "name" : "child_was_suffering_from_a_disease_at_birth_note", - "bind" : "/model/instance/Child_Vaccination_Followup/child_was_suffering_from_a_disease_at_birth_note" - }, { - "name" : "aefi", - "bind" : "/model/instance/Child_Vaccination_Followup/aefi" - }, { - "name" : "reminders_approval", - "bind" : "/model/instance/Child_Vaccination_Followup/reminders_approval" - }, { - "name" : "contact_phone_number", - "bind" : "/model/instance/Child_Vaccination_Followup/contact_phone_number" - }, { - "name" : "six_weeks", - "bind" : "/model/instance/Child_Vaccination_Followup/six_weeks" - }, { - "name" : "ten_weeks", - "bind" : "/model/instance/Child_Vaccination_Followup/ten_weeks" - }, { - "name" : "forteen_weeks", - "bind" : "/model/instance/Child_Vaccination_Followup/forteen_weeks" - }, { - "name" : "nine_months", - "bind" : "/model/instance/Child_Vaccination_Followup/nine_months" - }, { - "name" : "fifteen_months", - "bind" : "/model/instance/Child_Vaccination_Followup/fifteen_months" - }, { - "name" : "vaccines", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines" - }, { - "name" : "bcg_retro", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/bcg_retro" - }, { - "name" : "opv0_retro", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/opv0_retro" - }, { - "name" : "opv0_dose", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/opv0_dose" - }, { - "name" : "pcv1_retro", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/pcv1_retro" - }, { - "name" : "pcv1_dose", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/pcv1_dose" - }, { - "name" : "opv1_retro", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/opv1_retro" - }, { - "name" : "opv1_dose", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/opv1_dose" - }, { - "name" : "penta1_retro", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/penta1_retro" - }, { - "name" : "penta1_dose", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/penta1_dose" - }, { - "name" : "pcv2_retro", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/pcv2_retro" - }, { - "name" : "pcv2_dose", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/pcv2_dose" - }, { - "name" : "opv2_retro", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/opv2_retro" - }, { - "name" : "opv2_dose", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/opv2_dose" - }, { - "name" : "penta2_retro", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/penta2_retro" - }, { - "name" : "penta2_dose", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/penta2_dose" - }, { - "name" : "pcv3_retro", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/pcv3_retro" - }, { - "name" : "pcv3_dose", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/pcv3_dose" - }, { - "name" : "opv3_retro", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/opv3_retro" - }, { - "name" : "opv3_dose", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/opv3_dose" - }, { - "name" : "penta3_retro", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/penta3_retro" - }, { - "name" : "penta3_dose", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/penta3_dose" - }, { - "name" : "ipv_retro", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/ipv_retro" - }, { - "name" : "measles1_retro", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/measles1_retro" - }, { - "name" : "measles1_dose", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/measles1_dose" - }, { - "name" : "measles2_retro", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/measles2_retro" - }, { - "name" : "measles2_dose", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_group/measles2_dose" - }, { - "name" : "vaccines_2", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccines_2" - }, { - "name" : "vaccination_date", - "bind" : "/model/instance/Child_Vaccination_Followup/vaccination_date" - }, { - "name" : "bcg", - "bind" : "/model/instance/Child_Vaccination_Followup/bcg" - }, { - "name" : "opv0", - "bind" : "/model/instance/Child_Vaccination_Followup/opv0" - }, { - "name" : "opv0_dose_today", - "bind" : "/model/instance/Child_Vaccination_Followup/opv0_dose_today" - }, { - "name" : "pcv1", - "bind" : "/model/instance/Child_Vaccination_Followup/pcv1" - }, { - "name" : "pcv1_dose_today", - "bind" : "/model/instance/Child_Vaccination_Followup/pcv1_dose_today" - }, { - "name" : "opv1", - "bind" : "/model/instance/Child_Vaccination_Followup/opv1" - }, { - "name" : "opv1_dose_today", - "bind" : "/model/instance/Child_Vaccination_Followup/opv1_dose_today" - }, { - "name" : "penta1", - "bind" : "/model/instance/Child_Vaccination_Followup/penta1" - }, { - "name" : "penta1_dose_today", - "bind" : "/model/instance/Child_Vaccination_Followup/penta1_dose_today" - }, { - "name" : "pcv2", - "bind" : "/model/instance/Child_Vaccination_Followup/pcv2" - }, { - "name" : "pcv2_dose_today", - "bind" : "/model/instance/Child_Vaccination_Followup/pcv2_dose_today" - }, { - "name" : "opv2", - "bind" : "/model/instance/Child_Vaccination_Followup/opv2" - }, { - "name" : "opv2_dose_today", - "bind" : "/model/instance/Child_Vaccination_Followup/opv2_dose_today" - }, { - "name" : "penta2", - "bind" : "/model/instance/Child_Vaccination_Followup/penta2" - }, { - "name" : "penta2_dose_today", - "bind" : "/model/instance/Child_Vaccination_Followup/penta2_dose_today" - }, { - "name" : "pcv3", - "bind" : "/model/instance/Child_Vaccination_Followup/pcv3" - }, { - "name" : "pcv3_dose_today", - "bind" : "/model/instance/Child_Vaccination_Followup/pcv3_dose_today" - }, { - "name" : "opv3", - "bind" : "/model/instance/Child_Vaccination_Followup/opv3" - }, { - "name" : "opv3_dose_today", - "bind" : "/model/instance/Child_Vaccination_Followup/opv3_dose_today" - }, { - "name" : "penta3", - "bind" : "/model/instance/Child_Vaccination_Followup/penta3" - }, { - "name" : "penta3_dose_today", - "bind" : "/model/instance/Child_Vaccination_Followup/penta3_dose_today" - }, { - "name" : "ipv", - "bind" : "/model/instance/Child_Vaccination_Followup/ipv" - }, { - "name" : "measles1", - "bind" : "/model/instance/Child_Vaccination_Followup/measles1" - }, { - "name" : "measles1_dose_today", - "bind" : "/model/instance/Child_Vaccination_Followup/measles1_dose_today" - }, { - "name" : "measles2", - "bind" : "/model/instance/Child_Vaccination_Followup/measles2" - }, { - "name" : "measles2_dose_today", - "bind" : "/model/instance/Child_Vaccination_Followup/measles2_dose_today" - }, { - "name" : "instanceID", - "bind" : "/model/instance/Child_Vaccination_Followup/meta/instanceID" - } ] - } -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/child_followup/form_submission.json b/opensrp-core/src/test/resources/form/child_followup/form_submission.json deleted file mode 100644 index c87aa72b38..0000000000 --- a/opensrp-core/src/test/resources/form/child_followup/form_submission.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "_id": "3958f907af3f2842a3945b4aa9fd70b1", - "_rev": "1-3ceb37b50c6fd42051f2a9c1f809bf4e", - "type": "FormSubmission", - "anmId": "demotest", - "instanceId": "c9386e66-97d0-4c2e-8e72-3e0fe6981cbe", - "formName": "child_followup", - "entityId": "101aab44-5377-4846-95ad-442b857b54d2", - "clientVersion": 1476448247921, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "pkchild", - "default_bind_path": "/model/instance/Child_Vaccination_Followup/", - "fields": [ - { - "name": "id", - "value": "101aab44-5377-4846-95ad-442b857b54d2", - "source": "pkchild.id" - }, - { - "name": "instanceID", - "value": "uid:c9386e66-97d0-4c2e-8e72-3e0fe6981cbe", - "source": "pkchild.instanceID" - }, - { - "name": "provider_id", - "value": "demotest", - "source": "pkchild.provider_id" - }, - { - "name": "provider_location_id", - "value": "BHU 33C", - "source": "pkchild.provider_location_id" - }, - { - "name": "start", - "value": "2016-09-16 10:20:54", - "source": "pkchild.start" - }, - { - "name": "end", - "value": "2016-09-16 10:20:54", - "source": "pkchild.end" - }, - { - "name": "today", - "value": "2016-09-20", - "source": "pkchild.today" - }, - { - "name": "vaccination_date", - "value": "2016-09-20", - "source": "pkchild.vaccination_date" - }, - { - "name": "vaccines", - "value": "penta1", - "source": "pkchild.vaccines" - }, - { - "name": "pentavalent_1", - "value": "2016-09-20", - "source": "pkchild.penta1" - }, - { - "name": "pentavalent_1_retro", - "value": "2016-09-20", - "source": "pkchild.penta1" - }, - { - "name": "pentavalent_2", - "source": "pkchild.penta1" - }, - { - "name": "pentavalent_2_retro", - "source": "pkchild.penta1" - }, - { - "name": "penta1_dose_today", - "value": "1", - "source": "pkchild.penta1_dose_today" - } - ], - "fieldsAsMap": { - "id": "101aab44-5377-4846-95ad-442b857b54d2", - "vaccines": "penta1", - "penta1_dose_today": "1", - "pentavalent_1": "2016-09-20", - "pentavalent_1_retro": "2016-09-20", - "start": "2016-09-16 10:20:54", - "provider_id": "demotest", - "instanceID": "uid:c9386e66-97d0-4c2e-8e72-3e0fe6981cbe", - "vaccination_date": "2016-09-20", - "today": "2016-09-20", - "provider_location_id": "BHU 33C", - "end": "2016-09-16 10:20:54" - } - } - }, - "serverVersion": 1484828390836 -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/child_followup/model.xml b/opensrp-core/src/test/resources/form/child_followup/model.xml deleted file mode 100644 index b8d42cd6ba..0000000000 --- a/opensrp-core/src/test/resources/form/child_followup/model.xml +++ /dev/null @@ -1,1685 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - ${provider_province} - ${provider_city} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${today} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - static_instance-provinces-0 - kpk - - - static_instance-provinces-1 - sindh - - - static_instance-provinces-2 - balochistan - - - static_instance-provinces-3 - punjab - - - static_instance-provinces-4 - gilgit_baltistan - - - static_instance-provinces-5 - kashmir - - - static_instance-provinces-6 - fata - - - static_instance-provinces-7 - out_of_country - - - - - - - static_instance-ucs-0 - sindh - karachi - korangi - bilal_colony - - - static_instance-ucs-1 - sindh - karachi - korangi - nasir_colony - - - static_instance-ucs-2 - sindh - karachi - korangi - chakra_goth - - - static_instance-ucs-3 - sindh - karachi - korangi - mustafa_taj_colony - - - static_instance-ucs-4 - sindh - karachi - korangi - hundred_quarters - - - static_instance-ucs-5 - sindh - karachi - korangi - gulzar_colony - - - static_instance-ucs-6 - sindh - karachi - korangi - korangi_sector_33 - - - static_instance-ucs-7 - sindh - karachi - korangi - zaman_town - - - static_instance-ucs-8 - sindh - karachi - korangi - hasrat_mohani_colony - - - static_instance-ucs-9 - sindh - karachi - baldia - gulshan_e_ghazi - - - static_instance-ucs-10 - sindh - karachi - baldia - ittehad_town - - - static_instance-ucs-11 - sindh - karachi - baldia - islam_nagar - - - static_instance-ucs-12 - sindh - karachi - baldia - nai_abadi - - - static_instance-ucs-13 - sindh - karachi - baldia - saeedabad - - - static_instance-ucs-14 - sindh - karachi - baldia - muslim_mujahid_colony - - - static_instance-ucs-15 - sindh - karachi - baldia - muhajir_camp - - - static_instance-ucs-16 - sindh - karachi - baldia - rasheedabad - - - static_instance-ucs-17 - sindh - karachi - bin_qasim - ibrahim_hyderi - - - static_instance-ucs-18 - sindh - karachi - bin_qasim - rehri - - - static_instance-ucs-19 - sindh - karachi - bin_qasim - cattle_colony - - - static_instance-ucs-20 - sindh - karachi - bin_qasim - qaidabad - - - static_instance-ucs-21 - sindh - karachi - bin_qasim - landhi_colony - - - static_instance-ucs-22 - sindh - karachi - bin_qasim - gulshan_e_hadeed - - - static_instance-ucs-23 - sindh - karachi - bin_qasim - gaghar - - - static_instance-ucs-24 - sindh - karachi - gadap - murad_memon_goth - - - static_instance-ucs-25 - sindh - karachi - gadap - darsano_chana - - - static_instance-ucs-26 - sindh - karachi - gadap - gujro - - - static_instance-ucs-27 - sindh - karachi - gadap - songal - - - static_instance-ucs-28 - sindh - karachi - gadap - maymarabad - - - static_instance-ucs-29 - sindh - karachi - gadap - yousuf_goth - - - static_instance-ucs-30 - sindh - karachi - gadap - manghopir - - - static_instance-ucs-31 - sindh - karachi - gulberg - azizabad - - - static_instance-ucs-32 - sindh - karachi - gulberg - karimabad - - - static_instance-ucs-33 - sindh - karachi - gulberg - aisha_manzil - - - static_instance-ucs-34 - sindh - karachi - gulberg - ancholi - - - static_instance-ucs-35 - sindh - karachi - gulberg - naseerabad - - - static_instance-ucs-36 - sindh - karachi - gulberg - yaseenabad - - - static_instance-ucs-37 - sindh - karachi - gulberg - water_pump - - - static_instance-ucs-38 - sindh - karachi - gulberg - shafiq_mill_colony - - - static_instance-ucs-39 - sindh - karachi - gulshan - delhi_mercantile_society - - - static_instance-ucs-40 - sindh - karachi - gulshan - civic_centre - - - static_instance-ucs-41 - sindh - karachi - gulshan - pir_ilahi_buksh_colony - - - static_instance-ucs-42 - sindh - karachi - gulshan - essa_nagri - - - static_instance-ucs-43 - sindh - karachi - gulshan - gulshan_e_iqbal - - - static_instance-ucs-44 - sindh - karachi - gulshan - gillani_railway_station - - - static_instance-ucs-45 - sindh - karachi - gulshan - shanti_nagar - - - static_instance-ucs-46 - sindh - karachi - gulshan - jamali_colony - - - static_instance-ucs-47 - sindh - karachi - gulshan - gulshan_e_iqbal_ii - - - static_instance-ucs-48 - sindh - karachi - gulshan - pehlwan_goth - - - static_instance-ucs-49 - sindh - karachi - gulshan - matrovil_colony - - - static_instance-ucs-50 - sindh - karachi - gulshan - gulzar_e_hijri - - - static_instance-ucs-51 - sindh - karachi - gulshan - safooran_goth - - - static_instance-ucs-52 - sindh - karachi - jamshed - akhtar_colony - - - static_instance-ucs-53 - sindh - karachi - jamshed - manzoor_colony - - - static_instance-ucs-54 - sindh - karachi - jamshed - azam_basti - - - static_instance-ucs-55 - sindh - karachi - jamshed - chanesar_goth - - - static_instance-ucs-56 - sindh - karachi - jamshed - mahmudabad - - - static_instance-ucs-57 - sindh - karachi - jamshed - pechs - - - static_instance-ucs-58 - sindh - karachi - jamshed - pechs_ii - - - static_instance-ucs-59 - sindh - karachi - jamshed - jut_line - - - static_instance-ucs-60 - sindh - karachi - jamshed - central_jacob_lines - - - static_instance-ucs-61 - sindh - karachi - jamshed - jamshed_quarters - - - static_instance-ucs-62 - sindh - karachi - jamshed - garden_east - - - static_instance-ucs-63 - sindh - karachi - jamshed - soldier_bazar - - - static_instance-ucs-64 - sindh - karachi - jamshed - pakistan_quarters - - - static_instance-ucs-65 - sindh - karachi - kiamari - bhutta_village - - - static_instance-ucs-66 - sindh - karachi - kiamari - sultanabad - - - static_instance-ucs-67 - sindh - karachi - kiamari - kiamari_uc - - - static_instance-ucs-68 - sindh - karachi - kiamari - baba_bhit - - - static_instance-ucs-69 - sindh - karachi - kiamari - machar_colony - - - static_instance-ucs-70 - sindh - karachi - kiamari - maripur - - - static_instance-ucs-71 - sindh - karachi - kiamari - shershah - - - static_instance-ucs-72 - sindh - karachi - kiamari - gabo_pat - - - static_instance-ucs-73 - sindh - karachi - landhi - muzafarabad - - - static_instance-ucs-74 - sindh - karachi - landhi - muslimabad - - - static_instance-ucs-75 - sindh - karachi - landhi - dawood_chowrangi - - - static_instance-ucs-76 - sindh - karachi - landhi - moinabad - - - static_instance-ucs-77 - sindh - karachi - landhi - sharafi_goth - - - static_instance-ucs-78 - sindh - karachi - landhi - bhutto_nagar - - - static_instance-ucs-79 - sindh - karachi - landhi - khawaja_ajmeer_colony - - - static_instance-ucs-80 - sindh - karachi - landhi - landhi_uc - - - static_instance-ucs-81 - sindh - karachi - landhi - awami_colony - - - static_instance-ucs-82 - sindh - karachi - landhi - burmee_colony - - - static_instance-ucs-83 - sindh - karachi - landhi - korangi_uc - - - static_instance-ucs-84 - sindh - karachi - landhi - sherabad - - - static_instance-ucs-85 - sindh - karachi - liaquatabad - rizvia_society - - - static_instance-ucs-86 - sindh - karachi - liaquatabad - firdous_colony - - - static_instance-ucs-87 - sindh - karachi - liaquatabad - super_market - - - static_instance-ucs-88 - sindh - karachi - liaquatabad - dak_khana - - - static_instance-ucs-89 - sindh - karachi - liaquatabad - qasimabad - - - static_instance-ucs-90 - sindh - karachi - liaquatabad - bandhani_colony - - - static_instance-ucs-91 - sindh - karachi - liaquatabad - sharifabad - - - static_instance-ucs-92 - sindh - karachi - liaquatabad - commercial_area - - - static_instance-ucs-93 - sindh - karachi - liaquatabad - mujahid_colony - - - static_instance-ucs-94 - sindh - karachi - liaquatabad - nazimabad - - - static_instance-ucs-95 - sindh - karachi - liaquatabad - abbasi_shaheed - - - static_instance-ucs-96 - sindh - karachi - lyari - agra_taj_colony - - - static_instance-ucs-97 - sindh - karachi - lyari - daryaabad - - - static_instance-ucs-98 - sindh - karachi - lyari - nawabad - - - static_instance-ucs-99 - sindh - karachi - lyari - khada_memon_society - - - static_instance-ucs-100 - sindh - karachi - lyari - baghdadi - - - static_instance-ucs-101 - sindh - karachi - lyari - shah_baig_line - - - static_instance-ucs-102 - sindh - karachi - lyari - bihar_colony - - - static_instance-ucs-103 - sindh - karachi - lyari - ragiwara - - - static_instance-ucs-104 - sindh - karachi - lyari - singo_line - - - static_instance-ucs-105 - sindh - karachi - lyari - chakiwara - - - static_instance-ucs-106 - sindh - karachi - lyari - allama_iqbal_colony - - - static_instance-ucs-107 - sindh - karachi - malir - model_colony - - - static_instance-ucs-108 - sindh - karachi - malir - kala_board - - - static_instance-ucs-109 - sindh - karachi - malir - saudabad - - - static_instance-ucs-110 - sindh - karachi - malir - khokhra_par - - - static_instance-ucs-111 - sindh - karachi - malir - jafar_e_tayyar - - - static_instance-ucs-112 - sindh - karachi - malir - gharibabad - - - static_instance-ucs-113 - sindh - karachi - malir - ghazi_brohi_goth - - - static_instance-ucs-114 - sindh - karachi - new_karachi - kalyana - - - static_instance-ucs-115 - sindh - karachi - new_karachi - sir_syed_colony - - - static_instance-ucs-116 - sindh - karachi - new_karachi - fatima_jinnah_colony - - - static_instance-ucs-117 - sindh - karachi - new_karachi - godhra - - - static_instance-ucs-118 - sindh - karachi - new_karachi - abu_zar_ghaffari - - - static_instance-ucs-119 - sindh - karachi - new_karachi - hakim_ahsan - - - static_instance-ucs-120 - sindh - karachi - new_karachi - madina_colony - - - static_instance-ucs-121 - sindh - karachi - new_karachi - faisal_colony - - - static_instance-ucs-122 - sindh - karachi - new_karachi - khamiso_goth - - - static_instance-ucs-123 - sindh - karachi - new_karachi - mustufa_colony - - - static_instance-ucs-124 - sindh - karachi - new_karachi - khawaja_ajmeer_nagri - - - static_instance-ucs-125 - sindh - karachi - new_karachi - gulshan_e_saeed - - - static_instance-ucs-126 - sindh - karachi - new_karachi - shah_nawaz_bhutto_colony - - - static_instance-ucs-127 - sindh - karachi - north_nazimabad - paposh_nagar - - - static_instance-ucs-128 - sindh - karachi - north_nazimabad - pahar_ganj - - - static_instance-ucs-129 - sindh - karachi - north_nazimabad - khandu_goth - - - static_instance-ucs-130 - sindh - karachi - north_nazimabad - hyderi - - - static_instance-ucs-131 - sindh - karachi - north_nazimabad - sakhi_hassan - - - static_instance-ucs-132 - sindh - karachi - north_nazimabad - farooq_e_azam - - - static_instance-ucs-133 - sindh - karachi - north_nazimabad - nusrat_bhutto_colony - - - static_instance-ucs-134 - sindh - karachi - north_nazimabad - shadman_town - - - static_instance-ucs-135 - sindh - karachi - north_nazimabad - buffer_zone - - - static_instance-ucs-136 - sindh - karachi - north_nazimabad - buffer_zone_ii - - - static_instance-ucs-137 - sindh - karachi - orangi - mominabad - - - static_instance-ucs-138 - sindh - karachi - orangi - haryana_colony - - - static_instance-ucs-139 - sindh - karachi - orangi - hanifabad - - - static_instance-ucs-140 - sindh - karachi - orangi - mohammad_nagar - - - static_instance-ucs-141 - sindh - karachi - orangi - madina_colony_orangi - - - static_instance-ucs-142 - sindh - karachi - orangi - ghaziabad - - - static_instance-ucs-143 - sindh - karachi - orangi - chisti_nagar - - - static_instance-ucs-144 - sindh - karachi - orangi - bilal_colony_orangi - - - static_instance-ucs-145 - sindh - karachi - orangi - iqbal_baloch_colony - - - static_instance-ucs-146 - sindh - karachi - orangi - ghabool_town - - - static_instance-ucs-147 - sindh - karachi - orangi - data_nagar - - - static_instance-ucs-148 - sindh - karachi - orangi - mujahidabad - - - static_instance-ucs-149 - sindh - karachi - orangi - baloch_goth - - - static_instance-ucs-150 - sindh - karachi - saddar - old_haji_camp - - - static_instance-ucs-151 - sindh - karachi - saddar - garden - - - static_instance-ucs-152 - sindh - karachi - saddar - kharadar - - - static_instance-ucs-153 - sindh - karachi - saddar - city_railway_colony - - - static_instance-ucs-154 - sindh - karachi - saddar - nanak_wara - - - static_instance-ucs-155 - sindh - karachi - saddar - gazdarabad - - - static_instance-ucs-156 - sindh - karachi - saddar - millat_nagar_islam_pura - - - static_instance-ucs-157 - sindh - karachi - saddar - saddar_uc - - - static_instance-ucs-158 - sindh - karachi - saddar - civil_line - - - static_instance-ucs-159 - sindh - karachi - saddar - clifton - - - static_instance-ucs-160 - sindh - karachi - saddar - kehkashan - - - static_instance-ucs-161 - sindh - karachi - shah_faisal - natha_khan_goth - - - static_instance-ucs-162 - sindh - karachi - shah_faisal - pak_sadat_colony - - - static_instance-ucs-163 - sindh - karachi - shah_faisal - drigh_colony - - - static_instance-ucs-164 - sindh - karachi - shah_faisal - raita_plot - - - static_instance-ucs-165 - sindh - karachi - shah_faisal - moria_khan_goth - - - static_instance-ucs-166 - sindh - karachi - shah_faisal - rafa_e_aam_society - - - static_instance-ucs-167 - sindh - karachi - shah_faisal - al_falah_society - - - static_instance-ucs-168 - sindh - karachi - site - pak_colony - - - static_instance-ucs-169 - sindh - karachi - site - old_golimar - - - static_instance-ucs-170 - sindh - karachi - site - jahanabad - - - static_instance-ucs-171 - sindh - karachi - site - metrovil - - - static_instance-ucs-172 - sindh - karachi - site - bhawani_chali - - - static_instance-ucs-173 - sindh - karachi - site - frontier_colony - - - static_instance-ucs-174 - sindh - karachi - site - banaras_colony - - - static_instance-ucs-175 - sindh - karachi - site - qasba_colony - - - static_instance-ucs-176 - sindh - karachi - site - islamia_colony - - - static_instance-ucs-177 - na - na - na - other - - - static_instance-ucs-178 - na - na - na - not_applicable - - - - - - - static_instance-gender-0 - male - - - static_instance-gender-1 - female - - - static_instance-gender-2 - transgender - - - - - - - static_instance-vaccines-0 - bcg - - - static_instance-vaccines-1 - opv0 - - - static_instance-vaccines-2 - pcv1 - - - static_instance-vaccines-3 - opv1 - - - static_instance-vaccines-4 - penta1 - - - static_instance-vaccines-5 - pcv2 - - - static_instance-vaccines-6 - opv2 - - - static_instance-vaccines-7 - penta2 - - - static_instance-vaccines-8 - pcv3 - - - static_instance-vaccines-9 - opv3 - - - static_instance-vaccines-10 - penta3 - - - static_instance-vaccines-11 - ipv - - - static_instance-vaccines-12 - measles1 - - - static_instance-vaccines-13 - measles2 - - - - - - - static_instance-towns-0 - sindh - karachi - korangi - - - static_instance-towns-1 - sindh - karachi - landhi - - - static_instance-towns-2 - sindh - karachi - baldia - - - static_instance-towns-3 - sindh - karachi - bin_qasim - - - static_instance-towns-4 - sindh - karachi - gadap - - - static_instance-towns-5 - sindh - karachi - gulberg - - - static_instance-towns-6 - sindh - karachi - gulshan - - - static_instance-towns-7 - sindh - karachi - jamshed - - - static_instance-towns-8 - sindh - karachi - kiamari - - - static_instance-towns-9 - sindh - karachi - liaquatabad - - - static_instance-towns-10 - sindh - karachi - lyari - - - static_instance-towns-11 - sindh - karachi - malir - - - static_instance-towns-12 - sindh - karachi - new_karachi - - - static_instance-towns-13 - sindh - karachi - north_nazimabad - - - static_instance-towns-14 - sindh - karachi - orangi - - - static_instance-towns-15 - sindh - karachi - saddar - - - static_instance-towns-16 - sindh - karachi - shah_faisal - - - static_instance-towns-17 - sindh - karachi - site - - - static_instance-towns-18 - na - na - other - - - static_instance-towns-19 - na - na - not_applicable - - - - - - - static_instance-cities-0 - sindh - karachi - - - static_instance-cities-1 - punjab - hafizabad - - - static_instance-cities-2 - punjab - muzaffargarh - - - static_instance-cities-3 - na - other - - - static_instance-cities-4 - na - not_applicable - - - - - - - static_instance-yes_no-0 - yes - - - static_instance-yes_no-1 - no - - - - diff --git a/opensrp-core/src/test/resources/form/entity_relationship.json b/opensrp-core/src/test/resources/form/entity_relationship.json deleted file mode 100644 index 136f8cee02..0000000000 --- a/opensrp-core/src/test/resources/form/entity_relationship.json +++ /dev/null @@ -1,34 +0,0 @@ -[ - { - "parent": "household", - "child": "elco", - "field": "wife", - "kind": "one_to_many", - "from": "household.id", - "to": "elco.relationalid" - }, - { - "parent": "elco", - "child": "child", - "field": "child", - "kind": "one_to_many", - "from": "elco.id", - "to": "child.motherCaseId" - }, - { - "parent": "eligible_couple", - "child": "mother", - "field": "wife", - "kind": "one_to_one", - "from": "eligible_couple.id", - "to": "mother.ecCaseId" - }, - { - "parent": "mother", - "child": "child", - "field": "children", - "kind": "one_to_many", - "from": "mother.id", - "to": "child.motherCaseId" - } -] \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/new_household_registration/form.json b/opensrp-core/src/test/resources/form/new_household_registration/form.json deleted file mode 100644 index 0288ac30df..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration/form.json +++ /dev/null @@ -1,655 +0,0 @@ -{ - "default_language": "Bengali", - "id_string": "FWNewHH_1", - "children": [ - { - "name": "existing_location", - "instance": { - "openmrs_entity_id": "location_id", - "openmrs_entity": "encounter" - }, - "type": "hidden" - }, - { - "name": "today", - "instance": { - "openmrs_entity_id": "encounter_date", - "openmrs_entity": "encounter" - }, - "type": "today" - }, - { - "name": "start", - "instance": { - "openmrs_entity_id": "encounter_start", - "openmrs_entity": "encounter" - }, - "type": "start" - }, - { - "name": "end", - "instance": { - "openmrs_entity_id": "encounter_end", - "openmrs_entity": "encounter" - }, - "type": "end" - }, - { - "name": "FWNHREGDATE", - "hint": { - "Bengali": "আজকের তারিখ দিন", - "English": "Confirm Today’s date is correct" - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "তারিখ আজকের তারিখের চেয়ে বেশী হতে পারবেনা", - "English": "Date cannot be greater than current date." - }, - "required": "yes", - "constraint": ".<=${today}" - }, - "label": { - "Bengali": "তথ্য সংগ্রহের তারিখ", - "English": "Date of Interview" - }, - "instance": { - "openmrs_entity_id": "160753AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "date" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWGOBHHID", - "hint": { - "Bengali": "অনুগ্রহ করে খানার দরজাতে লেখা কালো রঙের JiVitA/Study household ID (HHID) টি টাইপ করুন", - "English": "Please input the Black – painted Government household ID (HHID) as displayed on the door/wall of the HH." - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "অনুগ্রহ করে ০০০১ থেকে ৯৯৯৯ এর মধ্যে ৪ ডিজিটের GoB HHID টাইপ করুন", - "English": "Please enter 4 digits of GoB HHID from 0001 to 9999" - }, - "required": "yes", - "constraint": "regex(., '^(?!0{4})[0-9]{4}$')" - }, - "label": { - "Bengali": "GoB HHID", - "English": "GoB HHID" - }, - "instance": { - "openmrs_entity_id": "GOB HHID", - "openmrs_entity": "person_identifier" - }, - "type": "text" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWJIVHHID", - "hint": { - "Bengali": "অনুগ্রহ করে খানার দরজাতে লেখা লাল রঙের JiVitA/Study household ID (HHID) টি টাইপ করুন", - "English": "Please input the RED – painted JiVitA / Study household ID (HHID) as displayed on the door/wall of the HH." - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "অনুগ্রহ করে ০০০১ থেকে ৯৯৯৯ এর মধ্যে ৪ ডিজিটের JiVitA HHID টাইপ করুন", - "English": "Please enter 4 digits of JiVitA HHID from 0001 to 9999" - }, - "required": "yes", - "constraint": "regex(., '^(?!0{4})[0-9]{4}$')" - }, - "label": { - "Bengali": "JiVitA HHID", - "English": "JiVitA HHID" - }, - "instance": { - "openmrs_entity_id": "JiVitA HHID", - "openmrs_entity": "person_identifier" - }, - "type": "text" - }, - { - "name": "FWNHNEARTO", - "label": { - "Bengali": "নিকটবর্তী স্থান", - "English": "Near to" - }, - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "landmark", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "FWNHHHGPS", - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "জি পি এস", - "English": "Collect GPS Location of HH" - }, - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "geopoint", - "openmrs_entity": "person_address" - }, - "type": "geopoint" - }, - { - "name": "FWHOHFNAME", - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "খানা প্রধানের নাম-", - "English": "Head of Household Name" - }, - "instance": { - "openmrs_entity_id": "first_name", - "openmrs_entity": "person" - }, - "type": "text" - }, - { - "name": "FWHOHLNAME", - "bind": { - "calculate": "\".\"" - }, - "instance": { - "openmrs_entity_id": "last_name", - "openmrs_entity": "person" - }, - "type": "calculate" - }, - { - "name": "FWHOHBIRTHDATE", - "bind": { - "calculate": "\"1900-01-01\"" - }, - "instance": { - "openmrs_entity_id": "birthdate", - "openmrs_entity": "person" - }, - "type": "calculate" - }, - { - "name": "FWHOHGENDER", - "bind": { - "calculate": "\"male\"" - }, - "instance": { - "openmrs_entity_id": "gender", - "openmrs_entity": "person" - }, - "type": "calculate" - }, - { - "name": "FWNHHMBRNUM", - "label": { - "Bengali": "খানা সদস্যের সংখ্যা কত?", - "English": "How many people are currently living in this household?" - }, - "instance": { - "openmrs_entity_id": "5611AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "integer" - }, - { - "children": [ - { - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - }, - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - }, - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "9", - "label": { - "Bengali": "জানিনা", - "English": "Don't know" - }, - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - } - ], - "name": "FWNHHMWRA", - "label": { - "Bengali": "এই খানায় কি প্রজনন বয়সী বিবাহিত মহিলা আছেন?", - "English": "Are there any MWRAs in this Household?" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "FWWOMFNAME", - "hint": { - "Bengali": "অনুগ্রহ করে মহিলার নাম টাইপ করুন", - "English": "Please type woman's name" - }, - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "মহিলার নাম-", - "English": "Woman Name" - }, - "instance": { - "openmrs_entity_id": "first_name", - "openmrs_entity": "person" - }, - "type": "text" - }, - { - "name": "FWWOMLNAME", - "bind": { - "calculate": "\".\"" - }, - "instance": { - "openmrs_entity_id": "last_name", - "openmrs_entity": "person" - }, - "type": "calculate" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWWOMNID", - "hint": { - "Bengali": "অনুগ্রহ করে জাতীয় পরিচয়পত্র কার্ড দেখে সরকার প্রদত্ত আইডি টাইপ করুন", - "English": "Please input the Government ID as displayed on the national ID card" - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "জাতীয় পরিচয়পত্র নং ১৩ অথবা ১৭ ডিজিটের হবে", - "English": "National ID should be 13 or 17 digits" - }, - "constraint": "regex(., '^(?!0{13})[0-9]{13}$') or regex(., '^(?!0{17})[0-9]{17}$')" - }, - "label": { - "Bengali": "মহিলার জাতীয় পরিচয়পত্র নং-", - "English": "Woman's National ID Number" - }, - "instance": { - "openmrs_entity_id": "NID", - "openmrs_entity": "person_identifier" - }, - "type": "text" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWWOMBID", - "hint": { - "Bengali": "অনুগ্রহ করে জন্ম নিবন্ধন সনদ দেখে সরকার প্রদত্ত আইডি টাইপ করুন", - "English": "Please input the Government ID as displayed on the birth certificate" - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "জন্ম নিবন্ধন সনদ নং ১৭ ডিজিটের হবে", - "English": "Birth Registration ID should be 17 digits" - }, - "required": "yes", - "constraint": "regex(., '^(?!0{17})[0-9]{17}$')" - }, - "label": { - "Bengali": "মহিলার জন্ম নিবন্ধন সনদ নং-", - "English": "Woman's Birth Registration ID" - }, - "instance": { - "openmrs_entity_id": "Birth Registration ID", - "openmrs_entity": "person_identifier" - }, - "type": "text" - }, - { - "name": "FWHUSNAME", - "hint": { - "Bengali": "অনুগ্রহ করে স্বামীর নাম টাইপ করুন", - "English": "Please type husband's name" - }, - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "স্বামীর নাম-", - "English": "Husband Name" - }, - "instance": { - "openmrs_entity_id": "161135AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "text" - }, - { - "name": "FWBIRTHDATE", - "hint": { - "Bengali": "মহিলার জন্ম নিবন্ধন পত্র থাকলে সেখান থেকে জন্ম তারিখটি লিখে নিন। যদি জন্ম তারিখ জানা না থাকে তবে তারিখ ১৫ সিলেক্ট করুন, যদি মাস জানা না থাকে তবে মাস ৬ (জুন) সিলেক্ট করুন", - "English": "If birth certificate is available, take date of birth from the birth certificate. \nIf date of birth is unknown, choose 15th as the date of birth. If month is unknown, choose month 06 (June) as month of birth." - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "মহিলার বয়স অবশ্যই ১৩ বছরের বেশী হবে", - "English": "Woman must be older than 13 years of age" - }, - "required": "yes", - "constraint": "((${FWBIRTHDATE})+4745) <= today()" - }, - "label": { - "Bengali": "মহিলার জন্ম তারিখ", - "English": "Woman's Date of Birth" - }, - "instance": { - "openmrs_entity_id": "birthdate", - "openmrs_entity": "person" - }, - "type": "date" - }, - { - "name": "FWGENDER", - "bind": { - "calculate": "\"female\"" - }, - "instance": { - "openmrs_entity_id": "gender", - "openmrs_entity": "person" - }, - "type": "calculate" - }, - { - "name": "FWWOMAGE", - "bind": { - "calculate": "round(((${today} - ${FWBIRTHDATE}) div 365.25),0)" - }, - "type": "calculate" - }, - { - "name": "display_age", - "label": { - "Bengali": "মহিলার বয়স ${FWWOMAGE}", - "English": "The woman's age is ${FWWOMAGE}." - }, - "type": "note" - }, - { - "children": [ - { - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - }, - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - }, - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "9", - "label": { - "Bengali": "জানিনা", - "English": "Don't know" - }, - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - } - ], - "name": "FWNHWOMSTRMEN", - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "আপনার কি মাসিক একেবারে উঠে গেছে/আপনি কি স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?", - "English": "Are you currently menopausal or sterilized?" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "0", - "label": { - "Bengali": "মারা গেছেন", - "English": "Deceased" - }, - "instance": { - "openmrs_code": "159AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "1", - "label": { - "Bengali": "বেঁচে আছেন", - "English": "Alive" - }, - "instance": { - "openmrs_code": "160429AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "9", - "label": { - "Bengali": "জানিনা", - "English": "Don't know" - }, - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - } - ], - "name": "FWNHWOMHUSALV", - "bind": { - "relevant": "${FWNHWOMSTRMEN}='0'", - "required": "yes" - }, - "label": { - "Bengali": "আপনার স্বামী কি বেঁচে আছেন?", - "English": "Is the husband alive?" - }, - "instance": { - "openmrs_entity_id": "5561AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - }, - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - }, - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "9", - "label": { - "Bengali": "জানিনা", - "English": "Don't know" - }, - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - } - ], - "name": "FWNHWOMHUSLIV", - "bind": { - "relevant": "${FWNHWOMSTRMEN}='0' and ${FWNHWOMHUSALV}='1'", - "required": "yes" - }, - "label": { - "Bengali": "আপনি কি বর্তমানে আপনার স্বামীর সাথে বসবাস করছেন?", - "English": "Are you currently living with your husband?" - }, - "instance": { - "openmrs_entity_id": "1060AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - }, - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - }, - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "9", - "label": { - "Bengali": "জানিনা", - "English": "Don't know" - }, - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - } - ], - "name": "FWNHWOMHUSSTR", - "bind": { - "relevant": "${FWNHWOMSTRMEN}='0' and ${FWNHWOMHUSLIV}='1'", - "required": "yes" - }, - "label": { - "Bengali": "আপনার স্বামী কি স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?", - "English": "Is the husband sterilized?" - }, - "type": "select one" - }, - { - "name": "FWELIGIBLE", - "bind": { - "calculate": "if(${FWNHWOMSTRMEN}='0' and ${FWNHWOMHUSLIV}='1' and ${FWNHWOMHUSSTR}='0',1,0)" - }, - "type": "calculate" - }, - { - "name": "add_women", - "label": { - "Bengali": "এই খানায় যদি আরও কোন মহিলা থাকে যাকে রেজিস্ট্রেশন করা হয়নি, তাহলে '+' অপশনটি বাছুন এবং একই প্রক্রিয়ায় পরবর্তী মহিলাকে রেজিস্ট্রেশন করুন", - "English": "If there are any additional unregistered women in this household, select the '+' to add them now." - }, - "type": "note" - } - ], - "name": "woman", - "hint": { - "Bengali": "আমরা এখন মহিলাটির রেজিস্ট্রেশন প্রক্রিয়া শুরু করতে যাচ্ছি। অনুগ্রহ করে মহিলাটিরে তার জন্ম নিবন্ধন স ও জাতীয় পরিচয়পত্র নিয়ে আসতে বলুন।", - "English": "We will now register the woman. Please ask her to bring her National ID Card and Birth Certificate." - }, - "bind": { - "relevant": "${FWNHHMWRA}='1'" - }, - "label": { - "Bengali": "মহিলা তথ্যঃ", - "English": "New Woman Registration" - }, - "instance": { - "openmrs_entity_id": "Census and New Woman Registration", - "openmrs_entity": "person" - }, - "type": "repeat" - }, - { - "name": "join_names", - "bind": { - "calculate": "join(' ', ${FWWOMFNAME})" - }, - "type": "calculate" - }, - { - "name": "MWRA", - "bind": { - "calculate": "if(${join_names} = '', 0, count(${woman}))" - }, - "type": "calculate" - }, - { - "control": { - "bodyless": true - }, - "children": [ - { - "name": "instanceID", - "bind": { - "readonly": "true()", - "calculate": "concat('uuid:', uuid())" - }, - "type": "calculate" - } - ], - "name": "meta", - "type": "group" - } - ], - "instance": { - "encounter_type": "New Household Registration" - }, - "version": "201505070930", - "type": "survey", - "name": "FWNewHH", - "sms_keyword": "FWNewHH", - "title": "FW new HH Reg" -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/new_household_registration/form.xml b/opensrp-core/src/test/resources/form/new_household_registration/form.xml deleted file mode 100644 index 85089deaa5..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration/form.xml +++ /dev/null @@ -1,26 +0,0 @@ - -
-

নতুন খানা রেজিস্ট্রেশন ফর্ম

- - - - - - - - - -
এই খানায় কি প্রজনন বয়সী বিবাহিত মহিলা আছেন?Are there any MWRAs in this Household? -
-

মহিলা তথ্যঃNew Woman Registration

আপনার কি মাসিক একেবারে উঠে গেছে/আপনি কি স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?Are you currently menopausal or sterilized?* -
আপনার স্বামী কি বেঁচে আছেন?Is the husband alive?* -
আপনি কি বর্তমানে আপনার স্বামীর সাথে বসবাস করছেন?Are you currently living with your husband?* -
আপনার স্বামী কি স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?Is the husband sterilized?* -
-
-
- -
XML to HTML transformation for form took 0.03 secondsThis validation is yet not functional.
diff --git a/opensrp-core/src/test/resources/form/new_household_registration/form_definition.json b/opensrp-core/src/test/resources/form/new_household_registration/form_definition.json deleted file mode 100644 index f1dea2a941..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration/form_definition.json +++ /dev/null @@ -1,166 +0,0 @@ -{ - "form_data_definition_version": "1", - "form": { - "default_bind_path": "/model/instance/FWNewHH", - "bind_type": "household", - "fields": [ - { - "name": "id", - "shouldLoadValue": true - }, - { - "name": "existing_location", - "bind": "/model/instance/FWNewHH/existing_location" - }, - { - "name": "today", - "bind": "/model/instance/FWNewHH/today" - }, - { - "name": "start", - "bind": "/model/instance/FWNewHH/start" - }, - { - "name": "end", - "bind": "/model/instance/FWNewHH/end" - }, - { - "name": "FWNHREGDATE", - "bind": "/model/instance/FWNewHH/FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "bind": "/model/instance/FWNewHH/FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "bind": "/model/instance/FWNewHH/FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "bind": "/model/instance/FWNewHH/FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "bind": "/model/instance/FWNewHH/FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "bind": "/model/instance/FWNewHH/FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "bind": "/model/instance/FWNewHH/FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "bind": "/model/instance/FWNewHH/FWHOHBIRTHDATE" - }, - { - "name": "FWHOHBIRTHDATEAPPROX", - "bind": "/model/instance/FWNewHH/FWHOHBIRTHDATEAPPROX" - }, - { - "name": "FWHOHGENDER", - "bind": "/model/instance/FWNewHH/FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "bind": "/model/instance/FWNewHH/FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "bind": "/model/instance/FWNewHH/FWNHHMWRA" - }, - { - "name": "join_names", - "bind": "/model/instance/FWNewHH/join_names" - }, - { - "name": "MWRA", - "bind": "/model/instance/FWNewHH/MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "shouldLoadValue": true - }, - { - "name": "GOBHHID", - "bind": "/model/instance/FWNewHH/woman/GOBHHID" - }, - { - "name": "JiVitAHHID", - "bind": "/model/instance/FWNewHH/woman/JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "bind": "/model/instance/FWNewHH/woman/FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "bind": "/model/instance/FWNewHH/woman/FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "bind": "/model/instance/FWNewHH/woman/FWWOMNID" - }, - { - "name": "FWWOMBID", - "bind": "/model/instance/FWNewHH/woman/FWWOMBID" - }, - { - "name": "FWHUSNAME", - "bind": "/model/instance/FWNewHH/woman/FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "bind": "/model/instance/FWNewHH/woman/FWBIRTHDATE" - }, - { - "name": "FWBIRTHDATEAPPROX", - "bind": "/model/instance/FWNewHH/woman/FWBIRTHDATEAPPROX" - }, - { - "name": "FWGENDER", - "bind": "/model/instance/FWNewHH/woman/FWGENDER" - }, - { - "name": "FWWOMAGE", - "bind": "/model/instance/FWNewHH/woman/FWWOMAGE" - }, - { - "name": "display_age", - "bind": "/model/instance/FWNewHH/woman/display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "bind": "/model/instance/FWNewHH/woman/FWELIGIBLE" - } - ] - } - ] - } -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/new_household_registration/form_submission1.json b/opensrp-core/src/test/resources/form/new_household_registration/form_submission1.json deleted file mode 100644 index a6a2f189a5..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration/form_submission1.json +++ /dev/null @@ -1,228 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f180115a3", - "_rev": "1-e73e1d93acdcdaeb1d41a738da5d9284", - "type": "FormSubmission", - "anmId": "demotest", - "instanceId": "88c0e824-10b4-44c2-9429-754b8d823776", - "formName": "new_household_registration", - "entityId": "a3f2abf4-2699-4761-819a-cea739224164", - "clientVersion": 1430997074596, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "a3f2abf4-2699-4761-819a-cea739224164", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "KUPTALA", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-07", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-07", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "1234", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "1234", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "value": "nothing", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "34 34 0 0", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "test", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "value": "2", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "value": "1", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "shumi sumaita", - "source": "household.join_names" - }, - { - "name": "MWRA", - "value": "2", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "1234323", - "JiVitAHHID": "123465656", - "FWWOMFNAME": "shumi", - "FWWOMLNAME": ".", - "FWWOMNID": "", - "FWWOMBID": "54676545676787876", - "FWHUSNAME": "selim", - "FWBIRTHDATE": "1998-02-04", - "FWGENDER": "female", - "FWWOMAGE": "17", - "display_age": "", - "FWNHWOMSTRMEN": "1", - "FWNHWOMHUSALV": "", - "FWNHWOMHUSLIV": "", - "FWNHWOMHUSSTR": "", - "FWELIGIBLE": "0", - "id": "babcd9d2-b3e9-4f6d-8a06-2df8f5fbf01f" - }, - { - "GOBHHID": "1234121", - "JiVitAHHID": "12348787", - "FWWOMFNAME": "sumaita", - "FWWOMLNAME": ".", - "FWWOMNID": "", - "FWWOMBID": "56543456567654567", - "FWHUSNAME": "razzak", - "FWBIRTHDATE": "1989-08-18", - "FWGENDER": "female", - "FWWOMAGE": "26", - "display_age": "", - "FWNHWOMSTRMEN": "0", - "FWNHWOMHUSALV": "1", - "FWNHWOMHUSLIV": "1", - "FWNHWOMHUSSTR": "1", - "FWELIGIBLE": "0", - "id": "74eebb60-a1b9-4691-81a4-5c04ecce7ae9" - } - ] - } - ] - } - }, - "serverVersion": 1430998001293 -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/new_household_registration/form_submission2.json b/opensrp-core/src/test/resources/form/new_household_registration/form_submission2.json deleted file mode 100644 index 7141db6678..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration/form_submission2.json +++ /dev/null @@ -1,207 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f18000df2", - "_rev": "1-0cec42380dce0fef7b1263aad8652c3f", - "type": "FormSubmission", - "anmId": "demotest", - "instanceId": "916363c4-a10e-488d-8de4-9be7a05d43cd", - "formName": "new_household_registration", - "entityId": "0aac6d81-b51f-4096-b354-5a5786e406c8", - "clientVersion": 1430924780686, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "0aac6d81-b51f-4096-b354-5a5786e406c8", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "KUPTALA", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-06", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-06T21:05:35.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-06T21:05:35.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-06", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "0002", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "0002", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "23.7984 90.4019 0 25", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "karim mia", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "value": "1", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "value": "0", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "source": "household.join_names" - }, - { - "name": "MWRA", - "value": "0", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "0002", - "JiVitAHHID": "042002", - "FWWOMFNAME": "fana", - "FWWOMLNAME": ".", - "FWWOMNID": "", - "FWWOMBID": "9999999999999999", - "FWHUSNAME": "", - "FWBIRTHDATE": "2000-12-12", - "FWGENDER": "female", - "FWWOMAGE": "NaN", - "display_age": "", - "FWNHWOMSTRMEN": "", - "FWNHWOMHUSALV": "", - "FWNHWOMHUSLIV": "", - "FWNHWOMHUSSTR": "", - "FWELIGIBLE": "1", - "id": "b19db74f-6e96-4652-a765-5078beb12434" - } - ] - } - ] - } - }, - "serverVersion": 1430924937728 -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/new_household_registration/form_submission3.json b/opensrp-core/src/test/resources/form/new_household_registration/form_submission3.json deleted file mode 100644 index 113c3c0829..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration/form_submission3.json +++ /dev/null @@ -1,208 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f1800160d", - "_rev": "1-89988ca8cc2db0cd67afc292263137fe", - "type": "FormSubmission", - "anmId": "demotest", - "instanceId": "1cdf1628-86f2-440b-b5b0-4bc612d2fd2f", - "formName": "new_household_registration", - "entityId": "baf59aa4-64e9-46fc-99e6-8cd8f01618ff", - "clientVersion": 1430925173098, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "baf59aa4-64e9-46fc-99e6-8cd8f01618ff", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "LAKSHMIPUR", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-06", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-06T21:09:22.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-06T21:09:22.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-06", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "0091", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "0091", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "23.7984 90.402 0 40", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "hasan ferox", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "value": "1", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "value": "1", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "mithila", - "source": "household.join_names" - }, - { - "name": "MWRA", - "value": "1", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "0091", - "JiVitAHHID": "0524091", - "FWWOMFNAME": "mithila", - "FWWOMLNAME": ".", - "FWWOMNID": "1111111111111", - "FWWOMBID": "12345678912345678", - "FWHUSNAME": "hasan feroz", - "FWBIRTHDATE": "1989-01-01", - "FWGENDER": "female", - "FWWOMAGE": "26", - "display_age": "", - "FWNHWOMSTRMEN": "0", - "FWNHWOMHUSALV": "1", - "FWNHWOMHUSLIV": "1", - "FWNHWOMHUSSTR": "1", - "FWELIGIBLE": "0", - "id": "409b44c4-262a-40b8-ad7d-748c480c7c13" - } - ] - } - ] - } - }, - "serverVersion": 1430925176060 -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/new_household_registration/form_submission4.json b/opensrp-core/src/test/resources/form/new_household_registration/form_submission4.json deleted file mode 100644 index 7665de2411..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration/form_submission4.json +++ /dev/null @@ -1,208 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f18001e50", - "_rev": "1-3a413b7428ae33aafd08898dc2c974d4", - "type": "FormSubmission", - "anmId": "demotest", - "instanceId": "cad01d9c-9f7f-4e0b-a66a-2d1121bf8b8d", - "formName": "new_household_registration", - "entityId": "f92ee1b5-c3ce-42fb-bbc8-e01f474acc5a", - "clientVersion": 1430926871912, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "f92ee1b5-c3ce-42fb-bbc8-e01f474acc5a", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "KUPTALA", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-06", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-06T21:38:52.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-06T21:38:52.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-06", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "4567", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "5678", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "23.7984 90.4021 0 37", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "jashim mia", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "value": "5", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "value": "1", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "razia sultana", - "source": "household.join_names" - }, - { - "name": "MWRA", - "value": "1", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "4567", - "JiVitAHHID": "5678", - "FWWOMFNAME": "razia sultana", - "FWWOMLNAME": ".", - "FWWOMNID": "0987654321123", - "FWWOMBID": "09876543211234567", - "FWHUSNAME": "jashim mia", - "FWBIRTHDATE": "1991-02-27", - "FWGENDER": "female", - "FWWOMAGE": "24", - "display_age": "", - "FWNHWOMSTRMEN": "0", - "FWNHWOMHUSALV": "1", - "FWNHWOMHUSLIV": "1", - "FWNHWOMHUSSTR": "0", - "FWELIGIBLE": "1", - "id": "0036b7ca-36ec-4242-9885-a0a03a666cda" - } - ] - } - ] - } - }, - "serverVersion": 1430926886181 -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/new_household_registration/form_submission5.json b/opensrp-core/src/test/resources/form/new_household_registration/form_submission5.json deleted file mode 100644 index 8447c0ff4a..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration/form_submission5.json +++ /dev/null @@ -1,209 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f180115a3", - "_rev": "1-e73e1d93acdcdaeb1d41a738da5d9284", - "type": "FormSubmission", - "anmId": "demotest", - "instanceId": "88c0e824-10b4-44c2-9429-754b8d823776", - "formName": "new_household_registration", - "entityId": "a3f2abf4-2699-4761-819a-cea739224164", - "clientVersion": 1430997074596, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "a3f2abf4-2699-4761-819a-cea739224164", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "KUPTALA", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-07", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-07", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "1234", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "1234", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "value": "nothing", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "34 34 0 0", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "test", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "value": "2", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "value": "1", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "shumi sumaita", - "source": "household.join_names" - }, - { - "name": "MWRA", - "value": "2", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "", - "JiVitAHHID": "", - "FWWOMFNAME": "", - "FWWOMLNAME": "", - "FWWOMNID": "", - "FWWOMBID": "", - "FWHUSNAME": "", - "FWBIRTHDATE": "", - "FWGENDER": "", - "FWWOMAGE": "", - "display_age": "", - "FWNHWOMSTRMEN": "", - "FWNHWOMHUSALV": "", - "FWNHWOMHUSLIV": "", - "FWNHWOMHUSSTR": "", - "FWELIGIBLE": "", - "id": "babcd9d2-b3e9-4f6d-8a06-2df8f5fbf01f" - } - ] - } - ] - } - }, - "serverVersion": 1430998001293 -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/new_household_registration/form_submission6.json b/opensrp-core/src/test/resources/form/new_household_registration/form_submission6.json deleted file mode 100644 index 8f3ec6c5ad..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration/form_submission6.json +++ /dev/null @@ -1,216 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f180115a3", - "_rev": "1-e73e1d93acdcdaeb1d41a738da5d9284", - "type": "FormSubmission", - "anmId": "admin", - "instanceId": "88c0e824-10b4-44c2-9429-754b8d823776", - "formName": "new_household_registration", - "entityId": "a3f2abf4-2699-4761-819a-cea739224164", - "clientVersion": 1430997074596, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "a3f2abf4-2699-4761-819a-cea739224164", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "KUPTALA", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-07", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-07", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "1234", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "1234", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "value": "nothing", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "34 34 0 0", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "test", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHBIRTHDATEAPPROX", - "value": "1", - "source": "household.FWHOHBIRTHDATEAPPROX" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "shumi sumaita", - "source": "household.join_names" - }, - { - "name": "MWRA", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWBIRTHDATEAPPROX", - "source": "elco.FWBIRTHDATEAPPROX" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "48374", - "JiVitAHHID": "78748", - "FWWOMFNAME": "tEST First", - "FWWOMLNAME": " lastname", - "FWWOMNID": "", - "FWWOMBID": "", - "FWHUSNAME": "", - "FWBIRTHDATE": "2000-05-07", - "FWBIRTHDATEAPPROX":"1", - "FWGENDER": "Female", - "FWWOMAGE": "", - "display_age": "", - "FWNHWOMSTRMEN": "", - "FWNHWOMHUSALV": "", - "FWNHWOMHUSLIV": "", - "FWNHWOMHUSSTR": "", - "FWELIGIBLE": "", - "id": "babcd9d2-b3e9-4f6d-8a06-2df8f5fbf01f" - } - ] - } - ] - } - }, - "serverVersion": 1430998001293 -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/new_household_registration/form_submission7.json b/opensrp-core/src/test/resources/form/new_household_registration/form_submission7.json deleted file mode 100644 index 443ced2385..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration/form_submission7.json +++ /dev/null @@ -1,216 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f180115a3", - "_rev": "1-e73e1d93acdcdaeb1d41a738da5d9284", - "type": "FormSubmission", - "anmId": "admin", - "instanceId": "88c0e824-10b4-44c2-9429-754b8d823776", - "formName": "new_household_registration", - "entityId": "a3f2abf4-2699-4761-819a-cea739224164", - "clientVersion": 1430997074596, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "a3f2abf4-2699-4761-819a-cea739224164", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "KUPTALA", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-07", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-07", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "1234", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "1234", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "value": "nothing", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "34 34 0 0", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "test", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHBIRTHDATEAPPROX", - "value": "1", - "source": "household.FWHOHBIRTHDATEAPPROX" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "shumi sumaita", - "source": "household.join_names" - }, - { - "name": "MWRA", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWBIRTHDATEAPPROX", - "source": "elco.FWBIRTHDATEAPPROX" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "48374", - "JiVitAHHID": "78748", - "FWWOMFNAME": "tEST First", - "FWWOMLNAME": " lastname", - "FWWOMNID": "5478549854895", - "FWWOMBID": "43030293029323", - "FWHUSNAME": "husb", - "FWBIRTHDATE": "2000-05-07", - "FWBIRTHDATEAPPROX":"0", - "FWGENDER": "Female", - "FWWOMAGE": "21", - "display_age": "", - "FWNHWOMSTRMEN": "", - "FWNHWOMHUSALV": "", - "FWNHWOMHUSLIV": "", - "FWNHWOMHUSSTR": "", - "FWELIGIBLE": "", - "id": "babcd9d2-b3e9-4f6d-8a06-2df8f5fbf01f" - } - ] - } - ] - } - }, - "serverVersion": 1430998001293 -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/new_household_registration/form_submission8.json b/opensrp-core/src/test/resources/form/new_household_registration/form_submission8.json deleted file mode 100644 index 0c1850d4ed..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration/form_submission8.json +++ /dev/null @@ -1,211 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f180115a3", - "_rev": "1-e73e1d93acdcdaeb1d41a738da5d9284", - "type": "FormSubmission", - "anmId": "admin", - "instanceId": "88c0e824-10b4-44c2-9429-754b8d823776", - "formName": "new_household_registration", - "entityId": "a3f2abf4-2699-4761-819a-cea739224164", - "clientVersion": 1430997074596, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "a3f2abf4-2699-4761-819a-cea739224164", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "KUPTALA", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-07", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-07", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "1234", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "1234", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "value": "nothing", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "34 34 0 0", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "test", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "shumi sumaita", - "source": "household.join_names" - }, - { - "name": "MWRA", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWBIRTHDATEAPPROX", - "source": "elco.FWBIRTHDATEAPPROX" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "48374", - "JiVitAHHID": "78748", - "FWWOMFNAME": "tEST First", - "FWWOMLNAME": " lastname", - "FWWOMNID": "", - "FWWOMBID": "", - "FWHUSNAME": "", - "FWBIRTHDATE": "2000-05-07", - "FWBIRTHDATEAPPROX":"", - "FWGENDER": "Female", - "FWWOMAGE": "", - "display_age": "", - "FWNHWOMSTRMEN": "", - "FWNHWOMHUSALV": "", - "FWNHWOMHUSLIV": "", - "FWNHWOMHUSSTR": "", - "FWELIGIBLE": "", - "id": "babcd9d2-b3e9-4f6d-8a06-2df8f5fbf01f" - } - ] - } - ] - } - }, - "serverVersion": 1430998001293 -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/new_household_registration/form_submission9.json b/opensrp-core/src/test/resources/form/new_household_registration/form_submission9.json deleted file mode 100644 index b1dd5bcb96..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration/form_submission9.json +++ /dev/null @@ -1,206 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f180115a3", - "_rev": "1-e73e1d93acdcdaeb1d41a738da5d9284", - "type": "FormSubmission", - "anmId": "admin", - "instanceId": "88c0e824-10b4-44c2-9429-754b8d823776", - "formName": "new_household_registration", - "entityId": "a3f2abf4-2699-4761-819a-cea739224164", - "clientVersion": 1430997074596, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "a3f2abf4-2699-4761-819a-cea739224164", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "KUPTALA", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-07", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-07", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "1234", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "1234", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "value": "nothing", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "34 34 0 0", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "shumi sumaita", - "source": "household.join_names" - }, - { - "name": "MWRA", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWBIRTHDATEAPPROX", - "source": "elco.FWBIRTHDATEAPPROX" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "48374", - "JiVitAHHID": "78748", - "FWWOMFNAME": "tEST First", - "FWWOMLNAME": " lastname", - "FWWOMNID": "", - "FWWOMBID": "", - "FWHUSNAME": "", - "FWBIRTHDATE": "2000-05-07", - "FWBIRTHDATEAPPROX":"", - "FWGENDER": "Female", - "FWWOMAGE": "", - "display_age": "", - "FWNHWOMSTRMEN": "", - "FWNHWOMHUSALV": "", - "FWNHWOMHUSLIV": "", - "FWNHWOMHUSSTR": "", - "FWELIGIBLE": "", - "id": "babcd9d2-b3e9-4f6d-8a06-2df8f5fbf01f" - } - ] - } - ] - } - }, - "serverVersion": 1430998001293 -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/new_household_registration/model.xml b/opensrp-core/src/test/resources/form/new_household_registration/model.xml deleted file mode 100644 index a0cabcad26..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration/model.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/opensrp-core/src/test/resources/form/new_household_registration_with_grouped_subform_data/form.json b/opensrp-core/src/test/resources/form/new_household_registration_with_grouped_subform_data/form.json deleted file mode 100644 index 99dadab7ad..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration_with_grouped_subform_data/form.json +++ /dev/null @@ -1,1100 +0,0 @@ -{ - "name": "FWNewHH", - "title": "নতুন খানা নিবন্ধন ফর্ম", - "sms_keyword": "FWNewHH", - "default_language": "Bengali", - "instance": { - "encounter_type": "New Household Registration" - }, - "version": "201510181114", - "id_string": "FWNewHH", - "type": "survey", - "children": [ - { - "type": "hidden", - "name": "version", - "label": { - "English": "TechVersion: v1.4 Aug 26, 2015\nFormVersion: v1.0" - } - }, - { - "type": "hidden", - "name": "changes", - "label": { - "English": "NN: \n1. Added a calculation field 'REGDATE' under 'woman' group\n2. Removed the conceptIDs which have Datatype N/A\n3. Define NID as person_attribute\nKZ: Dropped 9=DK from Vitsts choices\nCG: Added person_address mappings and NN added Variable Names for these address fields\nCG: Change NID back to person_identifier\nCG: Delete location_name field - need to communicate this change to Raihan - mauzapara name coming from existing_Mauzapara instead.\nCG: Added concept IDs for woman and husband unable to have children.\nKZ: 9/9\n1. Added photo capture of ID cards\n2. Added double entry of both IDs\n3. Added the which ID? screening question\n4. Changed the number of MWRAs in HH question to integer.\n5. Moved eligibility screening questions above ID questions, as in Census.\nCG: Updated address mappings so address5 is mapped to HHID\nCG: Added id_type to choices sheet.\n15/9\nKZ: Added Bangla to id_type choices, What type of ID and Re-Type National ID.\nKZ: Made FWWOMANYID field hidden until we come to a final decision on how to do this image capture.\nKZ: Removed leading zero from the '01' on the labels in HH Inhabitant number question.\nNN: Updated the constraint of 'How many member....' from \"regex(., '^(?!0{2})[0-9]{2}$')\" to \" .< 31 or .=99\"\nNN: Updated the 'relevant' logic of NID/BRID questions. added 'selected' logic\nKH: 16/9\n1. Added datatype / leading zeroes question as comment for FWNHHMBRNUM\n2. Changed constraint for FWNHHMBRNUM to exclude 0 as option\n3. Added \"Respondent Age\" concept UID to FWWOMAGE for data collection/analysis.\n4. Added \"Meets eligibility criteria for clinical trial or study\" concept UID to FWELIGIBLE to match FD form\nNN: 22/9\n1. Added entity:concept for FWELIGIBLE\n---\nKZ: 27/9\n1. Changed HHNUMB to text, still need to update the constraint to match with text.\nNN: 28/9\nUpdated the constraint of 'How many member....' from \".< 3 1 or .=99\" to \"regex(., '^(?!0{2})[0-9]{2}$')\"\nKZ (28/9):\n1. Change NUMMWRA to select one with yesno responses. Removed hints and constraints\n2. Updated hints and constraints for HH INhabitants to include leading zeros\nNN (8/10):\nAdd DoB, Gender questions before 'eligible' group\nMade FWNHHMBRNUM and FWNHHMWRA required field\nUpdated the constraing of 'how many member....' --> (regex(., '^(?!0{2})[0-9]{2}$') and .<31) or .=99\nUpdated the logic of Age (should not accept less than 12 years\nUpdated the hint/constraint message with english numeric input e.g 13 instead of ১৩\nCG (15/10):\nAdd ELCO count calculation; strike-through MWRA calculation\nNN (18/10): \nRemoved the Strikethrough fields.\nAdded two hidden variables for developers use- user_type and external_user_ID" - } - }, - { - "instance": { - "openmrs_entity_id": "location_id", - "openmrs_entity": "encounter" - }, - "type": "hidden", - "name": "existing_location" - }, - { - "type": "hidden", - "name": "existing_Country" - }, - { - "type": "hidden", - "name": "existing_Division" - }, - { - "type": "hidden", - "name": "existing_District" - }, - { - "type": "hidden", - "name": "existing_Upazilla" - }, - { - "type": "hidden", - "name": "existing_Union" - }, - { - "type": "hidden", - "name": "existing_Ward" - }, - { - "type": "hidden", - "name": "existing_Subunit" - }, - { - "type": "hidden", - "name": "existing_Mauzapara" - }, - { - "instance": { - "openmrs_entity_id": "encounter_date", - "openmrs_entity": "encounter" - }, - "type": "today", - "name": "today" - }, - { - "instance": { - "openmrs_entity_id": "encounter_start", - "openmrs_entity": "encounter" - }, - "type": "start", - "name": "start" - }, - { - "instance": { - "openmrs_entity_id": "encounter_end", - "openmrs_entity": "encounter" - }, - "type": "end", - "name": "end" - }, - { - "name": "FWNHREGDATE", - "hint": { - "Bengali": "আজকের তারিখ দিন", - "English": "Please enter today's date." - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "আজকের তারিখের পরের কোন তারিখ\nহতে পারবে না", - "English": "Date cannot be greater than current date." - }, - "required": "yes", - "constraint": ".<=${today}" - }, - "label": { - "Bengali": "সাক্ষাৎকারের তারিখ", - "English": "Date of Interview" - }, - "instance": { - "openmrs_entity_id": "160753AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "date" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWGOBHHID", - "hint": { - "Bengali": "কালো কালিতে লেখা সরকারী খানা নম্বর (HHID) যেভাবে ঘরের দেয়াল বা দরজায় দেওয়া আছে সেভাবেই ইনপুট দিন।\nসরকারী খানা নম্বর (HHID) পাওয়া না গেলে ৯৯৯৯ ইনপুট দিন", - "English": "Please input the Black – painted Government household ID (HHID) as displayed on the door/wall of the HH. If there is no Government HHID, enter 9999." - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "অনুগ্রহ করে ০০০১ থেকে ৯৯৯৯ এর মধ্যে ৪ ডিজিটের GoB HHID টাইপ করুন", - "English": "Please enter 4 digits of GoB HHID from 0001 to 9999" - }, - "required": "yes", - "constraint": "regex(., '^(?!0{4})[0-9]{4}$')" - }, - "label": { - "Bengali": "GoB HHID", - "English": "GoB HHID" - }, - "instance": { - "openmrs_entity_id": "GoB_HHID", - "openmrs_entity": "person_attribute" - }, - "type": "text" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWJIVHHID", - "hint": { - "Bengali": "লাল কালিতে দেয়া জীবিতা খানা নম্বর (HHID) যেভাবে দেয়ালে বা দরজায় দেওয়া আছে সেভাবেই ইনপুট দিন ।\nজীবিতা খানা নম্বর (HHID) পাওয়া না গেলে ৯৯৯৯ ইনপুট দিন", - "English": "Please input the RED – painted JiVitA / Study household ID (HHID) as displayed on the door/wall of the HH. Enter 9999 if JiVitA HHID is not found." - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "অনুগ্রহ করে ০০০১ থেকে ৯৯৯৯ এর মধ্যে ৪ ডিজিটের JiVitA HHID টাইপ করুন", - "English": "Please enter 4 digits of JiVitA HHID from 0001 to 9999" - }, - "required": "yes", - "constraint": "regex(., '^(?!0{4})[0-9]{4}$')" - }, - "label": { - "Bengali": "JiVitA HHID", - "English": "JiVitA HHID" - }, - "instance": { - "openmrs_entity_id": "JiVitA_HHID", - "openmrs_entity": "person_attribute" - }, - "type": "text" - }, - { - "bind": { - "calculate": "${existing_Country}" - }, - "type": "calculate", - "name": "FWCOUNTRY", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "country", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Division}" - }, - "type": "calculate", - "name": "FWDIVISION", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "stateProvince", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_District}" - }, - "type": "calculate", - "name": "FWDISTRICT", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "countyDistrict", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Upazilla}" - }, - "type": "calculate", - "name": "FWUPAZILLA", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "cityVillage", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Union}" - }, - "type": "calculate", - "name": "FWUNION", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address1", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Ward}" - }, - "type": "calculate", - "name": "FWWARD", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address2", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Subunit}" - }, - "type": "calculate", - "name": "FWSUBUNIT", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address3", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Mauzapara}" - }, - "type": "calculate", - "name": "FWMAUZA_PARA", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address4", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${FWGOBHHID}" - }, - "type": "calculate", - "name": "FWGOB_HHID", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address5", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "required": "yes" - }, - "type": "geopoint", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "geopoint", - "openmrs_entity_parent": "usual_residence" - }, - "name": "FWNHHHGPS", - "label": { - "Bengali": "জি পি এস", - "English": "Collect GPS Location of HH" - } - }, - { - "bind": { - "required": "yes" - }, - "type": "text", - "instance": { - "openmrs_entity_id": "first_name", - "openmrs_entity": "person" - }, - "name": "FWHOHFNAME", - "label": { - "Bengali": "খানা প্রধানের নাম-", - "English": "Head of Household Name" - } - }, - { - "bind": { - "calculate": "\".\"" - }, - "type": "calculate", - "name": "FWHOHLNAME", - "instance": { - "openmrs_entity_id": "last_name", - "openmrs_entity": "person" - } - }, - { - "bind": { - "calculate": "\"1900-01-01\"" - }, - "type": "calculate", - "name": "FWHOHBIRTHDATE", - "instance": { - "openmrs_entity_id": "birthdate", - "openmrs_entity": "person" - } - }, - { - "name": "FWHOHGENDER", - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "খানা প্রধানের লিঙ্গ", - "English": "Head of Household Gender" - }, - "instance": { - "openmrs_entity_id": "gender", - "openmrs_entity": "person" - }, - "type": "select one", - "children": [ - { - "name": "1", - "label": { - "Bengali": "ছেলে", - "English": "Male" - } - }, - { - "name": "2", - "label": { - "Bengali": "মেয়ে", - "English": "Female" - } - } - ] - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWNHHMBRNUM", - "hint": { - "Bengali": "খানার সদস্য সংখ্যা লিখতে 01-29 লিখুন । 30 বা তার বেশী হলে 30 লিখুন। খানার সদস্যের সংখ্যা জানা না থাকলে 99 লিখুন ।", - "English": "Enter 01-29 for the number of household members. Enter 30 if 30 or more. Enter 99 if the total number is unknown." - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "খানার সদস্য সংখ্যাকে দুই ডিজিট হিসেবে এন্ট্রি করতে হবে। খানার সদস্য সংখ্যা লিখতে 01- 29 লিখুন । খানার সদস্যের সংখ্যা 30 বা তার বেশি হলে 30 লিখুন। খানার সদস্যের সংখ্যা জানা না থাকলে 99 লিখুন ।", - "English": "Number should be entered as two digits. Enter 01-29 for the number of household members. Enter 30 if there are 30 or more household members. Enter 99 if the total number is unknown." - }, - "required": "yes", - "constraint": "(regex(., '^(?!0{2})[0-9]{2}$') and .<31) or .=99" - }, - "label": { - "Bengali": "এই খানায় বর্তমানে কতজন মানুষ বসবাস করছে?", - "English": "How many people are currently living in this household?" - }, - "instance": { - "openmrs_entity_id": "5611AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "text" - }, - { - "name": "FWNHHMWRA", - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "এই খানায় কি ১৫ থেকে ৪৯ বছর বয়সের কোন বিবাহিত মহিলা আছেন?", - "English": "Are there any married women between the ages of 15 - 49 live in this household?" - }, - "instance": { - "openmrs_entity_id": "1901AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - } - }, - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - } - }, - { - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "9", - "label": { - "Bengali": "জানি না", - "English": "Don't know" - } - } - ] - }, - { - "name": "woman", - "hint": { - "Bengali": "আমরা এখন মহিলাকে নিবন্ধন করব। তাকে জাতীয় পরিচয়পত্র এবং জন্ম নিবন্ধন সনদপত্র নিয়ে আসতে অনুরোধ করুন।", - "English": "We will now register the woman. Please ask her to bring her National ID Card and Birth Certificate." - }, - "bind": { - "relevant": "${FWNHHMWRA}='1'" - }, - "label": { - "Bengali": "মহিলার তথ্যঃ", - "English": "New Woman Registration" - }, - "instance": { - "openmrs_entity_id": "New Woman Registration", - "openmrs_entity": "person" - }, - "type": "repeat", - "children": [ - { - "bind": { - "calculate": "${FWGOBHHID}" - }, - "type": "calculate", - "name": "GOBHHID", - "instance": { - "openmrs_entity_id": "GoB_HHID", - "openmrs_entity": "person_attribute" - } - }, - { - "bind": { - "calculate": "${FWJIVHHID}" - }, - "type": "calculate", - "name": "JiVitAHHID", - "instance": { - "openmrs_entity_id": "JiVitA_HHID", - "openmrs_entity": "person_attribute" - } - }, - { - "bind": { - "calculate": "${FWNHREGDATE}" - }, - "type": "calculate", - "name": "REGDATE" - }, - { - "name": "FWWOMFNAME", - "hint": { - "Bengali": "মহিলার নাম টাইপ করুন", - "English": "Please type woman's name" - }, - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "মহিলার নাম-", - "English": "Woman Name" - }, - "instance": { - "openmrs_entity_id": "first_name", - "openmrs_entity": "person" - }, - "type": "text" - }, - { - "bind": { - "calculate": "\".\"" - }, - "type": "calculate", - "name": "FWWOMLNAME", - "instance": { - "openmrs_entity_id": "last_name", - "openmrs_entity": "person" - } - }, - { - "name": "FWBIRTHDATE", - "hint": { - "Bengali": "“যদি জন্মনিবন্ধন সনদপত্র থাকে তাহলে জন্মতারিখ সেখান থেকেই সংগ্রহ করুন। যদি জন্মতারিখ বলতে না পারে তাহলে মাসের ১৫ তারিখকে জন্মতারিখ হিসেবে বেছে নিন। যদি জন্মমাস বলতে না পারে তাহলে ৬ বা জুনকে মাস হিসেবে বেছে নিন এবং মহিলা যে বছরটিতে তার জন্ম বলবে সেটি এন্ট্রি করুন।”", - "English": "If birth certificate is available take date of birth from birth certificate. If date of birth is unknown choose 15 as the date of birth, if month is unknown choose 06 (June) as month of birth and enter the year of birth as mentioned by the woman." - }, - "default": "2000-01-02 00:00:00", - "bind": { - "jr:constraintMsg": { - "Bengali": "মহিলার বয়স অবশ্যই ১২ বছরের বেশী হবে", - "English": "Woman must be older than 12 years of age" - }, - "required": "yes", - "constraint": "((${FWBIRTHDATE})+4380) <= today()" - }, - "label": { - "Bengali": "মহিলার জন্ম তারিখ", - "English": "Woman's Date of Birth" - }, - "instance": { - "openmrs_entity_id": "birthdate", - "openmrs_entity": "person" - }, - "type": "date" - }, - { - "bind": { - "calculate": "\"female\"" - }, - "type": "calculate", - "name": "FWGENDER", - "instance": { - "openmrs_entity_id": "gender", - "openmrs_entity": "person" - } - }, - { - "bind": { - "calculate": "round(((${today} - ${FWBIRTHDATE}) div 365.25),0)" - }, - "type": "calculate", - "name": "FWWOMAGE", - "instance": { - "openmrs_entity_id": "1532AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - } - }, - { - "type": "note", - "name": "display_age", - "label": { - "Bengali": "মহিলার বয়স ${FWWOMAGE}", - "English": "The woman's age is ${FWWOMAGE}." - } - }, - { - "control": { - "appearance": "yes" - }, - "name": "FWNHWOMSTRMEN", - "label": { - "Bengali": "আপনার কি বর্তমানে মাসিক একেবারে উঠে গেছে বা আপনি কি বর্তমানে স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?", - "English": "Are you currently menopausal or sterilized?" - }, - "instance": { - "openmrs_entity_id": "163006AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - } - }, - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - } - }, - { - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "9", - "label": { - "Bengali": "জানি না", - "English": "Don't know" - } - } - ] - }, - { - "control": { - "appearance": "yes" - }, - "name": "FWNHWOMHUSLIV", - "bind": { - "relevant": "selected(${FWNHWOMSTRMEN}, '0') or selected(${FWNHWOMSTRMEN}, '9')" - }, - "label": { - "Bengali": "আপনি কি বর্তমানে আপনার স্বামীর সাথে বসবাস করছেন?", - "English": "Are you currently living with your husband?" - }, - "instance": { - "openmrs_entity_id": "162994AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - } - }, - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - } - }, - { - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "9", - "label": { - "Bengali": "জানি না", - "English": "Don't know" - } - } - ] - }, - { - "control": { - "appearance": "yes" - }, - "name": "FWNHWOMHUSALV", - "bind": { - "relevant": "selected(${FWNHWOMHUSLIV}, '0') or selected(${FWNHWOMHUSLIV}, '9')" - }, - "label": { - "Bengali": "আপনার স্বামী কি জীবিত আছেন?", - "English": "Is the husband alive?" - }, - "instance": { - "openmrs_entity_id": "5561AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - } - }, - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - } - } - ] - }, - { - "control": { - "appearance": "yes" - }, - "name": "FWNHWOMHUSSTR", - "bind": { - "relevant": "selected(${FWNHWOMHUSLIV}, '1') or (selected(${FWNHWOMHUSLIV}, '9') and selected(${FWNHWOMHUSALV}, '1'))" - }, - "label": { - "Bengali": "আপনার স্বামী কি স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?", - "English": "Is the husband sterilized?" - }, - "instance": { - "openmrs_entity_id": "162959AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - } - }, - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - } - }, - { - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "9", - "label": { - "Bengali": "জানি না", - "English": "Don't know" - } - } - ] - }, - { - "bind": { - "calculate": "if(${FWNHWOMSTRMEN}='0' and ${FWNHWOMHUSLIV}='1' and ${FWNHWOMHUSSTR}='0','1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA','1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')" - }, - "type": "calculate", - "name": "FWELIGIBLE", - "instance": { - "openmrs_entity_id": "162699AAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - } - }, - { - "bind": { - "relevant": "${FWELIGIBLE}='1'" - }, - "type": "group", - "children": [ - { - "name": "FWWOMANYID", - "hint": { - "Bengali": "প্রযোজ্য সবগুলো উত্তর নির্বাচন করুন", - "English": "Select all that apply." - }, - "label": { - "Bengali": "নিচের কোন পরিচয় পত্রটি মহিলার কাছে আছে?", - "English": "Which of the following IDs does the woman have?" - }, - "instance": { - "openmrs_entity_id": "163087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select all that apply", - "children": [ - { - "instance": { - "openmrs_code": "163084AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "1", - "label": { - "Bengali": "জাতীয় পরিচয়পত্র নম্বর", - "English": "National ID Number" - } - }, - { - "instance": { - "openmrs_code": "163083AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "2", - "label": { - "Bengali": "জন্ম নিবন্ধন সনদপত্র নম্বর", - "English": "Birth Registration ID Number" - } - } - ] - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWWOMNID", - "hint": { - "Bengali": "জাতীয় পরিচয়পত্রে দেওয়া সরকারী নম্বর যেভাবে দেওয়া আছে সেভাবেই প্রবেশ করান", - "English": "Please input the Government ID as displayed on the national ID card" - }, - "bind": { - "relevant": "selected(${FWWOMANYID},'1')", - "jr:constraintMsg": { - "Bengali": "জাতীয় পরিচয়পত্র নং ১৩ অথবা ১৭ ডিজিটের হবে", - "English": "National ID should be 13 or 17 digits" - }, - "required": "yes", - "constraint": "regex(., '^(?!0{13})[0-9]{13}$') or regex(., '^(?!0{17})[0-9]{17}$')" - }, - "label": { - "Bengali": "মহিলার জাতীয় পরিচয়পত্র নং-", - "English": "Woman's National ID Number" - }, - "type": "text" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWWOMRETYPENID", - "hint": { - "Bengali": "জাতীয় পরিচয়পত্রের নম্বরটি পুনরায় প্রবেশ করান", - "English": "Please re-input the National ID number" - }, - "bind": { - "relevant": "selected(${FWWOMANYID},'1')", - "jr:constraintMsg": { - "Bengali": "এই নম্বরটি ও পূর্বের স্ক্রিনে দেওয়া জন্ম নিবন্ধন নম্বরটি একই হতে হবে", - "English": "This number and the one in the previous screen should be same" - }, - "required": "yes", - "constraint": ".=${FWWOMNID}" - }, - "label": { - "Bengali": "মহিলার জাতীয় পরিচয়পত্র নম্বরটি পুনরায় লিখুন", - "English": "Re-Type Woman's National ID Number" - }, - "instance": { - "openmrs_entity_id": "NID", - "openmrs_entity": "person_identifier" - }, - "type": "text" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWWOMBID", - "hint": { - "Bengali": "জন্ম নিবন্ধন সনদপত্রের সরকারী নম্বর যেভাবে দেওয়া আছে সেভাবেই ইনপুট দিন।", - "English": "Please input the Government ID as displayed on the birth certificate" - }, - "bind": { - "relevant": "selected(${FWWOMANYID},'2')", - "jr:constraintMsg": { - "Bengali": "জন্ম নিবন্ধন সনদ নং ১৭ ডিজিটের হবে", - "English": "Birth Registration ID should be 17 digits" - }, - "required": "yes", - "constraint": "regex(., '^(?!0{17})[0-9]{17}$')" - }, - "label": { - "Bengali": "মহিলার জন্ম নিবন্ধন সনদ নং-", - "English": "Woman's Birth Registration ID" - }, - "type": "text" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWWOMRETYPEBID", - "hint": { - "Bengali": "জন্ম নিবন্ধন নম্বরটি পূনরায় প্রবেশ করান", - "English": "Please re-input the Birth Registration Number" - }, - "bind": { - "relevant": "selected(${FWWOMANYID},'2')", - "jr:constraintMsg": { - "Bengali": "এই নম্বরটি ও পূর্বের স্ক্রিনে দেওয়া জন্ম নিবন্ধন নম্বরটি একই হতে হবে", - "English": "This number and the one in the previous screen should be same" - }, - "required": "yes", - "constraint": ".=${FWWOMBID}" - }, - "label": { - "Bengali": "মহিলার জন্ম নিবন্ধন সনদ নং-", - "English": "Woman's Birth Registration ID" - }, - "instance": { - "openmrs_entity_id": "Birth Registration ID", - "openmrs_entity": "person_identifier" - }, - "type": "text" - }, - { - "name": "FWHUSNAME", - "hint": { - "Bengali": "স্বামীর নাম টাইপ করুন", - "English": "Please type husband's name" - }, - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "স্বামীর নাম-", - "English": "Husband's Name" - }, - "instance": { - "openmrs_entity_id": "161135AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "text" - }, - { - "bind": { - "calculate": "${existing_Country}" - }, - "type": "calculate", - "name": "FWWOMCOUNTRY", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "country", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Division}" - }, - "type": "calculate", - "name": "FWWOMDIVISION", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "stateProvince", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_District}" - }, - "type": "calculate", - "name": "FWWOMDISTRICT", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "countyDistrict", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Upazilla}" - }, - "type": "calculate", - "name": "FWWOMUPAZILLA", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "cityVillage", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Union}" - }, - "type": "calculate", - "name": "FWWOMUNION", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address1", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Ward}" - }, - "type": "calculate", - "name": "FWWOMWARD", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address2", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Subunit}" - }, - "type": "calculate", - "name": "FWWOMSUBUNIT", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address3", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Mauzapara}" - }, - "type": "calculate", - "name": "FWWOMMAUZA_PARA", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address4", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${FWGOBHHID}" - }, - "type": "calculate", - "name": "FWWOMGOBHHID", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address5", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${FWNHHHGPS}" - }, - "type": "calculate", - "name": "FWWOMGPS", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "geopoint", - "openmrs_entity_parent": "usual_residence" - } - } - ], - "name": "eligible" - }, - { - "type": "note", - "name": "add_women", - "label": { - "Bengali": "নির্দেশনাঃ এই খানায় যদি আরও কোন মহিলা থাকে যাকে রেজিস্ট্রেশন করা হয়নি, তাহলে '+' এ ক্লিক করুন এবং একই প্রক্রিয়ায় পরবর্তী মহিলাকে রেজিস্ট্রেশন করুন", - "English": "If there are any additional unregistered women in this household, select the '+' to add them now." - } - } - ] - }, - { - "bind": { - "calculate": "sum(${FWELIGIBLE})" - }, - "type": "calculate", - "name": "ELCO" - }, - { - "default": "FWA", - "type": "hidden", - "name": "user_type" - }, - { - "type": "hidden", - "name": "external_user_ID" - }, - { - "control": { - "bodyless": true - }, - "type": "group", - "children": [ - { - "bind": { - "readonly": "true()", - "calculate": "concat('uuid:', uuid())" - }, - "type": "calculate", - "name": "instanceID" - } - ], - "name": "meta" - } - ] -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/new_household_registration_with_grouped_subform_data/form.xml b/opensrp-core/src/test/resources/form/new_household_registration_with_grouped_subform_data/form.xml deleted file mode 100644 index bda24f905a..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration_with_grouped_subform_data/form.xml +++ /dev/null @@ -1,31 +0,0 @@ - -
-

নতুন খানা নিবন্ধন ফর্ম

- - - - - - - -
খানা প্রধানের লিঙ্গHead of Household Gender* -
- -
এই খানায় কি ১৫ থেকে ৪৯ বছর বয়সের কোন বিবাহিত মহিলা আছেন?Are there any married women between the ages of 15 - 49 live in this household?* -
-

মহিলার তথ্যঃNew Woman Registration

আপনার কি বর্তমানে মাসিক একেবারে উঠে গেছে বা আপনি কি বর্তমানে স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?Are you currently menopausal or sterilized? -
আপনি কি বর্তমানে আপনার স্বামীর সাথে বসবাস করছেন?Are you currently living with your husband? -
আপনার স্বামী কি জীবিত আছেন?Is the husband alive? -
আপনার স্বামী কি স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?Is the husband sterilized? -
নিচের কোন পরিচয় পত্রটি মহিলার কাছে আছে?Which of the following IDs does the woman have?প্রযোজ্য সবগুলো উত্তর নির্বাচন করুনSelect all that apply. -
-
-
-
- -
XML to HTML transformation for form took 0.05 secondsThis validation is yet not functional.
diff --git a/opensrp-core/src/test/resources/form/new_household_registration_with_grouped_subform_data/form_definition.json b/opensrp-core/src/test/resources/form/new_household_registration_with_grouped_subform_data/form_definition.json deleted file mode 100644 index 916bdf7aa8..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration_with_grouped_subform_data/form_definition.json +++ /dev/null @@ -1,290 +0,0 @@ -{ - "form_data_definition_version": "13", - "form": { - "default_bind_path": "/model/instance/FWNewHH", - "bind_type": "household", - "fields": [ - { - "name": "id", - "shouldLoadValue": true - }, - { - "name": "location_name", - "bind": "/model/instance/FWNewHH/existing_Mauzapara" - }, - { - "name": "existing_location", - "bind": "/model/instance/FWNewHH/existing_location" - }, - { - "name": "existing_Country", - "bind": "/model/instance/FWNewHH/existing_Country" - }, - { - "name": "existing_Division", - "bind": "/model/instance/FWNewHH/existing_Division" - }, - { - "name": "existing_District", - "bind": "/model/instance/FWNewHH/existing_District" - }, - { - "name": "existing_Upazilla", - "bind": "/model/instance/FWNewHH/existing_Upazilla" - }, - { - "name": "existing_Union", - "bind": "/model/instance/FWNewHH/existing_Union" - }, - { - "name": "existing_Ward", - "bind": "/model/instance/FWNewHH/existing_Ward" - }, - { - "name": "existing_Subunit", - "bind": "/model/instance/FWNewHH/existing_Subunit" - }, - { - "name": "existing_Mauzapara", - "bind": "/model/instance/FWNewHH/existing_Mauzapara" - }, - { - "name": "today", - "bind": "/model/instance/FWNewHH/today" - }, - { - "name": "start", - "bind": "/model/instance/FWNewHH/start" - }, - { - "name": "end", - "bind": "/model/instance/FWNewHH/end" - }, - { - "name": "FWNHREGDATE", - "bind": "/model/instance/FWNewHH/FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "bind": "/model/instance/FWNewHH/FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "bind": "/model/instance/FWNewHH/FWJIVHHID" - }, - { - "name": "FWCOUNTRY", - "bind": "/model/instance/FWNewHH/FWCOUNTRY" - }, - { - "name": "FWDIVISION", - "bind": "/model/instance/FWNewHH/FWDIVISION" - }, - { - "name": "FWDISTRICT", - "bind": "/model/instance/FWNewHH/FWDISTRICT" - }, - { - "name": "FWUPAZILLA", - "bind": "/model/instance/FWNewHH/FWUPAZILLA" - }, - { - "name": "FWUNION", - "bind": "/model/instance/FWNewHH/FWUNION" - }, - { - "name": "FWWARD", - "bind": "/model/instance/FWNewHH/FWWARD" - }, - { - "name": "FWSUBUNIT", - "bind": "/model/instance/FWNewHH/FWSUBUNIT" - }, - { - "name": "FWMAUZA_PARA", - "bind": "/model/instance/FWNewHH/FWMAUZA_PARA" - }, - { - "name": "FWNHHHGPS", - "bind": "/model/instance/FWNewHH/FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "bind": "/model/instance/FWNewHH/FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "bind": "/model/instance/FWNewHH/FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "bind": "/model/instance/FWNewHH/FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "bind": "/model/instance/FWNewHH/FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "bind": "/model/instance/FWNewHH/FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "bind": "/model/instance/FWNewHH/FWNHHMWRA" - }, - { - "name": "join_names", - "bind": "/model/instance/FWNewHH/join_names" - }, - { - "name": "ELCO", - "bind": "/model/instance/FWNewHH/ELCO" - }, - { - "name": "user_type", - "bind": "/model/instance/FWNewHH/user_type" - }, - { - "name": "external_user_ID", - "bind": "/model/instance/FWNewHH/external_user_ID" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "shouldLoadValue": true - }, - { - "name": "relationalid", - "shouldLoadValue": true - }, - { - "name": "WomanREGDATE", - "bind": "/model/instance/FWNewHH/woman/REGDATE" - }, - { - "name": "GOBHHID", - "bind": "/model/instance/FWNewHH/woman/GOBHHID" - }, - { - "name": "JiVitAHHID", - "bind": "/model/instance/FWNewHH/woman/JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "bind": "/model/instance/FWNewHH/woman/FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "bind": "/model/instance/FWNewHH/woman/FWWOMLNAME" - }, - { - "name": "FWBIRTHDATE", - "bind": "/model/instance/FWNewHH/woman/FWBIRTHDATE" - }, - { - "name": "FWGENDER", - "bind": "/model/instance/FWNewHH/woman/FWGENDER" - }, - { - "name": "FWWOMAGE", - "bind": "/model/instance/FWNewHH/woman/FWWOMAGE" - }, - { - "name": "display_age", - "bind": "/model/instance/FWNewHH/woman/display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "bind": "/model/instance/FWNewHH/woman/FWELIGIBLE" - }, - { - "name": "FWWOMANYID", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMANYID" - }, - { - "name": "FWWOMNID", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMNID" - }, - { - "name": "FWWOMRETYPENID", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMRETYPENID" - }, - { - "name": "FWWOMBID", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMBID" - }, - { - "name": "FWWOMRETYPEBID", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMRETYPEBID" - }, - { - "name": "FWHUSNAME", - "bind": "/model/instance/FWNewHH/woman/eligible/FWHUSNAME" - }, - { - "name": "FWWOMCOUNTRY", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMCOUNTRY" - }, - { - "name": "FWWOMDIVISION", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMDIVISION" - }, - { - "name": "FWWOMDISTRICT", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMDISTRICT" - }, - { - "name": "FWWOMUPAZILLA", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMUPAZILLA" - }, - { - "name": "FWWOMUNION", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMUNION" - }, - { - "name": "FWWOMWARD", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMWARD" - }, - { - "name": "FWWOMSUBUNIT", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMSUBUNIT" - }, - { - "name": "FWWOMMAUZA_PARA", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMMAUZA_PARA" - }, - { - "name": "FWWOMGOBHHID", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMGOBHHID" - }, - { - "name": "FWWOMGPS", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMGPS" - } - ] - } - ] - } -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/new_household_registration_with_grouped_subform_data/form_submission1.json b/opensrp-core/src/test/resources/form/new_household_registration_with_grouped_subform_data/form_submission1.json deleted file mode 100644 index 75775ca8cd..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration_with_grouped_subform_data/form_submission1.json +++ /dev/null @@ -1,363 +0,0 @@ -{ - "id": "5ec11f03071ef0929839079530028992", - "_rev": "2-ddf675dd499e017538671b94843aeefc", - "type": "FormSubmission", - "anmId": "opensrp", - "instanceId": "d304dbr7-3998-434f-8c5b-55d6f5fa4252", - "formName": "new_household_registration_with_grouped_subform_data", - "entityId": "4237d267-d438-49f2-7822-8968t555447c", - "clientVersion": 1444562091545, - "formDataDefinitionVersion": "12", - "formInstance": { - "form_data_definition_version": "12", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "4237d267-d438-49f2-7822-8968t555447c", - "source": "household.id" - }, - { - "name": "location_name", - "value": "DASLIA-_ALL_PARAS", - "source": "household.location_name" - }, - { - "name": "existing_location", - "value": "2fc43738-ace5-g961-8e8f-ab7dg0e5bc63", - "source": "household.existing_location" - }, - { - "name": "existing_Country", - "value": "Bangladesh", - "source": "household.existing_Country" - }, - { - "name": "existing_Division", - "value": "RANGPUR", - "source": "household.existing_Division" - }, - { - "name": "existing_District", - "value": "GAIBANDHA", - "source": "household.existing_District" - }, - { - "name": "existing_Upazilla", - "value": "SADULLAPUR", - "source": "household.existing_Upazilla" - }, - { - "name": "existing_Union", - "value": "NALDANGA", - "source": "household.existing_Union" - }, - { - "name": "existing_Ward", - "value": "Ward-3", - "source": "household.existing_Ward" - }, - { - "name": "existing_Subunit", - "value": "3-KHA", - "source": "household.existing_Subunit" - }, - { - "name": "existing_Mauzapara", - "value": "DASLIA+-+ALL+PARAS", - "source": "household.existing_Mauzapara" - }, - { - "name": "today", - "value": "2015-10-11", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-10-11T17:12:34.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-10-11T17:12:34.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-10-11", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "2322", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "9889", - "source": "household.FWJIVHHID" - }, - { - "name": "FWCOUNTRY", - "value": "Bangladesh", - "source": "household.FWCOUNTRY" - }, - { - "name": "FWDIVISION", - "value": "RANGPUR", - "source": "household.FWDIVISION" - }, - { - "name": "FWDISTRICT", - "value": "GAIBANDHA", - "source": "household.FWDISTRICT" - }, - { - "name": "FWUPAZILLA", - "value": "SADULLAPUR", - "source": "household.FWUPAZILLA" - }, - { - "name": "FWUNION", - "value": "NALDANGA", - "source": "household.FWUNION" - }, - { - "name": "FWWARD", - "value": "Ward-3", - "source": "household.FWWARD" - }, - { - "name": "FWSUBUNIT", - "value": "3-KHA", - "source": "household.FWSUBUNIT" - }, - { - "name": "FWMAUZA_PARA", - "value": "DASLIA+-+ALL+PARAS", - "source": "household.FWMAUZA_PARA" - }, - { - "name": "FWNHHHGPS", - "value": "23.8002 90.4068 0 10", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "mango", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "value": "2", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "value": "23", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "value": "1", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "hoby", - "source": "household.join_names" - }, - { - "name": "MWRA", - "value": "1", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "relationalid", - "source": "elco.relationalid" - }, - { - "name": "WomanREGDATE", - "source": "elco.WomanREGDATE" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - }, - { - "name": "FWWOMANYID", - "source": "elco.FWWOMANYID" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMRETYPENID", - "source": "elco.FWWOMRETYPENID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWWOMRETYPEBID", - "source": "elco.FWWOMRETYPEBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWWOMCOUNTRY", - "source": "elco.FWWOMCOUNTRY" - }, - { - "name": "FWWOMDIVISION", - "source": "elco.FWWOMDIVISION" - }, - { - "name": "FWWOMDISTRICT", - "source": "elco.FWWOMDISTRICT" - }, - { - "name": "FWWOMUPAZILLA", - "source": "elco.FWWOMUPAZILLA" - }, - { - "name": "FWWOMUNION", - "source": "elco.FWWOMUNION" - }, - { - "name": "FWWOMWARD", - "source": "elco.FWWOMWARD" - }, - { - "name": "FWWOMSUBUNIT", - "source": "elco.FWWOMSUBUNIT" - }, - { - "name": "FWWOMMAUZA_PARA", - "source": "elco.FWWOMMAUZA_PARA" - }, - { - "name": "FWWOMGOBHHID", - "source": "elco.FWWOMGOBHHID" - }, - { - "name": "FWWOMGPS", - "source": "elco.FWWOMGPS" - } - ], - "instances": [ - { - "GOBHHID": "2322", - "JiVitAHHID": "9889", - "WomanREGDATE": "2015-10-11", - "FWWOMFNAME": "jackfruit", - "FWWOMLNAME": ".", - "FWBIRTHDATE": "1988-10-08", - "FWGENDER": "female", - "FWWOMAGE": "27", - "display_age": "", - "FWNHWOMSTRMEN": "0", - "FWNHWOMHUSLIV": "1", - "FWNHWOMHUSALV": "", - "FWNHWOMHUSSTR": "0", - "FWELIGIBLE": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "FWWOMANYID": "1 2", - "FWWOMNID": "7675788777775", - "FWWOMRETYPENID": "7675788777775", - "FWWOMBID": "98899998888888888", - "FWWOMRETYPEBID": "98899998888888888", - "FWHUSNAME": "zoom", - "FWWOMCOUNTRY": "Bangladesh", - "FWWOMDIVISION": "RANGPUR", - "FWWOMDISTRICT": "GAIBANDHA", - "FWWOMUPAZILLA": "SADULLAPUR", - "FWWOMUNION": "NALDANGA", - "FWWOMWARD": "Ward-3", - "FWWOMSUBUNIT": "3-KHA", - "FWWOMMAUZA_PARA": "DASLIA+-+ALL+PARAS", - "FWWOMGOBHHID": "2322", - "FWWOMGPS": "23.8002 90.4068 0 10", - "id": "ce71572a-8oc5-u32f-9d3b-4a6b568d5g77" - } - ] - } - ] - } - }, - "serverVersion": 1444734863350 -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/new_household_registration_with_grouped_subform_data/model.xml b/opensrp-core/src/test/resources/form/new_household_registration_with_grouped_subform_data/model.xml deleted file mode 100644 index 49e8d05084..0000000000 --- a/opensrp-core/src/test/resources/form/new_household_registration_with_grouped_subform_data/model.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2000-01-02 00:00:00 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FWA - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/offsite_child_followup/form.json b/opensrp-core/src/test/resources/form/offsite_child_followup/form.json deleted file mode 100644 index 03c91a8053..0000000000 --- a/opensrp-core/src/test/resources/form/offsite_child_followup/form.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"Offsite_Child_Vaccination_Followup","title":"دوسرے سینٹر میں رجسٹرڈ بچّوں کا فالو اپ رجسٹر برائے ٹیکاجات - Off Site Child Follow Up Vaccination Register","sms_keyword":"offsite_child_vaccination_followup","default_language":"English","choices":{"provinces":[{"name":"kpk","label":{"Urdu":"خیبر پختون خواہ","English":"Khyber Pakhtunkhwa","Roman Urdu":"Khyber Pakhtunkhwa"}},{"name":"sindh","label":{"Urdu":"سندھ","English":"Sindh","Roman Urdu":"Sindh"}},{"name":"balochistan","label":{"Urdu":"بلوچستان","English":"Balochistan","Roman Urdu":"Balochistan"}},{"name":"punjab","label":{"Urdu":"پنجاب","English":"Punjab","Roman Urdu":"Punjab"}},{"name":"gilgit_baltistan","label":{"Urdu":"گلگت بلتستان","English":"Gilgit Baltistan","Roman Urdu":"Gilgit Baltistan"}},{"name":"kashmir","label":{"Urdu":"کشمیر","English":"Kashmir","Roman Urdu":"Kashmir"}},{"name":"fata","label":{"Urdu":"فاٹا","English":"FATA","Roman Urdu":"FATA"}},{"name":"out_of_country","label":{"Urdu":"ملک سے باہر","English":"Out of Country","Roman Urdu":"Out of Country"}}],"ucs":[{"province":"sindh","city":"karachi","town":"korangi","name":"bilal_colony","label":{"Urdu":"بلال کالونی","Roman Urdu":"Bilal Colony","English":"Bilal Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"nasir_colony","label":{"Urdu":"ناصر کالونی","Roman Urdu":"Nasir Colony","English":"Nasir Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"chakra_goth","label":{"Urdu":"چکرا گوٹھ","Roman Urdu":"Chakra Goth","English":"Chakra Goth"}},{"province":"sindh","city":"karachi","town":"korangi","name":"mustafa_taj_colony","label":{"Urdu":"مصطفی تاج کالونی","Roman Urdu":"Mustafa Taj Colony","English":"Mustafa Taj Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"hundred_quarters","label":{"Urdu":"ہنڈریڈ کوارٹر","Roman Urdu":"Hundred Quarters","English":"Hundred Quarters"}},{"province":"sindh","city":"karachi","town":"korangi","name":"gulzar_colony","label":{"Urdu":"گلزار کالونی","Roman Urdu":"Gulzar Colony","English":"Gulzar Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"korangi_sector_33","label":{"Urdu":"کورنگی سیکٹر 33","Roman Urdu":"Korangi Sector 33","English":"Korangi Sector 33"}},{"province":"sindh","city":"karachi","town":"korangi","name":"zaman_town","label":{"Urdu":"زمان ٹاوَن","Roman Urdu":"Zaman Town","English":"Zaman Town"}},{"province":"sindh","city":"karachi","town":"korangi","name":"hasrat_mohani_colony","label":{"Urdu":"حسرت موہانی کالونی","Roman Urdu":"Hasrat Mohani Colony","English":"Hasrat Mohani Colony"}},{"province":"sindh","city":"karachi","town":"baldia","name":"gulshan_e_ghazi","label":{"Urdu":"گلشن غازی","Roman Urdu":"Gulshan-e-Ghazi","English":"Gulshan-e-Ghazi"}},{"province":"sindh","city":"karachi","town":"baldia","name":"ittehad_town","label":{"Urdu":"اتحاد ٹاوَن","Roman Urdu":"Ittehad Town","English":"Ittehad Town"}},{"province":"sindh","city":"karachi","town":"baldia","name":"islam_nagar","label":{"Urdu":"اسلام نگر","Roman Urdu":"Islam Nagar","English":"Islam Nagar"}},{"province":"sindh","city":"karachi","town":"baldia","name":"nai_abadi","label":{"Urdu":"نئی آبادی","Roman Urdu":"Nai Abadi","English":"Nai Abadi"}},{"province":"sindh","city":"karachi","town":"baldia","name":"saeedabad","label":{"Urdu":"سعید آباد","Roman Urdu":"Saeedabad","English":"Saeedabad"}},{"province":"sindh","city":"karachi","town":"baldia","name":"muslim_mujahid_colony","label":{"Urdu":"مسلم مجاہد کالونی","Roman Urdu":"Muslim Mujahid Colony","English":"Muslim Mujahid Colony"}},{"province":"sindh","city":"karachi","town":"baldia","name":"muhajir_camp","label":{"Urdu":"مہاجر کیمپ","Roman Urdu":"Muhajir Camp","English":"Muhajir Camp"}},{"province":"sindh","city":"karachi","town":"baldia","name":"rasheedabad","label":{"Urdu":"رشید آباد","Roman Urdu":"Rasheedabad","English":"Rasheedabad"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"ibrahim_hyderi","label":{"Urdu":"ابراہیم حیدری","Roman Urdu":"Ibrahim Hyderi","English":"Ibrahim Hyderi"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"rehri","label":{"Urdu":"رہڑی","Roman Urdu":"Rehri","English":"Rehri"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"cattle_colony","label":{"Urdu":"کیٹل کالونی","Roman Urdu":"Cattle Colony","English":"Cattle Colony"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"qaidabad","label":{"Urdu":"قائدآباد","Roman Urdu":"Qaidabad","English":"Qaidabad"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"landhi_colony","label":{"Urdu":"لانڈھی کالونی","Roman Urdu":"Landhi Colony","English":"Landhi Colony"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"gulshan_e_hadeed","label":{"Urdu":"گلشن حدید","Roman Urdu":"Gulshan-e-Hadeed","English":"Gulshan-e-Hadeed"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"gaghar","label":{"Urdu":"گگر","Roman Urdu":"Gaghar","English":"Gaghar"}},{"province":"sindh","city":"karachi","town":"gadap","name":"murad_memon_goth","label":{"Urdu":"مراد میمن گوٹھ","Roman Urdu":"Murad Memon Goth","English":"Murad Memon Goth"}},{"province":"sindh","city":"karachi","town":"gadap","name":"darsano_chana","label":{"Urdu":"درشانو شنو","Roman Urdu":"Darsano Chana","English":"Darsano Chana"}},{"province":"sindh","city":"karachi","town":"gadap","name":"gujro","label":{"Urdu":"گجرو","Roman Urdu":"Gujro","English":"Gujro"}},{"province":"sindh","city":"karachi","town":"gadap","name":"songal","label":{"Urdu":"سنگل","Roman Urdu":"Songal","English":"Songal"}},{"province":"sindh","city":"karachi","town":"gadap","name":"maymarabad","label":{"Urdu":"معمار آباد","Roman Urdu":"Maymarabad","English":"Maymarabad"}},{"province":"sindh","city":"karachi","town":"gadap","name":"yousuf_goth","label":{"Urdu":"یوسف گوٹھ","Roman Urdu":"Yousuf Goth","English":"Yousuf Goth"}},{"province":"sindh","city":"karachi","town":"gadap","name":"manghopir","label":{"Urdu":"منگھوپیر","Roman Urdu":"Manghopir","English":"Manghopir"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"azizabad","label":{"Urdu":"عزیز آباد","Roman Urdu":"Azizabad","English":"Azizabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"karimabad","label":{"Urdu":"کریم آباد","Roman Urdu":"Karimabad","English":"Karimabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"aisha_manzil","label":{"Urdu":"عائشہ منزل","Roman Urdu":"Aisha Manzil","English":"Aisha Manzil"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"ancholi","label":{"Urdu":"انچولی","Roman Urdu":"Ancholi","English":"Ancholi"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"naseerabad","label":{"Urdu":"نصیرآباد","Roman Urdu":"Naseerabad","English":"Naseerabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"yaseenabad","label":{"Urdu":"یاسین آباد","Roman Urdu":"Yaseenabad","English":"Yaseenabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"water_pump","label":{"Urdu":"واٹرپمپ","Roman Urdu":"Water Pump","English":"Water Pump"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"shafiq_mill_colony","label":{"Urdu":"شفیق مل کالونی","Roman Urdu":"Shafiq Mill Colony","English":"Shafiq Mill Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"delhi_mercantile_society","label":{"Urdu":"دہلی مرچنٹائل سوسائٹی","Roman Urdu":"Delhi Mercantile Society","English":"Delhi Mercantile Society"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"civic_centre","label":{"Urdu":"سوک سینٹر","Roman Urdu":"Civic Centre","English":"Civic Centre"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"pir_ilahi_buksh_colony","label":{"Urdu":"پیر الہی بخش کالونی","Roman Urdu":"Pir Ilahi Buksh Colony","English":"Pir Ilahi Buksh Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"essa_nagri","label":{"Urdu":"عیسی نگری","Roman Urdu":"Essa Nagri","English":"Essa Nagri"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gulshan_e_iqbal","label":{"Urdu":"گلشن اقبال","Roman Urdu":"Gulshan-e-Iqbal","English":"Gulshan-e-Iqbal"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gillani_railway_station","label":{"Urdu":"گیلانی ریلوے اسٹیشن","Roman Urdu":"Gillani Railway Station","English":"Gillani Railway Station"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"shanti_nagar","label":{"Urdu":"شانتی نگر","Roman Urdu":"Shanti Nagar","English":"Shanti Nagar"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"jamali_colony","label":{"Urdu":"جمالی کالونی","Roman Urdu":"Jamali Colony","English":"Jamali Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gulshan_e_iqbal_ii","label":{"Urdu":"گلشن اقبال 2","Roman Urdu":"Gulshan-e-Iqbal II","English":"Gulshan-e-Iqbal II"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"pehlwan_goth","label":{"Urdu":"پہلوان گوٹھ","Roman Urdu":"Pehlwan Goth","English":"Pehlwan Goth"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"matrovil_colony","label":{"Urdu":"میٹروویل کالونی","Roman Urdu":"Matrovil Colony","English":"Matrovil Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gulzar_e_hijri","label":{"Urdu":"گلزار ہجری","Roman Urdu":"Gulzar-e-Hijri","English":"Gulzar-e-Hijri"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"safooran_goth","label":{"Urdu":"صفورا گوٹھ","Roman Urdu":"Safooran Goth","English":"Safooran Goth"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"akhtar_colony","label":{"Urdu":"اختر کالونی","Roman Urdu":"Akhtar Colony","English":"Akhtar Colony"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"manzoor_colony","label":{"Urdu":"منظور کالونی","Roman Urdu":"Manzoor Colony","English":"Manzoor Colony"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"azam_basti","label":{"Urdu":"اعظم بستی","Roman Urdu":"Azam Basti","English":"Azam Basti"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"chanesar_goth","label":{"Urdu":"چنیسر گوٹھ","Roman Urdu":"Chanesar Goth","English":"Chanesar Goth"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"mahmudabad","label":{"Urdu":"محمودآباد","Roman Urdu":"Mahmudabad","English":"Mahmudabad"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"pechs","label":{"Urdu":"پی۔ای۔سی۔ایچ۔ایس","Roman Urdu":"P.E.C.H.S.","English":"P.E.C.H.S."}},{"province":"sindh","city":"karachi","town":"jamshed","name":"pechs_ii","label":{"Urdu":"پی۔ای۔سی۔ایچ۔ایس 2","Roman Urdu":"P.E.C.H.S. II","English":"P.E.C.H.S. II"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"jut_line","label":{"Urdu":"جٹ لائن","Roman Urdu":"Jut Line","English":"Jut Line"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"central_jacob_lines","label":{"Urdu":"سینٹرل جیکب لائن","Roman Urdu":"Central Jacob Lines","English":"Central Jacob Lines"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"jamshed_quarters","label":{"Urdu":"جمشید کوارٹر","Roman Urdu":"Jamshed Quarters","English":"Jamshed Quarters"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"garden_east","label":{"Urdu":"گارڈن ایسٹ","Roman Urdu":"Garden East","English":"Garden East"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"soldier_bazar","label":{"Urdu":"سولجر بازار","Roman Urdu":"Soldier Bazar","English":"Soldier Bazar"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"pakistan_quarters","label":{"Urdu":"پاکستان کوارٹر","Roman Urdu":"Pakistan Quarters","English":"Pakistan Quarters"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"bhutta_village","label":{"Urdu":"بھٹا ولیج","Roman Urdu":"Bhutta Village","English":"Bhutta Village"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"sultanabad","label":{"Urdu":"سلطان آباد","Roman Urdu":"Sultanabad","English":"Sultanabad"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"kiamari_uc","label":{"Urdu":"کیماری یو- سی","Roman Urdu":"Kiamari UC","English":"Kiamari UC"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"baba_bhit","label":{"Urdu":"بابا بھٹ","Roman Urdu":"Baba Bhit","English":"Baba Bhit"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"machar_colony","label":{"Urdu":"مچھر کالونی","Roman Urdu":"Machar Colony","English":"Machar Colony"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"maripur","label":{"Urdu":"ماڑی پور","Roman Urdu":"Maripur","English":"Maripur"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"shershah","label":{"Urdu":"شیرشاہ","Roman Urdu":"SherShah","English":"SherShah"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"gabo_pat","label":{"Urdu":"گابو پٹ","Roman Urdu":"Gabo Pat","English":"Gabo Pat"}},{"province":"sindh","city":"karachi","town":"landhi","name":"muzafarabad","label":{"Urdu":"مظفرآباد","Roman Urdu":"Muzafarabad","English":"Muzafarabad"}},{"province":"sindh","city":"karachi","town":"landhi","name":"muslimabad","label":{"Urdu":"مسلم آباد","Roman Urdu":"Muslimabad","English":"Muslimabad"}},{"province":"sindh","city":"karachi","town":"landhi","name":"dawood_chowrangi","label":{"Urdu":"داوَد چورنگی","Roman Urdu":"Dawood Chowrangi","English":"Dawood Chowrangi"}},{"province":"sindh","city":"karachi","town":"landhi","name":"moinabad","label":{"Urdu":"معین آباد","Roman Urdu":"Moinabad","English":"Moinabad"}},{"province":"sindh","city":"karachi","town":"landhi","name":"sharafi_goth","label":{"Urdu":"شرافی گوٹھ","Roman Urdu":"Sharafi Goth","English":"Sharafi Goth"}},{"province":"sindh","city":"karachi","town":"landhi","name":"bhutto_nagar","label":{"Urdu":"بھٹو نگر","Roman Urdu":"Bhutto Nagar","English":"Bhutto Nagar"}},{"province":"sindh","city":"karachi","town":"landhi","name":"khawaja_ajmeer_colony","label":{"Urdu":"خواجہ اجمیر کالونی","Roman Urdu":"Khawaja Ajmeer Colony","English":"Khawaja Ajmeer Colony"}},{"province":"sindh","city":"karachi","town":"landhi","name":"landhi_uc","label":{"Urdu":"لانڈھی یوسی","Roman Urdu":"Landhi UC","English":"Landhi UC"}},{"province":"sindh","city":"karachi","town":"landhi","name":"awami_colony","label":{"Urdu":"عوامی کالونی","Roman Urdu":"Awami Colony","English":"Awami Colony"}},{"province":"sindh","city":"karachi","town":"landhi","name":"burmee_colony","label":{"Urdu":"برمی کالونی","Roman Urdu":"Burmee Colony","English":"Burmee Colony"}},{"province":"sindh","city":"karachi","town":"landhi","name":"korangi_uc","label":{"Urdu":"کورنگی یوسی","Roman Urdu":"Korangi UC","English":"Korangi UC"}},{"province":"sindh","city":"karachi","town":"landhi","name":"sherabad","label":{"Urdu":"شیرآباد","Roman Urdu":"Sherabad","English":"Sherabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"rizvia_society","label":{"Urdu":"رضویہ سوسائٹی","Roman Urdu":"Rizvia Society","English":"Rizvia Society"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"firdous_colony","label":{"Urdu":"فردوس کالونی","Roman Urdu":"Firdous Colony","English":"Firdous Colony"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"super_market","label":{"Urdu":"سپر مارکیٹ","Roman Urdu":"Super Market","English":"Super Market"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"dak_khana","label":{"Urdu":"دک کھانہ","Roman Urdu":"Dak Khana","English":"Dak Khana"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"qasimabad","label":{"Urdu":"قاسم آباد","Roman Urdu":"Qasimabad","English":"Qasimabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"bandhani_colony","label":{"Urdu":"بندھانی کالونی","Roman Urdu":"Bandhani Colony","English":"Bandhani Colony"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"sharifabad","label":{"Urdu":"شریف آباد","Roman Urdu":"Sharifabad","English":"Sharifabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"commercial_area","label":{"Urdu":"کمرشل ایریا","Roman Urdu":"Commercial Area","English":"Commercial Area"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"mujahid_colony","label":{"Urdu":"مجاہد کالونی","Roman Urdu":"Mujahid Colony","English":"Mujahid Colony"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"nazimabad","label":{"Urdu":"ناظم آباد","Roman Urdu":"Nazimabad","English":"Nazimabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"abbasi_shaheed","label":{"Urdu":"عباسی شہید","Roman Urdu":"Abbasi Shaheed","English":"Abbasi Shaheed"}},{"province":"sindh","city":"karachi","town":"lyari","name":"agra_taj_colony","label":{"Urdu":"آگرہ تاج کالونی","Roman Urdu":"Agra Taj Colony","English":"Agra Taj Colony"}},{"province":"sindh","city":"karachi","town":"lyari","name":"daryaabad","label":{"Urdu":"دریاآباد","Roman Urdu":"Daryaabad","English":"Daryaabad"}},{"province":"sindh","city":"karachi","town":"lyari","name":"nawabad","label":{"Urdu":"نواآباد","Roman Urdu":"Nawabad","English":"Nawabad"}},{"province":"sindh","city":"karachi","town":"lyari","name":"khada_memon_society","label":{"Urdu":"خدا- میمن- سوساَٹی","Roman Urdu":"Khada Memon Society","English":"Khada Memon Society"}},{"province":"sindh","city":"karachi","town":"lyari","name":"baghdadi","label":{"Urdu":"بغدادی","Roman Urdu":"Baghdadi","English":"Baghdadi"}},{"province":"sindh","city":"karachi","town":"lyari","name":"shah_baig_line","label":{"Urdu":"شاھ باغ لائن","Roman Urdu":"Shah Baig Line","English":"Shah Baig Line"}},{"province":"sindh","city":"karachi","town":"lyari","name":"bihar_colony","label":{"Urdu":"بہار کالونی","Roman Urdu":"Bihar Colony","English":"Bihar Colony"}},{"province":"sindh","city":"karachi","town":"lyari","name":"ragiwara","label":{"Urdu":"راگی واڑا","Roman Urdu":"Ragiwara","English":"Ragiwara"}},{"province":"sindh","city":"karachi","town":"lyari","name":"singo_line","label":{"Urdu":"سنگولائن","Roman Urdu":"Singo Line","English":"Singo Line"}},{"province":"sindh","city":"karachi","town":"lyari","name":"chakiwara","label":{"Urdu":"چاکی واڑا","Roman Urdu":"Chakiwara","English":"Chakiwara"}},{"province":"sindh","city":"karachi","town":"lyari","name":"allama_iqbal_colony","label":{"Urdu":"علامہ اقبال کالونی","Roman Urdu":"Allama Iqbal Colony","English":"Allama Iqbal Colony"}},{"province":"sindh","city":"karachi","town":"malir","name":"model_colony","label":{"Urdu":"موڈل کالونی","Roman Urdu":"Model Colony","English":"Model Colony"}},{"province":"sindh","city":"karachi","town":"malir","name":"kala_board","label":{"Urdu":"کالا بورڈ","Roman Urdu":"Kala Board","English":"Kala Board"}},{"province":"sindh","city":"karachi","town":"malir","name":"saudabad","label":{"Urdu":"سعودآباد","Roman Urdu":"Saudabad","English":"Saudabad"}},{"province":"sindh","city":"karachi","town":"malir","name":"khokhra_par","label":{"Urdu":"کھوکھرا پار","Roman Urdu":"Khokhra Par","English":"Khokhra Par"}},{"province":"sindh","city":"karachi","town":"malir","name":"jafar_e_tayyar","label":{"Urdu":"جعفر تیار","Roman Urdu":"Jafar-e-Tayyar","English":"Jafar-e-Tayyar"}},{"province":"sindh","city":"karachi","town":"malir","name":"gharibabad","label":{"Urdu":"غریب آباد","Roman Urdu":"Gharibabad","English":"Gharibabad"}},{"province":"sindh","city":"karachi","town":"malir","name":"ghazi_brohi_goth","label":{"Urdu":"غازی بروہی گوٹھ","Roman Urdu":"Ghazi Brohi Goth","English":"Ghazi Brohi Goth"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"kalyana","label":{"Urdu":"کالیانہ","Roman Urdu":"Kalyana","English":"Kalyana"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"sir_syed_colony","label":{"Urdu":"سر سید کالونی","Roman Urdu":"Sir Syed Colony","English":"Sir Syed Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"fatima_jinnah_colony","label":{"Urdu":"فاطمہ جناح کالونی","Roman Urdu":"Fatima Jinnah Colony","English":"Fatima Jinnah Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"godhra","label":{"Urdu":"گودھرا","Roman Urdu":"Godhra","English":"Godhra"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"abu_zar_ghaffari","label":{"Urdu":"ابو زر غفاری","Roman Urdu":"Abu Zar Ghaffari","English":"Abu Zar Ghaffari"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"hakim_ahsan","label":{"Urdu":"حاکم احسان","Roman Urdu":"Hakim Ahsan","English":"Hakim Ahsan"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"madina_colony","label":{"Urdu":"مدینہ کالونی","Roman Urdu":"Madina Colony","English":"Madina Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"faisal_colony","label":{"Urdu":"فیصل کالونی","Roman Urdu":"Faisal Colony","English":"Faisal Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"khamiso_goth","label":{"Urdu":"خمیسو گوٹھ","Roman Urdu":"Khamiso Goth","English":"Khamiso Goth"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"mustufa_colony","label":{"Urdu":"مصطفی کالونی","Roman Urdu":"Mustufa Colony","English":"Mustufa Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"khawaja_ajmeer_nagri","label":{"Urdu":"خواجہ اجمیر نگری","Roman Urdu":"Khawaja Ajmeer Nagri","English":"Khawaja Ajmeer Nagri"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"gulshan_e_saeed","label":{"Urdu":"گلشن سعید","Roman Urdu":"Gulshan-e-Saeed","English":"Gulshan-e-Saeed"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"shah_nawaz_bhutto_colony","label":{"Urdu":"شاہ نواز بھٹو کالونی","Roman Urdu":"Shah Nawaz Bhutto Colony","English":"Shah Nawaz Bhutto Colony"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"paposh_nagar","label":{"Urdu":"پاپوش نگر","Roman Urdu":"Paposh Nagar","English":"Paposh Nagar"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"pahar_ganj","label":{"Urdu":"پہاڑ گنج","Roman Urdu":"Pahar Ganj","English":"Pahar Ganj"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"khandu_goth","label":{"Urdu":"کھنڑو گوٹھ","Roman Urdu":"Khandu Goth","English":"Khandu Goth"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"hyderi","label":{"Urdu":"حیدری","Roman Urdu":"Hyderi","English":"Hyderi"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"sakhi_hassan","label":{"Urdu":"سخی حسن","Roman Urdu":"Sakhi Hassan","English":"Sakhi Hassan"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"farooq_e_azam","label":{"Urdu":"فاروق اعظم","Roman Urdu":"Farooq-e-Azam","English":"Farooq-e-Azam"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"nusrat_bhutto_colony","label":{"Urdu":"نصرت بھٹو کالونی","Roman Urdu":"Nusrat Bhutto Colony","English":"Nusrat Bhutto Colony"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"shadman_town","label":{"Urdu":"شادمان ٹاوَن","Roman Urdu":"Shadman Town","English":"Shadman Town"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"buffer_zone","label":{"Urdu":"بفرزون","Roman Urdu":"Buffer Zone","English":"Buffer Zone"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"buffer_zone_ii","label":{"Urdu":"بفرزون 2","Roman Urdu":"Buffer Zone II","English":"Buffer Zone II"}},{"province":"sindh","city":"karachi","town":"orangi","name":"mominabad","label":{"Urdu":"مومن آباد","Roman Urdu":"Mominabad","English":"Mominabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"haryana_colony","label":{"Urdu":"حریانہ کالونی","Roman Urdu":"Haryana Colony","English":"Haryana Colony"}},{"province":"sindh","city":"karachi","town":"orangi","name":"hanifabad","label":{"Urdu":"حنیف آباد","Roman Urdu":"Hanifabad","English":"Hanifabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"mohammad_nagar","label":{"Urdu":"محمد نگر","Roman Urdu":"Mohammad Nagar","English":"Mohammad Nagar"}},{"province":"sindh","city":"karachi","town":"orangi","name":"madina_colony_orangi","label":{"Urdu":"مدینہ کالونی اورنگی","Roman Urdu":"Madina Colony Orangi","English":"Madina Colony Orangi"}},{"province":"sindh","city":"karachi","town":"orangi","name":"ghaziabad","label":{"Urdu":"غازی آباد","Roman Urdu":"Ghaziabad","English":"Ghaziabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"chisti_nagar","label":{"Urdu":"چشتی نگر","Roman Urdu":"Chisti Nagar","English":"Chisti Nagar"}},{"province":"sindh","city":"karachi","town":"orangi","name":"bilal_colony_orangi","label":{"Urdu":"بلال کالونی اورنگی","Roman Urdu":"Bilal Colony Orangi","English":"Bilal Colony Orangi"}},{"province":"sindh","city":"karachi","town":"orangi","name":"iqbal_baloch_colony","label":{"Urdu":"اقبال بلوچ کالونی","Roman Urdu":"Iqbal Baloch Colony","English":"Iqbal Baloch Colony"}},{"province":"sindh","city":"karachi","town":"orangi","name":"ghabool_town","label":{"Urdu":"گبول ٹاوَن","Roman Urdu":"Ghabool Town","English":"Ghabool Town"}},{"province":"sindh","city":"karachi","town":"orangi","name":"data_nagar","label":{"Urdu":"داتا نگر","Roman Urdu":"Data Nagar","English":"Data Nagar"}},{"province":"sindh","city":"karachi","town":"orangi","name":"mujahidabad","label":{"Urdu":"مجاہد آباد","Roman Urdu":"Mujahidabad","English":"Mujahidabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"baloch_goth","label":{"Urdu":"بلوچ گوٹھ","Roman Urdu":"Baloch Goth","English":"Baloch Goth"}},{"province":"sindh","city":"karachi","town":"saddar","name":"old_haji_camp","label":{"Urdu":"پرانہ حاجی کیمپ","Roman Urdu":"Old Haji Camp","English":"Old Haji Camp"}},{"province":"sindh","city":"karachi","town":"saddar","name":"garden","label":{"Urdu":"گارڈن","Roman Urdu":"Garden","English":"Garden"}},{"province":"sindh","city":"karachi","town":"saddar","name":"kharadar","label":{"Urdu":"کھارادر","Roman Urdu":"Kharadar","English":"Kharadar"}},{"province":"sindh","city":"karachi","town":"saddar","name":"city_railway_colony","label":{"Urdu":"سٹی ریلوے کالونی","Roman Urdu":"City Railway Colony","English":"City Railway Colony"}},{"province":"sindh","city":"karachi","town":"saddar","name":"nanak_wara","label":{"Urdu":"ناناک واڑا","Roman Urdu":"Nanak Wara","English":"Nanak Wara"}},{"province":"sindh","city":"karachi","town":"saddar","name":"gazdarabad","label":{"Urdu":"گزدرآباد","Roman Urdu":"Gazdarabad","English":"Gazdarabad"}},{"province":"sindh","city":"karachi","town":"saddar","name":"millat_nagar_islam_pura","label":{"Urdu":"ملت نگر اسلام پورا","Roman Urdu":"Millat Nagar/Islam Pura","English":"Millat Nagar/Islam Pura"}},{"province":"sindh","city":"karachi","town":"saddar","name":"saddar_uc","label":{"Urdu":"صدر یو سی","Roman Urdu":"Saddar UC","English":"Saddar UC"}},{"province":"sindh","city":"karachi","town":"saddar","name":"civil_line","label":{"Urdu":"سول لائن","Roman Urdu":"Civil Line","English":"Civil Line"}},{"province":"sindh","city":"karachi","town":"saddar","name":"clifton","label":{"Urdu":"کلفٹن","Roman Urdu":"Clifton","English":"Clifton"}},{"province":"sindh","city":"karachi","town":"saddar","name":"kehkashan","label":{"Urdu":"کہکشان","Roman Urdu":"Kehkashan","English":"Kehkashan"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"natha_khan_goth","label":{"Urdu":"ناتھا خان گوٹھ","Roman Urdu":"Natha Khan Goth","English":"Natha Khan Goth"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"pak_sadat_colony","label":{"Urdu":"پاک صدر کالونی","Roman Urdu":"Pak Sadat Colony","English":"Pak Sadat Colony"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"drigh_colony","label":{"Urdu":"ڈرگ کالونی","Roman Urdu":"Drigh Colony","English":"Drigh Colony"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"raita_plot","label":{"Urdu":"رائتا پلاٹ","Roman Urdu":"Raita Plot","English":"Raita Plot"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"moria_khan_goth","label":{"Urdu":"موریا خان گوٹھ","Roman Urdu":"Moria Khan Goth","English":"Moria Khan Goth"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"rafa_e_aam_society","label":{"Urdu":"رفا عام سوسا ئٹی","Roman Urdu":"Rafa-e-Aam Society","English":"Rafa-e-Aam Society"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"al_falah_society","label":{"Urdu":"الفلاح سوسا ئٹی","Roman Urdu":"Al-Falah Society","English":"Al-Falah Society"}},{"province":"sindh","city":"karachi","town":"site","name":"pak_colony","label":{"Urdu":"پاک کالونی","Roman Urdu":"Pak Colony","English":"Pak Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"old_golimar","label":{"Urdu":"پرانہ گولی مار","Roman Urdu":"Old Golimar","English":"Old Golimar"}},{"province":"sindh","city":"karachi","town":"site","name":"jahanabad","label":{"Urdu":"جہان آباد","Roman Urdu":"Jahanabad","English":"Jahanabad"}},{"province":"sindh","city":"karachi","town":"site","name":"metrovil","label":{"Urdu":"میٹروویل","Roman Urdu":"Metrovil","English":"Metrovil"}},{"province":"sindh","city":"karachi","town":"site","name":"bhawani_chali","label":{"Urdu":"بہوانی چالی","Roman Urdu":"Bhawani Chali","English":"Bhawani Chali"}},{"province":"sindh","city":"karachi","town":"site","name":"frontier_colony","label":{"Urdu":"فرونٹر کالونی","Roman Urdu":"Frontier Colony","English":"Frontier Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"banaras_colony","label":{"Urdu":"بنارس کالونی","Roman Urdu":"Banaras Colony","English":"Banaras Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"qasba_colony","label":{"Urdu":"قصبہ کالونی","Roman Urdu":"Qasba Colony","English":"Qasba Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"islamia_colony","label":{"Urdu":"اسلامیہ کالونی","Roman Urdu":"Islamia Colony","English":"Islamia Colony"}},{"province":"na","city":"na","town":"na","name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}},{"province":"na","city":"na","town":"na","name":"not_applicable","label":{"Urdu":"قابل اطلاق نہیں","Roman Urdu":"Qaabil-e-atlaaq nahi","English":"Not Applicable"}}],"gender":[{"instance":{"openmrs_code":"1534AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"male","label":{"Urdu":"مرد/ لڑکا","Roman Urdu":"Mard/larka","English":"Male"}},{"instance":{"openmrs_code":"1535AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"female","label":{"Urdu":"عورت/لڑکی","Roman Urdu":"Aurat/larki","English":"Female"}},{"instance":{"openmrs_code":"163163AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"transgender","label":{"Urdu":"خواجہ سرہ","Roman Urdu":"Khwaja sira","English":"Transgender"}}],"vaccines":[{"instance":{"openmrs_code":"1570AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"bcg","label":{"Urdu":"بی سی جی","Roman Urdu":"BCG","English":"BCG"}},{"instance":{"openmrs_code":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv0","label":{"Urdu":"او پی وی 0","Roman Urdu":"OPV 0","English":"OPV 0"}},{"instance":{"openmrs_code":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pcv1","label":{"Urdu":"پی سی وی 1","Roman Urdu":"PCV 1","English":"PCV 1"}},{"instance":{"openmrs_code":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv1","label":{"Urdu":"او پی وی 1","Roman Urdu":"OPV 1","English":"OPV 1"}},{"instance":{"openmrs_code":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"penta11","label":{"Urdu":"پینٹا ویلنٹ 1","Roman Urdu":"Pentavalent 1","English":"Pentavalent 1"}},{"instance":{"openmrs_code":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pcv2","label":{"Urdu":"پی سی وی 2","Roman Urdu":"PCV 2","English":"PCV 2"}},{"instance":{"openmrs_code":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv2","label":{"Urdu":"او پی وی 2","Roman Urdu":"OPV 2","English":"OPV 2"}},{"instance":{"openmrs_code":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"penta12","label":{"Urdu":"پینٹا ویلنٹ 2","Roman Urdu":"Pentavalent 2","English":"Pentavalent 2"}},{"instance":{"openmrs_code":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pcv3","label":{"Urdu":"پی سی وی 3","Roman Urdu":"PCV 3","English":"PCV 3"}},{"instance":{"openmrs_code":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv3","label":{"Urdu":"او پی وی 3","Roman Urdu":"OPV 3","English":"OPV 3"}},{"instance":{"openmrs_code":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"penta13","label":{"Urdu":"پینٹا ویلنٹ 3","Roman Urdu":"Pentavalent 3","English":"Pentavalent 3"}},{"instance":{"openmrs_code":"82242AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"ipv","label":{"Urdu":"آئی پی وی","Roman Urdu":"IPV","English":"IPV"}},{"instance":{"openmrs_code":"79409AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"measles1","label":{"Urdu":"خسرہ 1","Roman Urdu":"Khasra 1","English":"Measles 1"}},{"instance":{"openmrs_code":"79409AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"measles2","label":{"Urdu":"خسرہ 2","Roman Urdu":"Khasra 2","English":"Measles 2"}}],"towns":[{"province":"sindh","city":"karachi","name":"korangi","label":{"Urdu":"کورنگی","Roman Urdu":"Korangi","English":"Korangi"}},{"province":"sindh","city":"karachi","name":"landhi","label":{"Urdu":"لانڈھی","Roman Urdu":"Landhi","English":"Landhi"}},{"province":"sindh","city":"karachi","name":"baldia","label":{"Urdu":"بلدیہ","Roman Urdu":"Baldia","English":"Baldia"}},{"province":"sindh","city":"karachi","name":"bin_qasim","label":{"Urdu":"بن قاسم","Roman Urdu":"Bin Qasim","English":"Bin Qasim"}},{"province":"sindh","city":"karachi","name":"gadap","label":{"Urdu":"گڈاپ","Roman Urdu":"Gadap","English":"Gadap"}},{"province":"sindh","city":"karachi","name":"gulberg","label":{"Urdu":"گلبرگ","Roman Urdu":"Gulberg","English":"Gulberg"}},{"province":"sindh","city":"karachi","name":"gulshan","label":{"Urdu":"گلشن","Roman Urdu":"Gulshan","English":"Gulshan"}},{"province":"sindh","city":"karachi","name":"jamshed","label":{"Urdu":"جمشید","Roman Urdu":"Jamshed","English":"Jamshed"}},{"province":"sindh","city":"karachi","name":"kiamari","label":{"Urdu":"کیماری","Roman Urdu":"Kiamari","English":"Kiamari"}},{"province":"sindh","city":"karachi","name":"liaquatabad","label":{"Urdu":"لیاقت آباد","Roman Urdu":"Liaquatabad","English":"Liaquatabad"}},{"province":"sindh","city":"karachi","name":"lyari","label":{"Urdu":"لیاری","Roman Urdu":"Lyari","English":"Lyari"}},{"province":"sindh","city":"karachi","name":"malir","label":{"Urdu":"ملیر","Roman Urdu":"Malir","English":"Malir"}},{"province":"sindh","city":"karachi","name":"new_karachi","label":{"Urdu":"نیو کراچی","Roman Urdu":"New Karachi","English":"New Karachi"}},{"province":"sindh","city":"karachi","name":"north_nazimabad","label":{"Urdu":"نارتھ ناظم آباد","Roman Urdu":"North Nazimabad","English":"North Nazimabad"}},{"province":"sindh","city":"karachi","name":"orangi","label":{"Urdu":"اورنگی","Roman Urdu":"Orangi","English":"Orangi"}},{"province":"sindh","city":"karachi","name":"saddar","label":{"Urdu":"صدر","Roman Urdu":"Saddar","English":"Saddar"}},{"province":"sindh","city":"karachi","name":"shah_faisal","label":{"Urdu":"شاہ فیصل","Roman Urdu":"Shah Faisal","English":"Shah Faisal"}},{"province":"sindh","city":"karachi","name":"site","label":{"Urdu":"سائٹ","Roman Urdu":"S.I.T.E.","English":"S.I.T.E."}},{"province":"na","city":"na","name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}},{"province":"na","city":"na","name":"not_applicable","label":{"Urdu":"قابل اطلاق نہیں","Roman Urdu":"Qaabil-e-atlaaq nahi","English":"Not Applicable"}}],"cities":[{"province":"sindh","name":"karachi","label":{"Urdu":"کراچی","Roman Urdu":"Karachi","English":"Karachi"}},{"province":"punjab","name":"hafizabad","label":{"Urdu":"حافظ آباد","Roman Urdu":"Hafizabad","English":"Hafizabad"}},{"province":"punjab","name":"muzaffargarh","label":{"Urdu":"مظفر گڑھ","Roman Urdu":"Muzaffargarh","English":"Muzaffargarh"}},{"province":"na","name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}},{"province":"na","name":"not_applicable","label":{"Urdu":"قابل اطلاق نہیں","Roman Urdu":"Qaabil-e-atlaaq nahi","English":"Not Applicable"}}],"yes_no":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}]},"instance":{"encounter_type":"Off Site Child Vaccination Follow Up"},"version":"201604080501","id_string":"offsite_child_vaccination_followup","type":"survey","children":[{"type":"hidden","name":"provider_uc"},{"type":"hidden","name":"provider_town"},{"type":"hidden","name":"provider_city"},{"type":"hidden","name":"provider_province"},{"type":"hidden","name":"existing_first_name"},{"type":"hidden","name":"existing_last_name"},{"type":"hidden","name":"existing_mother_name"},{"type":"hidden","name":"existing_gender"},{"type":"hidden","name":"existing_client_birth_date"},{"type":"hidden","name":"existing_client_reg_date"},{"type":"hidden","name":"existing_landmark"},{"type":"hidden","name":"existing_house_number"},{"type":"hidden","name":"existing_street"},{"type":"hidden","name":"existing_union_council"},{"type":"hidden","name":"existing_town"},{"type":"hidden","name":"existing_city_village"},{"type":"hidden","name":"existing_province"},{"type":"hidden","name":"existing_union_councilname"},{"type":"hidden","name":"existing_townname"},{"type":"hidden","name":"existing_city_villagename"},{"type":"hidden","name":"existing_provincename"},{"type":"hidden","name":"existing_ethnicity"},{"type":"hidden","name":"existing_program_client_id"},{"type":"hidden","name":"existing_epi_card_number"},{"type":"hidden","name":"existing_child_was_suffering_from_a_disease_at_birth"},{"type":"hidden","name":"existing_reminders_approval"},{"type":"hidden","name":"existing_contact_phone_number"},{"type":"hidden","name":"e_bcg"},{"type":"hidden","name":"e_opv0"},{"type":"hidden","name":"e_penta2"},{"type":"hidden","name":"e_penta1"},{"type":"hidden","name":"e_penta3"},{"type":"hidden","name":"e_opv1"},{"type":"hidden","name":"e_opv2"},{"type":"hidden","name":"e_opv3"},{"type":"hidden","name":"e_pcv1"},{"type":"hidden","name":"e_pcv2"},{"type":"hidden","name":"e_pcv3"},{"type":"hidden","name":"e_measles1"},{"type":"hidden","name":"e_measles2"},{"type":"hidden","name":"e_ipv"},{"type":"hidden","name":"provider_id"},{"instance":{"openmrs_entity_id":"location_id","openmrs_entity":"encounter"},"type":"hidden","name":"provider_location_id"},{"type":"hidden","name":"provider_location_name"},{"type":"note","name":"provider_location_note","label":{"Urdu":"شہر: ${provider_city} ; ٹائون: ${provider_town} ; یوسی: ${provider_uc} ; سینٹرکا نام: ${provider_location_name}","English":"City: ${provider_city} ; Town: ${provider_town} ; UC: ${provider_uc} ; Center Name: ${provider_location_name}","Roman Urdu":"Shehr: ${provider_city} ; Town: ${provider_town} ; UC: ${provider_uc} ; Center ka Naam: ${provider_location_name}"}},{"instance":{"openmrs_entity_id":"163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"start","name":"start"},{"instance":{"openmrs_entity_id":"163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"end","name":"end"},{"instance":{"openmrs_entity_id":"163286AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"today","name":"today"},{"instance":{"openmrs_entity_id":"163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"deviceid","name":"deviceid"},{"instance":{"openmrs_entity_id":"163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"subscriberid","name":"subscriberid"},{"instance":{"openmrs_entity_id":"163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"simserial","name":"simserial"},{"instance":{"openmrs_entity_id":"163152AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"phonenumber","name":"phonenumber"},{"bind":{"required":"yes"},"label":{"Urdu":"بچے کی پروگرام میں اندراج کی تاریخ: {existing_client_reg_date}$","Roman Urdu":"Bachay ki Program mai andraj ki tareekh: ${existing_client_reg_date}","English":"Child Registration date: ${existing_client_reg_date}"},"type":"note","name":"existing_client_reg_date_note","hint":{"Urdu":"بچے کو ویکسین لگنے کی تاریخ","Roman Urdu":"Bachay ko vaccine lagnay ki tareekh","English":"Date on which child was vaccinated"}},{"bind":{"required":"yes"},"type":"note","name":"program_client_id_note","label":{"Urdu":"کلائنٹ کی پروگرام ائی ڈی: {existing_program_client_id}$","Roman Urdu":"Client ki program ID: ${existing_program_client_id}","English":"Program Client ID: ${existing_program_client_id}"}},{"bind":{"jr:constraintMsg":{"Urdu":"نمبر آٹھ ہندسوں پر مشتمل ہونا چاہئے","English":"Number should be 8 digits","Roman Urdu":"Number 8 hindason par mushtamil hona chahiye"},"required":"yes","constraint":"string-length(.) = 8"},"type":"integer","instance":{"openmrs_entity_id":"EPI Card Number","openmrs_entity":"person_attribute"},"name":"epi_card_number","label":{"Urdu":"ای پی آئی کارڈ نمبر: {existing_epi_card_number}$","English":"EPI Card Number: ${existing_epi_card_number}","Roman Urdu":"EPI Card Number: ${existing_epi_card_number}"}},{"bind":{"required":"yes"},"type":"note","name":"first_name_note","label":{"Urdu":"نام: {existing_first_name}$","Roman Urdu":"Naam: ${existing_first_name}","English":"First Name: ${existing_first_name}"}},{"bind":{"required":"yes"},"type":"note","name":"last_name_note","label":{"Urdu":"والد کا نام: {existing_last_name}$","Roman Urdu":"Waalid ka naam: ${existing_last_name}","English":"Last name: ${existing_last_name}"}},{"bind":{"calculate":"int((${today} - ${existing_client_birth_date}) div 30.42)"},"type":"calculate","name":"child_age","instance":{"openmrs_entity_id":"154384AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"}},{"type":"note","name":"calc_dob_note","label":{"Urdu":"بچے کی تاریخ پیدائش: {existing_client_birth_date}$ ({child_age}$) مہینے","English":"Child dob: ${existing_client_birth_date} (${child_age}) months","Roman Urdu":"Bachay ki tareekh-e-paidaish: ${existing_client_birth_date} (${child_age}) mahinay"}},{"bind":{"required":"yes"},"type":"note","name":"gender_note","label":{"Urdu":"جنس: {existing_gender}$","Roman Urdu":"Jins:${existing_gender}","English":"Gender: ${existing_gender}"}},{"type":"note","name":"mother_name_note","label":{"Urdu":"ماں کا نام: {existing_mother_name}$","English":"Mother's Name: ${existing_mother_name}","Roman Urdu":"Maa ka naam: ${existing_mother_name}"}},{"bind":{"required":"yes"},"type":"note","name":"exisiting_ethnicity_note","label":{"Urdu":"قومیت: {existing_ethnicity}$","Roman Urdu":"Qomiat: ${existing_ethnicity}","English":"Ethnicity: ${existing_ethnicity}"}},{"type":"note","name":"address","label":{"Urdu":"موجودہ پتہ: ${existing_house_number}, ${existing_street}, ${existing_landmark}, ${existing_union_councilname}, ${existing_townname}, ${existing_city_villagename}, ${existing_provincename}","English":"Current Address: ${existing_house_number}, ${existing_street}, ${existing_landmark}, ${existing_union_councilname}, ${existing_townname}, ${existing_city_villagename}, ${existing_provincename}","Roman Urdu":"Mojooda Address: ${existing_house_number}, ${existing_street}, ${existing_landmark}, ${existing_union_councilname}, ${existing_townname}, ${existing_city_villagename}, ${existing_provincename}"}},{"label":{"Urdu":"کیا آپ کا گھر کا پتہ بدلا ہے؟","English":"Has your home address changed?","Roman Urdu":"Kya aap ka ghar ka pata badla hai?"},"type":"select one","children":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}],"name":"address_change"},{"control":{"appearance":"minimal"},"name":"province","default":"${provider_province}","bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"label":{"Urdu":"صوبہ","Roman Urdu":"Suba","English":"Province"},"instance":{"openmrs_entity":"person_address","openmrs_entity_id":"stateProvince","openmrs_entity_parent":"usual_residence"},"type":"select one","children":[{"name":"kpk","label":{"Urdu":"خیبر پختون خواہ","English":"Khyber Pakhtunkhwa","Roman Urdu":"Khyber Pakhtunkhwa"}},{"name":"sindh","label":{"Urdu":"سندھ","English":"Sindh","Roman Urdu":"Sindh"}},{"name":"balochistan","label":{"Urdu":"بلوچستان","English":"Balochistan","Roman Urdu":"Balochistan"}},{"name":"punjab","label":{"Urdu":"پنجاب","English":"Punjab","Roman Urdu":"Punjab"}},{"name":"gilgit_baltistan","label":{"Urdu":"گلگت بلتستان","English":"Gilgit Baltistan","Roman Urdu":"Gilgit Baltistan"}},{"name":"kashmir","label":{"Urdu":"کشمیر","English":"Kashmir","Roman Urdu":"Kashmir"}},{"name":"fata","label":{"Urdu":"فاٹا","English":"FATA","Roman Urdu":"FATA"}},{"name":"out_of_country","label":{"Urdu":"ملک سے باہر","English":"Out of Country","Roman Urdu":"Out of Country"}}]},{"control":{"appearance":"minimal"},"name":"city_village","choice_filter":"province=${province} or province='na'","default":"${provider_city}","bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"label":{"Urdu":"شہر","Roman Urdu":"Shehr","English":"City"},"itemset":"cities","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"cityVillage","openmrs_entity_parent":"usual_residence"},"type":"select one"},{"control":{"appearance":"minimal"},"name":"town","choice_filter":"(province=${province} and city=${city_village} ) or city='na'","bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"label":{"Urdu":"ٹاٰئون/ قصبہ/ بستی","Roman Urdu":"Town / Qasbah / Basti","English":"Town"},"itemset":"towns","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"town","openmrs_entity_parent":"usual_residence"},"type":"select one"},{"control":{"appearance":"minimal"},"name":"union_council","choice_filter":"(province=${province} and city=${city_village} and town=${town}) or town='na'","bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"label":{"Urdu":"یونین کونسل","Roman Urdu":"Union Council","English":"Union Council"},"itemset":"ucs","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"subTown","openmrs_entity_parent":"usual_residence"},"type":"select one"},{"bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"type":"text","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"house","openmrs_entity_parent":"usual_residence"},"name":"house_number","label":{"Urdu":"گھر کا نمبر","Roman Urdu":"Ghar ka number","English":"House Number"}},{"bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"type":"text","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"street","openmrs_entity_parent":"usual_residence"},"name":"street","label":{"Urdu":"گلی/کالونی/محلہ","Roman Urdu":"Gali/Colony/Mohalla","English":"Street"}},{"bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"type":"text","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"landmark","openmrs_entity_parent":"usual_residence"},"name":"landmark","label":{"Urdu":"گھر کے قریب کوئی مشہور جگہ","Roman Urdu":"Ghar ke qareeb koi mashoor jagah","English":"Land Mark"}},{"instance":{"openmrs_entity_id":"163277AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"geopoint","name":"center_gps","label":{"Urdu":"حاصل کردہ معلومات کی جگہ کے GPS کارڈینیٹس درج کریں","English":"Collect GPS coordinates of data entry location:","Roman Urdu":"Hasil karda malomaat ki jaga ke GPS coordinates darj karain"}},{"control":{"appearance":"minimal"},"bind":{"required":"yes"},"type":"note","name":"child_was_suffering_from_a_disease_at_birth_note","label":{"Urdu":"کیا بچہ پیدائش کے وقت کسی مرض میں مبتلا تھا؟ {existing_child_was_suffering_from_a_disease_at_birth}$","Roman Urdu":"Kya bacha pedaaish k waqt kissi marz mai mubtila tha? ${existing_child_was_suffering_from_a_disease_at_birth}","English":"Child was suffering from a disease at birth: ${existing_child_was_suffering_from_a_disease_at_birth}"}},{"instance":{"openmrs_entity_id":"163162AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"text","name":"aefi","label":{"Urdu":"حفاظتی ٹیکوں کے مضر اثرات","English":"The temporary side-effects of immunization shots","Roman Urdu":"Hifazati teekon ke muzr asraat"}},{"control":{"appearance":"minimal"},"name":"reminders_approval","bind":{"required":"yes"},"label":{"Urdu":"کیا آپ اپنے بچے کی اگلی ویکسین کی تاریخ کے لیے SMS موصول کرنا چاہتے ہیں؟ {existing_reminders_approval}$","English":"Are you willing to receive SMS reminders for your next visit? ${existing_reminders_approval}","Roman Urdu":"Kya aap apnay bachay ki agli vaccine ki tareekh ke liye SMS mausool karna chahtay hain? ${existing_reminders_approval}"},"instance":{"openmrs_entity_id":"163089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"select one","children":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}]},{"bind":{"jr:constraintMsg":{"Urdu":"فون نمبر گیارہ ہندسوں پر مشتمل اور مندرجہ ذیل شکل میں ہونا چاہئے: *********03","English":"Phone number should be 11 digits in the following format: 03*********","Roman Urdu":"Phone number 11 hindason par mushtamil aur mundarja zail shakal main hona chahiey: 03*********"},"relevant":"${existing_reminders_approval}='yes'","constraint":"regex(., '^03[0-9]{9}$')"},"type":"text","instance":{"openmrs_entity_id":"159635AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"name":"contact_phone_number","label":{"Urdu":"موبائل نمبر:{existing_contact_phone_number}$","English":"Mobile Number: ${existing_contact_phone_number}","Roman Urdu":"Mobile Number: ${existing_contact_phone_number}"}},{"bind":{"calculate":"${existing_client_birth_date} + 42"},"type":"calculate","name":"six_weeks"},{"bind":{"calculate":"${existing_client_birth_date} + 70"},"type":"calculate","name":"ten_weeks"},{"bind":{"calculate":"${existing_client_birth_date} + 98"},"type":"calculate","name":"forteen_weeks"},{"bind":{"calculate":"${existing_client_birth_date} + 245"},"type":"calculate","name":"nine_months"},{"bind":{"calculate":"${existing_client_birth_date} + 458"},"type":"calculate","name":"fifteen_months"},{"control":{"appearance":"minimal"},"name":"vaccines","choice_filter":"name != if( ${e_bcg} != '', 'bcg' , '') and \nname != if( ${e_opv0} != '', 'opv0' , '') and \nname != if( ${e_penta1} != '', 'penta1' , '') and \nname != if( ${e_penta2} != '', 'penta2' , '') and \nname != if( ${e_penta3} != '', 'penta3' , '') and \nname != if( ${e_opv1} != '', 'opv1' , '') and \nname != if( ${e_opv2} != '', 'opv2' , '') and \nname != if( ${e_opv3} != '', 'opv3' , '') and \nname != if( ${e_pcv1} != '', 'pcv1' , '') and \nname != if( ${e_pcv2} != '', 'pcv2' , '') and \nname != if( ${e_pcv3} != '', 'pcv3' , '') and \nname != if( ${e_ipv} != '', 'ipv' , '') and \nname != if( ${e_measles1} != '', 'measles1' , '') and \nname != if( ${e_measles2} != '', 'measles2' , '')","label":{"Urdu":"پچھلی تاریخ جب کسی اور سینٹر پر ٹیکے لگواِے گیے یا قطرے پلائے گئے","Roman Urdu":"Pichli tareekh jab kissi aur center par teekay lagwaye gaye ya katray pilaey gaye","English":"Retro vaccines"},"itemset":"vaccines","instance":{"openmrs_entity":"concept","openmrs_entity_id":"984AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1421AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"select all that apply"},{"type":"group","children":[{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'bcg')","constraint":".>= ${existing_client_birth_date} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"bcg_retro","label":{"Urdu":"بی سی جی","Roman Urdu":"BCG","English":"BCG"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'opv0')","constraint":".>= ${existing_client_birth_date} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv0_retro","label":{"Urdu":"او پی وی 0","Roman Urdu":"OPV 0","English":"OPV 0"}},{"bind":{"relevant":"selected(${vaccines}, 'opv0')","calculate":"0"},"type":"calculate","name":"opv0_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'pcv1')","constraint":".>= ${existing_client_birth_date} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pcv1_retro","label":{"Urdu":"پی سی وی 1","Roman Urdu":"PCV1","English":"PCV1"}},{"bind":{"relevant":"selected(${vaccines}, 'pcv1')","calculate":"1"},"type":"calculate","name":"pcv1_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'opv1')","constraint":".>= ${existing_client_birth_date} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv1_retro","label":{"Urdu":"او پی وی1","Roman Urdu":"OPV 1","English":"OPV 1"}},{"bind":{"relevant":"selected(${vaccines}, 'opv1')","calculate":"1"},"type":"calculate","name":"opv1_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'penta11')","constraint":".>= ${existing_client_birth_date} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"penta11_retro","label":{"Urdu":"پینٹا ویلنٹ 1","Roman Urdu":"Pentavalent 1","English":"Pentavalent 1"}},{"bind":{"relevant":"selected(${vaccines}, 'penta11')","calculate":"1"},"type":"calculate","name":"penta11_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'pcv2')","constraint":".>= ${existing_client_birth_date} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pcv2_retro","label":{"Urdu":"پی سی وی 2","Roman Urdu":"PCV2","English":"PCV2"}},{"bind":{"relevant":"selected(${vaccines}, 'pcv2')","calculate":"2"},"type":"calculate","name":"pcv2_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'opv2')","constraint":".>= ${existing_client_birth_date} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv2_retro","label":{"Urdu":"او پی وی 2","Roman Urdu":"OPV 2","English":"OPV 2"}},{"bind":{"relevant":"selected(${vaccines}, 'opv2')","calculate":"2"},"type":"calculate","name":"opv2_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'penta12')","constraint":".>= ${existing_client_birth_date} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"penta12_retro","label":{"Urdu":"پینٹا ویلنٹ 2","Roman Urdu":"Pentavalent 2","English":"Pentavalent 2"}},{"bind":{"relevant":"selected(${vaccines}, 'penta12')","calculate":"2"},"type":"calculate","name":"penta12_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'pcv3')","constraint":".>= ${existing_client_birth_date} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pcv3_retro","label":{"Urdu":"پی سی وی 3","Roman Urdu":"PCV3","English":"PCV3"}},{"bind":{"relevant":"selected(${vaccines}, 'penta12')","calculate":"3"},"type":"calculate","name":"pcv3_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'opv3')","constraint":".>= ${existing_client_birth_date} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"opv3_retro","label":{"Urdu":"او پی وی3","Roman Urdu":"OPV 3","English":"OPV 3"}},{"bind":{"relevant":"selected(${vaccines}, 'opv3')","calculate":"3"},"type":"calculate","name":"opv3_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'penta13')","constraint":".>= ${existing_client_birth_date} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"penta13_retro","label":{"Urdu":"پینٹا ویلنٹ 3","Roman Urdu":"Pentavalent 3","English":"Pentavalent 3"}},{"bind":{"relevant":"selected(${vaccines}, 'penta13')","calculate":"3"},"type":"calculate","name":"penta13_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'ipv')","constraint":".>= ${existing_client_birth_date} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1422AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"ipv_retro","label":{"Urdu":"آئی پی وی","Roman Urdu":"IPV","English":"IPV"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'measles1')","constraint":".>= ${existing_client_birth_date} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"measles1_retro","label":{"Urdu":"خسرہ 1","Roman Urdu":"Measles 1","English":"Measles 1"}},{"bind":{"relevant":"selected(${vaccines}, 'measles1')","calculate":"1"},"type":"calculate","name":"measles1_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"jr:constraintMsg":{"Urdu":"حفاظتی ٹیکا ملنے کی تاریخ، بچے کی تاریخ پیدائش کے بعد اور آج کی تاریخ سے پہلے کی ہونی چاہیے","English":"The date of vaccination must be greater than the child's birthdate and less than today.","Roman Urdu":"Hifaazati teeka milnay ki tareekh, bachay ki tareekh-e-pedaaish ke baad aur aaj ki tareekh se phlay ki honi chahiye."},"relevant":"selected(${vaccines}, 'measles2')","constraint":".>= ${existing_client_birth_date} and .<=${today}"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"measles2_retro","label":{"Urdu":"خسرہ 2","Roman Urdu":"Measles2","English":"Measles2"}},{"bind":{"relevant":"selected(${vaccines}, 'measles2')","calculate":"2"},"type":"calculate","name":"measles2_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}}],"name":"vaccines_group"},{"control":{"appearance":"minimal"},"name":"vaccines_2","choice_filter":"name != if( ${e_bcg} != '', 'bcg' , '') and \nname != if( ${e_opv0} != '', 'opv0' , '') and \nname != if( ${e_penta2} != '', 'penta2' , '') and \nname != if( ${e_penta1} != '', 'penta1' , '') and \nname != if( ${e_penta3} != '', 'penta3' , '') and \nname != if( ${e_opv1} != '', 'opv1' , '') and \nname != if( ${e_opv2} != '', 'opv2' , '') and \nname != if( ${e_opv3} != '', 'opv3' , '') and \nname != if( ${e_pcv1} != '', 'pcv1' , '') and \nname != if( ${e_pcv2} != '', 'pcv2' , '') and \nname != if( ${e_pcv3} != '', 'pcv3' , '') and \nname != if( ${e_measles1} != '', 'measles1' , '') and \nname != if( ${e_measles2} != '', 'measles2' , '') and \nname != if(selected(${vaccines}, 'bcg'), 'bcg', '') and \nname != if(selected(${vaccines}, 'opv0'), 'opv0', '') and \nname != if(selected(${vaccines}, 'penta1'), 'penta1', '') and \nname != if(selected(${vaccines}, 'opv1'), 'opv1', '') and \nname != if(selected(${vaccines}, 'pcv1'), 'pcv1', '') and \nname != if(selected(${vaccines}, 'penta2'), 'penta2', '') and \nname != if(selected(${vaccines}, 'opv2'), 'opv2', '') and \nname != if(selected(${vaccines}, 'pcv2'), 'pcv2', '') and \nname != if(selected(${vaccines}, 'penta3'), 'penta3', '') and \nname != if(selected(${vaccines}, 'opv3'), 'opv3', '') and \nname != if(selected(${vaccines}, 'ipv'), 'ipv', '') and \nname != if(selected(${vaccines}, 'measles1'), 'measles1', '') and \nname != if(selected(${vaccines}, 'measles2'), 'measles2', '')","bind":{"required":"yes","constraint":"if(selected(${vaccines_2}, 'bcg') or selected(${vaccines_2}, 'opv0') , .>= ${existing_client_birth_date} and .<=${today}, if(selected(${vaccines_2}, 'opv1') or selected(${vaccines_2}, 'penta11'), .>= ${six_weeks} and .<=${today}, if(selected(${vaccines_2}, 'opv2') or selected(${vaccines_2}, 'penta12'), .>=${ten_weeks} and .<=${today}, if(selected(${vaccines_2}, 'opv3') or selected(${vaccines_2}, 'penta13'), .>=${forteen_weeks} and .<=${today}, if(selected(${vaccines_2}, 'measles1'), .>=${nine_months} and .<=${today}, if(selected(${vaccines_2}, 'measles2'), .>= ${fifteen_months} and .<=${today}))))))"},"label":{"Urdu":"آج کون کون سی ویکسین دی گئی ہیں؟","Roman Urdu":"Aaj kon kon si vaccine di gai hain?","English":"Vaccines administered"},"itemset":"vaccines","instance":{"openmrs_entity":"concept","openmrs_entity_id":"984AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1441AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"select all that apply"},{"name":"vaccination_date","default":"${today}","bind":{"required":"yes","constraint":"if(selected(${vaccines_2}, 'bcg') or selected(${vaccines_2}, 'opv0') , .>= ${existing_client_birth_date} and .<=${today}, if(selected(${vaccines_2}, 'opv1') or selected(${vaccines_2}, 'penta11'), .>= ${six_weeks} and .<=${today}, if(selected(${vaccines_2}, 'opv2') or selected(${vaccines_2}, 'penta12'), .>=${ten_weeks} and .<=${today}, if(selected(${vaccines_2}, 'opv3') or selected(${vaccines_2}, 'penta13'), .>=${forteen_weeks} and .<=${today}, if(selected(${vaccines_2}, 'measles1'), .>=${nine_months} and .<=${today}, if(selected(${vaccines_2}, 'measles2'), .>= ${fifteen_months} and .<=${today}))))))"},"label":{"Urdu":"تاریخ","English":"Vaccination date","Roman Urdu":"Tareekh"},"instance":{"openmrs_entity_id":"encounter_date","openmrs_entity":"encounter"},"type":"date"},{"bind":{"calculate":"if(selected(${vaccines_2}, 'bcg'),${vaccination_date},'')"},"type":"calculate","name":"bcg","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'opv0'),${vaccination_date},'')"},"type":"calculate","name":"opv0","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'opv0')","calculate":"0"},"type":"calculate","name":"opv0_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'pcv1'),${vaccination_date},'')"},"type":"calculate","name":"pcv1","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'pcv1')","calculate":"1"},"type":"calculate","name":"pcv1_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'opv1'),${vaccination_date},'')"},"type":"calculate","name":"opv1","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'opv1')","calculate":"1"},"type":"calculate","name":"opv1_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'penta11'),${vaccination_date},'')"},"type":"calculate","name":"penta11","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'penta11')","calculate":"1"},"type":"calculate","name":"penta11_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'pcv2'),${vaccination_date},'')"},"type":"calculate","name":"pcv2","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'pcv2')","calculate":"2"},"type":"calculate","name":"pcv2_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'opv2'),${vaccination_date},'')"},"type":"calculate","name":"opv2","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'opv2')","calculate":"2"},"type":"calculate","name":"opv2_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'penta12'),${vaccination_date},'')"},"type":"calculate","name":"penta12","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'penta12')","calculate":"2"},"type":"calculate","name":"penta12_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'pcv3'),${vaccination_date},'')"},"type":"calculate","name":"pcv3","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'pcv3')","calculate":"3"},"type":"calculate","name":"pcv3_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'opv3'),${vaccination_date},'')"},"type":"calculate","name":"opv3","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'opv3')","calculate":"3"},"type":"calculate","name":"opv3_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'penta13'),${vaccination_date},'')"},"type":"calculate","name":"penta13","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'penta13')","calculate":"3"},"type":"calculate","name":"penta13_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines}, 'ipv')","calculate":"if(selected(${vaccines_2}, 'ipv'),${vaccination_date},'')"},"type":"calculate","name":"ipv","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1422AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'measles1'),${vaccination_date},'')"},"type":"calculate","name":"measles1","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'measles1')","calculate":"1"},"type":"calculate","name":"measles1_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'measles2'),${vaccination_date},'')"},"type":"calculate","name":"measles2","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2}, 'measles2')","calculate":"2"},"type":"calculate","name":"measles2_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"control":{"bodyless":true},"type":"group","children":[{"bind":{"readonly":"true()","calculate":"concat('uuid:', uuid())"},"type":"calculate","name":"instanceID"}],"name":"meta"}]} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/offsite_child_followup/form.xml b/opensrp-core/src/test/resources/form/offsite_child_followup/form.xml deleted file mode 100644 index 2042695a14..0000000000 --- a/opensrp-core/src/test/resources/form/offsite_child_followup/form.xml +++ /dev/null @@ -1,1560 +0,0 @@ -
- - -

دوسرے سینٹر میں رجسٹرڈ بچّوں کا فالو اپ رجسٹر برائے ٹیکاجات - Off Site Child Follow Up Vaccination Register

-
-
- - کیا آپ کا گھر کا پتہ بدلا ہے؟ - Has your home address changed? - - Kya aap ka ghar ka pata badla hai? -
- - -
-
-
- - - - - - - - - - - - - -
- - -
diff --git a/opensrp-core/src/test/resources/form/offsite_child_followup/form_definition.json b/opensrp-core/src/test/resources/form/offsite_child_followup/form_definition.json deleted file mode 100644 index 04a8d9a538..0000000000 --- a/opensrp-core/src/test/resources/form/offsite_child_followup/form_definition.json +++ /dev/null @@ -1,466 +0,0 @@ -{ - "form_data_definition_version" : "1", - "form" : { - "bind_type" : "pkchild", - "default_bind_path" : "/model/instance/Offsite_Child_Vaccination_Followup/", - "fields" : [ { - "name" : "id", - "shouldLoadValue" : true - }, { - "name" : "provider_uc", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/provider_uc", - "shouldLoadValue" : true - }, { - "name" : "provider_town", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/provider_town", - "shouldLoadValue" : true - }, { - "name" : "provider_city", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/provider_city", - "shouldLoadValue" : true - }, { - "name" : "provider_province", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/provider_province", - "shouldLoadValue" : true - }, { - "name" : "existing_first_name", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_first_name", - "shouldLoadValue" : true - }, { - "name" : "existing_last_name", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_last_name", - "shouldLoadValue" : true - }, { - "name" : "existing_mother_name", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_mother_name", - "shouldLoadValue" : true - }, { - "name" : "existing_gender", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_gender", - "shouldLoadValue" : true - }, { - "name" : "existing_birth_date", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_client_birth_date", - "shouldLoadValue" : true - }, { - "name" : "existing_client_reg_date", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_client_reg_date", - "shouldLoadValue" : true - }, { - "name" : "existing_landmark", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_landmark", - "shouldLoadValue" : true - }, { - "name" : "existing_house_number", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_house_number", - "shouldLoadValue" : true - }, { - "name" : "existing_street", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_street", - "shouldLoadValue" : true - }, { - "name" : "existing_union_council", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_union_council", - "shouldLoadValue" : true - }, { - "name" : "existing_town", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_town", - "shouldLoadValue" : true - }, { - "name" : "existing_city_village", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_city_village", - "shouldLoadValue" : true - }, { - "name" : "existing_province", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_province", - "shouldLoadValue" : true - }, { - "name" : "existing_union_councilname", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_union_councilname", - "shouldLoadValue" : true - }, { - "name" : "existing_townname", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_townname", - "shouldLoadValue" : true - }, { - "name" : "existing_city_villagename", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_city_villagename", - "shouldLoadValue" : true - }, { - "name" : "existing_provincename", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_provincename", - "shouldLoadValue" : true - }, { - "name" : "existing_ethnicity", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_ethnicity", - "shouldLoadValue" : true - }, { - "name" : "existing_program_client_id", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_program_client_id", - "shouldLoadValue" : true - }, { - "name" : "existing_epi_card_number", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_epi_card_number", - "shouldLoadValue" : true - }, { - "name" : "existing_child_was_suffering_from_a_disease_at_birth", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_child_was_suffering_from_a_disease_at_birth", - "shouldLoadValue" : true - }, { - "name" : "existing_reminders_approval", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_reminders_approval", - "shouldLoadValue" : true - }, { - "name" : "existing_contact_phone_number", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_contact_phone_number", - "shouldLoadValue" : true - }, { - "name" : "e_bcg", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/e_bcg", - "shouldLoadValue" : true - }, { - "name" : "e_opv0", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/e_opv0", - "shouldLoadValue" : true - }, { - "name" : "e_penta2", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/e_penta2", - "shouldLoadValue" : true - }, { - "name" : "e_penta1", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/e_penta1", - "shouldLoadValue" : true - }, { - "name" : "e_penta3", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/e_penta3", - "shouldLoadValue" : true - }, { - "name" : "e_opv1", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/e_opv1", - "shouldLoadValue" : true - }, { - "name" : "e_opv2", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/e_opv2", - "shouldLoadValue" : true - }, { - "name" : "e_opv3", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/e_opv3", - "shouldLoadValue" : true - }, { - "name" : "e_pcv1", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/e_pcv1", - "shouldLoadValue" : true - }, { - "name" : "e_pcv2", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/e_pcv2", - "shouldLoadValue" : true - }, { - "name" : "e_pcv3", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/e_pcv3", - "shouldLoadValue" : true - }, { - "name" : "e_measles1", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/e_measles1", - "shouldLoadValue" : true - }, { - "name" : "e_measles2", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/e_measles2", - "shouldLoadValue" : true - }, { - "name" : "e_ipv", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/e_ipv", - "shouldLoadValue" : true - }, { - "name" : "provider_id", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/provider_id", - "shouldLoadValue" : true - }, { - "name" : "provider_location_id", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/provider_location_id", - "shouldLoadValue" : true - }, { - "name" : "provider_location_name", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/provider_location_name", - "shouldLoadValue" : true - }, { - "name" : "provider_location_note", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/provider_location_note" - }, { - "name" : "start", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/start" - }, { - "name" : "end", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/end" - }, { - "name" : "today", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/today" - }, { - "name" : "deviceid", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/deviceid" - }, { - "name" : "subscriberid", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/subscriberid" - }, { - "name" : "simserial", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/simserial" - }, { - "name" : "phonenumber", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/phonenumber" - }, { - "name" : "existing_client_reg_date_note", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/existing_client_reg_date_note" - }, { - "name" : "program_client_id_note", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/program_client_id_note" - }, { - "name" : "epi_card_number", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/epi_card_number" - }, { - "name" : "first_name_note", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/first_name_note" - }, { - "name" : "last_name_note", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/last_name_note" - }, { - "name" : "child_age", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/child_age" - }, { - "name" : "calc_dob_note", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/calc_dob_note" - }, { - "name" : "gender_note", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/gender_note" - }, { - "name" : "mother_name_note", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/mother_name_note" - }, { - "name" : "exisiting_ethnicity_note", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/exisiting_ethnicity_note" - }, { - "name" : "address", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/address" - }, { - "name" : "address_change", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/address_change" - }, { - "name" : "province", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/province" - }, { - "name" : "city_village", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/city_village" - }, { - "name" : "town", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/town" - }, { - "name" : "union_council", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/union_council" - }, { - "name" : "house_number", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/house_number" - }, { - "name" : "street", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/street" - }, { - "name" : "landmark", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/landmark" - }, { - "name" : "center_gps", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/center_gps" - }, { - "name" : "child_was_suffering_from_a_disease_at_birth_note", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/child_was_suffering_from_a_disease_at_birth_note" - }, { - "name" : "aefi", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/aefi" - }, { - "name" : "reminders_approval", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/reminders_approval" - }, { - "name" : "contact_phone_number", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/contact_phone_number" - }, { - "name" : "six_weeks", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/six_weeks" - }, { - "name" : "ten_weeks", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/ten_weeks" - }, { - "name" : "forteen_weeks", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/forteen_weeks" - }, { - "name" : "nine_months", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/nine_months" - }, { - "name" : "fifteen_months", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/fifteen_months" - }, { - "name" : "vaccines", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines" - }, { - "name" : "bcg_retro", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/bcg_retro" - }, { - "name" : "opv0_retro", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/opv0_retro" - }, { - "name" : "opv0_dose", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/opv0_dose" - }, { - "name" : "pcv1_retro", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/pcv1_retro" - }, { - "name" : "pcv1_dose", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/pcv1_dose" - }, { - "name" : "opv1_retro", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/opv1_retro" - }, { - "name" : "opv1_dose", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/opv1_dose" - }, { - "name" : "penta11_retro", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/penta11_retro" - }, { - "name" : "penta11_dose", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/penta11_dose" - }, { - "name" : "pcv2_retro", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/pcv2_retro" - }, { - "name" : "pcv2_dose", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/pcv2_dose" - }, { - "name" : "opv2_retro", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/opv2_retro" - }, { - "name" : "opv2_dose", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/opv2_dose" - }, { - "name" : "penta12_retro", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/penta12_retro" - }, { - "name" : "penta12_dose", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/penta12_dose" - }, { - "name" : "pcv3_retro", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/pcv3_retro" - }, { - "name" : "pcv3_dose", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/pcv3_dose" - }, { - "name" : "opv3_retro", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/opv3_retro" - }, { - "name" : "opv3_dose", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/opv3_dose" - }, { - "name" : "penta13_retro", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/penta13_retro" - }, { - "name" : "penta13_dose", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/penta13_dose" - }, { - "name" : "ipv_retro", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/ipv_retro" - }, { - "name" : "measles1_retro", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/measles1_retro" - }, { - "name" : "measles1_dose", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/measles1_dose" - }, { - "name" : "measles2_retro", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/measles2_retro" - }, { - "name" : "measles2_dose", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_group/measles2_dose" - }, { - "name" : "vaccines_2", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccines_2" - }, { - "name" : "vaccination_date", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/vaccination_date" - }, { - "name" : "bcg", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/bcg" - }, { - "name" : "opv0", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/opv0" - }, { - "name" : "opv0_dose_today", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/opv0_dose_today" - }, { - "name" : "pcv1", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/pcv1" - }, { - "name" : "pcv1_dose_today", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/pcv1_dose_today" - }, { - "name" : "opv1", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/opv1" - }, { - "name" : "opv1_dose_today", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/opv1_dose_today" - }, { - "name" : "penta11", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/penta11" - }, { - "name" : "penta11_dose_today", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/penta11_dose_today" - }, { - "name" : "pcv2", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/pcv2" - }, { - "name" : "pcv2_dose_today", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/pcv2_dose_today" - }, { - "name" : "opv2", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/opv2" - }, { - "name" : "opv2_dose_today", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/opv2_dose_today" - }, { - "name" : "penta12", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/penta12" - }, { - "name" : "penta12_dose_today", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/penta12_dose_today" - }, { - "name" : "pcv3", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/pcv3" - }, { - "name" : "pcv3_dose_today", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/pcv3_dose_today" - }, { - "name" : "opv3", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/opv3" - }, { - "name" : "opv3_dose_today", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/opv3_dose_today" - }, { - "name" : "penta13", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/penta13" - }, { - "name" : "penta13_dose_today", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/penta13_dose_today" - }, { - "name" : "ipv", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/ipv" - }, { - "name" : "measles1", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/measles1" - }, { - "name" : "measles1_dose_today", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/measles1_dose_today" - }, { - "name" : "measles2", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/measles2" - }, { - "name" : "measles2_dose_today", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/measles2_dose_today" - }, { - "name" : "instanceID", - "bind" : "/model/instance/Offsite_Child_Vaccination_Followup/meta/instanceID" - } ] - } -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/offsite_child_followup/model.xml b/opensrp-core/src/test/resources/form/offsite_child_followup/model.xml deleted file mode 100644 index 93436952d8..0000000000 --- a/opensrp-core/src/test/resources/form/offsite_child_followup/model.xml +++ /dev/null @@ -1,1685 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - ${provider_province} - ${provider_city} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${today} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - static_instance-provinces-0 - kpk - - - static_instance-provinces-1 - sindh - - - static_instance-provinces-2 - balochistan - - - static_instance-provinces-3 - punjab - - - static_instance-provinces-4 - gilgit_baltistan - - - static_instance-provinces-5 - kashmir - - - static_instance-provinces-6 - fata - - - static_instance-provinces-7 - out_of_country - - - - - - - static_instance-ucs-0 - sindh - karachi - korangi - bilal_colony - - - static_instance-ucs-1 - sindh - karachi - korangi - nasir_colony - - - static_instance-ucs-2 - sindh - karachi - korangi - chakra_goth - - - static_instance-ucs-3 - sindh - karachi - korangi - mustafa_taj_colony - - - static_instance-ucs-4 - sindh - karachi - korangi - hundred_quarters - - - static_instance-ucs-5 - sindh - karachi - korangi - gulzar_colony - - - static_instance-ucs-6 - sindh - karachi - korangi - korangi_sector_33 - - - static_instance-ucs-7 - sindh - karachi - korangi - zaman_town - - - static_instance-ucs-8 - sindh - karachi - korangi - hasrat_mohani_colony - - - static_instance-ucs-9 - sindh - karachi - baldia - gulshan_e_ghazi - - - static_instance-ucs-10 - sindh - karachi - baldia - ittehad_town - - - static_instance-ucs-11 - sindh - karachi - baldia - islam_nagar - - - static_instance-ucs-12 - sindh - karachi - baldia - nai_abadi - - - static_instance-ucs-13 - sindh - karachi - baldia - saeedabad - - - static_instance-ucs-14 - sindh - karachi - baldia - muslim_mujahid_colony - - - static_instance-ucs-15 - sindh - karachi - baldia - muhajir_camp - - - static_instance-ucs-16 - sindh - karachi - baldia - rasheedabad - - - static_instance-ucs-17 - sindh - karachi - bin_qasim - ibrahim_hyderi - - - static_instance-ucs-18 - sindh - karachi - bin_qasim - rehri - - - static_instance-ucs-19 - sindh - karachi - bin_qasim - cattle_colony - - - static_instance-ucs-20 - sindh - karachi - bin_qasim - qaidabad - - - static_instance-ucs-21 - sindh - karachi - bin_qasim - landhi_colony - - - static_instance-ucs-22 - sindh - karachi - bin_qasim - gulshan_e_hadeed - - - static_instance-ucs-23 - sindh - karachi - bin_qasim - gaghar - - - static_instance-ucs-24 - sindh - karachi - gadap - murad_memon_goth - - - static_instance-ucs-25 - sindh - karachi - gadap - darsano_chana - - - static_instance-ucs-26 - sindh - karachi - gadap - gujro - - - static_instance-ucs-27 - sindh - karachi - gadap - songal - - - static_instance-ucs-28 - sindh - karachi - gadap - maymarabad - - - static_instance-ucs-29 - sindh - karachi - gadap - yousuf_goth - - - static_instance-ucs-30 - sindh - karachi - gadap - manghopir - - - static_instance-ucs-31 - sindh - karachi - gulberg - azizabad - - - static_instance-ucs-32 - sindh - karachi - gulberg - karimabad - - - static_instance-ucs-33 - sindh - karachi - gulberg - aisha_manzil - - - static_instance-ucs-34 - sindh - karachi - gulberg - ancholi - - - static_instance-ucs-35 - sindh - karachi - gulberg - naseerabad - - - static_instance-ucs-36 - sindh - karachi - gulberg - yaseenabad - - - static_instance-ucs-37 - sindh - karachi - gulberg - water_pump - - - static_instance-ucs-38 - sindh - karachi - gulberg - shafiq_mill_colony - - - static_instance-ucs-39 - sindh - karachi - gulshan - delhi_mercantile_society - - - static_instance-ucs-40 - sindh - karachi - gulshan - civic_centre - - - static_instance-ucs-41 - sindh - karachi - gulshan - pir_ilahi_buksh_colony - - - static_instance-ucs-42 - sindh - karachi - gulshan - essa_nagri - - - static_instance-ucs-43 - sindh - karachi - gulshan - gulshan_e_iqbal - - - static_instance-ucs-44 - sindh - karachi - gulshan - gillani_railway_station - - - static_instance-ucs-45 - sindh - karachi - gulshan - shanti_nagar - - - static_instance-ucs-46 - sindh - karachi - gulshan - jamali_colony - - - static_instance-ucs-47 - sindh - karachi - gulshan - gulshan_e_iqbal_ii - - - static_instance-ucs-48 - sindh - karachi - gulshan - pehlwan_goth - - - static_instance-ucs-49 - sindh - karachi - gulshan - matrovil_colony - - - static_instance-ucs-50 - sindh - karachi - gulshan - gulzar_e_hijri - - - static_instance-ucs-51 - sindh - karachi - gulshan - safooran_goth - - - static_instance-ucs-52 - sindh - karachi - jamshed - akhtar_colony - - - static_instance-ucs-53 - sindh - karachi - jamshed - manzoor_colony - - - static_instance-ucs-54 - sindh - karachi - jamshed - azam_basti - - - static_instance-ucs-55 - sindh - karachi - jamshed - chanesar_goth - - - static_instance-ucs-56 - sindh - karachi - jamshed - mahmudabad - - - static_instance-ucs-57 - sindh - karachi - jamshed - pechs - - - static_instance-ucs-58 - sindh - karachi - jamshed - pechs_ii - - - static_instance-ucs-59 - sindh - karachi - jamshed - jut_line - - - static_instance-ucs-60 - sindh - karachi - jamshed - central_jacob_lines - - - static_instance-ucs-61 - sindh - karachi - jamshed - jamshed_quarters - - - static_instance-ucs-62 - sindh - karachi - jamshed - garden_east - - - static_instance-ucs-63 - sindh - karachi - jamshed - soldier_bazar - - - static_instance-ucs-64 - sindh - karachi - jamshed - pakistan_quarters - - - static_instance-ucs-65 - sindh - karachi - kiamari - bhutta_village - - - static_instance-ucs-66 - sindh - karachi - kiamari - sultanabad - - - static_instance-ucs-67 - sindh - karachi - kiamari - kiamari_uc - - - static_instance-ucs-68 - sindh - karachi - kiamari - baba_bhit - - - static_instance-ucs-69 - sindh - karachi - kiamari - machar_colony - - - static_instance-ucs-70 - sindh - karachi - kiamari - maripur - - - static_instance-ucs-71 - sindh - karachi - kiamari - shershah - - - static_instance-ucs-72 - sindh - karachi - kiamari - gabo_pat - - - static_instance-ucs-73 - sindh - karachi - landhi - muzafarabad - - - static_instance-ucs-74 - sindh - karachi - landhi - muslimabad - - - static_instance-ucs-75 - sindh - karachi - landhi - dawood_chowrangi - - - static_instance-ucs-76 - sindh - karachi - landhi - moinabad - - - static_instance-ucs-77 - sindh - karachi - landhi - sharafi_goth - - - static_instance-ucs-78 - sindh - karachi - landhi - bhutto_nagar - - - static_instance-ucs-79 - sindh - karachi - landhi - khawaja_ajmeer_colony - - - static_instance-ucs-80 - sindh - karachi - landhi - landhi_uc - - - static_instance-ucs-81 - sindh - karachi - landhi - awami_colony - - - static_instance-ucs-82 - sindh - karachi - landhi - burmee_colony - - - static_instance-ucs-83 - sindh - karachi - landhi - korangi_uc - - - static_instance-ucs-84 - sindh - karachi - landhi - sherabad - - - static_instance-ucs-85 - sindh - karachi - liaquatabad - rizvia_society - - - static_instance-ucs-86 - sindh - karachi - liaquatabad - firdous_colony - - - static_instance-ucs-87 - sindh - karachi - liaquatabad - super_market - - - static_instance-ucs-88 - sindh - karachi - liaquatabad - dak_khana - - - static_instance-ucs-89 - sindh - karachi - liaquatabad - qasimabad - - - static_instance-ucs-90 - sindh - karachi - liaquatabad - bandhani_colony - - - static_instance-ucs-91 - sindh - karachi - liaquatabad - sharifabad - - - static_instance-ucs-92 - sindh - karachi - liaquatabad - commercial_area - - - static_instance-ucs-93 - sindh - karachi - liaquatabad - mujahid_colony - - - static_instance-ucs-94 - sindh - karachi - liaquatabad - nazimabad - - - static_instance-ucs-95 - sindh - karachi - liaquatabad - abbasi_shaheed - - - static_instance-ucs-96 - sindh - karachi - lyari - agra_taj_colony - - - static_instance-ucs-97 - sindh - karachi - lyari - daryaabad - - - static_instance-ucs-98 - sindh - karachi - lyari - nawabad - - - static_instance-ucs-99 - sindh - karachi - lyari - khada_memon_society - - - static_instance-ucs-100 - sindh - karachi - lyari - baghdadi - - - static_instance-ucs-101 - sindh - karachi - lyari - shah_baig_line - - - static_instance-ucs-102 - sindh - karachi - lyari - bihar_colony - - - static_instance-ucs-103 - sindh - karachi - lyari - ragiwara - - - static_instance-ucs-104 - sindh - karachi - lyari - singo_line - - - static_instance-ucs-105 - sindh - karachi - lyari - chakiwara - - - static_instance-ucs-106 - sindh - karachi - lyari - allama_iqbal_colony - - - static_instance-ucs-107 - sindh - karachi - malir - model_colony - - - static_instance-ucs-108 - sindh - karachi - malir - kala_board - - - static_instance-ucs-109 - sindh - karachi - malir - saudabad - - - static_instance-ucs-110 - sindh - karachi - malir - khokhra_par - - - static_instance-ucs-111 - sindh - karachi - malir - jafar_e_tayyar - - - static_instance-ucs-112 - sindh - karachi - malir - gharibabad - - - static_instance-ucs-113 - sindh - karachi - malir - ghazi_brohi_goth - - - static_instance-ucs-114 - sindh - karachi - new_karachi - kalyana - - - static_instance-ucs-115 - sindh - karachi - new_karachi - sir_syed_colony - - - static_instance-ucs-116 - sindh - karachi - new_karachi - fatima_jinnah_colony - - - static_instance-ucs-117 - sindh - karachi - new_karachi - godhra - - - static_instance-ucs-118 - sindh - karachi - new_karachi - abu_zar_ghaffari - - - static_instance-ucs-119 - sindh - karachi - new_karachi - hakim_ahsan - - - static_instance-ucs-120 - sindh - karachi - new_karachi - madina_colony - - - static_instance-ucs-121 - sindh - karachi - new_karachi - faisal_colony - - - static_instance-ucs-122 - sindh - karachi - new_karachi - khamiso_goth - - - static_instance-ucs-123 - sindh - karachi - new_karachi - mustufa_colony - - - static_instance-ucs-124 - sindh - karachi - new_karachi - khawaja_ajmeer_nagri - - - static_instance-ucs-125 - sindh - karachi - new_karachi - gulshan_e_saeed - - - static_instance-ucs-126 - sindh - karachi - new_karachi - shah_nawaz_bhutto_colony - - - static_instance-ucs-127 - sindh - karachi - north_nazimabad - paposh_nagar - - - static_instance-ucs-128 - sindh - karachi - north_nazimabad - pahar_ganj - - - static_instance-ucs-129 - sindh - karachi - north_nazimabad - khandu_goth - - - static_instance-ucs-130 - sindh - karachi - north_nazimabad - hyderi - - - static_instance-ucs-131 - sindh - karachi - north_nazimabad - sakhi_hassan - - - static_instance-ucs-132 - sindh - karachi - north_nazimabad - farooq_e_azam - - - static_instance-ucs-133 - sindh - karachi - north_nazimabad - nusrat_bhutto_colony - - - static_instance-ucs-134 - sindh - karachi - north_nazimabad - shadman_town - - - static_instance-ucs-135 - sindh - karachi - north_nazimabad - buffer_zone - - - static_instance-ucs-136 - sindh - karachi - north_nazimabad - buffer_zone_ii - - - static_instance-ucs-137 - sindh - karachi - orangi - mominabad - - - static_instance-ucs-138 - sindh - karachi - orangi - haryana_colony - - - static_instance-ucs-139 - sindh - karachi - orangi - hanifabad - - - static_instance-ucs-140 - sindh - karachi - orangi - mohammad_nagar - - - static_instance-ucs-141 - sindh - karachi - orangi - madina_colony_orangi - - - static_instance-ucs-142 - sindh - karachi - orangi - ghaziabad - - - static_instance-ucs-143 - sindh - karachi - orangi - chisti_nagar - - - static_instance-ucs-144 - sindh - karachi - orangi - bilal_colony_orangi - - - static_instance-ucs-145 - sindh - karachi - orangi - iqbal_baloch_colony - - - static_instance-ucs-146 - sindh - karachi - orangi - ghabool_town - - - static_instance-ucs-147 - sindh - karachi - orangi - data_nagar - - - static_instance-ucs-148 - sindh - karachi - orangi - mujahidabad - - - static_instance-ucs-149 - sindh - karachi - orangi - baloch_goth - - - static_instance-ucs-150 - sindh - karachi - saddar - old_haji_camp - - - static_instance-ucs-151 - sindh - karachi - saddar - garden - - - static_instance-ucs-152 - sindh - karachi - saddar - kharadar - - - static_instance-ucs-153 - sindh - karachi - saddar - city_railway_colony - - - static_instance-ucs-154 - sindh - karachi - saddar - nanak_wara - - - static_instance-ucs-155 - sindh - karachi - saddar - gazdarabad - - - static_instance-ucs-156 - sindh - karachi - saddar - millat_nagar_islam_pura - - - static_instance-ucs-157 - sindh - karachi - saddar - saddar_uc - - - static_instance-ucs-158 - sindh - karachi - saddar - civil_line - - - static_instance-ucs-159 - sindh - karachi - saddar - clifton - - - static_instance-ucs-160 - sindh - karachi - saddar - kehkashan - - - static_instance-ucs-161 - sindh - karachi - shah_faisal - natha_khan_goth - - - static_instance-ucs-162 - sindh - karachi - shah_faisal - pak_sadat_colony - - - static_instance-ucs-163 - sindh - karachi - shah_faisal - drigh_colony - - - static_instance-ucs-164 - sindh - karachi - shah_faisal - raita_plot - - - static_instance-ucs-165 - sindh - karachi - shah_faisal - moria_khan_goth - - - static_instance-ucs-166 - sindh - karachi - shah_faisal - rafa_e_aam_society - - - static_instance-ucs-167 - sindh - karachi - shah_faisal - al_falah_society - - - static_instance-ucs-168 - sindh - karachi - site - pak_colony - - - static_instance-ucs-169 - sindh - karachi - site - old_golimar - - - static_instance-ucs-170 - sindh - karachi - site - jahanabad - - - static_instance-ucs-171 - sindh - karachi - site - metrovil - - - static_instance-ucs-172 - sindh - karachi - site - bhawani_chali - - - static_instance-ucs-173 - sindh - karachi - site - frontier_colony - - - static_instance-ucs-174 - sindh - karachi - site - banaras_colony - - - static_instance-ucs-175 - sindh - karachi - site - qasba_colony - - - static_instance-ucs-176 - sindh - karachi - site - islamia_colony - - - static_instance-ucs-177 - na - na - na - other - - - static_instance-ucs-178 - na - na - na - not_applicable - - - - - - - static_instance-gender-0 - male - - - static_instance-gender-1 - female - - - static_instance-gender-2 - transgender - - - - - - - static_instance-vaccines-0 - bcg - - - static_instance-vaccines-1 - opv0 - - - static_instance-vaccines-2 - pcv1 - - - static_instance-vaccines-3 - opv1 - - - static_instance-vaccines-4 - penta11 - - - static_instance-vaccines-5 - pcv2 - - - static_instance-vaccines-6 - opv2 - - - static_instance-vaccines-7 - penta12 - - - static_instance-vaccines-8 - pcv3 - - - static_instance-vaccines-9 - opv3 - - - static_instance-vaccines-10 - penta13 - - - static_instance-vaccines-11 - ipv - - - static_instance-vaccines-12 - measles1 - - - static_instance-vaccines-13 - measles2 - - - - - - - static_instance-towns-0 - sindh - karachi - korangi - - - static_instance-towns-1 - sindh - karachi - landhi - - - static_instance-towns-2 - sindh - karachi - baldia - - - static_instance-towns-3 - sindh - karachi - bin_qasim - - - static_instance-towns-4 - sindh - karachi - gadap - - - static_instance-towns-5 - sindh - karachi - gulberg - - - static_instance-towns-6 - sindh - karachi - gulshan - - - static_instance-towns-7 - sindh - karachi - jamshed - - - static_instance-towns-8 - sindh - karachi - kiamari - - - static_instance-towns-9 - sindh - karachi - liaquatabad - - - static_instance-towns-10 - sindh - karachi - lyari - - - static_instance-towns-11 - sindh - karachi - malir - - - static_instance-towns-12 - sindh - karachi - new_karachi - - - static_instance-towns-13 - sindh - karachi - north_nazimabad - - - static_instance-towns-14 - sindh - karachi - orangi - - - static_instance-towns-15 - sindh - karachi - saddar - - - static_instance-towns-16 - sindh - karachi - shah_faisal - - - static_instance-towns-17 - sindh - karachi - site - - - static_instance-towns-18 - na - na - other - - - static_instance-towns-19 - na - na - not_applicable - - - - - - - static_instance-cities-0 - sindh - karachi - - - static_instance-cities-1 - punjab - hafizabad - - - static_instance-cities-2 - punjab - muzaffargarh - - - static_instance-cities-3 - na - other - - - static_instance-cities-4 - na - not_applicable - - - - - - - static_instance-yes_no-0 - yes - - - static_instance-yes_no-1 - no - - - - diff --git a/opensrp-core/src/test/resources/form/offsite_woman_followup/form.json b/opensrp-core/src/test/resources/form/offsite_woman_followup/form.json deleted file mode 100644 index c5c29a415b..0000000000 --- a/opensrp-core/src/test/resources/form/offsite_woman_followup/form.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"Offsite_Woman_Followup_Form","title":"دوسرے سینٹر میں رجسٹرڈ خواتین فالواپ رجسٹر - Off Site Woman Follow Up Form","sms_keyword":"offsite_woman_followup_form","default_language":"English","choices":{"provinces":[{"name":"kpk","label":{"Urdu":"خیبر پختون خواہ","English":"Khyber Pakhtunkhwa","Roman Urdu":"Khyber Pakhtunkhwa"}},{"name":"sindh","label":{"Urdu":"سندھ","English":"Sindh","Roman Urdu":"Sindh"}},{"name":"balochistan","label":{"Urdu":"بلوچستان","English":"Balochistan","Roman Urdu":"Balochistan"}},{"name":"punjab","label":{"Urdu":"پنجاب","English":"Punjab","Roman Urdu":"Punjab"}},{"name":"gilgit_baltistan","label":{"Urdu":"گلگت بلتستان","English":"Gilgit Baltistan","Roman Urdu":"Gilgit Baltistan"}},{"name":"kashmir","label":{"Urdu":"کشمیر","English":"Kashmir","Roman Urdu":"Kashmir"}},{"name":"fata","label":{"Urdu":"فاٹا","English":"FATA","Roman Urdu":"FATA"}},{"name":"out_of_country","label":{"Urdu":"ملک سے باہر","English":"Out of Country","Roman Urdu":"Mulk se baahir"}}],"ucs":[{"province":"sindh","city":"karachi","town":"korangi","name":"bilal_colony","label":{"Urdu":"بلال کالونی","Roman Urdu":"Bilal Colony","English":"Bilal Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"nasir_colony","label":{"Urdu":"ناصر کالونی","Roman Urdu":"Nasir Colony","English":"Nasir Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"chakra_goth","label":{"Urdu":"چکرا گوٹھ","Roman Urdu":"Chakra Goth","English":"Chakra Goth"}},{"province":"sindh","city":"karachi","town":"korangi","name":"mustafa_taj_colony","label":{"Urdu":"مصطفی تاج کالونی","Roman Urdu":"Mustafa Taj Colony","English":"Mustafa Taj Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"hundred_quarters","label":{"Urdu":"ہنڈریڈ کوارٹر","Roman Urdu":"Hundred Quarters","English":"Hundred Quarters"}},{"province":"sindh","city":"karachi","town":"korangi","name":"gulzar_colony","label":{"Urdu":"گلزار کالونی","Roman Urdu":"Gulzar Colony","English":"Gulzar Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"korangi_sector_33","label":{"Urdu":"کورنگی سیکٹر 33","Roman Urdu":"Korangi Sector 33","English":"Korangi Sector 33"}},{"province":"sindh","city":"karachi","town":"korangi","name":"zaman_town","label":{"Urdu":"زمان ٹاوَن","Roman Urdu":"Zaman Town","English":"Zaman Town"}},{"province":"sindh","city":"karachi","town":"korangi","name":"hasrat_mohani_colony","label":{"Urdu":"حسرت موہانی کالونی","Roman Urdu":"Hasrat Mohani Colony","English":"Hasrat Mohani Colony"}},{"province":"sindh","city":"karachi","town":"baldia","name":"gulshan_e_ghazi","label":{"Urdu":"گلشن غازی","Roman Urdu":"Gulshan-e-Ghazi","English":"Gulshan-e-Ghazi"}},{"province":"sindh","city":"karachi","town":"baldia","name":"ittehad_town","label":{"Urdu":"اتحاد ٹاوَن","Roman Urdu":"Ittehad Town","English":"Ittehad Town"}},{"province":"sindh","city":"karachi","town":"baldia","name":"islam_nagar","label":{"Urdu":"اسلام نگر","Roman Urdu":"Islam Nagar","English":"Islam Nagar"}},{"province":"sindh","city":"karachi","town":"baldia","name":"nai_abadi","label":{"Urdu":"نئی آبادی","Roman Urdu":"Nai Abadi","English":"Nai Abadi"}},{"province":"sindh","city":"karachi","town":"baldia","name":"saeedabad","label":{"Urdu":"سعید آباد","Roman Urdu":"Saeedabad","English":"Saeedabad"}},{"province":"sindh","city":"karachi","town":"baldia","name":"muslim_mujahid_colony","label":{"Urdu":"مسلم مجاہد کالونی","Roman Urdu":"Muslim Mujahid Colony","English":"Muslim Mujahid Colony"}},{"province":"sindh","city":"karachi","town":"baldia","name":"muhajir_camp","label":{"Urdu":"مہاجر کیمپ","Roman Urdu":"Muhajir Camp","English":"Muhajir Camp"}},{"province":"sindh","city":"karachi","town":"baldia","name":"rasheedabad","label":{"Urdu":"رشید آباد","Roman Urdu":"Rasheedabad","English":"Rasheedabad"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"ibrahim_hyderi","label":{"Urdu":"ابراہیم حیدری","Roman Urdu":"Ibrahim Hyderi","English":"Ibrahim Hyderi"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"rehri","label":{"Urdu":"رہڑی","Roman Urdu":"Rehri","English":"Rehri"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"cattle_colony","label":{"Urdu":"کیٹل کالونی","Roman Urdu":"Cattle Colony","English":"Cattle Colony"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"qaidabad","label":{"Urdu":"قائدآباد","Roman Urdu":"Qaidabad","English":"Qaidabad"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"landhi_colony","label":{"Urdu":"لانڈھی کالونی","Roman Urdu":"Landhi Colony","English":"Landhi Colony"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"gulshan_e_hadeed","label":{"Urdu":"گلشن حدید","Roman Urdu":"Gulshan-e-Hadeed","English":"Gulshan-e-Hadeed"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"gaghar","label":{"Urdu":"گگر","Roman Urdu":"Gaghar","English":"Gaghar"}},{"province":"sindh","city":"karachi","town":"gadap","name":"murad_memon_goth","label":{"Urdu":"مراد میمن گوٹھ","Roman Urdu":"Murad Memon Goth","English":"Murad Memon Goth"}},{"province":"sindh","city":"karachi","town":"gadap","name":"darsano_chana","label":{"Urdu":"درشانو شنو","Roman Urdu":"Darsano Chana","English":"Darsano Chana"}},{"province":"sindh","city":"karachi","town":"gadap","name":"gujro","label":{"Urdu":"گجرو","Roman Urdu":"Gujro","English":"Gujro"}},{"province":"sindh","city":"karachi","town":"gadap","name":"songal","label":{"Urdu":"سنگل","Roman Urdu":"Songal","English":"Songal"}},{"province":"sindh","city":"karachi","town":"gadap","name":"maymarabad","label":{"Urdu":"معمار آباد","Roman Urdu":"Maymarabad","English":"Maymarabad"}},{"province":"sindh","city":"karachi","town":"gadap","name":"yousuf_goth","label":{"Urdu":"یوسف گوٹھ","Roman Urdu":"Yousuf Goth","English":"Yousuf Goth"}},{"province":"sindh","city":"karachi","town":"gadap","name":"manghopir","label":{"Urdu":"منگھوپیر","Roman Urdu":"Manghopir","English":"Manghopir"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"azizabad","label":{"Urdu":"عزیز آباد","Roman Urdu":"Azizabad","English":"Azizabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"karimabad","label":{"Urdu":"کریم آباد","Roman Urdu":"Karimabad","English":"Karimabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"aisha_manzil","label":{"Urdu":"عائشہ منزل","Roman Urdu":"Aisha Manzil","English":"Aisha Manzil"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"ancholi","label":{"Urdu":"انچولی","Roman Urdu":"Ancholi","English":"Ancholi"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"naseerabad","label":{"Urdu":"نصیرآباد","Roman Urdu":"Naseerabad","English":"Naseerabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"yaseenabad","label":{"Urdu":"یاسین آباد","Roman Urdu":"Yaseenabad","English":"Yaseenabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"water_pump","label":{"Urdu":"واٹرپمپ","Roman Urdu":"Water Pump","English":"Water Pump"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"shafiq_mill_colony","label":{"Urdu":"شفیق مل کالونی","Roman Urdu":"Shafiq Mill Colony","English":"Shafiq Mill Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"delhi_mercantile_society","label":{"Urdu":"دہلی مرچنٹائل سوسائٹی","Roman Urdu":"Delhi Mercantile Society","English":"Delhi Mercantile Society"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"civic_centre","label":{"Urdu":"سوک سینٹر","Roman Urdu":"Civic Centre","English":"Civic Centre"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"pir_ilahi_buksh_colony","label":{"Urdu":"پیر الہی بخش کالونی","Roman Urdu":"Pir Ilahi Buksh Colony","English":"Pir Ilahi Buksh Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"essa_nagri","label":{"Urdu":"عیسی نگری","Roman Urdu":"Essa Nagri","English":"Essa Nagri"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gulshan_e_iqbal","label":{"Urdu":"گلشن اقبال","Roman Urdu":"Gulshan-e-Iqbal","English":"Gulshan-e-Iqbal"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gillani_railway_station","label":{"Urdu":"گیلانی ریلوے اسٹیشن","Roman Urdu":"Gillani Railway Station","English":"Gillani Railway Station"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"shanti_nagar","label":{"Urdu":"شانتی نگر","Roman Urdu":"Shanti Nagar","English":"Shanti Nagar"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"jamali_colony","label":{"Urdu":"جمالی کالونی","Roman Urdu":"Jamali Colony","English":"Jamali Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gulshan_e_iqbal_ii","label":{"Urdu":"گلشن اقبال 2","Roman Urdu":"Gulshan-e-Iqbal II","English":"Gulshan-e-Iqbal II"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"pehlwan_goth","label":{"Urdu":"پہلوان گوٹھ","Roman Urdu":"Pehlwan Goth","English":"Pehlwan Goth"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"matrovil_colony","label":{"Urdu":"میٹروویل کالونی","Roman Urdu":"Matrovil Colony","English":"Matrovil Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gulzar_e_hijri","label":{"Urdu":"گلزار ہجری","Roman Urdu":"Gulzar-e-Hijri","English":"Gulzar-e-Hijri"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"safooran_goth","label":{"Urdu":"صفورا گوٹھ","Roman Urdu":"Safooran Goth","English":"Safooran Goth"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"akhtar_colony","label":{"Urdu":"اختر کالونی","Roman Urdu":"Akhtar Colony","English":"Akhtar Colony"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"manzoor_colony","label":{"Urdu":"منظور کالونی","Roman Urdu":"Manzoor Colony","English":"Manzoor Colony"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"azam_basti","label":{"Urdu":"اعظم بستی","Roman Urdu":"Azam Basti","English":"Azam Basti"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"chanesar_goth","label":{"Urdu":"چنیسر گوٹھ","Roman Urdu":"Chanesar Goth","English":"Chanesar Goth"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"mahmudabad","label":{"Urdu":"محمودآباد","Roman Urdu":"Mahmudabad","English":"Mahmudabad"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"pechs","label":{"Urdu":"پی۔ای۔سی۔ایچ۔ایس","Roman Urdu":"P.E.C.H.S.","English":"P.E.C.H.S."}},{"province":"sindh","city":"karachi","town":"jamshed","name":"pechs_ii","label":{"Urdu":"پی۔ای۔سی۔ایچ۔ایس 2","Roman Urdu":"P.E.C.H.S. II","English":"P.E.C.H.S. II"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"jut_line","label":{"Urdu":"جٹ لائن","Roman Urdu":"Jut Line","English":"Jut Line"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"central_jacob_lines","label":{"Urdu":"سینٹرل جیکب لائن","Roman Urdu":"Central Jacob Lines","English":"Central Jacob Lines"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"jamshed_quarters","label":{"Urdu":"جمشید کوارٹر","Roman Urdu":"Jamshed Quarters","English":"Jamshed Quarters"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"garden_east","label":{"Urdu":"گارڈن ایسٹ","Roman Urdu":"Garden East","English":"Garden East"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"soldier_bazar","label":{"Urdu":"سولجر بازار","Roman Urdu":"Soldier Bazar","English":"Soldier Bazar"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"pakistan_quarters","label":{"Urdu":"پاکستان کوارٹر","Roman Urdu":"Pakistan Quarters","English":"Pakistan Quarters"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"bhutta_village","label":{"Urdu":"بھٹا ولیج","Roman Urdu":"Bhutta Village","English":"Bhutta Village"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"sultanabad","label":{"Urdu":"سلطان آباد","Roman Urdu":"Sultanabad","English":"Sultanabad"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"kiamari_uc","label":{"Urdu":"کیماری یوسی","Roman Urdu":"Kiamari UC","English":"Kiamari UC"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"baba_bhit","label":{"Urdu":"بابا بھٹ","Roman Urdu":"Baba Bhit","English":"Baba Bhit"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"machar_colony","label":{"Urdu":"مچھر کالونی","Roman Urdu":"Machar Colony","English":"Machar Colony"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"maripur","label":{"Urdu":"ماڑی پور","Roman Urdu":"Maripur","English":"Maripur"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"shershah","label":{"Urdu":"شیرشاہ","Roman Urdu":"SherShah","English":"SherShah"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"gabo_pat","label":{"Urdu":"گابو پٹ","Roman Urdu":"Gabo Pat","English":"Gabo Pat"}},{"province":"sindh","city":"karachi","town":"landhi","name":"muzafarabad","label":{"Urdu":"مظفرآباد","Roman Urdu":"Muzafarabad","English":"Muzafarabad"}},{"province":"sindh","city":"karachi","town":"landhi","name":"muslimabad","label":{"Urdu":"مسلم آباد","Roman Urdu":"Muslimabad","English":"Muslimabad"}},{"province":"sindh","city":"karachi","town":"landhi","name":"dawood_chowrangi","label":{"Urdu":"داوَد چورنگی","Roman Urdu":"Dawood Chowrangi","English":"Dawood Chowrangi"}},{"province":"sindh","city":"karachi","town":"landhi","name":"moinabad","label":{"Urdu":"معین آباد","Roman Urdu":"Moinabad","English":"Moinabad"}},{"province":"sindh","city":"karachi","town":"landhi","name":"sharafi_goth","label":{"Urdu":"شرافی گوٹھ","Roman Urdu":"Sharafi Goth","English":"Sharafi Goth"}},{"province":"sindh","city":"karachi","town":"landhi","name":"bhutto_nagar","label":{"Urdu":"بھٹو نگر","Roman Urdu":"Bhutto Nagar","English":"Bhutto Nagar"}},{"province":"sindh","city":"karachi","town":"landhi","name":"khawaja_ajmeer_colony","label":{"Urdu":"خواجہ اجمیر کالونی","Roman Urdu":"Khawaja Ajmeer Colony","English":"Khawaja Ajmeer Colony"}},{"province":"sindh","city":"karachi","town":"landhi","name":"landhi_uc","label":{"Urdu":"لانڈھی یوسی","Roman Urdu":"Landhi UC","English":"Landhi UC"}},{"province":"sindh","city":"karachi","town":"landhi","name":"awami_colony","label":{"Urdu":"عوامی کالونی","Roman Urdu":"Awami Colony","English":"Awami Colony"}},{"province":"sindh","city":"karachi","town":"landhi","name":"burmee_colony","label":{"Urdu":"برمی کالونی","Roman Urdu":"Burmee Colony","English":"Burmee Colony"}},{"province":"sindh","city":"karachi","town":"landhi","name":"korangi_uc","label":{"Urdu":"کورنگی یوسی","Roman Urdu":"Korangi UC","English":"Korangi UC"}},{"province":"sindh","city":"karachi","town":"landhi","name":"sherabad","label":{"Urdu":"شیرآباد","Roman Urdu":"Sherabad","English":"Sherabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"rizvia_society","label":{"Urdu":"رضویہ سوسائٹی","Roman Urdu":"Rizvia Society","English":"Rizvia Society"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"firdous_colony","label":{"Urdu":"فردوس کالونی","Roman Urdu":"Firdous Colony","English":"Firdous Colony"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"super_market","label":{"Urdu":"سپر مارکیٹ","Roman Urdu":"Super Market","English":"Super Market"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"dak_khana","label":{"Urdu":"دک کھانہ","Roman Urdu":"Dak Khana","English":"Dak Khana"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"qasimabad","label":{"Urdu":"قاسم آباد","Roman Urdu":"Qasimabad","English":"Qasimabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"bandhani_colony","label":{"Urdu":"بندھانی کالونی","Roman Urdu":"Bandhani Colony","English":"Bandhani Colony"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"sharifabad","label":{"Urdu":"شریف آباد","Roman Urdu":"Sharifabad","English":"Sharifabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"commercial_area","label":{"Urdu":"کمرشل ایریا","Roman Urdu":"Commercial Area","English":"Commercial Area"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"mujahid_colony","label":{"Urdu":"مجاہد کالونی","Roman Urdu":"Mujahid Colony","English":"Mujahid Colony"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"nazimabad","label":{"Urdu":"ناظم آباد","Roman Urdu":"Nazimabad","English":"Nazimabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"abbasi_shaheed","label":{"Urdu":"عباسی شہید","Roman Urdu":"Abbasi Shaheed","English":"Abbasi Shaheed"}},{"province":"sindh","city":"karachi","town":"lyari","name":"agra_taj_colony","label":{"Urdu":"آگرہ تاج کالونی","Roman Urdu":"Agra Taj Colony","English":"Agra Taj Colony"}},{"province":"sindh","city":"karachi","town":"lyari","name":"daryaabad","label":{"Urdu":"دریاآباد","Roman Urdu":"Daryaabad","English":"Daryaabad"}},{"province":"sindh","city":"karachi","town":"lyari","name":"nawabad","label":{"Urdu":"نواآباد","Roman Urdu":"Nawabad","English":"Nawabad"}},{"province":"sindh","city":"karachi","town":"lyari","name":"khada_memon_society","label":{"Urdu":"خدا- میمن- سوساَٹی","Roman Urdu":"Khada Memon Society","English":"Khada Memon Society"}},{"province":"sindh","city":"karachi","town":"lyari","name":"baghdadi","label":{"Urdu":"بغدادی","Roman Urdu":"Baghdadi","English":"Baghdadi"}},{"province":"sindh","city":"karachi","town":"lyari","name":"shah_baig_line","label":{"Urdu":"شاھ باغ لائن","Roman Urdu":"Shah Baig Line","English":"Shah Baig Line"}},{"province":"sindh","city":"karachi","town":"lyari","name":"bihar_colony","label":{"Urdu":"بہار کالونی","Roman Urdu":"Bihar Colony","English":"Bihar Colony"}},{"province":"sindh","city":"karachi","town":"lyari","name":"ragiwara","label":{"Urdu":"راگی واڑا","Roman Urdu":"Ragiwara","English":"Ragiwara"}},{"province":"sindh","city":"karachi","town":"lyari","name":"singo_line","label":{"Urdu":"سنگولائن","Roman Urdu":"Singo Line","English":"Singo Line"}},{"province":"sindh","city":"karachi","town":"lyari","name":"chakiwara","label":{"Urdu":"چاکی واڑا","Roman Urdu":"Chakiwara","English":"Chakiwara"}},{"province":"sindh","city":"karachi","town":"lyari","name":"allama_iqbal_colony","label":{"Urdu":"علامہ اقبال کالونی","Roman Urdu":"Allama Iqbal Colony","English":"Allama Iqbal Colony"}},{"province":"sindh","city":"karachi","town":"malir","name":"model_colony","label":{"Urdu":"موڈل کالونی","Roman Urdu":"Model Colony","English":"Model Colony"}},{"province":"sindh","city":"karachi","town":"malir","name":"kala_board","label":{"Urdu":"کالا بورڈ","Roman Urdu":"Kala Board","English":"Kala Board"}},{"province":"sindh","city":"karachi","town":"malir","name":"saudabad","label":{"Urdu":"سعودآباد","Roman Urdu":"Saudabad","English":"Saudabad"}},{"province":"sindh","city":"karachi","town":"malir","name":"khokhra_par","label":{"Urdu":"کھوکھرا پار","Roman Urdu":"Khokhra Par","English":"Khokhra Par"}},{"province":"sindh","city":"karachi","town":"malir","name":"jafar_e_tayyar","label":{"Urdu":"جعفر تیار","Roman Urdu":"Jafar-e-Tayyar","English":"Jafar-e-Tayyar"}},{"province":"sindh","city":"karachi","town":"malir","name":"gharibabad","label":{"Urdu":"غریب آباد","Roman Urdu":"Gharibabad","English":"Gharibabad"}},{"province":"sindh","city":"karachi","town":"malir","name":"ghazi_brohi_goth","label":{"Urdu":"غازی بروہی گوٹھ","Roman Urdu":"Ghazi Brohi Goth","English":"Ghazi Brohi Goth"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"kalyana","label":{"Urdu":"کالیانہ","Roman Urdu":"Kalyana","English":"Kalyana"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"sir_syed_colony","label":{"Urdu":"سر سید کالونی","Roman Urdu":"Sir Syed Colony","English":"Sir Syed Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"fatima_jinnah_colony","label":{"Urdu":"فاطمہ جناح کالونی","Roman Urdu":"Fatima Jinnah Colony","English":"Fatima Jinnah Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"godhra","label":{"Urdu":"گودھرا","Roman Urdu":"Godhra","English":"Godhra"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"abu_zar_ghaffari","label":{"Urdu":"ابو زر غفاری","Roman Urdu":"Abu Zar Ghaffari","English":"Abu Zar Ghaffari"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"hakim_ahsan","label":{"Urdu":"حاکم احسان","Roman Urdu":"Hakim Ahsan","English":"Hakim Ahsan"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"madina_colony","label":{"Urdu":"مدینہ کالونی","Roman Urdu":"Madina Colony","English":"Madina Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"faisal_colony","label":{"Urdu":"فیصل کالونی","Roman Urdu":"Faisal Colony","English":"Faisal Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"khamiso_goth","label":{"Urdu":"خمیسو گوٹھ","Roman Urdu":"Khamiso Goth","English":"Khamiso Goth"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"mustufa_colony","label":{"Urdu":"مصطفی کالونی","Roman Urdu":"Mustufa Colony","English":"Mustufa Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"khawaja_ajmeer_nagri","label":{"Urdu":"خواجہ اجمیر نگری","Roman Urdu":"Khawaja Ajmeer Nagri","English":"Khawaja Ajmeer Nagri"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"gulshan_e_saeed","label":{"Urdu":"گلشن سعید","Roman Urdu":"Gulshan-e-Saeed","English":"Gulshan-e-Saeed"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"shah_nawaz_bhutto_colony","label":{"Urdu":"شاہ نواز بھٹو کالونی","Roman Urdu":"Shah Nawaz Bhutto Colony","English":"Shah Nawaz Bhutto Colony"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"paposh_nagar","label":{"Urdu":"پاپوش نگر","Roman Urdu":"Paposh Nagar","English":"Paposh Nagar"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"pahar_ganj","label":{"Urdu":"پہاڑ گنج","Roman Urdu":"Pahar Ganj","English":"Pahar Ganj"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"khandu_goth","label":{"Urdu":"کھنڑو گوٹھ","Roman Urdu":"Khandu Goth","English":"Khandu Goth"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"hyderi","label":{"Urdu":"حیدری","Roman Urdu":"Hyderi","English":"Hyderi"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"sakhi_hassan","label":{"Urdu":"سخی حسن","Roman Urdu":"Sakhi Hassan","English":"Sakhi Hassan"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"farooq_e_azam","label":{"Urdu":"فاروق اعظم","Roman Urdu":"Farooq-e-Azam","English":"Farooq-e-Azam"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"nusrat_bhutto_colony","label":{"Urdu":"نصرت بھٹو کالونی","Roman Urdu":"Nusrat Bhutto Colony","English":"Nusrat Bhutto Colony"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"shadman_town","label":{"Urdu":"شادمان ٹاوَن","Roman Urdu":"Shadman Town","English":"Shadman Town"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"buffer_zone","label":{"Urdu":"بفرزون","Roman Urdu":"Buffer Zone","English":"Buffer Zone"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"buffer_zone_ii","label":{"Urdu":"بفرزون 2","Roman Urdu":"Buffer Zone II","English":"Buffer Zone II"}},{"province":"sindh","city":"karachi","town":"orangi","name":"mominabad","label":{"Urdu":"مومن آباد","Roman Urdu":"Mominabad","English":"Mominabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"haryana_colony","label":{"Urdu":"حریانہ کالونی","Roman Urdu":"Haryana Colony","English":"Haryana Colony"}},{"province":"sindh","city":"karachi","town":"orangi","name":"hanifabad","label":{"Urdu":"حنیف آباد","Roman Urdu":"Hanifabad","English":"Hanifabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"mohammad_nagar","label":{"Urdu":"محمد نگر","Roman Urdu":"Mohammad Nagar","English":"Mohammad Nagar"}},{"province":"sindh","city":"karachi","town":"orangi","name":"madina_colony_orangi","label":{"Urdu":"مدینہ کالونی اورنگی","Roman Urdu":"Madina Colony Orangi","English":"Madina Colony Orangi"}},{"province":"sindh","city":"karachi","town":"orangi","name":"ghaziabad","label":{"Urdu":"غازی آباد","Roman Urdu":"Ghaziabad","English":"Ghaziabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"chisti_nagar","label":{"Urdu":"چشتی نگر","Roman Urdu":"Chisti Nagar","English":"Chisti Nagar"}},{"province":"sindh","city":"karachi","town":"orangi","name":"bilal_colony_orangi","label":{"Urdu":"بلال کالونی اورنگی","Roman Urdu":"Bilal Colony Orangi","English":"Bilal Colony Orangi"}},{"province":"sindh","city":"karachi","town":"orangi","name":"iqbal_baloch_colony","label":{"Urdu":"اقبال بلوچ کالونی","Roman Urdu":"Iqbal Baloch Colony","English":"Iqbal Baloch Colony"}},{"province":"sindh","city":"karachi","town":"orangi","name":"ghabool_town","label":{"Urdu":"گبول ٹاوَن","Roman Urdu":"Ghabool Town","English":"Ghabool Town"}},{"province":"sindh","city":"karachi","town":"orangi","name":"data_nagar","label":{"Urdu":"داتا نگر","Roman Urdu":"Data Nagar","English":"Data Nagar"}},{"province":"sindh","city":"karachi","town":"orangi","name":"mujahidabad","label":{"Urdu":"مجاہد آباد","Roman Urdu":"Mujahidabad","English":"Mujahidabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"baloch_goth","label":{"Urdu":"بلوچ گوٹھ","Roman Urdu":"Baloch Goth","English":"Baloch Goth"}},{"province":"sindh","city":"karachi","town":"saddar","name":"old_haji_camp","label":{"Urdu":"پرانہ حاجی کیمپ","Roman Urdu":"Old Haji Camp","English":"Old Haji Camp"}},{"province":"sindh","city":"karachi","town":"saddar","name":"garden","label":{"Urdu":"گارڈن","Roman Urdu":"Garden","English":"Garden"}},{"province":"sindh","city":"karachi","town":"saddar","name":"kharadar","label":{"Urdu":"کھارادر","Roman Urdu":"Kharadar","English":"Kharadar"}},{"province":"sindh","city":"karachi","town":"saddar","name":"city_railway_colony","label":{"Urdu":"سٹی ریلوے کالونی","Roman Urdu":"City Railway Colony","English":"City Railway Colony"}},{"province":"sindh","city":"karachi","town":"saddar","name":"nanak_wara","label":{"Urdu":"ناناک واڑا","Roman Urdu":"Nanak Wara","English":"Nanak Wara"}},{"province":"sindh","city":"karachi","town":"saddar","name":"gazdarabad","label":{"Urdu":"گزدرآباد","Roman Urdu":"Gazdarabad","English":"Gazdarabad"}},{"province":"sindh","city":"karachi","town":"saddar","name":"millat_nagar_islam_pura","label":{"Urdu":"ملت نگر اسلام پورا","Roman Urdu":"Millat Nagar/Islam Pura","English":"Millat Nagar/Islam Pura"}},{"province":"sindh","city":"karachi","town":"saddar","name":"saddar_uc","label":{"Urdu":"صدر یو سی","Roman Urdu":"Saddar UC","English":"Saddar UC"}},{"province":"sindh","city":"karachi","town":"saddar","name":"civil_line","label":{"Urdu":"سول لائن","Roman Urdu":"Civil Line","English":"Civil Line"}},{"province":"sindh","city":"karachi","town":"saddar","name":"clifton","label":{"Urdu":"کلفٹن","Roman Urdu":"Clifton","English":"Clifton"}},{"province":"sindh","city":"karachi","town":"saddar","name":"kehkashan","label":{"Urdu":"کہکشان","Roman Urdu":"Kehkashan","English":"Kehkashan"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"natha_khan_goth","label":{"Urdu":"ناتھا خان گوٹھ","Roman Urdu":"Natha Khan Goth","English":"Natha Khan Goth"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"pak_sadat_colony","label":{"Urdu":"پاک صدر کالونی","Roman Urdu":"Pak Sadat Colony","English":"Pak Sadat Colony"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"drigh_colony","label":{"Urdu":"ڈرگ کالونی","Roman Urdu":"Drigh Colony","English":"Drigh Colony"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"raita_plot","label":{"Urdu":"رائتا پلاٹ","Roman Urdu":"Raita Plot","English":"Raita Plot"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"moria_khan_goth","label":{"Urdu":"موریا خان گوٹھ","Roman Urdu":"Moria Khan Goth","English":"Moria Khan Goth"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"rafa_e_aam_society","label":{"Urdu":"رفا عام سوسا ئٹی","Roman Urdu":"Rafa-e-Aam Society","English":"Rafa-e-Aam Society"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"al_falah_society","label":{"Urdu":"الفلاح سوسا ئٹی","Roman Urdu":"Al-Falah Society","English":"Al-Falah Society"}},{"province":"sindh","city":"karachi","town":"site","name":"pak_colony","label":{"Urdu":"پاک کالونی","Roman Urdu":"Pak Colony","English":"Pak Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"old_golimar","label":{"Urdu":"پرانہ گولی مار","Roman Urdu":"Old Golimar","English":"Old Golimar"}},{"province":"sindh","city":"karachi","town":"site","name":"jahanabad","label":{"Urdu":"جہان آباد","Roman Urdu":"Jahanabad","English":"Jahanabad"}},{"province":"sindh","city":"karachi","town":"site","name":"metrovil","label":{"Urdu":"میٹروویل","Roman Urdu":"Metrovil","English":"Metrovil"}},{"province":"sindh","city":"karachi","town":"site","name":"bhawani_chali","label":{"Urdu":"بہوانی چالی","Roman Urdu":"Bhawani Chali","English":"Bhawani Chali"}},{"province":"sindh","city":"karachi","town":"site","name":"frontier_colony","label":{"Urdu":"فرونٹر کالونی","Roman Urdu":"Frontier Colony","English":"Frontier Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"banaras_colony","label":{"Urdu":"بنارس کالونی","Roman Urdu":"Banaras Colony","English":"Banaras Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"qasba_colony","label":{"Urdu":"قصبہ کالونی","Roman Urdu":"Qasba Colony","English":"Qasba Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"islamia_colony","label":{"Urdu":"اسلامیہ کالونی","Roman Urdu":"Islamia Colony","English":"Islamia Colony"}},{"province":"na","city":"na","town":"na","name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}},{"province":"na","city":"na","town":"na","name":"not_applicable","label":{"Urdu":"قابل اطلاق نہیں","Roman Urdu":"Qaabil-e-atlaaq nahi","English":"Not Applicable"}}],"gender":[{"instance":{"openmrs_code":"1534AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"male","label":{"Urdu":"مرد/ لڑکا","Roman Urdu":"Mard/larka","English":"Male"}},{"instance":{"openmrs_code":"1535AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"female","label":{"Urdu":"عورت/لڑکی","Roman Urdu":"Aurat/larki","English":"Female"}},{"instance":{"openmrs_code":"163163AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"transgender","label":{"Urdu":"خواجہ سرہ","Roman Urdu":"Khwaja sira","English":"Transgender"}}],"vaccines":[{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT1","label":{"Urdu":"ٹی ٹی 1","Roman Urdu":"TT1","English":"TT1"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT2","label":{"Urdu":"ٹی ٹی 2","Roman Urdu":"TT2","English":"TT2"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT3","label":{"Urdu":"ٹی ٹی 3","Roman Urdu":"TT3","English":"TT3"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT4","label":{"Urdu":"ٹی ٹی 4","Roman Urdu":"TT4","English":"TT4"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT5","label":{"Urdu":"ٹی ٹی 5","Roman Urdu":"TT5","English":"TT5"}}],"towns":[{"province":"sindh","city":"karachi","name":"korangi","label":{"Urdu":"کورنگی","Roman Urdu":"Korangi","English":"Korangi"}},{"province":"sindh","city":"karachi","name":"landhi","label":{"Urdu":"لانڈھی","Roman Urdu":"Landhi","English":"Landhi"}},{"province":"sindh","city":"karachi","name":"baldia","label":{"Urdu":"بلدیہ","Roman Urdu":"Baldia","English":"Baldia"}},{"province":"sindh","city":"karachi","name":"bin_qasim","label":{"Urdu":"بن قاسم","Roman Urdu":"Bin Qasim","English":"Bin Qasim"}},{"province":"sindh","city":"karachi","name":"gadap","label":{"Urdu":"گڈاپ","Roman Urdu":"Gadap","English":"Gadap"}},{"province":"sindh","city":"karachi","name":"gulberg","label":{"Urdu":"گلبرگ","Roman Urdu":"Gulberg","English":"Gulberg"}},{"province":"sindh","city":"karachi","name":"gulshan","label":{"Urdu":"گلشن","Roman Urdu":"Gulshan","English":"Gulshan"}},{"province":"sindh","city":"karachi","name":"jamshed","label":{"Urdu":"جمشید","Roman Urdu":"Jamshed","English":"Jamshed"}},{"province":"sindh","city":"karachi","name":"kiamari","label":{"Urdu":"کیماری","Roman Urdu":"Kiamari","English":"Kiamari"}},{"province":"sindh","city":"karachi","name":"liaquatabad","label":{"Urdu":"لیاقت آباد","Roman Urdu":"Liaquatabad","English":"Liaquatabad"}},{"province":"sindh","city":"karachi","name":"lyari","label":{"Urdu":"لیاری","Roman Urdu":"Lyari","English":"Lyari"}},{"province":"sindh","city":"karachi","name":"malir","label":{"Urdu":"ملیر","Roman Urdu":"Malir","English":"Malir"}},{"province":"sindh","city":"karachi","name":"new_karachi","label":{"Urdu":"نیو کراچی","Roman Urdu":"New Karachi","English":"New Karachi"}},{"province":"sindh","city":"karachi","name":"north_nazimabad","label":{"Urdu":"نارتھ ناظم آباد","Roman Urdu":"North Nazimabad","English":"North Nazimabad"}},{"province":"sindh","city":"karachi","name":"orangi","label":{"Urdu":"اورنگی","Roman Urdu":"Orangi","English":"Orangi"}},{"province":"sindh","city":"karachi","name":"saddar","label":{"Urdu":"صدر","Roman Urdu":"Saddar","English":"Saddar"}},{"province":"sindh","city":"karachi","name":"shah_faisal","label":{"Urdu":"شاہ فیصل","Roman Urdu":"Shah Faisal","English":"Shah Faisal"}},{"province":"sindh","city":"karachi","name":"site","label":{"Urdu":"سائٹ","Roman Urdu":"S.I.T.E.","English":"S.I.T.E."}},{"province":"na","city":"na","name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}},{"province":"na","city":"na","name":"not_applicable","label":{"Urdu":"قابل اطلاق نہیں","Roman Urdu":"Qaabil-e-atlaaq nahi","English":"Not Applicable"}}],"cities":[{"province":"sindh","name":"karachi","label":{"Urdu":"کراچی","Roman Urdu":"Karachi","English":"Karachi"}},{"province":"punjab","name":"hafizabad","label":{"Urdu":"حافظ آباد","Roman Urdu":"Hafizabad","English":"Hafizabad"}},{"province":"punjab","name":"muzaffargarh","label":{"Urdu":"مظفر گڑھ","Roman Urdu":"Muzaffargarh","English":"Muzaffargarh"}},{"province":"na","name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}},{"province":"na","name":"not_applicable","label":{"Urdu":"قابل اطلاق نہیں","Roman Urdu":"Not Applicable","English":"Not Applicable"}}],"edd_lmp":[{"instance":{"openmrs_code":"5596AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"edd","label":{"Urdu":"زچگی کی متوقع تاریخ","Roman Urdu":"EDD","English":"EDD"}},{"instance":{"openmrs_code":"1427AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"lmp","label":{"Urdu":"پچھلی مہواری کی تاریخ","Roman Urdu":"LMP","English":"LMP"}},{"instance":{"openmrs_code":"159617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"ultrasound","label":{"Urdu":"الٹرا سائونڈ","Roman Urdu":"Ultrasound","English":"Ultrasound"}},{"instance":{"openmrs_code":"1107AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"none","label":{"Urdu":"کوئی بھی نہیں","Roman Urdu":"Koi bhi nahi","English":"None of the above"}}],"yes_no":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}]},"instance":{"encounter_type":"Off Site Woman Follow Up"},"version":"201604080459","id_string":"offsite_woman_followup_form","type":"survey","children":[{"type":"hidden","name":"provider_uc"},{"type":"hidden","name":"provider_town"},{"type":"hidden","name":"provider_city"},{"type":"hidden","name":"provider_province"},{"type":"hidden","name":"existing_landmark"},{"type":"hidden","name":"existing_house_number"},{"type":"hidden","name":"existing_street"},{"type":"hidden","name":"existing_union_council"},{"type":"hidden","name":"existing_town"},{"type":"hidden","name":"existing_city_village"},{"type":"hidden","name":"existing_province"},{"type":"hidden","name":"existing_union_councilname"},{"type":"hidden","name":"existing_townname"},{"type":"hidden","name":"existing_city_villagename"},{"type":"hidden","name":"existing_provincename"},{"type":"hidden","name":"existing_first_name"},{"type":"hidden","name":"existing_last_name"},{"type":"hidden","name":"existing_father_name"},{"type":"hidden","name":"existing_husband_name"},{"type":"hidden","name":"existing_marriage"},{"type":"hidden","name":"existing_calc_dob_confirm"},{"type":"hidden","name":"existing_gender"},{"type":"hidden","name":"existing_ethnicity"},{"type":"hidden","name":"existing_client_reg_date"},{"type":"hidden","name":"existing_program_client_id"},{"type":"hidden","name":"existing_epi_card_number"},{"type":"hidden","name":"existing_reminders_approval"},{"type":"hidden","name":"existing_contact_phone_number"},{"type":"hidden","name":"e_tt1"},{"type":"hidden","name":"e_tt2"},{"type":"hidden","name":"e_tt3"},{"type":"hidden","name":"e_tt4"},{"type":"hidden","name":"e_tt5"},{"type":"hidden","name":"provider_id"},{"instance":{"openmrs_entity_id":"location_id","openmrs_entity":"encounter"},"type":"hidden","name":"provider_location_id"},{"type":"hidden","name":"provider_location_name"},{"type":"note","name":"provider_location_note","label":{"Urdu":"شہر: ${provider_city} ; ٹائون: ${provider_town} ; یوسی: ${provider_uc} ; سینٹرکا نام: ${provider_location_name}","English":"City: ${provider_city} ; Town: ${provider_town} ; UC: ${provider_uc} ; Center Name: ${provider_location_name}"}},{"instance":{"openmrs_entity_id":"163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"start","name":"start"},{"instance":{"openmrs_entity_id":"163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"end","name":"end"},{"instance":{"openmrs_entity_id":"163286AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"today","name":"today"},{"instance":{"openmrs_entity_id":"163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"deviceid","name":"deviceid"},{"instance":{"openmrs_entity_id":"163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"subscriberid","name":"subscriberid"},{"instance":{"openmrs_entity_id":"163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"simserial","name":"simserial"},{"instance":{"openmrs_entity_id":"163152AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"phonenumber","name":"phonenumber"},{"bind":{"required":"yes"},"type":"note","name":"client_reg_date_note","label":{"Urdu":"${existing_client_reg_date} :پروگرام میں اندراج کی تاریخ","Roman Urdu":"Program main andraaj ki tareekh: ${existing_client_reg_date}","English":"Client Registration date: ${existing_client_reg_date}"}},{"bind":{"required":"yes"},"type":"note","name":"program_client_id_note","label":{"Urdu":"${existing_program_client_id}:کلائنٹ کی پروگرام ائی ڈی","Roman Urdu":"Client ki program ID: ${existing_program_client_id}","English":"Program Client ID: ${existing_program_client_id}"}},{"bind":{"jr:constraintMsg":{"Urdu":"نمبر آٹھ ہندسوں پر مشتمل ہونا چاہئے","English":"Number should be 8 digits","Roman Urdu":"Number 8 hindason par mushtamil hona chahiye"},"required":"yes","constraint":"string-length(.) = 8"},"type":"integer","instance":{"openmrs_entity_id":"EPI Card Number","openmrs_entity":"person_attribute"},"name":"epi_card_number","label":{"Urdu":"ای پی آئی کارڈ نمبر: {existing_epi_card_number}$","English":"EPI Card Number: ${existing_epi_card_number}","Roman Urdu":"EPI Card Number: ${existing_epi_card_number}"}},{"bind":{"required":"yes"},"type":"note","name":"first_name_note","label":{"Urdu":"${existing_first_name}: نام","Roman Urdu":"Naam: ${existing_first_name}","English":"First Name: ${existing_first_name}"}},{"bind":{"required":"yes"},"type":"note","name":"last_name_note","label":{"Urdu":"والد کا نام: ${existing_last_name}","Roman Urdu":"Waalid ka naam: ${existing_last_name}","English":"Last name: ${existing_last_name}"}},{"bind":{"calculate":"date( today() - (${existing_calc_dob_confirm} div 365))"},"type":"calculate","name":"client_age","instance":{"openmrs_entity_id":"154384AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"}},{"type":"note","name":"birth_date_note","label":{"Urdu":"تاریخِ پیدائش: {existing_calc_dob_confirm}$ ({client_age}$) سال","English":"Birth date: ${existing_calc_dob_confirm} (${client_age}) years","Roman Urdu":"Tareekh-e-pedaaish: ${existing_calc_dob_confirm} (${client_age}) years"}},{"bind":{"required":"yes"},"type":"note","name":"gender_note","label":{"Urdu":"${existing_gender}: جنس","Roman Urdu":"Jins:${existing_gender}","English":"Gender: ${existing_gender}"}},{"type":"note","name":"father_name_note","label":{"Urdu":"والد کا نام: {existing_father_name}$","English":"Father's Name: ${existing_father_name}","Roman Urdu":"Waalid ka naam: ${existing_father_name}"}},{"type":"note","name":"marriage_note","label":{"Urdu":"شادی شدہ: {existing_marriage}$","English":"Married: ${existing_marriage}","Roman Urdu":"Shaadi shuda: ${existing_marriage}"}},{"type":"note","name":"husband_name_note","label":{"Urdu":"شوہر کا نام: {existing_husband_name}$","English":"Husband's name: ${existing_husband_name}","Roman Urdu":"Shohar ka naam: ${existing_husband_name}"}},{"bind":{"required":"yes"},"type":"note","name":"ethnicity_note","label":{"Urdu":"قومیت: {existing_ethnicity}$","Roman Urdu":"Qomiat: ${existing_ethnicity}","English":"Ethnicity: ${existing_ethnicity}"}},{"type":"note","name":"address","label":{"Urdu":"موجودہ پتہ: ${existing_house_number}, ${existing_street}, ${existing_landmark}, ${existing_union_councilname}, ${existing_townname}, ${existing_city_villagename}, ${existing_provincename}","English":"Current Address: ${existing_house_number}, ${existing_street}, ${existing_landmark}, ${existing_union_councilname}, ${existing_townname}, ${existing_city_villagename}, ${existing_provincename}","Roman Urdu":"Mojooda Address: ${existing_house_number}, ${existing_street}, ${existing_landmark}, ${existing_union_councilname}, ${existing_townname}, ${existing_city_villagename}, ${existing_provincename}"}},{"label":{"Urdu":"کیا آپ کا گھر کا پتہ بدلا ہے؟","English":"Has your home address changed?","Roman Urdu":"Kya aap ka ghar ka pata badla hai?"},"type":"select one","children":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}],"name":"address_change"},{"control":{"appearance":"minimal"},"name":"province","default":"${provider_province}","bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"label":{"Urdu":"صوبہ","Roman Urdu":"Suba","English":"Province"},"instance":{"openmrs_entity":"person_address","openmrs_entity_id":"stateProvince","openmrs_entity_parent":"usual_residence"},"type":"select one","children":[{"name":"kpk","label":{"Urdu":"خیبر پختون خواہ","English":"Khyber Pakhtunkhwa","Roman Urdu":"Khyber Pakhtunkhwa"}},{"name":"sindh","label":{"Urdu":"سندھ","English":"Sindh","Roman Urdu":"Sindh"}},{"name":"balochistan","label":{"Urdu":"بلوچستان","English":"Balochistan","Roman Urdu":"Balochistan"}},{"name":"punjab","label":{"Urdu":"پنجاب","English":"Punjab","Roman Urdu":"Punjab"}},{"name":"gilgit_baltistan","label":{"Urdu":"گلگت بلتستان","English":"Gilgit Baltistan","Roman Urdu":"Gilgit Baltistan"}},{"name":"kashmir","label":{"Urdu":"کشمیر","English":"Kashmir","Roman Urdu":"Kashmir"}},{"name":"fata","label":{"Urdu":"فاٹا","English":"FATA","Roman Urdu":"FATA"}},{"name":"out_of_country","label":{"Urdu":"ملک سے باہر","English":"Out of Country","Roman Urdu":"Mulk se baahir"}}]},{"control":{"appearance":"minimal"},"name":"city_village","choice_filter":"province=${province} or province='na'","default":"${provider_city}","bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"label":{"Urdu":"شہر","Roman Urdu":"Shehr","English":"City"},"itemset":"cities","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"cityVillage","openmrs_entity_parent":"usual_residence"},"type":"select one"},{"control":{"appearance":"minimal"},"name":"town","choice_filter":"(province=${province} and city=${city_village} ) or city='na'","bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"label":{"Urdu":"ٹاٰئون/ قصبہ/ بستی","Roman Urdu":"Town / Qasbah / Basti","English":"Town"},"itemset":"towns","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"town","openmrs_entity_parent":"usual_residence"},"type":"select one"},{"control":{"appearance":"minimal"},"name":"union_council","choice_filter":"(province=${province} and city=${city_village} and town=${town}) or town='na'","bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"label":{"Urdu":"یونین کونسل","Roman Urdu":"Union Council","English":"Union Council"},"itemset":"ucs","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"subTown","openmrs_entity_parent":"usual_residence"},"type":"select one"},{"bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"type":"text","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"house","openmrs_entity_parent":"usual_residence"},"name":"house_number","label":{"Urdu":"گھر کا نمبر","Roman Urdu":"Ghar ka number","English":"House Number"}},{"bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"type":"text","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"street","openmrs_entity_parent":"usual_residence"},"name":"street","label":{"Urdu":"گلی/کالونی/محلہ","Roman Urdu":"Gali/Colony/Mohalla","English":"Street"}},{"bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"type":"text","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"landmark","openmrs_entity_parent":"usual_residence"},"name":"landmark","label":{"Urdu":"گھر کے قریب کوئی مشہور جگہ","Roman Urdu":"Ghar ke qareeb koi mashoor jagah","English":"Land Mark"}},{"instance":{"openmrs_entity_id":"163277AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"geopoint","name":"center_gps","label":{"Urdu":"حاصل کردہ معلومات کی جگہ کے GPS کارڈینیٹس درج کریں","English":"Collect GPS coordinates of data entry location:","Roman Urdu":"Hasil karda malomaat ki jaga ke GPS coordinates darj karain"}},{"control":{"appearance":"minimal"},"name":"reminders_approval","bind":{"required":"yes"},"label":{"Urdu":"کیا آپ اپنے بچے کی اگلی ویکسین کی تاریخ کے لیے SMS موصول کرنا چاہتے ہیں؟ {existing_reminders_approval}$","English":"Are you willing to receive SMS reminders for your next visit? ${existing_reminders_approval}","Roman Urdu":"Kya aap apnay bachay ki agli vaccine ki tareekh ke liye SMS mausool karna chahtay hain? ${existing_reminders_approval}"},"instance":{"openmrs_entity_id":"163089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"select one","children":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}]},{"bind":{"jr:constraintMsg":{"Urdu":"فون نمبر گیارہ ہندسوں پر مشتمل اور مندرجہ ذیل شکل میں ہونا چاہئے: *********03","English":"Phone number should be 11 digits in the following format: 03*********","Roman Urdu":"Phone number 11 hindason par mushtamil aur mundarja zail shakal main hona chahiey: 03*********"},"relevant":"${existing_reminders_approval}='yes'","constraint":"regex(., '^03[0-9]{9}$')"},"type":"text","instance":{"openmrs_entity_id":"159635AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"name":"contact_phone_number","label":{"Urdu":"موبائل نمبر:{existing_contact_phone_number}$","English":"Mobile Number: ${existing_contact_phone_number}","Roman Urdu":"Mobile Number: ${existing_contact_phone_number}"}},{"instance":{"openmrs_entity_id":"5272AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"label":{"Urdu":"کیا خا تون حاملہ ہیں؟","English":"Is female pregnant?","Roman Urdu":"Kia khatoon haamla hain?"},"type":"select one","children":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}],"name":"pregnant"},{"name":"edd_lmp","bind":{"relevant":"selected (${pregnant}, 'yes')"},"label":{"Urdu":"کیا آپ کو اپنی پچھلی ماہواری کی تاریخ، زچگی کی متوقع تاریخ، یا الٹرا سائونڈ کا علم ہے؟","English":"Do you know your LMP, EDD or last Ultrasound information?","Roman Urdu":"Kya aap ko apni pichli mahwaari ki tareekh, zachgi ki mutawaqqa tareekh ya ultrasound ka ilm hai?"},"instance":{"openmrs_entity_id":"160697AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"select one","children":[{"instance":{"openmrs_code":"5596AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"edd","label":{"Urdu":"زچگی کی متوقع تاریخ","Roman Urdu":"EDD","English":"EDD"}},{"instance":{"openmrs_code":"1427AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"lmp","label":{"Urdu":"پچھلی مہواری کی تاریخ","Roman Urdu":"LMP","English":"LMP"}},{"instance":{"openmrs_code":"159617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"ultrasound","label":{"Urdu":"الٹرا سائونڈ","Roman Urdu":"Ultrasound","English":"Ultrasound"}},{"instance":{"openmrs_code":"1107AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"none","label":{"Urdu":"کوئی بھی نہیں","Roman Urdu":"Koi bhi nahi","English":"None of the above"}}]},{"bind":{"jr:constraintMsg":{"Urdu":"زچگی کی متوقع تاریخ ماضی کی نہیں ہو سکتی","Roman Urdu":"Zachgi ki mutawaqqa tareekh maazi ki nahi hosakti","English":"EDD cannot be in the past"},"relevant":"selected (${edd_lmp}, 'edd')","constraint":".>=${today}"},"type":"date","name":"edd","label":{"Urdu":"زچگی کی متوقع تاریخ","Roman Urdu":"Zachgi ki mutawaqqa tareekh","English":"EDD"}},{"bind":{"jr:constraintMsg":{"Urdu":"پچھلی ماہواری کی تاریخ مستقبل کی نہیں ہوسکتی","Roman Urdu":"Pichli mahwaari ki tareekh mustaqbil ki nahi hosakti","English":"LMP cannot be in the future"},"relevant":"selected (${edd_lmp}, 'lmp')","constraint":".<=${today}"},"type":"date","name":"lmp","label":{"Urdu":"پچھلی ماہواری کی تاریخ","Roman Urdu":"Pichli mahwaari ki tareekh","English":"LMP"}},{"bind":{"relevant":"selected (${edd_lmp}, 'ultrasound')"},"type":"date","instance":{"openmrs_entity_id":"163165AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"name":"ultrasound_date","label":{"Urdu":"الٹرا سائونڈ کی تاریخ","English":"Ultrasound Date","Roman Urdu":"Ultrasound ki tareekh"}},{"bind":{"relevant":"selected (${edd_lmp}, 'ultrasound')"},"type":"integer","name":"ultrasound_weeks","label":{"Urdu":"الٹرا سائونڈ کی مدد سے حمل کی مدت [ہفتوں میں]","Roman Urdu":"Ultrasound ki madad se hamal ki muddat (hafton me)","English":"Gestational age determined by ultrasound"}},{"bind":{"calculate":"date(${lmp}+280)"},"type":"calculate","name":"edd_calc_lmp"},{"bind":{"calculate":"date((280-(${ultrasound_weeks}*7)+${ultrasound_date} ))"},"type":"calculate","name":"edd_calc_ultrasound"},{"bind":{"calculate":"format-date(${edd_calc_lmp}, '%Y-%n-%e')"},"type":"calculate","name":"edd_calc_lmp_formatted"},{"bind":{"calculate":"format-date(${edd_calc_ultrasound}, '%Y-%n-%e')"},"type":"calculate","name":"edd_calc_ultrasound_formatted"},{"bind":{"calculate":"date(${edd}-280)"},"type":"calculate","name":"lmp_calc_edd"},{"bind":{"calculate":"date(${ultrasound_date}-(${ultrasound_weeks}*7))"},"type":"calculate","name":"lmp_calc_ultrasound"},{"bind":{"calculate":"format-date(${lmp_calc_edd}, '%Y-%n-%e')"},"type":"calculate","name":"lmp_calc_edd_formatted"},{"bind":{"calculate":"format-date(${lmp_calc_ultrasound}, '%Y-%n-%e')"},"type":"calculate","name":"lmp_calc_ultrasound_formatted"},{"bind":{"calculate":"if(${edd_lmp}='lmp',${edd_calc_lmp_formatted},if(${edd_lmp}='edd',${edd} ,if(${edd_lmp}='ultrasound',${edd_calc_ultrasound_formatted},'')))"},"type":"calculate","name":"final_edd","instance":{"openmrs_entity_id":"5596AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"}},{"bind":{"calculate":"if(${edd_lmp}='lmp',${lmp},if(${edd_lmp}='edd',${lmp_calc_edd_formatted} ,if(${edd_lmp}='ultrasound',${lmp_calc_ultrasound_formatted},'')))"},"type":"calculate","name":"final_lmp","instance":{"openmrs_entity_id":"1427AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"}},{"bind":{"calculate":"int((${vaccination_date} - (${edd}-280))div7)"},"type":"calculate","name":"ga_edd"},{"bind":{"calculate":"int((${vaccination_date} - ${lmp})div7)"},"type":"calculate","name":"ga_lmp"},{"bind":{"calculate":"int((${vaccination_date} -(${ultrasound_date}-(${ultrasound_weeks}*7)))div7)"},"type":"calculate","name":"ga_ult"},{"bind":{"relevant":"selected (${pregnant}, 'yes')"},"type":"note","name":"final_edd_note","label":{"Urdu":"${final_edd}: زچگی کی متوقع تاریخ","Roman Urdu":"Zachgi ki mutawaqqa tareekh: ${final_edd}","English":"EDD: ${final_edd}"}},{"bind":{"relevant":"selected (${pregnant}, 'yes')"},"type":"note","name":"final_lmp_note","label":{"Urdu":"پچھلی ماہواری کی تاریخ :{final_lmp}$","Roman Urdu":"Pichli mahwaari ki tareekh: ${final_lmp}","English":"LMP: ${final_lmp}"}},{"bind":{"calculate":"if(${edd_lmp}='lmp',${ga_lmp},if(${edd_lmp}='edd',${ga_edd} ,if(${edd_lmp}='ultrasound',${ga_ult},'')))"},"type":"calculate","name":"final_ga","instance":{"openmrs_entity_id":"163166AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"}},{"bind":{"relevant":"selected (${pregnant}, 'yes')"},"type":"note","name":"final_ga_note","label":{"Urdu":"حمل کی مُدّت: {final_ga}$ ہفتے","Roman Urdu":"Hamal ki muddat: ${final_ga} weeks","English":"GA: ${final_ga} weeks"}},{"name":"vaccines","choice_filter":"name != if( ${e_tt1} != '', 'TT1' , '') and \nname != if( ${e_tt2} != '', 'TT2' , '') and \nname != if( ${e_tt3} != '', 'TT3' , '') and \nname != if( ${e_tt4} != '', 'TT4' , '') and \nname != if( ${e_tt5} != '', 'TT5' , '')","default":"minimal","label":{"Urdu":"پچھلی تاریخ جب کسی اور سینٹر پر ٹیکہ لگوایا گیا یا قطرے پلائے گئے","Roman Urdu":"Pichli tareekh jab kissi aur center par teeka lagwaya gaya ya katray pilaey gaye","English":"Retro vaccines"},"itemset":"vaccines","instance":{"openmrs_entity":"concept","openmrs_entity_id":"984AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1421AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"select all that apply"},{"bind":{"relevant":"selected(${vaccines},'TT1')","constraint":"(.<=${today} and .<=${existing_client_reg_date})"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"tt1_retro","label":{"Urdu":"ٹی ٹی 1","Roman Urdu":"TT1","English":"TT1"}},{"bind":{"relevant":"selected(${vaccines},'TT1')","calculate":"1"},"type":"calculate","name":"tt_1_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines},'TT2')","constraint":"(.<=${today} and .>=${tt1_retro} and ((selected(${vaccines}, 'TT1'))))"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"tt2_retro","label":{"Urdu":"ٹی ٹی 2","Roman Urdu":"TT2","English":"TT2"}},{"bind":{"relevant":"selected(${vaccines},'TT2')","calculate":"2"},"type":"calculate","name":"tt_2_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines},'TT3')","constraint":"(.<=${today} and .>=${tt2_retro} and ((selected(${vaccines}, 'TT2'))))"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"tt3_retro","label":{"Urdu":"ٹی ٹی 3","Roman Urdu":"TT3","English":"TT3"}},{"bind":{"relevant":"selected(${vaccines},'TT3')","calculate":"3"},"type":"calculate","name":"tt_3_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines},'TT4')","constraint":"(.<=${today} and .>=${tt3_retro} and ((selected(${vaccines}, 'TT3'))))"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"tt4_retro","label":{"Urdu":"ٹی ٹی 4","Roman Urdu":"TT4","English":"TT4"}},{"bind":{"relevant":"selected(${vaccines},'TT4')","calculate":"4"},"type":"calculate","name":"tt_4_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"name":"vaccines_2","choice_filter":"name != if( ${e_tt1} != '', 'TT1' , '') and \nname != if( ${e_tt2} != '', 'TT2' , '') and \nname != if( ${e_tt3} != '', 'TT3' , '') and \nname != if( ${e_tt4} != '', 'TT4' , '') and \nname != if( ${e_tt5} != '', 'TT5' , '') and \nname != if( selected(${vaccines}, 'TT1') , 'TT1', '') and \nname != if( selected(${vaccines}, 'TT2') , 'TT2', '') and \nname != if( selected(${vaccines}, 'TT3') , 'TT3', '') and \nname != if( selected(${vaccines}, 'TT4') , 'TT4', '') and \nname != if( selected(${vaccines}, 'TT5') , 'TT5', '')","bind":{"required":"yes"},"label":{"Urdu":"آج کون کون سی ویکسین دی گئی ہیں؟","Roman Urdu":"Aaj kon kon si vaccine di gai hain?","English":"Vaccine administered today"},"itemset":"vaccines","instance":{"openmrs_entity":"concept","openmrs_entity_id":"984AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1441AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"select all that apply"},{"bind":{"required":"yes"},"type":"date","instance":{"openmrs_entity_id":"encounter_date","openmrs_entity":"encounter"},"name":"vaccination_date","label":{"Urdu":"تاریخ","English":"Vaccination date","Roman Urdu":"Tareekh"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'TT1'),${vaccination_date},'')"},"type":"calculate","name":"tt1","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2},'TT1')","calculate":"1"},"type":"calculate","name":"tt_1_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'TT2'),${vaccination_date},'')"},"type":"calculate","name":"tt2","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2},'TT2')","calculate":"2"},"type":"calculate","name":"tt_2_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'TT3'),${vaccination_date},'')"},"type":"calculate","name":"tt3","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2},'TT3')","calculate":"3"},"type":"calculate","name":"tt_3_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'TT4'),${vaccination_date},'')"},"type":"calculate","name":"tt4","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2},'TT4')","calculate":"4"},"type":"calculate","name":"tt_4_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'TT5'),${vaccination_date},'')"},"type":"calculate","name":"tt5","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2},'TT5')","calculate":"5"},"type":"calculate","name":"tt_5_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"control":{"bodyless":true},"type":"group","children":[{"bind":{"readonly":"true()","calculate":"concat('uuid:', uuid())"},"type":"calculate","name":"instanceID"}],"name":"meta"}]} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/offsite_woman_followup/form.xml b/opensrp-core/src/test/resources/form/offsite_woman_followup/form.xml deleted file mode 100644 index a2f6cb48d4..0000000000 --- a/opensrp-core/src/test/resources/form/offsite_woman_followup/form.xml +++ /dev/null @@ -1,1439 +0,0 @@ -
- - -

دوسرے سینٹر میں رجسٹرڈ خواتین فالواپ رجسٹر - Off Site Woman Follow Up Form

-
-
- - کیا آپ کا گھر کا پتہ بدلا ہے؟ - Kya aap ka ghar ka pata badla hai? - - Has your home address changed? -
- - -
-
-
-
- - کیا خا تون حاملہ ہیں؟ - Kia khatoon haamla hain? - - Is female pregnant? -
- - -
-
-
-
- - کیا آپ کو اپنی پچھلی ماہواری کی تاریخ، زچگی کی متوقع تاریخ، یا الٹرا سائونڈ کا علم ہے؟ - Kya aap ko apni pichli mahwaari ki tareekh, zachgi ki mutawaqqa tareekh ya ultrasound ka ilm hai? - - Do you know your LMP, EDD or last Ultrasound information? -
- - - - -
-
-
-
- - پچھلی تاریخ جب کسی اور سینٹر پر ٹیکہ لگوایا گیا یا قطرے پلائے گئے - Pichli tareekh jab kissi aur center par teeka lagwaya gaya ya katray pilaey gaye - - Retro vaccines -
- - - ٹی ٹی 1 - TT1 - - TT1 - ٹی ٹی 2 - TT2 - - TT2 - ٹی ٹی 3 - TT3 - - TT3 - ٹی ٹی 4 - TT4 - - TT4 - ٹی ٹی 5 - TT5 - - TT5 -
-
-
-
- - آج کون کون سی ویکسین دی گئی ہیں؟ - Aaj kon kon si vaccine di gai hain? - - Vaccine administered today - * -
- - - ٹی ٹی 1 - TT1 - - TT1 - ٹی ٹی 2 - TT2 - - TT2 - ٹی ٹی 3 - TT3 - - TT3 - ٹی ٹی 4 - TT4 - - TT4 - ٹی ٹی 5 - TT5 - - TT5 -
-
-
- -
diff --git a/opensrp-core/src/test/resources/form/offsite_woman_followup/form_definition.json b/opensrp-core/src/test/resources/form/offsite_woman_followup/form_definition.json deleted file mode 100644 index 4353ee25d1..0000000000 --- a/opensrp-core/src/test/resources/form/offsite_woman_followup/form_definition.json +++ /dev/null @@ -1,372 +0,0 @@ -{ - "form_data_definition_version" : "1", - "form" : { - "bind_type" : "pkwoman", - "default_bind_path" : "/model/instance/Offsite_Woman_Followup_Form/", - "fields" : [ { - "name" : "id", - "shouldLoadValue" : true - }, { - "name" : "provider_uc", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/provider_uc", - "shouldLoadValue" : true - }, { - "name" : "provider_town", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/provider_town", - "shouldLoadValue" : true - }, { - "name" : "provider_city", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/provider_city", - "shouldLoadValue" : true - }, { - "name" : "provider_province", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/provider_province", - "shouldLoadValue" : true - }, { - "name" : "existing_landmark", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_landmark", - "shouldLoadValue" : true - }, { - "name" : "existing_house_number", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_house_number", - "shouldLoadValue" : true - }, { - "name" : "existing_street", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_street", - "shouldLoadValue" : true - }, { - "name" : "existing_union_council", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_union_council", - "shouldLoadValue" : true - }, { - "name" : "existing_town", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_town", - "shouldLoadValue" : true - }, { - "name" : "existing_city_village", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_city_village", - "shouldLoadValue" : true - }, { - "name" : "existing_province", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_province", - "shouldLoadValue" : true - }, { - "name" : "existing_union_councilname", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_union_councilname", - "shouldLoadValue" : true - }, { - "name" : "existing_townname", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_townname", - "shouldLoadValue" : true - }, { - "name" : "existing_city_villagename", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_city_villagename", - "shouldLoadValue" : true - }, { - "name" : "existing_provincename", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_provincename", - "shouldLoadValue" : true - }, { - "name" : "existing_first_name", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_first_name", - "shouldLoadValue" : true - }, { - "name" : "existing_last_name", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_last_name", - "shouldLoadValue" : true - }, { - "name" : "existing_father_name", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_father_name", - "shouldLoadValue" : true - }, { - "name" : "existing_husband_name", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_husband_name", - "shouldLoadValue" : true - }, { - "name" : "existing_marriage", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_marriage", - "shouldLoadValue" : true - }, { - "name" : "existing_birthdate", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_calc_dob_confirm", - "shouldLoadValue" : true - }, { - "name" : "existing_gender", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_gender", - "shouldLoadValue" : true - }, { - "name" : "existing_ethnicity", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_ethnicity", - "shouldLoadValue" : true - }, { - "name" : "existing_client_reg_date", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_client_reg_date", - "shouldLoadValue" : true - }, { - "name" : "existing_program_client_id", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_program_client_id", - "shouldLoadValue" : true - }, { - "name" : "existing_epi_card_number", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/existing_epi_card_number", - "shouldLoadValue" : true - }, { - "name" : "e_tt1", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/e_tt1", - "shouldLoadValue" : true - }, { - "name" : "e_tt2", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/e_tt2", - "shouldLoadValue" : true - }, { - "name" : "e_tt3", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/e_tt3", - "shouldLoadValue" : true - }, { - "name" : "e_tt4", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/e_tt4", - "shouldLoadValue" : true - }, { - "name" : "e_tt5", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/e_tt5", - "shouldLoadValue" : true - }, { - "name" : "provider_id", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/provider_id", - "shouldLoadValue" : true - }, { - "name" : "provider_location_id", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/provider_location_id", - "shouldLoadValue" : true - }, { - "name" : "provider_location_name", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/provider_location_name", - "shouldLoadValue" : true - }, { - "name" : "provider_location_note", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/provider_location_note" - }, { - "name" : "start", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/start" - }, { - "name" : "end", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/end" - }, { - "name" : "today", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/today" - }, { - "name" : "deviceid", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/deviceid" - }, { - "name" : "subscriberid", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/subscriberid" - }, { - "name" : "simserial", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/simserial" - }, { - "name" : "phonenumber", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/phonenumber" - }, { - "name" : "client_reg_date_note", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/client_reg_date_note" - }, { - "name" : "program_client_id_note", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/program_client_id_note" - }, { - "name" : "epi_card_number", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/epi_card_number" - }, { - "name" : "first_name_note", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/first_name_note" - }, { - "name" : "last_name_note", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/last_name_note" - }, { - "name" : "client_age", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/client_age" - }, { - "name" : "birth_date_note", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/birth_date_note" - }, { - "name" : "gender_note", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/gender_note" - }, { - "name" : "father_name_note", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/father_name_note" - }, { - "name" : "marriage_note", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/marriage_note" - }, { - "name" : "husband_name_note", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/husband_name_note" - }, { - "name" : "ethnicity_note", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/ethnicity_note" - }, { - "name" : "address", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/address" - }, { - "name" : "address_change", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/address_change" - }, { - "name" : "province", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/province" - }, { - "name" : "city_village", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/city_village" - }, { - "name" : "town", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/town" - }, { - "name" : "union_council", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/union_council" - }, { - "name" : "house_number", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/house_number" - }, { - "name" : "street", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/street" - }, { - "name" : "landmark", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/landmark" - }, { - "name" : "center_gps", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/center_gps" - }, { - "name" : "pregnant", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/pregnant" - }, { - "name" : "edd_lmp", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/edd_lmp" - }, { - "name" : "edd", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/edd" - }, { - "name" : "lmp", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/lmp" - }, { - "name" : "ultrasound_date", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/ultrasound_date" - }, { - "name" : "ultrasound_weeks", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/ultrasound_weeks" - }, { - "name" : "edd_calc_lmp", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/edd_calc_lmp" - }, { - "name" : "edd_calc_ultrasound", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/edd_calc_ultrasound" - }, { - "name" : "edd_calc_lmp_formatted", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/edd_calc_lmp_formatted" - }, { - "name" : "edd_calc_ultrasound_formatted", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/edd_calc_ultrasound_formatted" - }, { - "name" : "lmp_calc_edd", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/lmp_calc_edd" - }, { - "name" : "lmp_calc_ultrasound", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/lmp_calc_ultrasound" - }, { - "name" : "lmp_calc_edd_formatted", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/lmp_calc_edd_formatted" - }, { - "name" : "lmp_calc_ultrasound_formatted", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/lmp_calc_ultrasound_formatted" - }, { - "name" : "final_edd", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/final_edd" - }, { - "name" : "final_lmp", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/final_lmp" - }, { - "name" : "ga_edd", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/ga_edd" - }, { - "name" : "ga_lmp", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/ga_lmp" - }, { - "name" : "ga_ult", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/ga_ult" - }, { - "name" : "final_edd_note", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/final_edd_note" - }, { - "name" : "final_lmp_note", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/final_lmp_note" - }, { - "name" : "final_ga", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/final_ga" - }, { - "name" : "final_ga_note", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/final_ga_note" - }, { - "name" : "vaccines", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/vaccines" - }, { - "name" : "tt1_retro", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt1_retro" - }, { - "name" : "tt_1_dose", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt_1_dose" - }, { - "name" : "tt2_retro", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt2_retro" - }, { - "name" : "tt_2_dose", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt_2_dose" - }, { - "name" : "tt3_retro", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt3_retro" - }, { - "name" : "tt_3_dose", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt_3_dose" - }, { - "name" : "tt4_retro", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt4_retro" - }, { - "name" : "tt_4_dose", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt_4_dose" - }, { - "name" : "vaccines_2", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/vaccines_2" - }, { - "name" : "vaccination_date", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/vaccination_date" - }, { - "name" : "tt1", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt1" - }, { - "name" : "tt_1_dose_today", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt_1_dose_today" - }, { - "name" : "tt2", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt2" - }, { - "name" : "tt_2_dose_today", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt_2_dose_today" - }, { - "name" : "tt3", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt3" - }, { - "name" : "tt_3_dose_today", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt_3_dose_today" - }, { - "name" : "tt4", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt4" - }, { - "name" : "tt_4_dose_today", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt_4_dose_today" - }, { - "name" : "tt5", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt5" - }, { - "name" : "tt_5_dose_today", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/tt_5_dose_today" - }, { - "name" : "instanceID", - "bind" : "/model/instance/Offsite_Woman_Followup_Form/meta/instanceID" - } ] - } -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/offsite_woman_followup/model.xml b/opensrp-core/src/test/resources/form/offsite_woman_followup/model.xml deleted file mode 100644 index 2b5e6a2d81..0000000000 --- a/opensrp-core/src/test/resources/form/offsite_woman_followup/model.xml +++ /dev/null @@ -1,1643 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - ${provider_province} - ${provider_city} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - minimal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - static_instance-provinces-0 - kpk - - - static_instance-provinces-1 - sindh - - - static_instance-provinces-2 - balochistan - - - static_instance-provinces-3 - punjab - - - static_instance-provinces-4 - gilgit_baltistan - - - static_instance-provinces-5 - kashmir - - - static_instance-provinces-6 - fata - - - static_instance-provinces-7 - out_of_country - - - - - - - static_instance-ucs-0 - sindh - karachi - korangi - bilal_colony - - - static_instance-ucs-1 - sindh - karachi - korangi - nasir_colony - - - static_instance-ucs-2 - sindh - karachi - korangi - chakra_goth - - - static_instance-ucs-3 - sindh - karachi - korangi - mustafa_taj_colony - - - static_instance-ucs-4 - sindh - karachi - korangi - hundred_quarters - - - static_instance-ucs-5 - sindh - karachi - korangi - gulzar_colony - - - static_instance-ucs-6 - sindh - karachi - korangi - korangi_sector_33 - - - static_instance-ucs-7 - sindh - karachi - korangi - zaman_town - - - static_instance-ucs-8 - sindh - karachi - korangi - hasrat_mohani_colony - - - static_instance-ucs-9 - sindh - karachi - baldia - gulshan_e_ghazi - - - static_instance-ucs-10 - sindh - karachi - baldia - ittehad_town - - - static_instance-ucs-11 - sindh - karachi - baldia - islam_nagar - - - static_instance-ucs-12 - sindh - karachi - baldia - nai_abadi - - - static_instance-ucs-13 - sindh - karachi - baldia - saeedabad - - - static_instance-ucs-14 - sindh - karachi - baldia - muslim_mujahid_colony - - - static_instance-ucs-15 - sindh - karachi - baldia - muhajir_camp - - - static_instance-ucs-16 - sindh - karachi - baldia - rasheedabad - - - static_instance-ucs-17 - sindh - karachi - bin_qasim - ibrahim_hyderi - - - static_instance-ucs-18 - sindh - karachi - bin_qasim - rehri - - - static_instance-ucs-19 - sindh - karachi - bin_qasim - cattle_colony - - - static_instance-ucs-20 - sindh - karachi - bin_qasim - qaidabad - - - static_instance-ucs-21 - sindh - karachi - bin_qasim - landhi_colony - - - static_instance-ucs-22 - sindh - karachi - bin_qasim - gulshan_e_hadeed - - - static_instance-ucs-23 - sindh - karachi - bin_qasim - gaghar - - - static_instance-ucs-24 - sindh - karachi - gadap - murad_memon_goth - - - static_instance-ucs-25 - sindh - karachi - gadap - darsano_chana - - - static_instance-ucs-26 - sindh - karachi - gadap - gujro - - - static_instance-ucs-27 - sindh - karachi - gadap - songal - - - static_instance-ucs-28 - sindh - karachi - gadap - maymarabad - - - static_instance-ucs-29 - sindh - karachi - gadap - yousuf_goth - - - static_instance-ucs-30 - sindh - karachi - gadap - manghopir - - - static_instance-ucs-31 - sindh - karachi - gulberg - azizabad - - - static_instance-ucs-32 - sindh - karachi - gulberg - karimabad - - - static_instance-ucs-33 - sindh - karachi - gulberg - aisha_manzil - - - static_instance-ucs-34 - sindh - karachi - gulberg - ancholi - - - static_instance-ucs-35 - sindh - karachi - gulberg - naseerabad - - - static_instance-ucs-36 - sindh - karachi - gulberg - yaseenabad - - - static_instance-ucs-37 - sindh - karachi - gulberg - water_pump - - - static_instance-ucs-38 - sindh - karachi - gulberg - shafiq_mill_colony - - - static_instance-ucs-39 - sindh - karachi - gulshan - delhi_mercantile_society - - - static_instance-ucs-40 - sindh - karachi - gulshan - civic_centre - - - static_instance-ucs-41 - sindh - karachi - gulshan - pir_ilahi_buksh_colony - - - static_instance-ucs-42 - sindh - karachi - gulshan - essa_nagri - - - static_instance-ucs-43 - sindh - karachi - gulshan - gulshan_e_iqbal - - - static_instance-ucs-44 - sindh - karachi - gulshan - gillani_railway_station - - - static_instance-ucs-45 - sindh - karachi - gulshan - shanti_nagar - - - static_instance-ucs-46 - sindh - karachi - gulshan - jamali_colony - - - static_instance-ucs-47 - sindh - karachi - gulshan - gulshan_e_iqbal_ii - - - static_instance-ucs-48 - sindh - karachi - gulshan - pehlwan_goth - - - static_instance-ucs-49 - sindh - karachi - gulshan - matrovil_colony - - - static_instance-ucs-50 - sindh - karachi - gulshan - gulzar_e_hijri - - - static_instance-ucs-51 - sindh - karachi - gulshan - safooran_goth - - - static_instance-ucs-52 - sindh - karachi - jamshed - akhtar_colony - - - static_instance-ucs-53 - sindh - karachi - jamshed - manzoor_colony - - - static_instance-ucs-54 - sindh - karachi - jamshed - azam_basti - - - static_instance-ucs-55 - sindh - karachi - jamshed - chanesar_goth - - - static_instance-ucs-56 - sindh - karachi - jamshed - mahmudabad - - - static_instance-ucs-57 - sindh - karachi - jamshed - pechs - - - static_instance-ucs-58 - sindh - karachi - jamshed - pechs_ii - - - static_instance-ucs-59 - sindh - karachi - jamshed - jut_line - - - static_instance-ucs-60 - sindh - karachi - jamshed - central_jacob_lines - - - static_instance-ucs-61 - sindh - karachi - jamshed - jamshed_quarters - - - static_instance-ucs-62 - sindh - karachi - jamshed - garden_east - - - static_instance-ucs-63 - sindh - karachi - jamshed - soldier_bazar - - - static_instance-ucs-64 - sindh - karachi - jamshed - pakistan_quarters - - - static_instance-ucs-65 - sindh - karachi - kiamari - bhutta_village - - - static_instance-ucs-66 - sindh - karachi - kiamari - sultanabad - - - static_instance-ucs-67 - sindh - karachi - kiamari - kiamari_uc - - - static_instance-ucs-68 - sindh - karachi - kiamari - baba_bhit - - - static_instance-ucs-69 - sindh - karachi - kiamari - machar_colony - - - static_instance-ucs-70 - sindh - karachi - kiamari - maripur - - - static_instance-ucs-71 - sindh - karachi - kiamari - shershah - - - static_instance-ucs-72 - sindh - karachi - kiamari - gabo_pat - - - static_instance-ucs-73 - sindh - karachi - landhi - muzafarabad - - - static_instance-ucs-74 - sindh - karachi - landhi - muslimabad - - - static_instance-ucs-75 - sindh - karachi - landhi - dawood_chowrangi - - - static_instance-ucs-76 - sindh - karachi - landhi - moinabad - - - static_instance-ucs-77 - sindh - karachi - landhi - sharafi_goth - - - static_instance-ucs-78 - sindh - karachi - landhi - bhutto_nagar - - - static_instance-ucs-79 - sindh - karachi - landhi - khawaja_ajmeer_colony - - - static_instance-ucs-80 - sindh - karachi - landhi - landhi_uc - - - static_instance-ucs-81 - sindh - karachi - landhi - awami_colony - - - static_instance-ucs-82 - sindh - karachi - landhi - burmee_colony - - - static_instance-ucs-83 - sindh - karachi - landhi - korangi_uc - - - static_instance-ucs-84 - sindh - karachi - landhi - sherabad - - - static_instance-ucs-85 - sindh - karachi - liaquatabad - rizvia_society - - - static_instance-ucs-86 - sindh - karachi - liaquatabad - firdous_colony - - - static_instance-ucs-87 - sindh - karachi - liaquatabad - super_market - - - static_instance-ucs-88 - sindh - karachi - liaquatabad - dak_khana - - - static_instance-ucs-89 - sindh - karachi - liaquatabad - qasimabad - - - static_instance-ucs-90 - sindh - karachi - liaquatabad - bandhani_colony - - - static_instance-ucs-91 - sindh - karachi - liaquatabad - sharifabad - - - static_instance-ucs-92 - sindh - karachi - liaquatabad - commercial_area - - - static_instance-ucs-93 - sindh - karachi - liaquatabad - mujahid_colony - - - static_instance-ucs-94 - sindh - karachi - liaquatabad - nazimabad - - - static_instance-ucs-95 - sindh - karachi - liaquatabad - abbasi_shaheed - - - static_instance-ucs-96 - sindh - karachi - lyari - agra_taj_colony - - - static_instance-ucs-97 - sindh - karachi - lyari - daryaabad - - - static_instance-ucs-98 - sindh - karachi - lyari - nawabad - - - static_instance-ucs-99 - sindh - karachi - lyari - khada_memon_society - - - static_instance-ucs-100 - sindh - karachi - lyari - baghdadi - - - static_instance-ucs-101 - sindh - karachi - lyari - shah_baig_line - - - static_instance-ucs-102 - sindh - karachi - lyari - bihar_colony - - - static_instance-ucs-103 - sindh - karachi - lyari - ragiwara - - - static_instance-ucs-104 - sindh - karachi - lyari - singo_line - - - static_instance-ucs-105 - sindh - karachi - lyari - chakiwara - - - static_instance-ucs-106 - sindh - karachi - lyari - allama_iqbal_colony - - - static_instance-ucs-107 - sindh - karachi - malir - model_colony - - - static_instance-ucs-108 - sindh - karachi - malir - kala_board - - - static_instance-ucs-109 - sindh - karachi - malir - saudabad - - - static_instance-ucs-110 - sindh - karachi - malir - khokhra_par - - - static_instance-ucs-111 - sindh - karachi - malir - jafar_e_tayyar - - - static_instance-ucs-112 - sindh - karachi - malir - gharibabad - - - static_instance-ucs-113 - sindh - karachi - malir - ghazi_brohi_goth - - - static_instance-ucs-114 - sindh - karachi - new_karachi - kalyana - - - static_instance-ucs-115 - sindh - karachi - new_karachi - sir_syed_colony - - - static_instance-ucs-116 - sindh - karachi - new_karachi - fatima_jinnah_colony - - - static_instance-ucs-117 - sindh - karachi - new_karachi - godhra - - - static_instance-ucs-118 - sindh - karachi - new_karachi - abu_zar_ghaffari - - - static_instance-ucs-119 - sindh - karachi - new_karachi - hakim_ahsan - - - static_instance-ucs-120 - sindh - karachi - new_karachi - madina_colony - - - static_instance-ucs-121 - sindh - karachi - new_karachi - faisal_colony - - - static_instance-ucs-122 - sindh - karachi - new_karachi - khamiso_goth - - - static_instance-ucs-123 - sindh - karachi - new_karachi - mustufa_colony - - - static_instance-ucs-124 - sindh - karachi - new_karachi - khawaja_ajmeer_nagri - - - static_instance-ucs-125 - sindh - karachi - new_karachi - gulshan_e_saeed - - - static_instance-ucs-126 - sindh - karachi - new_karachi - shah_nawaz_bhutto_colony - - - static_instance-ucs-127 - sindh - karachi - north_nazimabad - paposh_nagar - - - static_instance-ucs-128 - sindh - karachi - north_nazimabad - pahar_ganj - - - static_instance-ucs-129 - sindh - karachi - north_nazimabad - khandu_goth - - - static_instance-ucs-130 - sindh - karachi - north_nazimabad - hyderi - - - static_instance-ucs-131 - sindh - karachi - north_nazimabad - sakhi_hassan - - - static_instance-ucs-132 - sindh - karachi - north_nazimabad - farooq_e_azam - - - static_instance-ucs-133 - sindh - karachi - north_nazimabad - nusrat_bhutto_colony - - - static_instance-ucs-134 - sindh - karachi - north_nazimabad - shadman_town - - - static_instance-ucs-135 - sindh - karachi - north_nazimabad - buffer_zone - - - static_instance-ucs-136 - sindh - karachi - north_nazimabad - buffer_zone_ii - - - static_instance-ucs-137 - sindh - karachi - orangi - mominabad - - - static_instance-ucs-138 - sindh - karachi - orangi - haryana_colony - - - static_instance-ucs-139 - sindh - karachi - orangi - hanifabad - - - static_instance-ucs-140 - sindh - karachi - orangi - mohammad_nagar - - - static_instance-ucs-141 - sindh - karachi - orangi - madina_colony_orangi - - - static_instance-ucs-142 - sindh - karachi - orangi - ghaziabad - - - static_instance-ucs-143 - sindh - karachi - orangi - chisti_nagar - - - static_instance-ucs-144 - sindh - karachi - orangi - bilal_colony_orangi - - - static_instance-ucs-145 - sindh - karachi - orangi - iqbal_baloch_colony - - - static_instance-ucs-146 - sindh - karachi - orangi - ghabool_town - - - static_instance-ucs-147 - sindh - karachi - orangi - data_nagar - - - static_instance-ucs-148 - sindh - karachi - orangi - mujahidabad - - - static_instance-ucs-149 - sindh - karachi - orangi - baloch_goth - - - static_instance-ucs-150 - sindh - karachi - saddar - old_haji_camp - - - static_instance-ucs-151 - sindh - karachi - saddar - garden - - - static_instance-ucs-152 - sindh - karachi - saddar - kharadar - - - static_instance-ucs-153 - sindh - karachi - saddar - city_railway_colony - - - static_instance-ucs-154 - sindh - karachi - saddar - nanak_wara - - - static_instance-ucs-155 - sindh - karachi - saddar - gazdarabad - - - static_instance-ucs-156 - sindh - karachi - saddar - millat_nagar_islam_pura - - - static_instance-ucs-157 - sindh - karachi - saddar - saddar_uc - - - static_instance-ucs-158 - sindh - karachi - saddar - civil_line - - - static_instance-ucs-159 - sindh - karachi - saddar - clifton - - - static_instance-ucs-160 - sindh - karachi - saddar - kehkashan - - - static_instance-ucs-161 - sindh - karachi - shah_faisal - natha_khan_goth - - - static_instance-ucs-162 - sindh - karachi - shah_faisal - pak_sadat_colony - - - static_instance-ucs-163 - sindh - karachi - shah_faisal - drigh_colony - - - static_instance-ucs-164 - sindh - karachi - shah_faisal - raita_plot - - - static_instance-ucs-165 - sindh - karachi - shah_faisal - moria_khan_goth - - - static_instance-ucs-166 - sindh - karachi - shah_faisal - rafa_e_aam_society - - - static_instance-ucs-167 - sindh - karachi - shah_faisal - al_falah_society - - - static_instance-ucs-168 - sindh - karachi - site - pak_colony - - - static_instance-ucs-169 - sindh - karachi - site - old_golimar - - - static_instance-ucs-170 - sindh - karachi - site - jahanabad - - - static_instance-ucs-171 - sindh - karachi - site - metrovil - - - static_instance-ucs-172 - sindh - karachi - site - bhawani_chali - - - static_instance-ucs-173 - sindh - karachi - site - frontier_colony - - - static_instance-ucs-174 - sindh - karachi - site - banaras_colony - - - static_instance-ucs-175 - sindh - karachi - site - qasba_colony - - - static_instance-ucs-176 - sindh - karachi - site - islamia_colony - - - static_instance-ucs-177 - na - na - na - other - - - static_instance-ucs-178 - na - na - na - not_applicable - - - - - - - static_instance-gender-0 - male - - - static_instance-gender-1 - female - - - static_instance-gender-2 - transgender - - - - - - - static_instance-vaccines-0 - TT1 - - - static_instance-vaccines-1 - TT2 - - - static_instance-vaccines-2 - TT3 - - - static_instance-vaccines-3 - TT4 - - - static_instance-vaccines-4 - TT5 - - - - - - - static_instance-towns-0 - sindh - karachi - korangi - - - static_instance-towns-1 - sindh - karachi - landhi - - - static_instance-towns-2 - sindh - karachi - baldia - - - static_instance-towns-3 - sindh - karachi - bin_qasim - - - static_instance-towns-4 - sindh - karachi - gadap - - - static_instance-towns-5 - sindh - karachi - gulberg - - - static_instance-towns-6 - sindh - karachi - gulshan - - - static_instance-towns-7 - sindh - karachi - jamshed - - - static_instance-towns-8 - sindh - karachi - kiamari - - - static_instance-towns-9 - sindh - karachi - liaquatabad - - - static_instance-towns-10 - sindh - karachi - lyari - - - static_instance-towns-11 - sindh - karachi - malir - - - static_instance-towns-12 - sindh - karachi - new_karachi - - - static_instance-towns-13 - sindh - karachi - north_nazimabad - - - static_instance-towns-14 - sindh - karachi - orangi - - - static_instance-towns-15 - sindh - karachi - saddar - - - static_instance-towns-16 - sindh - karachi - shah_faisal - - - static_instance-towns-17 - sindh - karachi - site - - - static_instance-towns-18 - na - na - other - - - static_instance-towns-19 - na - na - not_applicable - - - - - - - static_instance-cities-0 - sindh - karachi - - - static_instance-cities-1 - punjab - hafizabad - - - static_instance-cities-2 - punjab - muzaffargarh - - - static_instance-cities-3 - na - other - - - static_instance-cities-4 - na - not_applicable - - - - - - - static_instance-edd_lmp-0 - edd - - - static_instance-edd_lmp-1 - lmp - - - static_instance-edd_lmp-2 - ultrasound - - - static_instance-edd_lmp-3 - none - - - - - - - static_instance-yes_no-0 - yes - - - static_instance-yes_no-1 - no - - - - diff --git a/opensrp-core/src/test/resources/form/pnc_1st_registration/form.json b/opensrp-core/src/test/resources/form/pnc_1st_registration/form.json deleted file mode 100644 index ac61605e10..0000000000 --- a/opensrp-core/src/test/resources/form/pnc_1st_registration/form.json +++ /dev/null @@ -1,373 +0,0 @@ -{ - "name": "pnc_first_registration_motherdetails", - "title": "PNC Registration", - "sms_keyword": "pnc_1st_registration", - "default_language": "default", - "instance": { - "encounter_type": "PNC Registration" - }, - "version": "201504011203", - "id_string": "pnc_1st_registration", - "type": "survey", - "children": [ - { - "instance": { - "openmrs_entity_id": "location_id", - "openmrs_entity": "encounter" - }, - "type": "text", - "name": "location", - "label": "Location" - }, - { - "instance": { - "openmrs_entity_id": "encounter_date", - "openmrs_entity": "encounter" - }, - "type": "today", - "name": "today" - }, - { - "instance": { - "openmrs_entity_id": "encounter_start", - "openmrs_entity": "encounter" - }, - "type": "start", - "name": "start" - }, - { - "instance": { - "openmrs_entity_id": "encounter_end", - "openmrs_entity": "encounter" - }, - "type": "end", - "name": "end" - }, - { - "instance": { - "openmrs_entity_id": "OpenSRPID", - "openmrs_entity": "person_identifier" - }, - "type": "integer", - "name": "mother_id", - "label": "Mother ID number:" - }, - { - "name": "gender", - "bind": { - "required": "yes" - }, - "label": "Gender? ಮಗುವಿನ ಲಿಂಗ?", - "instance": { - "openmrs_entity_id": "gender", - "openmrs_entity": "person" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1534AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "male", - "label": "Male ಗಂಡು" - }, - { - "instance": { - "openmrs_code": "1535AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "female", - "label": "Female ಹೆಣ್ಣು" - } - ] - }, - { - "instance": { - "openmrs_entity_id": "birthdate", - "openmrs_entity": "person" - }, - "type": "date", - "name": "mother_birthdate", - "label": "Mother's DOB?" - }, - { - "instance": { - "openmrs_entity_id": "first_name", - "openmrs_entity": "person" - }, - "type": "text", - "name": "mother_first_name", - "label": "Mother's first name?" - }, - { - "instance": { - "openmrs_entity_id": "last_name", - "openmrs_entity": "person" - }, - "type": "text", - "name": "mother_last_name", - "label": "Mother's last name?" - }, - { - "bind": { - "required": "yes", - "constraint": ".<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity_id": "5599AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "name": "delivery_date", - "label": "Delivery date? ಹೆರಿಗೆ ದಿನಾಂಕ?" - }, - { - "instance": { - "openmrs_entity_id": "162724AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "text", - "name": "delivery_facility_name", - "label": "Name of delivery facility? ಹೆರಿಗೆಯಾದ ಸ್ಥಳದ ಹೆಸರು?" - }, - { - "name": "delivery_skilled", - "bind": { - "required": "yes" - }, - "label": "Delivery attended by SBA? ತರಬೇತಿ ಹೊಂದಿದ ಹೆರಿಗೆ ಸಹಾಯಕರು ಹೆರಿಗೆಯಲ್ಲಿ ಹಾಜರಿದ್ದರೆ?", - "instance": { - "openmrs_entity_id": "160083AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "yes", - "label": "Yes ಹೌದು" - }, - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "no", - "label": "No ಇಲ್ಲ" - } - ] - }, - { - "instance": { - "openmrs_entity_id": "5630AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "label": "Type of delivery? ಯಾವ ವಿಧದ ಹೆರಿಗೆ?", - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1170AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "normal", - "label": "Normal ಸಾಮಾನ್ಯ" - }, - { - "instance": { - "openmrs_code": "1171AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "cesarean", - "label": "Cesarean ಸಿಸೇರಿಯನ್" - }, - { - "instance": { - "openmrs_code": "118159AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "instrumental_forcep", - "label": "Instrumental / Forcep ಉಪಕರಣಗಳಿಂದ ಮಾಡುವ ಹೆರಿಗೆ" - } - ], - "name": "delivery_type" - }, - { - "name": "delivery_outcome", - "bind": { - "required": "yes" - }, - "label": "Delivery outcome? ಹೆರಿಗೆ ಫಲಿತಾಂಶವೇನು?", - "instance": { - "openmrs_entity_id": "159917AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "151849AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "live_birth", - "label": "Live Birth ಜೀವಂತ ಜನನ" - }, - { - "instance": { - "openmrs_code": "125872AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "still_birth", - "label": "Still Birth ನಿರ್ಜೀವ ಜನನ" - } - ] - }, - { - "instance": { - "openmrs_entity_id": "1053AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "int", - "name": "parity", - "label": "Parity" - }, - { - "bind": { - "relevant": "${delivery_outcome} = 'live_birth'" - }, - "type": "int", - "instance": { - "openmrs_entity_id": "160601AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "name": "num_livebirths", - "label": "Live births" - }, - { - "bind": { - "relevant": "${delivery_outcome} = 'still_birth'" - }, - "type": "int", - "instance": { - "openmrs_entity_id": "160077AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "name": "num_stillbirths", - "label": "Still births" - }, - { - "instance": { - "openmrs_entity_id": "1576AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "label": "What delivery complications were there? ಯಾವ ಹೆರಿಗೆ ತೊಂದರೆಗಳು ಉಂಟಾದವು?", - "type": "select all that apply", - "children": [ - { - "instance": { - "openmrs_code": "230AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "hemorrhage", - "label": "Hemorrhage ರಕ್ತಸ್ರಾವ" - }, - { - "instance": { - "openmrs_code": "114127AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "placenta_previa", - "label": "Placenta previa ಹಿಂದಿನ ಗರ್ಭದಲ್ಲಿ ಮಾಸು ಮುಂದಿರುವುದು" - }, - { - "instance": { - "openmrs_code": "128420AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "cord_prolapse", - "label": "Cord prolapse ಬಳ್ಳಿಯ ಸರಿತ" - }, - { - "instance": { - "openmrs_code": "115036AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "prolonged_labor", - "label": "Prolonged / obstructed labor ದೀರ್ಘಕಾಲೀನ / ಅಡಚಣೆಯನ್ನು ತಂದೊಡ್ಡುವ ಹೆರಿಗೆ ನೋವು" - }, - { - "instance": { - "openmrs_code": "1172AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "abnormal_presentation", - "label": "Abnormal presentation ಅಪಸಾಮಾನ್ಯ ಪ್ರಸ್ತುತಿ" - }, - { - "instance": { - "openmrs_code": "126886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "perineal_tear_2nd_degree", - "label": "Perineal tear (2 degree)" - }, - { - "instance": { - "openmrs_code": "124857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "perineal_tear_3rd_degree", - "label": "Perineal tear (3 degree)" - }, - { - "instance": { - "openmrs_code": "39911AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "perineal_tear_4th_degree", - "label": "Perineal tear (4 degree)" - }, - { - "instance": { - "openmrs_code": "120222AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "others", - "label": "Others ಇತರೆ" - } - ], - "name": "complications" - }, - { - "name": "woman_survived", - "bind": { - "required": "yes" - }, - "label": "Woman survived childbirth? ಮಗುವಿನ ಜನನದ ನಂತರ ಮಹಿಳೆ ಬದುಕುಳಿದರೆ?", - "instance": { - "openmrs_entity_id": "134612AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "yes", - "label": "Yes ಹೌದು" - }, - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "no", - "label": "No ಇಲ್ಲ" - } - ] - }, - { - "control": { - "bodyless": true - }, - "type": "group", - "children": [ - { - "bind": { - "readonly": "true()", - "calculate": "concat('uuid:', uuid())" - }, - "type": "calculate", - "name": "instanceID" - } - ], - "name": "meta" - } - ] -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/pnc_1st_registration/form.xml b/opensrp-core/src/test/resources/form/pnc_1st_registration/form.xml deleted file mode 100644 index d9501c2e3c..0000000000 --- a/opensrp-core/src/test/resources/form/pnc_1st_registration/form.xml +++ /dev/null @@ -1,29 +0,0 @@ - -
-

PNC Registration

- - - - -
Gender? ಮಗುವಿನ ಲಿಂಗ?* -
- - - - - -
Delivery attended by SBA? ತರಬೇತಿ ಹೊಂದಿದ ಹೆರಿಗೆ ಸಹಾಯಕರು ಹೆರಿಗೆಯಲ್ಲಿ ಹಾಜರಿದ್ದರೆ?* -
-
Type of delivery? ಯಾವ ವಿಧದ ಹೆರಿಗೆ? -
-
Delivery outcome? ಹೆರಿಗೆ ಫಲಿತಾಂಶವೇನು?* -
- - - -
What delivery complications were there? ಯಾವ ಹೆರಿಗೆ ತೊಂದರೆಗಳು ಉಂಟಾದವು? -
-
Woman survived childbirth? ಮಗುವಿನ ಜನನದ ನಂತರ ಮಹಿಳೆ ಬದುಕುಳಿದರೆ?* -
- -
XML to HTML transformation for form took 0.03 secondsThis validation is yet not functional.
diff --git a/opensrp-core/src/test/resources/form/pnc_1st_registration/form_definition.json b/opensrp-core/src/test/resources/form/pnc_1st_registration/form_definition.json deleted file mode 100644 index f715275a86..0000000000 --- a/opensrp-core/src/test/resources/form/pnc_1st_registration/form_definition.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "form_data_definition_version": "1", - "form": { - "default_bind_path": "/model/instance/pnc_first_registration_motherdetails", - "bind_type": "demo_mother", - "fields": [ - { - "name":"id", - "shouldLoadValue": true - }, - { - "name": "location", - "bind": "/model/instance/pnc_first_registration_motherdetails/location" - }, - { - "name": "today", - "bind": "/model/instance/pnc_first_registration_motherdetails/today" - }, - { - "name": "start", - "bind": "/model/instance/pnc_first_registration_motherdetails/start" - }, - { - "name": "end", - "bind": "/model/instance/pnc_first_registration_motherdetails/end" - }, - { - "name": "mother_id", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_id" - }, - { - "name": "gender", - "bind": "/model/instance/pnc_first_registration_motherdetails/gender" - }, - { - "name": "mother_birthdate", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_birthdate" - }, - { - "name": "mother_first_name", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_first_name" - }, - { - "name": "mother_last_name", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_last_name" - }, - { - "name": "delivery_date", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_date" - }, - { - "name": "delivery_facility_name", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_facility_name" - }, - { - "name": "delivery_skilled", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_skilled" - }, - { - "name": "delivery_type", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_type" - }, - { - "name": "delivery_outcome", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_outcome" - }, - { - "name": "parity", - "bind": "/model/instance/pnc_first_registration_motherdetails/parity" - }, - { - "name": "num_livebirths", - "bind": "/model/instance/pnc_first_registration_motherdetails/num_livebirths" - }, - { - "name": "num_stillbirths", - "bind": "/model/instance/pnc_first_registration_motherdetails/num_stillbirths" - }, - { - "name": "complications", - "bind": "/model/instance/pnc_first_registration_motherdetails/complications" - }, - { - "name": "woman_survived", - "bind": "/model/instance/pnc_first_registration_motherdetails/woman_survived" - } - ] - } -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/pnc_1st_registration/form_submission.json b/opensrp-core/src/test/resources/form/pnc_1st_registration/form_submission.json deleted file mode 100644 index 7cdcb1c63b..0000000000 --- a/opensrp-core/src/test/resources/form/pnc_1st_registration/form_submission.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "anmId": "admin", - "clientVersion": "1426830449320", - "entityId": "b716d938-1aea-40ae-a081-9ddddddcccc9", - "formDataDefinitionVersion": "5", - "formName": "pnc_1st_registration", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "default_bind_path": "/model/instance/pnc_first_registration_motherdetails", - "bind_type": "demo_mother", - "fields": [ - { - "name": "id", - "shouldLoadValue": true, - "source": "demo_mother.id", - "value": "aec8e1a5-ab11-47ac-8bc0-ff1e7146e342" - }, - { - "name": "location", - "bind": "/model/instance/pnc_first_registration_motherdetails/location", - "source": "demo_mother.location", - "value": "testloc" - }, - { - "name": "today", - "bind": "/model/instance/pnc_first_registration_motherdetails/today", - "source": "demo_mother.today", - "value": "2015-04-02" - }, - { - "name": "start", - "bind": "/model/instance/pnc_first_registration_motherdetails/start", - "source": "demo_mother.start", - "value": "2015-04-02T04:49:16.000-00:00" - }, - { - "name": "end", - "bind": "/model/instance/pnc_first_registration_motherdetails/end", - "source": "demo_mother.end", - "value": "2015-04-02T04:49:16.000-00:00" - }, - { - "name": "mother_id", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_id", - "source": "demo_mother.mother_id", - "value": "234" - }, - { - "name": "gender", - "bind": "/model/instance/pnc_first_registration_motherdetails/gender", - "source": "demo_mother.gender", - "value": "male" - }, - { - "name": "mother_birthdate", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_birthdate", - "source": "demo_mother.mother_birthdate", - "value": "1989-01-31" - }, - { - "name": "mother_first_name", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_first_name", - "source": "demo_mother.mother_first_name", - "value": "jamila" - }, - { - "name": "mother_last_name", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_last_name", - "source": "demo_mother.mother_last_name", - "value": "rashid" - }, - { - "name": "delivery_date", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_date", - "source": "demo_mother.delivery_date", - "value": "2015-04-01" - }, - { - "name": "delivery_facility_name", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_facility_name", - "source": "demo_mother.delivery_facility_name", - "value": "moghbazar health center" - }, - { - "name": "delivery_skilled", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_skilled", - "source": "demo_mother.delivery_skilled", - "value": "yes" - }, - { - "name": "delivery_type", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_type", - "source": "demo_mother.delivery_type", - "value": "normal" - }, - { - "name": "delivery_outcome", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_outcome", - "source": "demo_mother.delivery_outcome", - "value": "live_birth" - }, - { - "name": "parity", - "bind": "/model/instance/pnc_first_registration_motherdetails/parity", - "source": "demo_mother.parity", - "value": "1" - }, - { - "name": "num_livebirths", - "bind": "/model/instance/pnc_first_registration_motherdetails/num_livebirths", - "source": "demo_mother.num_livebirths", - "value": "1" - }, - { - "name": "num_stillbirths", - "bind": "/model/instance/pnc_first_registration_motherdetails/num_stillbirths", - "source": "demo_mother.num_stillbirths" - }, - { - "name": "complications", - "bind": "/model/instance/pnc_first_registration_motherdetails/complications", - "source": "demo_mother.complications", - "value": "hemorrhage" - }, - { - "name": "woman_survived", - "bind": "/model/instance/pnc_first_registration_motherdetails/woman_survived", - "source": "demo_mother.woman_survived", - "value": "yes" - } - ] - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/pnc_1st_registration/model.xml b/opensrp-core/src/test/resources/form/pnc_1st_registration/model.xml deleted file mode 100644 index 02529770ad..0000000000 --- a/opensrp-core/src/test/resources/form/pnc_1st_registration/model.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/pnc_reg_form/form.json b/opensrp-core/src/test/resources/form/pnc_reg_form/form.json deleted file mode 100644 index 5fd76f37d0..0000000000 --- a/opensrp-core/src/test/resources/form/pnc_reg_form/form.json +++ /dev/null @@ -1,1381 +0,0 @@ -{ - "default_language": "default", - "id_string": "Delivery_Outcome_EngKan", - "children": [ - { - "name": "today", - "type": "today" - }, - { - "name": "case_lmp", - "instance": { - "openmrs_entity_id": "1100282", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "delivery_date", - "bind": { - "required": "yes", - "constraint": ".<=${today}" - }, - "label": "Delivery date? ಹೆರಿಗೆ ದಿನಾಂಕ?", - "instance": { - "openmrs_entity_id": "2129182", - "openmrs_entity": "concept" - }, - "type": "date" - }, - { - "name": "delivery_reg_date", - "bind": { - "required": "yes", - "constraint": ".<=${today} and .>= ${delivery_date}" - }, - "label": "PNC registration date? ಬಾಣಂತಿ ದಾಖಲಾತಿ ದಿನಾಂಕ?", - "instance": { - "openmrs_entity_id": "encounter_date", - "openmrs_entity": "encounter" - }, - "type": "date" - }, - { - "children": [ - { - "name": "home", - "label": "Home ಮನೆ", - "instance": { - "openmrs_code": "32323213" - } - }, - { - "name": "subcenter", - "label": "Sub Center ಉಪ ಕೇಂದ್ರ", - "instance": { - "openmrs_code": "2321321" - } - }, - { - "name": "phc", - "label": "PHC ಪ್ರಾಥಮಿಕ ಆರೋಗ್ಯ ಕೇಂದ್ರ", - "instance": { - "openmrs_code": "323213" - } - }, - { - "name": "chc", - "label": "CHC ಸಮುದಾಯ ಆರೋಗ್ಯ ಕೇಂದ್ರ", - "instance": { - "openmrs_code": "1213213" - } - }, - { - "name": "sdh", - "label": "SDH ಉಪ ಜಿಲ್ಲಾ ಆಸ್ಪತ್ರೆ", - "instance": { - "openmrs_code": "23123" - } - }, - { - "name": "dh", - "label": "DH ಜಿಲ್ಲಾ ಆಸ್ಪತ್ರೆ", - "instance": { - "openmrs_code": "232113" - } - }, - { - "name": "private_facility", - "label": "Private ಖಾಸಗಿ", - "instance": { - "openmrs_code": "123123" - } - } - ], - "name": "place_delivery", - "bind": { - "required": "yes" - }, - "label": "Place of delivery? ಹೆರಿಗೆಯಾದ ಸ್ಥಳ?", - "instance": { - "openmrs_entity_id": "location_id", - "openmrs_entity": "encounter" - }, - "type": "select one" - }, - { - "name": "name_delivery_facility", - "bind": { - "relevant": "${place_delivery} != 'home'" - }, - "label": "Name of delivery place? ಹೆರಿಗೆಯಾದ ಸ್ಥಳದ ಹೆಸರು?", - "instance": { - "openmrs_entity_id": "4787232", - "openmrs_entity": "concept" - }, - "type": "text" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "only_delivery_facility", - "label": "Is this the only place woman went for delivery? ಹೆರಿಗೆಗೆ ಇದೊಂದೆ ಸ್ಥಳಕ್ಕೆ ಹೋಗಿದ್ದರೆ?", - "instance": { - "openmrs_entity_id": "120009", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "home", - "label": "Home ಮನೆ", - "instance": { - "openmrs_code": "32323213" - } - }, - { - "name": "subcenter", - "label": "Sub Center ಉಪ ಕೇಂದ್ರ", - "instance": { - "openmrs_code": "2321321" - } - }, - { - "name": "phc", - "label": "PHC ಪ್ರಾಥಮಿಕ ಆರೋಗ್ಯ ಕೇಂದ್ರ", - "instance": { - "openmrs_code": "323213" - } - }, - { - "name": "chc", - "label": "CHC ಸಮುದಾಯ ಆರೋಗ್ಯ ಕೇಂದ್ರ", - "instance": { - "openmrs_code": "1213213" - } - }, - { - "name": "sdh", - "label": "SDH ಉಪ ಜಿಲ್ಲಾ ಆಸ್ಪತ್ರೆ", - "instance": { - "openmrs_code": "23123" - } - }, - { - "name": "dh", - "label": "DH ಜಿಲ್ಲಾ ಆಸ್ಪತ್ರೆ", - "instance": { - "openmrs_code": "232113" - } - }, - { - "name": "private_facility", - "label": "Private ಖಾಸಗಿ", - "instance": { - "openmrs_code": "123123" - } - } - ], - "name": "addl_delivery_facility", - "bind": { - "relevant": "${only_delivery_facility} = 'no'" - }, - "label": "Where else did she go for delivery? ಹೆರಿಗೆಗೆ ಇನ್ಯಾವ ಸ್ಥಳಕ್ಕೆ ಹೋಗಿದ್ದರೆ?", - "instance": { - "openmrs_entity_id": "124433", - "openmrs_entity": "concept" - }, - "type": "select all that apply" - }, - { - "children": [ - { - "name": "no_staff", - "label": "No staff available for delivery ಹೆರಿಗೆಗೆ ಸಿಬ್ಬಂಧಿಯು ಲಭ್ಯವಿಲ್ಲ", - "instance": { - "openmrs_code": "4123" - } - }, - { - "name": "referred_higher_facility", - "label": "Referred to higher facility ಹೆಚ್ಚಿನ ಸೌಲಭ್ಯಕ್ಕೆ ರೆಫರ್ ಮಾಡಲಾಗಿದೆ", - "instance": { - "openmrs_code": "21312312" - } - }, - { - "name": "lack_of_supplies", - "label": "Lack of supplies ಸರಬರಾಜು ಕೊರತೆ", - "instance": { - "openmrs_code": "134134" - } - }, - { - "name": "no_electricity", - "label": "No electricity ವಿದ್ಯುತ್ ಇಲ್ಲ", - "instance": { - "openmrs_code": "34134134" - } - }, - { - "name": "family_insisted_elsewhere", - "label": "Family insisted on going elsewhere ಕುಟುಂಬಕ್ಕೆ ಬೇರೇಡೆಗೆ ಹೋಗಲು ಒತ್ತಾಯಿಸಿದರು", - "instance": { - "openmrs_code": "341341" - } - }, - { - "name": "no_money", - "label": "Not enough money ಸಾಕಷ್ಟು ಹಣವಿಲ್ಲ", - "instance": { - "openmrs_code": "43434432" - } - }, - { - "name": "others", - "label": "Others ಇತರೆ", - "instance": { - "openmrs_code": "323243224" - } - } - ], - "name": "reasons_addl_delivery_facility", - "bind": { - "relevant": "${only_delivery_facility} = 'no'" - }, - "label": "Select the reasons why more than one place. ಬೇರೆ ಸ್ಥಳಕ್ಕೆ ಹೋಗಿದ್ದಕ್ಕೆ ಕಾರಣವನ್ನು ಆಯ್ಕೆ ಮಾಡಿ.", - "instance": { - "openmrs_entity_id": "100933", - "openmrs_entity": "concept" - }, - "type": "select all that apply" - }, - { - "name": "other_reasons_addl_delivery_facility", - "bind": { - "relevant": "selected(${reasons_addl_delivery_facility}, 'others')" - }, - "label": "Others ಇತರೆ:", - "instance": { - "openmrs_entity_id": "2323233", - "openmrs_entity": "concept" - }, - "type": "text" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "skilled_delivery", - "bind": { - "relevant": "${place_delivery} = 'home'", - "required": "yes" - }, - "label": "Delivery attended by SBA? ತರಬೇತಿ ಹೊಂದಿದ ಹೆರಿಗೆ ಸಹಾಯಕರು ಹೆರಿಗೆಯಲ್ಲಿ ಹಾಜರಿದ್ದರೆ?", - "instance": { - "openmrs_entity_id": "3231212", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "normal", - "label": "Normal ಸಾಮಾನ್ಯ", - "instance": { - "openmrs_code": "43123" - } - }, - { - "name": "cesarean", - "label": "Cesarean ಸಿಸೇರಿಯನ್", - "instance": { - "openmrs_code": "3232" - } - }, - { - "name": "instrumental_forcep", - "label": "Instrumental / Forcep ಉಪಕರಣಗಳಿಂದ ಮಾಡುವ ಹೆರಿಗೆ", - "instance": { - "openmrs_code": "4134123" - } - } - ], - "name": "type_delivery", - "label": "Type of delivery? ಯಾವ ವಿಧದ ಹೆರಿಗೆ?", - "instance": { - "openmrs_entity_id": "120009", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "live_birth", - "label": "Live Birth ಜೀವಂತ ಜನನ", - "instance": { - "openmrs_code": "38493849" - } - }, - { - "name": "still_birth", - "label": "Still Birth ನಿರ್ಜೀವ ಜನನ", - "instance": { - "openmrs_code": "343434" - } - } - ], - "name": "delivery_outcome", - "bind": { - "required": "yes" - }, - "label": "Delivery outcome? ಹೆರಿಗೆ ಫಲಿತಾಂಶವೇನು?", - "instance": { - "openmrs_entity_id": "124433", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "name": "case_parity", - "instance": { - "openmrs_entity_id": "100933", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "parity", - "bind": { - "calculate": "${case_parity} + 1" - }, - "instance": { - "openmrs_entity_id": "434343", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "case_num_livebirths", - "instance": { - "openmrs_entity_id": "34324234", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "num_livebirths", - "bind": { - "relevant": "${delivery_outcome} = 'live_birth'", - "calculate": "${case_num_livebirths} + 1" - }, - "instance": { - "openmrs_entity_id": "3423423", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "youngestchild_date_of_birth", - "bind": { - "relevant": "${delivery_outcome} = 'live_birth'", - "calculate": "${delivery_date}" - }, - "instance": { - "openmrs_entity_id": "120009", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "youngestchild_age", - "bind": { - "calculate": "int((${today} - ${youngestchild_date_of_birth}) div 30)" - }, - "instance": { - "openmrs_entity_id": "124433", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "case_num_stillbirths", - "instance": { - "openmrs_entity_id": "100933", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "num_stillbirths", - "bind": { - "relevant": "${delivery_outcome} = 'still_birth'", - "calculate": "${case_num_stillbirths} + 1" - }, - "instance": { - "openmrs_entity_id": "3432434", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "children": [ - { - "children": [ - { - "name": "infection_during_preg", - "label": "Infection during pregnancy ಗರ್ಭಾವಸ್ಥೆಯಲ್ಲಿ ಸೋಂಕು", - "instance": { - "openmrs_code": "2323" - } - }, - { - "name": "gest_hypertension", - "label": "Gestational hypertension ಗರ್ಭಾಧಾರಣೆಯಲ್ಲಿನ ಅಧಿಕ ರಕ್ತದೊತ್ತಡ", - "instance": { - "openmrs_code": "2323" - } - }, - { - "name": "gest_diabetes", - "label": "Gestational diabetes ಗರ್ಭಾಧಾರಣೆಯಲ್ಲಿನ ಸಕ್ಕರೆ ಕಾಯಿಲೆ", - "instance": { - "openmrs_code": "23213" - } - }, - { - "name": "fetal_growth_restriction", - "label": "Fetal growth restriction ಭ್ರೂಣದ ಬೆಳವಣಿಗೆಯಲ್ಲಿ ನಿರ್ಬಂಧ", - "instance": { - "openmrs_code": "23123" - } - }, - { - "name": "birth_defects", - "label": "Birth defects ಜನ್ಮ ನ್ಯೂನ್ಯತೆಗಳು", - "instance": { - "openmrs_code": "23213" - } - }, - { - "name": "unknown", - "label": "Cause not identified ಕಾರಣವನ್ನು ಗುರುತಿಸಲ್ಪಟ್ಟಿಲ್ಲ", - "instance": { - "openmrs_code": "2323" - } - }, - { - "name": "others", - "label": "Others ಇತರೆ", - "instance": { - "openmrs_code": "23213" - } - } - ], - "name": "cause_of_still_birth", - "label": "Cause of still birth? ನಿರ್ಜೀವ ಜನನದ ಕಾರಣಗಳು?", - "instance": { - "openmrs_entity_parent": "65435", - "openmrs_entity_id": "4323232", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "woman_survived", - "bind": { - "required": "yes" - }, - "label": "Woman survived childbirth? ಮಗುವಿನ ಜನನದ ನಂತರ ಮಹಿಳೆ ಬದುಕುಳಿದರೆ?", - "instance": { - "openmrs_entity_parent": "65435", - "openmrs_entity_id": "100009", - "openmrs_entity": "concept" - }, - "type": "select one" - } - ], - "name": "still_birth_group", - "bind": { - "relevant": "${delivery_outcome} = 'still_birth'" - }, - "instance": { - "openmrs_entity_id": "65435", - "openmrs_entity": "concept" - }, - "type": "group" - }, - { - "children": [ - { - "children": [ - { - "children": [ - { - "name": "male", - "label": "Male ಗಂಡು", - "instance": { - "openmrs_code": "21321" - } - }, - { - "name": "female", - "label": "Female ಹೆಣ್ಣು", - "instance": { - "openmrs_code": "312312" - } - } - ], - "name": "sex_child", - "bind": { - "required": "yes" - }, - "label": "Sex of child? ಮಗುವಿನ ಲಿಂಗ?", - "instance": { - "openmrs_entity_id": "gender", - "openmrs_entity": "patient" - }, - "type": "select one" - }, - { - "name": "sex_child_female", - "bind": { - "calculate": "if(${sex_child} = 'female', 1, 0)" - }, - "type": "calculate" - }, - { - "name": "sex_child_male", - "bind": { - "calculate": "if(${sex_child} = 'male', 1, 0)" - }, - "type": "calculate" - }, - { - "name": "birthweight", - "label": "Child birthweight (in kgs)? ಹುಟ್ಟಿದ ಮಗುವಿನ ತೂಕ (ಕೆ.ಜಿ. ಗಳಲ್ಲಿ)?", - "instance": { - "openmrs_entity_id": "323232", - "openmrs_entity": "concept" - }, - "type": "decimal" - }, - { - "control": { - "appearance": "minimal" - }, - "children": [ - { - "name": "a_positive", - "label": "A+", - "instance": { - "openmrs_code": "34324" - } - }, - { - "name": "a_negative", - "label": "A-", - "instance": { - "openmrs_code": "34134" - } - }, - { - "name": "b_positive", - "label": "B+", - "instance": { - "openmrs_code": "1321312" - } - }, - { - "name": "b_negative", - "label": "B-", - "instance": { - "openmrs_code": "43434" - } - }, - { - "name": "ab_positive", - "label": "AB+", - "instance": { - "openmrs_code": "12323214" - } - }, - { - "name": "ab_negative", - "label": "AB-", - "instance": { - "openmrs_code": "11343141" - } - }, - { - "name": "o_positive", - "label": "O+", - "instance": { - "openmrs_code": "134343" - } - }, - { - "name": "o_negative", - "label": "O-", - "instance": { - "openmrs_code": "432434" - } - } - ], - "name": "child_blood_group", - "label": "Child blood group? ಮಗುವಿನ ರಕ್ತದ ಗುಂಪು?", - "instance": { - "openmrs_entity_id": "232112", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "bcg", - "label": "BCG ಬಿ.ಸಿ.ಜಿ", - "instance": { - "openmrs_code": "23123" - } - }, - { - "name": "opv_0", - "label": "OPV 0 ಒ.ಪಿ.ವಿ 0", - "instance": { - "openmrs_code": "12312" - } - }, - { - "name": "hepb_0", - "label": "Hep B 0 ಹೆಪಟೆಟಿಸ್ ಬಿ 0", - "instance": { - "openmrs_code": "213123" - } - } - ], - "name": "immunizations_atbirth", - "label": "Immunizations provided at birth? ಹುಟ್ಟಿದ ಮಗುವಿಗೆ ಇಮ್ಯುನೈಜೇಷನ್ ನೀಡಲಾಯಿತೆ?", - "instance": { - "openmrs_entity_id": "199277", - "openmrs_entity": "concept" - }, - "type": "select all that apply" - }, - { - "name": "case_hepb", - "instance": { - "openmrs_entity_id": "100285", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "hepb_prophylaxis_provided", - "bind": { - "relevant": "${case_hepb} != ''" - }, - "label": "Hep B prophylaxis provided? ಹೆಪಟೆಟಿಸ್ ಬಿ ರೋಗನಿರೋಧಕ ಚಿಕಿತ್ಸೆ ನೀಡಲಾಗಿದೆತೇ?", - "instance": { - "openmrs_entity_id": "3321323", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "name": "lbw", - "bind": { - "calculate": "if(${birthweight} >= 1.5 and ${birthweight} < 2.5, 'Low_Birth_Weight','')" - }, - "instance": { - "openmrs_entity_id": "1232132", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "vlbw", - "bind": { - "calculate": "if(${birthweight} < 1.5, 'Very_Low_Birth_Weight', '')" - }, - "instance": { - "openmrs_entity_id": "232133", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "num_preg_days", - "bind": { - "calculate": "int(date(${delivery_date}) - date(${case_lmp}))" - }, - "instance": { - "openmrs_entity_id": "232323", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "premature", - "bind": { - "calculate": "if(${num_preg_days} < 259, 'Premature', '')" - }, - "instance": { - "openmrs_entity_id": "232323", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "premature_message1", - "bind": { - "relevant": "${premature} != ''" - }, - "label": "Baby is premature! Advise kangaroo care and rooming in. ಅವಧಿಗೆ ಮುನ್ನ ಜನಿಸಿದ ಮಗು! ಕಾಂಗರೋ ಆರೈಕೆ ಮತ್ತು ಒಂದೇ ರೂಮಿನಲ್ಲಿಡುವಂತೆ ಸಲಹೆ ನೀಡಿ.", - "type": "note" - }, - { - "name": "is_child_high_risk1", - "bind": { - "calculate": "if(${premature} != '' or ${lbw} != '' or ${vlbw} != '', 'yes', 'no')" - }, - "instance": { - "openmrs_entity_id": "342343", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "child_high_risk_reasons", - "bind": { - "calculate": "concat(${premature}, ' ', ${lbw}, ' ', ${vlbw})" - }, - "instance": { - "openmrs_entity_id": "423434", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "high_risk_note_child", - "bind": { - "relevant": "${is_child_high_risk1} = 'yes'" - }, - "label": "Child is at risk because of, ಈಗ ಮಗು ಅಪಾಯದಲ್ಲಿದೆ ಏಕೆಂದರೆ: ${child_high_risk_reasons}", - "type": "note" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "is_child_high_risk", - "bind": { - "required": "yes" - }, - "label": "Do you want to mark child as HR (High Risk)? \nನೀವು ಮಗುವನ್ನು HR (ಹೆಚ್ಚು ಅಪಾಯವಿದೆ) ಎಂದು ಗುರುತಿಸಲು ಬಯಸುವಿರಾ?", - "instance": { - "openmrs_entity_id": "4342343", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "name": "addl_pnc_visit_message", - "bind": { - "relevant": "${is_child_high_risk1} = 'yes'" - }, - "label": "Child needs 3 more PNC visits on days 14, 21, and 28 because of, 14, 21 ಮತ್ತು 28 ನೇ ದಿನಗಳೊಂದು ಮಗುವಿಗೆ 3 ಹೆಚ್ಚಿನ ಭೇಟಿಯ ಅಗತ್ಯವಿದೆ, ಏಕೆಂದರೆ: ${child_high_risk_reasons}", - "type": "note" - } - ], - "name": "child", - "label": "Please enter birth information for each child born. ಜನನವಾದ ಪ್ರತಿ ಮಗುವಿನ ಜನ್ಮ ಮಾಹಿತಿಯನ್ನು ದಯವಿಟ್ಟು ನಮೂದಿಸಿ.", - "instance": { - "openmrs_entity_id": "100029", - "openmrs_entity": "concept" - }, - "type": "repeat" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "mother_survived", - "bind": { - "required": "yes" - }, - "label": "Mother survived childbirth? ಮಗುವಿನ ಜನನದ ನಂತರ ಮಹಿಳೆ ಬದುಕುಳಿದರೆ?", - "instance": { - "openmrs_entity_id": "343434", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "breastfeeding_postbirth", - "bind": { - "relevant": "${mother_survived} = 'yes'", - "required": "yes" - }, - "label": "Was breastfeeding started within 1 hour of birth? ಹುಟ್ಟಿದ ಒಂದು ಗಂಟೆಯ ಒಳಗೆ ಎದೆಹಾಲು ನೀಡಲಾಯಿತೆ?", - "instance": { - "openmrs_entity_id": "434343", - "openmrs_entity": "concept" - }, - "type": "select one" - } - ], - "name": "live_birth_group", - "bind": { - "relevant": "${delivery_outcome} = 'live_birth'" - }, - "type": "group" - }, - { - "name": "case_num_livingchildren", - "instance": { - "openmrs_entity_id": "434344", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "num_children_born", - "bind": { - "calculate": "if(${delivery_outcome} = 'still_birth', 0, count(${sex_child}))" - }, - "instance": { - "openmrs_entity_id": "43432", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "num_livingchildren", - "bind": { - "calculate": "${case_num_livingchildren} + ${num_children_born}" - }, - "instance": { - "openmrs_entity_id": "54541", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "case_numlivingchildren_female", - "instance": { - "openmrs_entity_id": "57467", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "num_female_children_born", - "bind": { - "calculate": "sum(${sex_child_female})" - }, - "instance": { - "openmrs_entity_id": "687832", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "numlivingchildren_female", - "bind": { - "calculate": "${case_numlivingchildren_female} + ${num_female_children_born}" - }, - "instance": { - "openmrs_entity_id": "098343", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "case_numlivingchildren_male", - "instance": { - "openmrs_entity_id": "98664", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "num_male_children_born", - "bind": { - "calculate": "sum(${sex_child_male})" - }, - "instance": { - "openmrs_entity_id": "4343656", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "numlivingchildren_male", - "bind": { - "calculate": "${case_numlivingchildren_male} + ${num_male_children_born}" - }, - "instance": { - "openmrs_entity_id": "342325", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "children": [ - { - "children": [ - { - "name": "prolonged_obstructed_labor", - "label": "Prolonged / obstructed labor ದೀರ್ಘಕಾಲೀನ / ಅಡಚಣೆಯನ್ನು ತಂದೊಡ್ಡುವ ಹೆರಿಗೆ ನೋವು", - "instance": { - "openmrs_code": "23123" - } - }, - { - "name": "hypertension_fits", - "label": "Severe hypertension / fits ತೀವ್ರತರವಾದ ಅಧಿಕ ರಕ್ತದೊತ್ತಡ / ಮೂರ್ಚೆರೋಗ", - "instance": { - "openmrs_code": "23213" - } - }, - { - "name": "bleeding_hemorrhage", - "label": "Bleeding / hemorrhage ರಕ್ತಸ್ರಾವ", - "instance": { - "openmrs_code": "23123" - } - }, - { - "name": "fever_infection", - "label": "High fever / infection ಅಧಿಕ ಜ್ವರ / ಸೊಂಕು", - "instance": { - "openmrs_code": "2323" - } - }, - { - "name": "cause_not_identified", - "label": "Cause not identified ಕಾರಣವನ್ನು ಗುರುತಿಸಲ್ಪಟ್ಟಿಲ್ಲ", - "instance": { - "openmrs_code": "23213" - } - }, - { - "name": "others", - "label": "Others ಇತರೆ", - "instance": { - "openmrs_code": "23213" - } - } - ], - "name": "maternal_death_cause", - "label": "Cause of maternal death? ತಾಯಿಯ ಮರಣಕ್ಕೆ ಕಾರಣಗಳು?", - "instance": { - "openmrs_entity_id": "43434", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "name": "other_maternal_death_cause", - "bind": { - "relevant": "${maternal_death_cause} = 'others'" - }, - "label": "Others ಇತರೆ:", - "instance": { - "openmrs_entity_id": "43221", - "openmrs_entity": "concept" - }, - "type": "text" - } - ], - "name": "maternal_death_group", - "bind": { - "relevant": "(${woman_survived} = 'no' or ${mother_survived} = 'no')" - }, - "type": "group" - }, - { - "children": [ - { - "name": "case_w_rh_negative", - "instance": { - "openmrs_entity_id": "4324234", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "rh_injection_given", - "bind": { - "relevant": "${case_w_rh_negative} != ''" - }, - "label": "Rh injection given to woman? ಮಹಿಳೆಗೆ Rh ಚುಚ್ಚುಮದ್ದು ನೀಡಲಾಯಿತೆ?", - "instance": { - "openmrs_entity_id": "32323", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "had_delivery_complications", - "label": "Were there delivery complications? ಹೆರಿಗೆಯಲ್ಲಿ ತೊಡಕುಂಟಾಯಿತೆ?", - "instance": { - "openmrs_entity_id": "233234", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "hemorrhage", - "label": "Hemorrhage ರಕ್ತಸ್ರಾವ", - "instance": { - "openmrs_code": "4123213" - } - }, - { - "name": "placenta_previa", - "label": "Placenta previa ಹಿಂದಿನ ಗರ್ಭದಲ್ಲಿ ಮಾಸು ಮುಂದಿರುವುದು", - "instance": { - "openmrs_code": "2131413" - } - }, - { - "name": "cord_prolapse", - "label": "Cord prolapse ಬಳ್ಳಿಯ ಸರಿತ", - "instance": { - "openmrs_code": "4134123" - } - }, - { - "name": "prolonged_labor", - "label": "Prolonged / obstructed labor ದೀರ್ಘಕಾಲೀನ / ಅಡಚಣೆಯನ್ನು ತಂದೊಡ್ಡುವ ಹೆರಿಗೆ ನೋವು", - "instance": { - "openmrs_code": "213124123" - } - }, - { - "name": "abnormal_presentation", - "label": "Abnormal presentation ಅಪಸಾಮಾನ್ಯ ಪ್ರಸ್ತುತಿ", - "instance": { - "openmrs_code": "14123123" - } - }, - { - "name": "perineal_tear", - "label": "Perineal tear (2, 3, or 4 degree)", - "instance": { - "openmrs_code": "23123" - } - }, - { - "name": "others", - "label": "Others ಇತರೆ", - "instance": { - "openmrs_code": "32123" - } - } - ], - "name": "complications", - "bind": { - "relevant": "${had_delivery_complications} = 'yes'" - }, - "label": "What delivery complications were there? ಯಾವ ಹೆರಿಗೆ ತೊಂದರೆಗಳು ಉಂಟಾದವು?", - "instance": { - "openmrs_entity_id": "25343", - "openmrs_entity": "concept" - }, - "type": "select all that apply" - }, - { - "name": "delivery_complications_other", - "bind": { - "relevant": "selected(${complications}, 'others')" - }, - "label": "Others ಇತರೆ:", - "instance": { - "openmrs_entity_id": "2355435", - "openmrs_entity": "concept" - }, - "type": "text" - } - ], - "name": "woman_survived_group", - "bind": { - "relevant": "(${woman_survived} = 'yes' or ${mother_survived} = 'yes')" - }, - "type": "group" - }, - { - "name": "case_is_high_risk_till_pnc_close", - "instance": { - "openmrs_entity_id": "8768767", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "case_is_high_risk_till_pnc_close_reason", - "instance": { - "openmrs_entity_id": "676576", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "case_anaemic_status", - "instance": { - "openmrs_entity_id": "76767", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "case_pih", - "instance": { - "openmrs_entity_id": "36787", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "case_pre_eclampsia", - "instance": { - "openmrs_entity_id": "376784", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "case_jaundice", - "instance": { - "openmrs_entity_id": "343434", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "is_high_risk1", - "bind": { - "calculate": "if(${case_is_high_risk_till_pnc_close} = 'yes' or ${case_anaemic_status} != '' or ${case_pih} != '' or ${case_pre_eclampsia} != '' or ${case_jaundice} != '', 'yes', 'no')" - }, - "instance": { - "openmrs_entity_id": "4746767", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "high_risk_reason", - "bind": { - "calculate": "concat(${case_is_high_risk_till_pnc_close_reason}, ' ', ${case_anaemic_status}, ' ', ${case_pih}, ' ', ${case_pre_eclampsia}, ' ', ${case_jaundice})" - }, - "instance": { - "openmrs_entity_id": "5656", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "high_risk_note_mother", - "bind": { - "relevant": "${is_high_risk1} = 'yes'" - }, - "label": "Woman is still at risk because of, ಮಹಿಳೆಯು ಈಗಲೂ ಅಪಾಯದಲ್ಲಿದ್ದಾಳೆ ಏಕೆಂದರೆ: ${high_risk_reason}", - "type": "note" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "is_high_risk", - "bind": { - "relevant": "(${woman_survived} = 'yes' or ${mother_survived} = 'yes')", - "required": "yes" - }, - "label": "Do you want to mark woman as HR (High Risk)?\nನೀವು ಮಹಿಳೆಯನ್ನು HR (ಹೆಚ್ಚು ಅಪಾಯವಿದೆ) ಎಂದು ಗುರುತಿಸಲು ಬಯಸುವಿರಾ?", - "instance": { - "openmrs_entity_id": "424253", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "control": { - "bodyless": true - }, - "children": [ - { - "name": "instanceID", - "bind": { - "readonly": "true()", - "calculate": "concat('uuid:', uuid())" - }, - "type": "calculate" - } - ], - "name": "meta", - "type": "group" - } - ], - "instance": { - "encounter_type": "PNC Registration" - }, - "version": "201504300627", - "type": "survey", - "name": "PNC_Registration_EngKan", - "sms_keyword": "Delivery_Outcome_EngKan", - "title": "PNC Registration" -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/pnc_reg_form/form_definition.json b/opensrp-core/src/test/resources/form/pnc_reg_form/form_definition.json deleted file mode 100644 index c64ffdc42f..0000000000 --- a/opensrp-core/src/test/resources/form/pnc_reg_form/form_definition.json +++ /dev/null @@ -1,315 +0,0 @@ -{ - "form_data_definition_version": "5", - "form": { - "bind_type": "mother", - "default_bind_path": "/model/instance/PNC_Registration_EngKan/", - "fields": [ - { - "name": "id", - "shouldLoadValue": true - }, - { - "name": "ecId", - "shouldLoadValue": true, - "source": "mother.eligible_couple.id" - }, - { - "name": "referenceDate", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_lmp" - }, - { - "name": "referenceDate", - "bind": "/model/instance/PNC_Registration_EngKan/delivery_date" - }, - { - "name": "deliveryRegistrationDate", - "bind": "/model/instance/PNC_Registration_EngKan/delivery_reg_date" - }, - { - "name": "deliveryPlace", - "bind": "/model/instance/PNC_Registration_EngKan/place_delivery" - }, - { - "name": "deliveryFacilityName", - "bind": "/model/instance/PNC_Registration_EngKan/name_delivery_facility" - }, - { - "name": "isThisOnlyDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/only_delivery_facility" - }, - { - "name": "additionalDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/addl_delivery_facility" - }, - { - "name": "reasonsForAdditionalDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/reasons_addl_delivery_facility" - }, - { - "name": "otherReasonsForAdditionalDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/other_reasons_addl_delivery_facility" - }, - { - "name": "isSkilledDelivery", - "bind": "/model/instance/PNC_Registration_EngKan/skilled_delivery" - }, - { - "name": "deliveryType", - "bind": "/model/instance/PNC_Registration_EngKan/type_delivery" - }, - { - "name": "deliveryOutcome", - "bind": "/model/instance/PNC_Registration_EngKan/delivery_outcome" - }, - { - "name": "parity", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_parity", - "source": "mother.eligible_couple.parity" - }, - { - "name": "parity", - "bind": "/model/instance/PNC_Registration_EngKan/parity", - "source": "mother.eligible_couple.parity" - }, - { - "name": "numberOfLiveBirths", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_num_livebirths", - "source": "mother.eligible_couple.numberOfLiveBirths" - }, - { - "name": "numberOfLiveBirths", - "bind": "/model/instance/PNC_Registration_EngKan/num_livebirths", - "source": "mother.eligible_couple.numberOfLiveBirths" - }, - { - "name": "numberOfStillBirths", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_num_stillbirths", - "source": "mother.eligible_couple.numberOfStillBirths" - }, - { - "name": "numberOfStillBirths", - "bind": "/model/instance/PNC_Registration_EngKan/num_stillbirths", - "source": "mother.eligible_couple.numberOfStillBirths" - }, - { - "name": "causeOfStillBirth", - "bind": "/model/instance/PNC_Registration_EngKan/still_birth_group/cause_of_still_birth" - }, - { - "name": "didWomanSurvive", - "bind": "/model/instance/PNC_Registration_EngKan/still_birth_group/woman_survived" - }, - { - "name": "didMotherSurvive", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/mother_survived" - }, - { - "name": "didBreastfeedingStart", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/breastfeeding_postbirth" - }, - { - "name": "maternalDeathCause", - "bind": "/model/instance/PNC_Registration_EngKan/maternal_death_group/maternal_death_cause" - }, - { - "name": "otherMaternalDeathCause", - "bind": "/model/instance/PNC_Registration_EngKan/maternal_death_group/other_maternal_death_cause" - }, - { - "name": "isRHNegative", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/case_w_rh_negative" - }, - { - "name": "isRHInjectionGiven", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/rh_injection_given" - }, - { - "name": "hadDeliveryComplications", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/had_delivery_complications" - }, - { - "name": "deliveryComplications", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/complications" - }, - { - "name": "otherDeliveryComplications", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/delivery_complications_other" - }, - { - "name": "isHighRiskTillPNCClose", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_is_high_risk_till_pnc_close" - }, - { - "name": "highRiskTillPNCCloseReason", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_is_high_risk_till_pnc_close_reason" - }, - { - "name": "anemicStatus", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_anaemic_status" - }, - { - "name": "pih", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_pih" - }, - { - "name": "preEclampsia", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_pre_eclampsia" - }, - { - "name": "jaundice", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_jaundice" - }, - { - "name": "isHighRisk", - "bind": "/model/instance/PNC_Registration_EngKan/is_high_risk" - }, - { - "name": "isBirthPlanningDone", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_birth_planning" - }, - { - "name": "highRiskReason", - "bind": "/model/instance/PNC_Registration_EngKan/high_risk_reason" - }, - { - "name": "submissionDate", - "bind": "/model/instance/PNC_Registration_EngKan/today" - }, - { - "name": "type", - "value": "PNC", - "source": "mother.type" - }, - { - "name": "numberOfLivingChildren", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_num_livingchildren", - "source": "mother.eligible_couple.numberOfLivingChildren" - }, - { - "name": "numberOfLivingChildren", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/num_livingchildren", - "source": "mother.eligible_couple.numberOfLivingChildren" - }, - { - "name": "numberOfChildrenBorn", - "bind": "/model/instance/PNC_Registration_EngKan/num_children_born" - }, - { - "name": "numberOfFemaleChildrenBorn", - "bind": "/model/instance/PNC_Registration_EngKan/num_female_children_born" - }, - { - "name": "numberOfMaleChildrenBorn", - "bind": "/model/instance/PNC_Registration_EngKan/num_male_children_born" - }, - { - "name": "numberOfLivingFemaleChild", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_numlivingchildren_female", - "source": "mother.eligible_couple.numberOfLivingChildrenFemale" - }, - { - "name": "numberOfLivingFemaleChild", - "bind": "/model/instance/PNC_Registration_EngKan/numlivingchildren_female", - "source": "mother.eligible_couple.numberOfLivingChildrenFemale" - }, - { - "name": "numberOfLivingMaleChild", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_numlivingchildren_male", - "source": "mother.eligible_couple.numberOfLivingMaleChild" - }, - { - "name": "numberOfLivingMaleChild", - "bind": "/model/instance/PNC_Registration_EngKan/numlivingchildren_male", - "source": "mother.eligible_couple.numberOfLivingMaleChild" - }, - { - "name": "youngestChildDOB", - "bind": "/model/instance/PNC_Registration_EngKan/youngestchild_date_of_birth", - "source": "mother.eligible_couple.youngestChildDOB" - }, - { - "name": "youngestChildAge", - "bind": "/model/instance/PNC_Registration_EngKan/youngestchild_age", - "source": "mother.eligible_couple.youngestChildAge" - } - ], - "sub_forms": [ - { - "name": "child_registration", - "bind_type": "child", - "default_bind_path": "/model/instance/PNC_Registration_EngKan/live_birth_group/child", - "fields": [ - { - "name": "id", - "shouldLoadValue": true - }, - { - "name": "gender", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/sex_child" - }, - { - "name": "weight", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/birthweight" - }, - { - "name": "bloodGroup", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/child_blood_group" - }, - { - "name": "immunizationsGiven", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/immunizations_atbirth" - }, - { - "name": "hepB", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/case_hepb" - }, - { - "name": "isHepBProphylaxisProvided", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/hepb_prophylaxis_provided" - }, - { - "name": "isChildHighRisk1", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/is_child_high_risk1" - }, - { - "name": "childHighRiskReasons", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/child_high_risk_reasons" - }, - { - "name": "isChildHighRisk", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/is_child_high_risk" - }, - { - "name": "lbw", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/lbw" - }, - { - "name": "vlbw", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/vlbw" - }, - { - "name": "premature", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/premature" - } - ] - } - ] - } -} diff --git a/opensrp-core/src/test/resources/form/pnc_reg_form/form_submission.json b/opensrp-core/src/test/resources/form/pnc_reg_form/form_submission.json deleted file mode 100644 index 5ec548d617..0000000000 --- a/opensrp-core/src/test/resources/form/pnc_reg_form/form_submission.json +++ /dev/null @@ -1,459 +0,0 @@ -{ - "anmId": "admin", - "clientVersion": "1426830449320", - "entityId": "b716d938-1aea-40ae-a081-9ddddddcccc9", - "formDataDefinitionVersion": "5", - "formName": "pnc_reg_form", - "formInstance": { - "form_data_definition_version": "5", - "form": { - "bind_type": "mother", - "default_bind_path": "/model/instance/PNC_Registration_EngKan/", - "fields": [ - { - "name": "id", - "shouldLoadValue": true, - "source": "mother.id", - "value": "7efb9e31-0e26-496e-bd16-e09a3b0d1a31" - }, - { - "name": "ecId", - "shouldLoadValue": true, - "source": "mother.eligible_couple.id", - "value": "aa786612-e7a8-4fea-b733-3de4d898f4d6" - }, - { - "name": "referenceDate", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_lmp", - "source": "mother.referenceDate", - "value": "2014-02-20" - }, - { - "name": "referenceDate", - "bind": "/model/instance/PNC_Registration_EngKan/delivery_date", - "source": "mother.referenceDate", - "value": "2015-02-20" - }, - { - "name": "deliveryRegistrationDate", - "bind": "/model/instance/PNC_Registration_EngKan/delivery_reg_date", - "source": "mother.deliveryRegistrationDate", - "value": "2015-03-20" - }, - { - "name": "deliveryPlace", - "bind": "/model/instance/PNC_Registration_EngKan/place_delivery", - "source": "mother.deliveryPlace", - "value": "home" - }, - { - "name": "deliveryFacilityName", - "bind": "/model/instance/PNC_Registration_EngKan/name_delivery_facility", - "source": "mother.deliveryFacilityName" - }, - { - "name": "isThisOnlyDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/only_delivery_facility", - "source": "mother.isThisOnlyDeliveryFacility", - "value": "yes" - }, - { - "name": "additionalDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/addl_delivery_facility", - "source": "mother.additionalDeliveryFacility" - }, - { - "name": "reasonsForAdditionalDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/reasons_addl_delivery_facility", - "source": "mother.reasonsForAdditionalDeliveryFacility" - }, - { - "name": "otherReasonsForAdditionalDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/other_reasons_addl_delivery_facility", - "source": "mother.otherReasonsForAdditionalDeliveryFacility" - }, - { - "name": "isSkilledDelivery", - "bind": "/model/instance/PNC_Registration_EngKan/skilled_delivery", - "source": "mother.isSkilledDelivery", - "value": "yes" - }, - { - "name": "deliveryType", - "bind": "/model/instance/PNC_Registration_EngKan/type_delivery", - "source": "mother.deliveryType", - "value": "normal" - }, - { - "name": "deliveryOutcome", - "bind": "/model/instance/PNC_Registration_EngKan/delivery_outcome", - "source": "mother.deliveryOutcome", - "value": "live_birth" - }, - { - "name": "parity", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_parity", - "source": "mother.eligible_couple.parity", - "value": "0" - }, - { - "name": "parity", - "bind": "/model/instance/PNC_Registration_EngKan/parity", - "source": "mother.eligible_couple.parity", - "value": "1" - }, - { - "name": "numberOfLiveBirths", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_num_livebirths", - "source": "mother.eligible_couple.numberOfLiveBirths", - "value": "0" - }, - { - "name": "numberOfLiveBirths", - "bind": "/model/instance/PNC_Registration_EngKan/num_livebirths", - "source": "mother.eligible_couple.numberOfLiveBirths", - "value": "1" - }, - { - "name": "numberOfStillBirths", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_num_stillbirths", - "source": "mother.eligible_couple.numberOfStillBirths", - "value": "0" - }, - { - "name": "numberOfStillBirths", - "bind": "/model/instance/PNC_Registration_EngKan/num_stillbirths", - "source": "mother.eligible_couple.numberOfStillBirths" - }, - { - "name": "causeOfStillBirth", - "bind": "/model/instance/PNC_Registration_EngKan/still_birth_group/cause_of_still_birth", - "source": "mother.causeOfStillBirth" - }, - { - "name": "didWomanSurvive", - "bind": "/model/instance/PNC_Registration_EngKan/still_birth_group/woman_survived", - "source": "mother.didWomanSurvive" - }, - { - "name": "didMotherSurvive", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/mother_survived", - "source": "mother.didMotherSurvive", - "value": "yes" - }, - { - "name": "didBreastfeedingStart", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/breastfeeding_postbirth", - "source": "mother.didBreastfeedingStart", - "value": "yes" - }, - { - "name": "maternalDeathCause", - "bind": "/model/instance/PNC_Registration_EngKan/maternal_death_group/maternal_death_cause", - "source": "mother.maternalDeathCause" - }, - { - "name": "otherMaternalDeathCause", - "bind": "/model/instance/PNC_Registration_EngKan/maternal_death_group/other_maternal_death_cause", - "source": "mother.otherMaternalDeathCause" - }, - { - "name": "isRHNegative", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/case_w_rh_negative", - "source": "mother.isRHNegative" - }, - { - "name": "isRHInjectionGiven", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/rh_injection_given", - "source": "mother.isRHInjectionGiven" - }, - { - "name": "hadDeliveryComplications", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/had_delivery_complications", - "source": "mother.hadDeliveryComplications", - "value": "yes" - }, - { - "name": "deliveryComplications", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/complications", - "source": "mother.deliveryComplications", - "value": "hemorrhage placenta_previa" - }, - { - "name": "otherDeliveryComplications", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/delivery_complications_other", - "source": "mother.otherDeliveryComplications" - }, - { - "name": "isHighRiskTillPNCClose", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_is_high_risk_till_pnc_close", - "source": "mother.isHighRiskTillPNCClose", - "value": "no" - }, - { - "name": "highRiskTillPNCCloseReason", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_is_high_risk_till_pnc_close_reason", - "source": "mother.highRiskTillPNCCloseReason" - }, - { - "name": "anemicStatus", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_anaemic_status", - "source": "mother.anemicStatus" - }, - { - "name": "pih", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_pih", - "source": "mother.pih" - }, - { - "name": "preEclampsia", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_pre_eclampsia", - "source": "mother.preEclampsia" - }, - { - "name": "jaundice", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_jaundice", - "source": "mother.jaundice" - }, - { - "name": "isHighRisk", - "bind": "/model/instance/PNC_Registration_EngKan/is_high_risk", - "source": "mother.isHighRisk", - "value": "yes" - }, - { - "name": "isBirthPlanningDone", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_birth_planning", - "source": "mother.isBirthPlanningDone" - }, - { - "name": "highRiskReason", - "bind": "/model/instance/PNC_Registration_EngKan/high_risk_reason", - "source": "mother.highRiskReason" - }, - { - "name": "submissionDate", - "bind": "/model/instance/PNC_Registration_EngKan/today", - "source": "mother.submissionDate", - "value": "2015-03-20" - }, - { - "name": "type", - "value": "PNC", - "source": "mother.type" - }, - { - "name": "numberOfLivingChildren", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_num_livingchildren", - "source": "mother.eligible_couple.numberOfLivingChildren", - "value": "0" - }, - { - "name": "numberOfLivingChildren", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/num_livingchildren", - "source": "mother.eligible_couple.numberOfLivingChildren", - "value": "3" - }, - { - "name": "numberOfChildrenBorn", - "bind": "/model/instance/PNC_Registration_EngKan/num_children_born", - "source": "mother.numberOfChildrenBorn", - "value": "3" - }, - { - "name": "numberOfFemaleChildrenBorn", - "bind": "/model/instance/PNC_Registration_EngKan/num_female_children_born", - "source": "mother.numberOfFemaleChildrenBorn", - "value": "1" - }, - { - "name": "numberOfMaleChildrenBorn", - "bind": "/model/instance/PNC_Registration_EngKan/num_male_children_born", - "source": "mother.numberOfMaleChildrenBorn", - "value": "2" - }, - { - "name": "numberOfLivingFemaleChild", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_numlivingchildren_female", - "source": "mother.eligible_couple.numberOfLivingChildrenFemale" - }, - { - "name": "numberOfLivingFemaleChild", - "bind": "/model/instance/PNC_Registration_EngKan/numlivingchildren_female", - "source": "mother.eligible_couple.numberOfLivingChildrenFemale", - "value": "NaN" - }, - { - "name": "numberOfLivingMaleChild", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_numlivingchildren_male", - "source": "mother.eligible_couple.numberOfLivingMaleChild" - }, - { - "name": "numberOfLivingMaleChild", - "bind": "/model/instance/PNC_Registration_EngKan/numlivingchildren_male", - "source": "mother.eligible_couple.numberOfLivingMaleChild", - "value": "NaN" - }, - { - "name": "youngestChildDOB", - "bind": "/model/instance/PNC_Registration_EngKan/youngestchild_date_of_birth", - "source": "mother.eligible_couple.youngestChildDOB", - "value": "2015-02-20" - }, - { - "name": "youngestChildAge", - "bind": "/model/instance/PNC_Registration_EngKan/youngestchild_age", - "source": "mother.eligible_couple.youngestChildAge", - "value": "0" - } - ], - "sub_forms": [ - { - "name": "child_registration", - "bind_type": "child", - "default_bind_path": "/model/instance/PNC_Registration_EngKan/live_birth_group/child", - "fields": [ - { - "name": "id", - "shouldLoadValue": true, - "source": "child.id" - }, - { - "name": "gender", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/sex_child", - "source": "child.gender" - }, - { - "name": "birthdate", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/birthdate", - "source": "child.birthdate" - }, - { - - "name": "weight", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/birthweight", - "source": "child.weight" - }, - { - "name": "bloodGroup", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/child_blood_group", - "source": "child.bloodGroup" - }, - { - "name": "immunizationsGiven", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/immunizations_atbirth", - "source": "child.immunizationsGiven" - }, - { - "name": "hepB", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/case_hepb", - "source": "child.hepB" - }, - { - "name": "isHepBProphylaxisProvided", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/hepb_prophylaxis_provided", - "source": "child.isHepBProphylaxisProvided" - }, - { - "name": "isChildHighRisk1", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/is_child_high_risk1", - "source": "child.isChildHighRisk1" - }, - { - "name": "childHighRiskReasons", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/child_high_risk_reasons", - "source": "child.childHighRiskReasons" - }, - { - "name": "isChildHighRisk", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/is_child_high_risk", - "source": "child.isChildHighRisk" - }, - { - "name": "lbw", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/lbw", - "source": "child.lbw" - }, - { - "name": "vlbw", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/vlbw", - "source": "child.vlbw" - }, - { - "name": "premature", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/premature", - "source": "child.premature" - } - ], - "instances": [ - { - "gender": "male", - "birthdate":"2015-03-05", - "weight": "2", - "bloodGroup": "a_negative", - "immunizationsGiven": "bcg", - "hepB": "", - "isHepBProphylaxisProvided": "", - "lbw": "Low_Birth_Weight", - "vlbw": "", - "premature": "", - "isChildHighRisk1": "yes", - "childHighRiskReasons": " Low_Birth_Weight ", - "isChildHighRisk": "yes", - "id": "e9a91c61-0d33-42d3-bf9b-560b4d08c74f" - }, - { - "gender": "male", - "birthdate":"2015-04-05", - "weight": "", - "bloodGroup": "a_negative", - "immunizationsGiven": "bcg", - "hepB": "", - "isHepBProphylaxisProvided": "", - "lbw": "", - "vlbw": "", - "premature": "", - "isChildHighRisk1": "no", - "childHighRiskReasons": "", - "isChildHighRisk": "yes", - "id": "c7305d21-0b90-4c15-a88f-b08338d3aed9" - }, - { - "gender": "female", - "birthdate":"2015-05-05", - "weight": "", - "bloodGroup": "a_negative", - "immunizationsGiven": "bcg", - "hepB": "", - "isHepBProphylaxisProvided": "", - "lbw": "", - "vlbw": "", - "premature": "", - "isChildHighRisk1": "no", - "childHighRiskReasons": "", - "isChildHighRisk": "no", - "id": "6c2d772b-7d6a-4a05-a83d-5168c183ef42" - } - ] - } - ] - } - } -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/pnc_reg_form/model.xml b/opensrp-core/src/test/resources/form/pnc_reg_form/model.xml deleted file mode 100644 index 21130a05e8..0000000000 --- a/opensrp-core/src/test/resources/form/pnc_reg_form/model.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/vaccine_stock_position/form.json b/opensrp-core/src/test/resources/form/vaccine_stock_position/form.json deleted file mode 100644 index 3405ad7da9..0000000000 --- a/opensrp-core/src/test/resources/form/vaccine_stock_position/form.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"Vaccine_Stock_Position","title":"ویکسین اسٹاک پوزیشن - Vaccine Stock Position","sms_keyword":"vaccine_stock_position","default_language":"English","instance":{"encounter_type":"Vaccine stock position"},"version":"201604080502","id_string":"vaccine_stock_position","type":"survey","children":[{"type":"hidden","name":"provider_uc"},{"type":"hidden","name":"provider_town"},{"type":"hidden","name":"provider_city"},{"type":"hidden","name":"provider_province"},{"type":"hidden","name":"provider_id"},{"instance":{"openmrs_entity_id":"location_id","openmrs_entity":"encounter"},"type":"hidden","name":"provider_location_id"},{"type":"hidden","name":"provider_location_name"},{"type":"note","name":"provider_location_note","label":{"Urdu":"شہر: ${provider_city} ; Town: ${provider_town} ; UC: ${provider_uc} ; Center Name: ${provider_location_name}","English":"City: ${provider_city} ; Town: ${provider_town} ; UC: ${provider_uc} ; Center Name: ${provider_location_name}","Roman Urdu":"Shehr: ${provider_city} ; Town: ${provider_town} ; UC: ${provider_uc} ; Center Name: ${provider_location_name}"}},{"instance":{"openmrs_entity_id":"163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"start","name":"start"},{"instance":{"openmrs_entity_id":"163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"end","name":"end"},{"instance":{"openmrs_entity_id":"163286AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"today","name":"today"},{"instance":{"openmrs_entity_id":"163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"deviceid","name":"deviceid"},{"instance":{"openmrs_entity_id":"163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"subscriberid","name":"subscriberid"},{"instance":{"openmrs_entity_id":"163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"simserial","name":"simserial"},{"instance":{"openmrs_entity_id":"163152AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"phonenumber","name":"phonenumber"},{"bind":{"calculate":"format-date(${today}, '%e-%n-%Y')"},"type":"calculate","name":"date_formatted"},{"type":"note","name":"vaccinator_name","label":{"Urdu":"${provider_id}","English":"${provider_id}","Roman Urdu":"${provider_id}"}},{"type":"note","name":"center_name","label":{"Urdu":"سینٹر کا نام: {provider_location_name}$","English":"Center Name: ${provider_location_name}","Roman Urdu":"Center ka naam: ${provider_location_name}"}},{"instance":{"openmrs_entity_id":"encounter_date","openmrs_entity":"encounter"},"type":"date","name":"date","label":{"Urdu":"تاریخ","English":"Date","Roman Urdu":"Tareekh"}},{"name":"report","bind":{"required":"yes"},"label":{"Urdu":"رپورٹ کی قسم","English":"Report Type","Roman Urdu":"Report ki kism"},"instance":{"openmrs_entity_id":"163331AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"select one","children":[{"instance":{"openmrs_code":"160862AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"daily","label":{"Urdu":"روزانہ کی رپورٹ","Roman Urdu":"Rozaana ki report","English":"Daily"}},{"instance":{"openmrs_code":"1098AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"monthly","label":{"Urdu":"ماہانہ رپورٹ","Roman Urdu":"Mahaana report","English":"Monthly"}}]},{"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"type":"integer","instance":{"openmrs_entity_id":"163174AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"name":"Target_assigned_for_vaccination_at_each_month","label":{"Urdu":"ویکسین لگانے کا ماہانہ ہدف","English":"Monthly Target","Roman Urdu":"Vaccine laganay ka mahaana hadf"}},{"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"type":"integer","instance":{"openmrs_entity_id":"163175AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"name":"Target_assigned_for_vaccination_for_the_year","label":{"Urdu":"ویکسین لگانے کا سالانہ ہدف","English":"Yearly Target","Roman Urdu":"Vaccine laganay ka salaana hadf"}},{"name":"bcg_balance_in_hand","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موجودہ بی سی جی کی تعداد","Roman Urdu":"Maujooda BCG ki taadaad","English":"BCG balance in hand"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163173AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"bcg_received","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موصول ہونے والی بی سی جی کی تعداد","Roman Urdu":"Mausool honay wali BCG ki taadaad","English":"BCG received"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163170AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"bcg_wasted","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'daily')","required":"yes"},"label":{"Urdu":"ضائع ہونے والی بی سی جی کی تعداد","Roman Urdu":"Zaya honay wali BCG ki taadaad","English":"BCG wasted"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163172AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"opv_balance_in_hand","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موجودہ او پی وی کی تعداد","Roman Urdu":"Maujooda OPV ki taadaad","English":"OPV balance in hand"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163173AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"opv_received","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موصول ہونے والی او پی وی کی تعداد","Roman Urdu":"Mausool honay wali OPV ki taadaad","English":"OPV received"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163170AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"opv_wasted","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'daily')","required":"yes"},"label":{"Urdu":"ضائع ہونے والی او پی وی کی تعداد","Roman Urdu":"Zaya honay wali OPV ki taadaad","English":"OPV wasted"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163172AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"ipv_balance_in_hand","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موجودہ آئی پی وی کی تعداد","Roman Urdu":"Maujooda IPV ki taadaad","English":"IPV balance in hand"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163173AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1422AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"ipv_received","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موصول ہونے والی آئی پی وی کی تعداد","Roman Urdu":"Mausool honay wali IPV ki taadaad","English":"IPV received"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163170AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1422AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"ipv_wasted","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'daily')","required":"yes"},"label":{"Urdu":"ضائع ہونے والی آئی پی وی کی تعداد","Roman Urdu":"Zaya honay wali IPV ki taadaad","English":"IPV wasted"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163172AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1422AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"pcv_balance_in_hand","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موجودہ پی سی وی کی تعداد","Roman Urdu":"Maujooda PCV ki taadaad","English":"PCV balance in hand"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163173AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"pcv_received","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موصول ہونے والی پی سی وی کی تعداد","Roman Urdu":"Mausool honay wali PCV ki taadaad","English":"PCV received"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163170AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"pcv_wasted","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'daily')","required":"yes"},"label":{"Urdu":"ضائع ہونے والی پی سی وی کی تعداد","Roman Urdu":"Zaya honay wali PCV ki taadaad","English":"PCV wasted"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163172AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"penta_balance_in_hand","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موجودہ پینٹاویلنٹ کی تعداد","Roman Urdu":"Maujooda Pentavalent ki taadaad","English":"Penta balance in hand"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163173AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"penta_received","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موصول ہونے والی پینٹاویلنٹ کی تعداد","Roman Urdu":"Mausool honay wali Pentavalent ki taadaad","English":"Penta received"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163170AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"penta_wasted","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'daily')","required":"yes"},"label":{"Urdu":"ضائع ہونے والی پینٹاویلنٹ کی تعداد","Roman Urdu":"Zaya honay wali Pentavalent ki taadaad","English":"Penta wasted"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163172AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162339AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"measles_balance_in_hand","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موجودہ خسرے کے ٹیکوں کی تعداد","Roman Urdu":"Maujooda khasray ke teekon ki taadaad","English":"Measles balance in hand"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163173AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"79409AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"measles_received","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موصول ہونے والے خسرے کے ٹیکوں کی تعداد","Roman Urdu":"Mausool honay walay khasray ke teekay ki taadaad","English":"Measles received"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163170AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"79409AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"measles_wasted","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'daily')","required":"yes"},"label":{"Urdu":"ضائع ہونے والے خسرے کے ٹیکوں کی تعداد","Roman Urdu":"Zaya honay walay khasray ke teekay ki taadaad","English":"Measles wasted"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163172AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"79409AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"tt_balance_in_hand","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موجودہ ٹی ٹی کی تعداد","Roman Urdu":"Maujooda TT ki taadaad","English":"TT balance in hand"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163173AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"tt_received","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موصول ہونے والی ٹی ٹی کی تعداد","Roman Urdu":"Mausool honay wali TT ki taadaad","English":"TT received"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163170AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"tt_wasted","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'daily')","required":"yes"},"label":{"Urdu":"ضائع ہونے والی ٹی ٹی کی تعداد","Roman Urdu":"Zaya honay wali TT ki taadaad","English":"TT wasted"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163172AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"dilutants_balance_in_hand","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"انجیکشن کے لئے موجودہ جراثیم سے پاک پانی کی شیشیوں کی تعداد","Roman Urdu":"Injection ke liye maujooda jaraseem se paak paani ki sheeshion ki taadaad","English":"Dilutants balance in hand"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163173AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"163287AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"dilutants_received","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"انجیکشن کے لئے موصول ہونے والا جراثیم سے پاک پانی کی شیشیوں کی تعداد","Roman Urdu":"Injection ke liye mausool honay wala jaraseem se paak paani ki sheeshion ki taadaad","English":"Dilutants received"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163170AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"163287AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"dilutants_wasted","hint":{"Urdu":"شیشیوں کی تعداد","Roman Urdu":"Sheeshion ki taadaad","English":"Number of vials"},"bind":{"relevant":"selected(${report}, 'daily')","required":"yes"},"label":{"Urdu":"انجیکشن کے لئے ضائع ہونے والا جراثیم سے پاک پانی کی شیشیوں کی تعداد","Roman Urdu":"Injection ke liye zaya honay wala jaraseem se paak paani ki sheeshion ki taadaad","English":"Dilutants wasted"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163172AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"163287AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"syringes_balance_in_hand","hint":{"Urdu":"سرنج کی تعداد","Roman Urdu":"Syringe ki taadaad","English":"Number of syringes"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موجودہ سرنج کی تعداد","Roman Urdu":"Maujooda siranj ki taadaad","English":"Syringes balance in hand"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163173AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162377AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"syringes_received","hint":{"Urdu":"سرنج کی تعداد","Roman Urdu":"Syringe ki taadaad","English":"Number of syringes"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موصول ہونے والی سرنج کی تعداد","Roman Urdu":"Mausool honay wali siranj ki taadaad","English":"Syringes received"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163170AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162377AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"syringes_wasted","hint":{"Urdu":"سرنج کی تعداد","Roman Urdu":"Syringe ki taadaad","English":"Number of syringes"},"bind":{"relevant":"selected(${report}, 'daily')","required":"yes"},"label":{"Urdu":"ضائع ہونے والی سرنج کی تعداد","Roman Urdu":"Zaya honay wali siranj taadaad","English":"Syringes wasted"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163172AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"162377AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"safety_boxes_balance_in_hand","hint":{"Urdu":"کنٹینر کی تعداد","Roman Urdu":"Container ki taadaad","English":"Number of containers"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موجودہ کنٹینر کی تعداد [جو تیز اوزار کو ضائع کرنے کے لیے استعمال ہوتے ہیں]","Roman Urdu":"Maujooda container ki taadaad [jo taiz auzaar ko zaya karne ke liye istamaal hotay hain]","English":"Sharp disposal container balance in hand"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163173AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"163285AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"safety_boxes_received","hint":{"Urdu":"کنٹینر کی تعداد","Roman Urdu":"Container ki taadaad","English":"Number of containers"},"bind":{"relevant":"selected(${report}, 'monthly')","required":"yes"},"label":{"Urdu":"موصول ہونے والے کنٹینر کی تعداد [جو تیز اوزار کو ضائع کرنے کے لیے استعمال ہوتے ہیں]","Roman Urdu":"Mausool honay walay container ki taadaad [jo taiz auzaar ko zaya karne ke liye istamaal hotay hain]","English":"Sharp disposal container received"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163170AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"163285AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"name":"safety_boxes_wasted","hint":{"Urdu":"کنٹینر کی تعداد","Roman Urdu":"Container ki taadaad","English":"Number of containers"},"bind":{"relevant":"selected(${report}, 'daily')","required":"yes"},"label":{"Urdu":"ضائع ہونے والے کنٹینر کی تعداد [جو تیز اوزار کو ضائع کرنے کے لیے استعمال ہوتے ہیں]","Roman Urdu":"Zaya honay walay container ki taadaad [jo taiz auzaar ko zaya karne ke liye istamaal hotay hain]","English":"Sharp disposal container wasted"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"163172AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"163285AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"integer"},{"bind":{"jr:constraintMsg":{"Urdu":"یہ تعداد موصول ہونے والی کل تعداد سے کم یا برابر ہونی چاہئیے","Roman Urdu":"Ye taadaad mausool honay wali kul taadaad se kam ya baraber honi chahiye","English":"This quantity should be less than or equal to the total quantity received"},"calculate":"${bcg_wasted}+${opv_wasted}+${ipv_wasted}+${pcv_wasted}+${penta_wasted}+${measles_wasted}+${tt_wasted}+${dilutants_wasted}+${syringes_wasted}+${safety_boxes_wasted}","constraint":".<=${total_received}"},"type":"calculate","name":"total_wasted","label":{"Urdu":"ضائع ہونے والی اشیاء کی مکمل تعداد","Roman Urdu":"Zaya honay wali ashia ki mukammal taadaad","English":"Total wasted"}},{"bind":{"calculate":"${bcg_received}+${opv_received}+${ipv_received}+${pcv_received}+${penta_received}+${measles_received}+${tt_received}+${dilutants_received}+${syringes_received}+${safety_boxes_received}"},"type":"calculate","name":"total_received","label":{"Urdu":"موصول ہونے والی اشیاء کی مکمل تعداد","Roman Urdu":"Mausool honay wali ashia ki mukammal taadaad","English":"Total received"}},{"bind":{"calculate":"${bcg_balance_in_hand}+${opv_balance_in_hand}+${ipv_balance_in_hand}+${pcv_balance_in_hand}+${penta_balance_in_hand}+${measles_balance_in_hand}+${tt_balance_in_hand}+${dilutants_balance_in_hand}+${syringes_balance_in_hand}+${safety_boxes_balance_in_hand}"},"type":"calculate","name":"total_balanceInHand","label":{"Urdu":"موجودہ اشیاء کی مکمل تعداد","Roman Urdu":"Maujooda ashia ki mukammal taadaad","English":"Total balance in hand"}},{"control":{"bodyless":true},"type":"group","children":[{"bind":{"readonly":"true()","calculate":"concat('uuid:', uuid())"},"type":"calculate","name":"instanceID"}],"name":"meta"}]} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/vaccine_stock_position/form.xml b/opensrp-core/src/test/resources/form/vaccine_stock_position/form.xml deleted file mode 100644 index 713d5efd97..0000000000 --- a/opensrp-core/src/test/resources/form/vaccine_stock_position/form.xml +++ /dev/null @@ -1,381 +0,0 @@ -
- - -

ویکسین اسٹاک پوزیشن - Vaccine Stock Position

-
-
- - رپورٹ کی قسم - Report Type - Report ki kism - * -
- - -
-
-
- -
diff --git a/opensrp-core/src/test/resources/form/vaccine_stock_position/form_definition.json b/opensrp-core/src/test/resources/form/vaccine_stock_position/form_definition.json deleted file mode 100644 index f6b50a149e..0000000000 --- a/opensrp-core/src/test/resources/form/vaccine_stock_position/form_definition.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "form_data_definition_version" : "1", - "form" : { - "bind_type" : "stock", - "default_bind_path" : "/model/instance/Vaccine_Stock_Position/", - "fields" : [ { - "name" : "id", - "shouldLoadValue" : true - }, { - "name" : "provider_uc", - "bind" : "/model/instance/Vaccine_Stock_Position/provider_uc", - "shouldLoadValue" : true - }, { - "name" : "provider_town", - "bind" : "/model/instance/Vaccine_Stock_Position/provider_town", - "shouldLoadValue" : true - }, { - "name" : "provider_city", - "bind" : "/model/instance/Vaccine_Stock_Position/provider_city", - "shouldLoadValue" : true - }, { - "name" : "provider_province", - "bind" : "/model/instance/Vaccine_Stock_Position/provider_province", - "shouldLoadValue" : true - }, { - "name" : "provider_id", - "bind" : "/model/instance/Vaccine_Stock_Position/provider_id", - "shouldLoadValue" : true - }, { - "name" : "provider_location_id", - "bind" : "/model/instance/Vaccine_Stock_Position/provider_location_id", - "shouldLoadValue" : true - }, { - "name" : "provider_location_name", - "bind" : "/model/instance/Vaccine_Stock_Position/provider_location_name", - "shouldLoadValue" : true - }, { - "name" : "provider_location_note", - "bind" : "/model/instance/Vaccine_Stock_Position/provider_location_note" - }, { - "name" : "start", - "bind" : "/model/instance/Vaccine_Stock_Position/start" - }, { - "name" : "end", - "bind" : "/model/instance/Vaccine_Stock_Position/end" - }, { - "name" : "today", - "bind" : "/model/instance/Vaccine_Stock_Position/today" - }, { - "name" : "deviceid", - "bind" : "/model/instance/Vaccine_Stock_Position/deviceid" - }, { - "name" : "subscriberid", - "bind" : "/model/instance/Vaccine_Stock_Position/subscriberid" - }, { - "name" : "simserial", - "bind" : "/model/instance/Vaccine_Stock_Position/simserial" - }, { - "name" : "phonenumber", - "bind" : "/model/instance/Vaccine_Stock_Position/phonenumber" - }, { - "name" : "date_formatted", - "bind" : "/model/instance/Vaccine_Stock_Position/date_formatted" - }, { - "name" : "vaccinator_name", - "bind" : "/model/instance/Vaccine_Stock_Position/vaccinator_name" - }, { - "name" : "center_name", - "bind" : "/model/instance/Vaccine_Stock_Position/center_name" - }, { - "name" : "date", - "bind" : "/model/instance/Vaccine_Stock_Position/date" - }, { - "name" : "report", - "bind" : "/model/instance/Vaccine_Stock_Position/report" - }, { - "name" : "Target_assigned_for_vaccination_at_each_month", - "bind" : "/model/instance/Vaccine_Stock_Position/Target_assigned_for_vaccination_at_each_month" - }, { - "name" : "Target_assigned_for_vaccination_for_the_year", - "bind" : "/model/instance/Vaccine_Stock_Position/Target_assigned_for_vaccination_for_the_year" - }, { - "name" : "bcg_balance_in_hand", - "bind" : "/model/instance/Vaccine_Stock_Position/bcg_balance_in_hand" - }, { - "name" : "bcg_received", - "bind" : "/model/instance/Vaccine_Stock_Position/bcg_received" - }, { - "name" : "bcg_wasted", - "bind" : "/model/instance/Vaccine_Stock_Position/bcg_wasted" - }, { - "name" : "opv_balance_in_hand", - "bind" : "/model/instance/Vaccine_Stock_Position/opv_balance_in_hand" - }, { - "name" : "opv_received", - "bind" : "/model/instance/Vaccine_Stock_Position/opv_received" - }, { - "name" : "opv_wasted", - "bind" : "/model/instance/Vaccine_Stock_Position/opv_wasted" - }, { - "name" : "ipv_balance_in_hand", - "bind" : "/model/instance/Vaccine_Stock_Position/ipv_balance_in_hand" - }, { - "name" : "ipv_received", - "bind" : "/model/instance/Vaccine_Stock_Position/ipv_received" - }, { - "name" : "ipv_wasted", - "bind" : "/model/instance/Vaccine_Stock_Position/ipv_wasted" - }, { - "name" : "pcv_balance_in_hand", - "bind" : "/model/instance/Vaccine_Stock_Position/pcv_balance_in_hand" - }, { - "name" : "pcv_received", - "bind" : "/model/instance/Vaccine_Stock_Position/pcv_received" - }, { - "name" : "pcv_wasted", - "bind" : "/model/instance/Vaccine_Stock_Position/pcv_wasted" - }, { - "name" : "penta_balance_in_hand", - "bind" : "/model/instance/Vaccine_Stock_Position/penta_balance_in_hand" - }, { - "name" : "penta_received", - "bind" : "/model/instance/Vaccine_Stock_Position/penta_received" - }, { - "name" : "penta_wasted", - "bind" : "/model/instance/Vaccine_Stock_Position/penta_wasted" - }, { - "name" : "measles_balance_in_hand", - "bind" : "/model/instance/Vaccine_Stock_Position/measles_balance_in_hand" - }, { - "name" : "measles_received", - "bind" : "/model/instance/Vaccine_Stock_Position/measles_received" - }, { - "name" : "measles_wasted", - "bind" : "/model/instance/Vaccine_Stock_Position/measles_wasted" - }, { - "name" : "tt_balance_in_hand", - "bind" : "/model/instance/Vaccine_Stock_Position/tt_balance_in_hand" - }, { - "name" : "tt_received", - "bind" : "/model/instance/Vaccine_Stock_Position/tt_received" - }, { - "name" : "tt_wasted", - "bind" : "/model/instance/Vaccine_Stock_Position/tt_wasted" - }, { - "name" : "dilutants_balance_in_hand", - "bind" : "/model/instance/Vaccine_Stock_Position/dilutants_balance_in_hand" - }, { - "name" : "dilutants_received", - "bind" : "/model/instance/Vaccine_Stock_Position/dilutants_received" - }, { - "name" : "dilutants_wasted", - "bind" : "/model/instance/Vaccine_Stock_Position/dilutants_wasted" - }, { - "name" : "syringes_balance_in_hand", - "bind" : "/model/instance/Vaccine_Stock_Position/syringes_balance_in_hand" - }, { - "name" : "syringes_received", - "bind" : "/model/instance/Vaccine_Stock_Position/syringes_received" - }, { - "name" : "syringes_wasted", - "bind" : "/model/instance/Vaccine_Stock_Position/syringes_wasted" - }, { - "name" : "safety_boxes_balance_in_hand", - "bind" : "/model/instance/Vaccine_Stock_Position/safety_boxes_balance_in_hand" - }, { - "name" : "safety_boxes_received", - "bind" : "/model/instance/Vaccine_Stock_Position/safety_boxes_received" - }, { - "name" : "safety_boxes_wasted", - "bind" : "/model/instance/Vaccine_Stock_Position/safety_boxes_wasted" - }, { - "name" : "total_wasted", - "bind" : "/model/instance/Vaccine_Stock_Position/total_wasted" - }, { - "name" : "total_received", - "bind" : "/model/instance/Vaccine_Stock_Position/total_received" - }, { - "name" : "total_balanceInHand", - "bind" : "/model/instance/Vaccine_Stock_Position/total_balanceInHand" - }, { - "name" : "instanceID", - "bind" : "/model/instance/Vaccine_Stock_Position/meta/instanceID" - } ] - } -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/vaccine_stock_position/model.xml b/opensrp-core/src/test/resources/form/vaccine_stock_position/model.xml deleted file mode 100644 index faec7c2e5c..0000000000 --- a/opensrp-core/src/test/resources/form/vaccine_stock_position/model.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/opensrp-core/src/test/resources/form/woman_enrollment/form.json b/opensrp-core/src/test/resources/form/woman_enrollment/form.json deleted file mode 100644 index fe3f23a6a2..0000000000 --- a/opensrp-core/src/test/resources/form/woman_enrollment/form.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"Woman_TT_Enrollment_Form","title":"خواتین انرولمنٹ فارم برائے ٹی ٹی ٹیکاجات - Woman TT Enrollment Form","sms_keyword":"woman_tt_enrollement_form","default_language":"English","choices":{"provinces":[{"name":"kpk","label":{"Urdu":"خیبر پختون خواہ","English":"Khyber Pakhtunkhwa","Roman Urdu":"Khyber Pakhtunkhwa"}},{"name":"sindh","label":{"Urdu":"سندھ","English":"Sindh","Roman Urdu":"Sindh"}},{"name":"balochistan","label":{"Urdu":"بلوچستان","English":"Balochistan","Roman Urdu":"Balochistan"}},{"name":"punjab","label":{"Urdu":"پنجاب","English":"Punjab","Roman Urdu":"Punjab"}},{"name":"gilgit_baltistan","label":{"Urdu":"گلگت بلتستان","English":"Gilgit Baltistan","Roman Urdu":"Gilgit Baltistan"}},{"name":"kashmir","label":{"Urdu":"کشمیر","English":"Kashmir","Roman Urdu":"Kashmir"}},{"name":"fata","label":{"Urdu":"فاٹا","English":"FATA","Roman Urdu":"FATA"}},{"name":"out_of_country","label":{"Urdu":"ملک سے باہر","English":"Out of Country","Roman Urdu":"Mulk se baahir"}}],"ucs":[{"province":"sindh","city":"karachi","town":"korangi","name":"bilal_colony","label":{"Urdu":"بلال کالونی","Roman Urdu":"Bilal Colony","English":"Bilal Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"nasir_colony","label":{"Urdu":"ناصر کالونی","Roman Urdu":"Nasir Colony","English":"Nasir Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"chakra_goth","label":{"Urdu":"چکرا گوٹھ","Roman Urdu":"Chakra Goth","English":"Chakra Goth"}},{"province":"sindh","city":"karachi","town":"korangi","name":"mustafa_taj_colony","label":{"Urdu":"مصطفی تاج کالونی","Roman Urdu":"Mustafa Taj Colony","English":"Mustafa Taj Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"hundred_quarters","label":{"Urdu":"ہنڈریڈ کوارٹر","Roman Urdu":"Hundred Quarters","English":"Hundred Quarters"}},{"province":"sindh","city":"karachi","town":"korangi","name":"gulzar_colony","label":{"Urdu":"گلزار کالونی","Roman Urdu":"Gulzar Colony","English":"Gulzar Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"korangi_sector_33","label":{"Urdu":"کورنگی سیکٹر 33","Roman Urdu":"Korangi Sector 33","English":"Korangi Sector 33"}},{"province":"sindh","city":"karachi","town":"korangi","name":"zaman_town","label":{"Urdu":"زمان ٹاوَن","Roman Urdu":"Zaman Town","English":"Zaman Town"}},{"province":"sindh","city":"karachi","town":"korangi","name":"hasrat_mohani_colony","label":{"Urdu":"حسرت موہانی کالونی","Roman Urdu":"Hasrat Mohani Colony","English":"Hasrat Mohani Colony"}},{"province":"sindh","city":"karachi","town":"baldia","name":"gulshan_e_ghazi","label":{"Urdu":"گلشن غازی","Roman Urdu":"Gulshan-e-Ghazi","English":"Gulshan-e-Ghazi"}},{"province":"sindh","city":"karachi","town":"baldia","name":"ittehad_town","label":{"Urdu":"اتحاد ٹاوَن","Roman Urdu":"Ittehad Town","English":"Ittehad Town"}},{"province":"sindh","city":"karachi","town":"baldia","name":"islam_nagar","label":{"Urdu":"اسلام نگر","Roman Urdu":"Islam Nagar","English":"Islam Nagar"}},{"province":"sindh","city":"karachi","town":"baldia","name":"nai_abadi","label":{"Urdu":"نئی آبادی","Roman Urdu":"Nai Abadi","English":"Nai Abadi"}},{"province":"sindh","city":"karachi","town":"baldia","name":"saeedabad","label":{"Urdu":"سعید آباد","Roman Urdu":"Saeedabad","English":"Saeedabad"}},{"province":"sindh","city":"karachi","town":"baldia","name":"muslim_mujahid_colony","label":{"Urdu":"مسلم مجاہد کالونی","Roman Urdu":"Muslim Mujahid Colony","English":"Muslim Mujahid Colony"}},{"province":"sindh","city":"karachi","town":"baldia","name":"muhajir_camp","label":{"Urdu":"مہاجر کیمپ","Roman Urdu":"Muhajir Camp","English":"Muhajir Camp"}},{"province":"sindh","city":"karachi","town":"baldia","name":"rasheedabad","label":{"Urdu":"رشید آباد","Roman Urdu":"Rasheedabad","English":"Rasheedabad"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"ibrahim_hyderi","label":{"Urdu":"ابراہیم حیدری","Roman Urdu":"Ibrahim Hyderi","English":"Ibrahim Hyderi"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"rehri","label":{"Urdu":"رہڑی","Roman Urdu":"Rehri","English":"Rehri"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"cattle_colony","label":{"Urdu":"کیٹل کالونی","Roman Urdu":"Cattle Colony","English":"Cattle Colony"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"qaidabad","label":{"Urdu":"قائدآباد","Roman Urdu":"Qaidabad","English":"Qaidabad"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"landhi_colony","label":{"Urdu":"لانڈھی کالونی","Roman Urdu":"Landhi Colony","English":"Landhi Colony"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"gulshan_e_hadeed","label":{"Urdu":"گلشن حدید","Roman Urdu":"Gulshan-e-Hadeed","English":"Gulshan-e-Hadeed"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"gaghar","label":{"Urdu":"گگر","Roman Urdu":"Gaghar","English":"Gaghar"}},{"province":"sindh","city":"karachi","town":"gadap","name":"murad_memon_goth","label":{"Urdu":"مراد میمن گوٹھ","Roman Urdu":"Murad Memon Goth","English":"Murad Memon Goth"}},{"province":"sindh","city":"karachi","town":"gadap","name":"darsano_chana","label":{"Urdu":"درشانو شنو","Roman Urdu":"Darsano Chana","English":"Darsano Chana"}},{"province":"sindh","city":"karachi","town":"gadap","name":"gujro","label":{"Urdu":"گجرو","Roman Urdu":"Gujro","English":"Gujro"}},{"province":"sindh","city":"karachi","town":"gadap","name":"songal","label":{"Urdu":"سنگل","Roman Urdu":"Songal","English":"Songal"}},{"province":"sindh","city":"karachi","town":"gadap","name":"maymarabad","label":{"Urdu":"معمار آباد","Roman Urdu":"Maymarabad","English":"Maymarabad"}},{"province":"sindh","city":"karachi","town":"gadap","name":"yousuf_goth","label":{"Urdu":"یوسف گوٹھ","Roman Urdu":"Yousuf Goth","English":"Yousuf Goth"}},{"province":"sindh","city":"karachi","town":"gadap","name":"manghopir","label":{"Urdu":"منگھوپیر","Roman Urdu":"Manghopir","English":"Manghopir"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"azizabad","label":{"Urdu":"عزیز آباد","Roman Urdu":"Azizabad","English":"Azizabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"karimabad","label":{"Urdu":"کریم آباد","Roman Urdu":"Karimabad","English":"Karimabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"aisha_manzil","label":{"Urdu":"عائشہ منزل","Roman Urdu":"Aisha Manzil","English":"Aisha Manzil"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"ancholi","label":{"Urdu":"انچولی","Roman Urdu":"Ancholi","English":"Ancholi"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"naseerabad","label":{"Urdu":"نصیرآباد","Roman Urdu":"Naseerabad","English":"Naseerabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"yaseenabad","label":{"Urdu":"یاسین آباد","Roman Urdu":"Yaseenabad","English":"Yaseenabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"water_pump","label":{"Urdu":"واٹرپمپ","Roman Urdu":"Water Pump","English":"Water Pump"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"shafiq_mill_colony","label":{"Urdu":"شفیق مل کالونی","Roman Urdu":"Shafiq Mill Colony","English":"Shafiq Mill Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"delhi_mercantile_society","label":{"Urdu":"دہلی مرچنٹائل سوسائٹی","Roman Urdu":"Delhi Mercantile Society","English":"Delhi Mercantile Society"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"civic_centre","label":{"Urdu":"سوک سینٹر","Roman Urdu":"Civic Centre","English":"Civic Centre"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"pir_ilahi_buksh_colony","label":{"Urdu":"پیر الہی بخش کالونی","Roman Urdu":"Pir Ilahi Buksh Colony","English":"Pir Ilahi Buksh Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"essa_nagri","label":{"Urdu":"عیسی نگری","Roman Urdu":"Essa Nagri","English":"Essa Nagri"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gulshan_e_iqbal","label":{"Urdu":"گلشن اقبال","Roman Urdu":"Gulshan-e-Iqbal","English":"Gulshan-e-Iqbal"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gillani_railway_station","label":{"Urdu":"گیلانی ریلوے اسٹیشن","Roman Urdu":"Gillani Railway Station","English":"Gillani Railway Station"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"shanti_nagar","label":{"Urdu":"شانتی نگر","Roman Urdu":"Shanti Nagar","English":"Shanti Nagar"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"jamali_colony","label":{"Urdu":"جمالی کالونی","Roman Urdu":"Jamali Colony","English":"Jamali Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gulshan_e_iqbal_ii","label":{"Urdu":"گلشن اقبال 2","Roman Urdu":"Gulshan-e-Iqbal II","English":"Gulshan-e-Iqbal II"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"pehlwan_goth","label":{"Urdu":"پہلوان گوٹھ","Roman Urdu":"Pehlwan Goth","English":"Pehlwan Goth"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"matrovil_colony","label":{"Urdu":"میٹروویل کالونی","Roman Urdu":"Matrovil Colony","English":"Matrovil Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gulzar_e_hijri","label":{"Urdu":"گلزار ہجری","Roman Urdu":"Gulzar-e-Hijri","English":"Gulzar-e-Hijri"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"safooran_goth","label":{"Urdu":"صفورا گوٹھ","Roman Urdu":"Safooran Goth","English":"Safooran Goth"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"akhtar_colony","label":{"Urdu":"اختر کالونی","Roman Urdu":"Akhtar Colony","English":"Akhtar Colony"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"manzoor_colony","label":{"Urdu":"منظور کالونی","Roman Urdu":"Manzoor Colony","English":"Manzoor Colony"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"azam_basti","label":{"Urdu":"اعظم بستی","Roman Urdu":"Azam Basti","English":"Azam Basti"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"chanesar_goth","label":{"Urdu":"چنیسر گوٹھ","Roman Urdu":"Chanesar Goth","English":"Chanesar Goth"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"mahmudabad","label":{"Urdu":"محمودآباد","Roman Urdu":"Mahmudabad","English":"Mahmudabad"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"pechs","label":{"Urdu":"پی۔ای۔سی۔ایچ۔ایس","Roman Urdu":"P.E.C.H.S.","English":"P.E.C.H.S."}},{"province":"sindh","city":"karachi","town":"jamshed","name":"pechs_ii","label":{"Urdu":"پی۔ای۔سی۔ایچ۔ایس 2","Roman Urdu":"P.E.C.H.S. II","English":"P.E.C.H.S. II"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"jut_line","label":{"Urdu":"جٹ لائن","Roman Urdu":"Jut Line","English":"Jut Line"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"central_jacob_lines","label":{"Urdu":"سینٹرل جیکب لائن","Roman Urdu":"Central Jacob Lines","English":"Central Jacob Lines"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"jamshed_quarters","label":{"Urdu":"جمشید کوارٹر","Roman Urdu":"Jamshed Quarters","English":"Jamshed Quarters"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"garden_east","label":{"Urdu":"گارڈن ایسٹ","Roman Urdu":"Garden East","English":"Garden East"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"soldier_bazar","label":{"Urdu":"سولجر بازار","Roman Urdu":"Soldier Bazar","English":"Soldier Bazar"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"pakistan_quarters","label":{"Urdu":"پاکستان کوارٹر","Roman Urdu":"Pakistan Quarters","English":"Pakistan Quarters"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"bhutta_village","label":{"Urdu":"بھٹا ولیج","Roman Urdu":"Bhutta Village","English":"Bhutta Village"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"sultanabad","label":{"Urdu":"سلطان آباد","Roman Urdu":"Sultanabad","English":"Sultanabad"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"kiamari_uc","label":{"Urdu":"کیماری یوسی","Roman Urdu":"Kiamari UC","English":"Kiamari UC"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"baba_bhit","label":{"Urdu":"بابا بھٹ","Roman Urdu":"Baba Bhit","English":"Baba Bhit"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"machar_colony","label":{"Urdu":"مچھر کالونی","Roman Urdu":"Machar Colony","English":"Machar Colony"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"maripur","label":{"Urdu":"ماڑی پور","Roman Urdu":"Maripur","English":"Maripur"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"shershah","label":{"Urdu":"شیرشاہ","Roman Urdu":"SherShah","English":"SherShah"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"gabo_pat","label":{"Urdu":"گابو پٹ","Roman Urdu":"Gabo Pat","English":"Gabo Pat"}},{"province":"sindh","city":"karachi","town":"landhi","name":"muzafarabad","label":{"Urdu":"مظفرآباد","Roman Urdu":"Muzafarabad","English":"Muzafarabad"}},{"province":"sindh","city":"karachi","town":"landhi","name":"muslimabad","label":{"Urdu":"مسلم آباد","Roman Urdu":"Muslimabad","English":"Muslimabad"}},{"province":"sindh","city":"karachi","town":"landhi","name":"dawood_chowrangi","label":{"Urdu":"داوَد چورنگی","Roman Urdu":"Dawood Chowrangi","English":"Dawood Chowrangi"}},{"province":"sindh","city":"karachi","town":"landhi","name":"moinabad","label":{"Urdu":"معین آباد","Roman Urdu":"Moinabad","English":"Moinabad"}},{"province":"sindh","city":"karachi","town":"landhi","name":"sharafi_goth","label":{"Urdu":"شرافی گوٹھ","Roman Urdu":"Sharafi Goth","English":"Sharafi Goth"}},{"province":"sindh","city":"karachi","town":"landhi","name":"bhutto_nagar","label":{"Urdu":"بھٹو نگر","Roman Urdu":"Bhutto Nagar","English":"Bhutto Nagar"}},{"province":"sindh","city":"karachi","town":"landhi","name":"khawaja_ajmeer_colony","label":{"Urdu":"خواجہ اجمیر کالونی","Roman Urdu":"Khawaja Ajmeer Colony","English":"Khawaja Ajmeer Colony"}},{"province":"sindh","city":"karachi","town":"landhi","name":"landhi_uc","label":{"Urdu":"لانڈھی یوسی","Roman Urdu":"Landhi UC","English":"Landhi UC"}},{"province":"sindh","city":"karachi","town":"landhi","name":"awami_colony","label":{"Urdu":"عوامی کالونی","Roman Urdu":"Awami Colony","English":"Awami Colony"}},{"province":"sindh","city":"karachi","town":"landhi","name":"burmee_colony","label":{"Urdu":"برمی کالونی","Roman Urdu":"Burmee Colony","English":"Burmee Colony"}},{"province":"sindh","city":"karachi","town":"landhi","name":"korangi_uc","label":{"Urdu":"کورنگی یوسی","Roman Urdu":"Korangi UC","English":"Korangi UC"}},{"province":"sindh","city":"karachi","town":"landhi","name":"sherabad","label":{"Urdu":"شیرآباد","Roman Urdu":"Sherabad","English":"Sherabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"rizvia_society","label":{"Urdu":"رضویہ سوسائٹی","Roman Urdu":"Rizvia Society","English":"Rizvia Society"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"firdous_colony","label":{"Urdu":"فردوس کالونی","Roman Urdu":"Firdous Colony","English":"Firdous Colony"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"super_market","label":{"Urdu":"سپر مارکیٹ","Roman Urdu":"Super Market","English":"Super Market"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"dak_khana","label":{"Urdu":"دک کھانہ","Roman Urdu":"Dak Khana","English":"Dak Khana"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"qasimabad","label":{"Urdu":"قاسم آباد","Roman Urdu":"Qasimabad","English":"Qasimabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"bandhani_colony","label":{"Urdu":"بندھانی کالونی","Roman Urdu":"Bandhani Colony","English":"Bandhani Colony"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"sharifabad","label":{"Urdu":"شریف آباد","Roman Urdu":"Sharifabad","English":"Sharifabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"commercial_area","label":{"Urdu":"کمرشل ایریا","Roman Urdu":"Commercial Area","English":"Commercial Area"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"mujahid_colony","label":{"Urdu":"مجاہد کالونی","Roman Urdu":"Mujahid Colony","English":"Mujahid Colony"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"nazimabad","label":{"Urdu":"ناظم آباد","Roman Urdu":"Nazimabad","English":"Nazimabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"abbasi_shaheed","label":{"Urdu":"عباسی شہید","Roman Urdu":"Abbasi Shaheed","English":"Abbasi Shaheed"}},{"province":"sindh","city":"karachi","town":"lyari","name":"agra_taj_colony","label":{"Urdu":"آگرہ تاج کالونی","Roman Urdu":"Agra Taj Colony","English":"Agra Taj Colony"}},{"province":"sindh","city":"karachi","town":"lyari","name":"daryaabad","label":{"Urdu":"دریاآباد","Roman Urdu":"Daryaabad","English":"Daryaabad"}},{"province":"sindh","city":"karachi","town":"lyari","name":"nawabad","label":{"Urdu":"نواآباد","Roman Urdu":"Nawabad","English":"Nawabad"}},{"province":"sindh","city":"karachi","town":"lyari","name":"khada_memon_society","label":{"Urdu":"خدا- میمن- سوساَٹی","Roman Urdu":"Khada Memon Society","English":"Khada Memon Society"}},{"province":"sindh","city":"karachi","town":"lyari","name":"baghdadi","label":{"Urdu":"بغدادی","Roman Urdu":"Baghdadi","English":"Baghdadi"}},{"province":"sindh","city":"karachi","town":"lyari","name":"shah_baig_line","label":{"Urdu":"شاھ باغ لائن","Roman Urdu":"Shah Baig Line","English":"Shah Baig Line"}},{"province":"sindh","city":"karachi","town":"lyari","name":"bihar_colony","label":{"Urdu":"بہار کالونی","Roman Urdu":"Bihar Colony","English":"Bihar Colony"}},{"province":"sindh","city":"karachi","town":"lyari","name":"ragiwara","label":{"Urdu":"راگی واڑا","Roman Urdu":"Ragiwara","English":"Ragiwara"}},{"province":"sindh","city":"karachi","town":"lyari","name":"singo_line","label":{"Urdu":"سنگولائن","Roman Urdu":"Singo Line","English":"Singo Line"}},{"province":"sindh","city":"karachi","town":"lyari","name":"chakiwara","label":{"Urdu":"چاکی واڑا","Roman Urdu":"Chakiwara","English":"Chakiwara"}},{"province":"sindh","city":"karachi","town":"lyari","name":"allama_iqbal_colony","label":{"Urdu":"علامہ اقبال کالونی","Roman Urdu":"Allama Iqbal Colony","English":"Allama Iqbal Colony"}},{"province":"sindh","city":"karachi","town":"malir","name":"model_colony","label":{"Urdu":"موڈل کالونی","Roman Urdu":"Model Colony","English":"Model Colony"}},{"province":"sindh","city":"karachi","town":"malir","name":"kala_board","label":{"Urdu":"کالا بورڈ","Roman Urdu":"Kala Board","English":"Kala Board"}},{"province":"sindh","city":"karachi","town":"malir","name":"saudabad","label":{"Urdu":"سعودآباد","Roman Urdu":"Saudabad","English":"Saudabad"}},{"province":"sindh","city":"karachi","town":"malir","name":"khokhra_par","label":{"Urdu":"کھوکھرا پار","Roman Urdu":"Khokhra Par","English":"Khokhra Par"}},{"province":"sindh","city":"karachi","town":"malir","name":"jafar_e_tayyar","label":{"Urdu":"جعفر تیار","Roman Urdu":"Jafar-e-Tayyar","English":"Jafar-e-Tayyar"}},{"province":"sindh","city":"karachi","town":"malir","name":"gharibabad","label":{"Urdu":"غریب آباد","Roman Urdu":"Gharibabad","English":"Gharibabad"}},{"province":"sindh","city":"karachi","town":"malir","name":"ghazi_brohi_goth","label":{"Urdu":"غازی بروہی گوٹھ","Roman Urdu":"Ghazi Brohi Goth","English":"Ghazi Brohi Goth"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"kalyana","label":{"Urdu":"کالیانہ","Roman Urdu":"Kalyana","English":"Kalyana"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"sir_syed_colony","label":{"Urdu":"سر سید کالونی","Roman Urdu":"Sir Syed Colony","English":"Sir Syed Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"fatima_jinnah_colony","label":{"Urdu":"فاطمہ جناح کالونی","Roman Urdu":"Fatima Jinnah Colony","English":"Fatima Jinnah Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"godhra","label":{"Urdu":"گودھرا","Roman Urdu":"Godhra","English":"Godhra"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"abu_zar_ghaffari","label":{"Urdu":"ابو زر غفاری","Roman Urdu":"Abu Zar Ghaffari","English":"Abu Zar Ghaffari"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"hakim_ahsan","label":{"Urdu":"حاکم احسان","Roman Urdu":"Hakim Ahsan","English":"Hakim Ahsan"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"madina_colony","label":{"Urdu":"مدینہ کالونی","Roman Urdu":"Madina Colony","English":"Madina Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"faisal_colony","label":{"Urdu":"فیصل کالونی","Roman Urdu":"Faisal Colony","English":"Faisal Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"khamiso_goth","label":{"Urdu":"خمیسو گوٹھ","Roman Urdu":"Khamiso Goth","English":"Khamiso Goth"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"mustufa_colony","label":{"Urdu":"مصطفی کالونی","Roman Urdu":"Mustufa Colony","English":"Mustufa Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"khawaja_ajmeer_nagri","label":{"Urdu":"خواجہ اجمیر نگری","Roman Urdu":"Khawaja Ajmeer Nagri","English":"Khawaja Ajmeer Nagri"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"gulshan_e_saeed","label":{"Urdu":"گلشن سعید","Roman Urdu":"Gulshan-e-Saeed","English":"Gulshan-e-Saeed"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"shah_nawaz_bhutto_colony","label":{"Urdu":"شاہ نواز بھٹو کالونی","Roman Urdu":"Shah Nawaz Bhutto Colony","English":"Shah Nawaz Bhutto Colony"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"paposh_nagar","label":{"Urdu":"پاپوش نگر","Roman Urdu":"Paposh Nagar","English":"Paposh Nagar"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"pahar_ganj","label":{"Urdu":"پہاڑ گنج","Roman Urdu":"Pahar Ganj","English":"Pahar Ganj"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"khandu_goth","label":{"Urdu":"کھنڑو گوٹھ","Roman Urdu":"Khandu Goth","English":"Khandu Goth"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"hyderi","label":{"Urdu":"حیدری","Roman Urdu":"Hyderi","English":"Hyderi"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"sakhi_hassan","label":{"Urdu":"سخی حسن","Roman Urdu":"Sakhi Hassan","English":"Sakhi Hassan"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"farooq_e_azam","label":{"Urdu":"فاروق اعظم","Roman Urdu":"Farooq-e-Azam","English":"Farooq-e-Azam"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"nusrat_bhutto_colony","label":{"Urdu":"نصرت بھٹو کالونی","Roman Urdu":"Nusrat Bhutto Colony","English":"Nusrat Bhutto Colony"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"shadman_town","label":{"Urdu":"شادمان ٹاوَن","Roman Urdu":"Shadman Town","English":"Shadman Town"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"buffer_zone","label":{"Urdu":"بفرزون","Roman Urdu":"Buffer Zone","English":"Buffer Zone"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"buffer_zone_ii","label":{"Urdu":"بفرزون 2","Roman Urdu":"Buffer Zone II","English":"Buffer Zone II"}},{"province":"sindh","city":"karachi","town":"orangi","name":"mominabad","label":{"Urdu":"مومن آباد","Roman Urdu":"Mominabad","English":"Mominabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"haryana_colony","label":{"Urdu":"حریانہ کالونی","Roman Urdu":"Haryana Colony","English":"Haryana Colony"}},{"province":"sindh","city":"karachi","town":"orangi","name":"hanifabad","label":{"Urdu":"حنیف آباد","Roman Urdu":"Hanifabad","English":"Hanifabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"mohammad_nagar","label":{"Urdu":"محمد نگر","Roman Urdu":"Mohammad Nagar","English":"Mohammad Nagar"}},{"province":"sindh","city":"karachi","town":"orangi","name":"madina_colony_orangi","label":{"Urdu":"مدینہ کالونی اورنگی","Roman Urdu":"Madina Colony Orangi","English":"Madina Colony Orangi"}},{"province":"sindh","city":"karachi","town":"orangi","name":"ghaziabad","label":{"Urdu":"غازی آباد","Roman Urdu":"Ghaziabad","English":"Ghaziabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"chisti_nagar","label":{"Urdu":"چشتی نگر","Roman Urdu":"Chisti Nagar","English":"Chisti Nagar"}},{"province":"sindh","city":"karachi","town":"orangi","name":"bilal_colony_orangi","label":{"Urdu":"بلال کالونی اورنگی","Roman Urdu":"Bilal Colony Orangi","English":"Bilal Colony Orangi"}},{"province":"sindh","city":"karachi","town":"orangi","name":"iqbal_baloch_colony","label":{"Urdu":"اقبال بلوچ کالونی","Roman Urdu":"Iqbal Baloch Colony","English":"Iqbal Baloch Colony"}},{"province":"sindh","city":"karachi","town":"orangi","name":"ghabool_town","label":{"Urdu":"گبول ٹاوَن","Roman Urdu":"Ghabool Town","English":"Ghabool Town"}},{"province":"sindh","city":"karachi","town":"orangi","name":"data_nagar","label":{"Urdu":"داتا نگر","Roman Urdu":"Data Nagar","English":"Data Nagar"}},{"province":"sindh","city":"karachi","town":"orangi","name":"mujahidabad","label":{"Urdu":"مجاہد آباد","Roman Urdu":"Mujahidabad","English":"Mujahidabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"baloch_goth","label":{"Urdu":"بلوچ گوٹھ","Roman Urdu":"Baloch Goth","English":"Baloch Goth"}},{"province":"sindh","city":"karachi","town":"saddar","name":"old_haji_camp","label":{"Urdu":"پرانہ حاجی کیمپ","Roman Urdu":"Old Haji Camp","English":"Old Haji Camp"}},{"province":"sindh","city":"karachi","town":"saddar","name":"garden","label":{"Urdu":"گارڈن","Roman Urdu":"Garden","English":"Garden"}},{"province":"sindh","city":"karachi","town":"saddar","name":"kharadar","label":{"Urdu":"کھارادر","Roman Urdu":"Kharadar","English":"Kharadar"}},{"province":"sindh","city":"karachi","town":"saddar","name":"city_railway_colony","label":{"Urdu":"سٹی ریلوے کالونی","Roman Urdu":"City Railway Colony","English":"City Railway Colony"}},{"province":"sindh","city":"karachi","town":"saddar","name":"nanak_wara","label":{"Urdu":"ناناک واڑا","Roman Urdu":"Nanak Wara","English":"Nanak Wara"}},{"province":"sindh","city":"karachi","town":"saddar","name":"gazdarabad","label":{"Urdu":"گزدرآباد","Roman Urdu":"Gazdarabad","English":"Gazdarabad"}},{"province":"sindh","city":"karachi","town":"saddar","name":"millat_nagar_islam_pura","label":{"Urdu":"ملت نگر اسلام پورا","Roman Urdu":"Millat Nagar/Islam Pura","English":"Millat Nagar/Islam Pura"}},{"province":"sindh","city":"karachi","town":"saddar","name":"saddar_uc","label":{"Urdu":"صدر یو سی","Roman Urdu":"Saddar UC","English":"Saddar UC"}},{"province":"sindh","city":"karachi","town":"saddar","name":"civil_line","label":{"Urdu":"سول لائن","Roman Urdu":"Civil Line","English":"Civil Line"}},{"province":"sindh","city":"karachi","town":"saddar","name":"clifton","label":{"Urdu":"کلفٹن","Roman Urdu":"Clifton","English":"Clifton"}},{"province":"sindh","city":"karachi","town":"saddar","name":"kehkashan","label":{"Urdu":"کہکشان","Roman Urdu":"Kehkashan","English":"Kehkashan"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"natha_khan_goth","label":{"Urdu":"ناتھا خان گوٹھ","Roman Urdu":"Natha Khan Goth","English":"Natha Khan Goth"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"pak_sadat_colony","label":{"Urdu":"پاک صدر کالونی","Roman Urdu":"Pak Sadat Colony","English":"Pak Sadat Colony"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"drigh_colony","label":{"Urdu":"ڈرگ کالونی","Roman Urdu":"Drigh Colony","English":"Drigh Colony"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"raita_plot","label":{"Urdu":"رائتا پلاٹ","Roman Urdu":"Raita Plot","English":"Raita Plot"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"moria_khan_goth","label":{"Urdu":"موریا خان گوٹھ","Roman Urdu":"Moria Khan Goth","English":"Moria Khan Goth"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"rafa_e_aam_society","label":{"Urdu":"رفا عام سوسا ئٹی","Roman Urdu":"Rafa-e-Aam Society","English":"Rafa-e-Aam Society"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"al_falah_society","label":{"Urdu":"الفلاح سوسا ئٹی","Roman Urdu":"Al-Falah Society","English":"Al-Falah Society"}},{"province":"sindh","city":"karachi","town":"site","name":"pak_colony","label":{"Urdu":"پاک کالونی","Roman Urdu":"Pak Colony","English":"Pak Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"old_golimar","label":{"Urdu":"پرانہ گولی مار","Roman Urdu":"Old Golimar","English":"Old Golimar"}},{"province":"sindh","city":"karachi","town":"site","name":"jahanabad","label":{"Urdu":"جہان آباد","Roman Urdu":"Jahanabad","English":"Jahanabad"}},{"province":"sindh","city":"karachi","town":"site","name":"metrovil","label":{"Urdu":"میٹروویل","Roman Urdu":"Metrovil","English":"Metrovil"}},{"province":"sindh","city":"karachi","town":"site","name":"bhawani_chali","label":{"Urdu":"بہوانی چالی","Roman Urdu":"Bhawani Chali","English":"Bhawani Chali"}},{"province":"sindh","city":"karachi","town":"site","name":"frontier_colony","label":{"Urdu":"فرونٹر کالونی","Roman Urdu":"Frontier Colony","English":"Frontier Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"banaras_colony","label":{"Urdu":"بنارس کالونی","Roman Urdu":"Banaras Colony","English":"Banaras Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"qasba_colony","label":{"Urdu":"قصبہ کالونی","Roman Urdu":"Qasba Colony","English":"Qasba Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"islamia_colony","label":{"Urdu":"اسلامیہ کالونی","Roman Urdu":"Islamia Colony","English":"Islamia Colony"}},{"province":"na","city":"na","town":"na","name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}},{"province":"na","city":"na","town":"na","name":"not_applicable","label":{"Urdu":"قابل اطلاق نہیں","Roman Urdu":"Qaabil-e-atlaaq nahi","English":"Not Applicable"}}],"gender":[{"instance":{"openmrs_code":"1534AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"male","label":{"Urdu":"مرد/ لڑکا","Roman Urdu":"Mard/larka","English":"Male"}},{"instance":{"openmrs_code":"1535AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"female","label":{"Urdu":"عورت/لڑکی","Roman Urdu":"Aurat/larki","English":"Female"}},{"instance":{"openmrs_code":"163163AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"transgender","label":{"Urdu":"خواجہ سرہ","Roman Urdu":"Khwaja sira","English":"Transgender"}}],"vaccines":[{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT1","label":{"Urdu":"ٹی ٹی 1","Roman Urdu":"TT1","English":"TT1"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT2","label":{"Urdu":"ٹی ٹی 2","Roman Urdu":"TT2","English":"TT2"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT3","label":{"Urdu":"ٹی ٹی 3","Roman Urdu":"TT3","English":"TT3"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT4","label":{"Urdu":"ٹی ٹی 4","Roman Urdu":"TT4","English":"TT4"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT5","label":{"Urdu":"ٹی ٹی 5","Roman Urdu":"TT5","English":"TT5"}}],"towns":[{"province":"sindh","city":"karachi","name":"korangi","label":{"Urdu":"کورنگی","Roman Urdu":"Korangi","English":"Korangi"}},{"province":"sindh","city":"karachi","name":"landhi","label":{"Urdu":"لانڈھی","Roman Urdu":"Landhi","English":"Landhi"}},{"province":"sindh","city":"karachi","name":"baldia","label":{"Urdu":"بلدیہ","Roman Urdu":"Baldia","English":"Baldia"}},{"province":"sindh","city":"karachi","name":"bin_qasim","label":{"Urdu":"بن قاسم","Roman Urdu":"Bin Qasim","English":"Bin Qasim"}},{"province":"sindh","city":"karachi","name":"gadap","label":{"Urdu":"گڈاپ","Roman Urdu":"Gadap","English":"Gadap"}},{"province":"sindh","city":"karachi","name":"gulberg","label":{"Urdu":"گلبرگ","Roman Urdu":"Gulberg","English":"Gulberg"}},{"province":"sindh","city":"karachi","name":"gulshan","label":{"Urdu":"گلشن","Roman Urdu":"Gulshan","English":"Gulshan"}},{"province":"sindh","city":"karachi","name":"jamshed","label":{"Urdu":"جمشید","Roman Urdu":"Jamshed","English":"Jamshed"}},{"province":"sindh","city":"karachi","name":"kiamari","label":{"Urdu":"کیماری","Roman Urdu":"Kiamari","English":"Kiamari"}},{"province":"sindh","city":"karachi","name":"liaquatabad","label":{"Urdu":"لیاقت آباد","Roman Urdu":"Liaquatabad","English":"Liaquatabad"}},{"province":"sindh","city":"karachi","name":"lyari","label":{"Urdu":"لیاری","Roman Urdu":"Lyari","English":"Lyari"}},{"province":"sindh","city":"karachi","name":"malir","label":{"Urdu":"ملیر","Roman Urdu":"Malir","English":"Malir"}},{"province":"sindh","city":"karachi","name":"new_karachi","label":{"Urdu":"نیو کراچی","Roman Urdu":"New Karachi","English":"New Karachi"}},{"province":"sindh","city":"karachi","name":"north_nazimabad","label":{"Urdu":"نارتھ ناظم آباد","Roman Urdu":"North Nazimabad","English":"North Nazimabad"}},{"province":"sindh","city":"karachi","name":"orangi","label":{"Urdu":"اورنگی","Roman Urdu":"Orangi","English":"Orangi"}},{"province":"sindh","city":"karachi","name":"saddar","label":{"Urdu":"صدر","Roman Urdu":"Saddar","English":"Saddar"}},{"province":"sindh","city":"karachi","name":"shah_faisal","label":{"Urdu":"شاہ فیصل","Roman Urdu":"Shah Faisal","English":"Shah Faisal"}},{"province":"sindh","city":"karachi","name":"site","label":{"Urdu":"سائٹ","Roman Urdu":"S.I.T.E.","English":"S.I.T.E."}},{"province":"na","city":"na","name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}},{"province":"na","city":"na","name":"not_applicable","label":{"Urdu":"قابل اطلاق نہیں","Roman Urdu":"Qaabil-e-atlaaq nahi","English":"Not Applicable"}}],"cities":[{"province":"sindh","name":"karachi","label":{"Urdu":"کراچی","Roman Urdu":"Karachi","English":"Karachi"}},{"province":"punjab","name":"hafizabad","label":{"Urdu":"حافظ آباد","Roman Urdu":"Hafizabad","English":"Hafizabad"}},{"province":"punjab","name":"muzaffargarh","label":{"Urdu":"مظفر گڑھ","Roman Urdu":"Muzaffargarh","English":"Muzaffargarh"}},{"province":"na","name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}},{"province":"na","name":"not_applicable","label":{"Urdu":"قابل اطلاق نہیں","Roman Urdu":"Not Applicable","English":"Not Applicable"}}],"edd_lmp":[{"instance":{"openmrs_code":"5596AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"edd","label":{"Urdu":"زچگی کی متوقع تاریخ","Roman Urdu":"EDD","English":"EDD"}},{"instance":{"openmrs_code":"1427AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"lmp","label":{"Urdu":"پچھلی مہواری کی تاریخ","Roman Urdu":"LMP","English":"LMP"}},{"instance":{"openmrs_code":"159617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"ultrasound","label":{"Urdu":"الٹرا سائونڈ","Roman Urdu":"Ultrasound","English":"Ultrasound"}},{"instance":{"openmrs_code":"1107AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"none","label":{"Urdu":"کوئی بھی نہیں","Roman Urdu":"Koi bhi nahi","English":"None of the above"}}],"ethnicity":[{"instance":{"openmrs_code":"163215AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"punjabi","label":{"Urdu":"پنجابی","Roman Urdu":"Punjabi","English":"Punjabi"}},{"instance":{"openmrs_code":"163216AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pushtuns","label":{"Urdu":"پشتون","Roman Urdu":"Pushtun","English":"Pushtun"}},{"instance":{"openmrs_code":"163217AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"sindhi","label":{"Urdu":"سندھی","Roman Urdu":"Sindhi","English":"Sindhi"}},{"instance":{"openmrs_code":"163218AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"saraiki","label":{"Urdu":"سرائیکی","Roman Urdu":"Saraiki","English":"Saraiki"}},{"instance":{"openmrs_code":"163219AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"muhajir","label":{"Urdu":"مہاجر","Roman Urdu":"Muhajir","English":"Muhajir"}},{"instance":{"openmrs_code":"163220AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"balochi","label":{"Urdu":"بلوچی","Roman Urdu":"Balochi","English":"Balochi"}},{"instance":{"openmrs_code":"5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}}],"yes_no":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}]},"instance":{"encounter_type":"Woman TT enrollment"},"version":"201604080500","id_string":"woman_tt_enrollement_form","type":"survey","children":[{"type":"hidden","name":"provider_uc"},{"type":"hidden","name":"provider_town"},{"type":"hidden","name":"provider_city"},{"type":"hidden","name":"provider_province"},{"type":"hidden","name":"provider_id"},{"instance":{"openmrs_entity_id":"location_id","openmrs_entity":"encounter"},"type":"hidden","name":"provider_location_id"},{"instance":{"openmrs_entity_id":"Program Client ID","openmrs_entity":"person_identifier"},"type":"hidden","name":"existing_program_client_id"},{"type":"hidden","name":"provider_location_name"},{"instance":{"openmrs_entity_id":"gender","openmrs_entity":"person"},"type":"hidden","name":"gender"},{"type":"note","name":"provider_location_note","label":{"Urdu":"شہر: ${provider_city} ; ٹائون: ${provider_town} ; یوسی: ${provider_uc} ; سینٹرکا نام: ${provider_location_name}","English":"City: ${provider_city} ; Town: ${provider_town} ; UC: ${provider_uc} ; Center Name: ${provider_location_name}","Roman Urdu":"Shehr: ${provider_city} ; Town: ${provider_town} ; UC: ${provider_uc} ; Center ka naam: ${provider_location_name}"}},{"instance":{"openmrs_entity_id":"163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"start","name":"start"},{"instance":{"openmrs_entity_id":"163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"end","name":"end"},{"instance":{"openmrs_entity_id":"163286AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"today","name":"today"},{"instance":{"openmrs_entity_id":"163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"deviceid","name":"deviceid"},{"instance":{"openmrs_entity_id":"163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"subscriberid","name":"subscriberid"},{"instance":{"openmrs_entity_id":"163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"simserial","name":"simserial"},{"instance":{"openmrs_entity_id":"163152AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"phonenumber","name":"phonenumber"},{"name":"client_reg_date","hint":{"Urdu":"خاتون کو ویکسین لگنے کی تاریخ","English":"Date on which woman was vaccinated","Roman Urdu":"Khatoon ko vaccine lagnay ki tareekh"},"bind":{"jr:constraintMsg":{"Urdu":"پروگرام مین اندراج کی تاریخ مستقبل کی نہیں ہوسکتی","English":"Client registration date cannot be in the future","Roman Urdu":"Program mai andraaj ki tareekh mustaqbil ki nahi hosakti"},"required":"yes","constraint":".<=${today}"},"label":{"Urdu":"پروگرام میں اندراج کی تاریخ","English":"Client Registration date","Roman Urdu":"Program mai andraj ki tareekh"},"instance":{"openmrs_entity_id":"encounter_date","openmrs_entity":"encounter"},"type":"date"},{"bind":{"required":"yes"},"type":"note","name":"program_client_id","label":{"Urdu":"کلائنٹ کی پروگرام آئی ڈی {existing_program_client_id}$","Roman Urdu":"Client ki program ID ${existing_program_client_id}","English":"Program Client ID ${existing_program_client_id}"}},{"bind":{"jr:constraintMsg":{"Urdu":"نمبر آٹھ ہندسوں پر مشتمل ہونا چاہئے","English":"Number should be 8 digits","Roman Urdu":"Number 8 hindason par mushtamil hona chahiye"},"required":"yes","constraint":"string-length(.) = 8"},"type":"integer","instance":{"openmrs_entity_id":"EPI Card Number","openmrs_entity":"person_attribute"},"name":"epi_card_number","label":{"Urdu":"کارڈ نمبر","English":"EPI Card Number","Roman Urdu":"EPI Card Number"}},{"bind":{"jr:constraintMsg":{"Urdu":"نام تین سے پچیس حروف پر مشتمل ہونا چاہئے","English":"Name should be 3 to 25 characters long","Roman Urdu":"Naam 3 say 25 huroof par mushtamil hona chahiye"},"required":"yes","constraint":"regex(., '^[a-zA-Z\\s\\.\\-]{3,25}$')"},"type":"text","instance":{"openmrs_entity_id":"first_name","openmrs_entity":"person"},"name":"first_name","label":{"Urdu":"نام","English":"First Name","Roman Urdu":"Naam"}},{"default":"yes","label":{"Urdu":"کیا تاریخ پیدائش معلوم ہے؟","Roman Urdu":"Kya tareekh-e-pedaaish maloom hai?","English":"Is birthdate known?"},"type":"select one","children":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}],"name":"member_birth_date_known"},{"bind":{"jr:constraintMsg":{"Urdu":"یہ تاریخ مستقبل کی نہیں ہوسکتی","Roman Urdu":"Ye tareekh mustaqbil ki nahi hosakti","English":"This date cannot be in the future"},"relevant":"selected(${member_birth_date_known}, 'yes')","constraint":".<=${today}"},"type":"date","name":"member_birth_date","label":{"Urdu":"تاریخ پیدائش","Roman Urdu":"Tareekh-e-pedaaish","English":"Birth date"}},{"bind":{"relevant":"selected(${member_birth_date_known}, 'no')"},"type":"integer","name":"age","label":{"Urdu":"عمر (سالوں میں)","Roman Urdu":"Umar (saalon me)","English":"Age (years)"}},{"bind":{"calculate":"int((${today} - ${member_birth_date}) div 365.25)"},"type":"calculate","name":"calc_age"},{"bind":{"calculate":"date(${today} - int(${age} * 365.25))"},"type":"calculate","name":"calc_dob"},{"bind":{"calculate":"if(${member_birth_date_known}='yes', ${member_birth_date}, ${calc_dob})"},"type":"calculate","name":"calc_dob_confirm","instance":{"openmrs_entity_id":"birthdate","openmrs_entity":"person"}},{"bind":{"calculate":"if(${member_birth_date_known} = 'yes', '0', '1')"},"type":"calculate","name":"calc_dob_estimated","instance":{"openmrs_entity_id":"birthdate_estimated","openmrs_entity":"person"}},{"bind":{"calculate":"if(${member_birth_date_known}='yes', ${calc_age}, ${age})"},"type":"calculate","name":"calc_age_confirm","instance":{"openmrs_entity_id":"154384AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"}},{"type":"note","name":"birth_date_note","label":{"Urdu":"کلائنٹ کی تاریخ پیدائش:${calc_dob_confirm}","English":"Date of Birth: ${calc_dob_confirm}","Roman Urdu":"Member ki Tareekh-e-pedaaish: ${calc_dob_confirm}"}},{"type":"note","name":"note_age","label":{"Urdu":"عمر :{calc_age_confirm}$ سال","English":"Age: ${calc_age_confirm} years","Roman Urdu":"Umar: ${calc_age_confirm} saal"}},{"default":"female","bind":{"required":"yes","calculate":"concat(\"female\",\"\")"},"type":"calculate","name":"gender1","label":{"Urdu":"جنس","Roman Urdu":"Jins","English":"Gender"}},{"bind":{"jr:constraintMsg":{"Urdu":"نام تین سے پچیس حروف پر مشتمل ہونا چاہئے","English":"Name should be 3 to 25 characters long","Roman Urdu":"Naam 3 say 25 huroof par mushtamil hona chahiye"},"constraint":"regex(., '^[a-zA-Z\\s\\.\\-]{3,25}$')"},"type":"text","instance":{"openmrs_entity_id":"1594AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"name":"father_name","label":{"Urdu":"والد کا نام","English":"Father's Name","Roman Urdu":"Waalid ka naam"}},{"label":{"Urdu":"کیا آپ شادی شدہ ہیں؟","English":"Are you married?","Roman Urdu":"Kya aap shaadi shuda hain?"},"type":"select one","children":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}],"name":"marriage"},{"bind":{"jr:constraintMsg":{"Urdu":"نام تین سے پچیس حروف پر مشتمل ہونا چاہئے","English":"Name should be 3 to 25 characters long","Roman Urdu":"Naam 3 say 25 huroof par mushtamil hona chahiye"},"relevant":"selected(${marriage}, 'yes')","constraint":"regex(., '^[a-zA-Z\\s\\.\\-]{3,25}$')"},"type":"text","instance":{"openmrs_entity_id":"161135AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"name":"husband_name","label":{"Urdu":"شوہر کا نام","English":"Husband's Name","Roman Urdu":"Shohar ka naam"}},{"bind":{"calculate":"if(${marriage} = 'no', ${father_name}, ${husband_name})"},"type":"calculate","name":"last_name","instance":{"openmrs_entity_id":"last_name","openmrs_entity":"person"}},{"control":{"appearance":"minimal"},"name":"ethnicity","bind":{"required":"yes"},"label":{"Urdu":"قومیت","English":"Ethnicity","Roman Urdu":"Qomiat"},"instance":{"openmrs_entity_id":"163153AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"select one","children":[{"instance":{"openmrs_code":"163215AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"punjabi","label":{"Urdu":"پنجابی","Roman Urdu":"Punjabi","English":"Punjabi"}},{"instance":{"openmrs_code":"163216AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"pushtuns","label":{"Urdu":"پشتون","Roman Urdu":"Pushtun","English":"Pushtun"}},{"instance":{"openmrs_code":"163217AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"sindhi","label":{"Urdu":"سندھی","Roman Urdu":"Sindhi","English":"Sindhi"}},{"instance":{"openmrs_code":"163218AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"saraiki","label":{"Urdu":"سرائیکی","Roman Urdu":"Saraiki","English":"Saraiki"}},{"instance":{"openmrs_code":"163219AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"muhajir","label":{"Urdu":"مہاجر","Roman Urdu":"Muhajir","English":"Muhajir"}},{"instance":{"openmrs_code":"163220AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"balochi","label":{"Urdu":"بلوچی","Roman Urdu":"Balochi","English":"Balochi"}},{"instance":{"openmrs_code":"5622AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}}]},{"bind":{"relevant":"selected(${ethnicity}, 'other')"},"type":"text","instance":{"openmrs_entity":"concept","openmrs_entity_id":"160632AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"163330AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"ethnicity_other","label":{"Urdu":"وضاحت کریں","Roman Urdu":"Wazaahat karain","English":"Please specify:"}},{"control":{"appearance":"minimal"},"name":"province","default":"${provider_province}","bind":{"required":"yes"},"label":{"Urdu":"صوبہ","Roman Urdu":"Suba","English":"Province"},"instance":{"openmrs_entity":"person_address","openmrs_entity_id":"stateProvince","openmrs_entity_parent":"usual_residence"},"type":"select one","children":[{"name":"kpk","label":{"Urdu":"خیبر پختون خواہ","English":"Khyber Pakhtunkhwa","Roman Urdu":"Khyber Pakhtunkhwa"}},{"name":"sindh","label":{"Urdu":"سندھ","English":"Sindh","Roman Urdu":"Sindh"}},{"name":"balochistan","label":{"Urdu":"بلوچستان","English":"Balochistan","Roman Urdu":"Balochistan"}},{"name":"punjab","label":{"Urdu":"پنجاب","English":"Punjab","Roman Urdu":"Punjab"}},{"name":"gilgit_baltistan","label":{"Urdu":"گلگت بلتستان","English":"Gilgit Baltistan","Roman Urdu":"Gilgit Baltistan"}},{"name":"kashmir","label":{"Urdu":"کشمیر","English":"Kashmir","Roman Urdu":"Kashmir"}},{"name":"fata","label":{"Urdu":"فاٹا","English":"FATA","Roman Urdu":"FATA"}},{"name":"out_of_country","label":{"Urdu":"ملک سے باہر","English":"Out of Country","Roman Urdu":"Mulk se baahir"}}]},{"control":{"appearance":"minimal"},"name":"city_village","choice_filter":"province=${province} or province='na'","default":"${provider_city}","bind":{"required":"yes"},"label":{"Urdu":"شہر","Roman Urdu":"Shehr","English":"City"},"itemset":"cities","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"cityVillage","openmrs_entity_parent":"usual_residence"},"type":"select one"},{"control":{"appearance":"minimal"},"name":"town","choice_filter":"(province=${province} and city=${city_village} ) or city='na'","bind":{"required":"yes"},"label":{"Urdu":"ٹاٰئون/ قصبہ/ بستی","Roman Urdu":"Town / Qasbah / Basti","English":"Town"},"itemset":"towns","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"town","openmrs_entity_parent":"usual_residence"},"type":"select one"},{"control":{"appearance":"minimal"},"name":"union_council","choice_filter":"(province=${province} and city=${city_village} and town=${town}) or town='na'","bind":{"required":"yes"},"label":{"Urdu":"یونین کونسل","Roman Urdu":"Union Council","English":"Union Council"},"itemset":"ucs","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"subTown","openmrs_entity_parent":"usual_residence"},"type":"select one"},{"bind":{"required":"yes"},"type":"text","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"house","openmrs_entity_parent":"usual_residence"},"name":"house_number","label":{"Urdu":"گھر کا نمبر","Roman Urdu":"Ghar ka number","English":"House Number"}},{"bind":{"required":"yes"},"type":"text","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"street","openmrs_entity_parent":"usual_residence"},"name":"street","label":{"Urdu":"گلی/کالونی/محلہ","Roman Urdu":"Gali/Colony/Mohalla","English":"Street"}},{"bind":{"required":"yes"},"type":"text","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"landmark","openmrs_entity_parent":"usual_residence"},"name":"landmark","label":{"Urdu":"گھر کے قریب کوئی مشہور جگہ","Roman Urdu":"Ghar ke qareeb koi mashoor jagah","English":"Land Mark"}},{"bind":{"calculate":"jr:choice-name(${province}, '${province}')"},"type":"calculate","name":"provincename"},{"bind":{"calculate":"jr:choice-name(${city_village}, '${city_village}')"},"type":"calculate","name":"city_villagename"},{"bind":{"calculate":"jr:choice-name(${town}, '${town}')"},"type":"calculate","name":"townname"},{"bind":{"calculate":"jr:choice-name(${union_council}, '${union_council}')"},"type":"calculate","name":"union_councilname"},{"type":"note","name":"address","label":{"Urdu":"پتہ: ${house_number}, ${street}, ${landmark}, ${union_councilname}, ${townname}, ${city_villagename}, ${provincename}","English":"Address: ${house_number}, ${street}, ${landmark}, ${union_councilname}, ${townname}, ${city_villagename}, ${provincename}","Roman Urdu":"Pata: ${house_number}, ${street}, ${landmark}, ${union_councilname}, ${townname}, ${city_villagename}, ${provincename}"}},{"instance":{"openmrs_entity_id":"163277AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"geopoint","name":"centre_gps","label":{"Urdu":"حاصل کردہ معلومات کی جگہ کے GPS کارڈینیٹس درج کریں","English":"Collect GPS coordinates of data entry location","Roman Urdu":"Hasil karda malomaat ki jaga ke GPS coordinates darj karain"}},{"name":"reminders_approval","bind":{"required":"yes"},"label":{"Urdu":"کیا آپ اپنے بچے کی اگلی ویکسین کی تاریخ کے لیے SMS موصول کرنا چاہتے ہیں؟","English":"Are you willing to receive SMS reminders for your next visit?","Roman Urdu":"Kya aap apnay bachay ki agli vaccine ki tareekh ke liye SMS mausool karna chahtay hain?"},"instance":{"openmrs_entity_id":"163089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"select one","children":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}]},{"bind":{"jr:constraintMsg":{"Urdu":"فون نمبر گیارہ ہندسوں پر مشتمل اور مندرجہ ذیل شکل میں ہونا چاہئے: *********03","English":"Phone number should be 11 digits in the following format: 03*********","Roman Urdu":"Phone number 11 hindason par mushtamil aur mundarja zail shakal main hona chahiey: 03*********"},"relevant":"${reminders_approval}='yes'","constraint":"regex(., '^03[0-9]{9}$')"},"type":"text","instance":{"openmrs_entity_id":"159635AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"name":"contact_phone_number","label":{"Urdu":"موبائل نمبر:","English":"Mobile Number:","Roman Urdu":"Mobile number:"}},{"instance":{"openmrs_entity_id":"5272AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"label":{"Urdu":"کیا خا تون حاملہ ہیں؟","English":"Is female pregnant?","Roman Urdu":"Kia khatoon haamla hain?"},"type":"select one","children":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}],"name":"pregnant"},{"name":"edd_lmp","bind":{"relevant":"selected (${pregnant}, 'yes')"},"label":{"Urdu":"کیا آپ کو اپنی پچھلی ماہواری کی تاریخ، زچگی کی متوقع تاریخ، یا الٹرا سائونڈ کا علم ہے؟","English":"Do you know your LMP, EDD or last Ultrasound information?","Roman Urdu":"Kya aap ko apni pichli mahwaari ki tareekh, zachgi ki mutawaqqa tareekh ya ultrasound ka ilm hai?"},"instance":{"openmrs_entity_id":"160697AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"select one","children":[{"instance":{"openmrs_code":"5596AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"edd","label":{"Urdu":"زچگی کی متوقع تاریخ","Roman Urdu":"EDD","English":"EDD"}},{"instance":{"openmrs_code":"1427AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"lmp","label":{"Urdu":"پچھلی مہواری کی تاریخ","Roman Urdu":"LMP","English":"LMP"}},{"instance":{"openmrs_code":"159617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"ultrasound","label":{"Urdu":"الٹرا سائونڈ","Roman Urdu":"Ultrasound","English":"Ultrasound"}},{"instance":{"openmrs_code":"1107AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"none","label":{"Urdu":"کوئی بھی نہیں","Roman Urdu":"Koi bhi nahi","English":"None of the above"}}]},{"bind":{"jr:constraintMsg":{"Urdu":"زچگی کی متوقع تاریخ ماضی کی نہیں ہو سکتی","Roman Urdu":"Zachgi ki mutawaqqa tareekh maazi ki nahi hosakti","English":"EDD cannot be in the past"},"relevant":"selected (${edd_lmp}, 'edd')","constraint":".>=${today}"},"type":"date","name":"edd","label":{"Urdu":"زچگی کی متوقع تاریخ","Roman Urdu":"Zachgi ki mutawaqqa tareekh","English":"EDD"}},{"bind":{"jr:constraintMsg":{"Urdu":"پچھلی ماہواری کی تاریخ مستقبل کی نہیں ہوسکتی","Roman Urdu":"Pichli mahwaari ki tareekh mustaqbil ki nahi hosakti","English":"LMP cannot be in the future"},"relevant":"selected (${edd_lmp}, 'lmp')","constraint":".<=${today}"},"type":"date","name":"lmp","label":{"Urdu":"پچھلی ماہواری کی تاریخ","Roman Urdu":"Pichli mahwaari ki tareekh","English":"LMP"}},{"bind":{"relevant":"selected (${edd_lmp}, 'ultrasound')"},"type":"date","instance":{"openmrs_entity_id":"163165AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"name":"ultrasound_date","label":{"Urdu":"الٹرا سائونڈ کی تاریخ","English":"Ultrasound Date","Roman Urdu":"Ultrasound ki tareekh"}},{"bind":{"relevant":"selected (${edd_lmp}, 'ultrasound')"},"type":"integer","name":"ultrasound_weeks","label":{"Urdu":"الٹرا سائونڈ کی مدد سے حمل کی مدت [ہفتوں میں]","Roman Urdu":"Ultrasound ki madad se hamal ki muddat (hafton me)","English":"Gestational age determined by ultrasound"}},{"bind":{"calculate":"date(${lmp}+280)"},"type":"calculate","name":"edd_calc_lmp"},{"bind":{"calculate":"date((280-(${ultrasound_weeks}*7)+${ultrasound_date} ))"},"type":"calculate","name":"edd_calc_ultrasound"},{"bind":{"calculate":"format-date(${edd_calc_lmp}, '%Y-%n-%e')"},"type":"calculate","name":"edd_calc_lmp_formatted"},{"bind":{"calculate":"format-date(${edd_calc_ultrasound}, '%Y-%n-%e')"},"type":"calculate","name":"edd_calc_ultrasound_formatted"},{"bind":{"calculate":"date(${edd}-280)"},"type":"calculate","name":"lmp_calc_edd"},{"bind":{"calculate":"date(${ultrasound_date}-(${ultrasound_weeks}*7))"},"type":"calculate","name":"lmp_calc_ultrasound"},{"bind":{"calculate":"format-date(${lmp_calc_edd}, '%Y-%n-%e')"},"type":"calculate","name":"lmp_calc_edd_formatted"},{"bind":{"calculate":"format-date(${lmp_calc_ultrasound}, '%Y-%n-%e')"},"type":"calculate","name":"lmp_calc_ultrasound_formatted"},{"bind":{"calculate":"if(${edd_lmp}='lmp',${edd_calc_lmp_formatted},if(${edd_lmp}='edd',${edd} ,if(${edd_lmp}='ultrasound',${edd_calc_ultrasound_formatted},'')))"},"type":"calculate","name":"final_edd","instance":{"openmrs_entity_id":"5596AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"}},{"bind":{"calculate":"if(${edd_lmp}='lmp',${lmp},if(${edd_lmp}='edd',${lmp_calc_edd_formatted} ,if(${edd_lmp}='ultrasound',${lmp_calc_ultrasound_formatted},'')))"},"type":"calculate","name":"final_lmp","instance":{"openmrs_entity_id":"1427AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"}},{"bind":{"calculate":"int((${today} - (${edd}-280))div7)"},"type":"calculate","name":"ga_edd"},{"bind":{"calculate":"int((${today} - ${lmp})div7)"},"type":"calculate","name":"ga_lmp"},{"bind":{"calculate":"int((${today} -(${ultrasound_date}-(${ultrasound_weeks}*7)))div7)"},"type":"calculate","name":"ga_ult"},{"bind":{"relevant":"selected (${pregnant}, 'yes')"},"type":"note","name":"final_edd_note","label":{"Urdu":"${final_edd}: زچگی کی متوقع تاریخ","Roman Urdu":"Zachgi ki mutawaqqa tareekh: ${final_edd}","English":"EDD: ${final_edd}"}},{"bind":{"relevant":"selected (${pregnant}, 'yes')"},"type":"note","name":"final_lmp_note","label":{"Urdu":"پچھلی ماہواری کی تاریخ :{final_lmp}$","Roman Urdu":"Pichli mahwaari ki tareekh: ${final_lmp}","English":"LMP: ${final_lmp}"}},{"bind":{"calculate":"if(${edd_lmp}='lmp',${ga_lmp},if(${edd_lmp}='edd',${ga_edd} ,if(${edd_lmp}='ultrasound',${ga_ult},'')))"},"type":"calculate","name":"final_ga","instance":{"openmrs_entity_id":"163166AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"}},{"bind":{"relevant":"selected (${pregnant}, 'yes')"},"type":"note","name":"final_ga_note","label":{"Urdu":"حمل کی مُدّت: {final_ga}$ ہفتے","Roman Urdu":"Hamal ki muddat: ${final_ga} weeks","English":"GA: ${final_ga} weeks"}},{"name":"vaccines","bind":{"calculate":"minimal"},"label":{"Urdu":"پچھلی تاریخ جب کسی اور سینٹر پر ٹیکہ لگوایا گیا یا قطرے پلائے گئے","Roman Urdu":"Pichli tareekh jab kissi aur center par teeka lagwaya gaya ya katray pilaey gaye","English":"Retro vaccines"},"instance":{"openmrs_entity":"concept","openmrs_entity_id":"984AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1421AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"select all that apply","children":[{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT1","label":{"Urdu":"ٹی ٹی 1","Roman Urdu":"TT1","English":"TT1"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT2","label":{"Urdu":"ٹی ٹی 2","Roman Urdu":"TT2","English":"TT2"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT3","label":{"Urdu":"ٹی ٹی 3","Roman Urdu":"TT3","English":"TT3"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT4","label":{"Urdu":"ٹی ٹی 4","Roman Urdu":"TT4","English":"TT4"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT5","label":{"Urdu":"ٹی ٹی 5","Roman Urdu":"TT5","English":"TT5"}}]},{"bind":{"relevant":"selected(${vaccines},'TT1')","constraint":"(.<=${today} and .<=${client_reg_date})"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"tt1_retro","label":{"Urdu":"ٹی ٹی 1","Roman Urdu":"TT1","English":"TT1"}},{"bind":{"relevant":"selected(${vaccines},'TT1')","calculate":"1"},"type":"calculate","name":"tt_1_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines},'TT2')","constraint":"(.<=${today} and .>=${tt1_retro} and ((selected(${vaccines}, 'TT1'))))"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"tt2_retro","label":{"Urdu":"ٹی ٹی 2","Roman Urdu":"TT2","English":"TT2"}},{"bind":{"relevant":"selected(${vaccines},'TT2')","calculate":"2"},"type":"calculate","name":"tt_2_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines},'TT3')","constraint":"(.<=${today} and .>=${tt2_retro} and ((selected(${vaccines}, 'TT2'))))"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"tt3_retro","label":{"Urdu":"ٹی ٹی 3","Roman Urdu":"TT3","English":"TT3"}},{"bind":{"relevant":"selected(${vaccines},'TT3')","calculate":"3"},"type":"calculate","name":"tt_3_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines},'TT4')","constraint":"(.<=${today} and .>=${tt3_retro} and ((selected(${vaccines}, 'TT3'))))"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"tt4_retro","label":{"Urdu":"ٹی ٹی 4","Roman Urdu":"TT4","English":"TT4"}},{"bind":{"relevant":"selected(${vaccines},'TT4')","calculate":"4"},"type":"calculate","name":"tt_4_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"name":"vaccines_2","choice_filter":"name = if(selected(${vaccines}, 'TT1'), '', 'TT1') or \nname = if(selected(${vaccines}, 'TT2'), '', 'TT2') or \nname = if(selected(${vaccines}, 'TT3'), '', 'TT3') or \nname = if(selected(${vaccines}, 'TT4'), '', 'TT4') or \nname = if(selected(${vaccines}, 'TT5'), '', 'TT5')","bind":{"required":"yes"},"label":{"Urdu":"آج کون کون سی ویکسین دی گئی ہیں؟","Roman Urdu":"Aaj kon kon si vaccine di gai hain?","English":"Vaccine administered today"},"itemset":"vaccines","instance":{"openmrs_entity":"concept","openmrs_entity_id":"984AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1441AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"select all that apply"},{"bind":{"calculate":"if(selected(${vaccines_2}, 'TT1'),${client_reg_date},'')"},"type":"calculate","name":"tt1","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2},'TT1')","calculate":"1"},"type":"calculate","name":"tt_1_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'TT2'),${client_reg_date},'')"},"type":"calculate","name":"tt2","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2},'TT2')","calculate":"2"},"type":"calculate","name":"tt_2_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'TT3'),${client_reg_date},'')"},"type":"calculate","name":"tt3","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2},'TT3')","calculate":"3"},"type":"calculate","name":"tt_3_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'TT4'),${client_reg_date},'')"},"type":"calculate","name":"tt4","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2},'TT4')","calculate":"4"},"type":"calculate","name":"tt_4_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'TT5'),${client_reg_date},'')"},"type":"calculate","name":"tt5","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2},'TT5')","calculate":"5"},"type":"calculate","name":"tt_5_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"control":{"bodyless":true},"type":"group","children":[{"bind":{"readonly":"true()","calculate":"concat('uuid:', uuid())"},"type":"calculate","name":"instanceID"}],"name":"meta"}]} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/woman_enrollment/form.xml b/opensrp-core/src/test/resources/form/woman_enrollment/form.xml deleted file mode 100644 index ebbd597bbb..0000000000 --- a/opensrp-core/src/test/resources/form/woman_enrollment/form.xml +++ /dev/null @@ -1,1550 +0,0 @@ -
- - -

خواتین انرولمنٹ فارم برائے ٹی ٹی ٹیکاجات - Woman TT Enrollment Form

-
-
- - کیا تاریخ پیدائش معلوم ہے؟ - Is birthdate known? - - Kya tareekh-e-pedaaish maloom hai? -
- - -
-
-
-
- - کیا آپ شادی شدہ ہیں؟ - Are you married? - - Kya aap shaadi shuda hain? -
- - -
-
-
-
- - کیا آپ اپنے بچے کی اگلی ویکسین کی تاریخ کے لیے SMS موصول کرنا چاہتے ہیں؟ - Are you willing to receive SMS reminders for your next visit? - - Kya aap apnay bachay ki agli vaccine ki tareekh ke liye SMS mausool karna chahtay hain? - * -
- - -
-
-
-
- - کیا خا تون حاملہ ہیں؟ - Is female pregnant? - - Kia khatoon haamla hain? -
- - -
-
-
-
- - کیا آپ کو اپنی پچھلی ماہواری کی تاریخ، زچگی کی متوقع تاریخ، یا الٹرا سائونڈ کا علم ہے؟ - Do you know your LMP, EDD or last Ultrasound information? - - Kya aap ko apni pichli mahwaari ki tareekh, zachgi ki mutawaqqa tareekh ya ultrasound ka ilm hai? -
- - - - -
-
-
-
- - پچھلی تاریخ جب کسی اور سینٹر پر ٹیکہ لگوایا گیا یا قطرے پلائے گئے - Retro vaccines - - Pichli tareekh jab kissi aur center par teeka lagwaya gaya ya katray pilaey gaye -
- - - - - -
-
-
-
- - آج کون کون سی ویکسین دی گئی ہیں؟ - Vaccine administered today - - Aaj kon kon si vaccine di gai hain? - * -
- - - ٹی ٹی 1 - TT1 - - TT1 - ٹی ٹی 2 - TT2 - - TT2 - ٹی ٹی 3 - TT3 - - TT3 - ٹی ٹی 4 - TT4 - - TT4 - ٹی ٹی 5 - TT5 - - TT5 -
-
-
- -
diff --git a/opensrp-core/src/test/resources/form/woman_enrollment/form_definition.json b/opensrp-core/src/test/resources/form/woman_enrollment/form_definition.json deleted file mode 100644 index 5d6cbabe33..0000000000 --- a/opensrp-core/src/test/resources/form/woman_enrollment/form_definition.json +++ /dev/null @@ -1,311 +0,0 @@ -{ - "form_data_definition_version" : "1", - "form" : { - "bind_type" : "pkwoman", - "default_bind_path" : "/model/instance/Woman_TT_Enrollment_Form/", - "fields" : [ { - "name" : "id", - "shouldLoadValue" : true - }, { - "name" : "provider_uc", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/provider_uc", - "shouldLoadValue" : true - }, { - "name" : "provider_town", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/provider_town", - "shouldLoadValue" : true - }, { - "name" : "provider_city", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/provider_city", - "shouldLoadValue" : true - }, { - "name" : "provider_province", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/provider_province", - "shouldLoadValue" : true - }, { - "name" : "provider_id", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/provider_id", - "shouldLoadValue" : true - }, { - "name" : "provider_location_id", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/provider_location_id", - "shouldLoadValue" : true - }, { - "name" : "existing_program_client_id", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/existing_program_client_id", - "shouldLoadValue" : true - }, { - "name" : "provider_location_name", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/provider_location_name", - "shouldLoadValue" : true - }, { - "name" : "gender", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/gender", - "shouldLoadValue" : true - }, { - "name" : "provider_location_note", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/provider_location_note" - }, { - "name" : "start", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/start" - }, { - "name" : "end", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/end" - }, { - "name" : "today", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/today" - }, { - "name" : "deviceid", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/deviceid" - }, { - "name" : "subscriberid", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/subscriberid" - }, { - "name" : "simserial", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/simserial" - }, { - "name" : "phonenumber", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/phonenumber" - }, { - "name" : "client_reg_date", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/client_reg_date" - }, { - "name" : "program_client_id", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/program_client_id" - }, { - "name" : "epi_card_number", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/epi_card_number" - }, { - "name" : "first_name", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/first_name" - }, { - "name" : "birth_date_known", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/member_birth_date_known" - }, { - "name" : "birth_date", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/member_birth_date" - }, { - "name" : "age", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/age" - }, { - "name" : "calc_age", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/calc_age" - }, { - "name" : "calc_dob", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/calc_dob" - }, { - "name" : "dob", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/calc_dob_confirm" - }, { - "name" : "calc_dob_estimated", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/calc_dob_estimated" - }, { - "name" : "calc_age_confirm", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/calc_age_confirm" - }, { - "name" : "birth_date_note", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/birth_date_note" - }, { - "name" : "note_age", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/note_age" - }, { - "name" : "gender1", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/gender1" - }, { - "name" : "father_name", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/father_name" - }, { - "name" : "marriage", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/marriage" - }, { - "name" : "husband_name", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/husband_name" - }, { - "name" : "last_name", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/last_name" - }, { - "name" : "ethnicity", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/ethnicity" - }, { - "name" : "ethnicity_other", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/ethnicity_other" - }, { - "name" : "province", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/province" - }, { - "name" : "city_village", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/city_village" - }, { - "name" : "town", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/town" - }, { - "name" : "union_council", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/union_council" - }, { - "name" : "house_number", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/house_number" - }, { - "name" : "street", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/street" - }, { - "name" : "landmark", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/landmark" - }, { - "name" : "provincename", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/provincename" - }, { - "name" : "city_villagename", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/city_villagename" - }, { - "name" : "townname", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/townname" - }, { - "name" : "union_councilname", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/union_councilname" - }, { - "name" : "address", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/address" - }, { - "name" : "centre_gps", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/centre_gps" - }, { - "name" : "reminders_approval", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/reminders_approval" - }, { - "name" : "contact_phone_number", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/contact_phone_number" - }, { - "name" : "pregnant", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/pregnant" - }, { - "name" : "edd_lmp", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/edd_lmp" - }, { - "name" : "edd", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/edd" - }, { - "name" : "lmp", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/lmp" - }, { - "name" : "ultrasound_date", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/ultrasound_date" - }, { - "name" : "ultrasound_weeks", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/ultrasound_weeks" - }, { - "name" : "edd_calc_lmp", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/edd_calc_lmp" - }, { - "name" : "edd_calc_ultrasound", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/edd_calc_ultrasound" - }, { - "name" : "edd_calc_lmp_formatted", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/edd_calc_lmp_formatted" - }, { - "name" : "edd_calc_ultrasound_formatted", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/edd_calc_ultrasound_formatted" - }, { - "name" : "lmp_calc_edd", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/lmp_calc_edd" - }, { - "name" : "lmp_calc_ultrasound", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/lmp_calc_ultrasound" - }, { - "name" : "lmp_calc_edd_formatted", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/lmp_calc_edd_formatted" - }, { - "name" : "lmp_calc_ultrasound_formatted", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/lmp_calc_ultrasound_formatted" - }, { - "name" : "final_edd", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/final_edd" - }, { - "name" : "final_lmp", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/final_lmp" - }, { - "name" : "ga_edd", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/ga_edd" - }, { - "name" : "ga_lmp", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/ga_lmp" - }, { - "name" : "ga_ult", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/ga_ult" - }, { - "name" : "final_edd_note", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/final_edd_note" - }, { - "name" : "final_lmp_note", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/final_lmp_note" - }, { - "name" : "final_ga", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/final_ga" - }, { - "name" : "final_ga_note", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/final_ga_note" - }, { - "name" : "vaccines", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/vaccines" - }, { - "name" : "tt1_retro", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt1_retro" - }, { - "name" : "tt_1_dose", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt_1_dose" - }, { - "name" : "tt2_retro", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt2_retro" - }, { - "name" : "tt_2_dose", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt_2_dose" - }, { - "name" : "tt3_retro", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt3_retro" - }, { - "name" : "tt_3_dose", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt_3_dose" - }, { - "name" : "tt4_retro", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt4_retro" - }, { - "name" : "tt_4_dose", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt_4_dose" - }, { - "name" : "vaccines_2", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/vaccines_2" - }, { - "name" : "tt1", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt1" - }, { - "name" : "tt_1_dose_today", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt_1_dose_today" - }, { - "name" : "tt2", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt2" - }, { - "name" : "tt_2_dose_today", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt_2_dose_today" - }, { - "name" : "tt3", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt3" - }, { - "name" : "tt_3_dose_today", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt_3_dose_today" - }, { - "name" : "tt4", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt4" - }, { - "name" : "tt_4_dose_today", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt_4_dose_today" - }, { - "name" : "tt5", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt5" - }, { - "name" : "tt_5_dose_today", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/tt_5_dose_today" - }, { - "name" : "instanceID", - "bind" : "/model/instance/Woman_TT_Enrollment_Form/meta/instanceID" - } ] - } -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/woman_enrollment/form_submission.json b/opensrp-core/src/test/resources/form/woman_enrollment/form_submission.json deleted file mode 100644 index d12e572222..0000000000 --- a/opensrp-core/src/test/resources/form/woman_enrollment/form_submission.json +++ /dev/null @@ -1,350 +0,0 @@ -{ - "_id": "5710d57eac4377dea3cbbb96005b6efc", - "_rev": "1-f38e0fadc71b86a7f5dfc27cabe43fa4", - "type": "FormSubmission", - "anmId": "demotest", - "instanceId": "c12d8e42-a230-415f-a513-9117f4c9db6a", - "formName": "woman_enrollment", - "entityId": "cd082cb2-abe1-4c78-a370-bd955d58e0ba", - "clientVersion": 1458899024110, - "formDataDefinitionVersion": "2", - "formInstance": { - "form_data_definition_version": "2", - "form": { - "bind_type": "pkwoman", - "default_bind_path": "/model/instance/Woman_TT_Enrollment_Form/", - "fields": [{ - "name": "id", - "value": "cd082cb2-abe1-4c78-a370-bd955d58e0ba", - "source": "pkwoman.id" - }, { - "name": "provider_uc", - "value": "Zaman Town", - "source": "pkwoman.provider_uc" - }, { - "name": "provider_town", - "value": "Korangi", - "source": "pkwoman.provider_town" - }, { - "name": "provider_city", - "value": "Karachi", - "source": "pkwoman.provider_city" - }, { - "name": "provider_province", - "value": "Sindh", - "source": "pkwoman.provider_province" - }, { - "name": "provider_id", - "value": "demotest", - "source": "pkwoman.provider_id" - }, { - "name": "provider_location_id", - "value": "null", - "source": "pkwoman.provider_location_id" - }, { - "name": "provider_location_name", - "value": "null", - "source": "pkwoman.provider_location_name" - }, { - "name": "existing_program_client_id", - "value": "11338235", - "source": "pkwoman.existing_program_client_id" - }, { - "name": "gender", - "value": "female", - "source": "pkwoman.gender" - }, { - "name": "provider_location_note", - "value": "", - "source": "pkwoman.provider_location_note" - }, { - "name": "start", - "value": "2016-03-25 14:39:36", - "source": "pkwoman.start" - }, { - "name": "end", - "value": "2016-03-25 14:43:43", - "source": "pkwoman.end" - }, { - "name": "today", - "value": "2016-03-25", - "source": "pkwoman.today" - }, { - "name": "deviceid", - "value": "Error: could not determine deviceID", - "source": "pkwoman.deviceid" - }, { - "name": "subscriberid", - "value": "no subscriberid property in enketo", - "source": "pkwoman.subscriberid" - }, { - "name": "simserial", - "value": "no simserial property in enketo", - "source": "pkwoman.simserial" - }, { - "name": "phonenumber", - "value": "no phonenumber property in enketo", - "source": "pkwoman.phonenumber" - }, { - "name": "client_reg_date", - "value": "2016-03-25", - "source": "pkwoman.client_reg_date" - }, { - "name": "program_client_id", - "value": "11338235", - "source": "pkwoman.program_client_id" - }, { - "name": "epi_card_number", - "value": "2015", - "source": "pkwoman.epi_card_number" - }, { - "name": "first_name", - "value": "mehrina", - "source": "pkwoman.first_name" - }, { - "name": "member_birth_date_known", - "value": "yes", - "source": "pkwoman.member_birth_date_known" - }, { - "name": "member_birth_date", - "value": "1986-03-04", - "source": "pkwoman.member_birth_date" - }, { - "name": "age", - "value": "", - "source": "pkwoman.age" - }, { - "name": "dob", - "value": "1986-03-04", - "source": "pkwoman.dob" - }, { - "name": "dob_estimated", - "value": "0", - "source": "pkwoman.dob_estimated" - }, { - "name": "age", - "value": "30", - "source": "pkwoman.age" - }, { - "name": "gender1", - "value": "female", - "source": "pkwoman.gender1" - }, { - "name": "father_name", - "value": "papa", - "source": "pkwoman.father_name" - }, { - "name": "marriage", - "value": "yes", - "source": "pkwoman.marriage" - }, { - "name": "husband_name", - "value": "husbi", - "source": "pkwoman.husband_name" - }, { - "name": "last_name", - "value": "husbi", - "source": "pkwoman.last_name" - }, { - "name": "ethnicity", - "value": "pushtuns", - "source": "pkwoman.ethnicity" - }, { - "name": "ethnicity_other", - "value": "", - "source": "pkwoman.ethnicity_other" - }, { - "name": "province", - "value": "sindh", - "source": "pkwoman.province" - }, { - "name": "city_village", - "value": "karachi", - "source": "pkwoman.city_village" - }, { - "name": "town", - "value": "gadap", - "source": "pkwoman.town" - }, { - "name": "union_council", - "value": "gujro", - "source": "pkwoman.union_council" - }, { - "name": "house_number", - "value": "34 k", - "source": "pkwoman.house_number" - }, { - "name": "street", - "value": "jim", - "source": "pkwoman.street" - }, { - "name": "landmark", - "value": "nishni", - "source": "pkwoman.landmark" - }, { - "name": "address", - "value": "", - "source": "pkwoman.address" - }, { - "name": "centre_gps", - "source": "pkwoman.centre_gps" - }, { - "name": "pregnant", - "value": "yes", - "source": "pkwoman.pregnant" - }, { - "name": "edd_lmp", - "value": "edd", - "source": "pkwoman.edd_lmp" - }, { - "name": "edd", - "value": "2016-04-28", - "source": "pkwoman.edd" - }, { - "name": "lmp", - "value": "", - "source": "pkwoman.lmp" - }, { - "name": "ultrasound_date", - "source": "pkwoman.ultrasound_date" - }, { - "name": "ultrasound_weeks", - "value": "", - "source": "pkwoman.ultrasound_weeks" - }, { - "name": "edd_calc_lmp", - "value": "Invalid Date", - "source": "pkwoman.edd_calc_lmp" - }, { - "name": "edd_calc_ultrasound", - "value": "Invalid Date", - "source": "pkwoman.edd_calc_ultrasound" - }, { - "name": "edd_calc_lmp_formatted", - "value": "Invalid Date", - "source": "pkwoman.edd_calc_lmp_formatted" - }, { - "name": "edd_calc_ultrasound_formatted", - "value": "Invalid Date", - "source": "pkwoman.edd_calc_ultrasound_formatted" - }, { - "name": "lmp_calc_edd", - "value": "Thu, 23 Jul 2015 00:00:00 GMT", - "source": "pkwoman.lmp_calc_edd" - }, { - "name": "lmp_calc_ultrasound", - "value": "Invalid Date", - "source": "pkwoman.lmp_calc_ultrasound" - }, { - "name": "final_edd", - "value": "2016-04-28", - "source": "pkwoman.final_edd" - }, { - "name": "final_lmp", - "value": "Thu, 23 Jul 2015 00:00:00 GMT", - "source": "pkwoman.final_lmp" - }, { - "name": "ga_edd", - "value": "35", - "source": "pkwoman.ga_edd" - }, { - "name": "ga_lmp", - "value": "NaN", - "source": "pkwoman.ga_lmp" - }, { - "name": "ga_ult", - "value": "NaN", - "source": "pkwoman.ga_ult" - }, { - "name": "final_edd_note", - "value": "", - "source": "pkwoman.final_edd_note" - }, { - "name": "final_lmp_note", - "value": "", - "source": "pkwoman.final_lmp_note" - }, { - "name": "final_ga", - "value": "35", - "source": "pkwoman.final_ga" - }, { - "name": "final_ga_note", - "value": "", - "source": "pkwoman.final_ga_note" - }, { - "name": "vaccines", - "value": "TT1 TT2", - "source": "pkwoman.vaccines" - }, { - "name": "tt1_retro", - "value": "2015-03-03", - "source": "pkwoman.tt1_retro" - }, { - "name": "tt_1_dose", - "value": "1", - "source": "pkwoman.tt_1_dose" - }, { - "name": "tt2_retro", - "value": "2015-11-24", - "source": "pkwoman.tt2_retro" - }, { - "name": "tt_2_dose", - "value": "2", - "source": "pkwoman.tt_2_dose" - }, { - "name": "tt3_retro", - "source": "pkwoman.tt3_retro" - }, { - "name": "tt_3_dose", - "source": "pkwoman.tt_3_dose" - }, { - "name": "tt4_retro", - "source": "pkwoman.tt4_retro" - }, { - "name": "tt_4_dose", - "source": "pkwoman.tt_4_dose" - }, { - "name": "vaccines_2", - "value": "TT3", - "source": "pkwoman.vaccines_2" - }, { - "name": "tt1", - "source": "pkwoman.tt1" - }, { - "name": "tt_1_dose_today", - "source": "pkwoman.tt_1_dose_today" - }, { - "name": "tt2", - "source": "pkwoman.tt2" - }, { - "name": "tt_2_dose_today", - "source": "pkwoman.tt_2_dose_today" - }, { - "name": "tt3", - "value": "2016-03-25", - "source": "pkwoman.tt3" - }, { - "name": "tt_3_dose_today", - "value": "3", - "source": "pkwoman.tt_3_dose_today" - }, { - "name": "tt4", - "source": "pkwoman.tt4" - }, { - "name": "tt_4_dose_today", - "source": "pkwoman.tt_4_dose_today" - }, { - "name": "tt5", - "source": "pkwoman.tt5" - }, { - "name": "tt_5_dose_today", - "source": "pkwoman.tt_5_dose_today" - }, { - "name": "instanceID", - "value": "uuid:67fd050a-b528-4de2-b382-c168730bf0df", - "source": "pkwoman.instanceID" - }] - } - }, - "serverVersion": 1458898979653 -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/woman_enrollment/model.xml b/opensrp-core/src/test/resources/form/woman_enrollment/model.xml deleted file mode 100644 index 8422c9b6c1..0000000000 --- a/opensrp-core/src/test/resources/form/woman_enrollment/model.xml +++ /dev/null @@ -1,1659 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - yes - - - - - - - - - - female - - - - - - - ${provider_province} - ${provider_city} - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - static_instance-provinces-0 - kpk - - - static_instance-provinces-1 - sindh - - - static_instance-provinces-2 - balochistan - - - static_instance-provinces-3 - punjab - - - static_instance-provinces-4 - gilgit_baltistan - - - static_instance-provinces-5 - kashmir - - - static_instance-provinces-6 - fata - - - static_instance-provinces-7 - out_of_country - - - - - - - static_instance-ucs-0 - sindh - karachi - korangi - bilal_colony - - - static_instance-ucs-1 - sindh - karachi - korangi - nasir_colony - - - static_instance-ucs-2 - sindh - karachi - korangi - chakra_goth - - - static_instance-ucs-3 - sindh - karachi - korangi - mustafa_taj_colony - - - static_instance-ucs-4 - sindh - karachi - korangi - hundred_quarters - - - static_instance-ucs-5 - sindh - karachi - korangi - gulzar_colony - - - static_instance-ucs-6 - sindh - karachi - korangi - korangi_sector_33 - - - static_instance-ucs-7 - sindh - karachi - korangi - zaman_town - - - static_instance-ucs-8 - sindh - karachi - korangi - hasrat_mohani_colony - - - static_instance-ucs-9 - sindh - karachi - baldia - gulshan_e_ghazi - - - static_instance-ucs-10 - sindh - karachi - baldia - ittehad_town - - - static_instance-ucs-11 - sindh - karachi - baldia - islam_nagar - - - static_instance-ucs-12 - sindh - karachi - baldia - nai_abadi - - - static_instance-ucs-13 - sindh - karachi - baldia - saeedabad - - - static_instance-ucs-14 - sindh - karachi - baldia - muslim_mujahid_colony - - - static_instance-ucs-15 - sindh - karachi - baldia - muhajir_camp - - - static_instance-ucs-16 - sindh - karachi - baldia - rasheedabad - - - static_instance-ucs-17 - sindh - karachi - bin_qasim - ibrahim_hyderi - - - static_instance-ucs-18 - sindh - karachi - bin_qasim - rehri - - - static_instance-ucs-19 - sindh - karachi - bin_qasim - cattle_colony - - - static_instance-ucs-20 - sindh - karachi - bin_qasim - qaidabad - - - static_instance-ucs-21 - sindh - karachi - bin_qasim - landhi_colony - - - static_instance-ucs-22 - sindh - karachi - bin_qasim - gulshan_e_hadeed - - - static_instance-ucs-23 - sindh - karachi - bin_qasim - gaghar - - - static_instance-ucs-24 - sindh - karachi - gadap - murad_memon_goth - - - static_instance-ucs-25 - sindh - karachi - gadap - darsano_chana - - - static_instance-ucs-26 - sindh - karachi - gadap - gujro - - - static_instance-ucs-27 - sindh - karachi - gadap - songal - - - static_instance-ucs-28 - sindh - karachi - gadap - maymarabad - - - static_instance-ucs-29 - sindh - karachi - gadap - yousuf_goth - - - static_instance-ucs-30 - sindh - karachi - gadap - manghopir - - - static_instance-ucs-31 - sindh - karachi - gulberg - azizabad - - - static_instance-ucs-32 - sindh - karachi - gulberg - karimabad - - - static_instance-ucs-33 - sindh - karachi - gulberg - aisha_manzil - - - static_instance-ucs-34 - sindh - karachi - gulberg - ancholi - - - static_instance-ucs-35 - sindh - karachi - gulberg - naseerabad - - - static_instance-ucs-36 - sindh - karachi - gulberg - yaseenabad - - - static_instance-ucs-37 - sindh - karachi - gulberg - water_pump - - - static_instance-ucs-38 - sindh - karachi - gulberg - shafiq_mill_colony - - - static_instance-ucs-39 - sindh - karachi - gulshan - delhi_mercantile_society - - - static_instance-ucs-40 - sindh - karachi - gulshan - civic_centre - - - static_instance-ucs-41 - sindh - karachi - gulshan - pir_ilahi_buksh_colony - - - static_instance-ucs-42 - sindh - karachi - gulshan - essa_nagri - - - static_instance-ucs-43 - sindh - karachi - gulshan - gulshan_e_iqbal - - - static_instance-ucs-44 - sindh - karachi - gulshan - gillani_railway_station - - - static_instance-ucs-45 - sindh - karachi - gulshan - shanti_nagar - - - static_instance-ucs-46 - sindh - karachi - gulshan - jamali_colony - - - static_instance-ucs-47 - sindh - karachi - gulshan - gulshan_e_iqbal_ii - - - static_instance-ucs-48 - sindh - karachi - gulshan - pehlwan_goth - - - static_instance-ucs-49 - sindh - karachi - gulshan - matrovil_colony - - - static_instance-ucs-50 - sindh - karachi - gulshan - gulzar_e_hijri - - - static_instance-ucs-51 - sindh - karachi - gulshan - safooran_goth - - - static_instance-ucs-52 - sindh - karachi - jamshed - akhtar_colony - - - static_instance-ucs-53 - sindh - karachi - jamshed - manzoor_colony - - - static_instance-ucs-54 - sindh - karachi - jamshed - azam_basti - - - static_instance-ucs-55 - sindh - karachi - jamshed - chanesar_goth - - - static_instance-ucs-56 - sindh - karachi - jamshed - mahmudabad - - - static_instance-ucs-57 - sindh - karachi - jamshed - pechs - - - static_instance-ucs-58 - sindh - karachi - jamshed - pechs_ii - - - static_instance-ucs-59 - sindh - karachi - jamshed - jut_line - - - static_instance-ucs-60 - sindh - karachi - jamshed - central_jacob_lines - - - static_instance-ucs-61 - sindh - karachi - jamshed - jamshed_quarters - - - static_instance-ucs-62 - sindh - karachi - jamshed - garden_east - - - static_instance-ucs-63 - sindh - karachi - jamshed - soldier_bazar - - - static_instance-ucs-64 - sindh - karachi - jamshed - pakistan_quarters - - - static_instance-ucs-65 - sindh - karachi - kiamari - bhutta_village - - - static_instance-ucs-66 - sindh - karachi - kiamari - sultanabad - - - static_instance-ucs-67 - sindh - karachi - kiamari - kiamari_uc - - - static_instance-ucs-68 - sindh - karachi - kiamari - baba_bhit - - - static_instance-ucs-69 - sindh - karachi - kiamari - machar_colony - - - static_instance-ucs-70 - sindh - karachi - kiamari - maripur - - - static_instance-ucs-71 - sindh - karachi - kiamari - shershah - - - static_instance-ucs-72 - sindh - karachi - kiamari - gabo_pat - - - static_instance-ucs-73 - sindh - karachi - landhi - muzafarabad - - - static_instance-ucs-74 - sindh - karachi - landhi - muslimabad - - - static_instance-ucs-75 - sindh - karachi - landhi - dawood_chowrangi - - - static_instance-ucs-76 - sindh - karachi - landhi - moinabad - - - static_instance-ucs-77 - sindh - karachi - landhi - sharafi_goth - - - static_instance-ucs-78 - sindh - karachi - landhi - bhutto_nagar - - - static_instance-ucs-79 - sindh - karachi - landhi - khawaja_ajmeer_colony - - - static_instance-ucs-80 - sindh - karachi - landhi - landhi_uc - - - static_instance-ucs-81 - sindh - karachi - landhi - awami_colony - - - static_instance-ucs-82 - sindh - karachi - landhi - burmee_colony - - - static_instance-ucs-83 - sindh - karachi - landhi - korangi_uc - - - static_instance-ucs-84 - sindh - karachi - landhi - sherabad - - - static_instance-ucs-85 - sindh - karachi - liaquatabad - rizvia_society - - - static_instance-ucs-86 - sindh - karachi - liaquatabad - firdous_colony - - - static_instance-ucs-87 - sindh - karachi - liaquatabad - super_market - - - static_instance-ucs-88 - sindh - karachi - liaquatabad - dak_khana - - - static_instance-ucs-89 - sindh - karachi - liaquatabad - qasimabad - - - static_instance-ucs-90 - sindh - karachi - liaquatabad - bandhani_colony - - - static_instance-ucs-91 - sindh - karachi - liaquatabad - sharifabad - - - static_instance-ucs-92 - sindh - karachi - liaquatabad - commercial_area - - - static_instance-ucs-93 - sindh - karachi - liaquatabad - mujahid_colony - - - static_instance-ucs-94 - sindh - karachi - liaquatabad - nazimabad - - - static_instance-ucs-95 - sindh - karachi - liaquatabad - abbasi_shaheed - - - static_instance-ucs-96 - sindh - karachi - lyari - agra_taj_colony - - - static_instance-ucs-97 - sindh - karachi - lyari - daryaabad - - - static_instance-ucs-98 - sindh - karachi - lyari - nawabad - - - static_instance-ucs-99 - sindh - karachi - lyari - khada_memon_society - - - static_instance-ucs-100 - sindh - karachi - lyari - baghdadi - - - static_instance-ucs-101 - sindh - karachi - lyari - shah_baig_line - - - static_instance-ucs-102 - sindh - karachi - lyari - bihar_colony - - - static_instance-ucs-103 - sindh - karachi - lyari - ragiwara - - - static_instance-ucs-104 - sindh - karachi - lyari - singo_line - - - static_instance-ucs-105 - sindh - karachi - lyari - chakiwara - - - static_instance-ucs-106 - sindh - karachi - lyari - allama_iqbal_colony - - - static_instance-ucs-107 - sindh - karachi - malir - model_colony - - - static_instance-ucs-108 - sindh - karachi - malir - kala_board - - - static_instance-ucs-109 - sindh - karachi - malir - saudabad - - - static_instance-ucs-110 - sindh - karachi - malir - khokhra_par - - - static_instance-ucs-111 - sindh - karachi - malir - jafar_e_tayyar - - - static_instance-ucs-112 - sindh - karachi - malir - gharibabad - - - static_instance-ucs-113 - sindh - karachi - malir - ghazi_brohi_goth - - - static_instance-ucs-114 - sindh - karachi - new_karachi - kalyana - - - static_instance-ucs-115 - sindh - karachi - new_karachi - sir_syed_colony - - - static_instance-ucs-116 - sindh - karachi - new_karachi - fatima_jinnah_colony - - - static_instance-ucs-117 - sindh - karachi - new_karachi - godhra - - - static_instance-ucs-118 - sindh - karachi - new_karachi - abu_zar_ghaffari - - - static_instance-ucs-119 - sindh - karachi - new_karachi - hakim_ahsan - - - static_instance-ucs-120 - sindh - karachi - new_karachi - madina_colony - - - static_instance-ucs-121 - sindh - karachi - new_karachi - faisal_colony - - - static_instance-ucs-122 - sindh - karachi - new_karachi - khamiso_goth - - - static_instance-ucs-123 - sindh - karachi - new_karachi - mustufa_colony - - - static_instance-ucs-124 - sindh - karachi - new_karachi - khawaja_ajmeer_nagri - - - static_instance-ucs-125 - sindh - karachi - new_karachi - gulshan_e_saeed - - - static_instance-ucs-126 - sindh - karachi - new_karachi - shah_nawaz_bhutto_colony - - - static_instance-ucs-127 - sindh - karachi - north_nazimabad - paposh_nagar - - - static_instance-ucs-128 - sindh - karachi - north_nazimabad - pahar_ganj - - - static_instance-ucs-129 - sindh - karachi - north_nazimabad - khandu_goth - - - static_instance-ucs-130 - sindh - karachi - north_nazimabad - hyderi - - - static_instance-ucs-131 - sindh - karachi - north_nazimabad - sakhi_hassan - - - static_instance-ucs-132 - sindh - karachi - north_nazimabad - farooq_e_azam - - - static_instance-ucs-133 - sindh - karachi - north_nazimabad - nusrat_bhutto_colony - - - static_instance-ucs-134 - sindh - karachi - north_nazimabad - shadman_town - - - static_instance-ucs-135 - sindh - karachi - north_nazimabad - buffer_zone - - - static_instance-ucs-136 - sindh - karachi - north_nazimabad - buffer_zone_ii - - - static_instance-ucs-137 - sindh - karachi - orangi - mominabad - - - static_instance-ucs-138 - sindh - karachi - orangi - haryana_colony - - - static_instance-ucs-139 - sindh - karachi - orangi - hanifabad - - - static_instance-ucs-140 - sindh - karachi - orangi - mohammad_nagar - - - static_instance-ucs-141 - sindh - karachi - orangi - madina_colony_orangi - - - static_instance-ucs-142 - sindh - karachi - orangi - ghaziabad - - - static_instance-ucs-143 - sindh - karachi - orangi - chisti_nagar - - - static_instance-ucs-144 - sindh - karachi - orangi - bilal_colony_orangi - - - static_instance-ucs-145 - sindh - karachi - orangi - iqbal_baloch_colony - - - static_instance-ucs-146 - sindh - karachi - orangi - ghabool_town - - - static_instance-ucs-147 - sindh - karachi - orangi - data_nagar - - - static_instance-ucs-148 - sindh - karachi - orangi - mujahidabad - - - static_instance-ucs-149 - sindh - karachi - orangi - baloch_goth - - - static_instance-ucs-150 - sindh - karachi - saddar - old_haji_camp - - - static_instance-ucs-151 - sindh - karachi - saddar - garden - - - static_instance-ucs-152 - sindh - karachi - saddar - kharadar - - - static_instance-ucs-153 - sindh - karachi - saddar - city_railway_colony - - - static_instance-ucs-154 - sindh - karachi - saddar - nanak_wara - - - static_instance-ucs-155 - sindh - karachi - saddar - gazdarabad - - - static_instance-ucs-156 - sindh - karachi - saddar - millat_nagar_islam_pura - - - static_instance-ucs-157 - sindh - karachi - saddar - saddar_uc - - - static_instance-ucs-158 - sindh - karachi - saddar - civil_line - - - static_instance-ucs-159 - sindh - karachi - saddar - clifton - - - static_instance-ucs-160 - sindh - karachi - saddar - kehkashan - - - static_instance-ucs-161 - sindh - karachi - shah_faisal - natha_khan_goth - - - static_instance-ucs-162 - sindh - karachi - shah_faisal - pak_sadat_colony - - - static_instance-ucs-163 - sindh - karachi - shah_faisal - drigh_colony - - - static_instance-ucs-164 - sindh - karachi - shah_faisal - raita_plot - - - static_instance-ucs-165 - sindh - karachi - shah_faisal - moria_khan_goth - - - static_instance-ucs-166 - sindh - karachi - shah_faisal - rafa_e_aam_society - - - static_instance-ucs-167 - sindh - karachi - shah_faisal - al_falah_society - - - static_instance-ucs-168 - sindh - karachi - site - pak_colony - - - static_instance-ucs-169 - sindh - karachi - site - old_golimar - - - static_instance-ucs-170 - sindh - karachi - site - jahanabad - - - static_instance-ucs-171 - sindh - karachi - site - metrovil - - - static_instance-ucs-172 - sindh - karachi - site - bhawani_chali - - - static_instance-ucs-173 - sindh - karachi - site - frontier_colony - - - static_instance-ucs-174 - sindh - karachi - site - banaras_colony - - - static_instance-ucs-175 - sindh - karachi - site - qasba_colony - - - static_instance-ucs-176 - sindh - karachi - site - islamia_colony - - - static_instance-ucs-177 - na - na - na - other - - - static_instance-ucs-178 - na - na - na - not_applicable - - - - - - - static_instance-gender-0 - male - - - static_instance-gender-1 - female - - - static_instance-gender-2 - transgender - - - - - - - static_instance-vaccines-0 - TT1 - - - static_instance-vaccines-1 - TT2 - - - static_instance-vaccines-2 - TT3 - - - static_instance-vaccines-3 - TT4 - - - static_instance-vaccines-4 - TT5 - - - - - - - static_instance-towns-0 - sindh - karachi - korangi - - - static_instance-towns-1 - sindh - karachi - landhi - - - static_instance-towns-2 - sindh - karachi - baldia - - - static_instance-towns-3 - sindh - karachi - bin_qasim - - - static_instance-towns-4 - sindh - karachi - gadap - - - static_instance-towns-5 - sindh - karachi - gulberg - - - static_instance-towns-6 - sindh - karachi - gulshan - - - static_instance-towns-7 - sindh - karachi - jamshed - - - static_instance-towns-8 - sindh - karachi - kiamari - - - static_instance-towns-9 - sindh - karachi - liaquatabad - - - static_instance-towns-10 - sindh - karachi - lyari - - - static_instance-towns-11 - sindh - karachi - malir - - - static_instance-towns-12 - sindh - karachi - new_karachi - - - static_instance-towns-13 - sindh - karachi - north_nazimabad - - - static_instance-towns-14 - sindh - karachi - orangi - - - static_instance-towns-15 - sindh - karachi - saddar - - - static_instance-towns-16 - sindh - karachi - shah_faisal - - - static_instance-towns-17 - sindh - karachi - site - - - static_instance-towns-18 - na - na - other - - - static_instance-towns-19 - na - na - not_applicable - - - - - - - static_instance-cities-0 - sindh - karachi - - - static_instance-cities-1 - punjab - hafizabad - - - static_instance-cities-2 - punjab - muzaffargarh - - - static_instance-cities-3 - na - other - - - static_instance-cities-4 - na - not_applicable - - - - - - - static_instance-edd_lmp-0 - edd - - - static_instance-edd_lmp-1 - lmp - - - static_instance-edd_lmp-2 - ultrasound - - - static_instance-edd_lmp-3 - none - - - - - - - static_instance-ethnicity-0 - punjabi - - - static_instance-ethnicity-1 - pushtuns - - - static_instance-ethnicity-2 - sindhi - - - static_instance-ethnicity-3 - saraiki - - - static_instance-ethnicity-4 - muhajir - - - static_instance-ethnicity-5 - balochi - - - static_instance-ethnicity-6 - other - - - - - - - static_instance-yes_no-0 - yes - - - static_instance-yes_no-1 - no - - - - diff --git a/opensrp-core/src/test/resources/form/woman_followup/form.json b/opensrp-core/src/test/resources/form/woman_followup/form.json deleted file mode 100644 index 73ab628765..0000000000 --- a/opensrp-core/src/test/resources/form/woman_followup/form.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"Woman_TT_Followup_Form","title":"خواتین فالواپ رجسٹر برائے ٹیکاجات - Woman TT Follow Up Form","sms_keyword":"woman_tt_followup_form","default_language":"English","choices":{"provinces":[{"name":"kpk","label":{"Urdu":"خیبر پختون خواہ","English":"Khyber Pakhtunkhwa","Roman Urdu":"Khyber Pakhtunkhwa"}},{"name":"sindh","label":{"Urdu":"سندھ","English":"Sindh","Roman Urdu":"Sindh"}},{"name":"balochistan","label":{"Urdu":"بلوچستان","English":"Balochistan","Roman Urdu":"Balochistan"}},{"name":"punjab","label":{"Urdu":"پنجاب","English":"Punjab","Roman Urdu":"Punjab"}},{"name":"gilgit_baltistan","label":{"Urdu":"گلگت بلتستان","English":"Gilgit Baltistan","Roman Urdu":"Gilgit Baltistan"}},{"name":"kashmir","label":{"Urdu":"کشمیر","English":"Kashmir","Roman Urdu":"Kashmir"}},{"name":"fata","label":{"Urdu":"فاٹا","English":"FATA","Roman Urdu":"FATA"}},{"name":"out_of_country","label":{"Urdu":"ملک سے باہر","English":"Out of Country","Roman Urdu":"Mulk se baahir"}}],"ucs":[{"province":"sindh","city":"karachi","town":"korangi","name":"bilal_colony","label":{"Urdu":"بلال کالونی","Roman Urdu":"Bilal Colony","English":"Bilal Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"nasir_colony","label":{"Urdu":"ناصر کالونی","Roman Urdu":"Nasir Colony","English":"Nasir Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"chakra_goth","label":{"Urdu":"چکرا گوٹھ","Roman Urdu":"Chakra Goth","English":"Chakra Goth"}},{"province":"sindh","city":"karachi","town":"korangi","name":"mustafa_taj_colony","label":{"Urdu":"مصطفی تاج کالونی","Roman Urdu":"Mustafa Taj Colony","English":"Mustafa Taj Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"hundred_quarters","label":{"Urdu":"ہنڈریڈ کوارٹر","Roman Urdu":"Hundred Quarters","English":"Hundred Quarters"}},{"province":"sindh","city":"karachi","town":"korangi","name":"gulzar_colony","label":{"Urdu":"گلزار کالونی","Roman Urdu":"Gulzar Colony","English":"Gulzar Colony"}},{"province":"sindh","city":"karachi","town":"korangi","name":"korangi_sector_33","label":{"Urdu":"کورنگی سیکٹر 33","Roman Urdu":"Korangi Sector 33","English":"Korangi Sector 33"}},{"province":"sindh","city":"karachi","town":"korangi","name":"zaman_town","label":{"Urdu":"زمان ٹاوَن","Roman Urdu":"Zaman Town","English":"Zaman Town"}},{"province":"sindh","city":"karachi","town":"korangi","name":"hasrat_mohani_colony","label":{"Urdu":"حسرت موہانی کالونی","Roman Urdu":"Hasrat Mohani Colony","English":"Hasrat Mohani Colony"}},{"province":"sindh","city":"karachi","town":"baldia","name":"gulshan_e_ghazi","label":{"Urdu":"گلشن غازی","Roman Urdu":"Gulshan-e-Ghazi","English":"Gulshan-e-Ghazi"}},{"province":"sindh","city":"karachi","town":"baldia","name":"ittehad_town","label":{"Urdu":"اتحاد ٹاوَن","Roman Urdu":"Ittehad Town","English":"Ittehad Town"}},{"province":"sindh","city":"karachi","town":"baldia","name":"islam_nagar","label":{"Urdu":"اسلام نگر","Roman Urdu":"Islam Nagar","English":"Islam Nagar"}},{"province":"sindh","city":"karachi","town":"baldia","name":"nai_abadi","label":{"Urdu":"نئی آبادی","Roman Urdu":"Nai Abadi","English":"Nai Abadi"}},{"province":"sindh","city":"karachi","town":"baldia","name":"saeedabad","label":{"Urdu":"سعید آباد","Roman Urdu":"Saeedabad","English":"Saeedabad"}},{"province":"sindh","city":"karachi","town":"baldia","name":"muslim_mujahid_colony","label":{"Urdu":"مسلم مجاہد کالونی","Roman Urdu":"Muslim Mujahid Colony","English":"Muslim Mujahid Colony"}},{"province":"sindh","city":"karachi","town":"baldia","name":"muhajir_camp","label":{"Urdu":"مہاجر کیمپ","Roman Urdu":"Muhajir Camp","English":"Muhajir Camp"}},{"province":"sindh","city":"karachi","town":"baldia","name":"rasheedabad","label":{"Urdu":"رشید آباد","Roman Urdu":"Rasheedabad","English":"Rasheedabad"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"ibrahim_hyderi","label":{"Urdu":"ابراہیم حیدری","Roman Urdu":"Ibrahim Hyderi","English":"Ibrahim Hyderi"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"rehri","label":{"Urdu":"رہڑی","Roman Urdu":"Rehri","English":"Rehri"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"cattle_colony","label":{"Urdu":"کیٹل کالونی","Roman Urdu":"Cattle Colony","English":"Cattle Colony"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"qaidabad","label":{"Urdu":"قائدآباد","Roman Urdu":"Qaidabad","English":"Qaidabad"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"landhi_colony","label":{"Urdu":"لانڈھی کالونی","Roman Urdu":"Landhi Colony","English":"Landhi Colony"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"gulshan_e_hadeed","label":{"Urdu":"گلشن حدید","Roman Urdu":"Gulshan-e-Hadeed","English":"Gulshan-e-Hadeed"}},{"province":"sindh","city":"karachi","town":"bin_qasim","name":"gaghar","label":{"Urdu":"گگر","Roman Urdu":"Gaghar","English":"Gaghar"}},{"province":"sindh","city":"karachi","town":"gadap","name":"murad_memon_goth","label":{"Urdu":"مراد میمن گوٹھ","Roman Urdu":"Murad Memon Goth","English":"Murad Memon Goth"}},{"province":"sindh","city":"karachi","town":"gadap","name":"darsano_chana","label":{"Urdu":"درشانو شنو","Roman Urdu":"Darsano Chana","English":"Darsano Chana"}},{"province":"sindh","city":"karachi","town":"gadap","name":"gujro","label":{"Urdu":"گجرو","Roman Urdu":"Gujro","English":"Gujro"}},{"province":"sindh","city":"karachi","town":"gadap","name":"songal","label":{"Urdu":"سنگل","Roman Urdu":"Songal","English":"Songal"}},{"province":"sindh","city":"karachi","town":"gadap","name":"maymarabad","label":{"Urdu":"معمار آباد","Roman Urdu":"Maymarabad","English":"Maymarabad"}},{"province":"sindh","city":"karachi","town":"gadap","name":"yousuf_goth","label":{"Urdu":"یوسف گوٹھ","Roman Urdu":"Yousuf Goth","English":"Yousuf Goth"}},{"province":"sindh","city":"karachi","town":"gadap","name":"manghopir","label":{"Urdu":"منگھوپیر","Roman Urdu":"Manghopir","English":"Manghopir"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"azizabad","label":{"Urdu":"عزیز آباد","Roman Urdu":"Azizabad","English":"Azizabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"karimabad","label":{"Urdu":"کریم آباد","Roman Urdu":"Karimabad","English":"Karimabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"aisha_manzil","label":{"Urdu":"عائشہ منزل","Roman Urdu":"Aisha Manzil","English":"Aisha Manzil"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"ancholi","label":{"Urdu":"انچولی","Roman Urdu":"Ancholi","English":"Ancholi"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"naseerabad","label":{"Urdu":"نصیرآباد","Roman Urdu":"Naseerabad","English":"Naseerabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"yaseenabad","label":{"Urdu":"یاسین آباد","Roman Urdu":"Yaseenabad","English":"Yaseenabad"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"water_pump","label":{"Urdu":"واٹرپمپ","Roman Urdu":"Water Pump","English":"Water Pump"}},{"province":"sindh","city":"karachi","town":"gulberg","name":"shafiq_mill_colony","label":{"Urdu":"شفیق مل کالونی","Roman Urdu":"Shafiq Mill Colony","English":"Shafiq Mill Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"delhi_mercantile_society","label":{"Urdu":"دہلی مرچنٹائل سوسائٹی","Roman Urdu":"Delhi Mercantile Society","English":"Delhi Mercantile Society"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"civic_centre","label":{"Urdu":"سوک سینٹر","Roman Urdu":"Civic Centre","English":"Civic Centre"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"pir_ilahi_buksh_colony","label":{"Urdu":"پیر الہی بخش کالونی","Roman Urdu":"Pir Ilahi Buksh Colony","English":"Pir Ilahi Buksh Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"essa_nagri","label":{"Urdu":"عیسی نگری","Roman Urdu":"Essa Nagri","English":"Essa Nagri"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gulshan_e_iqbal","label":{"Urdu":"گلشن اقبال","Roman Urdu":"Gulshan-e-Iqbal","English":"Gulshan-e-Iqbal"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gillani_railway_station","label":{"Urdu":"گیلانی ریلوے اسٹیشن","Roman Urdu":"Gillani Railway Station","English":"Gillani Railway Station"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"shanti_nagar","label":{"Urdu":"شانتی نگر","Roman Urdu":"Shanti Nagar","English":"Shanti Nagar"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"jamali_colony","label":{"Urdu":"جمالی کالونی","Roman Urdu":"Jamali Colony","English":"Jamali Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gulshan_e_iqbal_ii","label":{"Urdu":"گلشن اقبال 2","Roman Urdu":"Gulshan-e-Iqbal II","English":"Gulshan-e-Iqbal II"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"pehlwan_goth","label":{"Urdu":"پہلوان گوٹھ","Roman Urdu":"Pehlwan Goth","English":"Pehlwan Goth"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"matrovil_colony","label":{"Urdu":"میٹروویل کالونی","Roman Urdu":"Matrovil Colony","English":"Matrovil Colony"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"gulzar_e_hijri","label":{"Urdu":"گلزار ہجری","Roman Urdu":"Gulzar-e-Hijri","English":"Gulzar-e-Hijri"}},{"province":"sindh","city":"karachi","town":"gulshan","name":"safooran_goth","label":{"Urdu":"صفورا گوٹھ","Roman Urdu":"Safooran Goth","English":"Safooran Goth"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"akhtar_colony","label":{"Urdu":"اختر کالونی","Roman Urdu":"Akhtar Colony","English":"Akhtar Colony"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"manzoor_colony","label":{"Urdu":"منظور کالونی","Roman Urdu":"Manzoor Colony","English":"Manzoor Colony"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"azam_basti","label":{"Urdu":"اعظم بستی","Roman Urdu":"Azam Basti","English":"Azam Basti"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"chanesar_goth","label":{"Urdu":"چنیسر گوٹھ","Roman Urdu":"Chanesar Goth","English":"Chanesar Goth"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"mahmudabad","label":{"Urdu":"محمودآباد","Roman Urdu":"Mahmudabad","English":"Mahmudabad"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"pechs","label":{"Urdu":"پی۔ای۔سی۔ایچ۔ایس","Roman Urdu":"P.E.C.H.S.","English":"P.E.C.H.S."}},{"province":"sindh","city":"karachi","town":"jamshed","name":"pechs_ii","label":{"Urdu":"پی۔ای۔سی۔ایچ۔ایس 2","Roman Urdu":"P.E.C.H.S. II","English":"P.E.C.H.S. II"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"jut_line","label":{"Urdu":"جٹ لائن","Roman Urdu":"Jut Line","English":"Jut Line"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"central_jacob_lines","label":{"Urdu":"سینٹرل جیکب لائن","Roman Urdu":"Central Jacob Lines","English":"Central Jacob Lines"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"jamshed_quarters","label":{"Urdu":"جمشید کوارٹر","Roman Urdu":"Jamshed Quarters","English":"Jamshed Quarters"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"garden_east","label":{"Urdu":"گارڈن ایسٹ","Roman Urdu":"Garden East","English":"Garden East"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"soldier_bazar","label":{"Urdu":"سولجر بازار","Roman Urdu":"Soldier Bazar","English":"Soldier Bazar"}},{"province":"sindh","city":"karachi","town":"jamshed","name":"pakistan_quarters","label":{"Urdu":"پاکستان کوارٹر","Roman Urdu":"Pakistan Quarters","English":"Pakistan Quarters"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"bhutta_village","label":{"Urdu":"بھٹا ولیج","Roman Urdu":"Bhutta Village","English":"Bhutta Village"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"sultanabad","label":{"Urdu":"سلطان آباد","Roman Urdu":"Sultanabad","English":"Sultanabad"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"kiamari_uc","label":{"Urdu":"کیماری یوسی","Roman Urdu":"Kiamari UC","English":"Kiamari UC"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"baba_bhit","label":{"Urdu":"بابا بھٹ","Roman Urdu":"Baba Bhit","English":"Baba Bhit"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"machar_colony","label":{"Urdu":"مچھر کالونی","Roman Urdu":"Machar Colony","English":"Machar Colony"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"maripur","label":{"Urdu":"ماڑی پور","Roman Urdu":"Maripur","English":"Maripur"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"shershah","label":{"Urdu":"شیرشاہ","Roman Urdu":"SherShah","English":"SherShah"}},{"province":"sindh","city":"karachi","town":"kiamari","name":"gabo_pat","label":{"Urdu":"گابو پٹ","Roman Urdu":"Gabo Pat","English":"Gabo Pat"}},{"province":"sindh","city":"karachi","town":"landhi","name":"muzafarabad","label":{"Urdu":"مظفرآباد","Roman Urdu":"Muzafarabad","English":"Muzafarabad"}},{"province":"sindh","city":"karachi","town":"landhi","name":"muslimabad","label":{"Urdu":"مسلم آباد","Roman Urdu":"Muslimabad","English":"Muslimabad"}},{"province":"sindh","city":"karachi","town":"landhi","name":"dawood_chowrangi","label":{"Urdu":"داوَد چورنگی","Roman Urdu":"Dawood Chowrangi","English":"Dawood Chowrangi"}},{"province":"sindh","city":"karachi","town":"landhi","name":"moinabad","label":{"Urdu":"معین آباد","Roman Urdu":"Moinabad","English":"Moinabad"}},{"province":"sindh","city":"karachi","town":"landhi","name":"sharafi_goth","label":{"Urdu":"شرافی گوٹھ","Roman Urdu":"Sharafi Goth","English":"Sharafi Goth"}},{"province":"sindh","city":"karachi","town":"landhi","name":"bhutto_nagar","label":{"Urdu":"بھٹو نگر","Roman Urdu":"Bhutto Nagar","English":"Bhutto Nagar"}},{"province":"sindh","city":"karachi","town":"landhi","name":"khawaja_ajmeer_colony","label":{"Urdu":"خواجہ اجمیر کالونی","Roman Urdu":"Khawaja Ajmeer Colony","English":"Khawaja Ajmeer Colony"}},{"province":"sindh","city":"karachi","town":"landhi","name":"landhi_uc","label":{"Urdu":"لانڈھی یوسی","Roman Urdu":"Landhi UC","English":"Landhi UC"}},{"province":"sindh","city":"karachi","town":"landhi","name":"awami_colony","label":{"Urdu":"عوامی کالونی","Roman Urdu":"Awami Colony","English":"Awami Colony"}},{"province":"sindh","city":"karachi","town":"landhi","name":"burmee_colony","label":{"Urdu":"برمی کالونی","Roman Urdu":"Burmee Colony","English":"Burmee Colony"}},{"province":"sindh","city":"karachi","town":"landhi","name":"korangi_uc","label":{"Urdu":"کورنگی یوسی","Roman Urdu":"Korangi UC","English":"Korangi UC"}},{"province":"sindh","city":"karachi","town":"landhi","name":"sherabad","label":{"Urdu":"شیرآباد","Roman Urdu":"Sherabad","English":"Sherabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"rizvia_society","label":{"Urdu":"رضویہ سوسائٹی","Roman Urdu":"Rizvia Society","English":"Rizvia Society"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"firdous_colony","label":{"Urdu":"فردوس کالونی","Roman Urdu":"Firdous Colony","English":"Firdous Colony"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"super_market","label":{"Urdu":"سپر مارکیٹ","Roman Urdu":"Super Market","English":"Super Market"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"dak_khana","label":{"Urdu":"دک کھانہ","Roman Urdu":"Dak Khana","English":"Dak Khana"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"qasimabad","label":{"Urdu":"قاسم آباد","Roman Urdu":"Qasimabad","English":"Qasimabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"bandhani_colony","label":{"Urdu":"بندھانی کالونی","Roman Urdu":"Bandhani Colony","English":"Bandhani Colony"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"sharifabad","label":{"Urdu":"شریف آباد","Roman Urdu":"Sharifabad","English":"Sharifabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"commercial_area","label":{"Urdu":"کمرشل ایریا","Roman Urdu":"Commercial Area","English":"Commercial Area"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"mujahid_colony","label":{"Urdu":"مجاہد کالونی","Roman Urdu":"Mujahid Colony","English":"Mujahid Colony"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"nazimabad","label":{"Urdu":"ناظم آباد","Roman Urdu":"Nazimabad","English":"Nazimabad"}},{"province":"sindh","city":"karachi","town":"liaquatabad","name":"abbasi_shaheed","label":{"Urdu":"عباسی شہید","Roman Urdu":"Abbasi Shaheed","English":"Abbasi Shaheed"}},{"province":"sindh","city":"karachi","town":"lyari","name":"agra_taj_colony","label":{"Urdu":"آگرہ تاج کالونی","Roman Urdu":"Agra Taj Colony","English":"Agra Taj Colony"}},{"province":"sindh","city":"karachi","town":"lyari","name":"daryaabad","label":{"Urdu":"دریاآباد","Roman Urdu":"Daryaabad","English":"Daryaabad"}},{"province":"sindh","city":"karachi","town":"lyari","name":"nawabad","label":{"Urdu":"نواآباد","Roman Urdu":"Nawabad","English":"Nawabad"}},{"province":"sindh","city":"karachi","town":"lyari","name":"khada_memon_society","label":{"Urdu":"خدا- میمن- سوساَٹی","Roman Urdu":"Khada Memon Society","English":"Khada Memon Society"}},{"province":"sindh","city":"karachi","town":"lyari","name":"baghdadi","label":{"Urdu":"بغدادی","Roman Urdu":"Baghdadi","English":"Baghdadi"}},{"province":"sindh","city":"karachi","town":"lyari","name":"shah_baig_line","label":{"Urdu":"شاھ باغ لائن","Roman Urdu":"Shah Baig Line","English":"Shah Baig Line"}},{"province":"sindh","city":"karachi","town":"lyari","name":"bihar_colony","label":{"Urdu":"بہار کالونی","Roman Urdu":"Bihar Colony","English":"Bihar Colony"}},{"province":"sindh","city":"karachi","town":"lyari","name":"ragiwara","label":{"Urdu":"راگی واڑا","Roman Urdu":"Ragiwara","English":"Ragiwara"}},{"province":"sindh","city":"karachi","town":"lyari","name":"singo_line","label":{"Urdu":"سنگولائن","Roman Urdu":"Singo Line","English":"Singo Line"}},{"province":"sindh","city":"karachi","town":"lyari","name":"chakiwara","label":{"Urdu":"چاکی واڑا","Roman Urdu":"Chakiwara","English":"Chakiwara"}},{"province":"sindh","city":"karachi","town":"lyari","name":"allama_iqbal_colony","label":{"Urdu":"علامہ اقبال کالونی","Roman Urdu":"Allama Iqbal Colony","English":"Allama Iqbal Colony"}},{"province":"sindh","city":"karachi","town":"malir","name":"model_colony","label":{"Urdu":"موڈل کالونی","Roman Urdu":"Model Colony","English":"Model Colony"}},{"province":"sindh","city":"karachi","town":"malir","name":"kala_board","label":{"Urdu":"کالا بورڈ","Roman Urdu":"Kala Board","English":"Kala Board"}},{"province":"sindh","city":"karachi","town":"malir","name":"saudabad","label":{"Urdu":"سعودآباد","Roman Urdu":"Saudabad","English":"Saudabad"}},{"province":"sindh","city":"karachi","town":"malir","name":"khokhra_par","label":{"Urdu":"کھوکھرا پار","Roman Urdu":"Khokhra Par","English":"Khokhra Par"}},{"province":"sindh","city":"karachi","town":"malir","name":"jafar_e_tayyar","label":{"Urdu":"جعفر تیار","Roman Urdu":"Jafar-e-Tayyar","English":"Jafar-e-Tayyar"}},{"province":"sindh","city":"karachi","town":"malir","name":"gharibabad","label":{"Urdu":"غریب آباد","Roman Urdu":"Gharibabad","English":"Gharibabad"}},{"province":"sindh","city":"karachi","town":"malir","name":"ghazi_brohi_goth","label":{"Urdu":"غازی بروہی گوٹھ","Roman Urdu":"Ghazi Brohi Goth","English":"Ghazi Brohi Goth"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"kalyana","label":{"Urdu":"کالیانہ","Roman Urdu":"Kalyana","English":"Kalyana"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"sir_syed_colony","label":{"Urdu":"سر سید کالونی","Roman Urdu":"Sir Syed Colony","English":"Sir Syed Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"fatima_jinnah_colony","label":{"Urdu":"فاطمہ جناح کالونی","Roman Urdu":"Fatima Jinnah Colony","English":"Fatima Jinnah Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"godhra","label":{"Urdu":"گودھرا","Roman Urdu":"Godhra","English":"Godhra"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"abu_zar_ghaffari","label":{"Urdu":"ابو زر غفاری","Roman Urdu":"Abu Zar Ghaffari","English":"Abu Zar Ghaffari"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"hakim_ahsan","label":{"Urdu":"حاکم احسان","Roman Urdu":"Hakim Ahsan","English":"Hakim Ahsan"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"madina_colony","label":{"Urdu":"مدینہ کالونی","Roman Urdu":"Madina Colony","English":"Madina Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"faisal_colony","label":{"Urdu":"فیصل کالونی","Roman Urdu":"Faisal Colony","English":"Faisal Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"khamiso_goth","label":{"Urdu":"خمیسو گوٹھ","Roman Urdu":"Khamiso Goth","English":"Khamiso Goth"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"mustufa_colony","label":{"Urdu":"مصطفی کالونی","Roman Urdu":"Mustufa Colony","English":"Mustufa Colony"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"khawaja_ajmeer_nagri","label":{"Urdu":"خواجہ اجمیر نگری","Roman Urdu":"Khawaja Ajmeer Nagri","English":"Khawaja Ajmeer Nagri"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"gulshan_e_saeed","label":{"Urdu":"گلشن سعید","Roman Urdu":"Gulshan-e-Saeed","English":"Gulshan-e-Saeed"}},{"province":"sindh","city":"karachi","town":"new_karachi","name":"shah_nawaz_bhutto_colony","label":{"Urdu":"شاہ نواز بھٹو کالونی","Roman Urdu":"Shah Nawaz Bhutto Colony","English":"Shah Nawaz Bhutto Colony"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"paposh_nagar","label":{"Urdu":"پاپوش نگر","Roman Urdu":"Paposh Nagar","English":"Paposh Nagar"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"pahar_ganj","label":{"Urdu":"پہاڑ گنج","Roman Urdu":"Pahar Ganj","English":"Pahar Ganj"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"khandu_goth","label":{"Urdu":"کھنڑو گوٹھ","Roman Urdu":"Khandu Goth","English":"Khandu Goth"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"hyderi","label":{"Urdu":"حیدری","Roman Urdu":"Hyderi","English":"Hyderi"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"sakhi_hassan","label":{"Urdu":"سخی حسن","Roman Urdu":"Sakhi Hassan","English":"Sakhi Hassan"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"farooq_e_azam","label":{"Urdu":"فاروق اعظم","Roman Urdu":"Farooq-e-Azam","English":"Farooq-e-Azam"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"nusrat_bhutto_colony","label":{"Urdu":"نصرت بھٹو کالونی","Roman Urdu":"Nusrat Bhutto Colony","English":"Nusrat Bhutto Colony"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"shadman_town","label":{"Urdu":"شادمان ٹاوَن","Roman Urdu":"Shadman Town","English":"Shadman Town"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"buffer_zone","label":{"Urdu":"بفرزون","Roman Urdu":"Buffer Zone","English":"Buffer Zone"}},{"province":"sindh","city":"karachi","town":"north_nazimabad","name":"buffer_zone_ii","label":{"Urdu":"بفرزون 2","Roman Urdu":"Buffer Zone II","English":"Buffer Zone II"}},{"province":"sindh","city":"karachi","town":"orangi","name":"mominabad","label":{"Urdu":"مومن آباد","Roman Urdu":"Mominabad","English":"Mominabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"haryana_colony","label":{"Urdu":"حریانہ کالونی","Roman Urdu":"Haryana Colony","English":"Haryana Colony"}},{"province":"sindh","city":"karachi","town":"orangi","name":"hanifabad","label":{"Urdu":"حنیف آباد","Roman Urdu":"Hanifabad","English":"Hanifabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"mohammad_nagar","label":{"Urdu":"محمد نگر","Roman Urdu":"Mohammad Nagar","English":"Mohammad Nagar"}},{"province":"sindh","city":"karachi","town":"orangi","name":"madina_colony_orangi","label":{"Urdu":"مدینہ کالونی اورنگی","Roman Urdu":"Madina Colony Orangi","English":"Madina Colony Orangi"}},{"province":"sindh","city":"karachi","town":"orangi","name":"ghaziabad","label":{"Urdu":"غازی آباد","Roman Urdu":"Ghaziabad","English":"Ghaziabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"chisti_nagar","label":{"Urdu":"چشتی نگر","Roman Urdu":"Chisti Nagar","English":"Chisti Nagar"}},{"province":"sindh","city":"karachi","town":"orangi","name":"bilal_colony_orangi","label":{"Urdu":"بلال کالونی اورنگی","Roman Urdu":"Bilal Colony Orangi","English":"Bilal Colony Orangi"}},{"province":"sindh","city":"karachi","town":"orangi","name":"iqbal_baloch_colony","label":{"Urdu":"اقبال بلوچ کالونی","Roman Urdu":"Iqbal Baloch Colony","English":"Iqbal Baloch Colony"}},{"province":"sindh","city":"karachi","town":"orangi","name":"ghabool_town","label":{"Urdu":"گبول ٹاوَن","Roman Urdu":"Ghabool Town","English":"Ghabool Town"}},{"province":"sindh","city":"karachi","town":"orangi","name":"data_nagar","label":{"Urdu":"داتا نگر","Roman Urdu":"Data Nagar","English":"Data Nagar"}},{"province":"sindh","city":"karachi","town":"orangi","name":"mujahidabad","label":{"Urdu":"مجاہد آباد","Roman Urdu":"Mujahidabad","English":"Mujahidabad"}},{"province":"sindh","city":"karachi","town":"orangi","name":"baloch_goth","label":{"Urdu":"بلوچ گوٹھ","Roman Urdu":"Baloch Goth","English":"Baloch Goth"}},{"province":"sindh","city":"karachi","town":"saddar","name":"old_haji_camp","label":{"Urdu":"پرانہ حاجی کیمپ","Roman Urdu":"Old Haji Camp","English":"Old Haji Camp"}},{"province":"sindh","city":"karachi","town":"saddar","name":"garden","label":{"Urdu":"گارڈن","Roman Urdu":"Garden","English":"Garden"}},{"province":"sindh","city":"karachi","town":"saddar","name":"kharadar","label":{"Urdu":"کھارادر","Roman Urdu":"Kharadar","English":"Kharadar"}},{"province":"sindh","city":"karachi","town":"saddar","name":"city_railway_colony","label":{"Urdu":"سٹی ریلوے کالونی","Roman Urdu":"City Railway Colony","English":"City Railway Colony"}},{"province":"sindh","city":"karachi","town":"saddar","name":"nanak_wara","label":{"Urdu":"ناناک واڑا","Roman Urdu":"Nanak Wara","English":"Nanak Wara"}},{"province":"sindh","city":"karachi","town":"saddar","name":"gazdarabad","label":{"Urdu":"گزدرآباد","Roman Urdu":"Gazdarabad","English":"Gazdarabad"}},{"province":"sindh","city":"karachi","town":"saddar","name":"millat_nagar_islam_pura","label":{"Urdu":"ملت نگر اسلام پورا","Roman Urdu":"Millat Nagar/Islam Pura","English":"Millat Nagar/Islam Pura"}},{"province":"sindh","city":"karachi","town":"saddar","name":"saddar_uc","label":{"Urdu":"صدر یو سی","Roman Urdu":"Saddar UC","English":"Saddar UC"}},{"province":"sindh","city":"karachi","town":"saddar","name":"civil_line","label":{"Urdu":"سول لائن","Roman Urdu":"Civil Line","English":"Civil Line"}},{"province":"sindh","city":"karachi","town":"saddar","name":"clifton","label":{"Urdu":"کلفٹن","Roman Urdu":"Clifton","English":"Clifton"}},{"province":"sindh","city":"karachi","town":"saddar","name":"kehkashan","label":{"Urdu":"کہکشان","Roman Urdu":"Kehkashan","English":"Kehkashan"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"natha_khan_goth","label":{"Urdu":"ناتھا خان گوٹھ","Roman Urdu":"Natha Khan Goth","English":"Natha Khan Goth"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"pak_sadat_colony","label":{"Urdu":"پاک صدر کالونی","Roman Urdu":"Pak Sadat Colony","English":"Pak Sadat Colony"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"drigh_colony","label":{"Urdu":"ڈرگ کالونی","Roman Urdu":"Drigh Colony","English":"Drigh Colony"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"raita_plot","label":{"Urdu":"رائتا پلاٹ","Roman Urdu":"Raita Plot","English":"Raita Plot"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"moria_khan_goth","label":{"Urdu":"موریا خان گوٹھ","Roman Urdu":"Moria Khan Goth","English":"Moria Khan Goth"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"rafa_e_aam_society","label":{"Urdu":"رفا عام سوسا ئٹی","Roman Urdu":"Rafa-e-Aam Society","English":"Rafa-e-Aam Society"}},{"province":"sindh","city":"karachi","town":"shah_faisal","name":"al_falah_society","label":{"Urdu":"الفلاح سوسا ئٹی","Roman Urdu":"Al-Falah Society","English":"Al-Falah Society"}},{"province":"sindh","city":"karachi","town":"site","name":"pak_colony","label":{"Urdu":"پاک کالونی","Roman Urdu":"Pak Colony","English":"Pak Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"old_golimar","label":{"Urdu":"پرانہ گولی مار","Roman Urdu":"Old Golimar","English":"Old Golimar"}},{"province":"sindh","city":"karachi","town":"site","name":"jahanabad","label":{"Urdu":"جہان آباد","Roman Urdu":"Jahanabad","English":"Jahanabad"}},{"province":"sindh","city":"karachi","town":"site","name":"metrovil","label":{"Urdu":"میٹروویل","Roman Urdu":"Metrovil","English":"Metrovil"}},{"province":"sindh","city":"karachi","town":"site","name":"bhawani_chali","label":{"Urdu":"بہوانی چالی","Roman Urdu":"Bhawani Chali","English":"Bhawani Chali"}},{"province":"sindh","city":"karachi","town":"site","name":"frontier_colony","label":{"Urdu":"فرونٹر کالونی","Roman Urdu":"Frontier Colony","English":"Frontier Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"banaras_colony","label":{"Urdu":"بنارس کالونی","Roman Urdu":"Banaras Colony","English":"Banaras Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"qasba_colony","label":{"Urdu":"قصبہ کالونی","Roman Urdu":"Qasba Colony","English":"Qasba Colony"}},{"province":"sindh","city":"karachi","town":"site","name":"islamia_colony","label":{"Urdu":"اسلامیہ کالونی","Roman Urdu":"Islamia Colony","English":"Islamia Colony"}},{"province":"na","city":"na","town":"na","name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}},{"province":"na","city":"na","town":"na","name":"not_applicable","label":{"Urdu":"قابل اطلاق نہیں","Roman Urdu":"Qaabil-e-atlaaq nahi","English":"Not Applicable"}}],"gender":[{"instance":{"openmrs_code":"1534AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"male","label":{"Urdu":"مرد/ لڑکا","Roman Urdu":"Mard/larka","English":"Male"}},{"instance":{"openmrs_code":"1535AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"female","label":{"Urdu":"عورت/لڑکی","Roman Urdu":"Aurat/larki","English":"Female"}},{"instance":{"openmrs_code":"163163AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"transgender","label":{"Urdu":"خواجہ سرہ","Roman Urdu":"Khwaja sira","English":"Transgender"}}],"vaccines":[{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT1","label":{"Urdu":"ٹی ٹی 1","Roman Urdu":"TT1","English":"TT1"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT2","label":{"Urdu":"ٹی ٹی 2","Roman Urdu":"TT2","English":"TT2"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT3","label":{"Urdu":"ٹی ٹی 3","Roman Urdu":"TT3","English":"TT3"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT4","label":{"Urdu":"ٹی ٹی 4","Roman Urdu":"TT4","English":"TT4"}},{"instance":{"openmrs_code":"84880AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"TT5","label":{"Urdu":"ٹی ٹی 5","Roman Urdu":"TT5","English":"TT5"}}],"towns":[{"province":"sindh","city":"karachi","name":"korangi","label":{"Urdu":"کورنگی","Roman Urdu":"Korangi","English":"Korangi"}},{"province":"sindh","city":"karachi","name":"landhi","label":{"Urdu":"لانڈھی","Roman Urdu":"Landhi","English":"Landhi"}},{"province":"sindh","city":"karachi","name":"baldia","label":{"Urdu":"بلدیہ","Roman Urdu":"Baldia","English":"Baldia"}},{"province":"sindh","city":"karachi","name":"bin_qasim","label":{"Urdu":"بن قاسم","Roman Urdu":"Bin Qasim","English":"Bin Qasim"}},{"province":"sindh","city":"karachi","name":"gadap","label":{"Urdu":"گڈاپ","Roman Urdu":"Gadap","English":"Gadap"}},{"province":"sindh","city":"karachi","name":"gulberg","label":{"Urdu":"گلبرگ","Roman Urdu":"Gulberg","English":"Gulberg"}},{"province":"sindh","city":"karachi","name":"gulshan","label":{"Urdu":"گلشن","Roman Urdu":"Gulshan","English":"Gulshan"}},{"province":"sindh","city":"karachi","name":"jamshed","label":{"Urdu":"جمشید","Roman Urdu":"Jamshed","English":"Jamshed"}},{"province":"sindh","city":"karachi","name":"kiamari","label":{"Urdu":"کیماری","Roman Urdu":"Kiamari","English":"Kiamari"}},{"province":"sindh","city":"karachi","name":"liaquatabad","label":{"Urdu":"لیاقت آباد","Roman Urdu":"Liaquatabad","English":"Liaquatabad"}},{"province":"sindh","city":"karachi","name":"lyari","label":{"Urdu":"لیاری","Roman Urdu":"Lyari","English":"Lyari"}},{"province":"sindh","city":"karachi","name":"malir","label":{"Urdu":"ملیر","Roman Urdu":"Malir","English":"Malir"}},{"province":"sindh","city":"karachi","name":"new_karachi","label":{"Urdu":"نیو کراچی","Roman Urdu":"New Karachi","English":"New Karachi"}},{"province":"sindh","city":"karachi","name":"north_nazimabad","label":{"Urdu":"نارتھ ناظم آباد","Roman Urdu":"North Nazimabad","English":"North Nazimabad"}},{"province":"sindh","city":"karachi","name":"orangi","label":{"Urdu":"اورنگی","Roman Urdu":"Orangi","English":"Orangi"}},{"province":"sindh","city":"karachi","name":"saddar","label":{"Urdu":"صدر","Roman Urdu":"Saddar","English":"Saddar"}},{"province":"sindh","city":"karachi","name":"shah_faisal","label":{"Urdu":"شاہ فیصل","Roman Urdu":"Shah Faisal","English":"Shah Faisal"}},{"province":"sindh","city":"karachi","name":"site","label":{"Urdu":"سائٹ","Roman Urdu":"S.I.T.E.","English":"S.I.T.E."}},{"province":"na","city":"na","name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}},{"province":"na","city":"na","name":"not_applicable","label":{"Urdu":"قابل اطلاق نہیں","Roman Urdu":"Qaabil-e-atlaaq nahi","English":"Not Applicable"}}],"cities":[{"province":"sindh","name":"karachi","label":{"Urdu":"کراچی","Roman Urdu":"Karachi","English":"Karachi"}},{"province":"punjab","name":"hafizabad","label":{"Urdu":"حافظ آباد","Roman Urdu":"Hafizabad","English":"Hafizabad"}},{"province":"punjab","name":"muzaffargarh","label":{"Urdu":"مظفر گڑھ","Roman Urdu":"Muzaffargarh","English":"Muzaffargarh"}},{"province":"na","name":"other","label":{"Urdu":"دیگر","Roman Urdu":"Deegar","English":"Other"}},{"province":"na","name":"not_applicable","label":{"Urdu":"قابل اطلاق نہیں","Roman Urdu":"Not Applicable","English":"Not Applicable"}}],"edd_lmp":[{"instance":{"openmrs_code":"5596AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"edd","label":{"Urdu":"زچگی کی متوقع تاریخ","Roman Urdu":"EDD","English":"EDD"}},{"instance":{"openmrs_code":"1427AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"lmp","label":{"Urdu":"پچھلی مہواری کی تاریخ","Roman Urdu":"LMP","English":"LMP"}},{"instance":{"openmrs_code":"159617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"ultrasound","label":{"Urdu":"الٹرا سائونڈ","Roman Urdu":"Ultrasound","English":"Ultrasound"}},{"instance":{"openmrs_code":"1107AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"none","label":{"Urdu":"کوئی بھی نہیں","Roman Urdu":"Koi bhi nahi","English":"None of the above"}}],"yes_no":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}]},"instance":{"encounter_type":"Woman TT Follow Up"},"version":"201604080459","id_string":"woman_tt_followup_form","type":"survey","children":[{"type":"hidden","name":"provider_uc"},{"type":"hidden","name":"provider_town"},{"type":"hidden","name":"provider_city"},{"type":"hidden","name":"provider_province"},{"type":"hidden","name":"existing_landmark"},{"type":"hidden","name":"existing_house_number"},{"type":"hidden","name":"existing_street"},{"type":"hidden","name":"existing_union_council"},{"type":"hidden","name":"existing_town"},{"type":"hidden","name":"existing_city_village"},{"type":"hidden","name":"existing_province"},{"type":"hidden","name":"existing_union_councilname"},{"type":"hidden","name":"existing_townname"},{"type":"hidden","name":"existing_city_villagename"},{"type":"hidden","name":"existing_provincename"},{"type":"hidden","name":"existing_first_name"},{"type":"hidden","name":"existing_last_name"},{"type":"hidden","name":"existing_father_name"},{"type":"hidden","name":"existing_husband_name"},{"type":"hidden","name":"existing_marriage"},{"type":"hidden","name":"existing_calc_dob_confirm"},{"type":"hidden","name":"existing_gender"},{"type":"hidden","name":"existing_ethnicity"},{"type":"hidden","name":"existing_client_reg_date"},{"type":"hidden","name":"existing_program_client_id"},{"type":"hidden","name":"existing_epi_card_number"},{"type":"hidden","name":"existing_reminders_approval"},{"type":"hidden","name":"existing_contact_phone_number"},{"type":"hidden","name":"e_tt1"},{"type":"hidden","name":"e_tt2"},{"type":"hidden","name":"e_tt3"},{"type":"hidden","name":"e_tt4"},{"type":"hidden","name":"e_tt5"},{"type":"hidden","name":"provider_id"},{"instance":{"openmrs_entity_id":"location_id","openmrs_entity":"encounter"},"type":"hidden","name":"provider_location_id"},{"type":"hidden","name":"provider_location_name"},{"type":"note","name":"provider_location_note","label":{"Urdu":"شہر: ${provider_city} ; ٹائون: ${provider_town} ; یوسی: ${provider_uc} ; سینٹرکا نام: ${provider_location_name}","English":"City: ${provider_city} ; Town: ${provider_town} ; UC: ${provider_uc} ; Center Name: ${provider_location_name}"}},{"instance":{"openmrs_entity_id":"163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"start","name":"start"},{"instance":{"openmrs_entity_id":"163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"end","name":"end"},{"instance":{"openmrs_entity_id":"163286AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"today","name":"today"},{"instance":{"openmrs_entity_id":"163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"deviceid","name":"deviceid"},{"instance":{"openmrs_entity_id":"163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"subscriberid","name":"subscriberid"},{"instance":{"openmrs_entity_id":"163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"simserial","name":"simserial"},{"instance":{"openmrs_entity_id":"163152AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"phonenumber","name":"phonenumber"},{"bind":{"required":"yes"},"type":"note","name":"client_reg_date_note","label":{"Urdu":"${existing_client_reg_date} :پروگرام میں اندراج کی تاریخ","Roman Urdu":"Program main andraaj ki tareekh: ${existing_client_reg_date}","English":"Client Registration date: ${existing_client_reg_date}"}},{"bind":{"required":"yes"},"type":"note","name":"program_client_id_note","label":{"Urdu":"${existing_program_client_id}:کلائنٹ کی پروگرام ائی ڈی","Roman Urdu":"Client ki program ID: ${existing_program_client_id}","English":"Program Client ID: ${existing_program_client_id}"}},{"bind":{"required":"yes"},"type":"note","name":"epi_card_number_note","label":{"Urdu":"${existing_epi_card_number}: کارڈ نمبر","Roman Urdu":"Card Number: ${existing_epi_card_number}","English":"EPI Card Number: ${existing_epi_card_number}"}},{"bind":{"required":"yes"},"type":"note","name":"first_name_note","label":{"Urdu":"${existing_first_name}: نام","Roman Urdu":"Naam: ${existing_first_name}","English":"First Name: ${existing_first_name}"}},{"bind":{"required":"yes"},"type":"note","name":"last_name_note","label":{"Urdu":"والد کا نام: ${existing_last_name}","Roman Urdu":"Waalid ka naam: ${existing_last_name}","English":"Last name: ${existing_last_name}"}},{"bind":{"calculate":"date( today() - (${existing_calc_dob_confirm} div 365))"},"type":"calculate","name":"client_age","instance":{"openmrs_entity_id":"154384AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"}},{"type":"note","name":"member_birth_date_note","label":{"Urdu":"کلائنٹ کی تاریخِ پیدائش: {existing_calc_dob_confirm}$ ({client_age}$) سال","English":"Client birth date: ${existing_calc_dob_confirm} (${client_age}) years","Roman Urdu":"Client ki tareekh-e-pedaaish: ${existing_calc_dob_confirm} (${client_age}) years"}},{"bind":{"required":"yes"},"type":"note","name":"gender_note","label":{"Urdu":"${existing_gender}: جنس","Roman Urdu":"Jins:${existing_gender}","English":"Gender: ${existing_gender}"}},{"type":"note","name":"father_name_note","label":{"Urdu":"والد کا نام: {existing_father_name}$","English":"Father's Name: ${existing_father_name}","Roman Urdu":"Waalid ka naam: ${existing_father_name}"}},{"type":"note","name":"marriage_note","label":{"Urdu":"کیا آپ شادی شدہ ہیں: {existing_marriage}$","English":"Are you married: ${existing_marriage}","Roman Urdu":"Kya aap shaadi shuda hain: ${existing_marriage}"}},{"type":"note","name":"husband_name_note","label":{"Urdu":"شوہر کا نام: {existing_husband_name}$","English":"Husband's name: ${existing_husband_name}","Roman Urdu":"Shohar ka naam: ${existing_husband_name}"}},{"bind":{"required":"yes"},"type":"note","name":"ethnicity_note","label":{"Urdu":"قومیت: {existing_ethnicity}$","Roman Urdu":"Qomiat: ${existing_ethnicity}","English":"Ethnicity: ${existing_ethnicity}"}},{"type":"note","name":"address","label":{"Urdu":"موجودہ پتہ: ${existing_house_number}, ${existing_street}, ${existing_landmark}, ${existing_union_councilname}, ${existing_townname}, ${existing_city_villagename}, ${existing_provincename}","English":"Current Address: ${existing_house_number}, ${existing_street}, ${existing_landmark}, ${existing_union_councilname}, ${existing_townname}, ${existing_city_villagename}, ${existing_provincename}","Roman Urdu":"Mojooda Address: ${existing_house_number}, ${existing_street}, ${existing_landmark}, ${existing_union_councilname}, ${existing_townname}, ${existing_city_villagename}, ${existing_provincename}"}},{"label":{"Urdu":"کیا آپ کا گھر کا پتہ بدلا ہے؟","English":"Has your home address changed?","Roman Urdu":"Kya aap ka ghar ka pata badla hai?"},"type":"select one","children":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}],"name":"address_change"},{"control":{"appearance":"minimal"},"name":"province","default":"${provider_province}","bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"label":{"Urdu":"صوبہ","Roman Urdu":"Suba","English":"Province"},"instance":{"openmrs_entity":"person_address","openmrs_entity_id":"stateProvince","openmrs_entity_parent":"usual_residence"},"type":"select one","children":[{"name":"kpk","label":{"Urdu":"خیبر پختون خواہ","English":"Khyber Pakhtunkhwa","Roman Urdu":"Khyber Pakhtunkhwa"}},{"name":"sindh","label":{"Urdu":"سندھ","English":"Sindh","Roman Urdu":"Sindh"}},{"name":"balochistan","label":{"Urdu":"بلوچستان","English":"Balochistan","Roman Urdu":"Balochistan"}},{"name":"punjab","label":{"Urdu":"پنجاب","English":"Punjab","Roman Urdu":"Punjab"}},{"name":"gilgit_baltistan","label":{"Urdu":"گلگت بلتستان","English":"Gilgit Baltistan","Roman Urdu":"Gilgit Baltistan"}},{"name":"kashmir","label":{"Urdu":"کشمیر","English":"Kashmir","Roman Urdu":"Kashmir"}},{"name":"fata","label":{"Urdu":"فاٹا","English":"FATA","Roman Urdu":"FATA"}},{"name":"out_of_country","label":{"Urdu":"ملک سے باہر","English":"Out of Country","Roman Urdu":"Mulk se baahir"}}]},{"control":{"appearance":"minimal"},"name":"city_village","choice_filter":"province=${province} or province='na'","default":"${provider_city}","bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"label":{"Urdu":"شہر","Roman Urdu":"Shehr","English":"City"},"itemset":"cities","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"cityVillage","openmrs_entity_parent":"usual_residence"},"type":"select one"},{"control":{"appearance":"minimal"},"name":"town","choice_filter":"(province=${province} and city=${city_village} ) or city='na'","bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"label":{"Urdu":"ٹاٰئون/ قصبہ/ بستی","Roman Urdu":"Town / Qasbah / Basti","English":"Town"},"itemset":"towns","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"town","openmrs_entity_parent":"usual_residence"},"type":"select one"},{"control":{"appearance":"minimal"},"name":"union_council","choice_filter":"(province=${province} and city=${city_village} and town=${town}) or town='na'","bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"label":{"Urdu":"یونین کونسل","Roman Urdu":"Union Council","English":"Union Council"},"itemset":"ucs","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"subTown","openmrs_entity_parent":"usual_residence"},"type":"select one"},{"bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"type":"text","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"house","openmrs_entity_parent":"usual_residence"},"name":"house_number","label":{"Urdu":"گھر کا نمبر","Roman Urdu":"Ghar ka number","English":"House Number"}},{"bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"type":"text","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"street","openmrs_entity_parent":"usual_residence"},"name":"street","label":{"Urdu":"گلی/کالونی/محلہ","Roman Urdu":"Gali/Colony/Mohalla","English":"Street"}},{"bind":{"relevant":"selected(${address_change}, 'yes')","required":"yes"},"type":"text","instance":{"openmrs_entity":"person_address","openmrs_entity_id":"landmark","openmrs_entity_parent":"usual_residence"},"name":"landmark","label":{"Urdu":"گھر کے قریب کوئی مشہور جگہ","Roman Urdu":"Ghar ke qareeb koi mashoor jagah","English":"Land Mark"}},{"instance":{"openmrs_entity_id":"163277AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"geopoint","name":"center_gps","label":{"Urdu":"حاصل کردہ معلومات کی جگہ کے GPS کارڈینیٹس درج کریں","English":"Collect GPS coordinates of data entry location:","Roman Urdu":"Hasil karda malomaat ki jaga ke GPS coordinates darj karain"}},{"control":{"appearance":"minimal"},"name":"reminders_approval","bind":{"required":"yes"},"label":{"Urdu":"کیا آپ اپنے بچے کی اگلی ویکسین کی تاریخ کے لیے SMS موصول کرنا چاہتے ہیں؟ {existing_reminders_approval}$","English":"Are you willing to receive SMS reminders for your next visit? ${existing_reminders_approval}","Roman Urdu":"Kya aap apnay bachay ki agli vaccine ki tareekh ke liye SMS mausool karna chahtay hain? ${existing_reminders_approval}"},"instance":{"openmrs_entity_id":"163089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"select one","children":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}]},{"bind":{"jr:constraintMsg":{"Urdu":"فون نمبر گیارہ ہندسوں پر مشتمل اور مندرجہ ذیل شکل میں ہونا چاہئے: *********03","English":"Phone number should be 11 digits in the following format: 03*********","Roman Urdu":"Phone number 11 hindason par mushtamil aur mundarja zail shakal main hona chahiey: 03*********"},"relevant":"${existing_reminders_approval}='yes'","constraint":"regex(., '^03[0-9]{9}$')"},"type":"text","instance":{"openmrs_entity_id":"159635AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"name":"contact_phone_number","label":{"Urdu":"موبائل نمبر:{existing_contact_phone_number}$","English":"Mobile Number: ${existing_contact_phone_number}","Roman Urdu":"Mobile Number: ${existing_contact_phone_number}"}},{"instance":{"openmrs_entity_id":"5272AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"label":{"Urdu":"کیا خا تون حاملہ ہیں؟","English":"Is female pregnant?","Roman Urdu":"Kia khatoon haamla hain?"},"type":"select one","children":[{"instance":{"openmrs_code":"1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"yes","label":{"Urdu":"ہاں","Roman Urdu":"Yes","English":"Yes"}},{"instance":{"openmrs_code":"1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"no","label":{"Urdu":"نہیں","Roman Urdu":"No","English":"No"}}],"name":"pregnant"},{"name":"edd_lmp","bind":{"relevant":"selected (${pregnant}, 'yes')"},"label":{"Urdu":"کیا آپ کو اپنی پچھلی ماہواری کی تاریخ، زچگی کی متوقع تاریخ، یا الٹرا سائونڈ کا علم ہے؟","English":"Do you know your LMP, EDD or last Ultrasound information?","Roman Urdu":"Kya aap ko apni pichli mahwaari ki tareekh, zachgi ki mutawaqqa tareekh ya ultrasound ka ilm hai?"},"instance":{"openmrs_entity_id":"160697AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"type":"select one","children":[{"instance":{"openmrs_code":"5596AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"edd","label":{"Urdu":"زچگی کی متوقع تاریخ","Roman Urdu":"EDD","English":"EDD"}},{"instance":{"openmrs_code":"1427AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"lmp","label":{"Urdu":"پچھلی مہواری کی تاریخ","Roman Urdu":"LMP","English":"LMP"}},{"instance":{"openmrs_code":"159617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"ultrasound","label":{"Urdu":"الٹرا سائونڈ","Roman Urdu":"Ultrasound","English":"Ultrasound"}},{"instance":{"openmrs_code":"1107AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"none","label":{"Urdu":"کوئی بھی نہیں","Roman Urdu":"Koi bhi nahi","English":"None of the above"}}]},{"bind":{"jr:constraintMsg":{"Urdu":"زچگی کی متوقع تاریخ ماضی کی نہیں ہو سکتی","Roman Urdu":"Zachgi ki mutawaqqa tareekh maazi ki nahi hosakti","English":"EDD cannot be in the past"},"relevant":"selected (${edd_lmp}, 'edd')","constraint":".>=${today}"},"type":"date","name":"edd","label":{"Urdu":"زچگی کی متوقع تاریخ","Roman Urdu":"Zachgi ki mutawaqqa tareekh","English":"EDD"}},{"bind":{"jr:constraintMsg":{"Urdu":"پچھلی ماہواری کی تاریخ مستقبل کی نہیں ہوسکتی","Roman Urdu":"Pichli mahwaari ki tareekh mustaqbil ki nahi hosakti","English":"LMP cannot be in the future"},"relevant":"selected (${edd_lmp}, 'lmp')","constraint":".<=${today}"},"type":"date","name":"lmp","label":{"Urdu":"پچھلی ماہواری کی تاریخ","Roman Urdu":"Pichli mahwaari ki tareekh","English":"LMP"}},{"bind":{"relevant":"selected (${edd_lmp}, 'ultrasound')"},"type":"date","instance":{"openmrs_entity_id":"163165AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"},"name":"ultrasound_date","label":{"Urdu":"الٹرا سائونڈ کی تاریخ","English":"Ultrasound Date","Roman Urdu":"Ultrasound ki tareekh"}},{"bind":{"relevant":"selected (${edd_lmp}, 'ultrasound')"},"type":"integer","name":"ultrasound_weeks","label":{"Urdu":"الٹرا سائونڈ کی مدد سے حمل کی مدت [ہفتوں میں]","Roman Urdu":"Ultrasound ki madad se hamal ki muddat (hafton me)","English":"Gestational age determined by ultrasound"}},{"bind":{"calculate":"date(${lmp}+280)"},"type":"calculate","name":"edd_calc_lmp"},{"bind":{"calculate":"date((280-(${ultrasound_weeks}*7)+${ultrasound_date} ))"},"type":"calculate","name":"edd_calc_ultrasound"},{"bind":{"calculate":"format-date(${edd_calc_lmp}, '%Y-%n-%e')"},"type":"calculate","name":"edd_calc_lmp_formatted"},{"bind":{"calculate":"format-date(${edd_calc_ultrasound}, '%Y-%n-%e')"},"type":"calculate","name":"edd_calc_ultrasound_formatted"},{"bind":{"calculate":"date(${edd}-280)"},"type":"calculate","name":"lmp_calc_edd"},{"bind":{"calculate":"date(${ultrasound_date}-(${ultrasound_weeks}*7))"},"type":"calculate","name":"lmp_calc_ultrasound"},{"bind":{"calculate":"format-date(${lmp_calc_edd}, '%Y-%n-%e')"},"type":"calculate","name":"lmp_calc_edd_formatted"},{"bind":{"calculate":"format-date(${lmp_calc_ultrasound}, '%Y-%n-%e')"},"type":"calculate","name":"lmp_calc_ultrasound_formatted"},{"bind":{"calculate":"if(${edd_lmp}='lmp',${edd_calc_lmp_formatted},if(${edd_lmp}='edd',${edd} ,if(${edd_lmp}='ultrasound',${edd_calc_ultrasound_formatted},'')))"},"type":"calculate","name":"final_edd","instance":{"openmrs_entity_id":"5596AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"}},{"bind":{"calculate":"if(${edd_lmp}='lmp',${lmp},if(${edd_lmp}='edd',${lmp_calc_edd_formatted} ,if(${edd_lmp}='ultrasound',${lmp_calc_ultrasound_formatted},'')))"},"type":"calculate","name":"final_lmp","instance":{"openmrs_entity_id":"1427AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"}},{"bind":{"calculate":"int((${vaccination_date} - (${edd}-280))div7)"},"type":"calculate","name":"ga_edd"},{"bind":{"calculate":"int((${vaccination_date} - ${lmp})div7)"},"type":"calculate","name":"ga_lmp"},{"bind":{"calculate":"int((${vaccination_date} -(${ultrasound_date}-(${ultrasound_weeks}*7)))div7)"},"type":"calculate","name":"ga_ult"},{"bind":{"relevant":"selected (${pregnant}, 'yes')"},"type":"note","name":"final_edd_note","label":{"Urdu":"${final_edd}: زچگی کی متوقع تاریخ","Roman Urdu":"Zachgi ki mutawaqqa tareekh: ${final_edd}","English":"EDD: ${final_edd}"}},{"bind":{"relevant":"selected (${pregnant}, 'yes')"},"type":"note","name":"final_lmp_note","label":{"Urdu":"پچھلی ماہواری کی تاریخ :{final_lmp}$","Roman Urdu":"Pichli mahwaari ki tareekh: ${final_lmp}","English":"LMP: ${final_lmp}"}},{"bind":{"calculate":"if(${edd_lmp}='lmp',${ga_lmp},if(${edd_lmp}='edd',${ga_edd} ,if(${edd_lmp}='ultrasound',${ga_ult},'')))"},"type":"calculate","name":"final_ga","instance":{"openmrs_entity_id":"163166AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity":"concept"}},{"bind":{"relevant":"selected (${pregnant}, 'yes')"},"type":"note","name":"final_ga_note","label":{"Urdu":"حمل کی مُدّت: {final_ga}$ ہفتے","Roman Urdu":"Hamal ki muddat: ${final_ga} weeks","English":"GA: ${final_ga} weeks"}},{"name":"vaccines","choice_filter":"name != if( ${e_tt1} != '', 'TT1' , '') and \nname != if( ${e_tt2} != '', 'TT2' , '') and \nname != if( ${e_tt3} != '', 'TT3' , '') and \nname != if( ${e_tt4} != '', 'TT4' , '') and \nname != if( ${e_tt5} != '', 'TT5' , '')","default":"minimal","label":{"Urdu":"پچھلی تاریخ جب کسی اور سینٹر پر ٹیکہ لگوایا گیا یا قطرے پلائے گئے","Roman Urdu":"Pichli tareekh jab kissi aur center par teeka lagwaya gaya ya katray pilaey gaye","English":"Retro vaccines"},"itemset":"vaccines","instance":{"openmrs_entity":"concept","openmrs_entity_id":"984AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1421AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"select all that apply"},{"bind":{"relevant":"selected(${vaccines},'TT1')","constraint":"(.<=${today} and .<=${existing_client_reg_date})"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"tt1_retro","label":{"Urdu":"ٹی ٹی 1","Roman Urdu":"TT1","English":"TT1"}},{"bind":{"relevant":"selected(${vaccines},'TT1')","calculate":"1"},"type":"calculate","name":"tt_1_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines},'TT2')","constraint":"(.<=${today} and .>=${tt1_retro} and ((selected(${vaccines}, 'TT1'))))"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"tt2_retro","label":{"Urdu":"ٹی ٹی 2","Roman Urdu":"TT2","English":"TT2"}},{"bind":{"relevant":"selected(${vaccines},'TT2')","calculate":"2"},"type":"calculate","name":"tt_2_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines},'TT3')","constraint":"(.<=${today} and .>=${tt2_retro} and ((selected(${vaccines}, 'TT2'))))"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"tt3_retro","label":{"Urdu":"ٹی ٹی 3","Roman Urdu":"TT3","English":"TT3"}},{"bind":{"relevant":"selected(${vaccines},'TT3')","calculate":"3"},"type":"calculate","name":"tt_3_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines},'TT4')","constraint":"(.<=${today} and .>=${tt3_retro} and ((selected(${vaccines}, 'TT3'))))"},"type":"date","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"name":"tt4_retro","label":{"Urdu":"ٹی ٹی 4","Roman Urdu":"TT4","English":"TT4"}},{"bind":{"relevant":"selected(${vaccines},'TT4')","calculate":"4"},"type":"calculate","name":"tt_4_dose","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"name":"vaccines_2","choice_filter":"name != if( ${e_tt1} != '', 'TT1' , '') and \nname != if( ${e_tt2} != '', 'TT2' , '') and \nname != if( ${e_tt3} != '', 'TT3' , '') and \nname != if( ${e_tt4} != '', 'TT4' , '') and \nname != if( ${e_tt5} != '', 'TT5' , '') and \nname != if( selected(${vaccines}, 'TT1') , 'TT1', '') and \nname != if( selected(${vaccines}, 'TT2') , 'TT2', '') and \nname != if( selected(${vaccines}, 'TT3') , 'TT3', '') and \nname != if( selected(${vaccines}, 'TT4') , 'TT4', '') and \nname != if( selected(${vaccines}, 'TT5') , 'TT5', '')","bind":{"required":"yes"},"label":{"Urdu":"آج کون کون سی ویکسین دی گئی ہیں؟","Roman Urdu":"Aaj kon kon si vaccine di gai hain?","English":"Vaccine administered today"},"itemset":"vaccines","instance":{"openmrs_entity":"concept","openmrs_entity_id":"984AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"1441AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"type":"select all that apply"},{"bind":{"required":"yes"},"type":"date","instance":{"openmrs_entity_id":"encounter_date","openmrs_entity":"encounter"},"name":"vaccination_date","label":{"Urdu":"تاریخ","English":"Vaccination date","Roman Urdu":"Tareekh"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'TT1'),${vaccination_date},'')"},"type":"calculate","name":"tt1","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2},'TT1')","calculate":"1"},"type":"calculate","name":"tt_1_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'TT2'),${vaccination_date},'')"},"type":"calculate","name":"tt2","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2},'TT2')","calculate":"2"},"type":"calculate","name":"tt_2_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'TT3'),${vaccination_date},'')"},"type":"calculate","name":"tt3","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2},'TT3')","calculate":"3"},"type":"calculate","name":"tt_3_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'TT4'),${vaccination_date},'')"},"type":"calculate","name":"tt4","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2},'TT4')","calculate":"4"},"type":"calculate","name":"tt_4_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"calculate":"if(selected(${vaccines_2}, 'TT5'),${vaccination_date},'')"},"type":"calculate","name":"tt5","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"bind":{"relevant":"selected(${vaccines_2},'TT5')","calculate":"5"},"type":"calculate","name":"tt_5_dose_today","instance":{"openmrs_entity":"concept","openmrs_entity_id":"1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","openmrs_entity_parent":"104528AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"control":{"bodyless":true},"type":"group","children":[{"bind":{"readonly":"true()","calculate":"concat('uuid:', uuid())"},"type":"calculate","name":"instanceID"}],"name":"meta"}]} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/woman_followup/form.xml b/opensrp-core/src/test/resources/form/woman_followup/form.xml deleted file mode 100644 index 678d93463a..0000000000 --- a/opensrp-core/src/test/resources/form/woman_followup/form.xml +++ /dev/null @@ -1,1435 +0,0 @@ -
- - -

خواتین فالواپ رجسٹر برائے ٹیکاجات - Woman TT Follow Up Form

-
-
- - کیا آپ کا گھر کا پتہ بدلا ہے؟ - Kya aap ka ghar ka pata badla hai? - - Has your home address changed? -
- - -
-
-
-
- - کیا خا تون حاملہ ہیں؟ - Kia khatoon haamla hain? - - Is female pregnant? -
- - -
-
-
-
- - کیا آپ کو اپنی پچھلی ماہواری کی تاریخ، زچگی کی متوقع تاریخ، یا الٹرا سائونڈ کا علم ہے؟ - Kya aap ko apni pichli mahwaari ki tareekh, zachgi ki mutawaqqa tareekh ya ultrasound ka ilm hai? - - Do you know your LMP, EDD or last Ultrasound information? -
- - - - -
-
-
-
- - پچھلی تاریخ جب کسی اور سینٹر پر ٹیکہ لگوایا گیا یا قطرے پلائے گئے - Pichli tareekh jab kissi aur center par teeka lagwaya gaya ya katray pilaey gaye - - Retro vaccines -
- - - ٹی ٹی 1 - TT1 - - TT1 - ٹی ٹی 2 - TT2 - - TT2 - ٹی ٹی 3 - TT3 - - TT3 - ٹی ٹی 4 - TT4 - - TT4 - ٹی ٹی 5 - TT5 - - TT5 -
-
-
-
- - آج کون کون سی ویکسین دی گئی ہیں؟ - Aaj kon kon si vaccine di gai hain? - - Vaccine administered today - * -
- - - ٹی ٹی 1 - TT1 - - TT1 - ٹی ٹی 2 - TT2 - - TT2 - ٹی ٹی 3 - TT3 - - TT3 - ٹی ٹی 4 - TT4 - - TT4 - ٹی ٹی 5 - TT5 - - TT5 -
-
-
- -
diff --git a/opensrp-core/src/test/resources/form/woman_followup/form_definition.json b/opensrp-core/src/test/resources/form/woman_followup/form_definition.json deleted file mode 100644 index b1d257f7a1..0000000000 --- a/opensrp-core/src/test/resources/form/woman_followup/form_definition.json +++ /dev/null @@ -1,384 +0,0 @@ -{ - "form_data_definition_version" : "1", - "form" : { - "bind_type" : "pkwoman", - "default_bind_path" : "/model/instance/Woman_TT_Followup_Form/", - "fields" : [ { - "name" : "id", - "shouldLoadValue" : true - }, { - "name" : "provider_uc", - "bind" : "/model/instance/Woman_TT_Followup_Form/provider_uc", - "shouldLoadValue" : true - }, { - "name" : "provider_town", - "bind" : "/model/instance/Woman_TT_Followup_Form/provider_town", - "shouldLoadValue" : true - }, { - "name" : "provider_city", - "bind" : "/model/instance/Woman_TT_Followup_Form/provider_city", - "shouldLoadValue" : true - }, { - "name" : "provider_province", - "bind" : "/model/instance/Woman_TT_Followup_Form/provider_province", - "shouldLoadValue" : true - }, { - "name" : "existing_landmark", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_landmark", - "shouldLoadValue" : true - }, { - "name" : "existing_house_number", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_house_number", - "shouldLoadValue" : true - }, { - "name" : "existing_street", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_street", - "shouldLoadValue" : true - }, { - "name" : "existing_union_council", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_union_council", - "shouldLoadValue" : true - }, { - "name" : "existing_town", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_town", - "shouldLoadValue" : true - }, { - "name" : "existing_city_village", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_city_village", - "shouldLoadValue" : true - }, { - "name" : "existing_province", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_province", - "shouldLoadValue" : true - }, { - "name" : "existing_union_councilname", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_union_councilname", - "shouldLoadValue" : true - }, { - "name" : "existing_townname", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_townname", - "shouldLoadValue" : true - }, { - "name" : "existing_city_villagename", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_city_villagename", - "shouldLoadValue" : true - }, { - "name" : "existing_provincename", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_provincename", - "shouldLoadValue" : true - }, { - "name" : "existing_first_name", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_first_name", - "shouldLoadValue" : true - }, { - "name" : "existing_last_name", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_last_name", - "shouldLoadValue" : true - }, { - "name" : "existing_father_name", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_father_name", - "shouldLoadValue" : true - }, { - "name" : "existing_husband_name", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_husband_name", - "shouldLoadValue" : true - }, { - "name" : "existing_marriage", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_marriage", - "shouldLoadValue" : true - }, { - "name" : "existing_birthdate", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_calc_dob_confirm", - "shouldLoadValue" : true - }, { - "name" : "existing_gender", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_gender", - "shouldLoadValue" : true - }, { - "name" : "existing_ethnicity", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_ethnicity", - "shouldLoadValue" : true - }, { - "name" : "existing_client_reg_date", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_client_reg_date", - "shouldLoadValue" : true - }, { - "name" : "existing_program_client_id", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_program_client_id", - "shouldLoadValue" : true - }, { - "name" : "existing_epi_card_number", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_epi_card_number", - "shouldLoadValue" : true - }, { - "name" : "existing_reminders_approval", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_reminders_approval" - }, { - "name" : "existing_contact_phone_number", - "bind" : "/model/instance/Woman_TT_Followup_Form/existing_contact_phone_number" - }, { - "name" : "e_tt1", - "bind" : "/model/instance/Woman_TT_Followup_Form/e_tt1", - "shouldLoadValue" : true - }, { - "name" : "e_tt2", - "bind" : "/model/instance/Woman_TT_Followup_Form/e_tt2", - "shouldLoadValue" : true - }, { - "name" : "e_tt3", - "bind" : "/model/instance/Woman_TT_Followup_Form/e_tt3", - "shouldLoadValue" : true - }, { - "name" : "e_tt4", - "bind" : "/model/instance/Woman_TT_Followup_Form/e_tt4", - "shouldLoadValue" : true - }, { - "name" : "e_tt5", - "bind" : "/model/instance/Woman_TT_Followup_Form/e_tt5", - "shouldLoadValue" : true - }, { - "name" : "provider_id", - "bind" : "/model/instance/Woman_TT_Followup_Form/provider_id", - "shouldLoadValue" : true - }, { - "name" : "provider_location_id", - "bind" : "/model/instance/Woman_TT_Followup_Form/provider_location_id", - "shouldLoadValue" : true - }, { - "name" : "provider_location_name", - "bind" : "/model/instance/Woman_TT_Followup_Form/provider_location_name", - "shouldLoadValue" : true - }, { - "name" : "provider_location_note", - "bind" : "/model/instance/Woman_TT_Followup_Form/provider_location_note" - }, { - "name" : "start", - "bind" : "/model/instance/Woman_TT_Followup_Form/start" - }, { - "name" : "end", - "bind" : "/model/instance/Woman_TT_Followup_Form/end" - }, { - "name" : "today", - "bind" : "/model/instance/Woman_TT_Followup_Form/today" - }, { - "name" : "deviceid", - "bind" : "/model/instance/Woman_TT_Followup_Form/deviceid" - }, { - "name" : "subscriberid", - "bind" : "/model/instance/Woman_TT_Followup_Form/subscriberid" - }, { - "name" : "simserial", - "bind" : "/model/instance/Woman_TT_Followup_Form/simserial" - }, { - "name" : "phonenumber", - "bind" : "/model/instance/Woman_TT_Followup_Form/phonenumber" - }, { - "name" : "client_reg_date_note", - "bind" : "/model/instance/Woman_TT_Followup_Form/client_reg_date_note" - }, { - "name" : "program_client_id_note", - "bind" : "/model/instance/Woman_TT_Followup_Form/program_client_id_note" - }, { - "name" : "epi_card_number_note", - "bind" : "/model/instance/Woman_TT_Followup_Form/epi_card_number_note" - }, { - "name" : "first_name_note", - "bind" : "/model/instance/Woman_TT_Followup_Form/first_name_note" - }, { - "name" : "last_name_note", - "bind" : "/model/instance/Woman_TT_Followup_Form/last_name_note" - }, { - "name" : "client_age", - "bind" : "/model/instance/Woman_TT_Followup_Form/client_age" - }, { - "name" : "member_birth_date_note", - "bind" : "/model/instance/Woman_TT_Followup_Form/member_birth_date_note" - }, { - "name" : "gender_note", - "bind" : "/model/instance/Woman_TT_Followup_Form/gender_note" - }, { - "name" : "father_name_note", - "bind" : "/model/instance/Woman_TT_Followup_Form/father_name_note" - }, { - "name" : "marriage_note", - "bind" : "/model/instance/Woman_TT_Followup_Form/marriage_note" - }, { - "name" : "husband_name_note", - "bind" : "/model/instance/Woman_TT_Followup_Form/husband_name_note" - }, { - "name" : "ethnicity_note", - "bind" : "/model/instance/Woman_TT_Followup_Form/ethnicity_note" - }, { - "name" : "address", - "bind" : "/model/instance/Woman_TT_Followup_Form/address" - }, { - "name" : "address_change", - "bind" : "/model/instance/Woman_TT_Followup_Form/address_change" - }, { - "name" : "province", - "bind" : "/model/instance/Woman_TT_Followup_Form/province" - }, { - "name" : "city_village", - "bind" : "/model/instance/Woman_TT_Followup_Form/city_village" - }, { - "name" : "town", - "bind" : "/model/instance/Woman_TT_Followup_Form/town" - }, { - "name" : "union_council", - "bind" : "/model/instance/Woman_TT_Followup_Form/union_council" - }, { - "name" : "house_number", - "bind" : "/model/instance/Woman_TT_Followup_Form/house_number" - }, { - "name" : "street", - "bind" : "/model/instance/Woman_TT_Followup_Form/street" - }, { - "name" : "landmark", - "bind" : "/model/instance/Woman_TT_Followup_Form/landmark" - }, { - "name" : "center_gps", - "bind" : "/model/instance/Woman_TT_Followup_Form/center_gps" - }, { - "name" : "reminders_approval", - "bind" : "/model/instance/Woman_TT_Followup_Form/reminders_approval" - }, { - "name" : "contact_phone_number", - "bind" : "/model/instance/Woman_TT_Followup_Form/contact_phone_number" - }, { - "name" : "pregnant", - "bind" : "/model/instance/Woman_TT_Followup_Form/pregnant" - }, { - "name" : "edd_lmp", - "bind" : "/model/instance/Woman_TT_Followup_Form/edd_lmp" - }, { - "name" : "edd", - "bind" : "/model/instance/Woman_TT_Followup_Form/edd" - }, { - "name" : "lmp", - "bind" : "/model/instance/Woman_TT_Followup_Form/lmp" - }, { - "name" : "ultrasound_date", - "bind" : "/model/instance/Woman_TT_Followup_Form/ultrasound_date" - }, { - "name" : "ultrasound_weeks", - "bind" : "/model/instance/Woman_TT_Followup_Form/ultrasound_weeks" - }, { - "name" : "edd_calc_lmp", - "bind" : "/model/instance/Woman_TT_Followup_Form/edd_calc_lmp" - }, { - "name" : "edd_calc_ultrasound", - "bind" : "/model/instance/Woman_TT_Followup_Form/edd_calc_ultrasound" - }, { - "name" : "edd_calc_lmp_formatted", - "bind" : "/model/instance/Woman_TT_Followup_Form/edd_calc_lmp_formatted" - }, { - "name" : "edd_calc_ultrasound_formatted", - "bind" : "/model/instance/Woman_TT_Followup_Form/edd_calc_ultrasound_formatted" - }, { - "name" : "lmp_calc_edd", - "bind" : "/model/instance/Woman_TT_Followup_Form/lmp_calc_edd" - }, { - "name" : "lmp_calc_ultrasound", - "bind" : "/model/instance/Woman_TT_Followup_Form/lmp_calc_ultrasound" - }, { - "name" : "lmp_calc_edd_formatted", - "bind" : "/model/instance/Woman_TT_Followup_Form/lmp_calc_edd_formatted" - }, { - "name" : "lmp_calc_ultrasound_formatted", - "bind" : "/model/instance/Woman_TT_Followup_Form/lmp_calc_ultrasound_formatted" - }, { - "name" : "final_edd", - "bind" : "/model/instance/Woman_TT_Followup_Form/final_edd" - }, { - "name" : "final_lmp", - "bind" : "/model/instance/Woman_TT_Followup_Form/final_lmp" - }, { - "name" : "ga_edd", - "bind" : "/model/instance/Woman_TT_Followup_Form/ga_edd" - }, { - "name" : "ga_lmp", - "bind" : "/model/instance/Woman_TT_Followup_Form/ga_lmp" - }, { - "name" : "ga_ult", - "bind" : "/model/instance/Woman_TT_Followup_Form/ga_ult" - }, { - "name" : "final_edd_note", - "bind" : "/model/instance/Woman_TT_Followup_Form/final_edd_note" - }, { - "name" : "final_lmp_note", - "bind" : "/model/instance/Woman_TT_Followup_Form/final_lmp_note" - }, { - "name" : "final_ga", - "bind" : "/model/instance/Woman_TT_Followup_Form/final_ga" - }, { - "name" : "final_ga_note", - "bind" : "/model/instance/Woman_TT_Followup_Form/final_ga_note" - }, { - "name" : "vaccines", - "bind" : "/model/instance/Woman_TT_Followup_Form/vaccines" - }, { - "name" : "tt1_retro", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt1_retro" - }, { - "name" : "tt_1_dose", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt_1_dose" - }, { - "name" : "tt2_retro", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt2_retro" - }, { - "name" : "tt_2_dose", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt_2_dose" - }, { - "name" : "tt3_retro", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt3_retro" - }, { - "name" : "tt_3_dose", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt_3_dose" - }, { - "name" : "tt4_retro", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt4_retro" - }, { - "name" : "tt_4_dose", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt_4_dose" - }, { - "name" : "vaccines_2", - "bind" : "/model/instance/Woman_TT_Followup_Form/vaccines_2" - }, { - "name" : "vaccination_date", - "bind" : "/model/instance/Woman_TT_Followup_Form/vaccination_date" - }, { - "name" : "tt1", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt1" - }, { - "name" : "tt_1_dose_today", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt_1_dose_today" - }, { - "name" : "tt2", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt2" - }, { - "name" : "tt_2_dose_today", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt_2_dose_today" - }, { - "name" : "tt3", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt3" - }, { - "name" : "tt_3_dose_today", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt_3_dose_today" - }, { - "name" : "tt4", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt4" - }, { - "name" : "tt_4_dose_today", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt_4_dose_today" - }, { - "name" : "tt5", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt5" - }, { - "name" : "tt_5_dose_today", - "bind" : "/model/instance/Woman_TT_Followup_Form/tt_5_dose_today" - }, { - "name" : "instanceID", - "bind" : "/model/instance/Woman_TT_Followup_Form/meta/instanceID" - } ] - } -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/form/woman_followup/model.xml b/opensrp-core/src/test/resources/form/woman_followup/model.xml deleted file mode 100644 index e914536dda..0000000000 --- a/opensrp-core/src/test/resources/form/woman_followup/model.xml +++ /dev/null @@ -1,1643 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - ${provider_province} - ${provider_city} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - minimal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - static_instance-provinces-0 - kpk - - - static_instance-provinces-1 - sindh - - - static_instance-provinces-2 - balochistan - - - static_instance-provinces-3 - punjab - - - static_instance-provinces-4 - gilgit_baltistan - - - static_instance-provinces-5 - kashmir - - - static_instance-provinces-6 - fata - - - static_instance-provinces-7 - out_of_country - - - - - - - static_instance-ucs-0 - sindh - karachi - korangi - bilal_colony - - - static_instance-ucs-1 - sindh - karachi - korangi - nasir_colony - - - static_instance-ucs-2 - sindh - karachi - korangi - chakra_goth - - - static_instance-ucs-3 - sindh - karachi - korangi - mustafa_taj_colony - - - static_instance-ucs-4 - sindh - karachi - korangi - hundred_quarters - - - static_instance-ucs-5 - sindh - karachi - korangi - gulzar_colony - - - static_instance-ucs-6 - sindh - karachi - korangi - korangi_sector_33 - - - static_instance-ucs-7 - sindh - karachi - korangi - zaman_town - - - static_instance-ucs-8 - sindh - karachi - korangi - hasrat_mohani_colony - - - static_instance-ucs-9 - sindh - karachi - baldia - gulshan_e_ghazi - - - static_instance-ucs-10 - sindh - karachi - baldia - ittehad_town - - - static_instance-ucs-11 - sindh - karachi - baldia - islam_nagar - - - static_instance-ucs-12 - sindh - karachi - baldia - nai_abadi - - - static_instance-ucs-13 - sindh - karachi - baldia - saeedabad - - - static_instance-ucs-14 - sindh - karachi - baldia - muslim_mujahid_colony - - - static_instance-ucs-15 - sindh - karachi - baldia - muhajir_camp - - - static_instance-ucs-16 - sindh - karachi - baldia - rasheedabad - - - static_instance-ucs-17 - sindh - karachi - bin_qasim - ibrahim_hyderi - - - static_instance-ucs-18 - sindh - karachi - bin_qasim - rehri - - - static_instance-ucs-19 - sindh - karachi - bin_qasim - cattle_colony - - - static_instance-ucs-20 - sindh - karachi - bin_qasim - qaidabad - - - static_instance-ucs-21 - sindh - karachi - bin_qasim - landhi_colony - - - static_instance-ucs-22 - sindh - karachi - bin_qasim - gulshan_e_hadeed - - - static_instance-ucs-23 - sindh - karachi - bin_qasim - gaghar - - - static_instance-ucs-24 - sindh - karachi - gadap - murad_memon_goth - - - static_instance-ucs-25 - sindh - karachi - gadap - darsano_chana - - - static_instance-ucs-26 - sindh - karachi - gadap - gujro - - - static_instance-ucs-27 - sindh - karachi - gadap - songal - - - static_instance-ucs-28 - sindh - karachi - gadap - maymarabad - - - static_instance-ucs-29 - sindh - karachi - gadap - yousuf_goth - - - static_instance-ucs-30 - sindh - karachi - gadap - manghopir - - - static_instance-ucs-31 - sindh - karachi - gulberg - azizabad - - - static_instance-ucs-32 - sindh - karachi - gulberg - karimabad - - - static_instance-ucs-33 - sindh - karachi - gulberg - aisha_manzil - - - static_instance-ucs-34 - sindh - karachi - gulberg - ancholi - - - static_instance-ucs-35 - sindh - karachi - gulberg - naseerabad - - - static_instance-ucs-36 - sindh - karachi - gulberg - yaseenabad - - - static_instance-ucs-37 - sindh - karachi - gulberg - water_pump - - - static_instance-ucs-38 - sindh - karachi - gulberg - shafiq_mill_colony - - - static_instance-ucs-39 - sindh - karachi - gulshan - delhi_mercantile_society - - - static_instance-ucs-40 - sindh - karachi - gulshan - civic_centre - - - static_instance-ucs-41 - sindh - karachi - gulshan - pir_ilahi_buksh_colony - - - static_instance-ucs-42 - sindh - karachi - gulshan - essa_nagri - - - static_instance-ucs-43 - sindh - karachi - gulshan - gulshan_e_iqbal - - - static_instance-ucs-44 - sindh - karachi - gulshan - gillani_railway_station - - - static_instance-ucs-45 - sindh - karachi - gulshan - shanti_nagar - - - static_instance-ucs-46 - sindh - karachi - gulshan - jamali_colony - - - static_instance-ucs-47 - sindh - karachi - gulshan - gulshan_e_iqbal_ii - - - static_instance-ucs-48 - sindh - karachi - gulshan - pehlwan_goth - - - static_instance-ucs-49 - sindh - karachi - gulshan - matrovil_colony - - - static_instance-ucs-50 - sindh - karachi - gulshan - gulzar_e_hijri - - - static_instance-ucs-51 - sindh - karachi - gulshan - safooran_goth - - - static_instance-ucs-52 - sindh - karachi - jamshed - akhtar_colony - - - static_instance-ucs-53 - sindh - karachi - jamshed - manzoor_colony - - - static_instance-ucs-54 - sindh - karachi - jamshed - azam_basti - - - static_instance-ucs-55 - sindh - karachi - jamshed - chanesar_goth - - - static_instance-ucs-56 - sindh - karachi - jamshed - mahmudabad - - - static_instance-ucs-57 - sindh - karachi - jamshed - pechs - - - static_instance-ucs-58 - sindh - karachi - jamshed - pechs_ii - - - static_instance-ucs-59 - sindh - karachi - jamshed - jut_line - - - static_instance-ucs-60 - sindh - karachi - jamshed - central_jacob_lines - - - static_instance-ucs-61 - sindh - karachi - jamshed - jamshed_quarters - - - static_instance-ucs-62 - sindh - karachi - jamshed - garden_east - - - static_instance-ucs-63 - sindh - karachi - jamshed - soldier_bazar - - - static_instance-ucs-64 - sindh - karachi - jamshed - pakistan_quarters - - - static_instance-ucs-65 - sindh - karachi - kiamari - bhutta_village - - - static_instance-ucs-66 - sindh - karachi - kiamari - sultanabad - - - static_instance-ucs-67 - sindh - karachi - kiamari - kiamari_uc - - - static_instance-ucs-68 - sindh - karachi - kiamari - baba_bhit - - - static_instance-ucs-69 - sindh - karachi - kiamari - machar_colony - - - static_instance-ucs-70 - sindh - karachi - kiamari - maripur - - - static_instance-ucs-71 - sindh - karachi - kiamari - shershah - - - static_instance-ucs-72 - sindh - karachi - kiamari - gabo_pat - - - static_instance-ucs-73 - sindh - karachi - landhi - muzafarabad - - - static_instance-ucs-74 - sindh - karachi - landhi - muslimabad - - - static_instance-ucs-75 - sindh - karachi - landhi - dawood_chowrangi - - - static_instance-ucs-76 - sindh - karachi - landhi - moinabad - - - static_instance-ucs-77 - sindh - karachi - landhi - sharafi_goth - - - static_instance-ucs-78 - sindh - karachi - landhi - bhutto_nagar - - - static_instance-ucs-79 - sindh - karachi - landhi - khawaja_ajmeer_colony - - - static_instance-ucs-80 - sindh - karachi - landhi - landhi_uc - - - static_instance-ucs-81 - sindh - karachi - landhi - awami_colony - - - static_instance-ucs-82 - sindh - karachi - landhi - burmee_colony - - - static_instance-ucs-83 - sindh - karachi - landhi - korangi_uc - - - static_instance-ucs-84 - sindh - karachi - landhi - sherabad - - - static_instance-ucs-85 - sindh - karachi - liaquatabad - rizvia_society - - - static_instance-ucs-86 - sindh - karachi - liaquatabad - firdous_colony - - - static_instance-ucs-87 - sindh - karachi - liaquatabad - super_market - - - static_instance-ucs-88 - sindh - karachi - liaquatabad - dak_khana - - - static_instance-ucs-89 - sindh - karachi - liaquatabad - qasimabad - - - static_instance-ucs-90 - sindh - karachi - liaquatabad - bandhani_colony - - - static_instance-ucs-91 - sindh - karachi - liaquatabad - sharifabad - - - static_instance-ucs-92 - sindh - karachi - liaquatabad - commercial_area - - - static_instance-ucs-93 - sindh - karachi - liaquatabad - mujahid_colony - - - static_instance-ucs-94 - sindh - karachi - liaquatabad - nazimabad - - - static_instance-ucs-95 - sindh - karachi - liaquatabad - abbasi_shaheed - - - static_instance-ucs-96 - sindh - karachi - lyari - agra_taj_colony - - - static_instance-ucs-97 - sindh - karachi - lyari - daryaabad - - - static_instance-ucs-98 - sindh - karachi - lyari - nawabad - - - static_instance-ucs-99 - sindh - karachi - lyari - khada_memon_society - - - static_instance-ucs-100 - sindh - karachi - lyari - baghdadi - - - static_instance-ucs-101 - sindh - karachi - lyari - shah_baig_line - - - static_instance-ucs-102 - sindh - karachi - lyari - bihar_colony - - - static_instance-ucs-103 - sindh - karachi - lyari - ragiwara - - - static_instance-ucs-104 - sindh - karachi - lyari - singo_line - - - static_instance-ucs-105 - sindh - karachi - lyari - chakiwara - - - static_instance-ucs-106 - sindh - karachi - lyari - allama_iqbal_colony - - - static_instance-ucs-107 - sindh - karachi - malir - model_colony - - - static_instance-ucs-108 - sindh - karachi - malir - kala_board - - - static_instance-ucs-109 - sindh - karachi - malir - saudabad - - - static_instance-ucs-110 - sindh - karachi - malir - khokhra_par - - - static_instance-ucs-111 - sindh - karachi - malir - jafar_e_tayyar - - - static_instance-ucs-112 - sindh - karachi - malir - gharibabad - - - static_instance-ucs-113 - sindh - karachi - malir - ghazi_brohi_goth - - - static_instance-ucs-114 - sindh - karachi - new_karachi - kalyana - - - static_instance-ucs-115 - sindh - karachi - new_karachi - sir_syed_colony - - - static_instance-ucs-116 - sindh - karachi - new_karachi - fatima_jinnah_colony - - - static_instance-ucs-117 - sindh - karachi - new_karachi - godhra - - - static_instance-ucs-118 - sindh - karachi - new_karachi - abu_zar_ghaffari - - - static_instance-ucs-119 - sindh - karachi - new_karachi - hakim_ahsan - - - static_instance-ucs-120 - sindh - karachi - new_karachi - madina_colony - - - static_instance-ucs-121 - sindh - karachi - new_karachi - faisal_colony - - - static_instance-ucs-122 - sindh - karachi - new_karachi - khamiso_goth - - - static_instance-ucs-123 - sindh - karachi - new_karachi - mustufa_colony - - - static_instance-ucs-124 - sindh - karachi - new_karachi - khawaja_ajmeer_nagri - - - static_instance-ucs-125 - sindh - karachi - new_karachi - gulshan_e_saeed - - - static_instance-ucs-126 - sindh - karachi - new_karachi - shah_nawaz_bhutto_colony - - - static_instance-ucs-127 - sindh - karachi - north_nazimabad - paposh_nagar - - - static_instance-ucs-128 - sindh - karachi - north_nazimabad - pahar_ganj - - - static_instance-ucs-129 - sindh - karachi - north_nazimabad - khandu_goth - - - static_instance-ucs-130 - sindh - karachi - north_nazimabad - hyderi - - - static_instance-ucs-131 - sindh - karachi - north_nazimabad - sakhi_hassan - - - static_instance-ucs-132 - sindh - karachi - north_nazimabad - farooq_e_azam - - - static_instance-ucs-133 - sindh - karachi - north_nazimabad - nusrat_bhutto_colony - - - static_instance-ucs-134 - sindh - karachi - north_nazimabad - shadman_town - - - static_instance-ucs-135 - sindh - karachi - north_nazimabad - buffer_zone - - - static_instance-ucs-136 - sindh - karachi - north_nazimabad - buffer_zone_ii - - - static_instance-ucs-137 - sindh - karachi - orangi - mominabad - - - static_instance-ucs-138 - sindh - karachi - orangi - haryana_colony - - - static_instance-ucs-139 - sindh - karachi - orangi - hanifabad - - - static_instance-ucs-140 - sindh - karachi - orangi - mohammad_nagar - - - static_instance-ucs-141 - sindh - karachi - orangi - madina_colony_orangi - - - static_instance-ucs-142 - sindh - karachi - orangi - ghaziabad - - - static_instance-ucs-143 - sindh - karachi - orangi - chisti_nagar - - - static_instance-ucs-144 - sindh - karachi - orangi - bilal_colony_orangi - - - static_instance-ucs-145 - sindh - karachi - orangi - iqbal_baloch_colony - - - static_instance-ucs-146 - sindh - karachi - orangi - ghabool_town - - - static_instance-ucs-147 - sindh - karachi - orangi - data_nagar - - - static_instance-ucs-148 - sindh - karachi - orangi - mujahidabad - - - static_instance-ucs-149 - sindh - karachi - orangi - baloch_goth - - - static_instance-ucs-150 - sindh - karachi - saddar - old_haji_camp - - - static_instance-ucs-151 - sindh - karachi - saddar - garden - - - static_instance-ucs-152 - sindh - karachi - saddar - kharadar - - - static_instance-ucs-153 - sindh - karachi - saddar - city_railway_colony - - - static_instance-ucs-154 - sindh - karachi - saddar - nanak_wara - - - static_instance-ucs-155 - sindh - karachi - saddar - gazdarabad - - - static_instance-ucs-156 - sindh - karachi - saddar - millat_nagar_islam_pura - - - static_instance-ucs-157 - sindh - karachi - saddar - saddar_uc - - - static_instance-ucs-158 - sindh - karachi - saddar - civil_line - - - static_instance-ucs-159 - sindh - karachi - saddar - clifton - - - static_instance-ucs-160 - sindh - karachi - saddar - kehkashan - - - static_instance-ucs-161 - sindh - karachi - shah_faisal - natha_khan_goth - - - static_instance-ucs-162 - sindh - karachi - shah_faisal - pak_sadat_colony - - - static_instance-ucs-163 - sindh - karachi - shah_faisal - drigh_colony - - - static_instance-ucs-164 - sindh - karachi - shah_faisal - raita_plot - - - static_instance-ucs-165 - sindh - karachi - shah_faisal - moria_khan_goth - - - static_instance-ucs-166 - sindh - karachi - shah_faisal - rafa_e_aam_society - - - static_instance-ucs-167 - sindh - karachi - shah_faisal - al_falah_society - - - static_instance-ucs-168 - sindh - karachi - site - pak_colony - - - static_instance-ucs-169 - sindh - karachi - site - old_golimar - - - static_instance-ucs-170 - sindh - karachi - site - jahanabad - - - static_instance-ucs-171 - sindh - karachi - site - metrovil - - - static_instance-ucs-172 - sindh - karachi - site - bhawani_chali - - - static_instance-ucs-173 - sindh - karachi - site - frontier_colony - - - static_instance-ucs-174 - sindh - karachi - site - banaras_colony - - - static_instance-ucs-175 - sindh - karachi - site - qasba_colony - - - static_instance-ucs-176 - sindh - karachi - site - islamia_colony - - - static_instance-ucs-177 - na - na - na - other - - - static_instance-ucs-178 - na - na - na - not_applicable - - - - - - - static_instance-gender-0 - male - - - static_instance-gender-1 - female - - - static_instance-gender-2 - transgender - - - - - - - static_instance-vaccines-0 - TT1 - - - static_instance-vaccines-1 - TT2 - - - static_instance-vaccines-2 - TT3 - - - static_instance-vaccines-3 - TT4 - - - static_instance-vaccines-4 - TT5 - - - - - - - static_instance-towns-0 - sindh - karachi - korangi - - - static_instance-towns-1 - sindh - karachi - landhi - - - static_instance-towns-2 - sindh - karachi - baldia - - - static_instance-towns-3 - sindh - karachi - bin_qasim - - - static_instance-towns-4 - sindh - karachi - gadap - - - static_instance-towns-5 - sindh - karachi - gulberg - - - static_instance-towns-6 - sindh - karachi - gulshan - - - static_instance-towns-7 - sindh - karachi - jamshed - - - static_instance-towns-8 - sindh - karachi - kiamari - - - static_instance-towns-9 - sindh - karachi - liaquatabad - - - static_instance-towns-10 - sindh - karachi - lyari - - - static_instance-towns-11 - sindh - karachi - malir - - - static_instance-towns-12 - sindh - karachi - new_karachi - - - static_instance-towns-13 - sindh - karachi - north_nazimabad - - - static_instance-towns-14 - sindh - karachi - orangi - - - static_instance-towns-15 - sindh - karachi - saddar - - - static_instance-towns-16 - sindh - karachi - shah_faisal - - - static_instance-towns-17 - sindh - karachi - site - - - static_instance-towns-18 - na - na - other - - - static_instance-towns-19 - na - na - not_applicable - - - - - - - static_instance-cities-0 - sindh - karachi - - - static_instance-cities-1 - punjab - hafizabad - - - static_instance-cities-2 - punjab - muzaffargarh - - - static_instance-cities-3 - na - other - - - static_instance-cities-4 - na - not_applicable - - - - - - - static_instance-edd_lmp-0 - edd - - - static_instance-edd_lmp-1 - lmp - - - static_instance-edd_lmp-2 - ultrasound - - - static_instance-edd_lmp-3 - none - - - - - - - static_instance-yes_no-0 - yes - - - static_instance-yes_no-1 - no - - - - diff --git a/opensrp-core/src/test/resources/report-definition.json b/opensrp-core/src/test/resources/report-definition.json deleted file mode 100644 index adb4932b8a..0000000000 --- a/opensrp-core/src/test/resources/report-definition.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "formIndicators": [ - { - "form": "child_close", - "indicators": [ - { - "indicator": "INFANT_LEFT", - "formFields": [ - "id", - "closeReason", - "submissionDate" - ], - "referenceData": { - "type": "child", - "idField": "id", - "fields": [ - "dateOfBirth" - ] - }, - "reportWhen": [ - "IsChildLessThanOneYearOldRule", - "RelocationIsPermanentRule" - ], - "bindType": "child" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/report-fields-definition.json b/opensrp-core/src/test/resources/report-fields-definition.json deleted file mode 100644 index 1de01ae204..0000000000 --- a/opensrp-core/src/test/resources/report-fields-definition.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "form1": [ - "field1", - "field2" - ], - "form2": [ - "field3", - "field4" - ] -} diff --git a/opensrp-core/src/test/resources/sampleXLS/emptyXLS.xls b/opensrp-core/src/test/resources/sampleXLS/emptyXLS.xls deleted file mode 100644 index a0c2798b79..0000000000 Binary files a/opensrp-core/src/test/resources/sampleXLS/emptyXLS.xls and /dev/null differ diff --git a/opensrp-core/src/test/resources/sampleXLS/invalidXLS.xls b/opensrp-core/src/test/resources/sampleXLS/invalidXLS.xls deleted file mode 100644 index 0543216180..0000000000 Binary files a/opensrp-core/src/test/resources/sampleXLS/invalidXLS.xls and /dev/null differ diff --git a/opensrp-core/src/test/resources/sampleXLS/validXLS.xls b/opensrp-core/src/test/resources/sampleXLS/validXLS.xls deleted file mode 100644 index 3fe68201c4..0000000000 Binary files a/opensrp-core/src/test/resources/sampleXLS/validXLS.xls and /dev/null differ diff --git a/opensrp-core/src/test/resources/schedules/child-bcg.json b/opensrp-core/src/test/resources/schedules/child-bcg.json deleted file mode 100644 index fbab1eefbc..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-bcg.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "BCG", - "absolute": true, - "milestones": [ - { - "name": "bcg", - "scheduleWindows": { - "earliest": ["1 Days"], - "due": ["28 Days"], - "late": ["11 Months"], - "max": ["1 Year"] - }, - "alerts": [ - { - "window": "due", - "offset": ["0 Days"], - "interval": ["1 Day"], - "count": "28" - }, - { - "window": "late", - "offset": ["29 Days"], - "interval": ["1 Day"], - "count": "350" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-boosters.json b/opensrp-core/src/test/resources/schedules/child-boosters.json deleted file mode 100644 index 546d4229eb..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-boosters.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "Boosters", - "absolute": false, - "milestones": [ - { - "name": "REMINDER", - "scheduleWindows": { - "earliest": ["72 Weeks"], - "due": ["73 Weeks"], - "late": [""], - "max": [""] - }, - "alerts": [ - { - "window": "due", - "offset": ["0 Days"], - "interval": ["1 Week"], - "count": "1" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-dpt-booster1.json b/opensrp-core/src/test/resources/schedules/child-dpt-booster1.json deleted file mode 100644 index ac3930beb1..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-dpt-booster1.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "DPT Booster 1", - "absolute": true, - "milestones": [ - { - "name": "dptbooster_1", - "scheduleWindows": { - "earliest": ["16 Months"], - "due": ["24 Months"], - "late": ["5 Years"], - "max": [""] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Days"], - "interval": ["1 Day"], - "count": "486" - }, - { - "window": "due", - "offset": ["16 Months"], - "interval": ["1 Day"], - "count": "243" - }, - { - "window": "late", - "offset": ["24 Months"], - "interval": ["1 Day"], - "count": "1095" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-dpt-booster2.json b/opensrp-core/src/test/resources/schedules/child-dpt-booster2.json deleted file mode 100644 index 74f1a83bae..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-dpt-booster2.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "DPT Booster 2", - "absolute": true, - "milestones": [ - { - "name": "dptbooster_2", - "scheduleWindows": { - "earliest": ["5 Years"], - "due": ["7 Years"], - "max": ["7 Years"] - }, - "alerts": [ - { - "window": "due", - "offset": ["5 Years"], - "interval": ["1 Day"], - "count": "730" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-measles-booster.json b/opensrp-core/src/test/resources/schedules/child-measles-booster.json deleted file mode 100644 index 53adf9df55..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-measles-booster.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "Measles Booster", - "absolute": true, - "milestones": [ - { - "name": "measlesbooster", - "scheduleWindows": { - "earliest": ["16 Months"], - "due": ["24 Months"], - "late": ["5 Years"], - "max": ["5 Years"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Days"], - "interval": ["1 Day"], - "count": "486" - }, - { - "window": "due", - "offset": ["16 Months"], - "interval": ["1 Day"], - "count": "243" - }, - { - "window": "late", - "offset": ["24 Months"], - "interval": ["1 Day"], - "count": "1095" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-measles.json b/opensrp-core/src/test/resources/schedules/child-measles.json deleted file mode 100644 index ddff3deb83..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-measles.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "Measles Vaccination", - "absolute": true, - "milestones": [ - { - "name": "measles", - "scheduleWindows": { - "earliest": ["9 Months"], - "due": ["12 Months"], - "late": ["5 Years"], - "max": ["5 Years"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Days"], - "interval": ["1 Day"], - "count": "273" - }, - { - "window": "due", - "offset": ["9 Months"], - "interval": ["1 Day"], - "count": "91" - }, - { - "window": "late", - "offset": ["12 Months"], - "interval": ["1 Day"], - "count": "1460" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-measles1.json b/opensrp-core/src/test/resources/schedules/child-measles1.json deleted file mode 100644 index 7539a2d05f..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-measles1.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "Measles 1", - "absolute": true, - "milestones": [ - { - "name": "measles1", - "scheduleWindows": { - "earliest": ["8 Months"], - "due": ["9 Months"], - "late": ["12 Months"], - "max": ["5 Years"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["8 Months"], - "interval": ["1 Day"], - "count": "30" - }, - { - "window": "due", - "offset": ["9 Months"], - "interval": ["1 Day"], - "count": "91" - }, - { - "window": "late", - "offset": ["12 Months"], - "interval": ["1 Day"], - "count": "1460" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-measles2.json b/opensrp-core/src/test/resources/schedules/child-measles2.json deleted file mode 100644 index d867d1c9a8..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-measles2.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "Measles 2", - "absolute": true, - "milestones": [ - { - "name": "measles2", - "scheduleWindows": { - "earliest": ["14 Months"], - "due": ["15 Months"], - "late": ["16 Months"], - "max": ["5 Years"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["14 Months"], - "interval": ["1 Day"], - "count": "486" - }, - { - "window": "due", - "offset": ["15 Months"], - "interval": ["1 Day"], - "count": "243" - }, - { - "window": "late", - "offset": ["16 Months"], - "interval": ["1 Day"], - "count": "1095" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-opv-booster.json b/opensrp-core/src/test/resources/schedules/child-opv-booster.json deleted file mode 100644 index 1c4e122505..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-opv-booster.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "OPV BOOSTER", - "absolute": true, - "milestones": [ - { - "name": "opvbooster", - "scheduleWindows": { - "earliest": ["16 Months"], - "due": ["24 Months"], - "late": ["5 Years"], - "max": ["5 Years"] - }, - "alerts": [ - { - "window": "due", - "offset": ["16 Months"], - "interval": ["1 Day"], - "count": "243" - }, - { - "window": "late", - "offset": ["24 Months"], - "interval": ["1 Day"], - "count": "1095" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-opv0.json b/opensrp-core/src/test/resources/schedules/child-opv0.json deleted file mode 100644 index 298046b58c..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-opv0.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "OPV 0", - "absolute": true, - "milestones": [ - { - "name": "opv0", - "scheduleWindows": { - "earliest": ["0 Days"], - "due": ["7 Days"], - "late": ["15 Days"], - "max": ["16 Days"] - }, - "alerts": [ - { - "window": "due", - "offset": ["0 Days"], - "interval": ["1 Day"], - "count": "7" - }, - { - "window": "late", - "offset": ["7 Days"], - "interval": ["1 Day"], - "count": "15" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-opv1.json b/opensrp-core/src/test/resources/schedules/child-opv1.json deleted file mode 100644 index 10dee713c1..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-opv1.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "OPV 1", - "absolute": true, - "milestones": [ - { - "name": "opv1", - "scheduleWindows": { - "earliest": ["6 Weeks"], - "due": ["8 Weeks"], - "late": ["40 Weeks"], - "max": ["350 Days"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["4 Weeks"], - "interval": ["1 Day"], - "count": "15" - }, - { - "window": "due", - "offset": ["6 Weeks"], - "interval": ["1 Day"], - "count": "28" - }, - { - "window": "late", - "offset": ["8 Weeks"], - "interval": ["1 Day"], - "count": "350" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-opv2.json b/opensrp-core/src/test/resources/schedules/child-opv2.json deleted file mode 100644 index 6204846072..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-opv2.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "OPV 2", - "absolute": true, - "milestones": [ - { - "name": "opv2", - "scheduleWindows": { - "earliest": ["4 Weeks"], - "due": ["6 Weeks"], - "late": ["20 Weeks"], - "max": ["5 Years"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["2 Weeks"], - "interval": ["1 Day"], - "count": "15" - }, - { - "window": "due", - "offset": ["4 Weeks"], - "interval": ["1 Day"], - "count": "15" - }, - { - "window": "late", - "offset": ["6 Weeks"], - "interval": ["1 Day"], - "count": "1778" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-opv3.json b/opensrp-core/src/test/resources/schedules/child-opv3.json deleted file mode 100644 index 72aa630525..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-opv3.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "OPV 3", - "absolute": true, - "milestones": [ - { - "name": "opv3", - "scheduleWindows": { - "earliest": ["4 Weeks"], - "due": ["6 Weeks"], - "late": ["20 Weeks"], - "max": ["5 Years"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["2 Weeks"], - "interval": ["1 Day"], - "count": "15" - }, - { - "window": "due", - "offset": ["4 Weeks"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "late", - "offset": ["6 Weeks"], - "interval": ["1 Day"], - "count": "1778" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-pentavalent-1.json b/opensrp-core/src/test/resources/schedules/child-pentavalent-1.json deleted file mode 100644 index 50085c2d5e..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-pentavalent-1.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "PENTAVALENT 1", - "absolute": true, - "milestones": [ - { - "name": "pentavalent_1", - "scheduleWindows": { - "earliest": ["6 Weeks"], - "due": ["8 Weeks"], - "late": ["12 Months"], - "max": ["12 Months"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Days"], - "interval": ["1 Day"], - "count": "42" - }, - { - "window": "due", - "offset": ["6 Weeks"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "late", - "offset": ["8 Weeks"], - "interval": ["1 Day"], - "count": "308" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-pentavalent-2.json b/opensrp-core/src/test/resources/schedules/child-pentavalent-2.json deleted file mode 100644 index 9bdc10d86e..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-pentavalent-2.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "PENTAVALENT 2", - "absolute": true, - "milestones": [ - { - "name": "pentavalent_2", - "scheduleWindows": { - "earliest": ["4 Weeks"], - "due": ["6 Weeks"], - "late": ["12 Months"], - "max": ["12 Months"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Days"], - "interval": ["1 Day"], - "count": "28" - }, - { - "window": "due", - "offset": ["4 Weeks"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "late", - "offset": ["6 Weeks"], - "interval": ["1 Day"], - "count": "322" - } - ] - } - ] -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/schedules/child-pentavalent-3.json b/opensrp-core/src/test/resources/schedules/child-pentavalent-3.json deleted file mode 100644 index 9ffe531b92..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-pentavalent-3.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "PENTAVALENT 3", - "absolute": true, - "milestones": [ - { - "name": "pentavalent_3", - "scheduleWindows": { - "earliest": ["4 Weeks"], - "due": ["6 Weeks"], - "late": ["12 Months"], - "max": ["12 Months"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Days"], - "interval": ["1 Day"], - "count": "28" - }, - { - "window": "due", - "offset": ["4 Weeks"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "late", - "offset": ["6 Weeks"], - "interval": ["1 Day"], - "count": "322" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-pentavalent1.json b/opensrp-core/src/test/resources/schedules/child-pentavalent1.json deleted file mode 100644 index 13973c148b..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-pentavalent1.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "PENTAVALENT 1", - "absolute": true, - "milestones": [ - { - "name": "penta1", - "scheduleWindows": { - "earliest": ["6 Weeks"], - "due": ["10 Weeks"], - "late": ["12 Weeks"], - "max": ["12 Months"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["4 Weeks"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "due", - "offset": ["6 Weeks"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "late", - "offset": ["12 Weeks"], - "interval": ["1 Day"], - "count": "350" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/child-pentavalent2.json b/opensrp-core/src/test/resources/schedules/child-pentavalent2.json deleted file mode 100644 index 7b250e99ee..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-pentavalent2.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "PENTAVALENT 2", - "absolute": true, - "milestones": [ - { - "name": "penta2", - "scheduleWindows": { - "earliest": ["4 Weeks"], - "due": ["6 Weeks"], - "late": ["12 Weeks"], - "max": ["12 Months"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["2 Weeks"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "due", - "offset": ["4 Weeks"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "late", - "offset": ["6 Weeks"], - "interval": ["1 Day"], - "count": "322" - } - ] - } - ] -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/schedules/child-pentavalent3.json b/opensrp-core/src/test/resources/schedules/child-pentavalent3.json deleted file mode 100644 index 2dd945a704..0000000000 --- a/opensrp-core/src/test/resources/schedules/child-pentavalent3.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "PENTAVALENT 3", - "absolute": true, - "milestones": [ - { - "name": "penta3", - "scheduleWindows": { - "earliest": ["4 Weeks"], - "due": ["6 Weeks"], - "late": ["12 Weeks"], - "max": ["12 Months"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["2 Weeks"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "due", - "offset": ["4 Weeks"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "late", - "offset": ["6 Weeks"], - "interval": ["1 Day"], - "count": "322" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/delivery-plan.json b/opensrp-core/src/test/resources/schedules/delivery-plan.json deleted file mode 100644 index a265d65154..0000000000 --- a/opensrp-core/src/test/resources/schedules/delivery-plan.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "Delivery Plan", - "absolute": true, - "milestones": [ - { - "name": "Delivery Plan", - "scheduleWindows": { - "earliest": ["34 Weeks"], - "due": ["36 Weeks"], - "late": ["300 Days"], - "max": ["5 Years"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Days"], - "interval": ["1 Day"], - "count": "238" - }, - { - "window": "due", - "offset": ["34 Weeks"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "late", - "offset": ["36 Weeks"], - "interval": ["1 Day"], - "count": "48" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/ec-condom-refill.json b/opensrp-core/src/test/resources/schedules/ec-condom-refill.json deleted file mode 100644 index cce9f98933..0000000000 --- a/opensrp-core/src/test/resources/schedules/ec-condom-refill.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "Condom Refill", - "absolute": true, - "milestones": [ - { - "name": "Condom Refill", - "scheduleWindows": { - "earliest": ["0 Weeks"], - "due": ["1 Weeks"], - "late": ["1 Year"], - "max": ["1 Year", "1 Day"] - }, - "alerts": [ - { - "window": "due", - "offset": ["0 Weeks"], - "interval": ["1 Day"], - "count": "7" - }, - { - "window": "late", - "offset": ["1 Weeks"], - "interval": ["1 Day"], - "count": "358" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/ec-dmpa-injectable-refill.json b/opensrp-core/src/test/resources/schedules/ec-dmpa-injectable-refill.json deleted file mode 100644 index d83b18ce80..0000000000 --- a/opensrp-core/src/test/resources/schedules/ec-dmpa-injectable-refill.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "DMPA Injectable Refill", - "absolute": true, - "milestones": [ - { - "name": "DMPA Injectable Refill", - "scheduleWindows": { - "earliest": ["12 Weeks"], - "due": ["13 Weeks"], - "late": ["1 Year"], - "max": ["1 Year", "1 Day"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Weeks"], - "interval": ["1 Day"], - "count": "84" - }, - { - "window": "due", - "offset": ["12 Weeks"], - "interval": ["1 Day"], - "count": "7" - }, - { - "window": "late", - "offset": ["13 Weeks"], - "interval": ["1 Day"], - "count": "274" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/ec-female-sterilization-followup.json b/opensrp-core/src/test/resources/schedules/ec-female-sterilization-followup.json deleted file mode 100644 index 2fe8f4c6db..0000000000 --- a/opensrp-core/src/test/resources/schedules/ec-female-sterilization-followup.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "Female sterilization Followup", - "absolute": true, - "milestones": [ - { - "name": "Female sterilization Followup 1", - "scheduleWindows": { - "earliest": ["0 Weeks"], - "due": ["2 Days"], - "late": ["7 Days"], - "max": ["7 Days"] - }, - "alerts": [ - { - "window": "due", - "offset": ["0 Days"], - "interval": ["1 Day"], - "count": "2" - }, - { - "window": "late", - "offset": ["2 Days"], - "interval": ["1 Day"], - "count": "5" - } - ] - }, - { - "name": "Female sterilization Followup 2", - "scheduleWindows": { - "earliest": ["0 Weeks"], - "due": ["9 Days"], - "late": ["1 Month"], - "max": ["1 Month"] - }, - "alerts": [ - { - "window": "due", - "offset": ["7 Days"], - "interval": ["1 Day"], - "count": "2" - }, - { - "window": "late", - "offset": ["9 Days"], - "interval": ["1 Day"], - "count": "22" - } - ] - }, - { - "name": "Female sterilization Followup 3", - "scheduleWindows": { - "earliest": ["0 Weeks"], - "due": ["1 Month", "1 Week"], - "late": ["100 Weeks"], - "max": ["100 Weeks", "1 Day"] - }, - "alerts": [ - { - "window": "due", - "offset": ["1 Month"], - "interval": ["1 Day"], - "count": "7" - }, - { - "window": "late", - "offset": ["1 Month", "1 Week"], - "interval": ["1 Day"], - "count": "665" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/ec-fp-followup.json b/opensrp-core/src/test/resources/schedules/ec-fp-followup.json deleted file mode 100644 index 092db43076..0000000000 --- a/opensrp-core/src/test/resources/schedules/ec-fp-followup.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "FP Followup", - "absolute": true, - "milestones": [ - { - "name": "FP Followup", - "scheduleWindows": { - "earliest": ["3 Days"], - "due": ["7 Days"], - "late": ["100 Weeks"], - "max": ["100 Weeks", "1 Day"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Days"], - "interval": ["1 Day"], - "count": "3" - }, - { - "window": "due", - "offset": ["3 Days"], - "interval": ["1 Day"], - "count": "4" - }, - { - "window": "late", - "offset": ["7 Days"], - "interval": ["1 Day"], - "count": "693" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/ec-fp-referral-followup.json b/opensrp-core/src/test/resources/schedules/ec-fp-referral-followup.json deleted file mode 100644 index 3c36c7dc9c..0000000000 --- a/opensrp-core/src/test/resources/schedules/ec-fp-referral-followup.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "FP Referral Followup", - "absolute": true, - "milestones": [ - { - "name": "FP Referral Followup", - "scheduleWindows": { - "earliest": ["1 Day"], - "due": ["2 Days"], - "late": ["100 Weeks"], - "max": ["100 Weeks", "1 Day"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Days"], - "interval": ["1 Day"], - "count": "1" - }, - { - "window": "due", - "offset": ["1 Day"], - "interval": ["1 Day"], - "count": "1" - }, - { - "window": "late", - "offset": ["2 Days"], - "interval": ["1 Day"], - "count": "698" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/ec-iud-followup.json b/opensrp-core/src/test/resources/schedules/ec-iud-followup.json deleted file mode 100644 index 5e39cdaf8c..0000000000 --- a/opensrp-core/src/test/resources/schedules/ec-iud-followup.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "IUD Followup", - "absolute": true, - "milestones": [ - { - "name": "IUD Followup 1", - "scheduleWindows": { - "earliest": ["1 Month"], - "due": ["1 Month", "1 Week"], - "late": ["4 Months"], - "max": ["4 Months"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Days"], - "interval": ["1 Day"], - "count": "30" - }, - { - "window": "due", - "offset": ["1 Month"], - "interval": ["1 Day"], - "count": "7" - }, - { - "window": "late", - "offset": ["1 Month", "1 Week"], - "interval": ["1 Day"], - "count": "84" - } - ] - }, - { - "name": "IUD Followup 2", - "scheduleWindows": { - "earliest": ["0 Weeks"], - "due": ["4 Months", "1 Week"], - "late": ["100 Weeks"], - "max": ["100 Weeks", "1 Day"] - }, - "alerts": [ - { - "window": "due", - "offset": ["4 Months"], - "interval": ["1 Day"], - "count": "7" - }, - { - "window": "late", - "offset": ["4 Months", "1 Week"], - "interval": ["1 Day"], - "count": "572" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/ec-male-sterilization-followup.json b/opensrp-core/src/test/resources/schedules/ec-male-sterilization-followup.json deleted file mode 100644 index 72d095e489..0000000000 --- a/opensrp-core/src/test/resources/schedules/ec-male-sterilization-followup.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "Male sterilization Followup", - "absolute": true, - "milestones": [ - { - "name": "Male sterilization Followup 1", - "scheduleWindows": { - "earliest": ["0 Weeks"], - "due": ["2 Days"], - "late": ["3 Months"], - "max": ["3 Months"] - }, - "alerts": [ - { - "window": "due", - "offset": ["0 Days"], - "interval": ["1 Day"], - "count": "2" - }, - { - "window": "late", - "offset": ["2 Days"], - "interval": ["1 Day"], - "count": "89" - } - ] - }, - { - "name": "Male sterilization Followup 2", - "scheduleWindows": { - "earliest": ["0 Weeks"], - "due": ["3 Months", "1 Week"], - "late": ["100 Weeks"], - "max": ["100 Weeks", "1 Day"] - }, - "alerts": [ - { - "window": "due", - "offset": ["3 Months"], - "interval": ["1 Day"], - "count": "7" - }, - { - "window": "late", - "offset": ["3 Months", "1 Week"], - "interval": ["1 Day"], - "count": "602" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/ec-ocp-refill.json b/opensrp-core/src/test/resources/schedules/ec-ocp-refill.json deleted file mode 100644 index e5b0c4556b..0000000000 --- a/opensrp-core/src/test/resources/schedules/ec-ocp-refill.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "OCP Refill", - "absolute": true, - "milestones": [ - { - "name": "OCP Refill", - "scheduleWindows": { - "earliest": ["0 Weeks"], - "due": ["1 Week"], - "late": ["1 Year"], - "max": ["1 Year", "1 Day"] - }, - "alerts": [ - { - "window": "due", - "offset": ["0 Week"], - "interval": ["1 Day"], - "count": "7" - }, - { - "window": "late", - "offset": ["1 Weeks"], - "interval": ["1 Day"], - "count": "358" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/fw-census.json b/opensrp-core/src/test/resources/schedules/fw-census.json deleted file mode 100644 index 2e1c935ae9..0000000000 --- a/opensrp-core/src/test/resources/schedules/fw-census.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "FW CENSUS", - "absolute": true, - "milestones": [ - { - "name": "FW CENSUS", - "scheduleWindows": { - "earliest": ["1 Day"], - "due": ["2 Days"], - "late": ["4 Days"], - "max": ["8 Days"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Days"], - "interval": ["1 Day"], - "count": "1" - }, - { - "window": "due", - "offset": ["1 Day"], - "interval": ["1 Day"], - "count": "1" - }, - { - "window": "late", - "offset": ["2 Days"], - "interval": ["1 Day"], - "count": "2" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/mother-anc-normal.json b/opensrp-core/src/test/resources/schedules/mother-anc-normal.json deleted file mode 100644 index 7032989b45..0000000000 --- a/opensrp-core/src/test/resources/schedules/mother-anc-normal.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "name": "Ante Natal Care - Normal", - "absolute": true, - "milestones": [ - { - "name": "ANC 1", - "scheduleWindows": { - "earliest": ["0 Weeks"], - "due": ["12 Weeks"], - "late": ["14 Weeks"], - "max": ["14 weeks"] - }, - "alerts": [ - { - "window": "due", - "offset": ["0 Weeks"], - "interval": ["1 Day"], - "count": "84" - }, - { - "window": "late", - "offset": ["12 Weeks"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "max", - "offset": ["14 Weeks"], - "interval": ["1 Day"], - "count": "2" - } - ] - }, - { - "name": "ANC 2", - "scheduleWindows": { - "earliest": ["14 Weeks"], - "due": ["26 Weeks"], - "late": ["28 Weeks"], - "max": ["28 Weeks"] - }, - "alerts": [ - { - "window": "due", - "offset": ["14 Weeks"], - "interval": ["1 Day"], - "count": "84" - }, - { - "window": "late", - "offset": ["26 Weeks"], - "interval": ["1 Day"], - "count": "14" - } - ] - }, - { - "name": "ANC 3", - "scheduleWindows": { - "earliest": ["28 Weeks"], - "due": ["34 Weeks"], - "late": ["36 Weeks"], - "max": ["36 Weeks"] - }, - "alerts": [ - { - "window": "due", - "offset": ["28 Weeks"], - "interval": ["1 Day"], - "count": "42" - }, - { - "window": "late", - "offset": ["34 Weeks"], - "interval": ["1 Day"], - "count": "14" - } - ] - }, - { - "name": "ANC 4", - "scheduleWindows": { - "earliest": ["36 Weeks"], - "due": ["39 Weeks"], - "late": ["100 Weeks"], - "max": ["100 Weeks", "1 Day"] - }, - "alerts": [ - { - "window": "due", - "offset": ["36 Weeks"], - "interval": ["1 Day"], - "count": "21" - }, - { - "window": "late", - "offset": ["39 Weeks"], - "interval": ["1 Day"], - "count": "427" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/mother-auto-close-pnc.json b/opensrp-core/src/test/resources/schedules/mother-auto-close-pnc.json deleted file mode 100644 index e73b24f8ba..0000000000 --- a/opensrp-core/src/test/resources/schedules/mother-auto-close-pnc.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "Auto Close PNC", - "absolute": false, - "milestones": [ - { - "name": "Auto Close PNC", - "scheduleWindows": { - "due": ["8 Weeks", "4 Day"] - }, - "alerts": [ - { - "window": "due", - "offset": ["8 Weeks"], - "interval": ["1 Day"], - "count": "4" - } - ] - } - ] -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/schedules/mother-expected-date-of-delivery.json b/opensrp-core/src/test/resources/schedules/mother-expected-date-of-delivery.json deleted file mode 100644 index adf0921335..0000000000 --- a/opensrp-core/src/test/resources/schedules/mother-expected-date-of-delivery.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "Expected Date Of Delivery", - "absolute": false, - "milestones": [ - { - "name": "EDD", - "scheduleWindows": { - "earliest": ["38 Weeks"], - "due": ["40 Weeks", "1 Day"], - "late": ["100 Weeks"], - "max": ["100 Weeks", "1 Day"] - }, - "alerts": [ - { - "window": "due", - "offset": ["0 Days"], - "interval": ["1 Weeks"], - "count": "3" - }, - { - "window": "late", - "offset": ["2 Days"], - "interval": ["1 Weeks"], - "count": "100" - }, - { - "window": "late", - "offset": ["6 Days"], - "interval": ["1 Weeks"], - "count": "100" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/mother-hb-followup-test.json b/opensrp-core/src/test/resources/schedules/mother-hb-followup-test.json deleted file mode 100644 index cceeeeb496..0000000000 --- a/opensrp-core/src/test/resources/schedules/mother-hb-followup-test.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "Hb Followup Test", - "absolute": true, - "milestones": [ - { - "name": "Hb Followup Test", - "scheduleWindows": { - "earliest": ["1 Month"], - "due": ["1 Month", "2 Weeks"], - "late": ["100 Weeks"], - "max": ["100 Weeks", "1 Day"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Weeks"], - "interval": ["1 Day"], - "count": "30" - }, - { - "window": "due", - "offset": ["1 Month"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "late", - "offset": ["1 Month", "2 Weeks"], - "interval": ["1 Day"], - "count": "655" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/mother-hb-test-1.json b/opensrp-core/src/test/resources/schedules/mother-hb-test-1.json deleted file mode 100644 index 97f7b54267..0000000000 --- a/opensrp-core/src/test/resources/schedules/mother-hb-test-1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "Hb Test 1", - "absolute": true, - "milestones": [ - { - "name": "Hb Test 1", - "scheduleWindows": { - "earliest": ["0 Weeks"], - "due": ["12 Weeks"], - "late": ["100 Weeks"], - "max": ["100 Weeks", "1 Day"] - }, - "alerts": [ - { - "window": "due", - "offset": ["0 Weeks"], - "interval": ["1 Day"], - "count": "84" - }, - { - "window": "late", - "offset": ["12 Weeks"], - "interval": ["1 Day"], - "count": "616" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/mother-hb-test-2.json b/opensrp-core/src/test/resources/schedules/mother-hb-test-2.json deleted file mode 100644 index 70d2f18b48..0000000000 --- a/opensrp-core/src/test/resources/schedules/mother-hb-test-2.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "Hb Test 2", - "absolute": true, - "milestones": [ - { - "name": "Hb Test 2", - "scheduleWindows": { - "earliest": ["0 Weeks"], - "due": ["30 Weeks"], - "late": ["100 Weeks"], - "max": ["100 Weeks", "1 Day"] - }, - "alerts": [ - { - "window": "due", - "offset": ["28 Weeks"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "late", - "offset": ["30 Weeks"], - "interval": ["1 Day"], - "count": "490" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/mother-ifa-1.json b/opensrp-core/src/test/resources/schedules/mother-ifa-1.json deleted file mode 100644 index 027939ac58..0000000000 --- a/opensrp-core/src/test/resources/schedules/mother-ifa-1.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "IFA 1", - "absolute": true, - "milestones": [ - { - "name": "IFA 1", - "scheduleWindows": { - "earliest": ["14 Weeks"], - "due": ["16 Weeks"], - "late": ["100 Weeks"], - "max": ["100 Weeks", "1 Day"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Weeks"], - "interval": ["1 Day"], - "count": "90" - }, - { - "window": "due", - "offset": ["14 Weeks"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "late", - "offset": ["16 Weeks"], - "interval": ["1 Day"], - "count": "588" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/mother-ifa-2.json b/opensrp-core/src/test/resources/schedules/mother-ifa-2.json deleted file mode 100644 index e45e067ee8..0000000000 --- a/opensrp-core/src/test/resources/schedules/mother-ifa-2.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "IFA 2", - "absolute": true, - "milestones": [ - { - "name": "IFA 2", - "scheduleWindows": { - "earliest": ["1 Months"], - "due": ["1 Month", "2 Weeks"], - "late": ["100 Weeks"], - "max": ["100 Weeks", "1 Day"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Weeks"], - "interval": ["1 Day"], - "count": "30" - }, - { - "window": "due", - "offset": ["1 Months"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "late", - "offset": ["1 Month", "2 Weeks"], - "interval": ["1 Day"], - "count": "658" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/mother-ifa-3.json b/opensrp-core/src/test/resources/schedules/mother-ifa-3.json deleted file mode 100644 index 206ede5e19..0000000000 --- a/opensrp-core/src/test/resources/schedules/mother-ifa-3.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "IFA 3", - "absolute": true, - "milestones": [ - { - "name": "IFA 3", - "scheduleWindows": { - "earliest": ["1 Months"], - "due": ["1 Month", "2 Weeks"], - "late": ["100 Weeks"], - "max": ["100 Weeks", "1 Day"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Weeks"], - "interval": ["1 Day"], - "count": "30" - }, - { - "window": "due", - "offset": ["1 Months"], - "interval": ["1 Day"], - "count": "14" - }, - { - "window": "late", - "offset": ["1 Month", "2 Weeks"], - "interval": ["1 Day"], - "count": "658" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/mother-lab-reminder.json b/opensrp-core/src/test/resources/schedules/mother-lab-reminder.json deleted file mode 100644 index 6738572b56..0000000000 --- a/opensrp-core/src/test/resources/schedules/mother-lab-reminder.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "Lab Reminders", - "absolute": false, - "milestones": [ - { - "name": "REMINDER", - "scheduleWindows": { - "earliest": ["10 Weeks"], - "due": ["30 Weeks"], - "late": ["40 Weeks", "1 Day"], - "max": ["41 Weeks"] - }, - "alerts": [ - { - "window": "late", - "offset": ["0 Days"], - "interval": ["1 Weeks"], - "count": "11" - }, - { - "window": "max", - "offset": ["1 Day"], - "interval": ["1 Day"], - "count": "3" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/schedule-config.xls b/opensrp-core/src/test/resources/schedules/schedule-config.xls deleted file mode 100644 index 03ca142d88..0000000000 Binary files a/opensrp-core/src/test/resources/schedules/schedule-config.xls and /dev/null differ diff --git a/opensrp-core/src/test/resources/schedules/woman-tt1.json b/opensrp-core/src/test/resources/schedules/woman-tt1.json deleted file mode 100644 index 1e8a410eff..0000000000 --- a/opensrp-core/src/test/resources/schedules/woman-tt1.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "TT 1", - "absolute": true, - "milestones": [ - { - "name": "tt1", - "scheduleWindows": { - "earliest": ["0 Weeks"], - "due": ["12 Weeks"], - "late": ["1 Year"], - "max": ["1 Year"] - }, - "alerts": [ - { - "window": "due", - "offset": ["0 Weeks"], - "interval": ["1 Day"], - "count": "84" - }, - { - "window": "late", - "offset": ["12 Weeks"], - "interval": ["1 Day"], - "count": "280" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/woman-tt2.json b/opensrp-core/src/test/resources/schedules/woman-tt2.json deleted file mode 100644 index 69ccd3977e..0000000000 --- a/opensrp-core/src/test/resources/schedules/woman-tt2.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "TT 2", - "absolute": true, - "milestones": [ - { - "name": "tt2", - "scheduleWindows": { - "earliest": ["4 Weeks"], - "due": ["6 Weeks"], - "late": ["20 Weeks"], - "max": ["1 Year"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Weeks"], - "interval": ["1 Day"], - "count": "28" - }, - { - "window": "due", - "offset": ["4 Weeks"], - "interval": ["1 Day"], - "count": "50" - }, - { - "window": "late", - "offset": ["6 Weeks"], - "interval": ["1 Day"], - "count": "322" - } - ] - } - ] -} diff --git a/opensrp-core/src/test/resources/schedules/woman-tt3.json b/opensrp-core/src/test/resources/schedules/woman-tt3.json deleted file mode 100644 index 04143b042a..0000000000 --- a/opensrp-core/src/test/resources/schedules/woman-tt3.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "TT 3", - "absolute": true, - "milestones": [ - { - "name": "tt3", - "scheduleWindows": { - "earliest": ["6 Months"], - "due": ["8 Months"], - "late": ["9 Months"], - "max": ["1 Year"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Months"], - "interval": ["1 Day"], - "count": "100" - }, - { - "window": "due", - "offset": ["6 Months"], - "interval": ["1 Day"], - "count": "360" - }, - { - "window": "late", - "offset": ["8 Months"], - "interval": ["1 Day"], - "count": "360" - } - ] - } - ] -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/schedules/woman-tt4.json b/opensrp-core/src/test/resources/schedules/woman-tt4.json deleted file mode 100644 index bcb7550021..0000000000 --- a/opensrp-core/src/test/resources/schedules/woman-tt4.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "TT 4", - "absolute": true, - "milestones": [ - { - "name": "tt4", - "scheduleWindows": { - "earliest": ["12 Months"], - "due": ["14 Months"], - "late": ["20 Months"], - "max": ["30 Months"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Months"], - "interval": ["1 Day"], - "count": "40" - }, - { - "window": "due", - "offset": ["1 Year"], - "interval": ["1 Day"], - "count": "360" - }, - { - "window": "late", - "offset": ["14 Months"], - "interval": ["1 Day"], - "count": "360" - } - - ] - } - ] -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/schedules/woman-tt5.json b/opensrp-core/src/test/resources/schedules/woman-tt5.json deleted file mode 100644 index ff9cd30d48..0000000000 --- a/opensrp-core/src/test/resources/schedules/woman-tt5.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "TT 5", - "absolute": true, - "milestones": [ - { - "name": "tt5", - "scheduleWindows": { - "earliest": ["12 Months"], - "due": ["14 Months"], - "late": ["20 Months"], - "max": ["30 Months"] - }, - "alerts": [ - { - "window": "earliest", - "offset": ["0 Months"], - "interval": ["1 Day"], - "count": "50" - }, - { - "window": "due", - "offset": ["1 Year"], - "interval": ["1 Day"], - "count": "360" - }, - { - "window": "late", - "offset": ["14 Months"], - "interval": ["1 Day"], - "count": "360" - } - ] - } - ] -} \ No newline at end of file diff --git a/opensrp-core/src/test/resources/test-applicationContext-opensrp.xml b/opensrp-core/src/test/resources/test-applicationContext-opensrp.xml deleted file mode 100644 index d0e9ee7dc7..0000000000 --- a/opensrp-core/src/test/resources/test-applicationContext-opensrp.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/opensrp-core/src/test/resources/test-opensrp.properties b/opensrp-core/src/test/resources/test-opensrp.properties deleted file mode 100644 index b84f1fb96c..0000000000 --- a/opensrp-core/src/test/resources/test-opensrp.properties +++ /dev/null @@ -1,126 +0,0 @@ -sms.can.be.sent=false -number.of.audit.messages=1000 - -form.poll.time.interval=2 -mcts.phone.number=8762963816 -js.directory.name=/ziggy -form.directory.name=/form -multimedia.directory.name=/opt/multimedia -form.download.files=form.xml, model.xml, form_definition.json -qrcodes.directory.name=/home/opensrp/qr-codes/ - -schedule.config.path=/schedules/schedule-config.xls -schedule.config.json.path=/schedules/schedule-config.json -schedules.config.files.dir=/schedules/schedule-configs - -report-fields-definition-path=/report-fields-definition.json -report-definition-path=/report-definition.json -mcts-report-definition-path=/mcts-report-definition.json -mcts-report-delay-in-days=10 -mcts.poll.time.interval.in.minutes=10 - -# OpenMRS configuration -openmrs.url=http://localhost:8080/openmrs/ -openmrs.username=admin -openmrs.password=Admin123 -openmrs.idgen.url=/module/idgen/exportIdentifiers.form -openmrs.idgen.initial.batchsize=300000 -openmrs.idgen.batchsize=100 -openmrs.idgen.idsource=1 -openmrs.version=2.1.3 -#supported versions 1.11x and 2x - -dhis2.url=http://dhis2.mpower-social.com:8080/api/ -dhis2.username=path -dhis2.password=Path@123 -# make REST calls and push data while testing on the server specified above -openmrs.test.make-rest-call=false - -openmrs.scheduletracker.syncer.interval-min=2 - -#database configuration that is not likely to change unless massive refactoring are in build/maven.properties - -#couchdb properties -couchdb.server=localhost -couchdb.port=5984 -couchdb.username=rootuser -couchdb.password=adminpass - -couchdb.atomfeed-db.revision-limit=2 - -# properties for postgres db in opensrp-web and opensrp-reporting modules -jdbc.backend=MYSQL -jdbc.driverClassName=com.mysql.jdbc.Driver -jdbc.username=root -jdbc.password=VA1913wm -jdbc.url=jdbc:mysql://localhost:3306/opensrp?createDatabaseIfNotExist=true - -##jdbc url with server and port but without database -jdbc.url-wo-db=jdbc:mysql://localhost:3306 - -# Hibernate properties for Reporting DB -hibernate.dialect=org.hibernate.dialect.MySQLDialect -# hibernate.hbm2ddl.auto=update -hibernate.show_sql=true -hibernate.format_sql=false -hibernate.auto_commit=false - -hibernate.c3p0.max_size=15 -hibernate.c3p0.min_size=3 -hibernate.c3p0.timeout=60000 -hibernate.c3p0.max_statements=20 -hibernate.c3p0.idle_test_period=300 -hibernate.c3p0.acquire_increment=3 - -preferred.time=7 -aggregator.dataset.url=http://bamboo.io/datasets/55a9e822cf46480eb1f24970741ceb15 -aggregated.dataset.url=http://bamboo.io/datasets/5d0734ccf76c4153a9db750b86ca49b9 -number.of.reports.sent.in.a.batch=100 -batch.update.time.interval=5 -drishti.site.url=http://localhost:9000 -application.context=org.springframework.web.context.WebApplicationContext:/opensrp - -#RapidPro settings -rapidpro.url=https://rapidpro.ona.io -rapidpro.token=YOUR_AUTH_TOKEN -#files upload -file.maxUploadSize=20971520 - -#CORS allowed source domain -opensrp.cors.allowed.source="" -opensrp.cors.max.age=60 - -#search for missing clients -opensrp.sync.search.missing.client=false - -#duration in seconds to cache authetication time to live -opensrp.authencation.cache.ttl=600 - -#redis settings -redis.host=localhost -redis.port=6379 -redis.password=RedI$P@S5 -redis.pool.max.connections=25 - -#ouath settings -oauth.default.client.id=opensrp-trusted-client -oauth.default.grant.types=password,authorization_code,refresh_token,implicit -oauth.default.secret=O@aTHS#cr3t -oauth.default.scope=read,write,trust -oauth.default.token.validity=3600 -oauth.default.callback.url=https://yourapplication.com/registered/callback - -#Team module settings -use.opensrp.team.module=false - -# S3 configuration (should be populated for deployments using S3 multimedia storage) -aws_access_key_id= -aws_secret_access_key= -aws_region= -aws_bucket= -aws_key_folder=none - -# multimedia file manager (is file system by default) -multimedia_file_manager=FileSystemMultimediaFileManager - - diff --git a/opensrp-core/src/test/resources/test-persistence-postgres.xml b/opensrp-core/src/test/resources/test-persistence-postgres.xml deleted file mode 100644 index e63a9b6c6e..0000000000 --- a/opensrp-core/src/test/resources/test-persistence-postgres.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/opensrp-core/src/test/resources/test-scripts/action.sql b/opensrp-core/src/test/resources/test-scripts/action.sql deleted file mode 100644 index 768cd5bf89..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/action.sql +++ /dev/null @@ -1,78 +0,0 @@ ---clear data -TRUNCATE TABLE core.action CASCADE; - -ALTER SEQUENCE core.action_id_seq RESTART WITH 35; - -ALTER SEQUENCE core.action_metadata_id_seq RESTART WITH 35; - -INSERT INTO core.action (id, json) VALUES -(1, '{"_id": "05934ae338431f28bf6793b241642462", "data": {"visitCode": "OPV 0", "completionDate": "2017-02-13"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-2879a3a80caa0ab8c599b766496b8234", "timeStamp": 1520932697689, "actionType": "closeAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "67007c17-97bb-4732-a1b8-3a0c292b5432", "isActionActive": true}'), -(2, '{"_id": "05934ae338431f28bf6793b2416433c9", "data": {"visitCode": "BCG", "completionDate": "2017-02-13"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-6136b587025c608f3d4f41731eefb157", "timeStamp": 1520932698005, "actionType": "closeAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "67007c17-97bb-4732-a1b8-3a0c292b5432", "isActionActive": true}'), -(3, '{"_id": "05934ae338431f28bf6793b241643a7e", "data": {"visitCode": "PENTA 1", "completionDate": "2017-03-27"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-2f64b198e90652c816a01b59b15d10c9", "timeStamp": 1520932698821, "actionType": "closeAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "67007c17-97bb-4732-a1b8-3a0c292b5432", "isActionActive": true}'), -(4, '{"_id": "05934ae338431f28bf6793b241644dd7", "data": {"visitCode": "OPV 1", "completionDate": "2017-03-27"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-6fda14ca820ed569269b81cc28832619", "timeStamp": 1520932699621, "actionType": "closeAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "67007c17-97bb-4732-a1b8-3a0c292b5432", "isActionActive": true}'), -(5, '{"_id": "05934ae338431f28bf6793b241645535", "data": {"visitCode": "ROTA 1", "completionDate": "2017-03-27"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-f00737fd2a6354d243c161c161a886fd", "timeStamp": 1520932700149, "actionType": "closeAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "67007c17-97bb-4732-a1b8-3a0c292b5432", "isActionActive": true}'), -(6, '{"_id": "05934ae338431f28bf6793b241645f1f", "data": {"visitCode": "PCV 1", "completionDate": "2017-03-27"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-c66dfedbaf6582dc04c209c467f8a057", "timeStamp": 1520932700973, "actionType": "closeAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "67007c17-97bb-4732-a1b8-3a0c292b5432", "isActionActive": true}'), -(7, '{"_id": "05934ae338431f28bf6793b2416473e0", "data": {"visitCode": "PENTA 2", "completionDate": "2017-04-24"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-02c3a00f308e4ce385ce558cf0d944d8", "timeStamp": 1520932701845, "actionType": "closeAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "67007c17-97bb-4732-a1b8-3a0c292b5432", "isActionActive": true}'), -(8, '{"_id": "05934ae338431f28bf6793b2416481aa", "data": {"visitCode": "OPV 2", "completionDate": "2017-04-24"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-8c95d366cfe85f1b2dbfb3ca8c80fa60", "timeStamp": 1520932702653, "actionType": "closeAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "67007c17-97bb-4732-a1b8-3a0c292b5432", "isActionActive": true}'), -(9, '{"_id": "05934ae338431f28bf6793b241648e9d", "data": {"visitCode": "ROTA 2", "completionDate": "2017-04-24"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-9ad54ee7aea405a883c41203f42b7102", "timeStamp": 1520932703185, "actionType": "closeAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "67007c17-97bb-4732-a1b8-3a0c292b5432", "isActionActive": true}'), -(10, '{"_id": "05934ae338431f28bf6793b241649473", "data": {"visitCode": "PCV 2", "completionDate": "2017-04-24"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-660bbaae08f13bd1901bf0916c85d7f1", "timeStamp": 1520932703825, "actionType": "closeAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "67007c17-97bb-4732-a1b8-3a0c292b5432", "isActionActive": true}'), -(11, '{"_id": "05934ae338431f28bf6793b24164a5d7", "data": {"visitCode": "PENTA 3", "completionDate": "2017-05-22"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-6a87e5caa57732fd5c3fef5dc5a4ba71", "timeStamp": 1520932704673, "actionType": "closeAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "67007c17-97bb-4732-a1b8-3a0c292b5432", "isActionActive": true}'), -(12, '{"_id": "05934ae338431f28bf6793b24164b4ce", "data": {"visitCode": "OPV 3", "completionDate": "2017-05-22"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-9a13ae05df3839ea97d54d42150cf294", "timeStamp": 1520932705277, "actionType": "closeAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "67007c17-97bb-4732-a1b8-3a0c292b5432", "isActionActive": true}'), -(13, '{"_id": "05934ae338431f28bf6793b24164c069", "data": {"visitCode": "PCV 3", "completionDate": "2017-05-22"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-2cab2feb95c70dcaabecb6f9eed6ddf2", "timeStamp": 1520932705889, "actionType": "closeAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "67007c17-97bb-4732-a1b8-3a0c292b5432", "isActionActive": true}'), -(14, '{"_id": "05934ae338431f28bf6793b241651160", "data": {"visitCode": "MEASLES 1", "completionDate": "2017-11-14"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-8a96e017d3f3772d1fceeda32360af03", "timeStamp": 1520933247737, "actionType": "closeAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "67007c17-97bb-4732-a1b8-3a0c292b5432", "isActionActive": true}'), -(15, '{"_id": "05934ae338431f28bf6793b241663fcd", "data": {"visitCode": "BCG", "completionDate": "2016-04-13"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-14792d0f46a0883ad712b1579229e327", "timeStamp": 1520933431893, "actionType": "closeAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "86c039a2-0b68-4166-849e-f49897e3a510", "isActionActive": true}'), -(16, '{"_id": "05934ae338431f28bf6793b2417bfe8f", "data": {"startDate": "2018-02-22", "visitCode": "penta1", "expiryDate": "2022-11-01", "alertStatus": "urgent", "scheduleName": "PENTA 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-6356c0c4202703c768764a3475d7ce3b", "timeStamp": 1520978413525, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "469597f0-eefe-4171-afef-f7234cbb2859", "isActionActive": true}'), -(17, '{"_id": "05934ae338431f28bf6793b2417bf883", "data": {"startDate": "2018-02-22", "visitCode": "pcv1", "expiryDate": "2022-11-01", "alertStatus": "urgent", "scheduleName": "PCV 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-076a5315cb585348af4335f3392f3f3d", "timeStamp": 1520978413537, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "469597f0-eefe-4171-afef-f7234cbb2859", "isActionActive": true}'), -(18, '{"_id": "05934ae338431f28bf6793b2417bf3c3", "data": {"startDate": "2018-02-22", "visitCode": "rota1", "expiryDate": "2018-08-01", "alertStatus": "urgent", "scheduleName": "ROTA 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-5d69b3061e54074f4e280ed3b0b06181", "timeStamp": 1520978413541, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "469597f0-eefe-4171-afef-f7234cbb2859", "isActionActive": true}'), -(19, '{"_id": "05934ae338431f28bf6793b2417c671b", "data": {"startDate": "2018-02-22", "visitCode": "rota1", "expiryDate": "2018-08-01", "alertStatus": "urgent", "scheduleName": "ROTA 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-35d72bbd1769bd66675997ac9e79164e", "timeStamp": 1520978413737, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "aabcd2cc-c111-41c6-85e6-cb5d9e350d08", "isActionActive": true}'), -(20, '{"_id": "05934ae338431f28bf6793b2417c4bae", "data": {"startDate": "2018-01-11", "visitCode": "bcg", "expiryDate": "2019-01-01", "alertStatus": "urgent", "scheduleName": "BCG", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-232d50fcd2a7a7801633b5a0546cb753", "timeStamp": 1520978413764, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "469597f0-eefe-4171-afef-f7234cbb2859", "isActionActive": true}'), -(21, '{"_id": "05934ae338431f28bf6793b2417c4d6c", "data": {"startDate": "2018-02-22", "visitCode": "pcv1", "expiryDate": "2022-11-01", "alertStatus": "urgent", "scheduleName": "PCV 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-2871da12dbce3cb16e0746f30cbc26fa", "timeStamp": 1520978413764, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "aabcd2cc-c111-41c6-85e6-cb5d9e350d08", "isActionActive": true}'), -(22, '{"_id": "05934ae338431f28bf6793b2417c5aae", "data": {"startDate": "2018-02-22", "visitCode": "opv1", "expiryDate": "2022-11-01", "alertStatus": "urgent", "scheduleName": "OPV 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-9c72f8f01fd21ae36e84a2def4db8732", "timeStamp": 1520978413765, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "469597f0-eefe-4171-afef-f7234cbb2859", "isActionActive": true}'), -(23, '{"_id": "05934ae338431f28bf6793b2417c705e", "data": {"startDate": "2018-02-22", "visitCode": "opv1", "expiryDate": "2022-11-01", "alertStatus": "urgent", "scheduleName": "OPV 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-f72851fdbaac0f4f091054bbf60b8ed3", "timeStamp": 1520978413880, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "aabcd2cc-c111-41c6-85e6-cb5d9e350d08", "isActionActive": true}'), -(24, '{"_id": "05934ae338431f28bf6793b2417c98f9", "data": {"startDate": "2018-02-22", "visitCode": "penta1", "expiryDate": "2022-11-01", "alertStatus": "urgent", "scheduleName": "PENTA 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-fc9c73741eee67f6b71c84333ad6eb25", "timeStamp": 1520978413884, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "aabcd2cc-c111-41c6-85e6-cb5d9e350d08", "isActionActive": true}'), -(25, '{"_id": "05934ae338431f28bf6793b2417c7d94", "data": {"startDate": "2018-01-11", "visitCode": "bcg", "expiryDate": "2019-01-01", "alertStatus": "urgent", "scheduleName": "BCG", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-ea88434f62397611c8e794eedbca74e4", "timeStamp": 1520978413894, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "aabcd2cc-c111-41c6-85e6-cb5d9e350d08", "isActionActive": true}'), -(26, '{"_id": "05934ae338431f28bf6793b2417ca6cd", "data": {"startDate": "2018-02-22", "visitCode": "pcv1", "expiryDate": "2022-11-01", "alertStatus": "urgent", "scheduleName": "PCV 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-6db5f0e05e5e69aa5f33429f6cdc75a7", "timeStamp": 1520978413945, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "4a2a4ad9-cd29-47cb-bdb9-5b617a73b898", "isActionActive": true}'), -(27, '{"_id": "05934ae338431f28bf6793b2417d0103", "data": {"startDate": "2018-02-22", "visitCode": "rota1", "expiryDate": "2018-08-01", "alertStatus": "urgent", "scheduleName": "ROTA 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-a28be37e4572a5e77a92461c76d0885e", "timeStamp": 1520978414164, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "4a2a4ad9-cd29-47cb-bdb9-5b617a73b898", "isActionActive": true}'), -(28, '{"_id": "05934ae338431f28bf6793b2417d1390", "data": {"startDate": "2018-02-22", "visitCode": "opv1", "expiryDate": "2022-11-01", "alertStatus": "urgent", "scheduleName": "OPV 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-8da27b44f49e08574f5b8a7ad746a88c", "timeStamp": 1520978414184, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "4a2a4ad9-cd29-47cb-bdb9-5b617a73b898", "isActionActive": true}'), -(29, '{"_id": "05934ae338431f28bf6793b2417d0b1c", "data": {"startDate": "2018-02-22", "visitCode": "penta1", "expiryDate": "2022-11-01", "alertStatus": "urgent", "scheduleName": "PENTA 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-87165e743ef46e7bfbdfea5d9e81d049", "timeStamp": 1520978414186, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "4a2a4ad9-cd29-47cb-bdb9-5b617a73b898", "isActionActive": true}'), -(30, '{"_id": "05934ae338431f28bf6793b2417d2ec2", "data": {"startDate": "2018-02-22", "visitCode": "penta1", "expiryDate": "2022-11-01", "alertStatus": "urgent", "scheduleName": "PENTA 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-8506e63790993901b69708e013df5a8e", "timeStamp": 1520978414292, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "b06e0847-0d68-4f5c-9288-58bc394fe052", "isActionActive": true}'), -(31, '{"_id": "05934ae338431f28bf6793b2417d3aa0", "data": {"startDate": "2018-02-22", "visitCode": "rota1", "expiryDate": "2018-08-01", "alertStatus": "urgent", "scheduleName": "ROTA 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-636eec945c3c237fd8e90fe854dce081", "timeStamp": 1520978414313, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "b06e0847-0d68-4f5c-9288-58bc394fe052", "isActionActive": true}'), -(32, '{"_id": "05934ae338431f28bf6793b2417db6ca", "data": {"startDate": "2018-01-11", "visitCode": "bcg", "expiryDate": "2019-01-01", "alertStatus": "urgent", "scheduleName": "BCG", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-a8177920ff1fbef63a63f03851a343ee", "timeStamp": 1520978414508, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "b06e0847-0d68-4f5c-9288-58bc394fe052", "isActionActive": true}'), -(33, '{"_id": "05934ae338431f28bf6793b2417dba2d", "data": {"startDate": "2018-02-22", "visitCode": "opv1", "expiryDate": "2022-11-01", "alertStatus": "normal", "scheduleName": "OPV 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-51466c72f83907a175263b5750fe9b6c", "timeStamp": 1520978414513, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "b06e0847-0d68-4f5c-9288-58bc394fe052", "isActionActive": true}'), -(34, '{"_id": "05934ae338431f28bf6793b2417da475", "data": {"startDate": "2018-02-22", "visitCode": "pcv1", "expiryDate": "2022-11-01", "alertStatus": "urgent", "scheduleName": "PCV 1", "beneficiaryType": "child"}, "type": "Action", "details": {}, "version": 0, "_rev": "1-f18f7d27909a2cc3e3e27c5b4c116075", "timeStamp": 1520978414514, "actionType": "createAlert", "providerId": "biddemo", "actionTarget": "alert", "baseEntityId": "b06e0847-0d68-4f5c-9288-58bc394fe052", "isActionActive": true}'); - -INSERT INTO core.action_metadata (id, action_id, document_id, base_entity_id, server_version, provider_id, location_id, team, team_id) VALUES -(1, 1, '05934ae338431f28bf6793b241642462', '67007c17-97bb-4732-a1b8-3a0c292b5432', 1520932697689, 'biddemo', null, null, null), -(2, 2, '05934ae338431f28bf6793b2416433c9', '67007c17-97bb-4732-a1b8-3a0c292b5432', 1520932698005, 'biddemo', null, null, null), -(3, 3, '05934ae338431f28bf6793b241643a7e', '67007c17-97bb-4732-a1b8-3a0c292b5432', 1520932698821, 'biddemo', null, null, null), -(4, 4, '05934ae338431f28bf6793b241644dd7', '67007c17-97bb-4732-a1b8-3a0c292b5432', 1520932699621, 'biddemo', null, null, null), -(5, 5, '05934ae338431f28bf6793b241645535', '67007c17-97bb-4732-a1b8-3a0c292b5432', 1520932700149, 'biddemo', null, null, null), -(6, 6, '05934ae338431f28bf6793b241645f1f', '67007c17-97bb-4732-a1b8-3a0c292b5432', 1520932700973, 'biddemo', null, null, null), -(7, 7, '05934ae338431f28bf6793b2416473e0', '67007c17-97bb-4732-a1b8-3a0c292b5432', 1520932701845, 'biddemo', null, null, null), -(8, 8, '05934ae338431f28bf6793b2416481aa', '67007c17-97bb-4732-a1b8-3a0c292b5432', 1520932702653, 'biddemo', null, null, null), -(9, 9, '05934ae338431f28bf6793b241648e9d', '67007c17-97bb-4732-a1b8-3a0c292b5432', 1520932703185, 'biddemo', null, null, null), -(10, 10, '05934ae338431f28bf6793b241649473', '67007c17-97bb-4732-a1b8-3a0c292b5432', 1520932703825, 'biddemo', null, null, null), -(11, 11, '05934ae338431f28bf6793b24164a5d7', '67007c17-97bb-4732-a1b8-3a0c292b5432', 1520932704673, 'biddemo', null, null, null), -(12, 12, '05934ae338431f28bf6793b24164b4ce', '67007c17-97bb-4732-a1b8-3a0c292b5432', 1520932705277, 'biddemo', null, null, null), -(13, 13, '05934ae338431f28bf6793b24164c069', '67007c17-97bb-4732-a1b8-3a0c292b5432', 1520932705889, 'biddemo', null, null, null), -(14, 14, '05934ae338431f28bf6793b241651160', '67007c17-97bb-4732-a1b8-3a0c292b5432', 1520933247737, 'biddemo', null, null, null), -(15, 15, '05934ae338431f28bf6793b241663fcd', '86c039a2-0b68-4166-849e-f49897e3a510', 1520933431893, 'biddemo', null, null, null), -(16, 16, '05934ae338431f28bf6793b2417bfe8f', '469597f0-eefe-4171-afef-f7234cbb2859', 1520978413525, 'biddemo', null, null, null), -(17, 17, '05934ae338431f28bf6793b2417bf883', '469597f0-eefe-4171-afef-f7234cbb2859', 1520978413537, 'biddemo', null, null, null), -(18, 18, '05934ae338431f28bf6793b2417bf3c3', '469597f0-eefe-4171-afef-f7234cbb2859', 1520978413541, 'biddemo', null, null, null), -(19, 19, '05934ae338431f28bf6793b2417c671b', 'aabcd2cc-c111-41c6-85e6-cb5d9e350d08', 1520978413737, 'biddemo', null, null, null), -(20, 20, '05934ae338431f28bf6793b2417c4bae', '469597f0-eefe-4171-afef-f7234cbb2859', 1520978413764, 'biddemo', null, null, null), -(21, 21, '05934ae338431f28bf6793b2417c4d6c', 'aabcd2cc-c111-41c6-85e6-cb5d9e350d08', 1520978413764, 'biddemo', null, null, null), -(22, 22, '05934ae338431f28bf6793b2417c5aae', '469597f0-eefe-4171-afef-f7234cbb2859', 1520978413765, 'biddemo', null, null, null), -(23, 23, '05934ae338431f28bf6793b2417c705e', 'aabcd2cc-c111-41c6-85e6-cb5d9e350d08', 1520978413880, 'biddemo', null, null, null), -(24, 24, '05934ae338431f28bf6793b2417c98f9', 'aabcd2cc-c111-41c6-85e6-cb5d9e350d08', 1520978413884, 'biddemo', null, null, null), -(25, 25, '05934ae338431f28bf6793b2417c7d94', 'aabcd2cc-c111-41c6-85e6-cb5d9e350d08', 1520978413894, 'biddemo', null, null, null), -(26, 26, '05934ae338431f28bf6793b2417ca6cd', '4a2a4ad9-cd29-47cb-bdb9-5b617a73b898', 1520978413945, 'biddemo', null, null, null), -(27, 27, '05934ae338431f28bf6793b2417d0103', '4a2a4ad9-cd29-47cb-bdb9-5b617a73b898', 1520978414164, 'biddemo', null, null, null), -(28, 28, '05934ae338431f28bf6793b2417d1390', '4a2a4ad9-cd29-47cb-bdb9-5b617a73b898', 1520978414184, 'biddemo', null, null, null), -(29, 29, '05934ae338431f28bf6793b2417d0b1c', '4a2a4ad9-cd29-47cb-bdb9-5b617a73b898', 1520978414186, 'biddemo', null, null, null), -(30, 30, '05934ae338431f28bf6793b2417d2ec2', 'b06e0847-0d68-4f5c-9288-58bc394fe052', 1520978414292, 'biddemo', null, null, null), -(31, 31, '05934ae338431f28bf6793b2417d3aa0', 'b06e0847-0d68-4f5c-9288-58bc394fe052', 1520978414313, 'biddemo', null, null, null), -(32, 32, '05934ae338431f28bf6793b2417db6ca', 'b06e0847-0d68-4f5c-9288-58bc394fe052', 1520978414508, 'biddemo', null, null, null), -(33, 33, '05934ae338431f28bf6793b2417dba2d', 'b06e0847-0d68-4f5c-9288-58bc394fe052', 1520978414513, 'biddemo', null, null, null), -(34, 34, '05934ae338431f28bf6793b2417da475', 'b06e0847-0d68-4f5c-9288-58bc394fe052', 1520978414514, 'biddemo', null, null, null); diff --git a/opensrp-core/src/test/resources/test-scripts/alert.sql b/opensrp-core/src/test/resources/test-scripts/alert.sql deleted file mode 100644 index 9c751e43c2..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/alert.sql +++ /dev/null @@ -1,41 +0,0 @@ ---clear data -TRUNCATE TABLE core.alert CASCADE; - -ALTER SEQUENCE core.alert_id_seq RESTART WITH 16; - -ALTER SEQUENCE core.alert_metadata_id_seq RESTART WITH 16; - -INSERT INTO core.alert (id, json) VALUES -(1, '{"_id": "a6159ce3-c93c-4339-9766-d814a10ca2db", "type": "Alert", "details": {"upcoming:end": "2018-04-30T00:00:00.000+02:00", "upcoming:start": "2018-04-20T00:00:00.000+02:00"}, "entityId": "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "isActive": true, "alertType": "notification", "startDate": "2018-04-20T00:00:00.000+02:00", "timeStamp": 1521842403899, "expiryDate": "2018-04-30T00:00:00.000+02:00", "providerId": "biddemo", "alertStatus": "upcoming", "triggerCode": "pcv2", "triggerName": "PCV 2", "triggerType": "schedule", "beneficiaryType": "vaccination"}'), -(2, '{"_id": "758aaf63-324e-4ccc-95f2-894be012dc25", "type": "Alert", "details": {"upcoming:end": "2018-04-30T00:00:00.000+02:00", "upcoming:start": "2018-04-20T00:00:00.000+02:00"}, "entityId": "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "isActive": true, "alertType": "notification", "startDate": "2018-04-20T00:00:00.000+02:00", "timeStamp": 1521842403900, "expiryDate": "2018-04-30T00:00:00.000+02:00", "providerId": "biddemo", "alertStatus": "upcoming", "triggerCode": "opv2", "triggerName": "OPV 2", "triggerType": "schedule", "beneficiaryType": "vaccination"}'), -(3, '{"_id": "f210392d-2905-458a-8301-5a7fb844c448", "type": "Alert", "details": {"upcoming:end": "2018-04-30T00:00:00.000+02:00", "upcoming:start": "2018-04-20T00:00:00.000+02:00"}, "entityId": "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "isActive": true, "alertType": "notification", "startDate": "2018-04-20T00:00:00.000+02:00", "timeStamp": 1521842403899, "expiryDate": "2018-04-30T00:00:00.000+02:00", "providerId": "biddemo", "alertStatus": "upcoming", "triggerCode": "pcv1", "triggerName": "PCV 1", "triggerType": "schedule", "beneficiaryType": "vaccination"}'), -(4, '{"_id": "52e33167-4b64-4189-bf0c-e7a916815bc9", "type": "Alert", "details": {"upcoming:end": "2018-04-30T00:00:00.000+02:00", "upcoming:start": "2018-04-20T00:00:00.000+02:00"}, "entityId": "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "isActive": true, "alertType": "notification", "startDate": "2018-04-20T00:00:00.000+02:00", "timeStamp": 1521842403837, "expiryDate": "2018-04-30T00:00:00.000+02:00", "providerId": "biddemo", "alertStatus": "upcoming", "triggerCode": "penta2", "triggerName": "PENTA 2", "triggerType": "schedule", "beneficiaryType": "vaccination"}'), -(5, '{"_id": "07a17c79-1e96-478b-ab23-a56a748df09e", "type": "Alert", "details": {"upcoming:end": "2018-04-30T00:00:00.000+02:00", "upcoming:start": "2018-04-20T00:00:00.000+02:00"}, "entityId": "01a12dba-d25e-4518-8da3-cfa8cf5ebf40", "isActive": true, "alertType": "notification", "startDate": "2018-04-20T00:00:00.000+02:00", "timeStamp": 1521842403913, "expiryDate": "2018-04-30T00:00:00.000+02:00", "providerId": "biddemo", "alertStatus": "upcoming", "triggerCode": "rota2", "triggerName": "ROTA 2", "triggerType": "schedule", "beneficiaryType": "vaccination"}'), -(6, '{"_id": "89bcc696-9491-4b03-8064-d7752b0cb12a", "type": "Alert", "details": {"urgent:end": "2022-04-20T00:00:00.000+02:00", "urgent:start": "2017-05-28T00:00:00.000+02:00"}, "entityId": "06e4d8c0-f3ff-458c-8141-53d199355c7a", "isActive": true, "alertType": "notification", "startDate": "2017-05-28T00:00:00.000+02:00", "timeStamp": 1521064813469, "expiryDate": "2022-04-20T00:00:00.000+02:00", "providerId": "DYuyi", "alertStatus": "urgent", "triggerCode": "opv3", "triggerName": "OPV 3", "triggerType": "schedule", "beneficiaryType": "vaccination"}'), -(7, '{"_id": "3aa476f0-50e3-489e-9778-5ae3dcea8640", "type": "Alert", "details": {"urgent:end": "2022-04-20T00:00:00.000+02:00", "urgent:start": "2017-05-28T00:00:00.000+02:00"}, "entityId": "06e4d8c0-f3ff-458c-8141-53d199355c7a", "isActive": true, "alertType": "notification", "startDate": "2017-05-28T00:00:00.000+02:00", "timeStamp": 1521064813617, "expiryDate": "2022-04-20T00:00:00.000+02:00", "providerId": "DYuyi", "alertStatus": "urgent", "triggerCode": "penta3", "triggerName": "PENTA 3", "triggerType": "schedule", "beneficiaryType": "vaccination"}'), -(8, '{"_id": "170c64f5-a187-4c90-b76d-09ff14d5e280", "type": "Alert", "details": {"urgent:end": "2022-04-20T00:00:00.000+02:00", "urgent:start": "2017-05-28T00:00:00.000+02:00"}, "entityId": "06e4d8c0-f3ff-458c-8141-53d199355c7a", "isActive": false, "alertType": "notification", "startDate": "2017-05-28T00:00:00.000+02:00", "timeStamp": 1521756016156, "dateClosed": "2018-03-27", "expiryDate": "2022-04-20T00:00:00.000+02:00", "providerId": "biddemo", "alertStatus": "complete", "triggerCode": "pcv3", "triggerName": "PCV 3", "triggerType": "schedule", "dateComplete": "2018-03-27", "closingPeriod": "urgent", "beneficiaryType": "vaccination"}'), -(9, '{"_id": "80242dd1-01ca-47ea-ae3c-dc0c24dd3f5f", "type": "Alert", "details": {"urgent:end": "2022-04-20T00:00:00.000+02:00", "urgent:start": "2017-05-28T00:00:00.000+02:00"}, "entityId": "06e4d8c0-f3ff-458c-8141-53d199355c7a", "isActive": true, "alertType": "notification", "startDate": "2017-05-28T00:00:00.000+02:00", "timeStamp": 1521064813385, "expiryDate": "2022-04-20T00:00:00.000+02:00", "providerId": "DYuyi", "alertStatus": "urgent", "triggerCode": "pcv3", "triggerName": "PCV 3", "triggerType": "schedule", "beneficiaryType": "vaccination"}'), -(10, '{"_id": "1b7ed001-201b-4503-a098-4b1cd509470d", "type": "Alert", "details": {"normal:end": "2018-03-23T00:00:00.000+02:00", "normal:start": "2018-03-13T00:00:00.000+02:00"}, "entityId": "7583329e-340e-4f64-8d6e-a7cbcf334455", "isActive": true, "alertType": "notification", "startDate": "2018-03-13T00:00:00.000+02:00", "timeStamp": 1520978413376, "expiryDate": "2018-03-23T00:00:00.000+02:00", "providerId": "DYuyi", "alertStatus": "normal", "triggerCode": "itn1", "triggerName": "ITN 1", "triggerType": "schedule", "beneficiaryType": "child"}'), -(11, '{"_id": "32e7d8cd-28e6-4361-9a39-bee732e61d93", "type": "Alert", "details": {"normal:end": "2018-03-23T00:00:00.000+02:00", "normal:start": "2018-03-13T00:00:00.000+02:00"}, "entityId": "7583329e-340e-4f64-8d6e-a7cbcf334455", "isActive": true, "alertType": "notification", "startDate": "2018-03-13T00:00:00.000+02:00", "timeStamp": 1520978413593, "expiryDate": "2018-03-23T00:00:00.000+02:00", "providerId": "DYuyi", "alertStatus": "normal", "triggerCode": "bcg", "triggerName": "BCG", "triggerType": "schedule", "beneficiaryType": "child"}'), -(12, '{"_id": "01741058-588c-4105-b2e4-6e5ae47f4880", "type": "Alert", "details": {"urgent:end": "2021-03-27T00:00:00.000+02:00", "urgent:start": "2017-04-06T00:00:00.000+02:00"}, "entityId": "980d55f5-60d8-4488-b75b-f511c3c839f7", "isActive": true, "alertType": "notification", "startDate": "2017-04-06T00:00:00.000+02:00", "timeStamp": 1522188003909, "expiryDate": "2021-03-27T00:00:00.000+02:00", "providerId": "biddemo", "alertStatus": "urgent", "triggerCode": "deworming1", "triggerName": "DEWORMING 1", "triggerType": "schedule", "beneficiaryType": "child"}'), -(13, '{"_id": "4ba278a4-7d91-4cae-a54d-8353c63e2940", "type": "Alert", "details": {"urgent:end": "2021-03-27T00:00:00.000+02:00", "urgent:start": "2016-10-07T00:00:00.000+02:00"}, "entityId": "980d55f5-60d8-4488-b75b-f511c3c839f7", "isActive": true, "alertType": "notification", "startDate": "2016-10-07T00:00:00.000+02:00", "timeStamp": 1522188003905, "expiryDate": "2021-03-27T00:00:00.000+02:00", "providerId": "biddemo", "alertStatus": "urgent", "triggerCode": "vita1", "triggerName": "VIT A 1", "triggerType": "schedule", "beneficiaryType": "child"}'), -(14, '{"_id": "950d34d1-a374-47aa-91ac-09a62373e624", "type": "Alert", "details": {"normal:end": "2018-07-01T00:00:00.000+02:00", "normal:start": "2018-01-01T00:00:00.000+02:00"}, "entityId": "4a2a4ad9-cd29-47cb-bdb9-5b617a73b898", "isActive": true, "alertType": "notification", "startDate": "2018-01-01T00:00:00.000+02:00", "timeStamp": 1520978414377, "expiryDate": "2018-07-01T00:00:00.000+02:00", "providerId": "biddemo", "alertStatus": "normal", "triggerCode": "vitaifc2", "triggerName": "VIT A IFC 2", "triggerType": "schedule", "beneficiaryType": "child"}'), -(15, '{"_id": "59bf074a-0415-40bb-9b15-d681613673d9", "type": "Alert", "entityId": "fe7b6350-16d2-41d0-8574-c194088705df", "isActive": false, "alertType": "notification", "startDate": "2018-02-22", "timeStamp": 1520978414781, "dateClosed": "2018-03-14", "expiryDate": "2022-11-01", "providerId": "biddemo", "alertStatus": "complete", "triggerCode": "pcv1", "triggerName": "PCV 1", "triggerType": "schedule", "dateComplete": "2018-02-12", "closingPeriod": "urgent", "beneficiaryType": "child"}'); - - -INSERT INTO core.alert_metadata (id, alert_id, document_id, base_entity_id, server_version, provider_id, location_id, team, team_id, is_active, trigger_name) VALUES -(1, 1, 'a6159ce3-c93c-4339-9766-d814a10ca2db', '01a12dba-d25e-4518-8da3-cfa8cf5ebf40', 1521842403899, 'biddemo', null, null, null, true, 'PCV 2'), -(2, 2, '758aaf63-324e-4ccc-95f2-894be012dc25', '01a12dba-d25e-4518-8da3-cfa8cf5ebf40', 1521842403900, 'biddemo', null, null, null, true, 'OPV 2'), -(3, 3, 'f210392d-2905-458a-8301-5a7fb844c448', '01a12dba-d25e-4518-8da3-cfa8cf5ebf40', 1521842403899, 'biddemo', null, null, null, true, 'PCV 1'), -(4, 4, '52e33167-4b64-4189-bf0c-e7a916815bc9', '01a12dba-d25e-4518-8da3-cfa8cf5ebf40', 1521842403837, 'biddemo', null, null, null, true, 'PENTA 2'), -(5, 5, '07a17c79-1e96-478b-ab23-a56a748df09e', '01a12dba-d25e-4518-8da3-cfa8cf5ebf40', 1521842403913, 'biddemo', null, null, null, true, 'ROTA 2'), -(6, 6, '89bcc696-9491-4b03-8064-d7752b0cb12a', '06e4d8c0-f3ff-458c-8141-53d199355c7a', 1521064813469, 'DYuyi', null, null, null, true, 'OPV 3'), -(7, 7, '3aa476f0-50e3-489e-9778-5ae3dcea8640', '06e4d8c0-f3ff-458c-8141-53d199355c7a', 1521064813617, 'DYuyi', null, null, null, true, 'PENTA 3'), -(8, 8, '170c64f5-a187-4c90-b76d-09ff14d5e280', '06e4d8c0-f3ff-458c-8141-53d199355c7a', 1521756016156, 'biddemo', null, null, null, false, 'PCV 3'), -(9, 9, '80242dd1-01ca-47ea-ae3c-dc0c24dd3f5f', '06e4d8c0-f3ff-458c-8141-53d199355c7a', 1521064813385, 'DYuyi', null, null, null, true, 'PCV 3'), -(10, 10, '1b7ed001-201b-4503-a098-4b1cd509470d', '7583329e-340e-4f64-8d6e-a7cbcf334455', 1520978413376, 'DYuyi', null, null, null, true, 'ITN 1'), -(11, 11, '32e7d8cd-28e6-4361-9a39-bee732e61d93', '7583329e-340e-4f64-8d6e-a7cbcf334455', 1520978413593, 'DYuyi', null, null, null, true, 'BCG'), -(12, 12, '01741058-588c-4105-b2e4-6e5ae47f4880', '980d55f5-60d8-4488-b75b-f511c3c839f7', 1522188003909, 'biddemo', null, null, null, true, 'DEWORMING 1'), -(13, 13, '4ba278a4-7d91-4cae-a54d-8353c63e2940', '980d55f5-60d8-4488-b75b-f511c3c839f7', 1522188003905, 'biddemo', null, null, null, true, 'VIT A 1'), -(14, 14, '950d34d1-a374-47aa-91ac-09a62373e624', '4a2a4ad9-cd29-47cb-bdb9-5b617a73b898', 1520978414377, 'biddemo', null, null, null, true, 'VIT A IFC 2'), -(15, 15, '59bf074a-0415-40bb-9b15-d681613673d9', 'fe7b6350-16d2-41d0-8574-c194088705df', 1520978414781, 'biddemo', null, null, null, false, 'PCV 1'); diff --git a/opensrp-core/src/test/resources/test-scripts/app_state_token.sql b/opensrp-core/src/test/resources/test-scripts/app_state_token.sql deleted file mode 100644 index e80e056e89..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/app_state_token.sql +++ /dev/null @@ -1,12 +0,0 @@ ---clear data -TRUNCATE TABLE core.app_state_token; - -ALTER SEQUENCE core.app_state_token_id_seq RESTART WITH 6; - ---insert data -INSERT INTO core.app_state_token (id, name, description, value, last_edited_date) VALUES -(1, 'sync_schedule_tracker_by_last_update_enrollment', 'ScheduleTracker token to keep track of enrollment', '34343', 1521017416), -(2, 'sync_client_by_date_updated', 'OpenMRS data pusher token to keep track of new / updated clients', '65765', 1521217416), -(3, 'sync_client_by_date_voided', 'OpenMRS data pusher token to keep track of voided clients synced ', '122001', 1521017416), -(4, 'sync_event_by_date_updated', 'OpenMRS data pusher token to keep track of new / updated events synced ', '343232', 1521017416), -(5, 'sync_event_by_date_voided', 'OpenMRS data pusher token to keep track of voided events synced ', '23432', 1521017416); diff --git a/opensrp-core/src/test/resources/test-scripts/campaign.sql b/opensrp-core/src/test/resources/test-scripts/campaign.sql deleted file mode 100644 index 60f955ab1b..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/campaign.sql +++ /dev/null @@ -1,13 +0,0 @@ ---clear data -TRUNCATE TABLE core.campaign CASCADE; - -ALTER SEQUENCE core.campaign_id_seq RESTART WITH 6; - -ALTER SEQUENCE core.campaign_metadata_id_seq RESTART WITH 6; - - -INSERT INTO core.campaign (id, json) VALUES (3, '{"owner": "jdoe", "title": "2019 IRS Season 1", "status": "In Progress", "authoredOn": "2018-10-01T09:00:00.000", "identifier": "IRS_2018_S1", "description": "This is the 2010 IRS Spray Campaign for Zambia for the first spray season dated 1 Jan 2019 - 31 Mar 2019.", "lastModified": "2018-11-12T11:49:00.782", "serverVersion": 1542012540782, "executionPeriod": {"end": "2019-03-31", "start": "2019-01-01"}}'); -INSERT INTO core.campaign (id, json) VALUES (4, '{"owner": "jdoe", "title": "2019 IRS Season 2", "status": "In Progress", "authoredOn": "2018-11-12T17:05:00.585", "identifier": "IRS_2018_S2", "description": "This is the 2010 IRS Spray Campaign for Zambia for the first spray season dated 1 Apr 2019 - 30 Jun 2019.", "lastModified": "2018-11-12T17:05:00.586", "serverVersion": 1542031500585, "executionPeriod": {"end": "2019-06-30", "start": "2019-04-01"}}'); - -INSERT INTO core.campaign_metadata (id, campaign_id, identifier, server_version) VALUES (3, 3, 'IRS_2018_S1', 1542012540782); -INSERT INTO core.campaign_metadata (id, campaign_id, identifier, server_version) VALUES (4, 4, 'IRS_2018_S2', 1542031500585); \ No newline at end of file diff --git a/opensrp-core/src/test/resources/test-scripts/client.sql b/opensrp-core/src/test/resources/test-scripts/client.sql deleted file mode 100644 index 29bfe9a724..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/client.sql +++ /dev/null @@ -1,57 +0,0 @@ ---clear data -TRUNCATE TABLE core.client CASCADE; - -ALTER SEQUENCE core.client_id_seq RESTART WITH 17; - -ALTER SEQUENCE core.client_metadata_id_seq RESTART WITH 17; - -INSERT INTO core.client (id, json) VALUES -(1, '{"_id": "05934ae338431f28bf6793b24159ce5d", "type": "Client", "gender": "Male", "lastName": "Child", "_rev": "2-0b2b71f8189f101a5c4c69e44d4886f5", "addresses": [{"addressType": "usual_residence", "addressFields": {"address2": "Dre0", "address3": "78e20b3d-f25e-436f-9cb0-9a505d362f34"}}], "birthdate": "2018-03-01T03:00:00.000", "firstName": "Second", "attributes": {}, "dateEdited": "2018-03-13T00:52:58.942", "dateCreated": "2018-03-13T00:48:59.829", "identifiers": {"ZEIR_ID": "218221-0", "OPENMRS_UUID": "8796f967-2f7a-40f7-8586-d63dbc81b709"}, "baseEntityId": "287be17c-30a7-4482-8816-e2382ec502f1", "relationships": {"mother": ["22b8570a-3207-4af7-8da7-8a1c5b84d3ff"]}, "birthdateApprox": false, "deathdateApprox": false}'), -(2, '{"_id": "05934ae338431f28bf6793b24159dea7", "type": "Client", "gender": "Male", "lastName": " Child", "_rev": "2-6ccd1e9150e9055193267acc3fd311e8", "addresses": [{"addressType": "usual_residence", "addressFields": {"address2": "Rwre", "address3": "78e20b3d-f25e-436f-9cb0-9a505d362f34"}}], "birthdate": "2018-03-01T03:00:00.000", "firstName": "Third", "attributes": {}, "dateEdited": "2018-03-13T00:52:59.675", "dateCreated": "2018-03-13T00:52:01.121", "identifiers": {"ZEIR_ID": "218222-8", "OPENMRS_UUID": "99621619-688a-4f0f-b93e-68ab1b8cf49e"}, "baseEntityId": "43930c23-c787-4ddb-ab76-770f77e7b17d", "relationships": {"mother": ["0154839f-8766-4eda-b729-89067c7a8c5d"]}, "birthdateApprox": false, "deathdateApprox": false}'), -(3, '{"_id": "05934ae338431f28bf6793b24159ebc2", "type": "Client", "gender": "Female", "lastName": "Child", "_rev": "2-0ea77a08483ea9a0c5849cb4fd3da368", "addresses": [{"addressType": "usual_residence", "addressFields": {"address2": "Gjg", "address3": "c19431f1-566c-44ac-ad9e-dfd33eac8daa"}}], "birthdate": "2018-03-01T03:00:00.000", "firstName": "Fourth", "attributes": {}, "dateEdited": "2018-03-13T00:58:00.873", "dateCreated": "2018-03-13T00:54:42.889", "identifiers": {"ZEIR_ID": "218223-6", "OPENMRS_UUID": "07880fcb-0061-43b0-8ae8-6b52372b1a6b"}, "baseEntityId": "219655bb-a733-4d7a-8b1f-ecc5ff3af6cc", "relationships": {"mother": ["0154839f-8766-4eda-b729-89067c7a8c5d"]}, "birthdateApprox": false, "deathdateApprox": false}'), -(4, '{"_id": "05934ae338431f28bf6793b2415a0374", "type": "Client", "gender": "Female", "lastName": "Child", "_rev": "2-5ec561cece5508f14bb0381b59e40baa", "addresses": [{"addressType": "usual_residence", "addressFields": {"address2": "Er", "address3": "78e20b3d-f25e-436f-9cb0-9a505d362f34"}}], "birthdate": "2018-03-01T03:00:00.000", "firstName": "Fith", "attributes": {}, "dateEdited": "2018-03-13T02:23:03.971", "dateCreated": "2018-03-13T02:20:08.984", "identifiers": {"ZEIR_ID": "218224-4", "OPENMRS_UUID": "cf58894b-71c6-41e0-a977-7283f2411cd5"}, "baseEntityId": "94f3e8fb-2f05-4fca-8119-2b593d1962eb", "relationships": {"mother": ["3abdb25a-f151-4a95-9311-bd30bf935085"]}, "birthdateApprox": false, "deathdateApprox": false}'), -(5, '{"_id": "05934ae338431f28bf6793b24159c647", "type": "Client", "gender": "Male", "lastName": "Child", "_rev": "2-3867cacbf2a4b3736524552816381927", "addresses": [{"addressType": "usual_residence", "addressFields": {"address2": "Rewe", "address3": "78e20b3d-f25e-436f-9cb0-9a505d362f34"}}], "birthdate": "2018-01-04T03:00:00.000", "firstName": "First", "attributes": {}, "dateEdited": "2018-03-13T00:47:57.879", "dateCreated": "2018-03-13T00:42:58.436", "identifiers": {"ZEIR_ID": "218220-2", "OPENMRS_UUID": "9c4260f2-d296-4af1-b771-debda1b6cfd1"}, "baseEntityId": "33d9a17f-d729-4276-9891-b43e8b60fd12", "relationships": {"mother": ["d0ecee83-6ccd-4096-9188-f63a40fa2f63"]}, "birthdateApprox": false, "deathdateApprox": false}'), -(6, '{"_id": "05934ae338431f28bf6793b24164cbd9", "type": "Client", "gender": "Female", "lastName": "Mtini ", "_rev": "2-70add9f425fe26094fe4542bdf9a9acf", "addresses": [{"addressType": "usual_residence", "addressFields": {"address1": "Church", "address2": "Tulia Gardens ", "address3": "f940e2a3-b553-496a-80b3-091891bb5194"}}], "birthdate": "2016-04-13T03:00:00.000", "firstName": "Sally", "attributes": {"CHW_Name": "Hellen", "Home_Facility": "Happy Kids Clinic", "CHW_Phone_Number": "0964357951", "Father_NRC_Number": "721345/67/8"}, "dateEdited": "2018-03-13T12:26:53.223", "dateCreated": "2018-03-13T12:26:43.857", "identifiers": {"ZEIR_ID": "218923-1", "OPENMRS_UUID": "ab91df5d-e433-40f3-b44f-427b73c9ae2a"}, "baseEntityId": "86c039a2-0b68-4166-849e-f49897e3a510", "relationships": {"mother": ["758dab58-7629-4da9-882f-ae5110bcd240"]}, "birthdateApprox": false, "deathdateApprox": false}'), -(7, '{"_id": "05934ae338431f28bf6793b241692648", "type": "Client", "gender": "Female", "lastName": "Babbyfour", "_rev": "2-2fa38eef6330ee8753e1ea18a94512aa", "addresses": [{"addressType": "usual_residence", "addressFields": {"address2": "Gcfd", "address3": "82b4de33-a336-4671-820b-32a32ace8819"}}], "birthdate": "2018-01-01T03:00:00.000", "firstName": "Januar", "attributes": {"Home_Facility": "Happy Kids Clinic"}, "dateEdited": "2018-03-13T13:12:09.837", "dateCreated": "2018-03-13T13:11:18.453", "identifiers": {"ZEIR_ID": "218229-3", "OPENMRS_UUID": "825b4d23-a3ea-4c58-a95b-d0df2f9c1690"}, "baseEntityId": "58b33379-dab2-4f5c-8f09-6d2bd63023d8", "relationships": {"mother": ["43930c23-c787-4ddb-ab76-770f77e7b17d"]}, "birthdateApprox": false, "deathdateApprox": false}'), -(8, '{"_id": "05934ae338431f28bf6793b241693a2f", "type": "Client", "gender": "Female", "lastName": "Babyfive", "_rev": "2-8a753553c0e0ae4ed0257bb6d686d2ea", "addresses": [{"addressType": "usual_residence", "addressFields": {"address2": "Home", "address3": "82b4de33-a336-4671-820b-32a32ace8819"}}], "birthdate": "2018-01-01T03:00:00.000", "firstName": "January", "attributes": {"Home_Facility": "Happy Kids Clinic"}, "dateEdited": "2018-03-13T13:12:11.027", "dateCreated": "2018-03-13T13:11:18.725", "identifiers": {"ZEIR_ID": "218230-1", "OPENMRS_UUID": "11a1ecf6-7d6d-4e12-8e6f-bb3cf5a3ebb8"}, "baseEntityId": "aabcd2cc-c111-41c6-85e6-cb5d9e350d08", "relationships": {"mother": ["41d1841b-4d6c-4f06-b5e8-b55907892ee6"]}, "birthdateApprox": false, "deathdateApprox": false}'), -(9, '{"_id": "05934ae338431f28bf6793b2416946b7", "type": "Client", "gender": "Female", "lastName": "Babysix", "_rev": "2-0684ed7a15c29c8bf479a36d8c5986c5", "addresses": [{"addressType": "usual_residence", "addressFields": {"address2": "Gu", "address3": "82b4de33-a336-4671-820b-32a32ace8819"}}], "birthdate": "2018-01-01T03:00:00.000", "firstName": "January ", "attributes": {"Home_Facility": "Happy Kids Clinic"}, "dateEdited": "2018-03-13T13:12:12.257", "dateCreated": "2018-03-13T13:11:19.005", "identifiers": {"ZEIR_ID": "218231-9", "OPENMRS_UUID": "eb4b258c-7558-436c-a1fe-e91d9e12f849"}, "baseEntityId": "469597f0-eefe-4171-afef-f7234cbb2859", "relationships": {"mother": ["7bce6b9a-e575-4cc6-b987-a12284912e84"]}, "birthdateApprox": false, "deathdateApprox": false}'), -(10, '{"_id": "05934ae338431f28bf6793b24167817d", "type": "Client", "gender": "Male", "lastName": "Child", "_rev": "2-9de838d2e671a8d5011cedf66143b023", "addresses": [{"addressType": "usual_residence", "addressFields": {"address2": "Guy", "address3": "78e20b3d-f25e-436f-9cb0-9a505d362f34"}}], "birthdate": "2018-03-01T03:00:00.000", "firstName": "Sixth", "attributes": {"Home_Facility": "Happy Kids Clinic"}, "dateEdited": "2018-03-13T12:57:03.225", "dateCreated": "2018-03-13T12:53:04.188", "identifiers": {"ZEIR_ID": "218225-1", "OPENMRS_UUID": "43397e39-0a11-4bb7-ba2d-3820436bef85"}, "baseEntityId": "28caef27-d1b3-497b-8a55-954f2f0f6e24", "relationships": {"mother": ["ab1eda08-2185-4d5f-9301-abb17d376ded"]}, "birthdateApprox": false, "deathdateApprox": false}'), -(11, '{"_id": "05934ae338431f28bf6793b241679500", "type": "Client", "gender": "Male", "lastName": "Baby", "_rev": "2-f7de9e0a0e63129a1e4a3016539a2194", "addresses": [{"addressType": "usual_residence", "addressFields": {"address2": "Rer", "address3": "82b4de33-a336-4671-820b-32a32ace8819"}}], "birthdate": "2018-01-01T03:00:00.000", "deathdate": "2018-02-13T03:00:00.000", "firstName": "Jan", "attributes": {"Home_Facility": "Happy Kids Clinic"}, "dateEdited": "2018-03-13T12:57:04.417", "dateCreated": "2018-03-13T12:53:04.453", "identifiers": {"ZEIR_ID": "218226-9", "OPENMRS_UUID": "7a8926a9-f35a-41ba-adbf-87712333d5c2"}, "baseEntityId": "f33c71c7-a9a4-495d-8028-b6d59e4034b3", "relationships": {"mother": ["7289296d-9ec9-450e-9389-88b5b0d329a0"]}, "birthdateApprox": false, "deathdateApprox": false}'), -(12, '{"_id": "05934ae338431f28bf6793b24167b6d1", "type": "Client", "gender": "Male", "lastName": "Babytwo", "_rev": "2-ce3c6a238b86298059c0dd792f0c0dcc", "addresses": [{"addressType": "usual_residence", "addressFields": {"address2": "Ty", "address3": "82b4de33-a336-4671-820b-32a32ace8819"}}], "birthdate": "2018-01-01T03:00:00.000", "firstName": "Janu", "attributes": {"Home_Facility": "Happy Kids Clinic"}, "dateEdited": "2018-03-13T12:57:05.652", "dateCreated": "2018-03-13T12:54:42.456", "identifiers": {"ZEIR_ID": "218227-7", "OPENMRS_UUID": "ba5d3927-414f-4796-ae1e-9b73b50a5573"}, "baseEntityId": "fe7b6350-16d2-41d0-8574-c194088705df", "relationships": {"mother": ["14715b97-f0d5-4515-813b-5698934dbf1d"]}, "birthdateApprox": false, "deathdateApprox": false}'), -(13, '{"_id": "05934ae338431f28bf6793b24162ca7e", "type": "Client", "gender": "Male", "lastName": "Owino", "_rev": "2-5d274d303daa8ff1cd5eb5604b8e60f7", "addresses": [{"addressType": "usual_residence", "addressFields": {"address2": "Kilimani", "address3": "6c814e69-ed6f-4fcc-ac2c-8406508603f2"}}], "birthdate": "2017-02-13T03:00:00.000", "firstName": "George", "attributes": {"Home_Facility": "Happy Kids Clinic", "Child_Birth_Certificate": "7865", "Child_Register_Card_Number": "4567"}, "dateEdited": "2018-03-13T11:46:46.277", "dateCreated": "2018-03-13T11:42:01.573", "identifiers": {"ZEIR_ID": "218922-3", "OPENMRS_UUID": "c5780597-3d54-4298-b39f-9d38dfd14970"}, "baseEntityId": "67007c17-97bb-4732-a1b8-3a0c292b5432", "relationships": {"mother": ["14f94928-ef60-4d1c-a6be-f46b3b844268"]}, "birthdateApprox": false, "deathdateApprox": false}'), -(14, '{"_id": "05934ae338431f28bf6793b2418380ce", "type": "Client", "gender": "Female", "lastName": "Gchf", "_rev": "2-2d194250dc94b0ed20fbb2dac28a9020", "addresses": [{"addressType": "usual_residence", "addressFields": {"address2": "Chf", "address3": "144cea61-2322-4a2c-8963-d99b52aa1406"}}], "birthdate": "1960-01-01T03:00:00.000", "firstName": "Gg", "attributes": {}, "dateEdited": "2018-03-14T07:53:06.606", "dateCreated": "2018-03-14T07:52:16.620", "identifiers": {"M_ZEIR_ID": "218232-7_mother", "OPENMRS_UUID": "2ca99239-ba6e-42d6-92a5-a889d2de50c0"}, "baseEntityId": "cc127350-c1cd-4c3a-99d4-4d632882f522", "birthdateApprox": false, "deathdateApprox": false}'), -(15, '{"_id": "05934ae338431f28bf6793b241839005", "type": "Client", "gender": "Female", "lastName": "Immunisedtwo", "_rev": "2-db28bfef08ea6a88fc4d387bbb83b369", "addresses": [{"addressType": "usual_residence", "addressFields": {"address2": "Home", "address3": "144cea61-2322-4a2c-8963-d99b52aa1406"}}], "birthdate": "2017-06-13T03:00:00.000", "firstName": "Fully", "attributes": {"Home_Facility": "Happy Kids Clinic","residence":"90397"}, "dateEdited": "2018-03-14T07:53:07.496", "dateCreated": "2018-03-14T07:52:16.757", "identifiers": {"ZEIR_ID": "218233-5", "OPENMRS_UUID": "02d89e05-64ad-4fa3-86d9-93b669ec02c5"}, "baseEntityId": "d4eda055-60c6-44a4-ba48-61dfe6485bea", "relationships": {"mother": ["17a1f5ed-a4cd-4427-ad9f-6471f4fc963d"]}, "birthdateApprox": false, "deathdateApprox": false}'), -(16, '{"_id": "f5934ae338431f28bf6793b24159ce5a", "type": "Client", "gender": "Male", "lastName": "Child", "_rev": "2-0b2b71f8189f101a5c4c69e44d4886f5", "addresses": [{"addressType": "usual_residence", "addressFields": {"address2": "Dre0", "address3": "78e20b3d-f25e-436f-9cb0-9a505d362f34"}}], "birthdate": "2018-03-01T03:00:00.000", "firstName": "Second", "attributes": {}, "dateEdited": "2018-03-13T00:52:58.942", "dateCreated": "2018-03-13T00:48:59.829", "identifiers": {"ZEIR_ID": "218221-0", "OPENMRS_UUID": "8796f967-2f7a-40f7-8586-d63dbc81b709"}, "baseEntityId": "040d4f18-8140-479c-aa21-725612073490", "relationships": {"mother": ["22b8570a-3207-4af7-8da7-8a1c5b84d3fa"]}, "birthdateApprox": false, "deathdateApprox": false}'), -(20, '{"_id": "2e14b66f-206c-4314-a0f7-c5d2c4d9860f", "_rev": "v1", "type": "Client", "gender": "Female", "lastName": "Nobina", "addresses": [], "birthdate": "1997-11-14T06:00:00.000+06:00", "firstName": "Nobonita", "attributes": {}, "middleName": "", "dateCreated": "2019-11-14T18:20:49.792+06:00", "identifiers": {"opensrp_id": "1008162"}, "baseEntityId": "8a118521-126b-4d5e-9c3b-0b359671bbae", "relationships": {"family": ["ea0edc48-4752-4ad0-a834-f1f68c7ae310"]}, "serverVersion": 1573734049787, "birthdateApprox": false, "deathdateApprox": false, "clientDatabaseVersion": 12, "clientApplicationVersion": 9}'), -(21, '{"_id": "ade884f8-2685-45fd-93f8-122045b2635e", "_rev": "v1", "type": "Client", "gender": "Male", "lastName": "Family", "addresses": [{"addressType": "", "cityVillage": "mouchak", "addressFields": {"commune": "2"}}], "birthdate": "1970-01-01T12:00:00.000+06:00", "firstName": "Haraner Bari", "attributes": {"fam_source_income": "Family source of income"}, "dateCreated": "2019-11-14T18:19:13.516+06:00", "identifiers": {"opensrp_id": "1008140_family"}, "baseEntityId": "ea0edc48-4752-4ad0-a834-f1f68c7ae310", "relationships": {"family_head": ["0830ce5e-21ff-4f28-8a67-d820f0ff15bc"], "primary_caregiver": ["0830ce5e-21ff-4f28-8a67-d820f0ff15bc"]}, "serverVersion": 1573733953501, "birthdateApprox": false, "deathdateApprox": false, "clientDatabaseVersion": 12, "clientApplicationVersion": 9}'), -(22, '{"_id": "28ea8f0a-fa53-447d-b8f9-ad07263b382c", "_rev": "v1", "type": "Client", "gender": "Female", "lastName": "Moni", "addresses": [{"addressType": "", "addressFields": {"commune": "no"}}], "birthdate": "2017-11-14T06:00:00.000+06:00", "firstName": "mala", "attributes": {}, "middleName": "", "dateCreated": "2019-11-14T17:40:23.092+06:00", "identifiers": {"opensrp_id": "1005501"}, "baseEntityId": "98adc983-01e6-4755-b110-5111d98dbd45", "relationships": {"family": ["f69de82f-0608-45c8-8347-6b7044aa8d8d"], "mother": ["f69de82f-0608-45c8-8347-6b7044aa8d8d"]}, "serverVersion": 1573731623081, "birthdateApprox": false, "deathdateApprox": false, "clientDatabaseVersion": 12, "clientApplicationVersion": 9}'), -(23, '{"_id": "b0cb057b-c396-4ec9-bfab-388117a9a5f6", "_rev": "v1", "type": "Client", "gender": "Male", "lastName": "Family", "addresses": [{"addressType": "", "cityVillage": "syank", "addressFields": {"commune": "no"}}], "birthdate": "1970-01-01T12:00:00.000+06:00", "firstName": "Jahan", "attributes": {"fam_source_income": "Family source of income"}, "dateCreated": "2019-11-14T17:39:37.811+06:00", "identifiers": {"opensrp_id": "1005490_family"}, "baseEntityId": "f69de82f-0608-45c8-8347-6b7044aa8d8d", "relationships": {"family_head": ["2a066f6d-9817-4879-baac-4331f6d4bc2f"], "primary_caregiver": ["2a066f6d-9817-4879-baac-4331f6d4bc2f"]}, "serverVersion": 1573731577780, "birthdateApprox": false, "deathdateApprox": false, "clientDatabaseVersion": 12, "clientApplicationVersion": 9}'), -(24, '{"_id": "5bd3e1eb-5cd4-4e8d-9180-4293b7ea3b78", "_rev": "v1", "type": "Client", "gender": "Male", "lastName": "Haran", "addresses": [], "birthdate": "1982-11-14T06:00:00.000+06:00", "firstName": "Haran Mia", "attributes": {}, "middleName": "", "dateCreated": "2019-11-14T18:19:13.529+06:00", "identifiers": {"opensrp_id": "1008140"}, "baseEntityId": "0830ce5e-21ff-4f28-8a67-d820f0ff15bc", "relationships": {"family": ["ea0edc48-4752-4ad0-a834-f1f68c7ae310"]}, "serverVersion": 1573733953502, "birthdateApprox": false, "deathdateApprox": false, "clientDatabaseVersion": 12, "clientApplicationVersion": 9}'); -INSERT INTO core.client_metadata (id, client_id, document_id, base_entity_id, relational_id, server_version, openmrs_uuid, unique_id, first_name, middle_name, last_name, birth_date) VALUES -(1, 1, '05934ae338431f28bf6793b24159ce5d', '287be17c-30a7-4482-8816-e2382ec502f1', '22b8570a-3207-4af7-8da7-8a1c5b84d3ff', 1520891339766, '8796f967-2f7a-40f7-8586-d63dbc81b709', '218221-0', 'Second', null, 'Child', '2018-03-01'), -(2, 2, '05934ae338431f28bf6793b24159dea7', '43930c23-c787-4ddb-ab76-770f77e7b17d', '58b33379-dab2-4f5c-8f09-6d2bd63023d8', 1520891521078, '99621619-688a-4f0f-b93e-68ab1b8cf49e', '218222-8', 'Third', null, ' Child', '2018-03-01'), -(3, 3, '05934ae338431f28bf6793b24159ebc2', '219655bb-a733-4d7a-8b1f-ecc5ff3af6cc', '0154839f-8766-4eda-b729-89067c7a8c5d', 1520891682846, '07880fcb-0061-43b0-8ae8-6b52372b1a6b', '218223-6', 'Fourth', null, 'Child', '2018-03-01'), -(4, 4, '05934ae338431f28bf6793b2415a0374', '94f3e8fb-2f05-4fca-8119-2b593d1962eb', '3abdb25a-f151-4a95-9311-bd30bf935085', 1520896808942, 'cf58894b-71c6-41e0-a977-7283f2411cd5', '218224-4', 'Fith', null, 'Child', '2018-03-01'), -(5, 5, '05934ae338431f28bf6793b24159c647', '33d9a17f-d729-4276-9891-b43e8b60fd12', 'd0ecee83-6ccd-4096-9188-f63a40fa2f63', 1520890978382, '9c4260f2-d296-4af1-b771-debda1b6cfd1', '218220-2', 'First', null, 'Child', '2018-01-04'), -(6, 6, '05934ae338431f28bf6793b24164cbd9', '86c039a2-0b68-4166-849e-f49897e3a510', '758dab58-7629-4da9-882f-ae5110bcd240', 1520933203799, 'ab91df5d-e433-40f3-b44f-427b73c9ae2a', '218923-1', 'Sally', null, 'Mtini ', '2016-04-13'), -(7, 7, '05934ae338431f28bf6793b241692648', '58b33379-dab2-4f5c-8f09-6d2bd63023d8', '43930c23-c787-4ddb-ab76-770f77e7b17d', 1520935878137, '825b4d23-a3ea-4c58-a95b-d0df2f9c1690', '218229-3', 'Januar', null, 'Babbyfour', '2018-01-01'), -(8, 8, '05934ae338431f28bf6793b241693a2f', 'aabcd2cc-c111-41c6-85e6-cb5d9e350d08', '41d1841b-4d6c-4f06-b5e8-b55907892ee6', 1520935878137, '11a1ecf6-7d6d-4e12-8e6f-bb3cf5a3ebb8', '218230-1', 'January', null, 'Babyfive', '2018-01-01'), -(9, 9, '05934ae338431f28bf6793b2416946b7', '469597f0-eefe-4171-afef-f7234cbb2859', '7bce6b9a-e575-4cc6-b987-a12284912e84', 1520935878137, 'eb4b258c-7558-436c-a1fe-e91d9e12f849', '218231-9', 'January ', null, 'Babysix', '2018-01-01'), -(10, 10, '05934ae338431f28bf6793b24167817d', '28caef27-d1b3-497b-8a55-954f2f0f6e24', 'ab1eda08-2185-4d5f-9301-abb17d376ded', 1520934784144, '43397e39-0a11-4bb7-ba2d-3820436bef85', '218225-1', 'Sixth', null, 'Child', '2018-03-01'), -(11, 11, '05934ae338431f28bf6793b241679500', 'f33c71c7-a9a4-495d-8028-b6d59e4034b3', '7289296d-9ec9-450e-9389-88b5b0d329a0', 1520934784145, '7a8926a9-f35a-41ba-adbf-87712333d5c2', '218226-9', 'Jan', null, 'Baby', '2018-01-01'), -(12, 12, '05934ae338431f28bf6793b24167b6d1', 'fe7b6350-16d2-41d0-8574-c194088705df', '14715b97-f0d5-4515-813b-5698934dbf1d', 1520934882395, 'ba5d3927-414f-4796-ae1e-9b73b50a5573', '218227-7', 'Janu', null, 'Babytwo', '2018-01-01'), -(13, 13, '05934ae338431f28bf6793b24162ca7e', '67007c17-97bb-4732-a1b8-3a0c292b5432', '14f94928-ef60-4d1c-a6be-f46b3b844268', 1520930521516, 'c5780597-3d54-4298-b39f-9d38dfd14970', '218922-3', 'George', null, 'Owino', '2017-02-13'), -(14, 14, '05934ae338431f28bf6793b2418380ce', 'cc127350-c1cd-4c3a-99d4-4d632882f522', null, 1521003136407, '2ca99239-ba6e-42d6-92a5-a889d2de50c0', '218232-7_mother', 'Gg', null, 'Gchf', '1960-01-01'), -(16, 16, 'f5934ae338431f28bf6793b24159ce5a', '040d4f18-8140-479c-aa21-725612073490', '22b8570a-3207-4af7-8da7-8a1c5b84d3fa', 1521003136408, '02d89e05-64ad-4fa3-86d9-93b669ec02c6', '218933-6', 'Fully', null, 'Immunisedthree', '2017-06-13'); - -INSERT INTO core.client_metadata (id, client_id, document_id, base_entity_id, relational_id, server_version, openmrs_uuid, unique_id, first_name, middle_name, last_name, birth_date,residence) VALUES -(15, 15, '05934ae338431f28bf6793b241839005', 'd4eda055-60c6-44a4-ba48-61dfe6485bea', '17a1f5ed-a4cd-4427-ad9f-6471f4fc963d', 1521003136407, '02d89e05-64ad-4fa3-86d9-93b669ec02c5', '218233-5', 'Fully', null, 'Immunisedtwo', '2017-06-13',90397), -(20, 20, '2e14b66f-206c-4314-a0f7-c5d2c4d9860f', '8a118521-126b-4d5e-9c3b-0b359671bbae', 'ea0edc48-4752-4ad0-a834-f1f68c7ae310', 1573734049787, '', '1008162', 'Nobonita', null, 'Nobina', '1997-11-14',''), -(21, 21, 'ade884f8-2685-45fd-93f8-122045b2635e', 'ea0edc48-4752-4ad0-a834-f1f68c7ae310', '0830ce5e-21ff-4f28-8a67-d820f0ff15bc', 1573733953501, '', '1008140_family', 'Haraner Bari', null, 'Family', '1970-01-01',''), -(22, 22, '28ea8f0a-fa53-447d-b8f9-ad07263b382c', '98adc983-01e6-4755-b110-5111d98dbd45', 'f69de82f-0608-45c8-8347-6b7044aa8d8d', 1573731623081, '', '1005501', 'mala', null, 'Moni', '2017-11-14',''), -(23, 23, 'b0cb057b-c396-4ec9-bfab-388117a9a5f6', 'f69de82f-0608-45c8-8347-6b7044aa8d8d', '2a066f6d-9817-4879-baac-4331f6d4bc2f', 1573731577780, '', '1005490_family', 'Jahan', null, 'Family', '1970-01-01',''), -(24, 24, '5bd3e1eb-5cd4-4e8d-9180-4293b7ea3b78', '0830ce5e-21ff-4f28-8a67-d820f0ff15bc', 'ea0edc48-4752-4ad0-a834-f1f68c7ae310', 1573733953502, '', '1008140', 'Haran Mia', null, 'Haran', '1982-11-14',''); - - - - diff --git a/opensrp-core/src/test/resources/test-scripts/error.sql b/opensrp-core/src/test/resources/test-scripts/error.sql deleted file mode 100644 index d7acf4525d..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/error.sql +++ /dev/null @@ -1,84 +0,0 @@ ---clear data -TRUNCATE TABLE error.error_trace; - -ALTER SEQUENCE error.error_trace_id_seq RESTART WITH 9; - ---insert test data -INSERT INTO error.error_trace (id, document_id, date_occurred, error_type, occurred_at, stack_trace, status, record_id, date_closed, document_type, retry_url) VALUES (1, '85ed95b2-8436-4a93-9ae7-ab104d65edd7', '2018-03-14 07:53:11.152000', 'OPENMRS FAILED CLIENT PUSH', null, 'at sun.reflect.GeneratedMethodAccessor985.invoke(Unknown Source) - at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) - at java.lang.reflect.Method.invoke(Method.java:498) - at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64) - at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53) - at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) - at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) - at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) - at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) - at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) - at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) - at java.lang.Thread.run(Thread.java:748) -', null, null, null, 'org.opensrp.domain.Client', ''); -INSERT INTO error.error_trace (id, document_id, date_occurred, error_type, occurred_at, stack_trace, status, record_id, date_closed, document_type, retry_url) VALUES (2, 'd41ba935-c8f6-4d3d-8432-8e8059ae39ca', '2018-03-14 11:24:30.643000', 'OPENMRS FAILED CLIENT PUSH', null, 'at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) - at java.lang.reflect.Method.invoke(Method.java:498) - at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64) - at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53) - at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) - at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) - at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) - at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) - at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) - at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) - at java.lang.Thread.run(Thread.java:748) -', null, null, null, 'org.opensrp.domain.Client', ''); -INSERT INTO error.error_trace (id, document_id, date_occurred, error_type, occurred_at, stack_trace, status, record_id, date_closed, document_type, retry_url) VALUES (3, 'f4bb0d37-0f08-44e2-822f-87d81983eefb', '2018-03-15 16:16:09.571000', 'OPENMRS FAILED EVENT PUSH', null, 'at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) - at java.lang.reflect.Method.invoke(Method.java:498) - at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64) - at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53) - at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) - at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) - at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) - at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) - at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) - at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) - at java.lang.Thread.run(Thread.java:748) -', null, null, null, 'org.opensrp.domain.Event', ''); -INSERT INTO error.error_trace (id, document_id, date_occurred, error_type, occurred_at, stack_trace, status, record_id, date_closed, document_type, retry_url) VALUES (4, '8798ae98-4f71-4bbb-8391-bfbda783b2d9', '2018-03-19 16:31:47.916000', 'OPENMRS FAILED CLIENT PUSH', null, 'at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) - at java.lang.reflect.Method.invoke(Method.java:498) - at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64) - at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53) - at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) - at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) - at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) - at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) - at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) - at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) - at java.lang.Thread.run(Thread.java:748) -', null, null, null, 'org.opensrp.domain.Client', ''); -INSERT INTO error.error_trace (id, document_id, date_occurred, error_type, occurred_at, stack_trace, status, record_id, date_closed, document_type, retry_url) VALUES (5, 'ea96c23d-bbf1-4365-bdf5-bcf56f08ce1f', '2018-03-22 15:59:30.791000', 'OPENMRS FAILED EVENT PUSH', null, 'at sun.reflect.GeneratedMethodAccessor985.invoke(Unknown Source) - at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) - at java.lang.reflect.Method.invoke(Method.java:498) - at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64) - at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53) - at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) - at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) - at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) - at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) - at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) - at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) - at java.lang.Thread.run(Thread.java:748) -', null, null, null, 'org.opensrp.domain.Event', ''); -INSERT INTO error.error_trace (id, document_id, date_occurred, error_type, occurred_at, stack_trace, status, record_id, date_closed, document_type, retry_url) VALUES (6, '911c7520-f701-419e-b225-5e21286b585b', '2018-01-11 11:14:07.655000', 'OPENMRS FAILED EVENT VALIDATION', null, 'at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) - at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) - at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) - at java.lang.reflect.Method.invoke(Method.java:498) - at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64) - at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53) - at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) - at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) - at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) - at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) - at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) - at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) - at java.lang.Thread.run(Thread.java:748) -', null, null, null, 'org.opensrp.domain.Event', ''); -INSERT INTO error.error_trace (id, document_id, date_occurred, error_type, occurred_at, stack_trace, status, record_id, date_closed, document_type, retry_url) VALUES (7, '48106c03-8900-4156-a7bf-93226e1d3e58', '2018-01-03 11:20:52.467000', 'FormSubmissionProcessor', 'org.opensrp.service.formSubmission.FormSubmissionListener', '[Ljava.lang.StackTraceElement;@22cdbe2', 'solved', null, null, 'org.opensrp.form.domain.FormSubmission', null); -INSERT INTO error.error_trace (id, document_id, date_occurred, error_type, occurred_at, stack_trace, status, record_id, date_closed, document_type, retry_url) VALUES (8, '07c32814-d7d1-48a5-8320-ed80435a4606', '2018-01-03 17:06:11.166000', 'FormSubmissionProcessor', 'org.opensrp.service.formSubmission.FormSubmissionListener', '[Ljava.lang.StackTraceElement;@50ef4583', 'solved', null, null, 'org.opensrp.form.domain.FormSubmission', null); \ No newline at end of file diff --git a/opensrp-core/src/test/resources/test-scripts/event.sql b/opensrp-core/src/test/resources/test-scripts/event.sql deleted file mode 100644 index 73a5cd71a9..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/event.sql +++ /dev/null @@ -1,57 +0,0 @@ ---clear data -TRUNCATE TABLE core.event CASCADE; - -ALTER SEQUENCE core.event_id_seq RESTART WITH 16; - -ALTER SEQUENCE core.event_metadata_id_seq RESTART WITH 16; - ---insert data -INSERT INTO core.event (id, json, date_deleted) VALUES -(1, '{"_id": "05934ae338431f28bf6793b2417696bf", "obs": [{"values": ["2018-03-13"], "fieldCode": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "162586AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "date", "formSubmissionField": "mr_1", "humanReadableValues": []}, {"values": ["1"], "fieldCode": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "162586AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "calculate", "formSubmissionField": "mr_1_dose", "humanReadableValues": []}], "type": "Event", "version": 1520941739448, "duration": 0, "_rev": "1-069bfb5078ff17f922c0bba799222878", "eventDate": "2018-03-13T17:42:03.326+03:00", "eventType": "Vaccination", "entityType": "vaccination", "locationId": "42b88545-7ebb-4e11-8d1a-3d3a924c8af4", "providerId": "biddemo", "dateCreated": "2018-03-19T17:27:26.477+03:00", "identifiers": {}, "baseEntityId": "ea1f9439-a663-4073-93b9-6ef2b8bca3c1", "serverVersion": 1520945634380, "formSubmissionId": "29243014-48df-4165-a82d-f4878f6a830e"}', null), -(2, '{"_id": "05934ae338431f28bf6793b24199e690", "obs": [{"values": ["2018-03-14 10:31:33"], "fieldCode": "163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "start", "formSubmissionField": "start", "humanReadableValues": []}, {"values": ["2018-03-14 10:39:56"], "fieldCode": "163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "end", "formSubmissionField": "end", "humanReadableValues": []}, {"values": ["867104020634913"], "fieldCode": "163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "deviceid", "formSubmissionField": "deviceid", "humanReadableValues": []}], "type": "Event", "version": 1521016796414, "duration": 0, "_rev": "2-615390b17f8f2f9e9aa92f5f4a8a7aaf", "eventDate": "2018-03-14T03:00:00.000+03:00", "eventType": "New Woman Registration", "dateEdited": "2018-03-14T11:39:35.826+03:00", "entityType": "mother", "locationId": "42abc582-6658-488b-922e-7be500c070f3", "providerId": "biddemo", "dateCreated": "2018-03-19T17:27:28.717+03:00", "identifiers": {"OPENMRS_UUID": "d3630a60-a1f4-4267-9225-f4cb728f4178"}, "baseEntityId": "43930c23-c787-4ddb-ab76-770f77e7b17d", "serverVersion": 1521016638453, "formSubmissionId": "6b3243e9-3d45-495c-af69-f012061def01"}', null), -(3, '{"_id": "05934ae338431f28bf6793b2419c64fb", "obs": [{"values": ["2018-03-14"], "fieldCode": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "date", "formSubmissionField": "measles_1", "humanReadableValues": []}, {"values": ["1"], "fieldCode": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "calculate", "formSubmissionField": "measles_1_dose", "humanReadableValues": []}], "type": "Event", "version": 1521033238310, "duration": 0, "_rev": "1-dff06b7575a5177c7200b08570d14f4b", "eventDate": "2018-03-14T19:09:51.379+03:00", "eventType": "Vaccination", "entityType": "vaccination", "locationId": "42b88545-7ebb-4e11-8d1a-3d3a924c8af4", "providerId": "biddemo", "dateCreated": "2018-03-19T17:27:28.750+03:00", "identifiers": {}, "baseEntityId": "ea1f9439-a663-4073-93b9-6ef2b8bca3c1", "serverVersion": 1521033533700, "formSubmissionId": "bfbfabe8-d4ae-4db2-940f-a6f126ef7829"}', null), -(4, '{"_id": "05934ae338431f28bf6793b2419c319a", "obs": [{"values": ["2018-03-13"], "fieldCode": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "date", "formSubmissionField": "measles_1_", "humanReadableValues": []}, {"values": ["1"], "fieldCode": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "36AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "calculate", "formSubmissionField": "measles_1__dose", "humanReadableValues": []}], "type": "Event", "version": 1521044035486, "duration": 0, "_rev": "3-2d669093b06c73fcd5c0fa7c4782e21d", "eventDate": "2018-03-13T22:10:00.321+03:00", "eventType": "Vaccination", "dateEdited": "2018-03-14T19:21:38.401+03:00", "entityType": "vaccination", "locationId": "42b88545-7ebb-4e11-8d1a-3d3a924c8af4", "providerId": "biddemo", "dateCreated": "2018-03-19T17:27:29.019+03:00", "identifiers": {}, "baseEntityId": "ea1f9439-a663-4073-93b9-6ef2b8bca3c1", "serverVersion": 1521044588444, "formSubmissionId": "d960046a-e2a0-4bbf-b687-d41c2a52d8c8"}', null), -(5, '{"_id": "05934ae338431f28bf6793b241bdb88c", "obs": [{"values": ["42abc582-6658-488b-922e-7be500c070f3"], "fieldCode": "Home_Facility", "fieldType": "formsubmissionField", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "Home_Facility", "humanReadableValues": []}, {"values": ["2018-02-16"], "fieldCode": "163260AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "date", "formSubmissionField": "First_Health_Facility_Contact", "humanReadableValues": []}, {"values": ["2.5"], "fieldCode": "5916AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "Birth_Weight", "humanReadableValues": []}, {"values": ["1588AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"], "fieldCode": "1572AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "select one", "formSubmissionField": "Place_Birth", "humanReadableValues": ["Health facility"]}, {"values": ["Happy Kids Clinic"], "fieldCode": "163531AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "Birth_Facility_Name", "humanReadableValues": []}, {"values": ["664AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"], "fieldCode": "1396AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "PMTCT_Status", "humanReadableValues": ["CNE"]}, {"values": ["2018-03-16 08:57:43"], "fieldCode": "163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "start", "formSubmissionField": "start", "humanReadableValues": []}, {"values": ["2018-03-16 08:59:04"], "fieldCode": "163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "end", "formSubmissionField": "end", "humanReadableValues": []}, {"values": ["867104020633980"], "fieldCode": "163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "deviceid", "formSubmissionField": "deviceid", "humanReadableValues": []}], "type": "Event", "version": 1521183544980, "duration": 0, "_rev": "2-04d992d294837437d5fc099fae979049", "eventDate": "2018-03-16T03:00:00.000+03:00", "eventType": "Birth Registration", "dateEdited": "2018-03-16T10:03:00.759+03:00", "entityType": "child", "locationId": "42abc582-6658-488b-922e-7be500c070f3", "providerId": "biddemo", "dateCreated": "2018-03-19T17:27:29.364+03:00", "identifiers": {"OPENMRS_UUID": "06c8644b-b560-45fd-9af5-b6b1484e3504"}, "baseEntityId": "58b33379-dab2-4f5c-8f09-6d2bd63023d8", "serverVersion": 1521183592609, "formSubmissionId": "d59504cc-09ef-4d09-9dc3-8f7eb65882fd"}', null), -(6, '{"_id": "05934ae338431f28bf6793b241bdbb60", "obs": [{"values": ["2018-01-10"], "fieldCode": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "date", "formSubmissionField": "opv_0", "humanReadableValues": []}, {"values": ["0"], "fieldCode": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "calculate", "formSubmissionField": "opv_0_dose", "humanReadableValues": []}], "type": "Event", "version": 1521183602537, "duration": 0, "_rev": "2-45e4b7c82520480edbc1adecec55f6ae", "eventDate": "2018-01-10T11:59:37.380+03:00", "eventType": "Vaccination", "dateEdited": "2018-03-16T10:03:00.949+03:00", "entityType": "vaccination", "locationId": "42abc582-6658-488b-922e-7be500c070f3", "providerId": "biddemo", "dateCreated": "2018-03-19T17:27:29.371+03:00", "identifiers": {"OPENMRS_UUID": "35d6a414-a379-4ada-97ee-39f680eecb91"}, "baseEntityId": "58b33379-dab2-4f5c-8f09-6d2bd63023d8", "serverVersion": 1521183593424, "formSubmissionId": "baf8e663-71a1-4a30-8d40-2f3cab45a6d7"}', null), -(7, '{"_id": "05934ae338431f28bf6793b241bdbc55", "obs": [{"values": ["2018-01-10"], "fieldCode": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "date", "formSubmissionField": "bcg", "humanReadableValues": []}, {"values": ["1"], "fieldCode": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "calculate", "formSubmissionField": "bcg_dose", "humanReadableValues": []}], "type": "Event", "version": 1521183602575, "duration": 0, "_rev": "2-1f5e07f8e65a09d5ca34cb21e6a29b41", "eventDate": "2018-01-10T11:59:41.058+03:00", "eventType": "Vaccination", "dateEdited": "2018-03-16T10:03:01.148+03:00", "entityType": "vaccination", "locationId": "42abc582-6658-488b-922e-7be500c070f3", "providerId": "biddemo", "dateCreated": "2018-03-19T17:27:29.376+03:00", "identifiers": {"OPENMRS_UUID": "94ec8561-14ab-48d1-a6d4-4ae05191f6e6"}, "baseEntityId": "58b33379-dab2-4f5c-8f09-6d2bd63023d8", "serverVersion": 1521183593424, "formSubmissionId": "014413c8-4dbf-4876-977d-0c1dfb9e4d05"}', null), -(8, '{"_id": "05934ae338431f28bf6793b241bdc231", "obs": [{"values": ["2018-02-21"], "fieldCode": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "1685AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "date", "formSubmissionField": "penta_1", "humanReadableValues": []}, {"values": ["1"], "fieldCode": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "1685AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "calculate", "formSubmissionField": "penta_1_dose", "humanReadableValues": []}], "type": "Event", "version": 1521183602635, "duration": 0, "_rev": "2-ad81df44c1f2eaba862585dd8918a16e", "eventDate": "2018-02-21T11:59:50.145+03:00", "eventType": "Vaccination", "dateEdited": "2018-03-16T10:03:01.341+03:00", "entityType": "vaccination", "locationId": "42abc582-6658-488b-922e-7be500c070f3", "providerId": "biddemo", "dateCreated": "2018-03-19T17:27:29.385+03:00", "identifiers": {"OPENMRS_UUID": "85abab15-0be3-4a9d-962d-de99a920d3cb"}, "baseEntityId": "58b33379-dab2-4f5c-8f09-6d2bd63023d8", "serverVersion": 1521183593424, "formSubmissionId": "5f1b201d-2132-4eb9-8fa1-3169a61cc50a"}', null), -(9, '{"_id": "05934ae338431f28bf6793b241bdc3df", "obs": [{"values": ["2018-02-21"], "fieldCode": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "date", "formSubmissionField": "opv_1", "humanReadableValues": []}, {"values": ["1"], "fieldCode": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "783AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "calculate", "formSubmissionField": "opv_1_dose", "humanReadableValues": []}], "type": "Event", "version": 1521183602672, "duration": 0, "_rev": "2-9f892924c7e9afe675bdb9f9a3d6231f", "eventDate": "2018-02-21T11:59:55.977+03:00", "eventType": "Vaccination", "dateEdited": "2018-03-16T10:03:01.537+03:00", "entityType": "vaccination", "locationId": "42abc582-6658-488b-922e-7be500c070f3", "providerId": "biddemo", "dateCreated": "2018-03-19T17:27:29.390+03:00", "identifiers": {"OPENMRS_UUID": "28baa742-4a00-480f-9fff-12629c765cc2"}, "baseEntityId": "58b33379-dab2-4f5c-8f09-6d2bd63023d8", "team":"ATeam", "teamId":"3453hgb454-4j345n-llk345","serverVersion": 1521183593424, "formSubmissionId": "4bc04bbe-bb2f-4e4e-b123-0c6131b91fec"}', null), -(10, '{"_id": "05934ae338431f28bf6793b241bdc44a", "obs": [{"values": ["2018-02-21"], "fieldCode": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "159698AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "date", "formSubmissionField": "rota_1", "humanReadableValues": []}, {"values": ["1"], "fieldCode": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "159698AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "calculate", "formSubmissionField": "rota_1_dose", "humanReadableValues": []}], "type": "Event", "version": 1521183602735, "duration": 0, "_rev": "2-3514437b6b19290b16b49714bf0182e8", "eventDate": "2018-02-21T12:00:02.298+03:00", "eventType": "Vaccination", "dateEdited": "2018-03-16T10:03:01.729+03:00", "entityType": "vaccination", "locationId": "42abc582-6658-488b-922e-7be500c070f3", "providerId": "biddemo", "dateCreated": "2018-03-19T17:27:29.394+03:00", "identifiers": {"OPENMRS_UUID": "34701637-5c2f-4483-a05e-46df003990ef"}, "baseEntityId": "58b33379-dab2-4f5c-8f09-6d2bd63023d8","team":"ATeam", "teamId":"3453hgb454-4j345n-llk345", "serverVersion": 1521183593424, "formSubmissionId": "6947237c-5e2b-4ccd-953b-dd8b019e0484"}', null), -(11, '{"_id": "05934ae338431f28bf6793b241be69a5", "obs": [{"values": ["2018-02-21"], "fieldCode": "1410AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "date", "formSubmissionField": "pcv_1", "humanReadableValues": []}, {"values": ["1"], "fieldCode": "1418AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "162342AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldDataType": "calculate", "formSubmissionField": "pcv_1_dose", "humanReadableValues": []}], "type": "Event", "version": 1521183849328, "duration": 0, "_rev": "2-1ef09e6758ecd9f2adaa1eb35e143a7b", "eventDate": "2018-02-21T12:00:08.788+03:00", "eventType": "Vaccination", "dateEdited": "2018-03-16T10:13:03.469+03:00", "entityType": "vaccination", "locationId": "42abc582-6658-488b-922e-7be500c070f3", "providerId": "biddemo", "dateCreated": "2018-03-19T17:27:29.398+03:00", "identifiers": {"OPENMRS_UUID": "4aecc0c1-e008-4227-938d-66db17236a3d"}, "baseEntityId": "58b33379-dab2-4f5c-8f09-6d2bd63023d8", "team":"ATeam", "teamId":"3453hgb454-4j345n-llk345","serverVersion": 1521184133098, "formSubmissionId": "d6c08393-ebde-4faa-ac94-11429c1233dd"}', null), -(12, '{"_id": "05934ae338431f28bf6793b24177a1dc", "obs": [{"values": ["8.6"], "fieldCode": "5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "decimal", "formSubmissionField": "Weight_Kgs", "humanReadableValues": []}, {"values": ["-0.3160736521259359"], "fieldCode": "162584AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "calculation", "formSubmissionField": "Z_Score_Weight_Age", "humanReadableValues": []}], "type": "Event", "version": 1521468856705, "duration": 0, "_rev": "65-9ed92fd61bd67d89325ee3ea35c3f3cb", "eventDate": "2018-01-13T19:37:11.954+03:00", "eventType": "Growth Monitoring", "dateEdited": "2018-03-19T17:17:15.649+03:00", "entityType": "weight", "locationId": "42b88545-7ebb-4e11-8d1a-3d3a924c8af4", "providerId": "biddemo", "dateCreated": "2018-03-19T17:28:40.255+03:00", "identifiers": {}, "baseEntityId": "ea1f9439-a663-4073-93b9-6ef2b8bca3c1", "serverVersion": 1521469045587, "formSubmissionId": "306b6dc2-fa15-4e48-9ac3-4f8044899051"}', null), -(13, '{"_id": "05934ae338431f28bf6793b241780bac", "obs": [{"values": ["11.8"], "fieldCode": "5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "decimal", "formSubmissionField": "Weight_Kgs", "humanReadableValues": []}, {"values": ["2.0903075436287146"], "fieldCode": "162584AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "calculation", "formSubmissionField": "Z_Score_Weight_Age", "humanReadableValues": []}], "type": "Event", "version": 1521468857114, "duration": 0, "_rev": "65-81466693915e45bc1feb1f8ccc466475", "eventDate": "2018-03-12T19:40:01.023+03:00", "eventType": "Growth Monitoring", "dateEdited": "2018-03-19T17:17:15.789+03:00", "entityType": "weight", "locationId": "42b88545-7ebb-4e11-8d1a-3d3a924c8af4", "providerId": "biddemo", "dateCreated": "2018-03-19T17:28:40.260+03:00", "identifiers": {}, "baseEntityId": "ea1f9439-a663-4073-93b9-6ef2b8bca3c1", "serverVersion": 1521469045588, "formSubmissionId": "9bd94f7b-d7f5-4e38-bc0d-2fa7eb84dad3"}', null), -(14, '{"_id": "05934ae338431f28bf6793b241781149", "obs": [{"values": ["7.6"], "fieldCode": "5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "decimal", "formSubmissionField": "Weight_Kgs", "humanReadableValues": []}, {"values": ["0.10700349151262006"], "fieldCode": "162584AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "calculation", "formSubmissionField": "Z_Score_Weight_Age", "humanReadableValues": []}], "type": "Event", "version": 1521468857524, "duration": 0, "_rev": "65-9a91db1bb8e76c4c8a163c282c5d7479", "eventDate": "2017-09-06T19:40:24.702+03:00", "eventType": "Growth Monitoring", "dateEdited": "2018-03-19T17:17:15.929+03:00", "entityType": "weight", "locationId": "42b88545-7ebb-4e11-8d1a-3d3a924c8af5", "providerId": "biddemo2", "dateCreated": "2018-03-19T17:28:40.264+03:00", "identifiers": {}, "baseEntityId": "ea1f9439-a663-4073-93b9-6ef2b8bca3c1", "serverVersion": 1521469045589, "formSubmissionId": "31c4a45a-09f4-4b01-abe8-a87526827df6"}', null), -(15, '{"_id": "05934ae338431f28bf6793b241781a1e", "obs": [{"values": ["9.3"], "fieldCode": "5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "decimal", "formSubmissionField": "Weight_Kgs", "humanReadableValues": []}, {"values": ["1.0535868964441777"], "fieldCode": "162584AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "calculation", "formSubmissionField": "Z_Score_Weight_Age", "humanReadableValues": []}], "type": "Event", "version": 1521468857912, "duration": 0, "_rev": "65-bb37dd0fda12683a31217d1157d86539", "eventDate": "2017-11-06T19:42:02.327+03:00", "eventType": "Growth Monitoring", "dateEdited": "2018-03-19T17:17:16.069+03:00", "entityType": "weight", "locationId": "42b88545-7ebb-4e11-8d1a-3d3a924c8af5", "providerId": "biddemo2", "dateCreated": "2018-03-19T17:28:40.268+03:00", "identifiers": {}, "baseEntityId": "ea1f9439-a663-4073-93b9-6ef2b8bca3c1", "serverVersion": 1521469045590, "formSubmissionId": "3f66450e-2b66-43da-9b9b-dae5fced764f"}', null), -(20, '{"_id": "34166bde-2d40-4cb9-aec7-d8e4feb47c53", "obs": [{"values": ["ea0edc48-4752-4ad0-a834-f1f68c7ae310"], "fieldCode": "relational_id", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "relational_id", "humanReadableValues": []}, {"values": ["14-10-2019"], "fieldCode": "1427AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "last_menstrual_period", "humanReadableValues": []}, {"values": ["4 weeks"], "fieldCode": "gest_age_note", "fieldType": "formsubmissionField", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "gest_age_note", "humanReadableValues": []}, {"values": ["20-07-2020"], "fieldCode": "edd_note", "fieldType": "formsubmissionField", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "edd_note", "humanReadableValues": []}, {"values": ["4"], "fieldCode": "1438AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "gest_age", "humanReadableValues": []}, {"values": ["1"], "fieldCode": "no_prev_preg", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "no_prev_preg", "humanReadableValues": []}, {"values": ["2"], "fieldCode": "5624AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "gravida", "humanReadableValues": []}, {"values": ["1"], "fieldCode": "164894AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "no_surv_children", "humanReadableValues": []}, {"values": ["01712112332"], "fieldCode": "159635AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "phone_number", "humanReadableValues": []}, {"values": ["5555AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"], "fieldCode": "1054AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "select one", "formSubmissionField": "marital_status", "humanReadableValues": ["Married"]}, {"values": ["2019-11-14 18:57:08"], "fieldCode": "163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "start", "formSubmissionField": "start", "humanReadableValues": []}, {"values": ["2019-11-14 18:57:34"], "fieldCode": "163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "end", "formSubmissionField": "end", "humanReadableValues": []}, {"values": ["862349034710275"], "fieldCode": "163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "deviceid", "formSubmissionField": "deviceid", "humanReadableValues": []}, {"values": ["470010842368429"], "fieldCode": "163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "subscriberid", "formSubmissionField": "subscriberid", "humanReadableValues": []}, {"values": ["8988010408423684290f"], "fieldCode": "163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "simserial", "formSubmissionField": "simserial", "humanReadableValues": []}], "_rev": "v1", "team": "mPower", "type": "Event", "teamId": "3def4192-61ec-440d-af0b-d16ee1ecc262", "version": 1573736254643, "duration": 0, "eventDate": "2019-11-14T06:00:00.000+06:00", "eventType": "ANC Registration", "locationId": "e3170b23-bb22-42a4-875d-35c7f32c28ae", "providerId": "tanvir", "dateCreated": "2019-11-14T18:57:36.055+06:00", "identifiers": {}, "baseEntityId": "8a118521-126b-4d5e-9c3b-0b359671bbae", "serverVersion": 1573736256054, "formSubmissionId": "f5865190-0971-4e45-ae94-364de7b6ec73", "clientDatabaseVersion": 12, "clientApplicationVersion": 9}', null), -(21, '{"_id": "66c1ffdc-697c-4d31-b50d-6396ccb6368c", "obs": [{"values": ["2019-11-14 18:15:34"], "fieldCode": "163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "start", "formSubmissionField": "start", "humanReadableValues": []}, {"values": ["2019-11-14 18:19:07"], "fieldCode": "163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "end", "formSubmissionField": "end", "humanReadableValues": []}, {"values": ["862349034710275"], "fieldCode": "163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "deviceid", "formSubmissionField": "deviceid", "humanReadableValues": []}, {"values": ["470010842368429"], "fieldCode": "163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "subscriberid", "formSubmissionField": "subscriberid", "humanReadableValues": []}, {"values": ["8988010408423684290f"], "fieldCode": "163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "simserial", "formSubmissionField": "simserial", "humanReadableValues": []}], "_rev": "v1", "team": "mPower", "type": "Event", "teamId": "3def4192-61ec-440d-af0b-d16ee1ecc262", "version": 1573733948047, "duration": 0, "eventDate": "2019-11-14T06:00:00.000+06:00", "eventType": "Family Registration", "entityType": "ec_family", "locationId": "e3170b23-bb22-42a4-875d-35c7f32c28ae", "providerId": "tanvir", "dateCreated": "2019-11-14T18:19:13.534+06:00", "identifiers": {}, "baseEntityId": "ea0edc48-4752-4ad0-a834-f1f68c7ae310", "serverVersion": 1573733953533, "formSubmissionId": "128ad86c-522b-407c-9cbb-6e4d86f6dc44", "clientDatabaseVersion": 12, "clientApplicationVersion": 9}', null), -(22, '{"_id": "f9db43e1-1b15-4d26-ba56-29136edb73d6", "obs": [{"values": ["Moni"], "fieldCode": "", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "surname", "humanReadableValues": []}, {"values": ["Jahan"], "fieldCode": "", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "fam_name", "humanReadableValues": []}, {"values": ["1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"], "fieldCode": "159522AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "physically_challenged", "humanReadableValues": ["No"]}, {"values": ["2019-11-14 17:39:58"], "fieldCode": "163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "start", "formSubmissionField": "start", "humanReadableValues": []}, {"values": ["2019-11-14 17:40:14"], "fieldCode": "163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "end", "formSubmissionField": "end", "humanReadableValues": []}, {"values": ["862349034710275"], "fieldCode": "163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "deviceid", "formSubmissionField": "deviceid", "humanReadableValues": []}, {"values": ["470010842368429"], "fieldCode": "163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "subscriberid", "formSubmissionField": "subscriberid", "humanReadableValues": []}, {"values": ["8988010408423684290f"], "fieldCode": "163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "simserial", "formSubmissionField": "simserial", "humanReadableValues": []}], "_rev": "v1", "team": "ONA", "type": "Event", "teamId": "1d9effde-f745-45a0-bcc3-ae86424062cd", "version": 1573731614871, "duration": 0, "eventDate": "2019-11-14T06:00:00.000+06:00", "eventType": "Child Registration", "entityType": "ec_child", "locationId": "ce39f858-a2f6-4676-8db1-81fbb1891b01", "providerId": "ona", "dateCreated": "2019-11-14T17:40:23.102+06:00", "identifiers": {}, "baseEntityId": "98adc983-01e6-4755-b110-5111d98dbd45", "serverVersion": 1573731623102, "formSubmissionId": "2aa8df2d-65dd-4a7f-b2e1-6661f3e284f7", "clientDatabaseVersion": 12, "clientApplicationVersion": 9}', null), -(23, '{"_id": "18a43e36-5701-4afc-b901-8eb4ce0e2002", "obs": [{"values": ["2019-11-14 17:38:41"], "fieldCode": "163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "start", "formSubmissionField": "start", "humanReadableValues": []}, {"values": ["2019-11-14 17:39:30"], "fieldCode": "163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "end", "formSubmissionField": "end", "humanReadableValues": []}, {"values": ["862349034710275"], "fieldCode": "163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "deviceid", "formSubmissionField": "deviceid", "humanReadableValues": []}, {"values": ["470010842368429"], "fieldCode": "163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "subscriberid", "formSubmissionField": "subscriberid", "humanReadableValues": []}, {"values": ["8988010408423684290f"], "fieldCode": "163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "simserial", "formSubmissionField": "simserial", "humanReadableValues": []}], "_rev": "v1", "team": "ONA", "type": "Event", "teamId": "1d9effde-f745-45a0-bcc3-ae86424062cd", "version": 1573731570597, "duration": 0, "eventDate": "2019-11-14T06:00:00.000+06:00", "eventType": "Family Registration", "entityType": "ec_family", "locationId": "ce39f858-a2f6-4676-8db1-81fbb1891b01", "providerId": "ona", "dateCreated": "2019-11-14T17:39:37.864+06:00", "identifiers": {}, "baseEntityId": "f69de82f-0608-45c8-8347-6b7044aa8d8d", "serverVersion": 1573731577863, "formSubmissionId": "062f23c4-d464-4dee-a1c3-3fe80886238f", "clientDatabaseVersion": 12, "clientApplicationVersion": 9}', null), -(24, '{"_id": "cfcc0e7e3cef11eab77f2e728ce88125", "obs": [{"values": ["9.3"], "fieldCode": "5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "decimal", "formSubmissionField": "Weight_Kgs", "humanReadableValues": []}, {"values": ["1.0535868964441777"], "fieldCode": "162584AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "calculation", "formSubmissionField": "Z_Score_Weight_Age", "humanReadableValues": []}], "type": "Event", "version": 1521468857912, "duration": 0, "_rev": "65-bb37dd0fda12683a31217d1157d86532", "eventDate": "2017-11-06T19:42:02.327+03:00", "eventType": "Growth Monitoring", "dateEdited": "2018-03-19T17:17:16.069+03:00", "entityType": "weight", "locationId": "42b88545-7ebb-4e11-8d1a-3d3a924c8tyw", "providerId": "finddemo", "dateCreated": "2018-03-19T17:28:40.268+03:00", "identifiers": {}, "baseEntityId": "ea1f9439-a663-4073-93b9-6ef2b8bca453", "serverVersion": 1521469045590, "formSubmissionId": "3f66450e-2b66-43da-9b9b-dae5fcedrte2"}', '2018-03-19T17:17:16.069+03:00'), -(25, '{"_id": "d945f800-eeca-415e-b737-e5611e19f706", "obs": [{"values": ["22222222222"], "fieldCode": "163084AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "national_id", "humanReadableValues": []}, {"values": ["Haran"], "fieldCode": "", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "surname", "humanReadableValues": []}, {"values": ["01712332332"], "fieldCode": "159635AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "text", "formSubmissionField": "phone_number", "humanReadableValues": []}, {"values": [null], "fieldCode": "1712AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "select one", "formSubmissionField": "highest_edu_level", "humanReadableValues": ["Highest education level"]}, {"values": ["2019-11-14 18:15:34"], "fieldCode": "163137AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "start", "formSubmissionField": "start", "humanReadableValues": []}, {"values": ["2019-11-14 18:19:07"], "fieldCode": "163138AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "end", "formSubmissionField": "end", "humanReadableValues": []}, {"values": ["862349034710275"], "fieldCode": "163149AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "deviceid", "formSubmissionField": "deviceid", "humanReadableValues": []}, {"values": ["470010842368429"], "fieldCode": "163150AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "subscriberid", "formSubmissionField": "subscriberid", "humanReadableValues": []}, {"values": ["8988010408423684290f"], "fieldCode": "163151AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "fieldType": "concept", "parentCode": "", "fieldDataType": "simserial", "formSubmissionField": "simserial", "humanReadableValues": []}], "_rev": "v1", "team": "mPower", "type": "Event", "teamId": "3def4192-61ec-440d-af0b-d16ee1ecc262", "version": 1573733948056, "duration": 0, "eventDate": "2019-11-14T06:00:00.000+06:00", "eventType": "Family Member Registration", "entityType": "ec_family_member", "locationId": "e3170b23-bb22-42a4-875d-35c7f32c28ae", "providerId": "tanvir", "dateCreated": "2019-11-14T18:19:13.540+06:00", "identifiers": {}, "baseEntityId": "0830ce5e-21ff-4f28-8a67-d820f0ff15bc", "serverVersion": 1573733953534, "formSubmissionId": "49180e06-eed8-40b1-a9ea-c29c8b46c68a", "clientDatabaseVersion": 12, "clientApplicationVersion": 9}', null); - - -INSERT INTO core.event_metadata (id, event_id, document_id, base_entity_id, form_submission_id, server_version, openmrs_uuid, event_type, event_date, entity_type ,provider_id, location_id, team, team_id, date_created, date_edited, date_deleted) VALUES -(1, 1, '05934ae338431f28bf6793b2417696bf', 'ea1f9439-a663-4073-93b9-6ef2b8bca3c1', '29243014-48df-4165-a82d-f4878f6a830e', 1520945634380, null, 'Vaccination', '2018-03-13 17:42:03.326000', 'vaccination', 'biddemo', '42b88545-7ebb-4e11-8d1a-3d3a924c8af4', null, null, '2018-03-19 17:27:26.477000', null, null), -(2, 2, '05934ae338431f28bf6793b24199e690', '43930c23-c787-4ddb-ab76-770f77e7b17d', '6b3243e9-3d45-495c-af69-f012061def01', 1521016638453, 'd3630a60-a1f4-4267-9225-f4cb728f4178', 'Vaccination', '2018-03-14 03:00:00.000000', 'mother', 'biddemo', '42abc582-6658-488b-922e-7be500c070f3', null, null, '2018-03-19 17:27:28.717000', '2018-03-14 11:39:35.826000', null), -(3, 3, '05934ae338431f28bf6793b2419c64fb', 'ea1f9439-a663-4073-93b9-6ef2b8bca3c1', 'bfbfabe8-d4ae-4db2-940f-a6f126ef7829', 1521033533700, null, 'Vaccination', '2018-03-14 19:09:51.379000', 'vaccination', 'biddemo', '42b88545-7ebb-4e11-8d1a-3d3a924c8af4', null, null, '2018-03-19 17:27:28.750000', null, null), -(4, 4, '05934ae338431f28bf6793b2419c319a', 'ea1f9439-a663-4073-93b9-6ef2b8bca3c1', 'd960046a-e2a0-4bbf-b687-d41c2a52d8c8', 1521044588444, null, 'Vaccination', '2018-03-13 22:10:00.321000', 'vaccination', 'biddemo', '42b88545-7ebb-4e11-8d1a-3d3a924c8af4', null, null, '2018-03-19 17:27:29.019000', '2018-03-14 19:21:38.401000', null), -(5, 5, '05934ae338431f28bf6793b241bdb88c', '58b33379-dab2-4f5c-8f09-6d2bd63023d8', 'd59504cc-09ef-4d09-9dc3-8f7eb65882fd', 1521183592609, '06c8644b-b560-45fd-9af5-b6b1484e3504', 'Birth Registration', '2018-03-16 03:00:00.000000', 'child', 'biddemo', '42abc582-6658-488b-922e-7be500c070f3', null, null, '2018-03-19 17:27:29.364000', '2018-03-16 10:03:00.759000', null), -(6, 6, '05934ae338431f28bf6793b241bdbb60', '58b33379-dab2-4f5c-8f09-6d2bd63023d8', 'baf8e663-71a1-4a30-8d40-2f3cab45a6d7', 1521183593424, '35d6a414-a379-4ada-97ee-39f680eecb91', 'Vaccination', '2018-01-10 11:59:37.380000', 'vaccination', 'biddemo', '42abc582-6658-488b-922e-7be500c070f3', null, null, '2018-03-19 17:27:29.371000', '2018-03-16 10:03:00.949000', null), -(7, 7, '05934ae338431f28bf6793b241bdbc55', '58b33379-dab2-4f5c-8f09-6d2bd63023d8', '014413c8-4dbf-4876-977d-0c1dfb9e4d05', 1521183593424, '94ec8561-14ab-48d1-a6d4-4ae05191f6e6', 'Vaccination', '2018-01-10 11:59:41.058000', 'vaccination', 'biddemo', '42abc582-6658-488b-922e-7be500c070f3', null, null, '2018-03-19 17:27:29.376000', '2018-03-16 10:03:01.148000', null), -(8, 8, '05934ae338431f28bf6793b241bdc231', '58b33379-dab2-4f5c-8f09-6d2bd63023d8', '5f1b201d-2132-4eb9-8fa1-3169a61cc50a', 1521183593424, '85abab15-0be3-4a9d-962d-de99a920d3cb', 'Vaccination', '2018-02-21 11:59:50.145000', 'vaccination', 'biddemo', '42abc582-6658-488b-922e-7be500c070f3', null, null, '2018-03-19 17:27:29.385000', '2018-03-16 10:03:01.341000', null), -(9, 9, '05934ae338431f28bf6793b241bdc3df', '58b33379-dab2-4f5c-8f09-6d2bd63023d8', '4bc04bbe-bb2f-4e4e-b123-0c6131b91fec', 1521183593424, '28baa742-4a00-480f-9fff-12629c765cc2', 'Vaccination', '2018-02-21 11:59:55.977000', 'vaccination', 'biddemo', '42abc582-6658-488b-922e-7be500c070f3', 'ATeam', '3453hgb454-4j345n-llk345', '2018-03-19 17:27:29.390000', '2018-03-16 10:03:01.537000', null), -(10, 10, '05934ae338431f28bf6793b241bdc44a', '58b33379-dab2-4f5c-8f09-6d2bd63023d8', '6947237c-5e2b-4ccd-953b-dd8b019e0484', 1521183593424, '34701637-5c2f-4483-a05e-46df003990ef', 'Vaccination', '2018-02-21 12:00:02.298000', 'vaccination', 'biddemo', '42abc582-6658-488b-922e-7be500c070f3', 'ATeam', '3453hgb454-4j345n-llk345', '2018-03-19 17:27:29.394000', '2018-03-16 10:03:01.729000', null), -(11, 11, '05934ae338431f28bf6793b241be69a5', '58b33379-dab2-4f5c-8f09-6d2bd63023d8', 'd6c08393-ebde-4faa-ac94-11429c1233dd', 1521184133098, '4aecc0c1-e008-4227-938d-66db17236a3d', 'Vaccination', '2018-02-21 12:00:08.788000', 'vaccination', 'biddemo', '42abc582-6658-488b-922e-7be500c070f3', 'BTeam', '3453hgb454-4j345n-llk348', '2018-03-19 17:27:29.398000', '2018-03-16 10:13:03.469000', null), -(12, 12, '05934ae338431f28bf6793b24177a1dc', 'ea1f9439-a663-4073-93b9-6ef2b8bca3c1', '306b6dc2-fa15-4e48-9ac3-4f8044899051', 1521469045587, null, 'Growth Monitoring', '2018-01-13 19:37:11.954000', 'weight', 'biddemo', '42b88545-7ebb-4e11-8d1a-3d3a924c8af4', null, null, '2018-03-19 17:28:40.255000', '2018-03-19 17:17:15.649000', null), -(13, 13, '05934ae338431f28bf6793b241780bac', 'ea1f9439-a663-4073-93b9-6ef2b8bca3c1', '9bd94f7b-d7f5-4e38-bc0d-2fa7eb84dad3', 1521469045588, null, 'Growth Monitoring', '2018-03-12 19:40:01.023000', 'weight', 'biddemo', '42b88545-7ebb-4e11-8d1a-3d3a924c8af4', null, null, '2018-03-19 17:28:40.260000', '2018-03-19 17:17:15.789000', null), -(14, 14, '05934ae338431f28bf6793b241781149', 'ea1f9439-a663-4073-93b9-6ef2b8bca3c1', '31c4a45a-09f4-4b01-abe8-a87526827df6', 1521469045589, null, 'Growth Monitoring', '2017-09-06 19:40:24.702000', 'weight', 'biddemo2', '42b88545-7ebb-4e11-8d1a-3d3a924c8af5', null, null, '2018-03-19 17:28:40.264000', '2018-03-19 17:17:15.929000', null), -(15, 15, '05934ae338431f28bf6793b241781a1e', 'ea1f9439-a663-4073-93b9-6ef2b8bca3c1', '3f66450e-2b66-43da-9b9b-dae5fced764f', 1521469045590, null, 'Growth Monitoring', '2017-11-06 19:42:02.327000', 'weight', 'biddemo2', '42b88545-7ebb-4e11-8d1a-3d3a924c8af5', null, null, '2018-03-19 17:28:40.268000', '2018-03-19 17:17:16.069000', null), -(20, 20, '34166bde-2d40-4cb9-aec7-d8e4feb47c53', '8a118521-126b-4d5e-9c3b-0b359671bbae', 'f5865190-0971-4e45-ae94-364de7b6ec73', 1573736256054, null, 'ANC Registration', '2019-11-14 06:00:00', null, 'tanvir', 'e3170b23-bb22-42a4-875d-35c7f32c28ae', 'mPower', '3def4192-61ec-440d-af0b-d16ee1ecc262', '2019-11-14 18:57:36', null, null), -(21, 21, '66c1ffdc-697c-4d31-b50d-6396ccb6368c', 'ea0edc48-4752-4ad0-a834-f1f68c7ae310', '128ad86c-522b-407c-9cbb-6e4d86f6dc44', 1573733953533, null, 'Family Registration', '2019-11-14 06:00:00', 'ec_family', 'tanvir', 'e3170b23-bb22-42a4-875d-35c7f32c28ae', 'mPower', '3def4192-61ec-440d-af0b-d16ee1ecc262', '2019-11-14 18:57:36', null, null), -(22, 22, 'f9db43e1-1b15-4d26-ba56-29136edb73d6', '98adc983-01e6-4755-b110-5111d98dbd45', '2aa8df2d-65dd-4a7f-b2e1-6661f3e284f7', 1573731623102, null, 'Child Registration', '2019-11-14 06:00:00', 'ec_child', 'tanvir', 'ce39f858-a2f6-4676-8db1-81fbb1891b01', 'mPower', '3def4192-61ec-440d-af0b-d16ee1ecc262', '2019-11-14 17:40:23', null, null), -(23, 23, '18a43e36-5701-4afc-b901-8eb4ce0e2002', 'f69de82f-0608-45c8-8347-6b7044aa8d8d', '062f23c4-d464-4dee-a1c3-3fe80886238f', 1573731577863, null, 'Family Registration', '2019-11-14 06:00:00', 'ec_family', 'tanvir', 'ce39f858-a2f6-4676-8db1-81fbb1891b01', 'mPower', '3def4192-61ec-440d-af0b-d16ee1ecc262', '2019-11-14 17:39:37', null, null), -(24, 24, 'cfcc0e7e3cef11eab77f2e728ce88125', 'ea1f9439-a663-4073-93b9-6ef2b8bca3c1', '3f66450e-2b66-43da-9b9b-dae5fcedrte2', 1521469045590, null, 'Growth Monitoring', '2017-11-06 19:42:02.327000', 'weight', 'finddemo', '42b88545-7ebb-4e11-8d1a-3d3a924c8af5', null, null, '2018-03-19 17:28:40.268000', '2018-03-19 17:17:16.069000', '2018-03-19T17:17:16.069+03:00'), -(25, 25, 'd945f800-eeca-415e-b737-e5611e19f706', '0830ce5e-21ff-4f28-8a67-d820f0ff15bc', '49180e06-eed8-40b1-a9ea-c29c8b46c68a', 1573733953534, null, 'Family Member Registration', '2019-11-14 06:00:00', 'ec_family_member', 'tanvir', 'e3170b23-bb22-42a4-875d-35c7f32c28ae', 'mPower', '3def4192-61ec-440d-af0b-d16ee1ecc262', '2019-11-14 18:19:13', null, null); - - - diff --git a/opensrp-core/src/test/resources/test-scripts/location.sql b/opensrp-core/src/test/resources/test-scripts/location.sql deleted file mode 100644 index 0e9348a691..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/location.sql +++ /dev/null @@ -1,14 +0,0 @@ ---clear data -TRUNCATE TABLE core.location CASCADE; - -ALTER SEQUENCE core.location_id_seq RESTART WITH 6; - -ALTER SEQUENCE core.location_metadata_id_seq RESTART WITH 6; - -INSERT INTO core.location (id, json) VALUES (1, '{"id": "3734", "type": "Feature", "geometry": {"type": "MultiPolygon", "coordinates": [[[[32.59989007736522, -14.167432040756012], [32.599899215376524, -14.167521429770147], [32.59990104639621, -14.167611244163538], [32.599895558733124, -14.16770091736339], [32.59989008366051, -14.167739053114758], [32.59993602462787, -14.16775581827636], [32.600019423257834, -14.167793873088726], [32.60009945932262, -14.167838272618155], [32.60017562650404, -14.167888735376776], [32.60024744456398, -14.16794494480331], [32.60031445844555, -14.168006542967532], [32.60037624546743, -14.168073141362354], [32.60043241352514, -14.168144319105009], [32.6004826082858, -14.168219626534494], [32.60052651318807, -14.168298587010156], [32.60056384854283, -14.168380700508862], [32.60059438052627, -14.168465449920518], [32.600617914884936, -14.168552297450503], [32.60062693688366, -14.16860096246438], [32.600629671722004, -14.168608553641775], [32.600653206080665, -14.16869540117176], [32.60066959442628, -14.168783799132996], [32.600678733336906, -14.168873188147074], [32.60068056435659, -14.168963002540465], [32.600675075794186, -14.169052674840998], [32.60066230362247, -14.169141638475764], [32.60064232698187, -14.169229331368513], [32.60061527357607, -14.169315197738115], [32.60058131337695, -14.169398695293522], [32.6005406613225, -14.169479297031899], [32.60049357461884, -14.169556492138383], [32.600440351840795, -14.169629793180375], [32.60038132753629, -14.169698736107762], [32.60031687672256, -14.169762885648595], [32.60024740499381, -14.169821836208712], [32.60017335391722, -14.169875214569458], [32.600095189341566, -14.169922684384344], [32.600073628095515, -14.169933562583822], [32.60007671007219, -14.169963706060116], [32.600078541091875, -14.170053520453562], [32.60007305252941, -14.170143193653415], [32.600060280357695, -14.170232157288183], [32.600040303717094, -14.170319849281555], [32.60001324941197, -14.170405715651212], [32.599979289212854, -14.170489214105885], [32.59993897080693, -14.170569153943234], [32.599943946755786, -14.170617831547645], [32.599945777775474, -14.170707646840356], [32.59994028921301, -14.170797319140943], [32.59992751704135, -14.170886282775712], [32.59990754040069, -14.170973974769083], [32.59988048609562, -14.171059841138685], [32.5998465258965, -14.171143339593414], [32.59980587384205, -14.17122394043247], [32.59975878713834, -14.171301135538954], [32.59970556346104, -14.171374436580948], [32.59964653915648, -14.171443379508332], [32.59958208744342, -14.171507529049165], [32.59951261571467, -14.171566479609282], [32.59943856373877, -14.171619858869349], [32.59936039916312, -14.171667327784915], [32.599278615715605, -14.17170858778104], [32.59919373140565, -14.17174337715511], [32.599106283128485, -14.171771477371749], [32.59901682216866, -14.171792708566613], [32.59892591599828, -14.171806937640042], [32.5988341383848, -14.171814074659776], [32.59874206939105, -14.171814074659776], [32.598650291777574, -14.171806937640042], [32.59855938470787, -14.171792708566613], [32.59846992464736, -14.171771477371749], [32.59838247547094, -14.17174337715511], [32.5983273353383, -14.17172077809141], [32.59831050992216, -14.17173505572822], [32.59823645704688, -14.17178843408891], [32.59815829247128, -14.171835903903796], [32.59807650992303, -14.171877163899921], [32.597991625613076, -14.17191195327399], [32.59790417643665, -14.17194005259131], [32.597814715476765, -14.171961283786173], [32.59772380930639, -14.171975513758923], [32.59763203169297, -14.171982650778657], [32.59753996269916, -14.171982650778657], [32.59744818508574, -14.171975513758923], [32.597357278016034, -14.171961283786173], [32.59726781795547, -14.17194005259131], [32.59718036877905, -14.17191195327399], [32.597125046084045, -14.171889279566528], [32.59711651511515, -14.171899244054828], [32.59705206340203, -14.171963393595718], [32.59698259167334, -14.172022344155835], [32.59690853879806, -14.172075722516524], [32.59683037422246, -14.172123192331412], [32.596748590774894, -14.172164452327593], [32.596669124880236, -14.172197021275451], [32.59666535402294, -14.172199310949395], [32.596583571474696, -14.172240570945519], [32.59649868716474, -14.172275360319588], [32.59641123798832, -14.172303459636908], [32.596321777028436, -14.172324691731092], [32.59623087085805, -14.172338920804519], [32.59613909234531, -14.172346057824257], [32.5960470233515, -14.172346057824257], [32.595955245738025, -14.172338920804519], [32.59586433866832, -14.172324691731092], [32.595803283694636, -14.172310200954938], [32.59573533092083, -14.172367862786585], [32.59566127804561, -14.172421241147333], [32.59558311346996, -14.172468710062901], [32.59551500691208, -14.172503069560946], [32.59545514174147, -14.172546221730727], [32.59537697626649, -14.172593691545558], [32.59529519371824, -14.172634951541738], [32.59521030850897, -14.17266974091575], [32.59512285933255, -14.17269784023307], [32.59503339927198, -14.172719072327254], [32.59494249220228, -14.172733301400683], [32.59485071368954, -14.172740438420476], [32.59475864469573, -14.172740438420476], [32.59466686618299, -14.172733301400683], [32.594575960012605, -14.172719072327254], [32.59448649905272, -14.17269784023307], [32.59445585105675, -14.172687992656677], [32.59442677507565, -14.172690253552332], [32.59433470518257, -14.172690253552332], [32.5942429275691, -14.17268311653254], [32.59415202049939, -14.172668887459167], [32.594062559539566, -14.172647656264303], [32.59397511036309, -14.172619556946927], [32.593890226053134, -14.172584766673594], [32.59380844260562, -14.17254350667747], [32.593730278029966, -14.172496037761903], [32.593656225154746, -14.172442658501836], [32.593586753425996, -14.17238370794172], [32.593567544806376, -14.172364589254355], [32.59351203505241, -14.172317486362884], [32.593447582440035, -14.172253336821994], [32.59338855813547, -14.17218439389461], [32.593335334458175, -14.172111092852617], [32.59328824685514, -14.172033897746132], [32.59324759480069, -14.171953296907077], [32.593213634601625, -14.171869799351725], [32.5931865802965, -14.171783932082747], [32.5931666036559, -14.171696240089375], [32.59315383148419, -14.171607276454608], [32.59314834292172, -14.171517604154076], [32.5931501739414, -14.171427788861308], [32.59315931285203, -14.17133840074655], [32.59317570119771, -14.17125000278537], [32.59319923555631, -14.171163155255385], [32.59322976753981, -14.17107840584373], [32.593267104693155, -14.170996292344967], [32.59331100869616, -14.170917331869305], [32.59336120435614, -14.170842024439821], [32.59341737331317, -14.170770846697167], [32.59347916123437, -14.170704248302341], [32.59354617601525, -14.17064265013812], [32.593617994075196, -14.170586440711643], [32.593694163055204, -14.170535977952964], [32.59377420001937, -14.170491578423535], [32.593857599548635, -14.170453523611172], [32.59394383374098, -14.170422054534129], [32.594032357607254, -14.170397369942634], [32.594122611769194, -14.170379625419342], [32.594214026056534, -14.170368934278827], [32.5943060213059, -14.170365362171708], [32.59439801655525, -14.170368934278827], [32.594402085987554, -14.170369410020214], [32.59439156302028, -14.170336010998085], [32.594371587279, -14.170248319004656], [32.594358814207965, -14.17015935536989], [32.59435618369099, -14.170116383963887], [32.594347703084054, -14.170089466355762], [32.59432772734277, -14.170001773463014], [32.594314954271795, -14.169912809828245], [32.59430946660865, -14.169823137527715], [32.59431129672901, -14.169733323134324], [32.594320435639645, -14.169643934120245], [32.594336823985316, -14.16955553615901], [32.59436035834392, -14.169468688629022], [32.59439089032736, -14.169383940116688], [32.59442822658144, -14.16930182571866], [32.59447213148371, -14.169222865243], [32.59452232624443, -14.169147557813517], [32.59457849520146, -14.169076380070862], [32.59464028132396, -14.169009781676039], [32.5947072961049, -14.168948183511816], [32.59477911416485, -14.168891974984604], [32.59485528224553, -14.168841511326661], [32.59493531831032, -14.168797111797232], [32.595018716940274, -14.168759056984868], [32.59510495113261, -14.168727587907824], [32.595193474099574, -14.168702903316273], [32.5952837282615, -14.168685158792982], [32.59537514075021, -14.168674467652522], [32.59545842696491, -14.168671234589736], [32.5954623282239, -14.168656837343121], [32.5954928602074, -14.168572088830786], [32.595530195562105, -14.168489974432703], [32.59557410046443, -14.168411013957098], [32.595624295225086, -14.168335707426932], [32.595680463282804, -14.168264529684278], [32.59574225030468, -14.168197930390136], [32.595809264186244, -14.168136332225913], [32.59588108224619, -14.1680801236987], [32.59595725032687, -14.168029660040759], [32.596033266422175, -14.16798749083], [32.59606430112666, -14.167931676205853], [32.59611449588732, -14.16785636877637], [32.59617066394503, -14.167785191033715], [32.59623245006759, -14.167718592638892], [32.59629946394915, -14.167656993575347], [32.596371282009095, -14.167600785048137], [32.596447450089784, -14.167550322289514], [32.59652748525531, -14.167505922760085], [32.59661088388526, -14.167467867947721], [32.59669711717828, -14.167436398870677], [32.59678564014524, -14.167411714279126], [32.59687589340779, -14.167393969755835], [32.5969673058965, -14.167383278615375], [32.59705930024654, -14.1673797065082], [32.597151294596635, -14.167383278615375], [32.59724270708534, -14.167393969755835], [32.5973329603479, -14.167411714279126], [32.59742148331486, -14.167436398870677], [32.59746305357709, -14.16745156953425], [32.59747073828402, -14.167423210312847], [32.59750126936814, -14.167338461800512], [32.597508451353974, -14.167322665208815], [32.59752348801862, -14.167280928571927], [32.59752577679319, -14.16727248213931], [32.59755630787737, -14.167187732727655], [32.59759364413145, -14.16710561832957], [32.5976375481344, -14.16702665875323], [32.59768774289506, -14.166951351323744], [32.59774391095277, -14.16688017358109], [32.59780569707533, -14.166813574287005], [32.59787271005757, -14.166751976122782], [32.59794452811752, -14.16669576759557], [32.598020695298885, -14.166645303937571], [32.59810073136373, -14.166600904408142], [32.59818412909431, -14.166562850495096], [32.598270361488055, -14.166531381418054], [32.598358884455024, -14.166506696826557], [32.59844913681826, -14.166488952303268], [32.59852580672065, -14.166479984263844], [32.598559981857704, -14.166473265428806], [32.598651394346405, -14.166462574288346], [32.598743387797185, -14.166459002181169], [32.59883538214722, -14.166462574288346], [32.59892679373661, -14.166473265428806], [32.599017046999165, -14.166491009952097], [32.59910556996613, -14.166515694543648], [32.599191802359826, -14.166547163620635], [32.59927520009046, -14.166585218433056], [32.599355236155304, -14.166629617962426], [32.599431403336666, -14.166680081620425], [32.5995032204973, -14.16673629014764], [32.59957023437886, -14.166797888311862], [32.59963202050142, -14.16686448670663], [32.59968818855913, -14.166935664449284], [32.59973838331979, -14.167010971878824], [32.59978228732274, -14.167089932354429], [32.5998196226775, -14.167172046752512], [32.59985015466094, -14.167256795264848], [32.5998736890196, -14.167343642794833], [32.59989007736522, -14.167432040756012]]]]}, "properties": {"uid": "41587456-b7c8-4c4e-b433-23a786f742fc", "code": "3734", "name": "01_5", "type": "Intervention Unit", "status": "Active", "version": 0, "parentId": "21", "geographicLevel": 4, "effectiveStartDate": "2015-01-01T0000.000+03:00"},"serverVersion": 1542378347104}'); - -INSERT INTO core.location_metadata (id, location_id, geojson_id, type, parent_id, uuid, status, server_version) VALUES (1, 1, '3734', 'Intervention Unit', '21', '41587456-b7c8-4c4e-b433-23a786f742fc', 'ACTIVE', 1542378347104); - -INSERT INTO core.location (id, json) VALUES (2, '{"id": "3735", "type": "Feature", "geometry": {"type": "MultiPolygon", "coordinates": [[[[32.59989007736522, -14.167432040756012], [32.599899215376524, -14.167521429770147], [32.59990104639621, -14.167611244163538], [32.599895558733124, -14.16770091736339], [32.59989008366051, -14.167739053114758], [32.59993602462787, -14.16775581827636], [32.600019423257834, -14.167793873088726], [32.60009945932262, -14.167838272618155], [32.60017562650404, -14.167888735376776], [32.60024744456398, -14.16794494480331], [32.60031445844555, -14.168006542967532], [32.60037624546743, -14.168073141362354], [32.60043241352514, -14.168144319105009], [32.6004826082858, -14.168219626534494], [32.60052651318807, -14.168298587010156], [32.60056384854283, -14.168380700508862], [32.60059438052627, -14.168465449920518], [32.600617914884936, -14.168552297450503], [32.60062693688366, -14.16860096246438], [32.600629671722004, -14.168608553641775], [32.600653206080665, -14.16869540117176], [32.60066959442628, -14.168783799132996], [32.600678733336906, -14.168873188147074], [32.60068056435659, -14.168963002540465], [32.600675075794186, -14.169052674840998], [32.60066230362247, -14.169141638475764], [32.60064232698187, -14.169229331368513], [32.60061527357607, -14.169315197738115], [32.60058131337695, -14.169398695293522], [32.6005406613225, -14.169479297031899], [32.60049357461884, -14.169556492138383], [32.600440351840795, -14.169629793180375], [32.60038132753629, -14.169698736107762], [32.60031687672256, -14.169762885648595], [32.60024740499381, -14.169821836208712], [32.60017335391722, -14.169875214569458], [32.600095189341566, -14.169922684384344], [32.600073628095515, -14.169933562583822], [32.60007671007219, -14.169963706060116], [32.600078541091875, -14.170053520453562], [32.60007305252941, -14.170143193653415], [32.600060280357695, -14.170232157288183], [32.600040303717094, -14.170319849281555], [32.60001324941197, -14.170405715651212], [32.599979289212854, -14.170489214105885], [32.59993897080693, -14.170569153943234], [32.599943946755786, -14.170617831547645], [32.599945777775474, -14.170707646840356], [32.59994028921301, -14.170797319140943], [32.59992751704135, -14.170886282775712], [32.59990754040069, -14.170973974769083], [32.59988048609562, -14.171059841138685], [32.5998465258965, -14.171143339593414], [32.59980587384205, -14.17122394043247], [32.59975878713834, -14.171301135538954], [32.59970556346104, -14.171374436580948], [32.59964653915648, -14.171443379508332], [32.59958208744342, -14.171507529049165], [32.59951261571467, -14.171566479609282], [32.59943856373877, -14.171619858869349], [32.59936039916312, -14.171667327784915], [32.599278615715605, -14.17170858778104], [32.59919373140565, -14.17174337715511], [32.599106283128485, -14.171771477371749], [32.59901682216866, -14.171792708566613], [32.59892591599828, -14.171806937640042], [32.5988341383848, -14.171814074659776], [32.59874206939105, -14.171814074659776], [32.598650291777574, -14.171806937640042], [32.59855938470787, -14.171792708566613], [32.59846992464736, -14.171771477371749], [32.59838247547094, -14.17174337715511], [32.5983273353383, -14.17172077809141], [32.59831050992216, -14.17173505572822], [32.59823645704688, -14.17178843408891], [32.59815829247128, -14.171835903903796], [32.59807650992303, -14.171877163899921], [32.597991625613076, -14.17191195327399], [32.59790417643665, -14.17194005259131], [32.597814715476765, -14.171961283786173], [32.59772380930639, -14.171975513758923], [32.59763203169297, -14.171982650778657], [32.59753996269916, -14.171982650778657], [32.59744818508574, -14.171975513758923], [32.597357278016034, -14.171961283786173], [32.59726781795547, -14.17194005259131], [32.59718036877905, -14.17191195327399], [32.597125046084045, -14.171889279566528], [32.59711651511515, -14.171899244054828], [32.59705206340203, -14.171963393595718], [32.59698259167334, -14.172022344155835], [32.59690853879806, -14.172075722516524], [32.59683037422246, -14.172123192331412], [32.596748590774894, -14.172164452327593], [32.596669124880236, -14.172197021275451], [32.59666535402294, -14.172199310949395], [32.596583571474696, -14.172240570945519], [32.59649868716474, -14.172275360319588], [32.59641123798832, -14.172303459636908], [32.596321777028436, -14.172324691731092], [32.59623087085805, -14.172338920804519], [32.59613909234531, -14.172346057824257], [32.5960470233515, -14.172346057824257], [32.595955245738025, -14.172338920804519], [32.59586433866832, -14.172324691731092], [32.595803283694636, -14.172310200954938], [32.59573533092083, -14.172367862786585], [32.59566127804561, -14.172421241147333], [32.59558311346996, -14.172468710062901], [32.59551500691208, -14.172503069560946], [32.59545514174147, -14.172546221730727], [32.59537697626649, -14.172593691545558], [32.59529519371824, -14.172634951541738], [32.59521030850897, -14.17266974091575], [32.59512285933255, -14.17269784023307], [32.59503339927198, -14.172719072327254], [32.59494249220228, -14.172733301400683], [32.59485071368954, -14.172740438420476], [32.59475864469573, -14.172740438420476], [32.59466686618299, -14.172733301400683], [32.594575960012605, -14.172719072327254], [32.59448649905272, -14.17269784023307], [32.59445585105675, -14.172687992656677], [32.59442677507565, -14.172690253552332], [32.59433470518257, -14.172690253552332], [32.5942429275691, -14.17268311653254], [32.59415202049939, -14.172668887459167], [32.594062559539566, -14.172647656264303], [32.59397511036309, -14.172619556946927], [32.593890226053134, -14.172584766673594], [32.59380844260562, -14.17254350667747], [32.593730278029966, -14.172496037761903], [32.593656225154746, -14.172442658501836], [32.593586753425996, -14.17238370794172], [32.593567544806376, -14.172364589254355], [32.59351203505241, -14.172317486362884], [32.593447582440035, -14.172253336821994], [32.59338855813547, -14.17218439389461], [32.593335334458175, -14.172111092852617], [32.59328824685514, -14.172033897746132], [32.59324759480069, -14.171953296907077], [32.593213634601625, -14.171869799351725], [32.5931865802965, -14.171783932082747], [32.5931666036559, -14.171696240089375], [32.59315383148419, -14.171607276454608], [32.59314834292172, -14.171517604154076], [32.5931501739414, -14.171427788861308], [32.59315931285203, -14.17133840074655], [32.59317570119771, -14.17125000278537], [32.59319923555631, -14.171163155255385], [32.59322976753981, -14.17107840584373], [32.593267104693155, -14.170996292344967], [32.59331100869616, -14.170917331869305], [32.59336120435614, -14.170842024439821], [32.59341737331317, -14.170770846697167], [32.59347916123437, -14.170704248302341], [32.59354617601525, -14.17064265013812], [32.593617994075196, -14.170586440711643], [32.593694163055204, -14.170535977952964], [32.59377420001937, -14.170491578423535], [32.593857599548635, -14.170453523611172], [32.59394383374098, -14.170422054534129], [32.594032357607254, -14.170397369942634], [32.594122611769194, -14.170379625419342], [32.594214026056534, -14.170368934278827], [32.5943060213059, -14.170365362171708], [32.59439801655525, -14.170368934278827], [32.594402085987554, -14.170369410020214], [32.59439156302028, -14.170336010998085], [32.594371587279, -14.170248319004656], [32.594358814207965, -14.17015935536989], [32.59435618369099, -14.170116383963887], [32.594347703084054, -14.170089466355762], [32.59432772734277, -14.170001773463014], [32.594314954271795, -14.169912809828245], [32.59430946660865, -14.169823137527715], [32.59431129672901, -14.169733323134324], [32.594320435639645, -14.169643934120245], [32.594336823985316, -14.16955553615901], [32.59436035834392, -14.169468688629022], [32.59439089032736, -14.169383940116688], [32.59442822658144, -14.16930182571866], [32.59447213148371, -14.169222865243], [32.59452232624443, -14.169147557813517], [32.59457849520146, -14.169076380070862], [32.59464028132396, -14.169009781676039], [32.5947072961049, -14.168948183511816], [32.59477911416485, -14.168891974984604], [32.59485528224553, -14.168841511326661], [32.59493531831032, -14.168797111797232], [32.595018716940274, -14.168759056984868], [32.59510495113261, -14.168727587907824], [32.595193474099574, -14.168702903316273], [32.5952837282615, -14.168685158792982], [32.59537514075021, -14.168674467652522], [32.59545842696491, -14.168671234589736], [32.5954623282239, -14.168656837343121], [32.5954928602074, -14.168572088830786], [32.595530195562105, -14.168489974432703], [32.59557410046443, -14.168411013957098], [32.595624295225086, -14.168335707426932], [32.595680463282804, -14.168264529684278], [32.59574225030468, -14.168197930390136], [32.595809264186244, -14.168136332225913], [32.59588108224619, -14.1680801236987], [32.59595725032687, -14.168029660040759], [32.596033266422175, -14.16798749083], [32.59606430112666, -14.167931676205853], [32.59611449588732, -14.16785636877637], [32.59617066394503, -14.167785191033715], [32.59623245006759, -14.167718592638892], [32.59629946394915, -14.167656993575347], [32.596371282009095, -14.167600785048137], [32.596447450089784, -14.167550322289514], [32.59652748525531, -14.167505922760085], [32.59661088388526, -14.167467867947721], [32.59669711717828, -14.167436398870677], [32.59678564014524, -14.167411714279126], [32.59687589340779, -14.167393969755835], [32.5969673058965, -14.167383278615375], [32.59705930024654, -14.1673797065082], [32.597151294596635, -14.167383278615375], [32.59724270708534, -14.167393969755835], [32.5973329603479, -14.167411714279126], [32.59742148331486, -14.167436398870677], [32.59746305357709, -14.16745156953425], [32.59747073828402, -14.167423210312847], [32.59750126936814, -14.167338461800512], [32.597508451353974, -14.167322665208815], [32.59752348801862, -14.167280928571927], [32.59752577679319, -14.16727248213931], [32.59755630787737, -14.167187732727655], [32.59759364413145, -14.16710561832957], [32.5976375481344, -14.16702665875323], [32.59768774289506, -14.166951351323744], [32.59774391095277, -14.16688017358109], [32.59780569707533, -14.166813574287005], [32.59787271005757, -14.166751976122782], [32.59794452811752, -14.16669576759557], [32.598020695298885, -14.166645303937571], [32.59810073136373, -14.166600904408142], [32.59818412909431, -14.166562850495096], [32.598270361488055, -14.166531381418054], [32.598358884455024, -14.166506696826557], [32.59844913681826, -14.166488952303268], [32.59852580672065, -14.166479984263844], [32.598559981857704, -14.166473265428806], [32.598651394346405, -14.166462574288346], [32.598743387797185, -14.166459002181169], [32.59883538214722, -14.166462574288346], [32.59892679373661, -14.166473265428806], [32.599017046999165, -14.166491009952097], [32.59910556996613, -14.166515694543648], [32.599191802359826, -14.166547163620635], [32.59927520009046, -14.166585218433056], [32.599355236155304, -14.166629617962426], [32.599431403336666, -14.166680081620425], [32.5995032204973, -14.16673629014764], [32.59957023437886, -14.166797888311862], [32.59963202050142, -14.16686448670663], [32.59968818855913, -14.166935664449284], [32.59973838331979, -14.167010971878824], [32.59978228732274, -14.167089932354429], [32.5998196226775, -14.167172046752512], [32.59985015466094, -14.167256795264848], [32.5998736890196, -14.167343642794833], [32.59989007736522, -14.167432040756012]]]]}, "properties": {"uid": "41587456-b7c8-4c4e-b433-23a786f74wer", "code": "3734", "name2": "01_5", "type": "Intervention Unit", "status": "Active", "version": 0, "parentId": "3734", "geographicLevel": 4, "effectiveStartDate": "2015-01-01T0000.000+03:00"},"serverVersion": -1 }'); - -INSERT INTO core.location_metadata (id, location_id, geojson_id, type, parent_id, uuid, status, server_version) VALUES (2, 2, '3735', 'Intervention Unit 2', '3734', '41587456-b7c8-4c4e-b433-23a786f742fc', 'ACTIVE', -1); diff --git a/opensrp-core/src/test/resources/test-scripts/multimedia.sql b/opensrp-core/src/test/resources/test-scripts/multimedia.sql deleted file mode 100644 index 561e1b2d52..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/multimedia.sql +++ /dev/null @@ -1,11 +0,0 @@ ---clear data -TRUNCATE TABLE core.multi_media; - -ALTER SEQUENCE core.multi_media_id_seq RESTART WITH 6; - -INSERT INTO core.multi_media (id, document_id, case_id, provider_id, content_type, file_path, file_category) VALUES -(1, '05934ae338431f28bf6793b241f0c5ca', '040d4f18-8140-479c-aa21-725612073490', 'biddemo', 'image/jpeg', '/opt/multimedia/patient_images/040d4f18-8140-479c-aa21-725612073490.jpg', 'profilepic'), -(2, '317f8db1bb6cc4b15ecc9993a282bc2f', '3c07c42c-6aee-4eb9-8db3-0aae3eac8f6d', 'biddemo', 'image/jpeg', '/opt/multimedia/patient_images/3c07c42c-6aee-4eb9-8db3-0aae3eac8f6d.jpg', 'profilepic'), -(3, '091488163b6ecd589a915372a0ad3b0d', '87dc3230-84f7-4088-b257-e8b3130ab86b', 'biddemo', 'image/jpeg', '/opt/multimedia/patient_images/87dc3230-84f7-4088-b257-e8b3130ab86b.jpg', 'profilepic'), -(4, '3157f9339bf0c948dd5d12aff82111e1', '01503901-5acb-45fb-affe-839ac39d200d', 'biddemo', 'image/jpeg', '/opt/multimedia/patient_images/01503901-5acb-45fb-affe-839ac39d200d.jpg', 'profilepic'), -(5, '317f8db1bb6cc4b15ecc9993a2922f47', '24eec0d8-e0ee-4f22-9d6b-3cca84bdefcf', 'tester11', 'image/jpeg', '/opt/multimedia/patient_images/24eec0d8-e0ee-4f22-9d6b-3cca84bdefcf.jpg', 'profilepic'); diff --git a/opensrp-core/src/test/resources/test-scripts/organization.sql b/opensrp-core/src/test/resources/test-scripts/organization.sql deleted file mode 100644 index d3ad8c68f9..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/organization.sql +++ /dev/null @@ -1,28 +0,0 @@ ---clear data -TRUNCATE TABLE team.organization CASCADE; -TRUNCATE TABLE team.organization_location CASCADE; -TRUNCATE TABLE core.location CASCADE; -TRUNCATE TABLE core.plan CASCADE; - -ALTER SEQUENCE team.organization_id_seq RESTART WITH 4; -ALTER SEQUENCE team.organization_location_id_seq RESTART WITH 4; - -INSERT INTO team.organization (id, identifier, active, name, type, date_deleted, parent_id) VALUES (1, 'fcc19470-d599-11e9-bb65-2a2ae2dbcce4', true, 'The Luang', '{"coding": [{"code": "team", "system": "http://terminology.hl7.org/CodeSystem/organization-type", "display": "Team"}]}', null, null); -INSERT INTO team.organization (id, identifier, active, name, type, date_deleted, parent_id) VALUES (3, '4c506c98-d3a9-11e9-bb65-2a2ae2dbcce4', true, 'Demo Team', null, null, null); -INSERT INTO team.organization (id, identifier, active, name, type, date_deleted, parent_id) VALUES (2, 'd23f7350-d406-11e9-bb65-2a2ae2dbcce4', true, 'Takang 1', '{"coding": [{"code": "team", "system": "http://terminology.hl7.org/CodeSystem/organization-type", "display": "Team"}]}', null, 1); - - - -INSERT INTO core.location (id, json) VALUES (2243, '{"id": "304cbcd4-0850-404a-a8b1-486b02f7b84d", "type": "Feature", "properties": {"name": "TLv1_02", "status": "Active", "version": 0, "parentId": "dad42fa6-b9b8-4658-bf25-bfa7ab5b16ae", "OpenMRS_Id": "de28c78d-3111-4266-957b-c731a3330c1d", "geographicLevel": 4}, "serverVersion": 1568331709467}'); -INSERT INTO core.location (id, json) VALUES (224, '{"id": "3270", "type": "Feature", "geometry": {"type": "MultiPolygon"}, "properties": {"name": "NYJ_6", "status": "Active", "version": 0, "parentId": "2977", "geographicLevel": 2}, "serverVersion": 1545220000265}'); -INSERT INTO core.location_metadata (id, location_id, geojson_id, type, parent_id, uuid, status, server_version, name) VALUES (2243, 2243, '304cbcd4-0850-404a-a8b1-486b02f7b84d', null, 'dad42fa6-b9b8-4658-bf25-bfa7ab5b16ae', null, 'ACTIVE', 1568331709467, 'TLv1_02'); -INSERT INTO core.location_metadata (id, location_id, geojson_id, type, parent_id, uuid, status, server_version, name) VALUES (224, 224, '3270', null, '2977', null, 'ACTIVE', 1545220000265, 'NYJ_6'); - -INSERT INTO core.plan (identifier, json, date_deleted, server_version, id) VALUES ('36adfd55-3a61-4fcf-be39-3c9ccb2ffd78', '{}', null, 1567765433007, 162); -INSERT INTO core.plan (identifier, json, date_deleted, server_version, id) VALUES ('9d1403a5-756d-517b-91d6-5b19059a69f0', '{}', null, 1567765433007, 11); -INSERT INTO core.plan (identifier, json, date_deleted, server_version, id) VALUES ('7f2ae03f-9569-5535-918c-9d976b3ae5f8', '{}', null, 1567765433007, 294); - - -INSERT INTO team.organization_location (id, organization_id, location_id, plan_id, from_date, to_date) VALUES (1, 1, 2243, 162, '2019-09-10 17:29:55.059000', '2021-09-10 17:29:55.059000'); -INSERT INTO team.organization_location (id, organization_id, location_id, plan_id, from_date, to_date) VALUES (2, 1, 2243, 11, '2019-09-10 17:29:55.059000', '2021-09-10 17:29:55.059000'); -INSERT INTO team.organization_location (id, organization_id, location_id, plan_id, from_date, to_date) VALUES (3, 2, 2243, 294, '2019-09-10 17:29:55.059000', '2021-09-10 17:29:55.059000'); \ No newline at end of file diff --git a/opensrp-core/src/test/resources/test-scripts/practitioner.sql b/opensrp-core/src/test/resources/test-scripts/practitioner.sql deleted file mode 100644 index 26294d88b7..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/practitioner.sql +++ /dev/null @@ -1,11 +0,0 @@ ---clear data -TRUNCATE TABLE team.organization CASCADE; - --- insert data -INSERT INTO team.organization (id, identifier, active, name) VALUES -(1,'org1',TRUE,'Org 1'); - - -INSERT INTO team.practitioner (id, identifier, active, name, user_id, username) VALUES -(1,'p1-identifier',TRUE,'first practitioner','1','p1'), -(2,'p2-identifier',TRUE,'second practitioner','2','p2'); diff --git a/opensrp-core/src/test/resources/test-scripts/report.sql b/opensrp-core/src/test/resources/test-scripts/report.sql deleted file mode 100644 index c7e0575cde..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/report.sql +++ /dev/null @@ -1,22 +0,0 @@ ---clear data -TRUNCATE TABLE core.report CASCADE; - -ALTER SEQUENCE core.report_id_seq RESTART WITH 6; - -ALTER SEQUENCE core.report_metadata_id_seq RESTART WITH 6; - ---insert data - -INSERT INTO core.report (id, json) VALUES -(1, '{"_id": "07271855-4018-497a-b180-6af01f0fa62b", "baseEntityId": "6654kk-mnj45-mmnfgd-l45645" , "type": "Report", "status": "ERROR", "version": 1503312366265, "duration": 0, "addresses": [], "attributes": {}, "dateEdited": "2017-08-21T13:46:32.331+03:00", "locationId": "b0781dd2-e1b1-4878-8e6c-fba488eb9fa3", "providerId": "biddemo", "reportDate": "2017-06-28T01:00:00.000+03:00", "reportType": "HIA2", "identifiers": {"HIN":"1121K"}, "serverVersion": 1503312366265, "hia2Indicators": [{"label": "RV 2 (< 1 year) at facility", "value": "2", "dhisId": "dpKLNY9JjRR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 2 dose at this facility in this month ", "indicatorCode": "CHN3-070"}, {"label": "Vitamin A supplement to infants and children 12-59 months", "value": "0", "dhisId": "JfY9vBHsyzF", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children age 12-59 months who received vitamin A at this facility in this month", "indicatorCode": "CHN2-070"}, {"label": "Child weighed 24-59 months", "value": "0", "dhisId": "sSxqU6qPyXr", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children weighed aged 24-59 months who attended clinic this month", "indicatorCode": "CHN2-010"}, {"label": "RV 1 (< 1 year) at facility", "value": "2", "dhisId": "ziezVvnYWj0", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 1 dose at this facility in this month ", "indicatorCode": "CHN3-065"}, {"label": "Number of days fridge non-functional", "value": "0", "dhisId": "FGJcw1TCM9D", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of days during the month that vaccine storage fridge was not functioning ", "indicatorCode": "CHN3-090"}, {"label": "Attendance child health 12-59 months (female)", "value": "0", "dhisId": "ZDSUD6VHnoh", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of female children aged 12 to 59 months who attended a clinic this month", "indicatorCode": "CHN1-020"}, {"label": "PCV 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-050-O"}, {"label": "OPV 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-020-O"}, {"label": "IPV (< 1 year) at facility", "value": "10", "dhisId": "D2pqQ1bux6B", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received IPV dose at this facility in this month ", "indicatorCode": "CHN3-027"}, {"label": "OPV 3 (< 1 year) at facility ", "value": "0", "dhisId": "dqsYPg0F8DJ", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV3 dose at this facility in this month ", "indicatorCode": "CHN3-025"}, {"label": "Weight below -3Z scores 24-59 months", "value": "0", "dhisId": "AzLJv6qTtPO", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 24-59 months whose weight is below -3Z scores", "indicatorCode": "CHN2-050"}, {"label": "Attendance child health 12-59 months (total)", "value": "0", "dhisId": "sZQXZ069Vgj", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of Total children aged 12 to 59 months who attended clinic this month", "indicatorCode": "CHN1-021"}, {"label": "OPV 0 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV0 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-010-O"}, {"label": "Not gaining weight 0-23 months", "value": "0", "dhisId": "H5cadfqRh7I", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children aged 0-23 months who were weighed this month who did not gain >= 100g of weight from the last weigh-in. ", "indicatorCode": "CHN2-020"}, {"label": "BCG dose (< 1 year) at the facility", "value": "1", "dhisId": "ZTeQmMrVmNR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received BCG dose at this facility in this month ", "indicatorCode": "CHN3-005"}, {"label": "Attendance child health (total)", "value": "43", "dhisId": "YAY7yKAkSvq", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children < 5 who attended a clinic this month ", "indicatorCode": "CHN1-025"}, {"label": "Attendance child health 12-59 months (male)", "value": "0", "dhisId": "fl4bPFJRI5j", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of male children aged 12 to 59 months who attended a clinic this month", "indicatorCode": "CHN1-015"}, {"label": "Total weight below -3Z scores < five years", "value": "0", "dhisId": "OM9x7oS2qke", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age < 5 years whose weight below -3Z scores", "indicatorCode": "CHN2-051"}, {"label": "Weight between -2Z & -3Z scores < five years", "value": "0", "dhisId": "WOZUqhR5W37", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age < 5 years whose weight is between -2Z and -3Z scores", "indicatorCode": "CHN2-041"}, {"label": "Weight above 2Z scores 24-59 months", "value": "0", "dhisId": "ke26q8KPQPM", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 24-59 months whose weight is above 2Z scores", "indicatorCode": "CHN2-060"}, {"label": "Attendance child health < 12 months (male)", "value": "22", "dhisId": "n0uHub5ubqH", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of male children aged < 12 months who attended a clinic this month.", "indicatorCode": "CHN1-005"}, {"label": "Fully immunised (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "\"Number of children < one year who have received the complete BCG", "indicatorCode": "CHN3-080-O"}, {"label": "OPV 2 (< 1 year) at facility ", "value": "2", "dhisId": "Jbxssr389B6", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV2 dose at this facility in this month ", "indicatorCode": "CHN3-020"}, {"label": "Child weighed 0-23 months", "value": "0", "dhisId": "adkGrSGNt3L", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children weighed aged 0-23 months who attended clinic this month", "indicatorCode": "CHN2-005"}, {"label": "Vitamin A supplement to infants and children 6-11 months", "value": "0", "dhisId": "DSbbltBORY3", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children age 6-11 months who received vitamin A at this facility in this month", "indicatorCode": "CHN2-065"}, {"label": "Deworming dose 12-59 months", "value": "0", "dhisId": "B8nBT4kGhtB", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children age 12-59 months who received a deworming dose at this facility in this month ", "indicatorCode": "CHN2-075"}, {"label": "Fully immunised (< 1 year) at facility", "value": "14", "dhisId": "dzllAar6RrI", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "\"Number of children < one year who have received the complete BCG", "indicatorCode": "CHN3-080"}, {"label": "Total weight above 2Z scores < five years", "value": "0", "dhisId": "Yi4grVdr9Q5", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age < 5 years whose weight is above 2Z scores", "indicatorCode": "CHN2-061"}, {"label": "DPT-Hib-HepB 1 (< 1 year) at facility", "value": "2", "dhisId": "N7VEEjo8AdV", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 1 dose at this facility in this month ", "indicatorCode": "CHN3-035"}, {"label": "Measles/MR 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received Measles/ MR dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-075-O"}, {"label": "OPV 4 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV4 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-030-O"}, {"label": "OPV 4 (< 1 year) at facility ", "value": "0", "dhisId": "poPXN7Wn3RL", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV4 dose at this facility in this month ", "indicatorCode": "CHN3-030"}, {"label": "Weight between -2Z & -3Z scores 0-23 months", "value": "0", "dhisId": "lcpx7xdVC3z", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 0-23 months whose weight is between -2Z and -3Z scores", "indicatorCode": "CHN2-035"}, {"label": "OPV 0 (< 1 year) at facility ", "value": "1", "dhisId": "rwNWKJC4dIO", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV0 dose at this facility in this month ", "indicatorCode": "CHN3-010"}, {"label": "Weight below -3Z scores 0-23 months", "value": "0", "dhisId": "LpkrzZezPhP", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 0-23 months whose weight is below -3Z scores", "indicatorCode": "CHN2-045"}, {"label": "Total not gaining weight age < five years", "value": "0", "dhisId": "e10sC5c4pRz", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children aged < five years who were weighed this month and did not gain >= 100g from the last weigh-in.", "indicatorCode": "CHN2-030"}, {"label": "Attendance child health < 12 months (female)", "value": "21", "dhisId": "IWwblgpMxiS", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of female children aged < 12 months who attended a clinic this month.", "indicatorCode": "CHN1-010"}, {"label": "PCV 3 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 3 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-060-O"}, {"label": "RV 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-070-O"}, {"label": "Not gaining weight 24-59 months", "value": "0", "dhisId": "xWDkbLq9kji", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children aged 24-59 months who were weighed this month who did not gain >= 100g of weight from the last weigh-in. ", "indicatorCode": "CHN2-025"}, {"label": "Attendance from outside catchment area", "value": "0", "dhisId": "WFxN7txijYV", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children who attended clinic and are not part of clinics catchment area", "indicatorCode": "CHN1-030"}, {"label": "IPV (< 1 year) at outreach", "value": "10", "dhisId": "RAbXk70XDMq", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received IPV dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-027-O"}, {"label": "Children who received insecticide treated net", "value": "0", "dhisId": "G4vWZAJ0uz7", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children who received insecticide treated nets at this facility in this month ", "indicatorCode": "CHN2-080"}, {"label": "Weight between -2Z & -3Z scores 24-59 months", "value": "0", "dhisId": "hi9sRtkzimM", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 24-59 months whose weight is between -2Z and -3Z scores", "indicatorCode": "CHN2-040"}, {"label": "OPV 1 (< 1 year) at facility ", "value": "1", "dhisId": "J3Kd9wHj7mR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV1 dose at this facility in this month ", "indicatorCode": "CHN3-015"}, {"label": "Attendance child health < 12 months (total)", "value": "43", "dhisId": "C8vB7dH9ab4", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children aged < 12 months who attended a clinic this month.", "indicatorCode": "CHN1-011"}, {"label": "DPT-Hib-HepB 2 (< 1 year) at facility", "value": "2", "dhisId": "R2JLWtup2XR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 2 dose at this facility in this month ", "indicatorCode": "CHN3-040"}, {"label": "RV 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-065-O"}, {"label": "PCV 1 (< 1 year) at facilty", "value": "1", "dhisId": "dPpDhpO7GpB", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 1 dose at this facility in this month ", "indicatorCode": "CHN3-050"}, {"label": "DPT-Hib-HepB 3 (< 1 year) at facility", "value": "0", "dhisId": "ujEvTSZ0Wvn", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 3 dose at this facility in this month ", "indicatorCode": "CHN3-045"}, {"label": "Measles/MR 2 (at 18 months) at facility", "value": "0", "dhisId": "sqfX5MniMIH", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children at 18 months who received Measles/ MR 2 dose at this facility in this month ", "indicatorCode": "CHN3-085"}, {"label": "BCG dose (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received BCG dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-005-O"}, {"label": "DPT-Hib-HepB 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-040-O"}, {"label": "Weight above 2Z scores 0-23 months", "value": "0", "dhisId": "gdrQ69fCF8B", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 0-23 months whose weight is above 2Z scores", "indicatorCode": "CHN2-055"}, {"label": "Total child weighed", "value": "0", "dhisId": "xIGHv5CY2fF", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children weighed aged < 5 years who attended clinic this month", "indicatorCode": "CHN2-015"}, {"label": "DPT-Hib-HepB 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-035-O"}, {"label": "Measles/MR 1 (< 1 year) at facility", "value": "0", "dhisId": "zIM9ehVMkNW", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received Measles/ MR 1 dose at this facility in this month ", "indicatorCode": "CHN3-075"}, {"label": "Measles/MR 2 (at 18 months) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children at 18 months who received Measles/ MR 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-085-O"}, {"label": "PCV 3 (< 1 year) at facility", "value": "0", "dhisId": "K5XarM6QLxq", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 3 dose at this facility in this month ", "indicatorCode": "CHN3-060"}, {"label": "DPT-Hib-HepB 3 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 3 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-045-O"}, {"label": "OPV 3 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV3 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-025-O"}, {"label": "OPV 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-015-O"}, {"label": "PCV 2 (< 1 year) at facilty", "value": "2", "dhisId": "AU3Zp03Atnf", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 2 dose at this facility in this month ", "indicatorCode": "CHN3-055"}, {"label": "PCV 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-055-O"}], "formSubmissionId": "7073cef4-b974-4910-afa7-dd2ccadba089"}'), -(2, '{"_id": "ecafd20f-c95b-4046-9355-9512e1908da4", "baseEntityId": "678343544-nhj7-jghdfgfd-mkjdkfg" ,"type": "Report", "status": "WARNING", "version": 1500056613263, "duration": 0, "addresses": [], "attributes": {}, "dateEdited": "2017-07-17T18:38:43.492+03:00", "locationId": "9e4fc064-d8e7-4fcb-942e-cbcf6524fb24", "providerId": "biddemo", "reportDate": "2017-07-14T21:23:52.478+03:00", "reportType": "HIA2", "identifiers": {"WHO_R":"5934343"}, "serverVersion": 1500056613263, "hia2Indicators": [{"label": "RV 2 (< 1 year) at facility", "value": "0", "dhisId": "dpKLNY9JjRR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 2 dose at this facility in this month ", "indicatorCode": "CHN3-070"}, {"label": "Vitamin A supplement to infants and children 12-59 months", "value": "0", "dhisId": "JfY9vBHsyzF", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children age 12-59 months who received vitamin A at this facility in this month", "indicatorCode": "CHN2-070"}, {"label": "Child weighed 24-59 months", "value": "0", "dhisId": "sSxqU6qPyXr", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children weighed aged 24-59 months who attended clinic this month", "indicatorCode": "CHN2-010"}, {"label": "RV 1 (< 1 year) at facility", "value": "0", "dhisId": "ziezVvnYWj0", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 1 dose at this facility in this month ", "indicatorCode": "CHN3-065"}, {"label": "Number of days fridge non-functional", "value": "0", "dhisId": "FGJcw1TCM9D", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of days during the month that vaccine storage fridge was not functioning ", "indicatorCode": "CHN3-090"}, {"label": "Attendance child health 12-59 months (female)", "value": "0", "dhisId": "ZDSUD6VHnoh", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of female children aged 12 to 59 months who attended a clinic this month", "indicatorCode": "CHN1-020"}, {"label": "PCV 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-050-O"}, {"label": "OPV 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-020-O"}, {"label": "IPV (< 1 year) at facility", "value": "0", "dhisId": "D2pqQ1bux6B", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received IPV dose at this facility in this month ", "indicatorCode": "CHN3-027"}, {"label": "OPV 3 (< 1 year) at facility ", "value": "0", "dhisId": "dqsYPg0F8DJ", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV3 dose at this facility in this month ", "indicatorCode": "CHN3-025"}, {"label": "Weight below -3Z scores 24-59 months", "value": "0", "dhisId": "AzLJv6qTtPO", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 24-59 months whose weight is below -3Z scores", "indicatorCode": "CHN2-050"}, {"label": "Attendance child health 12-59 months (total)", "value": "0", "dhisId": "sZQXZ069Vgj", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of Total children aged 12 to 59 months who attended clinic this month", "indicatorCode": "CHN1-021"}, {"label": "OPV 0 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV0 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-010-O"}, {"label": "Not gaining weight 0-23 months", "value": "0", "dhisId": "H5cadfqRh7I", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children aged 0-23 months who were weighed this month who did not gain >= 100g of weight from the last weigh-in. ", "indicatorCode": "CHN2-020"}, {"label": "BCG dose (< 1 year) at the facility", "value": "0", "dhisId": "ZTeQmMrVmNR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received BCG dose at this facility in this month ", "indicatorCode": "CHN3-005"}, {"label": "Attendance child health (total)", "value": "88", "dhisId": "YAY7yKAkSvq", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children < 5 who attended a clinic this month ", "indicatorCode": "CHN1-025"}, {"label": "Attendance child health 12-59 months (male)", "value": "0", "dhisId": "fl4bPFJRI5j", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of male children aged 12 to 59 months who attended a clinic this month", "indicatorCode": "CHN1-015"}, {"label": "Total weight below -3Z scores < five years", "value": "0", "dhisId": "OM9x7oS2qke", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age < 5 years whose weight below -3Z scores", "indicatorCode": "CHN2-051"}, {"label": "Weight between -2Z & -3Z scores < five years", "value": "0", "dhisId": "WOZUqhR5W37", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age < 5 years whose weight is between -2Z and -3Z scores", "indicatorCode": "CHN2-041"}, {"label": "Weight above 2Z scores 24-59 months", "value": "0", "dhisId": "ke26q8KPQPM", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 24-59 months whose weight is above 2Z scores", "indicatorCode": "CHN2-060"}, {"label": "Attendance child health < 12 months (male)", "value": "54", "dhisId": "n0uHub5ubqH", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of male children aged < 12 months who attended a clinic this month.", "indicatorCode": "CHN1-005"}, {"label": "Fully immunised (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "\"Number of children < one year who have received the complete BCG", "indicatorCode": "CHN3-080-O"}, {"label": "OPV 2 (< 1 year) at facility ", "value": "0", "dhisId": "Jbxssr389B6", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV2 dose at this facility in this month ", "indicatorCode": "CHN3-020"}, {"label": "Child weighed 0-23 months", "value": "0", "dhisId": "adkGrSGNt3L", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children weighed aged 0-23 months who attended clinic this month", "indicatorCode": "CHN2-005"}, {"label": "Vitamin A supplement to infants and children 6-11 months", "value": "0", "dhisId": "DSbbltBORY3", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children age 6-11 months who received vitamin A at this facility in this month", "indicatorCode": "CHN2-065"}, {"label": "Deworming dose 12-59 months", "value": "0", "dhisId": "B8nBT4kGhtB", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children age 12-59 months who received a deworming dose at this facility in this month ", "indicatorCode": "CHN2-075"}, {"label": "Fully immunised (< 1 year) at facility", "value": "0", "dhisId": "dzllAar6RrI", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "\"Number of children < one year who have received the complete BCG", "indicatorCode": "CHN3-080"}, {"label": "Total weight above 2Z scores < five years", "value": "0", "dhisId": "Yi4grVdr9Q5", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age < 5 years whose weight is above 2Z scores", "indicatorCode": "CHN2-061"}, {"label": "DPT-Hib-HepB 1 (< 1 year) at facility", "value": "0", "dhisId": "N7VEEjo8AdV", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 1 dose at this facility in this month ", "indicatorCode": "CHN3-035"}, {"label": "Measles/MR 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received Measles/ MR dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-075-O"}, {"label": "OPV 4 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV4 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-030-O"}, {"label": "OPV 4 (< 1 year) at facility ", "value": "0", "dhisId": "poPXN7Wn3RL", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV4 dose at this facility in this month ", "indicatorCode": "CHN3-030"}, {"label": "Weight between -2Z & -3Z scores 0-23 months", "value": "0", "dhisId": "lcpx7xdVC3z", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 0-23 months whose weight is between -2Z and -3Z scores", "indicatorCode": "CHN2-035"}, {"label": "OPV 0 (< 1 year) at facility ", "value": "0", "dhisId": "rwNWKJC4dIO", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV0 dose at this facility in this month ", "indicatorCode": "CHN3-010"}, {"label": "Weight below -3Z scores 0-23 months", "value": "0", "dhisId": "LpkrzZezPhP", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 0-23 months whose weight is below -3Z scores", "indicatorCode": "CHN2-045"}, {"label": "Total not gaining weight age < five years", "value": "0", "dhisId": "e10sC5c4pRz", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children aged < five years who were weighed this month and did not gain >= 100g from the last weigh-in.", "indicatorCode": "CHN2-030"}, {"label": "Attendance child health < 12 months (female)", "value": "34", "dhisId": "IWwblgpMxiS", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of female children aged < 12 months who attended a clinic this month.", "indicatorCode": "CHN1-010"}, {"label": "PCV 3 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 3 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-060-O"}, {"label": "RV 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-070-O"}, {"label": "Not gaining weight 24-59 months", "value": "0", "dhisId": "xWDkbLq9kji", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children aged 24-59 months who were weighed this month who did not gain >= 100g of weight from the last weigh-in. ", "indicatorCode": "CHN2-025"}, {"label": "Attendance from outside catchment area", "value": "0", "dhisId": "WFxN7txijYV", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children who attended clinic and are not part of clinics catchment area", "indicatorCode": "CHN1-030"}, {"label": "IPV (< 1 year) at outreach", "value": "0", "dhisId": "RAbXk70XDMq", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received IPV dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-027-O"}, {"label": "Children who received insecticide treated net", "value": "0", "dhisId": "G4vWZAJ0uz7", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children who received insecticide treated nets at this facility in this month ", "indicatorCode": "CHN2-080"}, {"label": "Weight between -2Z & -3Z scores 24-59 months", "value": "0", "dhisId": "hi9sRtkzimM", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 24-59 months whose weight is between -2Z and -3Z scores", "indicatorCode": "CHN2-040"}, {"label": "OPV 1 (< 1 year) at facility ", "value": "0", "dhisId": "J3Kd9wHj7mR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV1 dose at this facility in this month ", "indicatorCode": "CHN3-015"}, {"label": "Attendance child health < 12 months (total)", "value": "88", "dhisId": "C8vB7dH9ab4", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children aged < 12 months who attended a clinic this month.", "indicatorCode": "CHN1-011"}, {"label": "DPT-Hib-HepB 2 (< 1 year) at facility", "value": "0", "dhisId": "R2JLWtup2XR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 2 dose at this facility in this month ", "indicatorCode": "CHN3-040"}, {"label": "RV 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-065-O"}, {"label": "PCV 1 (< 1 year) at facilty", "value": "0", "dhisId": "dPpDhpO7GpB", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 1 dose at this facility in this month ", "indicatorCode": "CHN3-050"}, {"label": "DPT-Hib-HepB 3 (< 1 year) at facility", "value": "0", "dhisId": "ujEvTSZ0Wvn", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 3 dose at this facility in this month ", "indicatorCode": "CHN3-045"}, {"label": "Measles/MR 2 (at 18 months) at facility", "value": "0", "dhisId": "sqfX5MniMIH", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children at 18 months who received Measles/ MR 2 dose at this facility in this month ", "indicatorCode": "CHN3-085"}, {"label": "BCG dose (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received BCG dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-005-O"}, {"label": "DPT-Hib-HepB 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-040-O"}, {"label": "Weight above 2Z scores 0-23 months", "value": "0", "dhisId": "gdrQ69fCF8B", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 0-23 months whose weight is above 2Z scores", "indicatorCode": "CHN2-055"}, {"label": "Total child weighed", "value": "0", "dhisId": "xIGHv5CY2fF", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children weighed aged < 5 years who attended clinic this month", "indicatorCode": "CHN2-015"}, {"label": "DPT-Hib-HepB 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-035-O"}, {"label": "Measles/MR 1 (< 1 year) at facility", "value": "0", "dhisId": "zIM9ehVMkNW", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received Measles/ MR 1 dose at this facility in this month ", "indicatorCode": "CHN3-075"}, {"label": "Measles/MR 2 (at 18 months) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children at 18 months who received Measles/ MR 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-085-O"}, {"label": "PCV 3 (< 1 year) at facility", "value": "0", "dhisId": "K5XarM6QLxq", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 3 dose at this facility in this month ", "indicatorCode": "CHN3-060"}, {"label": "DPT-Hib-HepB 3 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 3 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-045-O"}, {"label": "OPV 3 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV3 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-025-O"}, {"label": "OPV 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-015-O"}, {"label": "PCV 2 (< 1 year) at facilty", "value": "0", "dhisId": "AU3Zp03Atnf", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 2 dose at this facility in this month ", "indicatorCode": "CHN3-055"}, {"label": "PCV 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-055-O"}], "formSubmissionId": "1aea74ac-b737-477a-99d3-728011fbae3f"}'), -(3, '{"_id": "c57ba49f-34b9-4986-9b87-69f48b1830c5", "type": "Report", "status": "WARNING", "version": 1500307579516, "duration": 0, "addresses": [], "attributes": {}, "dateEdited": "2017-07-17T19:06:42.787+03:00", "locationId": "9e4fc064-d8e7-4fcb-942e-cbcf6524fb24", "providerId": "biddemo", "reportDate": "2017-05-01T01:00:00.000+03:00", "reportType": "HIA2", "identifiers": {"HIN":"56757L"}, "serverVersion": 1500307579516, "hia2Indicators": [{"label": "RV 2 (< 1 year) at facility", "value": "0", "dhisId": "dpKLNY9JjRR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 2 dose at this facility in this month ", "indicatorCode": "CHN3-070"}, {"label": "Vitamin A supplement to infants and children 12-59 months", "value": "0", "dhisId": "JfY9vBHsyzF", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children age 12-59 months who received vitamin A at this facility in this month", "indicatorCode": "CHN2-070"}, {"label": "Child weighed 24-59 months", "value": "0", "dhisId": "sSxqU6qPyXr", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children weighed aged 24-59 months who attended clinic this month", "indicatorCode": "CHN2-010"}, {"label": "RV 1 (< 1 year) at facility", "value": "0", "dhisId": "ziezVvnYWj0", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 1 dose at this facility in this month ", "indicatorCode": "CHN3-065"}, {"label": "Number of days fridge non-functional", "value": "0", "dhisId": "FGJcw1TCM9D", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of days during the month that vaccine storage fridge was not functioning ", "indicatorCode": "CHN3-090"}, {"label": "Attendance child health 12-59 months (female)", "value": "0", "dhisId": "ZDSUD6VHnoh", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of female children aged 12 to 59 months who attended a clinic this month", "indicatorCode": "CHN1-020"}, {"label": "PCV 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-050-O"}, {"label": "OPV 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-020-O"}, {"label": "IPV (< 1 year) at facility", "value": "0", "dhisId": "D2pqQ1bux6B", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received IPV dose at this facility in this month ", "indicatorCode": "CHN3-027"}, {"label": "OPV 3 (< 1 year) at facility ", "value": "0", "dhisId": "dqsYPg0F8DJ", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV3 dose at this facility in this month ", "indicatorCode": "CHN3-025"}, {"label": "Weight below -3Z scores 24-59 months", "value": "0", "dhisId": "AzLJv6qTtPO", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 24-59 months whose weight is below -3Z scores", "indicatorCode": "CHN2-050"}, {"label": "Attendance child health 12-59 months (total)", "value": "0", "dhisId": "sZQXZ069Vgj", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of Total children aged 12 to 59 months who attended clinic this month", "indicatorCode": "CHN1-021"}, {"label": "OPV 0 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV0 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-010-O"}, {"label": "Not gaining weight 0-23 months", "value": "0", "dhisId": "H5cadfqRh7I", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children aged 0-23 months who were weighed this month who did not gain >= 100g of weight from the last weigh-in. ", "indicatorCode": "CHN2-020"}, {"label": "BCG dose (< 1 year) at the facility", "value": "0", "dhisId": "ZTeQmMrVmNR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received BCG dose at this facility in this month ", "indicatorCode": "CHN3-005"}, {"label": "Attendance child health (total)", "value": "4", "dhisId": "YAY7yKAkSvq", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children < 5 who attended a clinic this month ", "indicatorCode": "CHN1-025"}, {"label": "Attendance child health 12-59 months (male)", "value": "0", "dhisId": "fl4bPFJRI5j", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of male children aged 12 to 59 months who attended a clinic this month", "indicatorCode": "CHN1-015"}, {"label": "Total weight below -3Z scores < five years", "value": "0", "dhisId": "OM9x7oS2qke", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age < 5 years whose weight below -3Z scores", "indicatorCode": "CHN2-051"}, {"label": "Weight between -2Z & -3Z scores < five years", "value": "0", "dhisId": "WOZUqhR5W37", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age < 5 years whose weight is between -2Z and -3Z scores", "indicatorCode": "CHN2-041"}, {"label": "Weight above 2Z scores 24-59 months", "value": "0", "dhisId": "ke26q8KPQPM", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 24-59 months whose weight is above 2Z scores", "indicatorCode": "CHN2-060"}, {"label": "Attendance child health < 12 months (male)", "value": "4", "dhisId": "n0uHub5ubqH", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of male children aged < 12 months who attended a clinic this month.", "indicatorCode": "CHN1-005"}, {"label": "Fully immunised (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "\"Number of children < one year who have received the complete BCG", "indicatorCode": "CHN3-080-O"}, {"label": "OPV 2 (< 1 year) at facility ", "value": "0", "dhisId": "Jbxssr389B6", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV2 dose at this facility in this month ", "indicatorCode": "CHN3-020"}, {"label": "Child weighed 0-23 months", "value": "0", "dhisId": "adkGrSGNt3L", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children weighed aged 0-23 months who attended clinic this month", "indicatorCode": "CHN2-005"}, {"label": "Vitamin A supplement to infants and children 6-11 months", "value": "0", "dhisId": "DSbbltBORY3", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children age 6-11 months who received vitamin A at this facility in this month", "indicatorCode": "CHN2-065"}, {"label": "Deworming dose 12-59 months", "value": "0", "dhisId": "B8nBT4kGhtB", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children age 12-59 months who received a deworming dose at this facility in this month ", "indicatorCode": "CHN2-075"}, {"label": "Fully immunised (< 1 year) at facility", "value": "0", "dhisId": "dzllAar6RrI", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "\"Number of children < one year who have received the complete BCG", "indicatorCode": "CHN3-080"}, {"label": "Total weight above 2Z scores < five years", "value": "0", "dhisId": "Yi4grVdr9Q5", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age < 5 years whose weight is above 2Z scores", "indicatorCode": "CHN2-061"}, {"label": "DPT-Hib-HepB 1 (< 1 year) at facility", "value": "0", "dhisId": "N7VEEjo8AdV", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 1 dose at this facility in this month ", "indicatorCode": "CHN3-035"}, {"label": "Measles/MR 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received Measles/ MR dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-075-O"}, {"label": "OPV 4 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV4 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-030-O"}, {"label": "OPV 4 (< 1 year) at facility ", "value": "0", "dhisId": "poPXN7Wn3RL", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV4 dose at this facility in this month ", "indicatorCode": "CHN3-030"}, {"label": "Weight between -2Z & -3Z scores 0-23 months", "value": "0", "dhisId": "lcpx7xdVC3z", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 0-23 months whose weight is between -2Z and -3Z scores", "indicatorCode": "CHN2-035"}, {"label": "OPV 0 (< 1 year) at facility ", "value": "0", "dhisId": "rwNWKJC4dIO", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV0 dose at this facility in this month ", "indicatorCode": "CHN3-010"}, {"label": "Weight below -3Z scores 0-23 months", "value": "0", "dhisId": "LpkrzZezPhP", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 0-23 months whose weight is below -3Z scores", "indicatorCode": "CHN2-045"}, {"label": "Total not gaining weight age < five years", "value": "0", "dhisId": "e10sC5c4pRz", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children aged < five years who were weighed this month and did not gain >= 100g from the last weigh-in.", "indicatorCode": "CHN2-030"}, {"label": "Attendance child health < 12 months (female)", "value": "0", "dhisId": "IWwblgpMxiS", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of female children aged < 12 months who attended a clinic this month.", "indicatorCode": "CHN1-010"}, {"label": "PCV 3 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 3 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-060-O"}, {"label": "RV 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-070-O"}, {"label": "Not gaining weight 24-59 months", "value": "0", "dhisId": "xWDkbLq9kji", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children aged 24-59 months who were weighed this month who did not gain >= 100g of weight from the last weigh-in. ", "indicatorCode": "CHN2-025"}, {"label": "Attendance from outside catchment area", "value": "0", "dhisId": "WFxN7txijYV", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children who attended clinic and are not part of clinics catchment area", "indicatorCode": "CHN1-030"}, {"label": "IPV (< 1 year) at outreach", "value": "0", "dhisId": "RAbXk70XDMq", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received IPV dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-027-O"}, {"label": "Children who received insecticide treated net", "value": "0", "dhisId": "G4vWZAJ0uz7", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children who received insecticide treated nets at this facility in this month ", "indicatorCode": "CHN2-080"}, {"label": "Weight between -2Z & -3Z scores 24-59 months", "value": "0", "dhisId": "hi9sRtkzimM", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 24-59 months whose weight is between -2Z and -3Z scores", "indicatorCode": "CHN2-040"}, {"label": "OPV 1 (< 1 year) at facility ", "value": "0", "dhisId": "J3Kd9wHj7mR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV1 dose at this facility in this month ", "indicatorCode": "CHN3-015"}, {"label": "Attendance child health < 12 months (total)", "value": "4", "dhisId": "C8vB7dH9ab4", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children aged < 12 months who attended a clinic this month.", "indicatorCode": "CHN1-011"}, {"label": "DPT-Hib-HepB 2 (< 1 year) at facility", "value": "0", "dhisId": "R2JLWtup2XR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 2 dose at this facility in this month ", "indicatorCode": "CHN3-040"}, {"label": "RV 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-065-O"}, {"label": "PCV 1 (< 1 year) at facilty", "value": "0", "dhisId": "dPpDhpO7GpB", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 1 dose at this facility in this month ", "indicatorCode": "CHN3-050"}, {"label": "DPT-Hib-HepB 3 (< 1 year) at facility", "value": "0", "dhisId": "ujEvTSZ0Wvn", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 3 dose at this facility in this month ", "indicatorCode": "CHN3-045"}, {"label": "Measles/MR 2 (at 18 months) at facility", "value": "0", "dhisId": "sqfX5MniMIH", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children at 18 months who received Measles/ MR 2 dose at this facility in this month ", "indicatorCode": "CHN3-085"}, {"label": "BCG dose (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received BCG dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-005-O"}, {"label": "DPT-Hib-HepB 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-040-O"}, {"label": "Weight above 2Z scores 0-23 months", "value": "0", "dhisId": "gdrQ69fCF8B", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 0-23 months whose weight is above 2Z scores", "indicatorCode": "CHN2-055"}, {"label": "Total child weighed", "value": "0", "dhisId": "xIGHv5CY2fF", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children weighed aged < 5 years who attended clinic this month", "indicatorCode": "CHN2-015"}, {"label": "DPT-Hib-HepB 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-035-O"}, {"label": "Measles/MR 1 (< 1 year) at facility", "value": "0", "dhisId": "zIM9ehVMkNW", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received Measles/ MR 1 dose at this facility in this month ", "indicatorCode": "CHN3-075"}, {"label": "Measles/MR 2 (at 18 months) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children at 18 months who received Measles/ MR 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-085-O"}, {"label": "PCV 3 (< 1 year) at facility", "value": "0", "dhisId": "K5XarM6QLxq", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 3 dose at this facility in this month ", "indicatorCode": "CHN3-060"}, {"label": "DPT-Hib-HepB 3 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 3 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-045-O"}, {"label": "OPV 3 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV3 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-025-O"}, {"label": "OPV 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-015-O"}, {"label": "PCV 2 (< 1 year) at facilty", "value": "0", "dhisId": "AU3Zp03Atnf", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 2 dose at this facility in this month ", "indicatorCode": "CHN3-055"}, {"label": "PCV 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-055-O"}], "formSubmissionId": "88f9fe90-1e45-46b3-8056-e932574dcbd9"}'), -(4, '{"_id": "cd09a3d4-01d9-485c-a1c5-a2eb078a61be", "type": "Report", "status": "SUCCESS", "version": 1500394719661, "duration": 0, "addresses": [], "attributes": {}, "dateEdited": "2017-07-18T19:18:41.822+03:00", "locationId": "9e4fc064-d8e7-4fcb-942e-cbcf6524fb24", "providerId": "biddemo", "reportDate": "2017-06-01T01:00:00.000+03:00", "reportType": "HIA2", "identifiers": {}, "serverVersion": 1500394719661, "hia2Indicators": [{"label": "RV 2 (< 1 year) at facility", "value": "100", "dhisId": "dpKLNY9JjRR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 2 dose at this facility in this month ", "indicatorCode": "CHN3-070"}, {"label": "Vitamin A supplement to infants and children 12-59 months", "value": "100", "dhisId": "JfY9vBHsyzF", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children age 12-59 months who received vitamin A at this facility in this month", "indicatorCode": "CHN2-070"}, {"label": "Child weighed 24-59 months", "value": "100", "dhisId": "sSxqU6qPyXr", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children weighed aged 24-59 months who attended clinic this month", "indicatorCode": "CHN2-010"}, {"label": "RV 1 (< 1 year) at facility", "value": "100", "dhisId": "ziezVvnYWj0", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 1 dose at this facility in this month ", "indicatorCode": "CHN3-065"}, {"label": "Number of days fridge non-functional", "value": "100", "dhisId": "FGJcw1TCM9D", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of days during the month that vaccine storage fridge was not functioning ", "indicatorCode": "CHN3-090"}, {"label": "Attendance child health 12-59 months (female)", "value": "100", "dhisId": "ZDSUD6VHnoh", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of female children aged 12 to 59 months who attended a clinic this month", "indicatorCode": "CHN1-020"}, {"label": "PCV 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-050-O"}, {"label": "OPV 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-020-O"}, {"label": "IPV (< 1 year) at facility", "value": "100", "dhisId": "D2pqQ1bux6B", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received IPV dose at this facility in this month ", "indicatorCode": "CHN3-027"}, {"label": "Weight below -3Z scores 24-59 months", "value": "100", "dhisId": "AzLJv6qTtPO", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 24-59 months whose weight is below -3Z scores", "indicatorCode": "CHN2-050"}, {"label": "OPV 3 (< 1 year) at facility ", "value": "100", "dhisId": "dqsYPg0F8DJ", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV3 dose at this facility in this month ", "indicatorCode": "CHN3-025"}, {"label": "Attendance child health 12-59 months (total)", "value": "200", "dhisId": "sZQXZ069Vgj", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of Total children aged 12 to 59 months who attended clinic this month", "indicatorCode": "CHN1-021"}, {"label": "OPV 0 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV0 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-010-O"}, {"label": "Not gaining weight 0-23 months", "value": "100", "dhisId": "H5cadfqRh7I", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children aged 0-23 months who were weighed this month who did not gain >= 100g of weight from the last weigh-in. ", "indicatorCode": "CHN2-020"}, {"label": "BCG dose (< 1 year) at the facility", "value": "100", "dhisId": "ZTeQmMrVmNR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received BCG dose at this facility in this month ", "indicatorCode": "CHN3-005"}, {"label": "Attendance child health 12-59 months (male)", "value": "100", "dhisId": "fl4bPFJRI5j", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of male children aged 12 to 59 months who attended a clinic this month", "indicatorCode": "CHN1-015"}, {"label": "Attendance child health (total)", "value": "400", "dhisId": "YAY7yKAkSvq", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children < 5 who attended a clinic this month ", "indicatorCode": "CHN1-025"}, {"label": "Total weight below -3Z scores < five years", "value": "200", "dhisId": "OM9x7oS2qke", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age < 5 years whose weight below -3Z scores", "indicatorCode": "CHN2-051"}, {"label": "Weight between -2Z & -3Z scores < five years", "value": "200", "dhisId": "WOZUqhR5W37", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age < 5 years whose weight is between -2Z and -3Z scores", "indicatorCode": "CHN2-041"}, {"label": "Weight above 2Z scores 24-59 months", "value": "100", "dhisId": "ke26q8KPQPM", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 24-59 months whose weight is above 2Z scores", "indicatorCode": "CHN2-060"}, {"label": "Attendance child health < 12 months (male)", "value": "100", "dhisId": "n0uHub5ubqH", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of male children aged < 12 months who attended a clinic this month.", "indicatorCode": "CHN1-005"}, {"label": "Fully immunised (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "\"Number of children < one year who have received the complete BCG", "indicatorCode": "CHN3-080-O"}, {"label": "OPV 2 (< 1 year) at facility ", "value": "100", "dhisId": "Jbxssr389B6", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV2 dose at this facility in this month ", "indicatorCode": "CHN3-020"}, {"label": "Child weighed 0-23 months", "value": "100", "dhisId": "adkGrSGNt3L", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children weighed aged 0-23 months who attended clinic this month", "indicatorCode": "CHN2-005"}, {"label": "Vitamin A supplement to infants and children 6-11 months", "value": "100", "dhisId": "DSbbltBORY3", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children age 6-11 months who received vitamin A at this facility in this month", "indicatorCode": "CHN2-065"}, {"label": "Deworming dose 12-59 months", "value": "100", "dhisId": "B8nBT4kGhtB", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children age 12-59 months who received a deworming dose at this facility in this month ", "indicatorCode": "CHN2-075"}, {"label": "Fully immunised (< 1 year) at facility", "value": "100", "dhisId": "dzllAar6RrI", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "\"Number of children < one year who have received the complete BCG", "indicatorCode": "CHN3-080"}, {"label": "Total weight above 2Z scores < five years", "value": "200", "dhisId": "Yi4grVdr9Q5", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age < 5 years whose weight is above 2Z scores", "indicatorCode": "CHN2-061"}, {"label": "DPT-Hib-HepB 1 (< 1 year) at facility", "value": "100", "dhisId": "N7VEEjo8AdV", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 1 dose at this facility in this month ", "indicatorCode": "CHN3-035"}, {"label": "Measles/MR 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received Measles/ MR dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-075-O"}, {"label": "OPV 4 (< 1 year) at facility ", "value": "100", "dhisId": "poPXN7Wn3RL", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV4 dose at this facility in this month ", "indicatorCode": "CHN3-030"}, {"label": "OPV 4 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV4 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-030-O"}, {"label": "Weight between -2Z & -3Z scores 0-23 months", "value": "100", "dhisId": "lcpx7xdVC3z", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 0-23 months whose weight is between -2Z and -3Z scores", "indicatorCode": "CHN2-035"}, {"label": "Weight below -3Z scores 0-23 months", "value": "100", "dhisId": "LpkrzZezPhP", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 0-23 months whose weight is below -3Z scores", "indicatorCode": "CHN2-045"}, {"label": "OPV 0 (< 1 year) at facility ", "value": "100", "dhisId": "rwNWKJC4dIO", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV0 dose at this facility in this month ", "indicatorCode": "CHN3-010"}, {"label": "Total not gaining weight age < five years", "value": "200", "dhisId": "e10sC5c4pRz", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children aged < five years who were weighed this month and did not gain >= 100g from the last weigh-in.", "indicatorCode": "CHN2-030"}, {"label": "Attendance child health < 12 months (female)", "value": "100", "dhisId": "IWwblgpMxiS", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of female children aged < 12 months who attended a clinic this month.", "indicatorCode": "CHN1-010"}, {"label": "PCV 3 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 3 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-060-O"}, {"label": "RV 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-070-O"}, {"label": "Not gaining weight 24-59 months", "value": "100", "dhisId": "xWDkbLq9kji", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children aged 24-59 months who were weighed this month who did not gain >= 100g of weight from the last weigh-in. ", "indicatorCode": "CHN2-025"}, {"label": "Attendance from outside catchment area", "value": "100", "dhisId": "WFxN7txijYV", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children who attended clinic and are not part of clinics catchment area", "indicatorCode": "CHN1-030"}, {"label": "IPV (< 1 year) at outreach", "value": "100", "dhisId": "RAbXk70XDMq", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received IPV dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-027-O"}, {"label": "Children who received insecticide treated net", "value": "100", "dhisId": "G4vWZAJ0uz7", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children who received insecticide treated nets at this facility in this month ", "indicatorCode": "CHN2-080"}, {"label": "Weight between -2Z & -3Z scores 24-59 months", "value": "100", "dhisId": "hi9sRtkzimM", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 24-59 months whose weight is between -2Z and -3Z scores", "indicatorCode": "CHN2-040"}, {"label": "Attendance child health < 12 months (total)", "value": "200", "dhisId": "C8vB7dH9ab4", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children aged < 12 months who attended a clinic this month.", "indicatorCode": "CHN1-011"}, {"label": "OPV 1 (< 1 year) at facility ", "value": "100", "dhisId": "J3Kd9wHj7mR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV1 dose at this facility in this month ", "indicatorCode": "CHN3-015"}, {"label": "DPT-Hib-HepB 2 (< 1 year) at facility", "value": "100", "dhisId": "R2JLWtup2XR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 2 dose at this facility in this month ", "indicatorCode": "CHN3-040"}, {"label": "RV 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-065-O"}, {"label": "DPT-Hib-HepB 3 (< 1 year) at facility", "value": "100", "dhisId": "ujEvTSZ0Wvn", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 3 dose at this facility in this month ", "indicatorCode": "CHN3-045"}, {"label": "PCV 1 (< 1 year) at facilty", "value": "100", "dhisId": "dPpDhpO7GpB", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 1 dose at this facility in this month ", "indicatorCode": "CHN3-050"}, {"label": "Measles/MR 2 (at 18 months) at facility", "value": "100", "dhisId": "sqfX5MniMIH", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children at 18 months who received Measles/ MR 2 dose at this facility in this month ", "indicatorCode": "CHN3-085"}, {"label": "BCG dose (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received BCG dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-005-O"}, {"label": "DPT-Hib-HepB 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-040-O"}, {"label": "Weight above 2Z scores 0-23 months", "value": "100", "dhisId": "gdrQ69fCF8B", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 0-23 months whose weight is above 2Z scores", "indicatorCode": "CHN2-055"}, {"label": "Total child weighed", "value": "200", "dhisId": "xIGHv5CY2fF", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children weighed aged < 5 years who attended clinic this month", "indicatorCode": "CHN2-015"}, {"label": "DPT-Hib-HepB 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-035-O"}, {"label": "Measles/MR 1 (< 1 year) at facility", "value": "100", "dhisId": "zIM9ehVMkNW", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received Measles/ MR 1 dose at this facility in this month ", "indicatorCode": "CHN3-075"}, {"label": "Measles/MR 2 (at 18 months) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children at 18 months who received Measles/ MR 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-085-O"}, {"label": "PCV 3 (< 1 year) at facility", "value": "100", "dhisId": "K5XarM6QLxq", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 3 dose at this facility in this month ", "indicatorCode": "CHN3-060"}, {"label": "DPT-Hib-HepB 3 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 3 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-045-O"}, {"label": "OPV 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-015-O"}, {"label": "OPV 3 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV3 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-025-O"}, {"label": "PCV 2 (< 1 year) at facilty", "value": "100", "dhisId": "AU3Zp03Atnf", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 2 dose at this facility in this month ", "indicatorCode": "CHN3-055"}, {"label": "PCV 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-055-O"}], "formSubmissionId": "d78a8105-f808-488a-b67a-0c4c46845194"}'), -(5, '{"_id": "60ab7d5c-a051-4633-b0b3-f52b701cb261", "baseEntityId": "6654kk-mnj45-mmnfgd-l45645", "type": "Report", "status": "WARNING", "version": 1500445930478, "duration": 0, "addresses": [], "attributes": {}, "dateEdited": "2017-07-19T09:32:41.737+03:00", "locationId": "9e4fc064-d8e7-4fcb-942e-cbcf6524fb24", "providerId": "biddemo", "reportDate": "2017-05-01T01:00:00.000+03:00", "reportType": "HIA2", "identifiers": {"HIN":"56757L"}, "serverVersion": null, "hia2Indicators": [{"label": "RV 2 (< 1 year) at facility", "value": "0", "dhisId": "dpKLNY9JjRR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 2 dose at this facility in this month ", "indicatorCode": "CHN3-070"}, {"label": "Vitamin A supplement to infants and children 12-59 months", "value": "0", "dhisId": "JfY9vBHsyzF", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children age 12-59 months who received vitamin A at this facility in this month", "indicatorCode": "CHN2-070"}, {"label": "Child weighed 24-59 months", "value": "0", "dhisId": "sSxqU6qPyXr", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children weighed aged 24-59 months who attended clinic this month", "indicatorCode": "CHN2-010"}, {"label": "RV 1 (< 1 year) at facility", "value": "0", "dhisId": "ziezVvnYWj0", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 1 dose at this facility in this month ", "indicatorCode": "CHN3-065"}, {"label": "Number of days fridge non-functional", "value": "0", "dhisId": "FGJcw1TCM9D", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of days during the month that vaccine storage fridge was not functioning ", "indicatorCode": "CHN3-090"}, {"label": "Attendance child health 12-59 months (female)", "value": "0", "dhisId": "ZDSUD6VHnoh", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of female children aged 12 to 59 months who attended a clinic this month", "indicatorCode": "CHN1-020"}, {"label": "PCV 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-050-O"}, {"label": "OPV 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-020-O"}, {"label": "IPV (< 1 year) at facility", "value": "0", "dhisId": "D2pqQ1bux6B", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received IPV dose at this facility in this month ", "indicatorCode": "CHN3-027"}, {"label": "OPV 3 (< 1 year) at facility ", "value": "0", "dhisId": "dqsYPg0F8DJ", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV3 dose at this facility in this month ", "indicatorCode": "CHN3-025"}, {"label": "Weight below -3Z scores 24-59 months", "value": "0", "dhisId": "AzLJv6qTtPO", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 24-59 months whose weight is below -3Z scores", "indicatorCode": "CHN2-050"}, {"label": "Attendance child health 12-59 months (total)", "value": "0", "dhisId": "sZQXZ069Vgj", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of Total children aged 12 to 59 months who attended clinic this month", "indicatorCode": "CHN1-021"}, {"label": "OPV 0 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV0 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-010-O"}, {"label": "Not gaining weight 0-23 months", "value": "0", "dhisId": "H5cadfqRh7I", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children aged 0-23 months who were weighed this month who did not gain >= 100g of weight from the last weigh-in. ", "indicatorCode": "CHN2-020"}, {"label": "BCG dose (< 1 year) at the facility", "value": "0", "dhisId": "ZTeQmMrVmNR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received BCG dose at this facility in this month ", "indicatorCode": "CHN3-005"}, {"label": "Attendance child health (total)", "value": "1000000", "dhisId": "YAY7yKAkSvq", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children < 5 who attended a clinic this month ", "indicatorCode": "CHN1-025"}, {"label": "Attendance child health 12-59 months (male)", "value": "0", "dhisId": "fl4bPFJRI5j", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of male children aged 12 to 59 months who attended a clinic this month", "indicatorCode": "CHN1-015"}, {"label": "Total weight below -3Z scores < five years", "value": "0", "dhisId": "OM9x7oS2qke", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age < 5 years whose weight below -3Z scores", "indicatorCode": "CHN2-051"}, {"label": "Weight between -2Z & -3Z scores < five years", "value": "0", "dhisId": "WOZUqhR5W37", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age < 5 years whose weight is between -2Z and -3Z scores", "indicatorCode": "CHN2-041"}, {"label": "Weight above 2Z scores 24-59 months", "value": "0", "dhisId": "ke26q8KPQPM", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 24-59 months whose weight is above 2Z scores", "indicatorCode": "CHN2-060"}, {"label": "Attendance child health < 12 months (male)", "value": "100000", "dhisId": "n0uHub5ubqH", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of male children aged < 12 months who attended a clinic this month.", "indicatorCode": "CHN1-005"}, {"label": "Fully immunised (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "\"Number of children < one year who have received the complete BCG", "indicatorCode": "CHN3-080-O"}, {"label": "OPV 2 (< 1 year) at facility ", "value": "0", "dhisId": "Jbxssr389B6", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV2 dose at this facility in this month ", "indicatorCode": "CHN3-020"}, {"label": "Child weighed 0-23 months", "value": "0", "dhisId": "adkGrSGNt3L", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children weighed aged 0-23 months who attended clinic this month", "indicatorCode": "CHN2-005"}, {"label": "Vitamin A supplement to infants and children 6-11 months", "value": "0", "dhisId": "DSbbltBORY3", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children age 6-11 months who received vitamin A at this facility in this month", "indicatorCode": "CHN2-065"}, {"label": "Deworming dose 12-59 months", "value": "0", "dhisId": "B8nBT4kGhtB", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children age 12-59 months who received a deworming dose at this facility in this month ", "indicatorCode": "CHN2-075"}, {"label": "Fully immunised (< 1 year) at facility", "value": "0", "dhisId": "dzllAar6RrI", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "\"Number of children < one year who have received the complete BCG", "indicatorCode": "CHN3-080"}, {"label": "Total weight above 2Z scores < five years", "value": "0", "dhisId": "Yi4grVdr9Q5", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age < 5 years whose weight is above 2Z scores", "indicatorCode": "CHN2-061"}, {"label": "DPT-Hib-HepB 1 (< 1 year) at facility", "value": "0", "dhisId": "N7VEEjo8AdV", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 1 dose at this facility in this month ", "indicatorCode": "CHN3-035"}, {"label": "Measles/MR 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received Measles/ MR dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-075-O"}, {"label": "OPV 4 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV4 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-030-O"}, {"label": "OPV 4 (< 1 year) at facility ", "value": "0", "dhisId": "poPXN7Wn3RL", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV4 dose at this facility in this month ", "indicatorCode": "CHN3-030"}, {"label": "Weight between -2Z & -3Z scores 0-23 months", "value": "0", "dhisId": "lcpx7xdVC3z", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 0-23 months whose weight is between -2Z and -3Z scores", "indicatorCode": "CHN2-035"}, {"label": "OPV 0 (< 1 year) at facility ", "value": "0", "dhisId": "rwNWKJC4dIO", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV0 dose at this facility in this month ", "indicatorCode": "CHN3-010"}, {"label": "Weight below -3Z scores 0-23 months", "value": "0", "dhisId": "LpkrzZezPhP", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 0-23 months whose weight is below -3Z scores", "indicatorCode": "CHN2-045"}, {"label": "Total not gaining weight age < five years", "value": "0", "dhisId": "e10sC5c4pRz", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children aged < five years who were weighed this month and did not gain >= 100g from the last weigh-in.", "indicatorCode": "CHN2-030"}, {"label": "Attendance child health < 12 months (female)", "value": "0", "dhisId": "IWwblgpMxiS", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of female children aged < 12 months who attended a clinic this month.", "indicatorCode": "CHN1-010"}, {"label": "PCV 3 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 3 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-060-O"}, {"label": "RV 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-070-O"}, {"label": "Not gaining weight 24-59 months", "value": "0", "dhisId": "xWDkbLq9kji", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children aged 24-59 months who were weighed this month who did not gain >= 100g of weight from the last weigh-in. ", "indicatorCode": "CHN2-025"}, {"label": "Attendance from outside catchment area", "value": "0", "dhisId": "WFxN7txijYV", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children who attended clinic and are not part of clinics catchment area", "indicatorCode": "CHN1-030"}, {"label": "IPV (< 1 year) at outreach", "value": "0", "dhisId": "RAbXk70XDMq", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received IPV dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-027-O"}, {"label": "Children who received insecticide treated net", "value": "0", "dhisId": "G4vWZAJ0uz7", "category": "Vitamin A, Deworming, and ITNs", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children who received insecticide treated nets at this facility in this month ", "indicatorCode": "CHN2-080"}, {"label": "Weight between -2Z & -3Z scores 24-59 months", "value": "0", "dhisId": "hi9sRtkzimM", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 24-59 months whose weight is between -2Z and -3Z scores", "indicatorCode": "CHN2-040"}, {"label": "OPV 1 (< 1 year) at facility ", "value": "0", "dhisId": "J3Kd9wHj7mR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV1 dose at this facility in this month ", "indicatorCode": "CHN3-015"}, {"label": "Attendance child health < 12 months (total)", "value": "10000", "dhisId": "C8vB7dH9ab4", "category": "Under 5 Clinic Attendance", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children aged < 12 months who attended a clinic this month.", "indicatorCode": "CHN1-011"}, {"label": "DPT-Hib-HepB 2 (< 1 year) at facility", "value": "0", "dhisId": "R2JLWtup2XR", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 2 dose at this facility in this month ", "indicatorCode": "CHN3-040"}, {"label": "RV 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received RV 1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-065-O"}, {"label": "PCV 1 (< 1 year) at facilty", "value": "0", "dhisId": "dPpDhpO7GpB", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 1 dose at this facility in this month ", "indicatorCode": "CHN3-050"}, {"label": "DPT-Hib-HepB 3 (< 1 year) at facility", "value": "0", "dhisId": "ujEvTSZ0Wvn", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 3 dose at this facility in this month ", "indicatorCode": "CHN3-045"}, {"label": "Measles/MR 2 (at 18 months) at facility", "value": "0", "dhisId": "sqfX5MniMIH", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children at 18 months who received Measles/ MR 2 dose at this facility in this month ", "indicatorCode": "CHN3-085"}, {"label": "BCG dose (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received BCG dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-005-O"}, {"label": "DPT-Hib-HepB 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-040-O"}, {"label": "Weight above 2Z scores 0-23 months", "value": "0", "dhisId": "gdrQ69fCF8B", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children age 0-23 months whose weight is above 2Z scores", "indicatorCode": "CHN2-055"}, {"label": "Total child weighed", "value": "0", "dhisId": "xIGHv5CY2fF", "category": "Growth Monitoring and Nutrition", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of total children weighed aged < 5 years who attended clinic this month", "indicatorCode": "CHN2-015"}, {"label": "DPT-Hib-HepB 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-035-O"}, {"label": "Measles/MR 1 (< 1 year) at facility", "value": "0", "dhisId": "zIM9ehVMkNW", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received Measles/ MR 1 dose at this facility in this month ", "indicatorCode": "CHN3-075"}, {"label": "Measles/MR 2 (at 18 months) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children at 18 months who received Measles/ MR 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-085-O"}, {"label": "PCV 3 (< 1 year) at facility", "value": "0", "dhisId": "K5XarM6QLxq", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 3 dose at this facility in this month ", "indicatorCode": "CHN3-060"}, {"label": "DPT-Hib-HepB 3 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received DPT-Hib+HepB 3 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-045-O"}, {"label": "OPV 3 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV3 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-025-O"}, {"label": "OPV 1 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received OPV1 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-015-O"}, {"label": "PCV 2 (< 1 year) at facilty", "value": "0", "dhisId": "AU3Zp03Atnf", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 2 dose at this facility in this month ", "indicatorCode": "CHN3-055"}, {"label": "PCV 2 (< 1 year) at outreach", "value": "0", "dhisId": "", "category": "Immunisation", "updatedAt": "1970-01-01T02:00:02.017+0200", "providerId": "biddemo", "description": "Number of children < one year who received PCV 2 dose at outreach conducted by this facility in this month ", "indicatorCode": "CHN3-055-O"}], "formSubmissionId": "03b5d0b8-4f72-4415-9909-ce03b5802c75"}'); - -INSERT INTO core.report_metadata (id, report_id, document_id, form_submission_id, base_entity_id, server_version, report_type, report_date, provider_id, location_id, team, team_id, date_edited) VALUES -(1, 1, '07271855-4018-497a-b180-6af01f0fa62b', '7073cef4-b974-4910-afa7-dd2ccadba089', '6654kk-mnj45-mmnfgd-l45645', 1503312366265, 'HIA2', '2017-06-28', 'biddemo', 'b0781dd2-e1b1-4878-8e6c-fba488eb9fa3', null, null, '2017-08-21'), -(2, 2, 'ecafd20f-c95b-4046-9355-9512e1908da4', '1aea74ac-b737-477a-99d3-728011fbae3f', '678343544-nhj7-jghdfgfd-mkjdkfg', 1500056613263, 'HIA2', '2017-07-14', 'biddemo', '9e4fc064-d8e7-4fcb-942e-cbcf6524fb24', null, null, '2017-07-17'), -(3, 3, 'c57ba49f-34b9-4986-9b87-69f48b1830c5', '88f9fe90-1e45-46b3-8056-e932574dcbd9', null, 1500307579516, 'HIA2', '2017-05-01', 'biddemo', '9e4fc064-d8e7-4fcb-942e-cbcf6524fb24', null, null, '2017-07-17'), -(4, 4, 'cd09a3d4-01d9-485c-a1c5-a2eb078a61be', 'd78a8105-f808-488a-b67a-0c4c46845194', null, 1500394719661, 'HIA2', '2017-06-01', 'biddemo', '9e4fc064-d8e7-4fcb-942e-cbcf6524fb24', null, null, '2017-07-18'), -(5, 5, '60ab7d5c-a051-4633-b0b3-f52b701cb261', '03b5d0b8-4f72-4415-9909-ce03b5802c75', '6654kk-mnj45-mmnfgd-l45645', null, 'HIA2', '2017-05-01', 'biddemo', '9e4fc064-d8e7-4fcb-942e-cbcf6524fb24', null, null, '2017-07-19'); \ No newline at end of file diff --git a/opensrp-core/src/test/resources/test-scripts/setting.sql b/opensrp-core/src/test/resources/test-scripts/setting.sql deleted file mode 100644 index 5355b92f64..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/setting.sql +++ /dev/null @@ -1,28 +0,0 @@ ---clear data -TRUNCATE TABLE core.settings CASCADE; - -ALTER SEQUENCE core.settings_id_seq RESTART WITH 9; - -ALTER SEQUENCE core.settings_metadata_id_seq RESTART WITH 9; - -INSERT INTO core.settings (id, json) VALUES -(1, '{"_id": 2, "_rev": 1, "type": "SettingConfiguration", "settings": [{"key": "pop_undernourish", "label": "Undernourished prevalence 20% or higher", "value": null, "description": "The proportion of women in the adult population (18 years or older), with a BMI less than 18.5, is 20% or higher."}, {"key": "pop_anaemia_40", "label": "Anaemia prevalence 40% or higher", "value": null, "description": "The proportion of pregnant women in the population with anaemia (haemoglobin level less than 11 g/dl) is 40% or higher."}, {"key": "pop_anaemia_20", "label": "Anaemia prevalence 20% or lower", "value": null, "description": "The proportion of pregnant women in the population with anaemia (haemoglobin level less than 11 g/dl) is 20% or lower."}, {"key": "pop_low_calcium", "label": "Low dietary calcium intake", "value": null, "description": "Women in the population are likely to have low dietary calcium intake (less than 900 mg of calcium per day)."}, {"key": "pop_tb", "label": "TB prevalence 100/100,000 or higher", "value": null, "description": "The tuberculosis prevalence in the general population is 100 cases per 100,000 persons or greater."}, {"key": "pop_vita", "label": "Vitamin A deficiency 5% or higher", "value": null, "description": "The prevalence of night blindness is 5% or higher in pregnant women or 5% or higher in children 24–59 months of age, or the proportion of pregnant women with a serum retinol level less than 0.7 mol/L is 20% or higher. "}, {"key": "pop_helminth", "label": "Soil-transmitted helminth infection prevalence 20% or higher", "value": null, "description": "The percentage of individuals in the general population infected with at least one species of soil-transmitted helminth is 20% or higher."}, {"key": "pop_hiv_incidence", "label": "HIV incidence greater than 3 per 100 person-years in the absence of PrEP", "value": null, "description": "Women in the population have a substantial risk of HIV infection. Substantial risk of HIV infection is provisionally defined as HIV incidence greater than 3 per 100 person–years in the absence of pre-exposure prophylaxis (PrEP)."}, {"key": "pop_hiv_prevalence", "label": "HIV prevalence 5% or higher", "value": null, "description": "The HIV prevalence in pregnant women in the population is 5% or higher."}, {"key": "pop_malaria", "label": "Malaria-endemic setting", "value": null, "description": "This is a malaria-endemic setting."}, {"key": "pop_syphilis", "label": "Syphilis prevalence 5% or higher", "value": null, "description": "The prevalence of syphilis in pregnant women in the population is 5% or higher."}, {"key": "pop_hepb", "label": "Hep B prevalence is intermediate (2% or higher) or high (5% or higher)", "value": null, "description": "The proportion of Hepatitis B surface antigen (HBsAg) seroprevalance in the general population is 2% or higher."}, {"key": "pop_hepb_screening", "label": "National Hep B ANC routine screening program established", "value": null, "description": "There is a national Hepatitis B ANC routine screening program in place."}, {"key": "pop_hepc", "label": "Hep C prevalence is intermediate (2% or higher) or high (5% or higher)", "value": null, "description": "The proportion of Hepatitis C virus (HCV) antibody seroprevalence in the general population is 2% or higher. "}], "documentId": "settings-document-id-2", "identifier": "population_characteristics", "serverVersion": null}'), -(2, '{"_id": "settings-document-id-1", "_rev": "v4", "team": "Bukesa", "type": "SettingConfiguration", "teamId": "6c8d2b9b-2246-47c2-949b-4fe29e888cc8", "settings": [{"key": "site_ipv_assess", "label": "Minimum requirements for IPV4 assessment", "value": "false", "description": "Are all of the following in place at your facility: \\r\null\\t\\ta. A protocol or standard operating procedure for Intimate Partner Violence (IPV); \\r\null\\t\\tb. A health worker trained on how to ask about IPV and how to provide the minimum response or beyond;\\r\null\\t\\tc. A private setting; \\r\null\\t\\td. A way to ensure confidentiality; \\r\null\\t\\te. Time to allow for appropriate disclosure; and\\r\null\\t\\tf. A system for referral in place. "}, {"key": "site_anc_hiv", "label": "Generalized HIV epidemic", "value": "false", "description": "Is the HIV prevalence consistently > 1% in pregnant women attending antenatal clinics at your facility?"}, {"key": "site_ultrasound", "label": "Ultrasound available", "value": "false", "description": "Is an ultrasound machine available and functional at your facility and a trained health worker available to use it?"}, {"key": "site_bp_tool", "label": "Automated BP measurement tool", "value": "true", "description": "Does your facility use an automated blood pressure (BP) measurement tool?"}], "identifier": "site_characteristics", "locationId": "44de66fb-e6c6-4bae-92bb-386dfe626eba", "providerId": "demo", "dateCreated": "2019-02-27T11:44:54.530+03:00", "serverVersion": 1551438162336}'), -(3, '{"_id": "5", "_rev": "v1", "type": "SettingConfiguration", "teamId": "131869c5-d67c-4060-8fe1-2dee6041da22", "settings": [{"key": "site_ipv_assess", "label": "Minimum requirements for IPV assessment", "value": "true", "description": "Are all of the following in place at your facility: \\r\null\\t\\ta. A protocol or standard operating procedure for Intimate Partner Violence (IPV); \\r\null\\t\\tb. A health worker trained on how to ask about IPV and how to provide the minimum response or beyond;\\r\null\\t\\tc. A private setting; \\r\null\\t\\td. A way to ensure confidentiality; \\r\null\\t\\te. Time to allow for appropriate disclosure; and\\r\null\\t\\tf. A system for referral in place. "}, {"key": "site_anc_hiv", "label": "Generalized HIV epidemic", "value": "true", "description": "Is the HIV prevalence consistently > 1% in pregnant women attending antenatal clinics at your facility?"}, {"key": "site_ultrasound", "label": "Ultrasound available", "value": "true", "description": "Is an ultrasound machine available and functional at your facility and a trained health worker available to use it?"}, {"key": "site_bp_tool", "label": "Automated BP measurement tool", "value": "false", "description": "Does your facility use an automated blood pressure (BP) measurement tool?"}], "identifier": "site_characteristics", "locationId": "37faf3f3-3ec6-4023-8d8c-dac7f8659dda", "providerId": "demo1", "dateCreated": "2018-10-15T17:39:37.561+03:00", "serverVersion": 1539614334672}'), -(4, '{"_id": "4", "_rev": "v1", "type": "SettingConfiguration", "teamId": "24f24d29-d3f3-4c91-868a-29e80efab829", "settings": [{"key": "site_ipv_assess", "label": "Minimum requirements for IPV assessment", "value": null, "description": "Are all of the following in place at your facility: \\r\null\\t\\ta. A protocol or standard operating procedure for Intimate Partner Violence (IPV); \\r\null\\t\\tb. A health worker trained on how to ask about IPV and how to provide the minimum response or beyond;\\r\null\\t\\tc. A private setting; \\r\null\\t\\td. A way to ensure confidentiality; \\r\null\\t\\te. Time to allow for appropriate disclosure; and\\r\null\\t\\tf. A system for referral in place. "}, {"key": "site_anc_hiv", "label": "Generalized HIV epidemic", "value": null, "description": "Is the HIV prevalence consistently > 1% in pregnant women attending antenatal clinics at your facility?"}, {"key": "site_ultrasound", "label": "Ultrasound available", "value": null, "description": "Is an ultrasound machine available and functional at your facility and a trained health worker available to use it?"}, {"key": "site_bp_tool", "label": "Automated BP measurement tool", "value": null, "description": "Does your facility use an automated blood pressure (BP) measurement tool?"}], "identifier": "site_characteristics", "locationId": "", "providerId": "", "dateCreated": "1970-10-04T10:17:09.993+03:00", "serverVersion": 1}'), -(5, '{"_id": "3", "_rev": "v1", "type": "SettingConfiguration", "teamId": "f4d3be2c-c663-43e1-a670-462ca8c7a96c", "settings": [{"key": "site_ipv_assess", "label": "Minimum requirements for IPV assessment", "value": null, "description": "Are all of the following in place at your facility: \\r\null\\t\\ta. A protocol or standard operating procedure for Intimate Partner Violence (IPV); \\r\null\\t\\tb. A health worker trained on how to ask about IPV and how to provide the minimum response or beyond;\\r\null\\t\\tc. A private setting; \\r\null\\t\\td. A way to ensure confidentiality; \\r\null\\t\\te. Time to allow for appropriate disclosure; and\\r\null\\t\\tf. A system for referral in place. "}, {"key": "site_anc_hiv", "label": "Generalized HIV epidemic", "value": null, "description": "Is the HIV prevalence consistently > 1% in pregnant women attending antenatal clinics at your facility?"}, {"key": "site_ultrasound", "label": "Ultrasound available", "value": null, "description": "Is an ultrasound machine available and functional at your facility and a trained health worker available to use it?"}, {"key": "site_bp_tool", "label": "Automated BP measurement tool", "value": null, "description": "Does your facility use an automated blood pressure (BP) measurement tool?"}], "identifier": "site_characteristics", "locationId": "", "providerId": "", "dateCreated": "1970-10-04T10:17:09.993+03:00", "serverVersion": 1}'), -(6, '{"_id": "3", "_rev": "v1", "type": "SettingConfiguration", "teamId": "73f7cf54-42b5-4cb6-b601-be151d34a9d8", "settings": [{"key": "site_ipv_assess", "label": "Minimum requirements for IPV assessment", "value": null, "description": "Are all of the following in place at your facility: \\r\null\\t\\ta. A protocol or standard operating procedure for Intimate Partner Violence (IPV); \\r\null\\t\\tb. A health worker trained on how to ask about IPV and how to provide the minimum response or beyond;\\r\null\\t\\tc. A private setting; \\r\null\\t\\td. A way to ensure confidentiality; \\r\null\\t\\te. Time to allow for appropriate disclosure; and\\r\null\\t\\tf. A system for referral in place. "}, {"key": "site_anc_hiv", "label": "Generalized HIV epidemic", "value": null, "description": "Is the HIV prevalence consistently > 1% in pregnant women attending antenatal clinics at your facility?"}, {"key": "site_ultrasound", "label": "Ultrasound available", "value": null, "description": "Is an ultrasound machine available and functional at your facility and a trained health worker available to use it?"}, {"key": "site_bp_tool", "label": "Automated BP measurement tool", "value": null, "description": "Does your facility use an automated blood pressure (BP) measurement tool?"}], "identifier": "site_characteristics", "locationId": "", "providerId": "", "dateCreated": "1970-10-04T10:17:09.993+03:00", "serverVersion": 1}'), -(7, '{"_id": "15", "_rev": "v1", "type": "SettingConfiguration", "teamId": "7e104eee-ec8a-4733-bcf7-c02c51cf43f4", "settings": [{"key": "location_buffer_radius_in_metres", "label": "Location Buffer", "value": "200", "description": ""}], "identifier": "global_configs", "providerId": "demo", "serverVersion": 1551187233614}'), -(8, '{"_id": "31972118-c8fc-44c4-bdfb-55607022d17a", "_rev": "v1", "type": "SettingConfiguration", "teamId": "6c8d2b9b-2246-47c2-949b-4fe29e888cc8", "settings": [{"key": "king", "label": "Mufasa", "value": "100", "description": ""}, {"key": "prince", "label": "Simba", "value": "200", "description": ""}], "identifier": "lion_king_cast", "serverVersion": 1551438494776}'), -(9, '{"_id": "affc7614-a51b-4b5f-877a-ad932b38bf4b", "_rev": "v1", "type": "SettingConfiguration", "teamId": "6c8d2b9b-2246-47c2-949b-4fe29e888cc8", "settings": [{"key": "king", "label": "Mufasa", "value": "4800", "description": ""}, {"key": "prince", "label": "Simba", "value": "9000", "description": ""}], "identifier": "lion_king_cast", "serverVersion": 1551439200276}'); - -INSERT INTO core.settings_metadata (id, settings_id, document_id, identifier, server_version, team, team_id, provider_id, location_id) VALUES -(1, 1, 'settings-document-id-2', 'population_characteristics', null, null, null, null, null), -(2, 2, 'settings-document-id-1', 'site_characteristics', 1551438162336, 'Bukesa', '6c8d2b9b-2246-47c2-949b-4fe29e888cc8', 'demo', '44de66fb-e6c6-4bae-92bb-386dfe626eba'), -(3, 8, '31972118-c8fc-44c4-bdfb-55607022d17a', 'lion_king_cast', null, null ,'6c8d2b9b-2246-47c2-949b-4fe29e888cc8', null, null), -(4, 9, 'affc7614-a51b-4b5f-877a-ad932b38bf4b', 'lion_king_cast_2', 1551439200276, null ,'6c8d2b9b-2246-47c2-949b-4fe29e888cc8', null, null), -(5, 4, 'settings-document-id-4', 'site_characteristics', 1, null, '24f24d29-d3f3-4c91-868a-29e80efab829', null, null), -(6, 5, 'settings-document-id-5', 'site_characteristics', 1, null, '131869c5-d67c-4060-8fe1-2dee6041da22', null, null), -(7, 6, 'settings-document-id-6', 'site_characteristics', null, null, '73f7cf54-42b5-4cb6-b601-be151d34a9d8', null, null), -(8, 7, '0811b1df-ccaf-476f-8b36-5a489d0391d6', 'global_configs', 1, 'my-team', '7e104eee-ec8a-4733-bcf7-c02c51cf43f4', 'demo', null), -(9, 3, 'settings-document-id-3', 'site_characteristics', 1, null, 'f4d3be2c-c663-43e1-a670-462ca8c7a96c', null, null); \ No newline at end of file diff --git a/opensrp-core/src/test/resources/test-scripts/stock.sql b/opensrp-core/src/test/resources/test-scripts/stock.sql deleted file mode 100644 index 61c159f267..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/stock.sql +++ /dev/null @@ -1,42 +0,0 @@ ---clear data -TRUNCATE TABLE core.stock CASCADE; - -ALTER SEQUENCE core.stock_id_seq RESTART WITH 16; - -ALTER SEQUENCE core.stock_metadata_id_seq RESTART WITH 16; - ---insert data -INSERT INTO core.stock (id, json) VALUES -(1, '{"_id": "05934ae338431f28bf6793b24181ea5e", "type": "Stock", "value": -3, "to_from": "C/C", "version": 1521003030510, "_rev": "1-4f090916632e2ae10f1ef7f972aaf6d2", "identifier": 1, "providerid": "biddemo", "dateCreated": "2018-04-04T13:55:43.515+03:00", "date_created": 1520892000000, "date_updated": 1520939303991, "serverVersion": 1521003030510, "vaccine_type_id": "2", "transaction_type": "issued"}'), -(2, '{"_id": "05934ae338431f28bf6793b241974356", "type": "Stock", "value": 10, "to_from": "DHO", "version": 1521007341010, "_rev": "1-f24ec853ded69d25028985069960f71a", "identifier": 2, "providerid": "biddemo", "dateCreated": "2018-04-04T13:55:43.587+03:00", "date_created": 1518559200000, "date_updated": 1521007053945, "serverVersion": 1521007341010, "vaccine_type_id": "1", "transaction_type": "received"}'), -(3, '{"_id": "05934ae338431f28bf6793b241974f0e", "type": "Stock", "value": -1, "to_from": "C/C", "version": 1521007341010, "_rev": "1-6e7a4b9ee84403f5fa25c5d83269149b", "identifier": 3, "providerid": "biddemo", "dateCreated": "2018-04-04T13:55:43.633+03:00", "date_created": 1520892000000, "date_updated": 1521007153528, "serverVersion": 1521007341010, "vaccine_type_id": "1", "transaction_type": "issued"}'), -(4, '{"_id": "05934ae338431f28bf6793b241975c6c", "type": "Stock", "value": 12, "to_from": "Physical_recount", "version": 1521007342323, "_rev": "1-a57ae3bf0a9d652f00dc33c23e2c7a52", "identifier": 4, "providerid": "biddemo", "dateCreated": "2018-04-04T13:55:43.655+03:00", "date_created": 1518559200000, "date_updated": 1521007339163, "serverVersion": 1521007342323, "vaccine_type_id": "2", "transaction_type": "loss_adjustment"}'), -(5, '{"_id": "05934ae338431f28bf6793b241978ad9", "type": "Stock", "value": 20, "to_from": "DHO", "version": 1521009418783, "_rev": "1-1421e42faf02e9fe5a65279ee3b199c3", "identifier": 5, "providerid": "biddemo", "dateCreated": "2018-04-04T13:55:43.672+03:00", "date_created": 1521000000000, "date_updated": 1521009346585, "serverVersion": 1521009418783, "vaccine_type_id": "1", "transaction_type": "received"}'), -(6, '{"_id": "05934ae338431f28bf6793b2419a4bd9", "type": "Stock", "value": 20, "to_from": "DHO", "version": 1521022620903, "_rev": "1-aba3734a871fb2b88deab7bb7e7f3a60", "identifier": 6, "providerid": "biddemo", "dateCreated": "2018-04-04T13:55:43.683+03:00", "date_created": 1519855200000, "date_updated": 1521022504878, "serverVersion": 1521022620903, "vaccine_type_id": "1", "transaction_type": "received"}'), -(7, '{"_id": "05934ae338431f28bf6793b2419a590b", "type": "Stock", "value": -27, "to_from": "C/C", "version": 1521022620903, "_rev": "1-5f6fdd394f6c34143f07798dd7fe74b0", "identifier": 7, "providerid": "biddemo", "dateCreated": "2018-04-04T13:55:43.689+03:00", "date_created": 1520632800000, "date_updated": 1521022571660, "serverVersion": 1521022620903, "vaccine_type_id": "1", "transaction_type": "issued"}'), -(8, '{"_id": "05934ae338431f28bf6793b2419a606f", "type": "Stock", "value": 1, "to_from": "Physical_recount", "version": 1521023046990, "_rev": "1-872a0dd1e50ea9437786f69fad2d182a", "identifier": 8, "providerid": "biddemo", "dateCreated": "2018-04-04T13:55:43.693+03:00", "date_created": 1518559200000, "date_updated": 1521022962706, "serverVersion": 1521023046990, "vaccine_type_id": "1", "transaction_type": "loss_adjustment"}'), -(9, '{"_id": "05934ae338431f28bf6793b2419a6dc7", "type": "Stock", "value": 10, "to_from": "DHO", "version": 1521030501655, "_rev": "1-a3846a988777e252c6f9aba383300b78", "identifier": 9, "providerid": "biddemo", "dateCreated": "2018-04-04T13:55:43.705+03:00", "date_created": 1518559200000, "date_updated": 1521027411881, "serverVersion": 1521030501655, "vaccine_type_id": "2", "transaction_type": "received"}'), -(10, '{"_id": "05934ae338431f28bf6793b2419a72da", "type": "Stock", "value": -19, "to_from": "C/C", "version": 1521030501655, "_rev": "1-42168381f27525e3c9022fbc46358a4b", "identifier": 10, "providerid": "biddemo", "dateCreated": "2018-04-04T13:55:43.735+03:00", "date_created": 1519164000000, "date_updated": 1521027466540, "serverVersion": 1521030501655, "vaccine_type_id": "2", "transaction_type": "issued"}'), -(11, '{"_id": "05934ae338431f28bf6793b241b2daa6", "type": "Stock", "value": -7, "to_from": "C/C", "version": 1521074546344, "_rev": "1-65d5197a96e17a8febf61324fbe5d454", "identifier": 11, "providerid": "biddemo", "dateCreated": "2018-04-04T13:55:43.755+03:00", "date_created": 1521064800000, "date_updated": 1521074321594, "serverVersion": 1521074546344, "vaccine_type_id": "1", "transaction_type": "issued"}'), -(12, '{"_id": "05934ae338431f28bf6793b241b2df09", "type": "Stock", "value": -2, "to_from": "Physical_recount", "version": 1521074546344, "_rev": "1-4069d28441029c88717f71d622eab412", "identifier": 12, "providerid": "biddemo", "dateCreated": "2018-04-04T13:55:43.771+03:00", "date_created": 1521064800000, "date_updated": 1521074352741, "serverVersion": 1521074546344, "vaccine_type_id": "1", "transaction_type": "loss_adjustment"}'), -(13, '{"_id": "05934ae338431f28bf6793b241b3c445", "type": "Stock", "value": -6, "to_from": "C/C", "version": 1521112141441, "_rev": "1-509d0919039dc1b0f9180aa187a87b75", "identifier": 13, "providerid": "biddemo1", "dateCreated": "2018-04-04T13:55:43.787+03:00", "date_created": 1520632800000, "date_updated": 1521111867821, "serverVersion": 1521112141441, "vaccine_type_id": "1", "transaction_type": "issued"}'), -(14, '{"_id": "05934ae338431f28bf6793b241b3c6f9", "type": "Stock", "value": 2, "to_from": "DHO", "version": 1521112141441, "_rev": "1-7e45403108a172bd63486e35ec99ce79", "identifier": 14, "providerid": "biddemo1", "dateCreated": "2018-04-04T13:55:43.804+03:00", "date_created": 1518645600000, "date_updated": 1521111912719, "serverVersion": 1521112141441, "vaccine_type_id": "1", "transaction_type": "received"}'), -(15, '{"_id": "05934ae338431f28bf6793b241b3cd6f", "type": "Stock", "value": -55, "to_from": "C/C", "version": 1521112141441, "_rev": "1-83e0bc2abeda38e5aa282d1f8d75e6bc", "identifier": 15, "providerid": "biddemo1", "dateCreated": "2018-04-04T13:55:43.809+03:00", "date_created": 1520460000000, "date_updated": 1521111967331, "serverVersion": 1521112141441, "vaccine_type_id": "1", "transaction_type": "issued"}'); - - -INSERT INTO core.stock_metadata (id, stock_id, document_id, server_version, provider_id, location_id, team, team_id) VALUES -(1, 1, '05934ae338431f28bf6793b24181ea5e', 1521003030510, 'biddemo', null, null, null), -(2, 2, '05934ae338431f28bf6793b241974356', 1521007341010, 'biddemo', null, null, null), -(3, 3, '05934ae338431f28bf6793b241974f0e', 1521007341010, 'biddemo', null, null, null), -(4, 4, '05934ae338431f28bf6793b241975c6c', 1521007342323, 'biddemo', null, null, null), -(5, 5, '05934ae338431f28bf6793b241978ad9', 1521009418783, 'biddemo', null, null, null), -(6, 6, '05934ae338431f28bf6793b2419a4bd9', 1521022620903, 'biddemo', null, null, null), -(7, 7, '05934ae338431f28bf6793b2419a590b', 1521022620903, 'biddemo', null, null, null), -(8, 8, '05934ae338431f28bf6793b2419a606f', 1521023046990, 'biddemo', null, null, null), -(9, 9, '05934ae338431f28bf6793b2419a6dc7', 1521030501655, 'biddemo', null, null, null), -(10, 10, '05934ae338431f28bf6793b2419a72da', 1521030501655, 'biddemo', null, null, null), -(11, 11, '05934ae338431f28bf6793b241b2daa6', 1521074546344, 'biddemo', null, null, null), -(12, 12, '05934ae338431f28bf6793b241b2df09', 1521074546344, 'biddemo', null, null, null), -(13, 13, '05934ae338431f28bf6793b241b3c445', 1521112141441, 'biddemo1', null, null, null), -(14, 14, '05934ae338431f28bf6793b241b3c6f9', 1521112141441, 'biddemo1', null, null, null), -(15, 15, '05934ae338431f28bf6793b241b3cd6f', 1521112141441, 'biddemo1', null, null, null); \ No newline at end of file diff --git a/opensrp-core/src/test/resources/test-scripts/structure.sql b/opensrp-core/src/test/resources/test-scripts/structure.sql deleted file mode 100644 index 17ecf2a361..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/structure.sql +++ /dev/null @@ -1,10 +0,0 @@ ---clear data -TRUNCATE TABLE core.structure CASCADE; - -ALTER SEQUENCE core.structure_id_seq RESTART WITH 6; - -ALTER SEQUENCE core.structure_metadata_id_seq RESTART WITH 6; - -INSERT INTO core.structure (id, json) VALUES (1, '{"id": "90397", "type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[32.5978597, -14.1699446], [32.5978956, -14.1699609], [32.5978794, -14.1699947], [32.5978434, -14.1699784], [32.5978597, -14.1699446]]]}, "properties": {"uid": "41587456-b7c8-4c4e-b433-23a786f742fc", "code": "21384443", "type": "Residential Structure", "status": "Active", "version": 0, "parentId": "3734", "geographicLevel": 5, "effectiveStartDate": "2017-01-10T0000.000"}, "serverVersion": 1542376382851}'); - -INSERT INTO core.structure_metadata (id, structure_id, geojson_id, type, parent_id, uuid, status, server_version) VALUES (1, 1, '90397', 'Residential Structure', '3734', '41587456-b7c8-4c4e-b433-23a786f742fc', 'ACTIVE', 1542376382851); \ No newline at end of file diff --git a/opensrp-core/src/test/resources/test-scripts/task.sql b/opensrp-core/src/test/resources/test-scripts/task.sql deleted file mode 100644 index b2988be342..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/task.sql +++ /dev/null @@ -1,14 +0,0 @@ ---clear data -TRUNCATE TABLE core.task CASCADE; - -ALTER SEQUENCE core.task_id_seq RESTART WITH 6; - -ALTER SEQUENCE core.task_metadata_id_seq RESTART WITH 6; - - -INSERT INTO core.task (id, json) VALUES (4, '{"code": "IRS", "focus": "IRS Visit", "note": [{"text": "This should be assigned to patrick.", "time": "2018-01-01T08:00:00.000", "authorString": "demouser"}], "owner": "demouser", "status": "Ready", "priority": 3, "for": "location.properties.uid:41587456-b7c8-4c4e-b433-23a786f742fc", "authoredOn": "2018-10-31T07:00:00.000", "identifier": "tsk11231jh22", "description": "Spray House", "lastModified": "2018-11-12T15:50:57.055", "serverVersion": 1542027762554, "businessStatus": "Not Visited", "groupIdentifier": "2018_IRS-3734", "planIdentifier": "IRS_2018_S1", "executionStartDate": "2018-11-10T22:00:00.000"}'); -INSERT INTO core.task (id, json) VALUES (5, '{"code": "IRS", "focus": "IRS Visit", "note": [{"text": "This should be assigned to patrick.", "time": "2018-01-01T08:00:00.000", "authorString": "demouser"}], "owner": "demouser", "status": "Ready", "priority": 3, "for": "location.properties.uid:41587456-b7c8-4c4e-b433-23a786f742fc", "authoredOn": "2018-11-12T17:05:43.987", "identifier": "iyr-998njoo", "description": "Spray House", "lastModified": "2018-11-12T17:05:43.987", "businessStatus": "Not Visited", "groupIdentifier": "2018_IRS-3734", "planIdentifier": "IRS_2018_S2", "executionStartDate": "2018-11-10T22:00:00.000"}'); - - -INSERT INTO core.task_metadata (id, task_id, identifier, plan_identifier, group_identifier, for_entity, server_version) VALUES (1, 4, 'tsk11231jh22', 'IRS_2018_S1', '2018_IRS-3734', 'location.properties.uid:41587456-b7c8-4c4e-b433-23a786f742fc', 1542027762554); -INSERT INTO core.task_metadata (id, task_id, identifier, plan_identifier, group_identifier, for_entity, server_version) VALUES (2, 5, 'iyr-998njoo', 'IRS_2018_S2', '2018_IRS-3734', 'location.properties.uid:41587456-b7c8-4c4e-b433-23a786f742fc', 1542031602680); \ No newline at end of file diff --git a/opensrp-core/src/test/resources/test-scripts/view_configuration.sql b/opensrp-core/src/test/resources/test-scripts/view_configuration.sql deleted file mode 100644 index 9752ef53ef..0000000000 --- a/opensrp-core/src/test/resources/test-scripts/view_configuration.sql +++ /dev/null @@ -1,21 +0,0 @@ ---clear data -TRUNCATE TABLE core.view_configuration CASCADE; - -ALTER SEQUENCE core.view_configuration_id_seq RESTART WITH 6; - -ALTER SEQUENCE core.view_configuration_metadata_id_seq RESTART WITH 6; - ---insert data -INSERT INTO core.view_configuration (id, json) VALUES -(1, '{"_id": "92141b17040021a7ce326194ff0029f7", "_rev": "19-004e54d1f1cd1b29ac681ec74cc672d2", "type": "ViewConfiguration", "metadata": {"type": "Login", "background": {"orientation": "BOTTOM_TOP"}, "showPasswordCheckbox": true}, "identifier": "login", "serverVersion": 1515152954114}'), -(2, '{"_id": "19a2e8aa6739d77a2b780199c6122867", "_rev": "60-9eaf54f5e5aa77f399f746401feaaab6", "type": "ViewConfiguration", "metadata": {"type": "Main", "language": "en", "applicationName": "TB REACH", "enableJsonViews": true}, "identifier": "main", "serverVersion": 1516890951253}'), -(3, '{"_id": "3a065d7c3354eb2bc23c8a3bc303ba20", "_rev": "2-e7c21d42edca554d9b1fb500381ded8d", "type": "ViewConfiguration", "views": [{"label": "column_patient", "visible": true, "residence": {"position": 0, "layout_weight": "2"}, "identifier": "patient"}, {"label": "column_results", "visible": true, "residence": {"position": 1, "layout_weight": "2"}, "identifier": "results"}, {"label": "column_treat", "visible": true, "residence": {"position": 3, "layout_weight": "1.5"}, "identifier": "treat"}, {"label": "column_smr_results", "visible": true, "residence": {"position": 2, "layout_weight": "1.5"}, "identifier": "smr_results"}, {"label": "column_xpert_results", "visible": true, "residence": {"position": 2, "layout_weight": "1.5"}, "identifier": "xpert_results"}, {"label": "column_diagnosis", "visible": true, "residence": {"position": 4, "layout_weight": "1.5"}, "identifier": "diagnosis"}], "metadata": {"type": "Register", "searchBarText": "Name and Participant ID", "enableSortList": false, "enableFilterList": false, "enableAdvancedSearch": true}, "identifier": "positive_register", "serverVersion": 1516605871345}'), -(4, '{"_id": "3a065d7c3354eb2bc23c8a3bc303ef62", "_rev": "4-44df2edb68f7fd2d416c3d24e0966abd", "type": "ViewConfiguration", "jsonView": {"views": [{"views": [], "widget": "org.smartregister.view.customcontrols.CustomFontTextView", "properties": [{"name": "id", "type": "ref", "value": "results_header"}, {"name": "style", "type": "ref", "value": "@style/CustomFontTextViewStyle.ClientList.Medium"}, {"name": "layout_width", "type": "dimen", "value": "0dp"}, {"name": "layout_height", "type": "dimen", "value": "wrap_content"}, {"name": "layout_alignParentRight", "type": "BOOLEAN", "value": "true"}, {"name": "layout_marginRight", "type": "dimen", "value": "7dp"}, {"name": "layout_weight", "type": "float", "value": "3.4"}, {"name": "text", "type": "ref", "value": "@string/results"}, {"name": "textAllCaps", "type": "BOOLEAN", "value": "true"}, {"name": "textColor", "type": "ref", "value": "@color/client_list_grey"}, {"name": "textSize", "type": "dimen", "value": "16sp"}]}, {"views": [], "widget": "org.smartregister.view.customcontrols.CustomFontTextView", "properties": [{"name": "id", "type": "ref", "value": "treat_header"}, {"name": "style", "type": "ref", "value": "@style/CustomFontTextViewStyle.ClientList.Medium"}, {"name": "layout_width", "type": "dimen", "value": "0dp"}, {"name": "layout_height", "type": "dimen", "value": "wrap_content"}, {"name": "layout_centerHorizontal", "type": "BOOLEAN", "value": "true"}, {"name": "layout_weight", "type": "float", "value": "2.6"}, {"name": "text", "type": "ref", "value": "@string/treat"}, {"name": "textAllCaps", "type": "BOOLEAN", "value": "true"}, {"name": "textColor", "type": "ref", "value": "@color/client_list_grey"}, {"name": "textSize", "type": "dimen", "value": "16sp"}]}, {"views": [], "widget": "org.smartregister.view.customcontrols.CustomFontTextView", "properties": [{"name": "id", "type": "ref", "value": "diagnosis_header"}, {"name": "style", "type": "ref", "value": "@style/CustomFontTextViewStyle.ClientList.Medium"}, {"name": "layout_width", "type": "dimen", "value": "0dp"}, {"name": "layout_height", "type": "dimen", "value": "wrap_content"}, {"name": "layout_centerHorizontal", "type": "BOOLEAN", "value": "true"}, {"name": "layout_weight", "type": "float", "value": "2.6"}, {"name": "text", "type": "ref", "value": "@string/diagnosis"}, {"name": "textAllCaps", "type": "BOOLEAN", "value": "true"}, {"name": "textColor", "type": "ref", "value": "@color/client_list_grey"}, {"name": "textSize", "type": "dimen", "value": "16sp"}, {"name": "visibility", "type": "string", "value": "gone"}]}], "widget": "LinearLayout", "properties": [{"name": "id", "type": "ref", "value": "register_headers"}, {"name": "layout_width", "type": "dimen", "value": "fill_parent"}, {"name": "layout_height", "type": "dimen", "value": "wrap_content"}, {"name": "background", "type": "ref", "value": "@color/client_list_header_dark_grey"}, {"name": "baselineAligned", "type": "string", "value": "false"}, {"name": "orientation", "type": "string", "value": "horizontal"}]}, "identifier": "positive_register_header", "serverVersion": 1516614392971}'), -(5, '{"_id": "d243bc5737fb389e52601cb850299541", "_rev": "46-7fa67d54ca9938f5400a2eb8fbf7a54e", "type": "ViewConfiguration", "labels": {"date": "Tarehe", "form": "Fomu", "contacts": "Anwani", "record_results": "REKODI MATOKEO", "remove_patient": "Toa Mgonjwa", "first_encounter": "Makutano ya Kwanza", "service_history": "Historia ya Huduma", "positive_results": "Matokeo ya Kudhibitishwa", "positive_patients": "Wangonjwa Wa Kudhibitishwa", "no_results_recorded": "Hakuna Matokeo", "presumptive_patients": "Wagonjwa Watakaopimwa", "in_treatment_patients": "Wagonjwa Wanaotibiwa"}, "identifier": "lang_sw", "serverVersion": 1515152954118}'); - -INSERT INTO core.view_configuration_metadata (id, view_configuration_id, document_id, identifier, server_version) VALUES -(1, 1, '92141b17040021a7ce326194ff0029f7', 'login', 1515152954114), -(2, 2, '19a2e8aa6739d77a2b780199c6122867', 'main', 1516890951253), -(3, 3, '3a065d7c3354eb2bc23c8a3bc303ba20', 'positive_register', 1516605871345), -(4, 4, '3a065d7c3354eb2bc23c8a3bc303ef62', 'positive_register_header', 1516614392971), -(5, 5, 'd243bc5737fb389e52601cb850299541', 'lang_sw', 1515152954118); \ No newline at end of file diff --git a/opensrp-form/pom.xml b/opensrp-form/pom.xml deleted file mode 100755 index cbdcdc5b7a..0000000000 --- a/opensrp-form/pom.xml +++ /dev/null @@ -1,352 +0,0 @@ - - 4.0.0 - org.smartregister - - opensrp-server-form - jar - - 1.0.1 - - opensrp-server-form - OpenSRP Server Form module - http://github.com/OpenSRP/opensrp-server-form - - - ${project.basedir} - 0.11 - 3.1.0.RELEASE - always - UTF-8 - 2.8.1 - 1.5.1 - 2.4.2 - 5.1.36 - - 1.0.1 - 1.0.1 - - - - - - nexus-snapshots - Nexus Snapshots Repository - https://oss.sonatype.org/content/repositories/snapshots - false - - - nexus-releases - https://oss.sonatype.org/service/local/staging/deploy/maven2 - - - - - scm:git:git@github.com:OpenSRP/opensrp-server-form.git - scm:git:git@github.com:OpenSRP/opensrp-server-form.git - https://github.com/OpenSRP/opensrp-server-form - - - - - Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0.txt - repo - Open Smart Register Platform (OpenSRP) is Licensed under the Apache License, Version 2.0 - - - - - - opensrp_developer - OpenSRP Developer - info@smartregister.org - https://groups.google.com/forum/#!forum/opensrp-dev - OpenSRP - http://smartregister.org - - developer - - Africa/Nairobi - - - - - snapshots-repo - https://oss.sonatype.org/content/repositories/snapshots - - false - - - true - - - - motech.opensrp - Motech Snapshots Repository - http://nexus.motechproject.org/content/repositories/opensrp-server - - true - ${opensrp.updatePolicy} - - - - motech.nexus - Motech Snapshots Repository - http://nexus.motechproject.org/content/repositories/snapshots - - true - ${opensrp.updatePolicy} - - - - motech.nexus.release - Motech Snapshots Repository - http://nexus.motechproject.org/content/repositories/releases - - - - - - org.smartregister - opensrp-server-common - ${opensrp.common.version} - - - org.smartregister - opensrp-server-interface - ${opensrp.interface.version} - - - org.springframework - spring-core - ${spring.version} - - - commons-logging - commons-logging - - - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-aop - ${spring.version} - - - org.springframework - spring-aspects - ${spring.version} - - - junit - junit - 4.11 - test - - - org.mockito - mockito-all - 1.9.0 - - - org.powermock - powermock-module-junit4 - 1.4.11 - test - - - org.powermock - powermock-api-mockito - 1.4.11 - test - - - nl.jqno.equalsverifier - equalsverifier - 2.3 - test - - - org.motechproject - motech-platform-common-api - ${motech.version} - - - org.motechproject - motech-testing-utils - ${motech.version} - test - - - mysql - mysql-connector-java - ${mysql.connector.version} - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.7 - 1.7 - UTF-8 - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.3 - - - **/*.properties - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - none - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${nexus-staging-maven-plugin.version} - - - default-deploy - deploy - - deploy - - - - - nexus-snapshots - https://oss.sonatype.org/ - true - - - - org.jacoco - jacoco-maven-plugin - 0.7.9 - - ${basedir}/target/coverage-reports/jacoco-unit.exec - ${basedir}/target/coverage-reports/jacoco-unit.exec - - - - jacoco-initialize - - prepare-agent - - - - jacoco-site - test - - report - - - - - - org.eluder.coveralls - coveralls-maven-plugin - 4.0.0 - - - - - - ../build - true - - maven.properties - - - - ../assets/config - - - src/main/resources - - - - - - - release - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.5.1 - - - default-deploy - deploy - - deploy - - - - - nexus-releases - https://oss.sonatype.org/ - false - true - - - - - - - diff --git a/opensrp-form/src/main/java/org/opensrp/form/domain/FormData.java b/opensrp-form/src/main/java/org/opensrp/form/domain/FormData.java deleted file mode 100644 index e34d14a7bd..0000000000 --- a/opensrp-form/src/main/java/org/opensrp/form/domain/FormData.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.opensrp.form.domain; - -import net.jcip.annotations.Immutable; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; - -import java.text.MessageFormat; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Immutable -public class FormData { - @JsonProperty - private String bind_type; - @JsonProperty - private String default_bind_path; - @JsonProperty - private List fields; - @JsonProperty - private List sub_forms; - - @JsonIgnore - private Map mapOfFieldsByName; - - public FormData() { - } - - public FormData(String bind_type, String default_bind_path, List fields, List sub_forms) { - this.bind_type = bind_type; - this.default_bind_path = default_bind_path; - this.fields = fields; - this.sub_forms = sub_forms; - } - - public List fields() { - return fields; - } - - public String getField(String name) { - if (mapOfFieldsByName == null) { - createFieldMapByName(); - } - return mapOfFieldsByName.get(name); - } - - public String bindType() { - return bind_type; - } - - public String defaultBindPath() { - return default_bind_path; - } - - private void createFieldMapByName() { - mapOfFieldsByName = new HashMap<>(); - for (FormField field : fields) { - mapOfFieldsByName.put(field.name(), field.value()); - } - } - - public Map getFieldsAsMap() { - if (mapOfFieldsByName == null) { - createFieldMapByName(); - } - return mapOfFieldsByName; - } - - public SubFormData getSubFormByName(String name) { - for (SubFormData sub_form : sub_forms) { - if (StringUtils.equalsIgnoreCase(name, sub_form.name())) - return sub_form; - } - throw new RuntimeException(MessageFormat.format("No sub form with the given name: {0}, in formData: {1}", name, this)); - } - - public List subForms() { - return sub_forms; - } - - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-form/src/main/java/org/opensrp/form/domain/FormField.java b/opensrp-form/src/main/java/org/opensrp/form/domain/FormField.java deleted file mode 100644 index e773dfacd2..0000000000 --- a/opensrp-form/src/main/java/org/opensrp/form/domain/FormField.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.opensrp.form.domain; - -import net.jcip.annotations.Immutable; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -@Immutable -public class FormField { - @JsonProperty - private String name; - @JsonProperty - private String value; - @JsonProperty - private String source; - - public FormField() { - } - - public FormField(String name, String value, String source) { - this.name = name; - this.value = value; - this.source = source; - } - - public String name() { - return name; - } - - public String value() { - return value; - } - - public String source() { - return source; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-form/src/main/java/org/opensrp/form/domain/FormInstance.java b/opensrp-form/src/main/java/org/opensrp/form/domain/FormInstance.java deleted file mode 100644 index 5a1cd112f3..0000000000 --- a/opensrp-form/src/main/java/org/opensrp/form/domain/FormInstance.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.opensrp.form.domain; - -import java.util.List; - -import net.jcip.annotations.Immutable; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -@Immutable -public class FormInstance { - @JsonProperty - private String form_data_definition_version; - - @JsonProperty - private FormData form; - - public FormInstance() { - } - - public FormInstance(FormData form) { - this.form = form; - } - - public FormInstance(FormData form, String form_data_definition_version) { - this.form = form; - this.form_data_definition_version = form_data_definition_version; - } - - public FormData form() { - return form; - } - - public String getField(String name) { - return form.getField(name); - } - - public String bindType() { - return form.bindType(); - } - - public String defaultBindPath() { - return form.defaultBindPath(); - } - - public SubFormData getSubFormByName(String name) { - return form.getSubFormByName(name); - } - - public List subForms() { - return form.subForms(); - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-form/src/main/java/org/opensrp/form/domain/FormSubmission.java b/opensrp-form/src/main/java/org/opensrp/form/domain/FormSubmission.java deleted file mode 100644 index f9bfa39f96..0000000000 --- a/opensrp-form/src/main/java/org/opensrp/form/domain/FormSubmission.java +++ /dev/null @@ -1,157 +0,0 @@ -package org.opensrp.form.domain; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; -import org.ektorp.support.TypeDiscriminator; -import org.motechproject.model.MotechBaseDataObject; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@TypeDiscriminator("doc.type === 'FormSubmission'") -public class FormSubmission extends MotechBaseDataObject { - @JsonProperty - private String anmId; - @JsonProperty - private String instanceId; - @JsonProperty - private String formName; - @JsonProperty - private String entityId; - @JsonProperty - private long clientVersion; - @JsonProperty - private String formDataDefinitionVersion; - @JsonProperty - private FormInstance formInstance; - @JsonProperty - private long serverVersion; - @JsonProperty - private Map metadata; - - public FormSubmission() { - } - - public FormSubmission(String anmId, String instanceId, String formName, String entityId, long clientVersion, String formDataDefinitionVersion, FormInstance formInstance, long serverVersion) { - this.instanceId = instanceId; - this.formName = formName; - this.anmId = anmId; - this.clientVersion = clientVersion; - this.entityId = entityId; - this.formInstance = formInstance; - this.serverVersion = serverVersion; - this.formDataDefinitionVersion = formDataDefinitionVersion; - } - - public FormSubmission(String anmId, String instanceId, String formName, String entityId, String formDataDefinitionVersion, long clientVersion, FormInstance formInstance) { - this(anmId, instanceId, formName, entityId, clientVersion, formDataDefinitionVersion, formInstance, 0L); - } - - public String anmId() { - return this.anmId; - } - - public String instanceId() { - return this.instanceId; - } - - public String entityId() { - return this.entityId; - } - - public String formName() { - return this.formName; - } - - public String bindType() { - return formInstance.bindType(); - } - - public String defaultBindPath() { - return formInstance.defaultBindPath(); - } - - public FormInstance instance() { - return formInstance; - } - - public long clientVersion() { - return this.clientVersion; - } - - public String formDataDefinitionVersion() { - return this.formDataDefinitionVersion; - } - - public long serverVersion() { - return serverVersion; - } - - public void setServerVersion(long serverVersion) { - this.serverVersion = serverVersion; - } - - public String getField(String name) { - return formInstance.getField(name); - } - - public Map getFields(List fieldNames) { - Map fieldsMap = new HashMap<>(); - for (String fieldName : fieldNames) { - fieldsMap.put(fieldName, getField(fieldName)); - } - return fieldsMap; - } - - public String getInstanceId() { - return instanceId; - } - - public SubFormData getSubFormByName(String name) { - return formInstance.getSubFormByName(name); - } - - public List subForms() { - return formInstance.subForms(); - } - - public Map getMetadata() { - return metadata; - } - - public Object getMetadata(String key) { - if(metadata == null){ - return null; - } - return metadata.get(key); - } - - void addMetadata(String key, Object value) { - if(metadata == null){ - metadata = new HashMap<>(); - } - metadata.put(key, value); - } - - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(o, this, "id", "revision"); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, "id", "revision"); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-form/src/main/java/org/opensrp/form/domain/SubFormData.java b/opensrp-form/src/main/java/org/opensrp/form/domain/SubFormData.java deleted file mode 100644 index 4227c75c02..0000000000 --- a/opensrp-form/src/main/java/org/opensrp/form/domain/SubFormData.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.opensrp.form.domain; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class SubFormData { - @JsonProperty - private String name; - @JsonProperty - private String bind_type; - @JsonProperty - private String default_bind_path; - @JsonProperty - private List fields; - @JsonProperty - private List> instances; - - public SubFormData() { - this.instances = new ArrayList<>(); - this.name = ""; - } - - public SubFormData(String name, List> instances) { - this.instances = instances; - this.name = name; - } - - public String name() { - return name; - } - - public String defaultBindPath() { - return default_bind_path; - } - - public String bindType() { - return bind_type; - } - - public List fields() { - return fields; - } - - public List> instances() { - return instances; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-form/src/main/java/org/opensrp/form/repository/AllFormSubmissions.java b/opensrp-form/src/main/java/org/opensrp/form/repository/AllFormSubmissions.java deleted file mode 100644 index c3aebec03b..0000000000 --- a/opensrp-form/src/main/java/org/opensrp/form/repository/AllFormSubmissions.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.opensrp.form.repository; - -import org.ektorp.ComplexKey; -import org.ektorp.CouchDbConnector; -import org.ektorp.ViewQuery; -import org.ektorp.support.GenerateView; -import org.ektorp.support.View; -import org.motechproject.dao.MotechBaseRepository; -import org.opensrp.form.domain.FormSubmission; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; -import org.opensrp.common.AllConstants; - -import java.util.List; - -@Repository -public class AllFormSubmissions extends MotechBaseRepository { - @Autowired - protected AllFormSubmissions(@Qualifier(AllConstants.OPENSRP_FORM_DATABASE_CONNECTOR) CouchDbConnector db) { - super(FormSubmission.class, db); - } - - public boolean exists(String instanceId) { - return findByInstanceId(instanceId) != null; - } - - @GenerateView - public FormSubmission findByInstanceId(String instanceId) { - List submissions = queryView("by_instanceId", instanceId); - if (submissions == null || submissions.isEmpty()) { - return null; - } - return submissions.get(0); - } - - @View(name = "formSubmission_by_server_version", map = "function(doc) { if (doc.type === 'FormSubmission') { emit([doc.serverVersion], null); } }") - public List findByServerVersion(long serverVersion) { - ComplexKey startKey = ComplexKey.of(serverVersion + 1); - ComplexKey endKey = ComplexKey.of(Long.MAX_VALUE); - return db.queryView(createQuery("formSubmission_by_server_version").startKey(startKey).endKey(endKey).includeDocs(true), FormSubmission.class); - } - - public List allFormSubmissions(long serverVersion, Integer batchSize) { - ComplexKey startKey = ComplexKey.of(serverVersion + 1); - ComplexKey endKey = ComplexKey.of(Long.MAX_VALUE); - ViewQuery query = createQuery("formSubmission_by_server_version") - .startKey(startKey) - .endKey(endKey) - .includeDocs(true); - - if (batchSize != null) { - query.limit(batchSize); - } - return db.queryView(query, FormSubmission.class); - } - - @View(name = "formSubmission_by_anm_and_server_version", - map = "function(doc) { if (doc.type === 'FormSubmission') { emit([doc.anmId, doc.serverVersion], null); } }") - public List findByANMIDAndServerVersion(String anmId, long version, Integer batchSize) { - ComplexKey startKey = ComplexKey.of(anmId, version + 1); - ComplexKey endKey = ComplexKey.of(anmId, Long.MAX_VALUE); - ViewQuery query = createQuery("formSubmission_by_anm_and_server_version") - .startKey(startKey) - .endKey(endKey) - .includeDocs(true); - if (batchSize != null) { - query.limit(batchSize); - } - return db.queryView(query, FormSubmission.class); - } - - @View(name = "formSubmission_by_form_name_and_server_version", - map = "function(doc) { if (doc.type === 'FormSubmission') { emit([doc.formName, doc.serverVersion]); } }") - public List findByFormName(String formName, long version) { - ComplexKey startKey = ComplexKey.of(formName, version + 1); - ComplexKey endKey = ComplexKey.of(formName, Long.MAX_VALUE); - return db.queryView(createQuery("formSubmission_by_form_name_and_server_version") - .startKey(startKey) - .endKey(endKey) - .includeDocs(true), FormSubmission.class); - } - - @View(name = "formSubmission_by_metadata_keyval", - map = "function(doc) { if (doc.type === 'FormSubmission') { " - + "if(doc.metadata){" - + "for(var key in doc.metadata) {emit([key, doc.metadata[key]]);}" - + "}" - + "}}") - public List findByMetadata(String key, Object value) { - ComplexKey ckey = ComplexKey.of(key, value); - return db.queryView(createQuery("formSubmission_by_metadata_keyval") - .key(ckey) - .includeDocs(true), FormSubmission.class); - } - /** - * Get form submissions from the specified database - * @param sourceDb - * @param serverVersion - * @param batchSize - * @return - */ - public List allFormSubmissions(CouchDbConnector sourceDb,long serverVersion, Integer batchSize) { - ComplexKey startKey = ComplexKey.of(serverVersion + 1); - ComplexKey endKey = ComplexKey.of(Long.MAX_VALUE); - ViewQuery query = createQuery("formSubmission_by_server_version") - .startKey(startKey) - .endKey(endKey) - .includeDocs(true); - - if (batchSize != null) { - query.limit(batchSize); - } - return sourceDb.queryView(query, FormSubmission.class); - } - -} diff --git a/opensrp-form/src/main/java/org/opensrp/form/service/FormAttributeParser.java b/opensrp-form/src/main/java/org/opensrp/form/service/FormAttributeParser.java deleted file mode 100644 index 2b3925c42e..0000000000 --- a/opensrp-form/src/main/java/org/opensrp/form/service/FormAttributeParser.java +++ /dev/null @@ -1,774 +0,0 @@ -package org.opensrp.form.service; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpression; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -import org.opensrp.form.domain.FormField; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.domain.SubFormData; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.ResourceLoader; -import org.springframework.stereotype.Service; -import org.w3c.dom.Document; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonIOException; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.google.gson.JsonSyntaxException; -import com.mysql.jdbc.StringUtils; - -/** - * The class is the bridge that allows parsing and mapping of formSubmission fields with - * those defined in xls form for external system entity mappings. - */ - -@Service -public class FormAttributeParser { - private String jsonFilePath; - private String xmlFilePath; - - @Autowired - public FormAttributeParser(@Value("#{opensrp['form.directory.name']}") String formDirPath) throws IOException - { - ResourceLoader loader=new DefaultResourceLoader(); - formDirPath = loader.getResource(formDirPath).getURI().getPath(); - this.jsonFilePath = formDirPath; - this.xmlFilePath = formDirPath; - } - - public FormSubmissionMap createFormSubmissionMap(FormSubmission fs) throws JsonIOException, JsonSyntaxException, ParserConfigurationException, SAXException, IOException, XPathExpressionException { - JsonObject formDefinitionData = getFormDefinitionData(fs.formName()); - Document modelXml = getModelXmlData(fs.formName()); - JsonObject jsonForm = getJSONFormData(fs.formName()); - - Map formAttributes = getAttributesForBindPath(fs.defaultBindPath(), modelXml); - List fields = new ArrayList(); - for (FormField fsf : fs.instance().form().fields()) { - String bindPath = getPropertyBindFromFormDefinition(fsf.name(), fs.formName(), formDefinitionData); - String type = bindPath==null?null:getFieldType(bindPath, jsonForm); - Map fieldAttributes = bindPath==null?new HashMap():getAttributesForBindPath(bindPath, modelXml); - - boolean ismultiselect = bindPath==null?false:isMultiselect(bindPath, jsonForm); - if(!StringUtils.isEmptyOrWhitespaceOnly(fsf.value())){ - if(ismultiselect){ - String[] vals = fsf.value().split(" "); - Map> valCods = new HashMap<>(); - for (String v : vals) { - valCods.put(v, getInstanceAttributesForFormFieldAndValue(bindPath, v, jsonForm)); - } - fields.add(new FormFieldMap(fsf.name(), Arrays.asList(vals), fsf.source(), bindPath, type, fieldAttributes, valCods)); - } - else { - Map valueCodes = bindPath==null?null:getInstanceAttributesForFormFieldAndValue(bindPath, fsf.value(), jsonForm); - fields.add(new FormFieldMap(fsf.name(), fsf.value(), fsf.source(), bindPath, type, fieldAttributes, valueCodes)); - } - } - } - - List subforms = new ArrayList(); - if(fs.subForms() != null){ - for (SubFormData sf : fs.subForms()) { - for (Map flvl : sf.instances()) { - Map subformAttributes = getAttributesForBindPath(sf.defaultBindPath(), modelXml); - List sfFields = new ArrayList<>(); - for (Entry sffl : flvl.entrySet()) { - String source = getSourceFromSubformDefinition(sf.name(), sffl.getKey(), fs.formName(), formDefinitionData); - String bindPath = getPathFromSubformDefinition(sf.name(), sffl.getKey(), fs.formName(), formDefinitionData); - String type = bindPath==null?null:getFieldType(bindPath, jsonForm); - Map attributes = bindPath==null?new HashMap():getAttributesForBindPath(bindPath, modelXml); - boolean ismultiselect = bindPath==null?false:isMultiselect(bindPath, jsonForm); - if(ismultiselect){ - String[] vals = sffl.getValue().split(" "); - Map> valCods = new HashMap<>(); - for (String v : vals) { - valCods.put(v, getInstanceAttributesForFormFieldAndValue(bindPath, v, jsonForm)); - } - sfFields.add(new FormFieldMap(sffl.getKey(), Arrays.asList(vals), source, bindPath, type, attributes, valCods)); - } - else { - Map valueCodes = bindPath==null?null:getInstanceAttributesForFormFieldAndValue(bindPath, sffl.getValue(), jsonForm); - sfFields.add(new FormFieldMap(sffl.getKey(), sffl.getValue(), source, bindPath, type, attributes, valueCodes)); - } - } - subforms.add(new SubformMap(flvl.get("id"), sf.name(), sf.bindType(), sf.defaultBindPath(), subformAttributes, sfFields)); - } - } - } - return new FormSubmissionMap(fs, formAttributes, fields, subforms); - } - - public JsonObject getFormDefinitionData(String formName) throws JsonIOException, JsonSyntaxException, FileNotFoundException { - String filePath = this.jsonFilePath+"/"+formName+"/form_definition.json"; - JsonParser parser = new JsonParser(); - Object obj = parser.parse(new FileReader(filePath)); - return (JsonObject)obj; - } - - public JsonObject getJSONFormData(String formName) throws JsonIOException, JsonSyntaxException, FileNotFoundException { - String filePath = this.jsonFilePath+"/"+formName+"/form.json"; - JsonParser parser = new JsonParser(); - Object obj = parser.parse(new FileReader(filePath)); - return (JsonObject)obj; - } - - public Document getModelXmlData(String formName) throws ParserConfigurationException, SAXException, IOException { - String filePath = this.xmlFilePath+"/"+formName+"/model.xml"; - File file = new File(filePath); - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = factory.newDocumentBuilder(); - return builder.parse(file); - } - - /** - * The method returns the field name in form submission mapped with custom attributes given as attributeMap. - * Ex: What is the field name in given form submission that is mapped with entity=person - * and entity_id=first_name - * @param attributeMap - * @param formSubmission - * @return - * @throws IOException - * @throws JsonSyntaxException - * @throws SAXException - * @throws ParserConfigurationException - * @throws XPathExpressionException - */ - public String getFieldName(Map attributeMap,FormSubmission formSubmission) throws JsonSyntaxException, IOException, XPathExpressionException, ParserConfigurationException, SAXException - { - String fieldName = ""; - Node fieldTag = getFieldTagFromModel(attributeMap,formSubmission); - String bind =getXPath(fieldTag); - fieldName = getFieldNameFromFormDefinition(bind,formSubmission.formName()); - return fieldName; - } - - /** - * The method returns the field name in form submission in given subform(repeat group) mapped with custom attributes given as attributeMap. - * Ex: What is the field name in given form submission in subform=child_born that is - * mapped with entity=person and entity_id=first_name - * @param attributeMap - * @param subform - * @param formSubmission - * @return - * @throws IOException - * @throws SAXException - * @throws ParserConfigurationException - * @throws XPathExpressionException - */ - public String getFieldName(Map attributeMap, String subform, FormSubmission formSubmission) throws XPathExpressionException, ParserConfigurationException, SAXException, IOException - { - String fieldName = ""; - Node fieldTag = getFieldTagFromModel(attributeMap, subform, formSubmission); - String bind =getXPath(fieldTag); - fieldName = getFieldNameFromFormDefinition(bind, subform, formSubmission); - return fieldName; - } - - /** - * Returns the field name in form submission with given bind path - * @param bind - * @param formName - * @param formSubmission - * @return - * @throws IOException - * @throws JsonSyntaxException - */ - String getFieldNameFromFormDefinition(String bind, String formName) throws JsonSyntaxException, IOException - { - String fieldAttribute = ""; - JsonObject jsonObject = getFormDefinitionData(formName); - JsonElement formElement = jsonObject.get("form"); - JsonElement subformElement = null; - JsonObject fields = null; - JsonObject individualField = null; - JsonElement individualBindObj = null; - JsonElement individualNameObj = null; - JsonArray fieldArray = null; - JsonArray subFormArray = null; - if(formElement!=null) - { - fields = formElement.getAsJsonObject(); - - for(Entry element:fields.entrySet()) - { - if(element.getKey().equalsIgnoreCase("fields")) - { - fieldArray = element.getValue().getAsJsonArray(); - } - if(element.getKey().equalsIgnoreCase("sub_forms")) - { - subFormArray = element.getValue().getAsJsonArray(); - } - } - for(JsonElement fieldElement:fieldArray) - { - individualField = fieldElement.getAsJsonObject(); - individualBindObj = individualField.get("bind"); - individualNameObj = individualField.get("name"); - if(individualBindObj!=null) - { - if(individualBindObj.getAsString().equalsIgnoreCase(bind)) - { - fieldAttribute = individualNameObj.getAsString(); - return fieldAttribute; - } - } - } - for(JsonElement fieldElement:subFormArray) - { - individualField = fieldElement.getAsJsonObject(); - subformElement = individualField.get("fields"); - } - for(JsonElement fieldElement:subformElement.getAsJsonArray()) - { - individualField = fieldElement.getAsJsonObject(); - individualNameObj = individualField.get("name"); - individualBindObj = individualField.get("bind"); - if(individualBindObj!=null) - { - if(individualNameObj.getAsString().equalsIgnoreCase(bind)) - { - fieldAttribute = individualNameObj.getAsString(); - return fieldAttribute; - } - } - } - } - - - return null; - } - - /** - * Returns the field name in given subform of given form submission with specified bind path - * @param bind - * @param subform - * @param formSubmission - * @return - * @throws IOException - * @throws JsonSyntaxException - */ - String getFieldNameFromFormDefinition(String bind, String subform, FormSubmission formSubmission) throws JsonSyntaxException, IOException - { - String formName = formSubmission.formName(); - JsonObject jsonObject = getFormDefinitionData(formName); - JsonArray subforms = jsonObject.get("form").getAsJsonObject().get("sub_forms").getAsJsonArray(); - for (JsonElement jsonElement : subforms) { - if(jsonElement.getAsJsonObject().get("name").getAsString().equalsIgnoreCase(subform)){ - JsonArray flarr = jsonElement.getAsJsonObject().get("fields").getAsJsonArray(); - for (JsonElement fl : flarr) { - if(fl.getAsJsonObject().has - ("bind") && fl.getAsJsonObject().get("bind").getAsString().equalsIgnoreCase(bind)){ - return fl.getAsJsonObject().get("name").getAsString(); - } - } - } - } - - return null; - } - - /** - * Returns the Node in model.xml of given form submission that maps to given custom attributes - * @param attributeMapForm - * @param formSubmission - * @return - * @throws IOException - * @throws SAXException - * @throws ParserConfigurationException - * @throws XPathExpressionException - */ - Node getFieldTagFromModel(Map attributeMapForm,FormSubmission formSubmission) throws IOException, XPathExpressionException, ParserConfigurationException, SAXException - { - Node lastNode = null; - String formName = formSubmission.formName(); - Document document = getModelXmlData(formName); - XPathFactory xPathFactory = XPathFactory.newInstance(); - XPath xpath = xPathFactory.newXPath(); - String expression = "//*["; - String expressionQuery = ""; - NodeList nodeList; - for(String key:attributeMapForm.keySet()) - { - if(expressionQuery.length()>0) - { - expressionQuery += " and "; - } - expressionQuery += "@"+key+"='"+attributeMapForm.get(key)+"'"; - } - - expression += expressionQuery; - expression += "]"; - nodeList = (NodeList) xpath.evaluate(expression, document, XPathConstants.NODESET); - lastNode = nodeList.item(0); - return lastNode; - } - - /** - * Returns the Node in model.xml of given subform of given form submission that maps to given custom attributes - * @param attributeMapForm - * @param subform - * @param formSubmission - * @return - * @throws IOException - * @throws SAXException - * @throws ParserConfigurationException - * @throws XPathExpressionException - */ - public Node getFieldTagFromModel(Map attributeMapForm, String subform, FormSubmission formSubmission) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException - { - Node lastNode = null; - String formName = formSubmission.formName(); - Document document = getModelXmlData(formName); - XPathFactory xPathFactory = XPathFactory.newInstance(); - XPath xpath = xPathFactory.newXPath(); - String expression = getDefaultBindPathFromSubformDefinition(subform, formSubmission)+"/node()["; - String expressionQuery = ""; - NodeList nodeList; - for(String key:attributeMapForm.keySet()) - { - if(expressionQuery.length()>0) - { - expressionQuery += " and "; - } - expressionQuery += "@"+key+"='"+attributeMapForm.get(key)+"'"; - } - - expression += expressionQuery; - expression += "]"; - nodeList = (NodeList) xpath.evaluate(expression, document, XPathConstants.NODESET); - lastNode = nodeList.item(0); - return lastNode; - } - - /** - * Get attributes and their values for given list of mappings. This should only be used for mapping those are - * unique in xls forms. Otherwise may lead to inconsistent and incomplete data - * @param attributeName - * @param formSubmission - * @return - * @throws IOException - * @throws SAXException - * @throws ParserConfigurationException - * @throws XPathExpressionException - */ - public Map getUniqueAttributeValue(List attributeName, FormSubmission formSubmission) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException - { - Map map = new HashMap<>(); - - Node lastNode = null; - String formName = formSubmission.formName(); - Document document = getModelXmlData(formName); - XPathFactory xPathFactory = XPathFactory.newInstance(); - XPath xpath = xPathFactory.newXPath(); - String expression = "//*["; - String expressionQuery = ""; - NodeList nodeList; - for(String att:attributeName) - { - if(expressionQuery.length()>0) - { - expressionQuery += " and "; - } - expressionQuery += "@"+att; - } - - expression += expressionQuery; - expression += "]"; - nodeList = (NodeList) xpath.evaluate(expression, document, XPathConstants.NODESET); - lastNode = nodeList.item(0); - - NamedNodeMap attributes = lastNode.getAttributes(); - for(int i=0;i getAttributesForField (String fieldName, String formName) throws JsonSyntaxException, IOException, XPathExpressionException, ParserConfigurationException, SAXException{ - - String formBindForField = getPropertyBindFromFormDefinition(fieldName, formName); - Node tagAndAttributes = null; - if(formBindForField!=null) - { - tagAndAttributes = getFormPropertyNameForAttribute(formBindForField, getModelXmlData(formName)); - } - - return convertToMap(tagAndAttributes); - - } - public Map getAttributesForField (String fieldName, String subform, String formName) throws JsonSyntaxException, IOException, XPathExpressionException, ParserConfigurationException, SAXException{ - - String formBindForField = getPathFromSubformDefinition(subform, fieldName, formName, getFormDefinitionData(formName)); - Node tagAndAttributes = null; - if(formBindForField!=null) - { - tagAndAttributes = getFormPropertyNameForAttribute(formBindForField, getModelXmlData(formName)); - } - - return convertToMap(tagAndAttributes); - - } - - public Map getAttributesForBindPath (String bindPath, Document xmlModel) throws XPathExpressionException, ParserConfigurationException, SAXException, IOException{ - return convertToMap(getFormPropertyNameForAttribute(bindPath, xmlModel)); - } - - public Map getAttributesForBindPath (String bindPath, String formName) throws XPathExpressionException, ParserConfigurationException, SAXException, IOException{ - Document xmlModel = getModelXmlData(formName); - return convertToMap(getFormPropertyNameForAttribute(bindPath, xmlModel)); - } - - private Map convertToMap(Node tagAndAttributes){ - Map attributeMap = new HashMap<>(); - Node attributeNode = null; - - if(tagAndAttributes!=null) - { - NamedNodeMap attributes = tagAndAttributes.getAttributes(); - for(int i=0;i convertToMap(JsonElement element) { - if(element == null){ - return new HashMap<>(); - } - Set> set = element.getAsJsonObject().entrySet(); - Iterator> iterator = set.iterator(); - HashMap map = new HashMap(); - while (iterator.hasNext()) { - Entry entry = iterator.next(); - String key = entry.getKey(); - JsonElement value = entry.getValue(); - map.put(key, value.getAsString()); - } - return map; - } - /** - * Returns the custom attributes associated with the given subform in given form submission - * @param subformName - * @param formSubmission - * @return - * @throws IOException - * @throws JsonSyntaxException - * @throws SAXException - * @throws ParserConfigurationException - * @throws XPathExpressionException - */ - public Map getAttributesForSubform (String subformName, FormSubmission formSubmission) throws JsonSyntaxException, IOException, XPathExpressionException, ParserConfigurationException, SAXException{ - String formBindForField = ""; - Node tagAndAttributes = null; - // From form_definition.json - formBindForField = getDefaultBindPathFromSubformDefinition(subformName, formSubmission); - // xpath in model.xml - if(formBindForField!=null && !formBindForField.equals("null") && formBindForField.length()>0) - { - tagAndAttributes = getFormPropertyNameForAttribute(formBindForField, getModelXmlData(formSubmission.formName())); - } - - return convertToMap(tagAndAttributes); - } - - /** - * Returns the value of custom code associated with specified field and selected value for given subform and form submission. - * The function is used to get custom code value of selected option in form submission from choices sheet in xls form. - * @param fieldName - * @param fieldVal - * @param subform - * @param jsonForm - * @param formSubmission - * @return - * @throws IOException - * @throws JsonSyntaxException - */ - public Map getInstanceAttributesForFormFieldAndValue(String fieldName, String fieldVal, String subform, String formName, JsonObject formDefinition, JsonObject jsonForm) throws JsonSyntaxException, IOException - { - String bindPath = null; - if(StringUtils.isEmptyOrWhitespaceOnly(subform)){ - bindPath = getPropertyBindFromFormDefinition(fieldName, formName, formDefinition); - } - else { - bindPath = getPathFromSubformDefinition(subform, fieldName, formName, formDefinition); - } - - return getInstanceAttributesForFormFieldAndValue(bindPath, fieldVal, jsonForm); - } - - public Map getInstanceAttributesForFormFieldAndValue(String fieldName, String fieldVal, String subform, FormSubmission fs) throws JsonSyntaxException, IOException - { - String bindPath = null; - if(StringUtils.isEmptyOrWhitespaceOnly(subform)){ - bindPath = getPropertyBindFromFormDefinition(fieldName, fs.formName(), getFormDefinitionData(fs.formName())); - } - else { - bindPath = getPathFromSubformDefinition(subform, fieldName, fs.formName(), getFormDefinitionData(fs.formName())); - } - - return getInstanceAttributesForFormFieldAndValue(bindPath, fieldVal, getJSONFormData(fs.formName())); - } - - public Map getInstanceAttributesForFormFieldAndValue(String fieldBindPath, String fieldVal, JsonObject jsonForm) throws JsonSyntaxException, IOException - { - String[] sps = fieldBindPath.split("/"); - int level = sps.length-4; - String nodeNameToFind = sps[sps.length-1]; - JsonObject node = getChildrenOfLevel(level, jsonForm, nodeNameToFind); - - if(node != null && node.getAsJsonObject().has("children")){ - JsonArray nodeChAr = node.getAsJsonObject().get("children").getAsJsonArray(); - for (int j = 0; j < nodeChAr.size(); j++) { - JsonObject option = nodeChAr.get(j).getAsJsonObject(); - if(option.get("name").getAsString().equalsIgnoreCase(fieldVal)){ - return convertToMap(option.get("instance")); - } - } - } - - return null; - } - - public String getFieldType(String fieldBindPath, JsonObject jsonForm) - { - String[] sps = fieldBindPath.split("/"); - int level = sps.length-4; - String nodeNameToFind = sps[sps.length-1]; - JsonObject node = getChildrenOfLevel(level, jsonForm, nodeNameToFind); - - if(node != null && node.getAsJsonObject().has("type")){ - return node.getAsJsonObject().get("type").getAsString(); - } - return null; - } - - public boolean isMultiselect(String fieldBindPath, JsonObject jsonForm) - { - String[] sps = fieldBindPath.split("/"); - int level = sps.length-4; - String nodeNameToFind = sps[sps.length-1]; - JsonObject node = getChildrenOfLevel(level, jsonForm, nodeNameToFind); - - if(node != null && node.getAsJsonObject().has("children") - && node.has("type") - && (node.get("type").getAsString().startsWith("select all") || node.get("type").getAsString().startsWith("select multiple"))){ - return true; - } - - return false; - } - - private JsonObject getChildrenOfLevel(int level, JsonObject node, String nodeName){ - for (JsonElement ch : getChildren(node)) { - if(ch.getAsJsonObject().has("type")){ - for (int i = 1; i <= level; i++) {//3 - String ccurrchnmae = ch.getAsJsonObject().get("name").getAsString(); - if(i==level){ - if(ccurrchnmae.equalsIgnoreCase(nodeName)){ - return ch.getAsJsonObject(); - } - continue; - } - - if(!ch.getAsJsonObject().has("children")){ - break; - } - JsonObject obj = getChildrenOfLevel(level-i, ch.getAsJsonObject(), nodeName); - if(obj != null){ - return obj; - } - } - } - } - return null; - } - - private JsonArray getChildren(JsonObject node){ - if(!node.has("children")){ - return new JsonArray(); - } - - return node.getAsJsonArray("children"); - - } - - /** - * read default bind path from form_definition.json for given subform in given formSubmission. This is used to get the xpath in model.xml for subform. - * @throws - * @throws JsonSyntaxException - * @throws JsonIOException - */ - String getDefaultBindPathFromSubformDefinition(String subformName, FormSubmission formSubmission) throws IOException, JsonSyntaxException - { - JsonObject jsonObject = getFormDefinitionData(formSubmission.formName()); - JsonArray subforms = jsonObject.get("form").getAsJsonObject().get("sub_forms").getAsJsonArray(); - for (JsonElement jsonElement : subforms) { - if(jsonElement.getAsJsonObject().get("name").getAsString().equalsIgnoreCase(subformName)){ - return jsonElement.getAsJsonObject().get("default_bind_path").getAsString(); - } - } - - return null; - } - - /** - * Gets the bind path of specified field for given subform in given form submission - * @param subformName - * @param field - * @param formSubmission - * @return - * @throws - * @throws JsonSyntaxException - * @throws JsonIOException - */ - String getPathFromSubformDefinition(String subformName, String field, String formName, JsonObject formDefinition) throws IOException, JsonSyntaxException - { - JsonArray subforms = formDefinition.get("form").getAsJsonObject().get("sub_forms").getAsJsonArray(); - for (JsonElement jsonElement : subforms) { - if(jsonElement.getAsJsonObject().get("name").getAsString().equalsIgnoreCase(subformName)){ - JsonArray flarr = jsonElement.getAsJsonObject().get("fields").getAsJsonArray(); - for (JsonElement fl : flarr) { - if(fl.getAsJsonObject().get("name").getAsString().equalsIgnoreCase(field) - &&fl.getAsJsonObject().has("bind")){ - return fl.getAsJsonObject().get("bind").getAsString(); - } - } - } - } - - return null; - } - /** - * Gets the bind path of specified field for given subform in given form submission - * @param subformName - * @param field - * @param formSubmission - * @return - * @throws JsonSyntaxException - * @throws IOException - */ - String getSourceFromSubformDefinition(String subformName, String field, String formName, JsonObject formDefinition) throws IOException, JsonSyntaxException - { - JsonArray subforms = formDefinition.get("form").getAsJsonObject().get("sub_forms").getAsJsonArray(); - for (JsonElement jsonElement : subforms) { - if(jsonElement.getAsJsonObject().get("name").getAsString().equalsIgnoreCase(subformName)){ - JsonArray flarr = jsonElement.getAsJsonObject().get("fields").getAsJsonArray(); - for (JsonElement fl : flarr) { - if(fl.getAsJsonObject().get("name").getAsString().equalsIgnoreCase(field) - &&fl.getAsJsonObject().has("source")){ - return fl.getAsJsonObject().get("source").getAsString(); - } - } - } - } - - return null; - } - - /** - * Gets the bind path from form_definition.json in given formSubmission for specified field - * @throws JsonSyntaxException - * @throws JsonIOException - */ - String getPropertyBindFromFormDefinition(String fieldName, String formName) throws JsonSyntaxException, IOException - { - JsonObject jsonObject = getFormDefinitionData(formName); - return getPropertyBindFromFormDefinition(fieldName, formName, jsonObject); - } - - String getPropertyBindFromFormDefinition(String fieldName, String formName, JsonObject formDefinition) throws JsonSyntaxException, IOException - { - JsonElement formElement = formDefinition.get("form"); - JsonArray formFields = formElement.getAsJsonObject().get("fields").getAsJsonArray(); - - for(JsonElement fieldElement : formFields) - { - if(fieldElement.getAsJsonObject().has("bind")){ - String bind = fieldElement.getAsJsonObject().get("bind").getAsString(); - String name = fieldElement.getAsJsonObject().get("name").getAsString(); - if(name.equalsIgnoreCase(fieldName)){ - return bind; - } - } - } - - return null; - } - - /** - * Gets the Node from model.xml that maps to specified bind path in given form submission - * @param xmlModel - * @throws XPathExpressionException - * @throws IOException - * @throws SAXException - * @throws ParserConfigurationException - */ - Node getFormPropertyNameForAttribute(String formBindForField, Document xmlModel) throws XPathExpressionException, ParserConfigurationException, SAXException, IOException - { - if(formBindForField.endsWith("/")){ - formBindForField = formBindForField.substring(0, formBindForField.length()-1); - } - Node lastNode = null; - XPathFactory xPathFactory = XPathFactory.newInstance(); - XPath xPath = xPathFactory.newXPath(); - //put the xpath to get - XPathExpression expr = xPath.compile(formBindForField); - - lastNode = (Node) expr.evaluate(xmlModel, XPathConstants.NODE); - - return lastNode; - } -} diff --git a/opensrp-form/src/main/java/org/opensrp/form/service/FormFieldMap.java b/opensrp-form/src/main/java/org/opensrp/form/service/FormFieldMap.java deleted file mode 100644 index b4d6a6c782..0000000000 --- a/opensrp-form/src/main/java/org/opensrp/form/service/FormFieldMap.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.opensrp.form.service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class FormFieldMap { - private String name; - private List values; - private String source; - private String bindPath; - private String type; - private Map fieldAttributes; - private Map> valuesCodes; - - public FormFieldMap(String name, List values, String source, String bindPath, String type, Map attributes, Map> valuesCodes) { - this.name = name; - this.values = values; - this.source = source; - this.bindPath = bindPath; - this.type = type; - this.fieldAttributes = attributes; - this.valuesCodes = valuesCodes; - } - public FormFieldMap(String name, String value, String source, String bindPath, String type, Map attributes, Map valueCodes) { - this.name = name; - addToValueList(value); - this.source = source; - this.bindPath = bindPath; - this.type = type; - this.fieldAttributes = attributes; - addToValueCodeList(value, valueCodes); - } - public String name() { - return name; - } - public String value() { - if(values.size() > 1){ - throw new RuntimeException("Multiset values can not be handled like single valued fields. Use function getValues"); - } - if(values == null || values.size() == 0){ - return null; - } - - return values.get(0); - } - - public List values() { - return values; - } - - private void addToValueList(String value) { - if(values == null){ - values = new ArrayList<>(); - } - values.add(value); - } - private void addToValueCodeList(String value, Map valueCodes) { - if(valuesCodes == null){ - valuesCodes = new HashMap<>(); - } - valuesCodes.put(value, valueCodes); - } - - public String source() { - return source; - } - public String bindPath() { - return bindPath; - } - public String type() { - return type; - } - public Map fieldAttributes() { - return fieldAttributes; - } - public Map> valuesCodes() { - return valuesCodes; - } - public Map valueCodes(String value) { - return valuesCodes.get(value); - } - - public String getName() { - return name; - } - public List getValues() { - return values; - } - public String getSource() { - return source; - } - public String getBindPath() { - return bindPath; - } - public String getType() { - return type; - } - public Map getFieldAttributes() { - return fieldAttributes; - } - public Map> getValuesCodes() { - return valuesCodes; - } - } - - \ No newline at end of file diff --git a/opensrp-form/src/main/java/org/opensrp/form/service/FormSubmissionConverter.java b/opensrp-form/src/main/java/org/opensrp/form/service/FormSubmissionConverter.java deleted file mode 100644 index 00ead2ea9b..0000000000 --- a/opensrp-form/src/main/java/org/opensrp/form/service/FormSubmissionConverter.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.opensrp.form.service; - -import com.google.gson.Gson; -import org.opensrp.dto.form.FormSubmissionDTO; -import org.opensrp.form.domain.FormInstance; -import org.opensrp.form.domain.FormSubmission; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.text.MessageFormat; - -import static java.lang.Long.parseLong; -import static java.lang.String.valueOf; - -public class FormSubmissionConverter { - private static Logger logger = LoggerFactory.getLogger(FormSubmissionConverter.class.toString()); - - public static FormSubmissionDTO from(FormSubmission formSubmission) { - return new FormSubmissionDTO(formSubmission.anmId(), formSubmission.instanceId(), formSubmission.entityId(), formSubmission.formName(), - new Gson().toJson(formSubmission.instance()), valueOf(formSubmission.clientVersion()), formSubmission.formDataDefinitionVersion()) - .withServerVersion(valueOf(formSubmission.serverVersion())); - } - - public static FormSubmission toFormSubmission(FormSubmissionDTO formSubmissionDTO) { - try { - FormInstance formInstance = new Gson().fromJson(formSubmissionDTO.getFormInstance(), FormInstance.class); - return new FormSubmission(formSubmissionDTO.getAnmId(), formSubmissionDTO.getInstanceId(), formSubmissionDTO.getFormName(), formSubmissionDTO.getEntityId(), - formSubmissionDTO.getFormDataDefinitionVersion(), parseLong(formSubmissionDTO.getClientVersion()), formInstance); - } catch (Exception e) { - logger.error(MessageFormat.format("Converting Form Submission :{0}, failed with error: {1}.", formSubmissionDTO, e)); - throw e; - } - } - - public static FormSubmission toFormSubmissionWithVersion(FormSubmissionDTO formSubmissionDTO) { - return new FormSubmission(formSubmissionDTO.getAnmId(), formSubmissionDTO.getInstanceId(), formSubmissionDTO.getFormName(), - formSubmissionDTO.getEntityId(), parseLong(formSubmissionDTO.getClientVersion()), formSubmissionDTO.getFormDataDefinitionVersion(), new Gson().fromJson(formSubmissionDTO.getFormInstance(), FormInstance.class), - parseLong(formSubmissionDTO.getServerVersion())); - } -} diff --git a/opensrp-form/src/main/java/org/opensrp/form/service/FormSubmissionMap.java b/opensrp-form/src/main/java/org/opensrp/form/service/FormSubmissionMap.java deleted file mode 100644 index 420ecfea2d..0000000000 --- a/opensrp-form/src/main/java/org/opensrp/form/service/FormSubmissionMap.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.opensrp.form.service; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.opensrp.form.domain.FormSubmission; - -public class FormSubmissionMap { - public String providerId() { - return fs.anmId(); - } - - public String instanceId() { - return fs.instanceId(); - } - - public String formName() { - return fs.formName(); - } - - public String entityId() { - return fs.entityId(); - }; - - public long clientTimestamp() { - return fs.clientVersion(); - }; - - public String formVersion() { - return fs.formDataDefinitionVersion(); - } - - public long serverTimestamp() { - return fs.serverVersion(); - } - - public String bindType() { - return fs.bindType(); - } - - public String bindPath() { - return fs.defaultBindPath(); - } - - public Map formAttributes() { - return formAttributes; - } - - public List fields() { - return fields; - } - - public List subforms() { - return subforms; - } - - public String getFieldValue(String field) { - for (FormFieldMap f : fields) { - if(f.name().equalsIgnoreCase(field)){ - return f.value(); - } - } - return null; - } - public FormFieldMap getField(String field) { - for (FormFieldMap f : fields) { - if(f.name().equalsIgnoreCase(field)){ - return f; - } - } - return null; - } - - public SubformMap getSubform(String entityId, String subformName) { - for (SubformMap sf : subforms) { - if(sf.name().equalsIgnoreCase(subformName) && sf.entityId().equalsIgnoreCase(entityId)){ - return sf; - } - } - return null; - } - - // Fields below should not be editable by external modules - void setFormAttributes(Map formAttributes) { - this.formAttributes = formAttributes; - } - void setFields(List fields) { - this.fields = fields; - } - void setSubforms(List subforms) { - this.subforms = subforms; - } - - private Map formAttributes; - private List fields = new ArrayList<>(); - private List subforms = new ArrayList(); - private FormSubmission fs; - - public FormSubmissionMap(FormSubmission fs, Map formAttributes, - List fields, List subforms) { - this.fs = fs; - this.formAttributes = formAttributes; - this.fields = fields; - this.subforms = subforms; - } - - -} \ No newline at end of file diff --git a/opensrp-form/src/main/java/org/opensrp/form/service/FormSubmissionService.java b/opensrp-form/src/main/java/org/opensrp/form/service/FormSubmissionService.java deleted file mode 100644 index 641413cb4e..0000000000 --- a/opensrp-form/src/main/java/org/opensrp/form/service/FormSubmissionService.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.opensrp.form.service; - -import ch.lambdaj.function.convert.Converter; - -import org.ektorp.CouchDbConnector; -import org.opensrp.common.util.DateUtil; -import org.opensrp.dto.form.FormSubmissionDTO; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.repository.AllFormSubmissions; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.Comparator; -import java.util.List; - -import static ch.lambdaj.collection.LambdaCollections.with; -import static java.text.MessageFormat.format; -import static java.util.Collections.sort; - -@Service -public class FormSubmissionService { - private static Logger logger = LoggerFactory.getLogger(FormSubmissionService.class.toString()); - private AllFormSubmissions allFormSubmissions; - - @Autowired - public FormSubmissionService(AllFormSubmissions allFormSubmissions) { - this.allFormSubmissions = allFormSubmissions; - } - - public List fetch(long formFetchToken) { - return with(allFormSubmissions.findByServerVersion(formFetchToken)).convert(new Converter() { - @Override - public FormSubmissionDTO convert(FormSubmission submission) { - return FormSubmissionConverter.from(submission); - } - }); - } - - public FormSubmission findByInstanceId(String instanceId) { - return allFormSubmissions.findByInstanceId(instanceId); - } - - public List getNewSubmissionsForANM(String anmIdentifier, Long version, Integer batchSize) { - return allFormSubmissions.findByANMIDAndServerVersion(anmIdentifier, version, batchSize); - } - - public List getAllSubmissions(Long version, Integer batchSize) { - return allFormSubmissions.allFormSubmissions(version, batchSize); - } - - public List getAllSubmissions(CouchDbConnector sourceDb,Long version, Integer batchSize) { - return allFormSubmissions.allFormSubmissions(sourceDb,version, batchSize); - } - - public List findByFormName(String formName, long version) { - return allFormSubmissions.findByFormName(formName, version); - } - - public List findByMetadata(String key, Object value) { - return allFormSubmissions.findByMetadata(key, value); - } - - public void submit(List formSubmissionsDTO) { - List formSubmissions = with(formSubmissionsDTO).convert(new Converter() { - @Override - public FormSubmission convert(FormSubmissionDTO submission) { - return FormSubmissionConverter.toFormSubmission(submission); - } - }); - - sort(formSubmissions, timeStampComparator()); - for (FormSubmission submission : formSubmissions) { - if (allFormSubmissions.exists(submission.instanceId())) { - logger.warn(format("Received form submission that already exists. Skipping. Submission: {0}", submission)); - continue; - } - logger.info(format("Saving form {0} with instance Id: {1} and for entity Id: {2}", - submission.formName(), submission.instanceId(), submission.entityId())); - submission.setServerVersion(DateUtil.millis()); - allFormSubmissions.add(submission); - } - } - - private Comparator timeStampComparator() { - return new Comparator() { - public int compare(FormSubmission firstSubmission, FormSubmission secondSubmission) { - long firstTimestamp = firstSubmission.clientVersion(); - long secondTimestamp = secondSubmission.clientVersion(); - return firstTimestamp == secondTimestamp ? 0 : firstTimestamp < secondTimestamp ? -1 : 1; - } - }; - } -} diff --git a/opensrp-form/src/main/java/org/opensrp/form/service/SubformMap.java b/opensrp-form/src/main/java/org/opensrp/form/service/SubformMap.java deleted file mode 100644 index 0502686dee..0000000000 --- a/opensrp-form/src/main/java/org/opensrp/form/service/SubformMap.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.opensrp.form.service; - -import java.util.List; -import java.util.Map; - -public class SubformMap{ - private String name; - private String entityId; - private String bindType; - private String defaultBindPath; - private Map formAttributes; - private List fields; - - public SubformMap(String entityId, String subformName, String bindType, String defaultBindPath, Map formAttributes, List fields) { - this.name = subformName; - this.entityId = entityId; - this.bindType = bindType; - this.defaultBindPath = defaultBindPath; - this.fields = fields; - this.formAttributes = formAttributes; - } - - public String entityId() { - return entityId; - } - public String name() { - return name; - } - public String bindType() { - return bindType; - } - public String defaultBindPath() { - return defaultBindPath; - } - public Map formAttributes() { - return formAttributes; - } - public List fields() { - return fields; - } - - public String getFieldValue(String field) { - for (FormFieldMap f : fields) { - if (f.name().equalsIgnoreCase(field)) { - return f.value(); - } - } - return null; - } - - public FormFieldMap getField(String field) { - for (FormFieldMap f : fields) { - if (f.name().equalsIgnoreCase(field)) { - return f; - } - } - return null; - } -} \ No newline at end of file diff --git a/opensrp-form/src/main/resources/applicationContext-opensrp-form.xml b/opensrp-form/src/main/resources/applicationContext-opensrp-form.xml deleted file mode 100755 index 7c02f9af12..0000000000 --- a/opensrp-form/src/main/resources/applicationContext-opensrp-form.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/opensrp-form/src/test/java/org/opensrp/form/domain/FormDataTest.java b/opensrp-form/src/test/java/org/opensrp/form/domain/FormDataTest.java deleted file mode 100755 index 25ad2200bf..0000000000 --- a/opensrp-form/src/test/java/org/opensrp/form/domain/FormDataTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.opensrp.form.domain; - -import static org.junit.Assert.*; -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -import org.junit.Before; -import org.junit.Test; - -public class FormDataTest { - @Before - public void setUp() throws Exception { - - } - - @Test - public void shouldTestEqualsAndHash(){ - EqualsVerifier.forClass(FormData.class) - .suppress(Warning.STRICT_INHERITANCE) - .verify(); - } - @Test - public void shouldTestConstructor(){ - assertEquals(getForm().bindType(),"pkchild"); - assertNotSame(getForm().bindType(),"pkchilds"); - } - - @Test - public void shouldGetSubFormByName(){ - assertEquals("woman_registration", getForm().getSubFormByName("woman_registration").name()); - assertNotSame("woman_registrations", getForm().getSubFormByName("woman_registration").name()); - } - public FormData getForm(){ - String bind_type = "pkchild"; - String default_bind_path = "/model/instance/Child_Vaccination_Enrollment/"; - List fields = new ArrayList<>(); - FormField formField1 = new FormField("provider_town","pktown","pkchild.provider_town"); - FormField formField2 = new FormField("provider_city","providerCity","pkchild.provider_city"); - fields.add(formField1); - fields.add(formField2); - List sub_forms = new ArrayList<>(); - List> instances = new ArrayList<>(); - Map map = new HashMap<>(); - map.put("provider_town", "pktown"); - map.put("provider_city", "providerCity"); - instances.add(map); - SubFormData subFormData = new SubFormData("woman_registration", instances); - sub_forms.add(subFormData); - FormData formData2 = new FormData(bind_type,default_bind_path,fields,sub_forms); - return formData2; - } - @Test(expected=RuntimeException.class) - public void shouldGetRunTimeExceptionBygetSubFormByName(){ - String bind_type = "pkchild"; - String default_bind_path = "/model/instance/Child_Vaccination_Enrollment/"; - List fields = new ArrayList<>(); - FormField formField1 = new FormField("provider_town","pktown","pkchild.provider_town"); - FormField formField2 = new FormField("provider_city","providerCity","pkchild.provider_city"); - fields.add(formField1); - fields.add(formField2); - List sub_forms = new ArrayList<>(); - List> instances = new ArrayList<>(); - SubFormData subFormData = new SubFormData("woman_registration", instances); - FormData formData2 = new FormData(bind_type,default_bind_path,fields,sub_forms); - assertEquals("woman_registration", formData2.getSubFormByName("woman_registration").name()); - assertNotSame("woman_registrations", formData2.getSubFormByName("woman_registration").name()); - } - @Test - public void shouldGetFieldsAsMap(){ - assertEquals("providerCity", getForm().getFieldsAsMap().get("provider_city")); - assertNotSame("providerCity", getForm().getFieldsAsMap().get("provider_cityu")); - } - -} diff --git a/opensrp-form/src/test/java/org/opensrp/form/domain/FormFieldTest.java b/opensrp-form/src/test/java/org/opensrp/form/domain/FormFieldTest.java deleted file mode 100755 index 14d58a2f0f..0000000000 --- a/opensrp-form/src/test/java/org/opensrp/form/domain/FormFieldTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.opensrp.form.domain; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -import org.junit.Test; - -public class FormFieldTest { - - @Test - public void shouldTestEqualsAndHash(){ - EqualsVerifier.forClass(FormField.class) - .suppress(Warning.STRICT_INHERITANCE) - .verify(); - } - -} diff --git a/opensrp-form/src/test/java/org/opensrp/form/domain/FormInstanceTest.java b/opensrp-form/src/test/java/org/opensrp/form/domain/FormInstanceTest.java deleted file mode 100755 index 4b776af015..0000000000 --- a/opensrp-form/src/test/java/org/opensrp/form/domain/FormInstanceTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.opensrp.form.domain; - -import static org.junit.Assert.*; -import static org.junit.Assert.assertEquals; -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -import org.junit.Test; - -public class FormInstanceTest { - @Test - public void shouldTestEqualsAndHash(){ - EqualsVerifier.forClass(FormInstance.class) - .suppress(Warning.STRICT_INHERITANCE) - .verify(); - } - @Test - public void shouldTestCOnstructorAndGetSubFormByName(){ - FormDataTest formDataTest = new FormDataTest(); - FormData formData = formDataTest.getForm(); - FormInstance formInstance = new FormInstance(formData, "1"); - FormInstance formInstance1 = new FormInstance(formData); - formInstance1.toString(); - assertNotNull(formInstance1); - assertEquals("woman_registration",formInstance.getSubFormByName("woman_registration").name()); - assertNotSame("woman_registrations",formInstance.getSubFormByName("woman_registration").name()); - - } - - @Test(expected=RuntimeException.class) - public void shouldGetRuntimeExcemptionTestCOnstructorAndGetSubFormByName(){ - FormDataTest formDataTest = new FormDataTest(); - FormData formData = formDataTest.getForm(); - FormInstance formInstance = new FormInstance(formData, "1"); - FormInstance formInstance1 = new FormInstance(formData); - formInstance1.toString(); - formInstance.getSubFormByName("woman_registrations").name(); - } - -} diff --git a/opensrp-form/src/test/java/org/opensrp/form/domain/FormSubmissionTest.java b/opensrp-form/src/test/java/org/opensrp/form/domain/FormSubmissionTest.java deleted file mode 100755 index 8aeb3eea90..0000000000 --- a/opensrp-form/src/test/java/org/opensrp/form/domain/FormSubmissionTest.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.opensrp.form.domain; - -import static org.junit.Assert.*; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.Test; - -public class FormSubmissionTest { - - @Test - public void shouldGetFields(){ - FormDataTest formDataTest = new FormDataTest(); - FormData formData = formDataTest.getForm(); - FormInstance formInstance = new FormInstance(formData, "1"); - List fieldNames = new ArrayList<>(); - fieldNames.add("provider_city"); - fieldNames.add("provider_town"); - FormSubmission formSubmission = new FormSubmission("ANM1", "", "pkchild", "", "1", 0l, formInstance); - assertEquals("providerCity", formSubmission.getFields(fieldNames).get("provider_city")); - assertNotEquals("providerCity", formSubmission.getFields(fieldNames).get("provider_citi")); - } - - @Test - public void shouldGetSubFormByName(){ - FormDataTest formDataTest = new FormDataTest(); - FormData formData = formDataTest.getForm(); - FormInstance formInstance = new FormInstance(formData, "1"); - List fieldNames = new ArrayList<>(); - fieldNames.add("provider_city"); - fieldNames.add("provider_town"); - FormSubmission formSubmission = new FormSubmission("ANM1", "", "pkchild", "", "1", 0l, formInstance); - assertEquals("woman_registration", formSubmission.getSubFormByName("woman_registration").name()); - assertNotSame("woman_registrationw", formSubmission.getSubFormByName("woman_registration").name()); - } - - - @Test(expected=RuntimeException.class) - public void shouldGetRuntimeExceptionWhenGetSubFormByName() throws Exception{ - FormDataTest formDataTest = new FormDataTest(); - FormData formData = formDataTest.getForm(); - FormInstance formInstance = new FormInstance(formData, "1"); - List fieldNames = new ArrayList<>(); - fieldNames.add("provider_city"); - fieldNames.add("provider_town"); - FormSubmission formSubmission = new FormSubmission("ANM1", "", "pkchild", "", "1", 0l, formInstance); - formSubmission.getSubFormByName("woman_registrations"); - } - - @Test - public void shouldAddMetadataAndGetMetadata(){ - FormDataTest formDataTest = new FormDataTest(); - FormData formData = formDataTest.getForm(); - FormInstance formInstance = new FormInstance(formData, "1"); - List fieldNames = new ArrayList<>(); - fieldNames.add("provider_city"); - fieldNames.add("provider_town"); - Map metadata = new HashMap<>(); - metadata.put("meta", "Meta"); - FormSubmission formSubmission = new FormSubmission("ANM1", "", "pkchild", "", "1", 0l, formInstance); - formSubmission.addMetadata("meta", "Meta"); - assertEquals(metadata, formSubmission.getMetadata()); - assertEquals("Meta", formSubmission.getMetadata("meta")); - Map metadata1 = new HashMap<>(); - metadata.put("meta1", "Meta"); - assertNotEquals("Meta1", formSubmission.getMetadata("meta")); - assertNotEquals(metadata1, formSubmission.getMetadata()); - FormSubmission formSubmission1 = new FormSubmission("ANM1", "", "pkchild", "", "1", 0l, formInstance); - assertNull(formSubmission1.getMetadata("meta")); - } - -} diff --git a/opensrp-form/src/test/java/org/opensrp/form/repository/it/AllSubmissionsIntegrationTest.java b/opensrp-form/src/test/java/org/opensrp/form/repository/it/AllSubmissionsIntegrationTest.java deleted file mode 100755 index 16b26d1df7..0000000000 --- a/opensrp-form/src/test/java/org/opensrp/form/repository/it/AllSubmissionsIntegrationTest.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.opensrp.form.repository.it; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.motechproject.util.DateUtil; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.repository.AllFormSubmissions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import static java.util.Arrays.asList; -import static junit.framework.Assert.*; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:applicationContext-opensrp-form.xml") -public class AllSubmissionsIntegrationTest extends TestDatabaseConfig { - @Autowired - private AllFormSubmissions formSubmissions; - - @Before - public void setUp() throws Exception { - formSubmissions.removeAll(); - } - - @Test - public void shouldCheckIfFormSubmissionExistsByInstanceId() throws Exception { - FormSubmission formSubmission = new FormSubmission("anm id 1", "instance id 1", "form name 1", "entity id 1", 1L, "1", null, 0L); - formSubmissions.add(formSubmission); - - assertTrue(formSubmissions.exists("instance id 1")); - assertFalse(formSubmissions.exists("Invalid Instance Id")); - } - - @Test - public void shouldFetchAllFormSubmissionsAfterServerVersion() throws Exception { - long baseTimeStamp = DateUtil.now().getMillis(); - - FormSubmission firstFormSubmission = new FormSubmission("anm id 1", "instance id 1", "form name 1", "entity id 1", 0L, "1", null, baseTimeStamp); - formSubmissions.add(firstFormSubmission); - - FormSubmission secondFormSubmission = new FormSubmission("anm id 2", "instance id 2", "form name 1", "entity id 2", 1L, "1", null, baseTimeStamp + 1); - formSubmissions.add(secondFormSubmission); - - FormSubmission thirdFormSubmission = new FormSubmission("anm id 3", "instance id 3", "form name 1", "entity id 3", 2L, "1", null, baseTimeStamp + 2); - formSubmissions.add(thirdFormSubmission); - - assertEquals(asList(firstFormSubmission, secondFormSubmission, thirdFormSubmission), formSubmissions.findByServerVersion(0L)); - assertEquals(asList(secondFormSubmission, thirdFormSubmission), formSubmissions.findByServerVersion(firstFormSubmission.serverVersion())); - assertEquals(asList(thirdFormSubmission), formSubmissions.findByServerVersion(secondFormSubmission.serverVersion())); - assertEquals(0, formSubmissions.findByServerVersion(thirdFormSubmission.serverVersion()).size()); - } - - @Test - public void shouldFetchAllFormSubmissions() throws Exception { - long baseTimeStamp = DateUtil.now().getMillis(); - - FormSubmission firstFormSubmission = new FormSubmission("anm id 1", "instance id 1", "form name 1", "entity id 1", 0L, "1", null, baseTimeStamp); - formSubmissions.add(firstFormSubmission); - - FormSubmission secondFormSubmission = new FormSubmission("anm id 2", "instance id 2", "form name 1", "entity id 2", 1L, "1", null, baseTimeStamp + 1); - formSubmissions.add(secondFormSubmission); - - FormSubmission thirdFormSubmission = new FormSubmission("anm id 3", "instance id 3", "form name 1", "entity id 3", 2L, "1", null, baseTimeStamp + 2); - formSubmissions.add(thirdFormSubmission); - - assertEquals(asList(firstFormSubmission, secondFormSubmission, thirdFormSubmission), formSubmissions.allFormSubmissions(0, 3)); - assertEquals(asList(firstFormSubmission, secondFormSubmission), formSubmissions.allFormSubmissions(0, 2)); - assertEquals(asList(firstFormSubmission, secondFormSubmission, thirdFormSubmission), formSubmissions.allFormSubmissions(0, 3)); - assertEquals(asList(secondFormSubmission, thirdFormSubmission), formSubmissions.allFormSubmissions(firstFormSubmission.serverVersion(), 3)); - - } - - @Test - public void shouldFetchFormSubmissionsBasedOnANMIDTimeStampAndBatchSize() throws Exception { - long baseTimeStamp = DateUtil.now().getMillis(); - FormSubmission firstFormSubmission = new FormSubmission("ANM 1", "instance id 1", "form name 1", "entity id 1", 0L, "1", null, baseTimeStamp); - formSubmissions.add(firstFormSubmission); - - FormSubmission secondFormSubmission = new FormSubmission("ANM 1", "instance id 2", "form name 1", "entity id 2", 1L, "1", null, baseTimeStamp + 1); - formSubmissions.add(secondFormSubmission); - - FormSubmission thirdFormSubmission = new FormSubmission("ANM 1", "instance id 3", "form name 1", "entity id 3", 2L, "1", null, baseTimeStamp + 2); - formSubmissions.add(thirdFormSubmission); - - assertEquals(asList(firstFormSubmission, secondFormSubmission, thirdFormSubmission), formSubmissions.findByANMIDAndServerVersion("ANM 1", 0L, null)); - assertEquals(asList(secondFormSubmission, thirdFormSubmission), formSubmissions.findByANMIDAndServerVersion("ANM 1", firstFormSubmission.serverVersion(), null)); - assertEquals(asList(thirdFormSubmission), formSubmissions.findByANMIDAndServerVersion("ANM 1", secondFormSubmission.serverVersion(), null)); - assertEquals(asList(firstFormSubmission, secondFormSubmission), formSubmissions.findByANMIDAndServerVersion("ANM 1", 0L, 2)); - - assertEquals(0, formSubmissions.findByANMIDAndServerVersion("ANM 1", thirdFormSubmission.serverVersion(), null).size()); - } - @Test - public void shouldFindByFormName(){ - long baseTimeStamp = DateUtil.now().getMillis(); - FormSubmission firstFormSubmission = new FormSubmission("ANM 1", "instance id 1", "DemoForm", "entity id 1", 0L, "1", null, baseTimeStamp); - formSubmissions.add(firstFormSubmission); - assertEquals(asList(firstFormSubmission), formSubmissions.findByFormName("DemoForm", 0l)); - FormSubmission secondFormSubmission = new FormSubmission("ANM 1", "instance id 2", "form name 1", "entity id 2", 1L, "1", null, baseTimeStamp + 1); - assertNotSame(asList(secondFormSubmission), formSubmissions.findByFormName("DemoForm", 0l)); - } - @Test - public void shouldGetAllFormSubmissions(){ - long baseTimeStamp = DateUtil.now().getMillis(); - FormSubmission firstFormSubmission = new FormSubmission("ANM 1", "instance id 1", "DemoForm Name", "entity id 1", 0L, "1", null, baseTimeStamp); - formSubmissions.add(firstFormSubmission); - assertEquals(asList(firstFormSubmission), formSubmissions.allFormSubmissions(getStdCouchDbConnectorForOpensrpForm(),0, 1)); - FormSubmission secondFormSubmission = new FormSubmission("ANM 1", "instance id 2", "form name 1", "entity id 2", 1L, "1", null, baseTimeStamp + 1); - assertNotSame(asList(secondFormSubmission), formSubmissions.allFormSubmissions(getStdCouchDbConnectorForOpensrpForm(),0, 1)); - } - @Test - public void shouldFindByMetadata(){ - long baseTimeStamp = DateUtil.now().getMillis(); - FormSubmission firstFormSubmission = new FormSubmission("ANM 2", "instance id 7", "DemoForm ff", "entity id 78", 0L, "1", null, baseTimeStamp); - Map metadata = new HashMap<>(); - metadata.put("formType", new String("type")); - firstFormSubmission.setMetadata(metadata); - formSubmissions.add(firstFormSubmission); - assertEquals(asList(firstFormSubmission), formSubmissions.findByMetadata("formType","type")); - FormSubmission secondFormSubmission = new FormSubmission("ANM 1", "instance id 2", "form name 1", "entity id 2", 1L, "1", null, baseTimeStamp + 1); - assertNotSame(asList(secondFormSubmission), formSubmissions.findByMetadata("formType","type")); - } -} diff --git a/opensrp-form/src/test/java/org/opensrp/form/repository/it/TestDatabaseConfig.java b/opensrp-form/src/test/java/org/opensrp/form/repository/it/TestDatabaseConfig.java deleted file mode 100755 index a3a0599cb0..0000000000 --- a/opensrp-form/src/test/java/org/opensrp/form/repository/it/TestDatabaseConfig.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.opensrp.form.repository.it; - -import org.ektorp.CouchDbInstance; -import org.ektorp.http.HttpClient; -import org.ektorp.http.StdHttpClient; -import org.ektorp.impl.StdCouchDbConnector; -import org.ektorp.impl.StdCouchDbInstance; -import org.ektorp.impl.StdObjectMapperFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; - -import javax.annotation.PostConstruct; - -import static org.mockito.MockitoAnnotations.initMocks; - -public class TestDatabaseConfig { - - private CouchDbInstance dbInstance; - - private StdCouchDbConnector stdCouchDbConnectorOpensrpForm; - - @Autowired - //@Value("#{opensrp['openmrs.url']}") - @Value("#{opensrp['couchdb.username']}") - public String userName; - - @Autowired - @Value("#{opensrp['couchdb.password']}") - private String password; - - @Autowired - @Value("#{opensrp['couchdb.server']}") - private String url; - - @Autowired - @Value("#{opensrp['couchdb.port']}") - private int port; - - public TestDatabaseConfig() { - initMocks(this); - } - - @PostConstruct - public void intCouchDbConfiguration() { - HttpClient httpClient = new StdHttpClient.Builder().host(url).username(userName).password(password).port(port) - .socketTimeout(1000).build(); - dbInstance = new StdCouchDbInstance(httpClient); - stdCouchDbConnectorOpensrpForm = new StdCouchDbConnector("opensrp-form", dbInstance, new StdObjectMapperFactory()); - stdCouchDbConnectorOpensrpForm.createDatabaseIfNotExists(); - } - - public StdCouchDbConnector getStdCouchDbConnectorForOpensrpForm() { - return stdCouchDbConnectorOpensrpForm; - } - - public CouchDbInstance getDbInstance() { - return dbInstance; - } - - public void setDbInstance(CouchDbInstance dbInstance) { - this.dbInstance = dbInstance; - } -} diff --git a/opensrp-form/src/test/java/org/opensrp/form/service/FormAttributeParserTest.java b/opensrp-form/src/test/java/org/opensrp/form/service/FormAttributeParserTest.java deleted file mode 100755 index 63553fc7e1..0000000000 --- a/opensrp-form/src/test/java/org/opensrp/form/service/FormAttributeParserTest.java +++ /dev/null @@ -1,488 +0,0 @@ -package org.opensrp.form.service; - -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.mockito.MockitoAnnotations.initMocks; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPathExpressionException; - -import org.hamcrest.Matchers; -import org.junit.Before; -import org.junit.Test; -import org.opensrp.form.domain.FormSubmission; -import org.xml.sax.SAXException; - -import com.google.gson.JsonIOException; -import com.google.gson.JsonSyntaxException; - - -public class FormAttributeParserTest extends TestResourceLoader{ - - public FormAttributeParserTest() throws IOException { - super(); - } - - FormAttributeParser fam; - - @Before - public void setUp() throws Exception { - initMocks(this); - fam = new FormAttributeParser(formDirPath); - } - - @SuppressWarnings({ "unchecked" }) - @Test - public void shouldValidateGeneratedFormSubmissionMap() throws JsonIOException, IOException, JsonSyntaxException, XPathExpressionException, ParserConfigurationException, SAXException { - FormSubmission fs = getFormSubmissionFor("basic_reg"); - FormSubmissionMap fsm = fam.createFormSubmissionMap(fs); - assertEquals("/model/instance/register_with_address/", fsm.bindPath()); - assertEquals("register_with_address", fsm.bindType()); - assertEquals(1426830449320L, fsm.clientTimestamp()); - assertEquals("b716d938-1aea-40ae-a081-9ddddddcccc9", fsm.entityId()); - - testFormField(fsm.fields(), "woman_name", "text", "test woman_name", - "/model/instance/register_with_address/woman_name", - fsm.getField("woman_name").fieldAttributes(), makeFieldAttributes("person", "first_name")); - testFormField(fsm.fields(), "last_name", "text", "test last_name", - "/model/instance/register_with_address/last_name", - fsm.getField("last_name").fieldAttributes(), makeFieldAttributes("person", "last_name")); - testFormField(fsm.fields(), "gender", "text", "FEMALE", - "/model/instance/register_with_address/gender", - fsm.getField("gender").fieldAttributes(), makeFieldAttributes("person", "gender")); - testFormField(fsm.fields(), "birthdate", "date", "2015-02-01", - "/model/instance/register_with_address/birthdate", - fsm.getField("birthdate").fieldAttributes(), makeFieldAttributes("person", "birthdate")); - testFormField(fsm.fields(), "location", "select one", "unknown location", - "/model/instance/register_with_address/location", - fsm.getField("location").fieldAttributes(), makeFieldAttributes("encounter", "location_id")); - testFormField(fsm.fields(), "anc_visit_date", "date", "2015-02-01", - "/model/instance/register_with_address/anc_visit_date", - fsm.getField("anc_visit_date").fieldAttributes(), makeFieldAttributes("encounter", "encounter_date")); - testFormField(fsm.fields(), "pulse_rate", "integer", "55", - "/model/instance/register_with_address/pulse_rate", - fsm.getField("pulse_rate").fieldAttributes(), makeFieldAttributes("concept", "5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")); - testFormField(fsm.fields(), "temperature", "decimal", "37", - "/model/instance/register_with_address/temperature", - fsm.getField("temperature").fieldAttributes(), makeFieldAttributes("concept", "5088AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")); - testFormField(fsm.fields(), "today", "today", "2015-02-01", - "/model/instance/register_with_address/today", - fsm.getField("today").fieldAttributes(), new HashMap()); - testFormField(fsm.fields(), "start", "start", "2015-02-01", - "/model/instance/register_with_address/start", - fsm.getField("start").fieldAttributes(), new HashMap()); - testFormField(fsm.fields(), "end", "end", "2015-02-01", - "/model/instance/register_with_address/end", - fsm.getField("end").fieldAttributes(), new HashMap()); - - testFormField(fsm.fields(), "birthplace_lat", "text", "test birthplace_lat", - "/model/instance/register_with_address/birthplace_address/birthplace_lat", - fsm.getField("birthplace_lat").fieldAttributes(), makeFieldAttributes("person_address", "latitude", "birthplace")); - testFormField(fsm.fields(), "birthplace_lon", "text", "test birthplace_lon", - "/model/instance/register_with_address/birthplace_address/birthplace_lon", - fsm.getField("birthplace_lon").fieldAttributes(), makeFieldAttributes("person_address", "longitute", "birthplace")); - testFormField(fsm.fields(), "birthplace_postcode", "text", "test birthplace_postcode", - "/model/instance/register_with_address/birthplace_address/birthplace_postcode", - fsm.getField("birthplace_postcode").fieldAttributes(), makeFieldAttributes("person_address", "postalcode", "birthplace")); - testFormField(fsm.fields(), "birthplace_house", "text", "test birthplace_house", - "/model/instance/register_with_address/birthplace_address/birthplace_house", - fsm.getField("birthplace_house").fieldAttributes(), makeFieldAttributes("person_address", "house_number", "birthplace")); - testFormField(fsm.fields(), "birthplace_street", "text", "test birthplace_street", - "/model/instance/register_with_address/birthplace_address/birthplace_street", - fsm.getField("birthplace_street").fieldAttributes(), makeFieldAttributes("person_address", "street", "birthplace")); - testFormField(fsm.fields(), "birthplace_area", "text", "test birthplace_area", - "/model/instance/register_with_address/birthplace_address/birthplace_area", - fsm.getField("birthplace_area").fieldAttributes(), makeFieldAttributes("person_address", "area", "birthplace")); - testFormField(fsm.fields(), "birthplace_town", "text", "test birthplace_town", - "/model/instance/register_with_address/birthplace_address/birthplace_town", - fsm.getField("birthplace_town").fieldAttributes(), makeFieldAttributes("person_address", "town", "birthplace")); - testFormField(fsm.fields(), "birthplace_busroute", "text", "test birthplace_busroute", - "/model/instance/register_with_address/birthplace_address/birthplace_busroute", - fsm.getField("birthplace_busroute").fieldAttributes(), makeFieldAttributes("person_address", "bus_route", "birthplace")); - testFormField(fsm.fields(), "birthplace_district", "text", "test birthplace_district", - "/model/instance/register_with_address/birthplace_address/birthplace_district", - fsm.getField("birthplace_district").fieldAttributes(), makeFieldAttributes("person_address", "district", "birthplace")); - testFormField(fsm.fields(), "birthplace_city", "text", "test birthplace_city", - "/model/instance/register_with_address/birthplace_address/birthplace_city", - fsm.getField("birthplace_city").fieldAttributes(), makeFieldAttributes("person_address", "city", "birthplace")); - testFormField(fsm.fields(), "birthplace_state", "text", "test birthplace_state", - "/model/instance/register_with_address/birthplace_address/birthplace_state", - fsm.getField("birthplace_state").fieldAttributes(), makeFieldAttributes("person_address", "state", "birthplace")); - testFormField(fsm.fields(), "birthplace_country", "text", "test birthplace_country", - "/model/instance/register_with_address/birthplace_address/birthplace_country", - fsm.getField("birthplace_country").fieldAttributes(), makeFieldAttributes("person_address", "country", "birthplace")); - - - testFormField(fsm.fields(), "usual_residence_lat", "text", "test usual_residence_lat", - "/model/instance/register_with_address/usual_residence_address/usual_residence_lat", - fsm.getField("usual_residence_lat").fieldAttributes(), makeFieldAttributes("person_address", "latitude", "usual_residence")); - testFormField(fsm.fields(), "usual_residence_lon", "text", "test usual_residence_lon", - "/model/instance/register_with_address/usual_residence_address/usual_residence_lon", - fsm.getField("usual_residence_lon").fieldAttributes(), makeFieldAttributes("person_address", "longitute", "usual_residence")); - testFormField(fsm.fields(), "usual_residence_postcode", "text", "test usual_residence_postcode", - "/model/instance/register_with_address/usual_residence_address/usual_residence_postcode", - fsm.getField("usual_residence_postcode").fieldAttributes(), makeFieldAttributes("person_address", "postalcode", "usual_residence")); - testFormField(fsm.fields(), "usual_residence_house", "text", "test usual_residence_house", - "/model/instance/register_with_address/usual_residence_address/usual_residence_house", - fsm.getField("usual_residence_house").fieldAttributes(), makeFieldAttributes("person_address", "unit", "usual_residence")); - testFormField(fsm.fields(), "usual_residence_street", "text", "test usual_residence_street", - "/model/instance/register_with_address/usual_residence_address/usual_residence_street", - fsm.getField("usual_residence_street").fieldAttributes(), makeFieldAttributes("person_address", "lane", "usual_residence")); - testFormField(fsm.fields(), "usual_residence_area", "text", "test usual_residence_area", - "/model/instance/register_with_address/usual_residence_address/usual_residence_area", - fsm.getField("usual_residence_area").fieldAttributes(), makeFieldAttributes("person_address", "sector", "usual_residence")); - testFormField(fsm.fields(), "usual_residence_town", "text", "test usual_residence_town", - "/model/instance/register_with_address/usual_residence_address/usual_residence_town", - fsm.getField("usual_residence_town").fieldAttributes(), makeFieldAttributes("person_address", "municipality", "usual_residence")); - testFormField(fsm.fields(), "usual_residence_start", "date", "2015-02-01", - "/model/instance/register_with_address/usual_residence_address/usual_residence_start", - fsm.getField("usual_residence_start").fieldAttributes(), makeFieldAttributes("person_address", "startdate", "usual_residence")); - testFormField(fsm.fields(), "usual_residence_district", "text", "test usual_residence_district", - "/model/instance/register_with_address/usual_residence_address/usual_residence_district", - fsm.getField("usual_residence_district").fieldAttributes(), makeFieldAttributes("person_address", "district", "usual_residence")); - testFormField(fsm.fields(), "usual_residence_city", "text", "test usual_residence_city", - "/model/instance/register_with_address/usual_residence_address/usual_residence_city", - fsm.getField("usual_residence_city").fieldAttributes(), makeFieldAttributes("person_address", "city", "usual_residence")); - testFormField(fsm.fields(), "usual_residence_state", "text", "test usual_residence_state", - "/model/instance/register_with_address/usual_residence_address/usual_residence_state", - fsm.getField("usual_residence_state").fieldAttributes(), makeFieldAttributes("person_address", "province", "usual_residence")); - testFormField(fsm.fields(), "usual_residence_country", "text", "test usual_residence_country", - "/model/instance/register_with_address/usual_residence_address/usual_residence_country", - fsm.getField("usual_residence_country").fieldAttributes(), makeFieldAttributes("person_address", "country", "usual_residence")); - - - assertThat(fsm.formAttributes(), Matchers.allOf( - Matchers.hasEntry("encounter_type", "patient_register"), - Matchers.hasEntry("id", "patient_basic_reg"), - Matchers.hasEntry("version", "201504030905"))); - assertEquals("basic_reg", fsm.formName()); - assertEquals("1", fsm.formVersion()); - //TODO assertEquals(, fsm.getSubform(entityId, subformName)); - assertEquals("88ceee24-10b4-44c2-9429-754b8d823776", fsm.instanceId()); - assertEquals("admin", fsm.providerId()); - assertEquals(1430998001293L, fsm.serverTimestamp()); - assertEquals(0, fsm.subforms().size()); - } - - @SuppressWarnings("unchecked") - @Test - public void shouldValidateGeneratedFormSubmissionMapWithSubform() throws JsonIOException, IOException, JsonSyntaxException, XPathExpressionException, ParserConfigurationException, SAXException { - FormSubmission fs = getFormSubmissionFor("new_household_registration", 7); - FormSubmissionMap fsm = fam.createFormSubmissionMap(fs); - assertEquals("/model/instance/FWNewHH", fsm.bindPath()); - assertEquals("household", fsm.bindType()); - assertEquals(1430997074596L, fsm.clientTimestamp()); - assertEquals("a3f2abf4-2699-4761-819a-cea739224164", fsm.entityId()); - - testFormField(fsm.fields(), "existing_location", "hidden", "KUPTALA", - "/model/instance/FWNewHH/existing_location", - fsm.getField("existing_location").fieldAttributes(), makeFieldAttributes("encounter", "location_id")); - testFormField(fsm.fields(), "today", "today", "2015-05-07", - "/model/instance/FWNewHH/today", - fsm.getField("today").fieldAttributes(), makeFieldAttributes("encounter", "encounter_date") ); - testFormField(fsm.fields(), "start", "start", "2015-05-07T17:07:21.000+06:00", - "/model/instance/FWNewHH/start", - fsm.getField("start").fieldAttributes(), new HashMap()); - testFormField(fsm.fields(), "end", "end", "2015-05-07T17:07:21.000+06:00", - "/model/instance/FWNewHH/end", - fsm.getField("end").fieldAttributes(), new HashMap()); - testFormField(fsm.fields(), "FWNHREGDATE", "date", "2015-05-07", - "/model/instance/FWNewHH/FWNHREGDATE", - fsm.getField("FWNHREGDATE").fieldAttributes(), makeFieldAttributes("concept", "160753AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")); - testFormField(fsm.fields(), "FWGOBHHID", "text", "1234", - "/model/instance/FWNewHH/FWGOBHHID", - fsm.getField("FWGOBHHID").fieldAttributes(), makeFieldAttributes("person_identifier", "GOB HHID")); - testFormField(fsm.fields(), "FWJIVHHID", "text", "1234", - "/model/instance/FWNewHH/FWJIVHHID", - fsm.getField("FWJIVHHID").fieldAttributes(), makeFieldAttributes("person_identifier", "JiVitA HHID")); - testFormField(fsm.fields(), "FWNHNEARTO", "text", "nothing", - "/model/instance/FWNewHH/FWNHNEARTO", - fsm.getField("FWNHNEARTO").fieldAttributes(), makeFieldAttributes("person_address", "landmark", "usual_residence")); - testFormField(fsm.fields(), "FWNHHHGPS", "geopoint", "34 34 0 0", - "/model/instance/FWNewHH/FWNHHHGPS", - fsm.getField("FWNHHHGPS").fieldAttributes(), makeFieldAttributes("person_address", "geopoint", "usual_residence")); - testFormField(fsm.fields(), "FWHOHFNAME", "text", "test", - "/model/instance/FWNewHH/FWHOHFNAME", - fsm.getField("FWHOHFNAME").fieldAttributes(), makeFieldAttributes("person", "first_name")); -//TODO all other props - assertThat(fsm.formAttributes(), Matchers.allOf( - Matchers.hasEntry("encounter_type", "New Household Registration"), - Matchers.hasEntry("id", "FWNewHH"), - Matchers.hasEntry("version", "201505061341"))); - assertEquals("new_household_registration", fsm.formName()); - assertEquals("1", fsm.formVersion()); - assertEquals("88c0e824-10b4-44c2-9429-754b8d823776", fsm.instanceId()); - assertEquals("admin", fsm.providerId()); - assertEquals(1430998001293L, fsm.serverTimestamp()); - assertEquals(1, fsm.subforms().size()); - SubformMap sf = fsm.subforms().get(0); - assertEquals("elco", sf.bindType()); - assertEquals("/model/instance/FWNewHH/woman", sf.defaultBindPath()); - assertEquals("babcd9d2-b3e9-4f6d-8a06-2df8f5fbf01f", sf.entityId()); - - testFormField(sf.fields(), "FWWOMFNAME", "text", "tEST First", - "/model/instance/FWNewHH/woman/FWWOMFNAME", - sf.getField("FWWOMFNAME").fieldAttributes(), makeFieldAttributes("person", "first_name")); - testFormField(sf.fields(), "FWWOMLNAME", "calculate", " lastname", - "/model/instance/FWNewHH/woman/FWWOMLNAME", - sf.getField("FWWOMLNAME").fieldAttributes(), makeFieldAttributes("person", "last_name")); - testFormField(sf.fields(), "FWWOMNID", "text", "5478549854895", - "/model/instance/FWNewHH/woman/FWWOMNID", - sf.getField("FWWOMNID").fieldAttributes(), makeFieldAttributes("person_identifier", "NID")); - testFormField(sf.fields(), "FWWOMBID", "text", "43030293029323", - "/model/instance/FWNewHH/woman/FWWOMBID", - sf.getField("FWWOMBID").fieldAttributes(), makeFieldAttributes("person_identifier", "Birth Registration ID")); - - assertThat(sf.formAttributes(), Matchers.allOf( - Matchers.hasEntry("openmrs_entity", "person"), - Matchers.hasEntry("openmrs_entity_id", "Census and New Woman Registration"))); - assertEquals("elco_registration", sf.name()); - } - - @Test - public void shouldValidateGeneratedFormSubmissionMapWithNoLastName() throws JsonIOException, IOException, JsonSyntaxException, XPathExpressionException, ParserConfigurationException, SAXException { - FormSubmission fs = getFormSubmissionFor("new_household_registration_with_grouped_subform_data", 1); - FormSubmissionMap fsm = fam.createFormSubmissionMap(fs); - assertEquals("/model/instance/FWNewHH", fsm.bindPath()); - assertEquals("household", fsm.bindType()); - assertEquals(1444562091545L, fsm.clientTimestamp()); - assertEquals("4237d267-d438-49f2-7822-8968t555447c", fsm.entityId()); - - testFormField(fsm.fields(), "existing_location", "hidden", "2fc43738-ace5-g961-8e8f-ab7dg0e5bc63", - "/model/instance/FWNewHH/existing_location", - fsm.getField("existing_location").fieldAttributes(), makeFieldAttributes("encounter", "location_id")); - testFormField(fsm.fields(), "today", "today", "2015-10-11", - "/model/instance/FWNewHH/today", - fsm.getField("today").fieldAttributes(), makeFieldAttributes("encounter", "encounter_date") ); - testFormField(fsm.fields(), "start", "start", "2015-10-11T17:12:34.000+06:00", - "/model/instance/FWNewHH/start", - fsm.getField("start").fieldAttributes(), new HashMap()); - testFormField(fsm.fields(), "end", "end", "2015-10-11T17:12:34.000+06:00", - "/model/instance/FWNewHH/end", - fsm.getField("end").fieldAttributes(), new HashMap()); - testFormField(fsm.fields(), "FWNHREGDATE", "date", "2015-10-11", - "/model/instance/FWNewHH/FWNHREGDATE", - fsm.getField("FWNHREGDATE").fieldAttributes(), makeFieldAttributes("concept", "160753AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")); - testFormField(fsm.fields(), "FWGOBHHID", "text", "2322", - "/model/instance/FWNewHH/FWGOBHHID", - fsm.getField("FWGOBHHID").fieldAttributes(), makeFieldAttributes("person_attribute", "GoB_HHID")); - testFormField(fsm.fields(), "FWJIVHHID", "text", "9889", - "/model/instance/FWNewHH/FWJIVHHID", - fsm.getField("FWJIVHHID").fieldAttributes(), makeFieldAttributes("person_attribute", "JiVitA_HHID")); - testFormField(fsm.fields(), "FWNHHHGPS", "geopoint", "23.8002 90.4068 0 10", - "/model/instance/FWNewHH/FWNHHHGPS", - fsm.getField("FWNHHHGPS").fieldAttributes(), makeFieldAttributes("person_address", "geopoint", "usual_residence")); - testFormField(fsm.fields(), "FWHOHFNAME", "text", "mango", - "/model/instance/FWNewHH/FWHOHFNAME", - fsm.getField("FWHOHFNAME").fieldAttributes(), makeFieldAttributes("person", "first_name")); -//TODO all other props - assertThat(fsm.formAttributes(), Matchers.allOf( - Matchers.hasEntry("encounter_type", "New Household Registration"), - Matchers.hasEntry("id", "FWNewHH"), - Matchers.hasEntry("version", "201510181114"))); - assertEquals("new_household_registration_with_grouped_subform_data", fsm.formName()); - assertEquals("12", fsm.formVersion()); - assertEquals("d304dbr7-3998-434f-8c5b-55d6f5fa4252", fsm.instanceId()); - assertEquals("opensrp", fsm.providerId()); - assertEquals(1444734863350L, fsm.serverTimestamp()); - assertEquals(1, fsm.subforms().size()); - SubformMap sf = fsm.subforms().get(0); - assertEquals("elco", sf.bindType()); - assertEquals("/model/instance/FWNewHH/woman", sf.defaultBindPath()); - assertEquals("ce71572a-8oc5-u32f-9d3b-4a6b568d5g77", sf.entityId()); - - testFormField(sf.fields(), "FWWOMFNAME", "text", "jackfruit", - "/model/instance/FWNewHH/woman/FWWOMFNAME", - sf.getField("FWWOMFNAME").fieldAttributes(), makeFieldAttributes("person", "first_name")); - testFormField(sf.fields(), "FWWOMLNAME", "calculate", ".", - "/model/instance/FWNewHH/woman/FWWOMLNAME", - sf.getField("FWWOMLNAME").fieldAttributes(), makeFieldAttributes("person", "last_name")); - testFormField(sf.fields(), "FWWOMRETYPENID", "text", "7675788777775", - "/model/instance/FWNewHH/woman/eligible/FWWOMRETYPENID", - sf.getField("FWWOMRETYPENID").fieldAttributes(), makeFieldAttributes("person_identifier", "NID")); - testFormField(sf.fields(), "FWWOMRETYPEBID", "text", "98899998888888888", - "/model/instance/FWNewHH/woman/eligible/FWWOMRETYPEBID", - sf.getField("FWWOMRETYPEBID").fieldAttributes(), makeFieldAttributes("person_identifier", "Birth Registration ID")); - - assertThat(sf.formAttributes(), Matchers.allOf( - Matchers.hasEntry("openmrs_entity", "person"), - Matchers.hasEntry("openmrs_entity_id", "New Woman Registration"))); - assertEquals("elco_registration", sf.name()); - } - - @Test - public void shouldValidateGeneratedFormSubmissionMapWithMultiselect() throws JsonIOException, IOException, JsonSyntaxException, XPathExpressionException, ParserConfigurationException, SAXException { - FormSubmission fs = getFormSubmissionFor("new_household_registration_with_grouped_subform_data", 1); - FormSubmissionMap fsm = fam.createFormSubmissionMap(fs); - - SubformMap sbf = fsm.getSubform("ce71572a-8oc5-u32f-9d3b-4a6b568d5g77", "elco_registration"); - String multiselectField = "FWWOMANYID"; - assertNotNull(sbf.getField(multiselectField)); - assertNotNull(sbf.getField(multiselectField).values()); - assertNotNull(sbf.getField(multiselectField).valuesCodes()); - assertEquals(2, sbf.getField(multiselectField).values().size()); - assertEquals(2, sbf.getField(multiselectField).valuesCodes().size()); - assertThat(sbf.getField(multiselectField).values(), Matchers.hasItems("1", "2")); - assertThat(sbf.getField(multiselectField).valuesCodes().keySet(), Matchers.hasItems("1", "2")); - assertThat(sbf.getField(multiselectField).valuesCodes().get("1"), Matchers.hasEntry("openmrs_code", "163084AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")); - assertThat(sbf.getField(multiselectField).valuesCodes().get("2"), Matchers.hasEntry("openmrs_code", "163083AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")); - } - - @SuppressWarnings("serial") - private Map makeFieldAttributes(final String entity, final String entityId) { - return new HashMap(){{ - put("openmrs_entity", entity); - put("openmrs_entity_id", entityId); - }}; - } - - private Map makeFieldAttributes(final String entity, final String entityId, final String parent) { - Map attr = makeFieldAttributes(entity, entityId); - attr.put("openmrs_entity_parent", parent); - return attr; - } - - @SuppressWarnings("unchecked") - private void testFormField(List fields, String name, String type, String value, - String bindPath, Map actualAttributes, Map expectedAttributes) { - assertThat(fields, Matchers.hasItem(Matchers.allOf( - Matchers.hasProperty("name",equalTo(name)), - Matchers.hasProperty("type",equalTo(type)), - Matchers.hasProperty("values", Matchers.allOf(Matchers.hasItem(value))), - Matchers.hasProperty("bindPath",equalTo(bindPath)), - Matchers.hasProperty("fieldAttributes"), - Matchers.hasProperty("valuesCodes") - ))); - for (Entry at : expectedAttributes.entrySet()) { - assertThat(actualAttributes, Matchers.hasEntry(at.getKey(), at.getValue())); - } - } - - @Test - public void shouldParseFormJSONToGetOpenMRSConcept() throws JsonSyntaxException, JsonIOException, IOException { - String field = "delivery_skilled"; - FormSubmission formSubmission = getFormSubmissionFor("pnc_1st_registration"); - String fieldValue = formSubmission.getField(field); - assertTrue(fam.getInstanceAttributesForFormFieldAndValue(field, fieldValue, null, formSubmission).get("openmrs_code").equalsIgnoreCase("1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")); - } - - @Test - public void shouldParseModelXMLDocAndFormDefJSONToGetOpenMRSConcept() throws JsonSyntaxException, JsonIOException, IOException, XPathExpressionException, ParserConfigurationException, SAXException { - String field = "delivery_skilled"; - FormSubmission formSubmission = getFormSubmissionFor("pnc_1st_registration"); - Map attributeMap = fam.getAttributesForField(field, formSubmission.formName()); - assertTrue(fam.getFieldName(attributeMap, formSubmission).equalsIgnoreCase(field)); - String etypr = "encounter_type"; - List atl = new ArrayList<>(); - atl.add(etypr); - assertNotNull(fam.getUniqueAttributeValue(atl, formSubmission).get("encounter_type")); - } - - @Test - public void shouldMapAddressWithClient() throws IOException, JsonSyntaxException, XPathExpressionException, ParserConfigurationException, SAXException{ - String field = "birthplace_street"; - FormSubmission formSubmission = getFormSubmissionFor("basic_reg"); - assertNotNull(fam.getAttributesForField(field, formSubmission.formName())); - } - - @Test - public void shouldFetchCorrectOptionConcept() throws IOException{ - String field = "isThisOnlyDeliveryFacility"; - String fieldVal = "Yes"; - FormSubmission formSubmission = getFormSubmissionFor("repeatform"); - Map concept = fam.getInstanceAttributesForFormFieldAndValue(field, fieldVal, null, formSubmission); - assertNotNull(concept); - assertThat(concept, Matchers.hasEntry("openmrs_code", "1065")); - - field = "bloodGroup"; - fieldVal = "a_negative"; - String subform = "child_registration"; - concept = fam.getInstanceAttributesForFormFieldAndValue(field, fieldVal, subform, formSubmission); - assertNotNull(concept); - assertThat(concept, Matchers.hasEntry("openmrs_code", "34134")); - } - - @Test - public void shouldFetchSubformData() throws IOException, JsonSyntaxException, XPathExpressionException, ParserConfigurationException, SAXException{ - String subform = "child_registration"; - - FormSubmission fs = getFormSubmissionFor("repeatform"); - Map attrs = fam.getAttributesForSubform(subform, fs); - assertNotNull(attrs.get("openmrs_entity")); - assertNotNull(attrs.get("openmrs_entity_id")); - assertEquals(attrs.get("openmrs_entity"), "person"); - assertEquals(attrs.get("openmrs_entity_id"), "new registration"); - - String field = "premature"; - attrs = fam.getAttributesForField(field,subform, fs.formName()); - assertNotNull(attrs.get("openmrs_entity")); - assertNotNull(attrs.get("openmrs_entity_id")); - assertEquals(attrs.get("openmrs_entity"), "concept"); - assertEquals(attrs.get("openmrs_entity_id"), "232323"); - - attrs.clear(); - attrs.put("openmrs_entity", "person"); - attrs.put("openmrs_entity_id", "gender"); - String fn = fam.getFieldName(attrs, subform, fs); - assertNotNull(fn); - assertEquals(fn, "gender"); - } - - @SuppressWarnings("unchecked") - @Test - public void shouldGetCorrectAttributesFromFormSubmissionMap() throws JsonIOException, IOException, JsonSyntaxException, XPathExpressionException, ParserConfigurationException, SAXException{ - FormSubmission fs = getFormSubmissionFor("repeatform"); - - FormSubmissionMap fsm = fam.createFormSubmissionMap(fs); - assertEquals("/model/instance/PNC_Registration_EngKan/", fsm.bindPath()); - assertEquals("mother", fsm.bindType()); - assertEquals(1426830449320L, fsm.clientTimestamp()); - assertEquals("b716d938-1aea-40ae-a081-9ddddddcccc9", fsm.entityId()); - assertThat(fsm.formAttributes(), allOf( - hasEntry("id", "Delivery_Outcome_EngKan"), - hasEntry("encounter_type", "PNC Registration"), - hasEntry("version", "201503200602"))); - assertEquals("repeatform", fsm.formName()); - assertEquals("5", fsm.formVersion()); - assertEquals("f7974258-1aea-40ae-6676-9ddddddcccc9", fsm.instanceId()); - assertEquals("admin", fsm.providerId()); - assertEquals(1426877779320L, fsm.serverTimestamp()); - - assertTrue(fsm.subforms().size() == 3); - - for (SubformMap sf : fsm.subforms()) { - assertEquals("child", sf.bindType()); - assertEquals("/model/instance/PNC_Registration_EngKan/live_birth_group/child", sf.defaultBindPath()); - assertEquals("child_registration", sf.name()); - assertThat(sf.formAttributes(), allOf( - hasEntry("openmrs_entity", "person"), - hasEntry("openmrs_entity_id", "new registration"))); - - assertThat(sf.entityId(), anyOf( - equalTo("e9a91c61-0d33-42d3-bf9b-560b4d08c74f"), - equalTo("c7305d21-0b90-4c15-a88f-b08338d3aed9"), - equalTo("6c2d772b-7d6a-4a05-a83d-5168c183ef42") - )); - } - } - - @Test - public void shouldMapCorrectAttributesForFieldsInFormSubmissionMap() throws JsonIOException, IOException, JsonSyntaxException, XPathExpressionException, ParserConfigurationException, SAXException{ - FormSubmission fs = getFormSubmissionFor("new_household_registration_with_grouped_subform_data", 1); - - FormSubmissionMap fsm = fam.createFormSubmissionMap(fs); - FormFieldMap fl = fsm.getField("existing_location"); - //TODO - } - -} diff --git a/opensrp-form/src/test/java/org/opensrp/form/service/FormFieldMapTest.java b/opensrp-form/src/test/java/org/opensrp/form/service/FormFieldMapTest.java deleted file mode 100755 index 1095d0e212..0000000000 --- a/opensrp-form/src/test/java/org/opensrp/form/service/FormFieldMapTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.opensrp.form.service; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; - -public class FormFieldMapTest { - - @Test - public void shouldGetFieldAttributesAndGetValuesCodesAndValueAndGetter(){ - String name = "provider_town"; - String value = "ProviderTown"; - String source = "pkchild.provider_town"; - String bindPath = "/model/instance/CensusNewMemberRegistration"; - String type = "FormSubmission"; - Map attributes = new HashMap<>(); - attributes.put("atr1", "atrValue1"); - attributes.put("atr2", "atrValue2"); - Map valueCodes = new HashMap<>(); - valueCodes.put("valueCode1", "valueCode11"); - valueCodes.put("valueCode2", "valueCode12"); - FormFieldMap FormFieldMap = new FormFieldMap(name, value, source, bindPath, type, attributes, valueCodes); - assertEquals(attributes,FormFieldMap.getFieldAttributes()); - assertNotNull(FormFieldMap.getValuesCodes()); - assertEquals(type, FormFieldMap.type()); - assertEquals(source, FormFieldMap.getSource()); - assertEquals(bindPath, FormFieldMap.getBindPath()); - assertEquals(source, FormFieldMap.source()); - assertEquals(bindPath, FormFieldMap.bindPath()); - assertEquals(valueCodes, FormFieldMap.valueCodes("ProviderTown")); - assertEquals("ProviderTown", FormFieldMap.value()); - } -} diff --git a/opensrp-form/src/test/java/org/opensrp/form/service/FormSubmissionConverterTest.java b/opensrp-form/src/test/java/org/opensrp/form/service/FormSubmissionConverterTest.java deleted file mode 100755 index 3cb711667d..0000000000 --- a/opensrp-form/src/test/java/org/opensrp/form/service/FormSubmissionConverterTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.opensrp.form.service; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.opensrp.dto.form.FormSubmissionDTO; - -public class FormSubmissionConverterTest { - - @Test - public void shouldToFormSubmission(){ - String anmId ="ANM1"; - String instanceId = "instanceId"; - String entityId = "entityId"; - String formName = "woman_registration"; - String formInstance = null; - String clientVersion = "09999"; - String formDataDefinitionVersion = "1"; - FormSubmissionDTO formSubmissionDTO = new FormSubmissionDTO(anmId, instanceId, entityId, formName, formInstance, clientVersion, formDataDefinitionVersion); - formSubmissionDTO.withServerVersion("334545"); - FormSubmissionConverter.toFormSubmissionWithVersion(formSubmissionDTO); - assertEquals(anmId, FormSubmissionConverter.toFormSubmission(formSubmissionDTO).anmId()); - } - - @Test(expected=Exception.class) - public void shouldGetExceptionToFormSubmission(){ - String anmId ="ANM1"; - String instanceId = "instanceId"; - String entityId = "entityId"; - String formName = "woman_registration"; - String formInstance = "formInstance"; - String clientVersion = "09999"; - String formDataDefinitionVersion = "1"; - FormSubmissionDTO formSubmissionDTO = new FormSubmissionDTO(anmId, instanceId, entityId, formName, formInstance, clientVersion, formDataDefinitionVersion); - FormSubmissionConverter.toFormSubmission(formSubmissionDTO) ; - } - -} diff --git a/opensrp-form/src/test/java/org/opensrp/form/service/FormSubmissionServiceTest.java b/opensrp-form/src/test/java/org/opensrp/form/service/FormSubmissionServiceTest.java deleted file mode 100755 index b7f525b981..0000000000 --- a/opensrp-form/src/test/java/org/opensrp/form/service/FormSubmissionServiceTest.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.opensrp.form.service; - -import org.joda.time.LocalDate; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InOrder; -import org.mockito.Mock; -import org.motechproject.util.DateUtil; -import org.opensrp.dto.form.FormSubmissionDTO; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.repository.AllFormSubmissions; -import org.opensrp.form.service.FormSubmissionService; - -import java.util.List; - -import static java.lang.String.valueOf; -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.*; -import static org.mockito.MockitoAnnotations.initMocks; - -public class FormSubmissionServiceTest { - @Mock - private AllFormSubmissions allFormSubmissions; - - private FormSubmissionService formSubmissionService; - private long serverVersion; - - @Before - public void setUp() throws Exception { - initMocks(this); - formSubmissionService = new FormSubmissionService(allFormSubmissions); - LocalDate fakeDate = new LocalDate("2012-01-01"); - org.opensrp.common.util.DateUtil.fakeIt(fakeDate); - serverVersion = fakeDate.toDateTimeAtStartOfDay().getMillis(); - } - - @Test - public void shouldSortAllSubmissionsAndSaveEachOne() throws Exception { - long baseTimeStamp = DateUtil.now().getMillis(); - FormSubmissionDTO earlierFormSubmissionDTO = new FormSubmissionDTO("anm id 1", "instance id 1", "entity id 1", "form name 1", null, valueOf(baseTimeStamp), "1"); - FormSubmissionDTO laterFormSubmissionDTO = new FormSubmissionDTO("anm id 2", "instance id 2", "entity id 2", "form name 1", null, valueOf(baseTimeStamp + 1), "1"); - FormSubmissionDTO veryLateFormSubmissionDTO = new FormSubmissionDTO("anm id 2", "instance id 3", "entity id 3", "form name 1", null, valueOf(baseTimeStamp + 2), "1"); - FormSubmission earlierFormSubmission = new FormSubmission("anm id 1", "instance id 1", "form name 1", "entity id 1", baseTimeStamp, "1", null, serverVersion); - FormSubmission laterFormSubmission = new FormSubmission("anm id 2", "instance id 2", "form name 1", "entity id 2", baseTimeStamp + 1, "1", null, serverVersion); - FormSubmission veryLateFormSubmission = new FormSubmission("anm id 2", "instance id 3", "form name 1", "entity id 3", baseTimeStamp + 2, "1", null, serverVersion); - List formSubmissionsDTO = asList(laterFormSubmissionDTO, earlierFormSubmissionDTO, veryLateFormSubmissionDTO); - when(allFormSubmissions.exists(anyString())).thenReturn(false); - - formSubmissionService.submit(formSubmissionsDTO); - - InOrder inOrder = inOrder(allFormSubmissions); - inOrder.verify(allFormSubmissions).exists("instance id 1"); - inOrder.verify(allFormSubmissions).add(earlierFormSubmission); - inOrder.verify(allFormSubmissions).exists("instance id 2"); - inOrder.verify(allFormSubmissions).add(laterFormSubmission); - inOrder.verify(allFormSubmissions).exists("instance id 3"); - inOrder.verify(allFormSubmissions).add(veryLateFormSubmission); - verifyNoMoreInteractions(allFormSubmissions); - } - - @Test - public void shouldNotDelegateFormSubmissionIfAlreadyExists() throws Exception { - long baseTimeStamp = DateUtil.now().getMillis(); - FormSubmissionDTO firstFormSubmissionDTO = new FormSubmissionDTO("anm id 1", "instance id 1", "entity id 1", "form name 1", null, valueOf(baseTimeStamp), "1"); - FormSubmissionDTO secondFormSubmissionDTO = new FormSubmissionDTO("anm id 2", "instance id 2", "entity id 2", "form name 1", null, valueOf(baseTimeStamp + 1), "1"); - FormSubmission firstFormSubmission = new FormSubmission("anm id 1", "instance id 1", "form name 1", "entity id 1", baseTimeStamp, "1", null, serverVersion); - FormSubmission secondFormSubmission = new FormSubmission("anm id 2", "instance id 2", "form name 1", "entity id 2", baseTimeStamp + 1, "1", null, serverVersion); - when(allFormSubmissions.exists("instance id 1")).thenReturn(true); - when(allFormSubmissions.exists("instance id 2")).thenReturn(false); - - formSubmissionService.submit(asList(firstFormSubmissionDTO, secondFormSubmissionDTO)); - - InOrder inOrder = inOrder(allFormSubmissions); - inOrder.verify(allFormSubmissions).exists("instance id 1"); - inOrder.verify(allFormSubmissions, times(0)).add(firstFormSubmission); - inOrder.verify(allFormSubmissions).exists("instance id 2"); - inOrder.verify(allFormSubmissions).add(secondFormSubmission); - verifyNoMoreInteractions(allFormSubmissions); - } - - @Test - public void shouldFetchFormSubmissionsByGiven() throws Exception { - long baseTimeStamp = DateUtil.now().getMillis(); - FormSubmissionDTO firstFormSubmissionDTO = new FormSubmissionDTO("anm id 1", "instance id 1", "entity id 1", "form name 1", "", valueOf(baseTimeStamp), "1").withServerVersion("0"); - FormSubmissionDTO secondFormSubmissionDTO = new FormSubmissionDTO("anm id 2", "instance id 2", "entity id 2", "form name 1", "", valueOf(baseTimeStamp + 1), "1").withServerVersion("1"); - FormSubmission firstFormSubmission = new FormSubmission("anm id 1", "instance id 1", "form name 1", "entity id 1", baseTimeStamp, "1", null, 0L); - FormSubmission secondFormSubmission = new FormSubmission("anm id 2", "instance id 2", "form name 1", "entity id 2", baseTimeStamp + 1, "1", null, 1L); - when(allFormSubmissions.findByServerVersion(0L)).thenReturn(asList(firstFormSubmission, secondFormSubmission)); - - List formSubmissionDTOs = formSubmissionService.fetch(0L); - - assertEquals(asList(firstFormSubmissionDTO, secondFormSubmissionDTO), formSubmissionDTOs); - } - - @Test - public void shouldFetchAllFormSubmissions() throws Exception { - long baseTimeStamp = DateUtil.now().getMillis(); - FormSubmission firstFormSubmission = new FormSubmission("anm id 1", "instance id 1", "form name 1", "entity id 1", baseTimeStamp, "1", null, 0L); - FormSubmission secondFormSubmission = new FormSubmission("anm id 2", "instance id 2", "form name 1", "entity id 2", baseTimeStamp + 1, "1", null, 1L); - when(allFormSubmissions.allFormSubmissions(0, 2)).thenReturn(asList(firstFormSubmission, secondFormSubmission)); - - List formSubmissions = formSubmissionService.getAllSubmissions(0L, 2); - - assertEquals(asList(firstFormSubmission, secondFormSubmission), formSubmissions); - } -} diff --git a/opensrp-form/src/test/java/org/opensrp/form/service/SubformMapTest.java b/opensrp-form/src/test/java/org/opensrp/form/service/SubformMapTest.java deleted file mode 100755 index 3eda9b7cd3..0000000000 --- a/opensrp-form/src/test/java/org/opensrp/form/service/SubformMapTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.opensrp.form.service; - -import static org.junit.Assert.*; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.Test; - -public class SubformMapTest { - @Test - public void shouldGetFieldValueAndGetField(){ - String entityId = "entityId"; - String subformName ="woman_registration"; - String bindType = "woman"; - String defaultBindPath = "/model/instance/CensusNewMemberRegistration/HH_Member"; - Map formAttributes =new HashMap<>(); - List fields = new ArrayList<>(); - formAttributes.put("atr", "atrValue"); - String name = "provider_town"; - String value = "ProviderTown"; - String source = "pkchild.provider_town"; - String bindPath = "/model/instance/CensusNewMemberRegistration"; - String type = "FormSubmission"; - Map attributes = new HashMap<>(); - attributes.put("atr1", "atrValue1"); - attributes.put("atr2", "atrValue2"); - Map valueCodes = new HashMap<>(); - valueCodes.put("valueCode1", "valueCode11"); - valueCodes.put("valueCode2", "valueCode12"); - FormFieldMap FormFieldMap = new FormFieldMap(name, value, source, bindPath, type, attributes, valueCodes); - fields.add(FormFieldMap); - SubformMap subformMap = new SubformMap(entityId, subformName, bindType, defaultBindPath, formAttributes, fields); - assertEquals(value, subformMap.getFieldValue("provider_town")); - assertNull(subformMap.getFieldValue(null)); - assertNull(subformMap.getField(null)); - } - -} diff --git a/opensrp-form/src/test/java/org/opensrp/form/service/TestResourceLoader.java b/opensrp-form/src/test/java/org/opensrp/form/service/TestResourceLoader.java deleted file mode 100755 index d407a3d71f..0000000000 --- a/opensrp-form/src/test/java/org/opensrp/form/service/TestResourceLoader.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.opensrp.form.service; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; - -import org.opensrp.form.domain.FormSubmission; -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.ResourceLoader; - -import com.google.gson.Gson; -import com.google.gson.JsonIOException; - - -public class TestResourceLoader { - protected String formDirPath; - - - public TestResourceLoader() throws IOException { - formDirPath = "/form"; - } - - protected FormSubmission getFormSubmissionFor(String formName, Integer number) throws JsonIOException, IOException{ - ResourceLoader loader=new DefaultResourceLoader(); - String path = loader.getResource(formDirPath).getURI().getPath(); - File fsfile = new File(path+"/"+formName+"/form_submission"+(number==null?"":number)+".json"); - return new Gson().fromJson(new FileReader(fsfile), FormSubmission.class); - } - - protected FormSubmission getFormSubmissionFor(String formName) throws JsonIOException, IOException{ - return getFormSubmissionFor(formName, null); - } -} diff --git a/opensrp-form/src/test/java/org/opensrp/form/service/it/FormSubmissionServiceTest.java b/opensrp-form/src/test/java/org/opensrp/form/service/it/FormSubmissionServiceTest.java deleted file mode 100755 index 9e3cfd60dd..0000000000 --- a/opensrp-form/src/test/java/org/opensrp/form/service/it/FormSubmissionServiceTest.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.opensrp.form.service.it; - -import static java.util.Arrays.asList; -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.motechproject.util.DateUtil; -import org.opensrp.form.domain.FormSubmission; -import org.opensrp.form.repository.AllFormSubmissions; -import org.opensrp.form.repository.it.TestDatabaseConfig; -import org.opensrp.form.service.FormSubmissionService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:applicationContext-opensrp-form.xml") -public class FormSubmissionServiceTest extends TestDatabaseConfig{ - @Autowired - private AllFormSubmissions formSubmissions; - private FormSubmissionService formSubmissionService; - - @Before - public void setUp() throws Exception { - formSubmissionService = new FormSubmissionService(formSubmissions); - } - - @SuppressWarnings("deprecation") - @Test - public void shouldFindByFormName(){ - long baseTimeStamp = DateUtil.now().getMillis(); - String provider = "ANM 6"; - FormSubmission firstFormSubmission = new FormSubmission("ANM 6", "instance id 77", "DemoForm77", "entity id 778", 0L, "1", null, baseTimeStamp); - Map metadata = new HashMap<>(); - metadata.put("formType", new String("type")); - firstFormSubmission.setMetadata(metadata); - formSubmissions.add(firstFormSubmission); - assertEquals(provider, formSubmissionService.findByFormName("DemoForm77", 0l).get(0).anmId()); - assertNotSame("er", formSubmissionService.findByFormName("DemoForm77", 0l).get(0).anmId()); - } - - @Test(expected=IndexOutOfBoundsException.class) - public void shouldGetRuntimeExceptionForFindByFormName(){ - long baseTimeStamp = DateUtil.now().getMillis(); - String provider = "ANM 6"; - FormSubmission firstFormSubmission = new FormSubmission("ANM 6", "instance id 77", "DemoForm77", "entity id 778", 0L, "1", null, baseTimeStamp); - Map metadata = new HashMap<>(); - metadata.put("formType", new String("type")); - firstFormSubmission.setMetadata(metadata); - formSubmissions.add(firstFormSubmission); - formSubmissionService.findByFormName("DemoForm77t", 0l).get(0).anmId(); - } - - @SuppressWarnings("deprecation") - @Test - public void shouldFindByInstanceId(){ - long baseTimeStamp = DateUtil.now().getMillis(); - String provider = "ANM 6"; - String formName = "DemoForm77"; - FormSubmission firstFormSubmission = new FormSubmission("ANM 6", "instance id 77", formName, "entity id 778", 0L, "1", null, baseTimeStamp); - Map metadata = new HashMap<>(); - metadata.put("formType", new String("type")); - firstFormSubmission.setMetadata(metadata); - formSubmissions.add(firstFormSubmission); - assertEquals(formName, formSubmissionService.findByInstanceId("instance id 77").formName()); - assertNotSame("fff", formSubmissionService.findByInstanceId("instance id 77").formName()); - } - - @Test - public void shouldFindByMetadata(){ - long baseTimeStamp = DateUtil.now().getMillis(); - FormSubmission firstFormSubmission = new FormSubmission("ANM 2", "instance id 7", "DemoForm ff", "entity id 78", 0L, "1", null, baseTimeStamp); - Map metadata = new HashMap<>(); - metadata.put("formType", new String("type")); - firstFormSubmission.setMetadata(metadata); - formSubmissions.add(firstFormSubmission); - assertEquals("type", formSubmissionService.findByMetadata("formType","type").get(0).getMetadata("formType")); - assertNotSame("types", formSubmissionService.findByMetadata("formType","type").get(0).getMetadata("formType")); - } - - @Test - public void shouldGetNewSubmissionsForANM(){ - long baseTimeStamp = DateUtil.now().getMillis(); - String provider = "ANM 5"; - FormSubmission firstFormSubmission = new FormSubmission(provider, "instance id 7", "DemoForm ff", "entity id 78", 0L, "1", null, baseTimeStamp); - Map metadata = new HashMap<>(); - metadata.put("formType", new String("type")); - firstFormSubmission.setMetadata(metadata); - formSubmissions.add(firstFormSubmission); - assertEquals(provider, formSubmissionService.getNewSubmissionsForANM(provider,0l,1).get(0).anmId()); - assertNotSame("pro", formSubmissionService.getNewSubmissionsForANM(provider,0l,1).get(0).anmId()); - } - - @Test - public void shouldGetAllFormSubmissions(){ - long baseTimeStamp = DateUtil.now().getMillis(); - FormSubmission firstFormSubmission = new FormSubmission("ANM 1", "instance id 1", "DemoForm Name", "entity id 1", 0L, "1", null, baseTimeStamp); - formSubmissions.add(firstFormSubmission); - assertEquals(1, formSubmissionService.getAllSubmissions(getStdCouchDbConnectorForOpensrpForm(),0L, 1).size()); - } - -} diff --git a/opensrp-form/src/test/resources/form/basic_reg/form.json b/opensrp-form/src/test/resources/form/basic_reg/form.json deleted file mode 100755 index 1dcfa303dc..0000000000 --- a/opensrp-form/src/test/resources/form/basic_reg/form.json +++ /dev/null @@ -1,653 +0,0 @@ -{ - "default_language": "default", - "id_string": "patient_basic_reg", - "children": [ - { - "name": "woman_name", - "label": "First name", - "instance": { - "openmrs_entity_id": "first_name", - "openmrs_entity": "person" - }, - "type": "text" - }, - { - "name": "last_name", - "label": "Last name", - "instance": { - "openmrs_entity_id": "last_name", - "openmrs_entity": "person" - }, - "type": "text" - }, - { - "name": "gender", - "default": "female", - "label": "Gender", - "instance": { - "openmrs_entity_id": "gender", - "openmrs_entity": "person" - }, - "type": "text" - }, - { - "name": "birthdate", - "label": "DOB", - "instance": { - "openmrs_entity_id": "birthdate", - "openmrs_entity": "person" - }, - "type": "date" - }, - { - "children": [ - { - "name": "karachi", - "label": "Karachi", - "instance": { - "openmrs_code": "karachi" - } - }, - { - "name": "lahore", - "label": "Lahore", - "instance": { - "openmrs_code": "lahore" - } - } - ], - "name": "location", - "bind": { - "required": "yes" - }, - "label": "Location of ANC", - "instance": { - "openmrs_entity_id": "location_id", - "openmrs_entity": "encounter" - }, - "type": "select one" - }, - { - "name": "anc_visit_date", - "bind": { - "required": "yes", - "constraint": ".<=${today}" - }, - "label": "ANC visit date?", - "instance": { - "openmrs_entity_id": "encounter_date", - "openmrs_entity": "encounter" - }, - "type": "date" - }, - { - "name": "pulse_rate", - "bind": { - "constraint": ".>0" - }, - "label": "Pulse rate", - "instance": { - "openmrs_entity_id": "5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "integer" - }, - { - "name": "temperature", - "bind": { - "constraint": ".>0" - }, - "label": "Temperature (C)", - "instance": { - "openmrs_entity_id": "5088AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "decimal" - }, - { - "children": [ - { - "name": "birthplace_lat", - "label": "Latitude", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "latitude", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_lon", - "label": "Longitude", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "longitute", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_postcode", - "label": "postalCode / postal_code", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "postalcode", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_house", - "label": "HOUSE_NUMBER / HOUSE / HOUSE_NO / UNIT / UNIT_NUMBER / UNIT_NO", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "house_number", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_street", - "label": "STREET / STREET_NUMBER / LANE", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "street", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_area", - "label": "SECTOR / AREA", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "area", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_town", - "label": "MUNICIPALITY / TOWN / LOCALITY / REGION", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "town", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_busroute", - "label": "Bus route custom field", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "bus_route", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_district", - "label": "COUNTY / DISTRICT", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "district", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_city", - "label": "CITY / VILLAGE", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "city", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_state", - "label": "state / state_province / stateProvince/ province", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "state", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "birthplace_country", - "label": "country", - "instance": { - "openmrs_entity_parent": "birthplace", - "openmrs_entity_id": "country", - "openmrs_entity": "person_address" - }, - "type": "text" - } - ], - "name": "birthplace_address", - "label": "Birthplace", - "type": "group" - }, - { - "children": [ - { - "name": "usual_residence_start", - "label": "When started (startDate / start_date)", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "startdate", - "openmrs_entity": "person_address" - }, - "type": "date" - }, - { - "name": "usual_residence_lat", - "label": "Latitude", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "latitude", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_lon", - "label": "Longitude", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "longitute", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_postcode", - "label": "postalCode / postal_code", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "postalcode", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_house", - "label": "HOUSE_NUMBER / HOUSE / HOUSE_NO / UNIT / UNIT_NUMBER / UNIT_NO", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "uniit", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_street", - "label": "STREET / STREET_NUMBER / LANE", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "lane", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_area", - "label": "SECTOR / AREA", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "sector", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_town", - "label": "MUNICIPALITY / TOWN / LOCALITY / REGION", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "municipality", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_district", - "label": "COUNTY / DISTRICT", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "district", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_city", - "label": "CITY / VILLAGE", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "city", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_state", - "label": "state / state_province / stateProvince/ province", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "province", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "usual_residence_country", - "label": "country", - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "country", - "openmrs_entity": "person_address" - }, - "type": "text" - } - ], - "name": "usual_residence_address", - "label": "Usual Residence", - "type": "group" - }, - { - "children": [ - { - "name": "previous_residence_start", - "label": "When started (startDate / start_date)", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "startdate", - "openmrs_entity": "person_address" - }, - "type": "date" - }, - { - "name": "previous_residence_end", - "label": "When ended (endDate/end_date)", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "enddate", - "openmrs_entity": "person_address" - }, - "type": "date" - }, - { - "name": "previous_residence_lat", - "label": "Latitude", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "latitude", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_lon", - "label": "Longitude", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "longitute", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_postcode", - "label": "postalCode / postal_code", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "postalcode", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_house", - "label": "HOUSE_NUMBER / HOUSE / HOUSE_NO / UNIT / UNIT_NUMBER / UNIT_NO", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "house", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_street", - "label": "STREET / STREET_NUMBER / LANE", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "street", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_area", - "label": "SECTOR / AREA", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "area", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_town", - "label": "MUNICIPALITY / TOWN / LOCALITY / REGION", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "region", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_district", - "label": "COUNTY / DISTRICT", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "county", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_city", - "label": "CITY / VILLAGE", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "village", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_state", - "label": "state / state_province / stateProvince/ province", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "state", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "previous_residence_country", - "label": "country", - "instance": { - "openmrs_entity_parent": "previous_residence", - "openmrs_entity_id": "country", - "openmrs_entity": "person_address" - }, - "type": "text" - } - ], - "name": "previous_residence_address", - "label": "Previous Residence", - "type": "group" - }, - { - "children": [ - { - "name": "deathplace_lat", - "label": "Latitude", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "latitude", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_lon", - "label": "Longitude", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "longitute", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_postcode", - "label": "postalCode / postal_code", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "postal_code", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_house", - "label": "HOUSE_NUMBER / HOUSE / HOUSE_NO / UNIT / UNIT_NUMBER / UNIT_NO", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "unit", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_street", - "label": "STREET / STREET_NUMBER / LANE", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "lane", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_area", - "label": "SECTOR / AREA", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "area", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_town", - "label": "MUNICIPALITY / TOWN / LOCALITY / REGION", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "region", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_district", - "label": "COUNTY / DISTRICT", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "district", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_city", - "label": "CITY / VILLAGE", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "city", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_state", - "label": "state / state_province / stateProvince/ province", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "state_province", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "deathplace_country", - "label": "country", - "instance": { - "openmrs_entity_parent": "deathplace", - "openmrs_entity_id": "country", - "openmrs_entity": "person_address" - }, - "type": "text" - } - ], - "name": "deathplace_address", - "label": "Death Place", - "type": "group" - }, - { - "name": "today", - "type": "today" - }, - { - "name": "start", - "type": "start" - }, - { - "name": "end", - "type": "end" - }, - { - "control": { - "bodyless": true - }, - "children": [ - { - "name": "instanceID", - "bind": { - "readonly": "true()", - "calculate": "concat('uuid:', uuid())" - }, - "type": "calculate" - } - ], - "name": "meta", - "type": "group" - } - ], - "instance": { - "encounter_type": "patient_register" - }, - "version": "201504030905", - "type": "survey", - "name": "register_with_address", - "sms_keyword": "patient_basic_reg", - "title": "Patient Registration" -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/basic_reg/form.xml b/opensrp-form/src/test/resources/form/basic_reg/form.xml deleted file mode 100755 index 8926f192ec..0000000000 --- a/opensrp-form/src/test/resources/form/basic_reg/form.xml +++ /dev/null @@ -1,287 +0,0 @@ -
- - -

Register with address

- - - - -
-
- - Location of ANC - * - -
- - -
-
-
- - - -
-

- Birthplace -

- - - - - - - - - - - - -
- -
-

- Usual Residence -

- - - - - - - - - - - - -
- -
-

- Previous Residence -

- - - - - - - - - - - - - -
- -
-

- Death Place -

- - - - - - - - - - - -
- - - -
\ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/basic_reg/form_definition.json b/opensrp-form/src/test/resources/form/basic_reg/form_definition.json deleted file mode 100755 index c6be057f92..0000000000 --- a/opensrp-form/src/test/resources/form/basic_reg/form_definition.json +++ /dev/null @@ -1,245 +0,0 @@ -{ - "form_data_definition_version": "1", - "form": { - "bind_type": "register_with_address", - "default_bind_path": "/model/instance/register_with_address/", - "fields": [ - { - "name": "woman_name", - "bind": "/model/instance/register_with_address/woman_name" - }, - { - "name": "last_name", - "bind": "/model/instance/register_with_address/last_name" - }, - { - "name": "gender", - "bind": "/model/instance/register_with_address/gender" - }, - { - "name": "birthdate", - "bind": "/model/instance/register_with_address/birthdate" - }, - { - "name": "location", - "bind": "/model/instance/register_with_address/location" - }, - { - "name": "anc_visit_date", - "bind": "/model/instance/register_with_address/anc_visit_date" - }, - { - "name": "pulse_rate", - "bind": "/model/instance/register_with_address/pulse_rate" - }, - { - "name": "temperature", - "bind": "/model/instance/register_with_address/temperature" - }, - { - "name": "birthplace_lat", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_lat" - }, - { - "name": "birthplace_lon", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_lon" - }, - { - "name": "birthplace_postcode", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_postcode" - }, - { - "name": "birthplace_house", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_house" - }, - { - "name": "birthplace_street", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_street" - }, - { - "name": "birthplace_area", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_area" - }, - { - "name": "birthplace_town", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_town" - }, - { - "name": "birthplace_busroute", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_busroute" - }, - { - "name": "birthplace_district", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_district" - }, - { - "name": "birthplace_city", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_city" - }, - { - "name": "birthplace_state", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_state" - }, - { - "name": "birthplace_country", - "bind": "/model/instance/register_with_address/birthplace_address/birthplace_country" - }, - { - "name": "usual_residence_start", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_start" - }, - { - "name": "usual_residence_lat", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_lat" - }, - { - "name": "usual_residence_lon", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_lon" - }, - { - "name": "usual_residence_postcode", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_postcode" - }, - { - "name": "usual_residence_house", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_house" - }, - { - "name": "usual_residence_street", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_street" - }, - { - "name": "usual_residence_area", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_area" - }, - { - "name": "usual_residence_town", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_town" - }, - { - "name": "usual_residence_district", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_district" - }, - { - "name": "usual_residence_city", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_city" - }, - { - "name": "usual_residence_state", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_state" - }, - { - "name": "usual_residence_country", - "bind": "/model/instance/register_with_address/usual_residence_address/usual_residence_country" - }, - { - "name": "previous_residence_start", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_start" - }, - { - "name": "previous_residence_end", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_end" - }, - { - "name": "previous_residence_lat", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_lat" - }, - { - "name": "previous_residence_lon", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_lon" - }, - { - "name": "previous_residence_postcode", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_postcode" - }, - { - "name": "previous_residence_house", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_house" - }, - { - "name": "previous_residence_street", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_street" - }, - { - "name": "previous_residence_area", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_area" - }, - { - "name": "previous_residence_town", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_town" - }, - { - "name": "previous_residence_district", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_district" - }, - { - "name": "previous_residence_city", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_city" - }, - { - "name": "previous_residence_state", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_state" - }, - { - "name": "previous_residence_country", - "bind": "/model/instance/register_with_address/previous_residence_address/previous_residence_country" - }, - { - "name": "deathplace_lat", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_lat" - }, - { - "name": "deathplace_lon", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_lon" - }, - { - "name": "deathplace_postcode", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_postcode" - }, - { - "name": "deathplace_house", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_house" - }, - { - "name": "deathplace_street", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_street" - }, - { - "name": "deathplace_area", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_area" - }, - { - "name": "deathplace_town", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_town" - }, - { - "name": "deathplace_district", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_district" - }, - { - "name": "deathplace_city", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_city" - }, - { - "name": "deathplace_state", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_state" - }, - { - "name": "deathplace_country", - "bind": "/model/instance/register_with_address/deathplace_address/deathplace_country" - }, - { - "name": "today", - "bind": "/model/instance/register_with_address/today" - }, - { - "name": "start", - "bind": "/model/instance/register_with_address/start" - }, - { - "name": "end", - "bind": "/model/instance/register_with_address/end" - } - ] - } -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/basic_reg/form_submission.json b/opensrp-form/src/test/resources/form/basic_reg/form_submission.json deleted file mode 100755 index 84c463821c..0000000000 --- a/opensrp-form/src/test/resources/form/basic_reg/form_submission.json +++ /dev/null @@ -1,254 +0,0 @@ -{ - "anmId": "admin", - "instanceId": "88ceee24-10b4-44c2-9429-754b8d823776", - "clientVersion": "1426830449320", - "entityId": "b716d938-1aea-40ae-a081-9ddddddcccc9", - "formDataDefinitionVersion": "1", - "formName": "basic_reg", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "register_with_address", - "default_bind_path": "/model/instance/register_with_address/", - "fields": [ - { - "name": "woman_name", - "value": "test woman_name" - }, - { - "name": "last_name", - "value": "test last_name" - }, - { - "name": "gender", - "value": "FEMALE" - }, - { - "name": "birthdate", - "value": "2015-02-01" - }, - { - "name": "location", - "value": "unknown location" - }, - { - "name": "anc_visit_date", - "value": "2015-02-01" - }, - { - "name": "pulse_rate", - "value": "55" - }, - { - "name": "temperature", - "value": "37" - }, - { - "name": "birthplace_lat", - "value": "test birthplace_lat" - }, - { - "name": "birthplace_lon", - "value": "test birthplace_lon" - }, - { - "name": "birthplace_postcode", - "value": "test birthplace_postcode" - }, - { - "name": "birthplace_house", - "value": "test birthplace_house" - }, - { - "name": "birthplace_street", - "value": "test birthplace_street" - }, - { - "name": "birthplace_area", - "value": "test birthplace_area" - }, - { - "name": "birthplace_town", - "value": "test birthplace_town" - }, - { - "name": "birthplace_busroute", - "value": "test birthplace_busroute" - }, - { - "name": "birthplace_district", - "value": "test birthplace_district" - }, - { - "name": "birthplace_city", - "value": "test birthplace_city" - }, - { - "name": "birthplace_state", - "value": "test birthplace_state" - }, - { - "name": "birthplace_country", - "value": "test birthplace_country" - }, - { - "name": "usual_residence_start", - "value": "2015-02-01" - }, - { - "name": "usual_residence_lat", - "value": "test usual_residence_lat" - }, - { - "name": "usual_residence_lon", - "value": "test usual_residence_lon" - }, - { - "name": "usual_residence_postcode", - "value": "test usual_residence_postcode" - }, - { - "name": "usual_residence_house", - "value": "test usual_residence_house" - }, - { - "name": "usual_residence_street", - "value": "test usual_residence_street" - }, - { - "name": "usual_residence_area", - "value": "test usual_residence_area" - }, - { - "name": "usual_residence_town", - "value": "test usual_residence_town" - }, - { - "name": "usual_residence_district", - "value": "test usual_residence_district" - }, - { - "name": "usual_residence_city", - "value": "test usual_residence_city" - }, - { - "name": "usual_residence_state", - "value": "test usual_residence_state" - }, - { - "name": "usual_residence_country", - "value": "test usual_residence_country" - }, - { - "name": "previous_residence_start", - "value": "2015-02-01" - }, - { - "name": "previous_residence_end", - "value": "2015-02-01" - }, - { - "name": "previous_residence_lat", - "value": "test previous_residence_lat" - }, - { - "name": "previous_residence_lon", - "value": "test previous_residence_lon" - }, - { - "name": "previous_residence_postcode", - "value": "test previous_residence_postcode" - }, - { - "name": "previous_residence_house", - "value": "test previous_residence_house" - }, - { - "name": "previous_residence_street", - "value": "test previous_residence_street" - }, - { - "name": "previous_residence_area", - "value": "test previous_residence_area" - }, - { - "name": "previous_residence_town", - "value": "test previous_residence_town" - }, - { - "name": "previous_residence_district", - "value": "test previous_residence_district" - }, - { - "name": "previous_residence_city", - "value": "test previous_residence_city" - }, - { - "name": "previous_residence_state", - "value": "test previous_residence_state" - }, - { - "name": "previous_residence_country", - "value": "test previous_residence_country" - }, - { - "name": "deathplace_lat", - "value": "test deathplace_lat" - }, - { - "name": "deathplace_lon", - "value": "test deathplace_lon" - }, - { - "name": "deathplace_postcode", - "value": "test deathplace_postcode" - }, - { - "name": "deathplace_house", - "value": "test deathplace_house" - }, - { - "name": "deathplace_street", - "value": "test deathplace_street" - }, - { - "name": "deathplace_area", - "value": "test deathplace_area" - }, - { - "name": "deathplace_town", - "value": "test deathplace_town" - }, - { - "name": "deathplace_district", - "value": "test deathplace_district" - }, - { - "name": "deathplace_city", - "value": "test deathplace_city" - }, - { - "name": "deathplace_state", - "value": "test deathplace_state" - }, - { - "name": "deathplace_country", - "value": "test deathplace_country" - }, - { - "name": "today", - "value": "2015-02-01" - }, - { - "name": "start", - "value": "2015-02-01" - }, - { - "name": "end", - "value": "2015-02-01" - } - ] - } - }, - "serverVersion": 1430998001293 -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/basic_reg/model.xml b/opensrp-form/src/test/resources/form/basic_reg/model.xml deleted file mode 100755 index 06822afad1..0000000000 --- a/opensrp-form/src/test/resources/form/basic_reg/model.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - female - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/new_household_registration/form.json b/opensrp-form/src/test/resources/form/new_household_registration/form.json deleted file mode 100755 index 0288ac30df..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration/form.json +++ /dev/null @@ -1,655 +0,0 @@ -{ - "default_language": "Bengali", - "id_string": "FWNewHH_1", - "children": [ - { - "name": "existing_location", - "instance": { - "openmrs_entity_id": "location_id", - "openmrs_entity": "encounter" - }, - "type": "hidden" - }, - { - "name": "today", - "instance": { - "openmrs_entity_id": "encounter_date", - "openmrs_entity": "encounter" - }, - "type": "today" - }, - { - "name": "start", - "instance": { - "openmrs_entity_id": "encounter_start", - "openmrs_entity": "encounter" - }, - "type": "start" - }, - { - "name": "end", - "instance": { - "openmrs_entity_id": "encounter_end", - "openmrs_entity": "encounter" - }, - "type": "end" - }, - { - "name": "FWNHREGDATE", - "hint": { - "Bengali": "আজকের তারিখ দিন", - "English": "Confirm Today’s date is correct" - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "তারিখ আজকের তারিখের চেয়ে বেশী হতে পারবেনা", - "English": "Date cannot be greater than current date." - }, - "required": "yes", - "constraint": ".<=${today}" - }, - "label": { - "Bengali": "তথ্য সংগ্রহের তারিখ", - "English": "Date of Interview" - }, - "instance": { - "openmrs_entity_id": "160753AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "date" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWGOBHHID", - "hint": { - "Bengali": "অনুগ্রহ করে খানার দরজাতে লেখা কালো রঙের JiVitA/Study household ID (HHID) টি টাইপ করুন", - "English": "Please input the Black – painted Government household ID (HHID) as displayed on the door/wall of the HH." - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "অনুগ্রহ করে ০০০১ থেকে ৯৯৯৯ এর মধ্যে ৪ ডিজিটের GoB HHID টাইপ করুন", - "English": "Please enter 4 digits of GoB HHID from 0001 to 9999" - }, - "required": "yes", - "constraint": "regex(., '^(?!0{4})[0-9]{4}$')" - }, - "label": { - "Bengali": "GoB HHID", - "English": "GoB HHID" - }, - "instance": { - "openmrs_entity_id": "GOB HHID", - "openmrs_entity": "person_identifier" - }, - "type": "text" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWJIVHHID", - "hint": { - "Bengali": "অনুগ্রহ করে খানার দরজাতে লেখা লাল রঙের JiVitA/Study household ID (HHID) টি টাইপ করুন", - "English": "Please input the RED – painted JiVitA / Study household ID (HHID) as displayed on the door/wall of the HH." - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "অনুগ্রহ করে ০০০১ থেকে ৯৯৯৯ এর মধ্যে ৪ ডিজিটের JiVitA HHID টাইপ করুন", - "English": "Please enter 4 digits of JiVitA HHID from 0001 to 9999" - }, - "required": "yes", - "constraint": "regex(., '^(?!0{4})[0-9]{4}$')" - }, - "label": { - "Bengali": "JiVitA HHID", - "English": "JiVitA HHID" - }, - "instance": { - "openmrs_entity_id": "JiVitA HHID", - "openmrs_entity": "person_identifier" - }, - "type": "text" - }, - { - "name": "FWNHNEARTO", - "label": { - "Bengali": "নিকটবর্তী স্থান", - "English": "Near to" - }, - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "landmark", - "openmrs_entity": "person_address" - }, - "type": "text" - }, - { - "name": "FWNHHHGPS", - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "জি পি এস", - "English": "Collect GPS Location of HH" - }, - "instance": { - "openmrs_entity_parent": "usual_residence", - "openmrs_entity_id": "geopoint", - "openmrs_entity": "person_address" - }, - "type": "geopoint" - }, - { - "name": "FWHOHFNAME", - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "খানা প্রধানের নাম-", - "English": "Head of Household Name" - }, - "instance": { - "openmrs_entity_id": "first_name", - "openmrs_entity": "person" - }, - "type": "text" - }, - { - "name": "FWHOHLNAME", - "bind": { - "calculate": "\".\"" - }, - "instance": { - "openmrs_entity_id": "last_name", - "openmrs_entity": "person" - }, - "type": "calculate" - }, - { - "name": "FWHOHBIRTHDATE", - "bind": { - "calculate": "\"1900-01-01\"" - }, - "instance": { - "openmrs_entity_id": "birthdate", - "openmrs_entity": "person" - }, - "type": "calculate" - }, - { - "name": "FWHOHGENDER", - "bind": { - "calculate": "\"male\"" - }, - "instance": { - "openmrs_entity_id": "gender", - "openmrs_entity": "person" - }, - "type": "calculate" - }, - { - "name": "FWNHHMBRNUM", - "label": { - "Bengali": "খানা সদস্যের সংখ্যা কত?", - "English": "How many people are currently living in this household?" - }, - "instance": { - "openmrs_entity_id": "5611AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "integer" - }, - { - "children": [ - { - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - }, - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - }, - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "9", - "label": { - "Bengali": "জানিনা", - "English": "Don't know" - }, - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - } - ], - "name": "FWNHHMWRA", - "label": { - "Bengali": "এই খানায় কি প্রজনন বয়সী বিবাহিত মহিলা আছেন?", - "English": "Are there any MWRAs in this Household?" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "FWWOMFNAME", - "hint": { - "Bengali": "অনুগ্রহ করে মহিলার নাম টাইপ করুন", - "English": "Please type woman's name" - }, - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "মহিলার নাম-", - "English": "Woman Name" - }, - "instance": { - "openmrs_entity_id": "first_name", - "openmrs_entity": "person" - }, - "type": "text" - }, - { - "name": "FWWOMLNAME", - "bind": { - "calculate": "\".\"" - }, - "instance": { - "openmrs_entity_id": "last_name", - "openmrs_entity": "person" - }, - "type": "calculate" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWWOMNID", - "hint": { - "Bengali": "অনুগ্রহ করে জাতীয় পরিচয়পত্র কার্ড দেখে সরকার প্রদত্ত আইডি টাইপ করুন", - "English": "Please input the Government ID as displayed on the national ID card" - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "জাতীয় পরিচয়পত্র নং ১৩ অথবা ১৭ ডিজিটের হবে", - "English": "National ID should be 13 or 17 digits" - }, - "constraint": "regex(., '^(?!0{13})[0-9]{13}$') or regex(., '^(?!0{17})[0-9]{17}$')" - }, - "label": { - "Bengali": "মহিলার জাতীয় পরিচয়পত্র নং-", - "English": "Woman's National ID Number" - }, - "instance": { - "openmrs_entity_id": "NID", - "openmrs_entity": "person_identifier" - }, - "type": "text" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWWOMBID", - "hint": { - "Bengali": "অনুগ্রহ করে জন্ম নিবন্ধন সনদ দেখে সরকার প্রদত্ত আইডি টাইপ করুন", - "English": "Please input the Government ID as displayed on the birth certificate" - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "জন্ম নিবন্ধন সনদ নং ১৭ ডিজিটের হবে", - "English": "Birth Registration ID should be 17 digits" - }, - "required": "yes", - "constraint": "regex(., '^(?!0{17})[0-9]{17}$')" - }, - "label": { - "Bengali": "মহিলার জন্ম নিবন্ধন সনদ নং-", - "English": "Woman's Birth Registration ID" - }, - "instance": { - "openmrs_entity_id": "Birth Registration ID", - "openmrs_entity": "person_identifier" - }, - "type": "text" - }, - { - "name": "FWHUSNAME", - "hint": { - "Bengali": "অনুগ্রহ করে স্বামীর নাম টাইপ করুন", - "English": "Please type husband's name" - }, - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "স্বামীর নাম-", - "English": "Husband Name" - }, - "instance": { - "openmrs_entity_id": "161135AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "text" - }, - { - "name": "FWBIRTHDATE", - "hint": { - "Bengali": "মহিলার জন্ম নিবন্ধন পত্র থাকলে সেখান থেকে জন্ম তারিখটি লিখে নিন। যদি জন্ম তারিখ জানা না থাকে তবে তারিখ ১৫ সিলেক্ট করুন, যদি মাস জানা না থাকে তবে মাস ৬ (জুন) সিলেক্ট করুন", - "English": "If birth certificate is available, take date of birth from the birth certificate. \nIf date of birth is unknown, choose 15th as the date of birth. If month is unknown, choose month 06 (June) as month of birth." - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "মহিলার বয়স অবশ্যই ১৩ বছরের বেশী হবে", - "English": "Woman must be older than 13 years of age" - }, - "required": "yes", - "constraint": "((${FWBIRTHDATE})+4745) <= today()" - }, - "label": { - "Bengali": "মহিলার জন্ম তারিখ", - "English": "Woman's Date of Birth" - }, - "instance": { - "openmrs_entity_id": "birthdate", - "openmrs_entity": "person" - }, - "type": "date" - }, - { - "name": "FWGENDER", - "bind": { - "calculate": "\"female\"" - }, - "instance": { - "openmrs_entity_id": "gender", - "openmrs_entity": "person" - }, - "type": "calculate" - }, - { - "name": "FWWOMAGE", - "bind": { - "calculate": "round(((${today} - ${FWBIRTHDATE}) div 365.25),0)" - }, - "type": "calculate" - }, - { - "name": "display_age", - "label": { - "Bengali": "মহিলার বয়স ${FWWOMAGE}", - "English": "The woman's age is ${FWWOMAGE}." - }, - "type": "note" - }, - { - "children": [ - { - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - }, - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - }, - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "9", - "label": { - "Bengali": "জানিনা", - "English": "Don't know" - }, - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - } - ], - "name": "FWNHWOMSTRMEN", - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "আপনার কি মাসিক একেবারে উঠে গেছে/আপনি কি স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?", - "English": "Are you currently menopausal or sterilized?" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "0", - "label": { - "Bengali": "মারা গেছেন", - "English": "Deceased" - }, - "instance": { - "openmrs_code": "159AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "1", - "label": { - "Bengali": "বেঁচে আছেন", - "English": "Alive" - }, - "instance": { - "openmrs_code": "160429AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "9", - "label": { - "Bengali": "জানিনা", - "English": "Don't know" - }, - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - } - ], - "name": "FWNHWOMHUSALV", - "bind": { - "relevant": "${FWNHWOMSTRMEN}='0'", - "required": "yes" - }, - "label": { - "Bengali": "আপনার স্বামী কি বেঁচে আছেন?", - "English": "Is the husband alive?" - }, - "instance": { - "openmrs_entity_id": "5561AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - }, - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - }, - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "9", - "label": { - "Bengali": "জানিনা", - "English": "Don't know" - }, - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - } - ], - "name": "FWNHWOMHUSLIV", - "bind": { - "relevant": "${FWNHWOMSTRMEN}='0' and ${FWNHWOMHUSALV}='1'", - "required": "yes" - }, - "label": { - "Bengali": "আপনি কি বর্তমানে আপনার স্বামীর সাথে বসবাস করছেন?", - "English": "Are you currently living with your husband?" - }, - "instance": { - "openmrs_entity_id": "1060AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - }, - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - }, - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - }, - { - "name": "9", - "label": { - "Bengali": "জানিনা", - "English": "Don't know" - }, - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - } - } - ], - "name": "FWNHWOMHUSSTR", - "bind": { - "relevant": "${FWNHWOMSTRMEN}='0' and ${FWNHWOMHUSLIV}='1'", - "required": "yes" - }, - "label": { - "Bengali": "আপনার স্বামী কি স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?", - "English": "Is the husband sterilized?" - }, - "type": "select one" - }, - { - "name": "FWELIGIBLE", - "bind": { - "calculate": "if(${FWNHWOMSTRMEN}='0' and ${FWNHWOMHUSLIV}='1' and ${FWNHWOMHUSSTR}='0',1,0)" - }, - "type": "calculate" - }, - { - "name": "add_women", - "label": { - "Bengali": "এই খানায় যদি আরও কোন মহিলা থাকে যাকে রেজিস্ট্রেশন করা হয়নি, তাহলে '+' অপশনটি বাছুন এবং একই প্রক্রিয়ায় পরবর্তী মহিলাকে রেজিস্ট্রেশন করুন", - "English": "If there are any additional unregistered women in this household, select the '+' to add them now." - }, - "type": "note" - } - ], - "name": "woman", - "hint": { - "Bengali": "আমরা এখন মহিলাটির রেজিস্ট্রেশন প্রক্রিয়া শুরু করতে যাচ্ছি। অনুগ্রহ করে মহিলাটিরে তার জন্ম নিবন্ধন স ও জাতীয় পরিচয়পত্র নিয়ে আসতে বলুন।", - "English": "We will now register the woman. Please ask her to bring her National ID Card and Birth Certificate." - }, - "bind": { - "relevant": "${FWNHHMWRA}='1'" - }, - "label": { - "Bengali": "মহিলা তথ্যঃ", - "English": "New Woman Registration" - }, - "instance": { - "openmrs_entity_id": "Census and New Woman Registration", - "openmrs_entity": "person" - }, - "type": "repeat" - }, - { - "name": "join_names", - "bind": { - "calculate": "join(' ', ${FWWOMFNAME})" - }, - "type": "calculate" - }, - { - "name": "MWRA", - "bind": { - "calculate": "if(${join_names} = '', 0, count(${woman}))" - }, - "type": "calculate" - }, - { - "control": { - "bodyless": true - }, - "children": [ - { - "name": "instanceID", - "bind": { - "readonly": "true()", - "calculate": "concat('uuid:', uuid())" - }, - "type": "calculate" - } - ], - "name": "meta", - "type": "group" - } - ], - "instance": { - "encounter_type": "New Household Registration" - }, - "version": "201505070930", - "type": "survey", - "name": "FWNewHH", - "sms_keyword": "FWNewHH", - "title": "FW new HH Reg" -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/new_household_registration/form.xml b/opensrp-form/src/test/resources/form/new_household_registration/form.xml deleted file mode 100755 index 85089deaa5..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration/form.xml +++ /dev/null @@ -1,26 +0,0 @@ - -
-

নতুন খানা রেজিস্ট্রেশন ফর্ম

- - - - - - - - - -
এই খানায় কি প্রজনন বয়সী বিবাহিত মহিলা আছেন?Are there any MWRAs in this Household? -
-

মহিলা তথ্যঃNew Woman Registration

আপনার কি মাসিক একেবারে উঠে গেছে/আপনি কি স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?Are you currently menopausal or sterilized?* -
আপনার স্বামী কি বেঁচে আছেন?Is the husband alive?* -
আপনি কি বর্তমানে আপনার স্বামীর সাথে বসবাস করছেন?Are you currently living with your husband?* -
আপনার স্বামী কি স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?Is the husband sterilized?* -
-
-
- -
XML to HTML transformation for form took 0.03 secondsThis validation is yet not functional.
diff --git a/opensrp-form/src/test/resources/form/new_household_registration/form_definition.json b/opensrp-form/src/test/resources/form/new_household_registration/form_definition.json deleted file mode 100755 index f1dea2a941..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration/form_definition.json +++ /dev/null @@ -1,166 +0,0 @@ -{ - "form_data_definition_version": "1", - "form": { - "default_bind_path": "/model/instance/FWNewHH", - "bind_type": "household", - "fields": [ - { - "name": "id", - "shouldLoadValue": true - }, - { - "name": "existing_location", - "bind": "/model/instance/FWNewHH/existing_location" - }, - { - "name": "today", - "bind": "/model/instance/FWNewHH/today" - }, - { - "name": "start", - "bind": "/model/instance/FWNewHH/start" - }, - { - "name": "end", - "bind": "/model/instance/FWNewHH/end" - }, - { - "name": "FWNHREGDATE", - "bind": "/model/instance/FWNewHH/FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "bind": "/model/instance/FWNewHH/FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "bind": "/model/instance/FWNewHH/FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "bind": "/model/instance/FWNewHH/FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "bind": "/model/instance/FWNewHH/FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "bind": "/model/instance/FWNewHH/FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "bind": "/model/instance/FWNewHH/FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "bind": "/model/instance/FWNewHH/FWHOHBIRTHDATE" - }, - { - "name": "FWHOHBIRTHDATEAPPROX", - "bind": "/model/instance/FWNewHH/FWHOHBIRTHDATEAPPROX" - }, - { - "name": "FWHOHGENDER", - "bind": "/model/instance/FWNewHH/FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "bind": "/model/instance/FWNewHH/FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "bind": "/model/instance/FWNewHH/FWNHHMWRA" - }, - { - "name": "join_names", - "bind": "/model/instance/FWNewHH/join_names" - }, - { - "name": "MWRA", - "bind": "/model/instance/FWNewHH/MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "shouldLoadValue": true - }, - { - "name": "GOBHHID", - "bind": "/model/instance/FWNewHH/woman/GOBHHID" - }, - { - "name": "JiVitAHHID", - "bind": "/model/instance/FWNewHH/woman/JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "bind": "/model/instance/FWNewHH/woman/FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "bind": "/model/instance/FWNewHH/woman/FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "bind": "/model/instance/FWNewHH/woman/FWWOMNID" - }, - { - "name": "FWWOMBID", - "bind": "/model/instance/FWNewHH/woman/FWWOMBID" - }, - { - "name": "FWHUSNAME", - "bind": "/model/instance/FWNewHH/woman/FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "bind": "/model/instance/FWNewHH/woman/FWBIRTHDATE" - }, - { - "name": "FWBIRTHDATEAPPROX", - "bind": "/model/instance/FWNewHH/woman/FWBIRTHDATEAPPROX" - }, - { - "name": "FWGENDER", - "bind": "/model/instance/FWNewHH/woman/FWGENDER" - }, - { - "name": "FWWOMAGE", - "bind": "/model/instance/FWNewHH/woman/FWWOMAGE" - }, - { - "name": "display_age", - "bind": "/model/instance/FWNewHH/woman/display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "bind": "/model/instance/FWNewHH/woman/FWELIGIBLE" - } - ] - } - ] - } -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/new_household_registration/form_submission1.json b/opensrp-form/src/test/resources/form/new_household_registration/form_submission1.json deleted file mode 100755 index a6a2f189a5..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration/form_submission1.json +++ /dev/null @@ -1,228 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f180115a3", - "_rev": "1-e73e1d93acdcdaeb1d41a738da5d9284", - "type": "FormSubmission", - "anmId": "demotest", - "instanceId": "88c0e824-10b4-44c2-9429-754b8d823776", - "formName": "new_household_registration", - "entityId": "a3f2abf4-2699-4761-819a-cea739224164", - "clientVersion": 1430997074596, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "a3f2abf4-2699-4761-819a-cea739224164", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "KUPTALA", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-07", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-07", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "1234", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "1234", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "value": "nothing", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "34 34 0 0", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "test", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "value": "2", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "value": "1", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "shumi sumaita", - "source": "household.join_names" - }, - { - "name": "MWRA", - "value": "2", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "1234323", - "JiVitAHHID": "123465656", - "FWWOMFNAME": "shumi", - "FWWOMLNAME": ".", - "FWWOMNID": "", - "FWWOMBID": "54676545676787876", - "FWHUSNAME": "selim", - "FWBIRTHDATE": "1998-02-04", - "FWGENDER": "female", - "FWWOMAGE": "17", - "display_age": "", - "FWNHWOMSTRMEN": "1", - "FWNHWOMHUSALV": "", - "FWNHWOMHUSLIV": "", - "FWNHWOMHUSSTR": "", - "FWELIGIBLE": "0", - "id": "babcd9d2-b3e9-4f6d-8a06-2df8f5fbf01f" - }, - { - "GOBHHID": "1234121", - "JiVitAHHID": "12348787", - "FWWOMFNAME": "sumaita", - "FWWOMLNAME": ".", - "FWWOMNID": "", - "FWWOMBID": "56543456567654567", - "FWHUSNAME": "razzak", - "FWBIRTHDATE": "1989-08-18", - "FWGENDER": "female", - "FWWOMAGE": "26", - "display_age": "", - "FWNHWOMSTRMEN": "0", - "FWNHWOMHUSALV": "1", - "FWNHWOMHUSLIV": "1", - "FWNHWOMHUSSTR": "1", - "FWELIGIBLE": "0", - "id": "74eebb60-a1b9-4691-81a4-5c04ecce7ae9" - } - ] - } - ] - } - }, - "serverVersion": 1430998001293 -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/new_household_registration/form_submission2.json b/opensrp-form/src/test/resources/form/new_household_registration/form_submission2.json deleted file mode 100755 index 76f8e41550..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration/form_submission2.json +++ /dev/null @@ -1,207 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f18000df2", - "_rev": "1-0cec42380dce0fef7b1263aad8652c3f", - "type": "FormSubmission", - "anmId": "demotest", - "instanceId": "916363c4-a10e-488d-8de4-9be7a05d43cd", - "formName": "new_household_registration", - "entityId": "0aac6d81-b51f-4096-b354-5a5786e406c8", - "clientVersion": 1430924780686, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "0aac6d81-b51f-4096-b354-5a5786e406c8", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "KUPTALA", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-06", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-06T21:05:35.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-06T21:05:35.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-06", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "0002", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "0002", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "23.7984 90.4019 0 25", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "karim mia", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "value": "1", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "value": "0", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "source": "household.join_names" - }, - { - "name": "MWRA", - "value": "0", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "0002", - "JiVitAHHID": "042002", - "FWWOMFNAME": "fana", - "FWWOMLNAME": ".", - "FWWOMNID": "", - "FWWOMBID": "9999999999999999", - "FWHUSNAME": "", - "FWBIRTHDATE": "2000-12-12", - "FWGENDER": "female", - "FWWOMAGE": "NaN", - "display_age": "", - "FWNHWOMSTRMEN": "", - "FWNHWOMHUSALV": "", - "FWNHWOMHUSLIV": "", - "FWNHWOMHUSSTR": "", - "FWELIGIBLE": "0", - "id": "b19db74f-6e96-4652-a765-5078beb12434" - } - ] - } - ] - } - }, - "serverVersion": 1430924937728 -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/new_household_registration/form_submission3.json b/opensrp-form/src/test/resources/form/new_household_registration/form_submission3.json deleted file mode 100755 index 113c3c0829..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration/form_submission3.json +++ /dev/null @@ -1,208 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f1800160d", - "_rev": "1-89988ca8cc2db0cd67afc292263137fe", - "type": "FormSubmission", - "anmId": "demotest", - "instanceId": "1cdf1628-86f2-440b-b5b0-4bc612d2fd2f", - "formName": "new_household_registration", - "entityId": "baf59aa4-64e9-46fc-99e6-8cd8f01618ff", - "clientVersion": 1430925173098, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "baf59aa4-64e9-46fc-99e6-8cd8f01618ff", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "LAKSHMIPUR", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-06", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-06T21:09:22.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-06T21:09:22.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-06", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "0091", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "0091", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "23.7984 90.402 0 40", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "hasan ferox", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "value": "1", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "value": "1", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "mithila", - "source": "household.join_names" - }, - { - "name": "MWRA", - "value": "1", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "0091", - "JiVitAHHID": "0524091", - "FWWOMFNAME": "mithila", - "FWWOMLNAME": ".", - "FWWOMNID": "1111111111111", - "FWWOMBID": "12345678912345678", - "FWHUSNAME": "hasan feroz", - "FWBIRTHDATE": "1989-01-01", - "FWGENDER": "female", - "FWWOMAGE": "26", - "display_age": "", - "FWNHWOMSTRMEN": "0", - "FWNHWOMHUSALV": "1", - "FWNHWOMHUSLIV": "1", - "FWNHWOMHUSSTR": "1", - "FWELIGIBLE": "0", - "id": "409b44c4-262a-40b8-ad7d-748c480c7c13" - } - ] - } - ] - } - }, - "serverVersion": 1430925176060 -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/new_household_registration/form_submission4.json b/opensrp-form/src/test/resources/form/new_household_registration/form_submission4.json deleted file mode 100755 index 7665de2411..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration/form_submission4.json +++ /dev/null @@ -1,208 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f18001e50", - "_rev": "1-3a413b7428ae33aafd08898dc2c974d4", - "type": "FormSubmission", - "anmId": "demotest", - "instanceId": "cad01d9c-9f7f-4e0b-a66a-2d1121bf8b8d", - "formName": "new_household_registration", - "entityId": "f92ee1b5-c3ce-42fb-bbc8-e01f474acc5a", - "clientVersion": 1430926871912, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "f92ee1b5-c3ce-42fb-bbc8-e01f474acc5a", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "KUPTALA", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-06", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-06T21:38:52.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-06T21:38:52.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-06", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "4567", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "5678", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "23.7984 90.4021 0 37", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "jashim mia", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "value": "5", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "value": "1", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "razia sultana", - "source": "household.join_names" - }, - { - "name": "MWRA", - "value": "1", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "4567", - "JiVitAHHID": "5678", - "FWWOMFNAME": "razia sultana", - "FWWOMLNAME": ".", - "FWWOMNID": "0987654321123", - "FWWOMBID": "09876543211234567", - "FWHUSNAME": "jashim mia", - "FWBIRTHDATE": "1991-02-27", - "FWGENDER": "female", - "FWWOMAGE": "24", - "display_age": "", - "FWNHWOMSTRMEN": "0", - "FWNHWOMHUSALV": "1", - "FWNHWOMHUSLIV": "1", - "FWNHWOMHUSSTR": "0", - "FWELIGIBLE": "1", - "id": "0036b7ca-36ec-4242-9885-a0a03a666cda" - } - ] - } - ] - } - }, - "serverVersion": 1430926886181 -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/new_household_registration/form_submission5.json b/opensrp-form/src/test/resources/form/new_household_registration/form_submission5.json deleted file mode 100755 index 8447c0ff4a..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration/form_submission5.json +++ /dev/null @@ -1,209 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f180115a3", - "_rev": "1-e73e1d93acdcdaeb1d41a738da5d9284", - "type": "FormSubmission", - "anmId": "demotest", - "instanceId": "88c0e824-10b4-44c2-9429-754b8d823776", - "formName": "new_household_registration", - "entityId": "a3f2abf4-2699-4761-819a-cea739224164", - "clientVersion": 1430997074596, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "a3f2abf4-2699-4761-819a-cea739224164", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "KUPTALA", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-07", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-07", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "1234", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "1234", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "value": "nothing", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "34 34 0 0", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "test", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "value": "2", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "value": "1", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "shumi sumaita", - "source": "household.join_names" - }, - { - "name": "MWRA", - "value": "2", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "", - "JiVitAHHID": "", - "FWWOMFNAME": "", - "FWWOMLNAME": "", - "FWWOMNID": "", - "FWWOMBID": "", - "FWHUSNAME": "", - "FWBIRTHDATE": "", - "FWGENDER": "", - "FWWOMAGE": "", - "display_age": "", - "FWNHWOMSTRMEN": "", - "FWNHWOMHUSALV": "", - "FWNHWOMHUSLIV": "", - "FWNHWOMHUSSTR": "", - "FWELIGIBLE": "", - "id": "babcd9d2-b3e9-4f6d-8a06-2df8f5fbf01f" - } - ] - } - ] - } - }, - "serverVersion": 1430998001293 -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/new_household_registration/form_submission6.json b/opensrp-form/src/test/resources/form/new_household_registration/form_submission6.json deleted file mode 100755 index 8f3ec6c5ad..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration/form_submission6.json +++ /dev/null @@ -1,216 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f180115a3", - "_rev": "1-e73e1d93acdcdaeb1d41a738da5d9284", - "type": "FormSubmission", - "anmId": "admin", - "instanceId": "88c0e824-10b4-44c2-9429-754b8d823776", - "formName": "new_household_registration", - "entityId": "a3f2abf4-2699-4761-819a-cea739224164", - "clientVersion": 1430997074596, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "a3f2abf4-2699-4761-819a-cea739224164", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "KUPTALA", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-07", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-07", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "1234", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "1234", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "value": "nothing", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "34 34 0 0", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "test", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHBIRTHDATEAPPROX", - "value": "1", - "source": "household.FWHOHBIRTHDATEAPPROX" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "shumi sumaita", - "source": "household.join_names" - }, - { - "name": "MWRA", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWBIRTHDATEAPPROX", - "source": "elco.FWBIRTHDATEAPPROX" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "48374", - "JiVitAHHID": "78748", - "FWWOMFNAME": "tEST First", - "FWWOMLNAME": " lastname", - "FWWOMNID": "", - "FWWOMBID": "", - "FWHUSNAME": "", - "FWBIRTHDATE": "2000-05-07", - "FWBIRTHDATEAPPROX":"1", - "FWGENDER": "Female", - "FWWOMAGE": "", - "display_age": "", - "FWNHWOMSTRMEN": "", - "FWNHWOMHUSALV": "", - "FWNHWOMHUSLIV": "", - "FWNHWOMHUSSTR": "", - "FWELIGIBLE": "", - "id": "babcd9d2-b3e9-4f6d-8a06-2df8f5fbf01f" - } - ] - } - ] - } - }, - "serverVersion": 1430998001293 -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/new_household_registration/form_submission7.json b/opensrp-form/src/test/resources/form/new_household_registration/form_submission7.json deleted file mode 100755 index 443ced2385..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration/form_submission7.json +++ /dev/null @@ -1,216 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f180115a3", - "_rev": "1-e73e1d93acdcdaeb1d41a738da5d9284", - "type": "FormSubmission", - "anmId": "admin", - "instanceId": "88c0e824-10b4-44c2-9429-754b8d823776", - "formName": "new_household_registration", - "entityId": "a3f2abf4-2699-4761-819a-cea739224164", - "clientVersion": 1430997074596, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "a3f2abf4-2699-4761-819a-cea739224164", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "KUPTALA", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-07", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-07", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "1234", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "1234", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "value": "nothing", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "34 34 0 0", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "test", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHBIRTHDATEAPPROX", - "value": "1", - "source": "household.FWHOHBIRTHDATEAPPROX" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "shumi sumaita", - "source": "household.join_names" - }, - { - "name": "MWRA", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWBIRTHDATEAPPROX", - "source": "elco.FWBIRTHDATEAPPROX" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "48374", - "JiVitAHHID": "78748", - "FWWOMFNAME": "tEST First", - "FWWOMLNAME": " lastname", - "FWWOMNID": "5478549854895", - "FWWOMBID": "43030293029323", - "FWHUSNAME": "husb", - "FWBIRTHDATE": "2000-05-07", - "FWBIRTHDATEAPPROX":"0", - "FWGENDER": "Female", - "FWWOMAGE": "21", - "display_age": "", - "FWNHWOMSTRMEN": "", - "FWNHWOMHUSALV": "", - "FWNHWOMHUSLIV": "", - "FWNHWOMHUSSTR": "", - "FWELIGIBLE": "", - "id": "babcd9d2-b3e9-4f6d-8a06-2df8f5fbf01f" - } - ] - } - ] - } - }, - "serverVersion": 1430998001293 -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/new_household_registration/form_submission8.json b/opensrp-form/src/test/resources/form/new_household_registration/form_submission8.json deleted file mode 100755 index 0c1850d4ed..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration/form_submission8.json +++ /dev/null @@ -1,211 +0,0 @@ -{ - "_id": "251ca0ef09df9af88f0e9d5f180115a3", - "_rev": "1-e73e1d93acdcdaeb1d41a738da5d9284", - "type": "FormSubmission", - "anmId": "admin", - "instanceId": "88c0e824-10b4-44c2-9429-754b8d823776", - "formName": "new_household_registration", - "entityId": "a3f2abf4-2699-4761-819a-cea739224164", - "clientVersion": 1430997074596, - "formDataDefinitionVersion": "1", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "a3f2abf4-2699-4761-819a-cea739224164", - "source": "household.id" - }, - { - "name": "existing_location", - "value": "KUPTALA", - "source": "household.existing_location" - }, - { - "name": "today", - "value": "2015-05-07", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-05-07T17:07:21.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-05-07", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "1234", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "1234", - "source": "household.FWJIVHHID" - }, - { - "name": "FWNHNEARTO", - "value": "nothing", - "source": "household.FWNHNEARTO" - }, - { - "name": "FWNHHHGPS", - "value": "34 34 0 0", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "test", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "value": "male", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "shumi sumaita", - "source": "household.join_names" - }, - { - "name": "MWRA", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWBIRTHDATEAPPROX", - "source": "elco.FWBIRTHDATEAPPROX" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - } - ], - "instances": [ - { - "GOBHHID": "48374", - "JiVitAHHID": "78748", - "FWWOMFNAME": "tEST First", - "FWWOMLNAME": " lastname", - "FWWOMNID": "", - "FWWOMBID": "", - "FWHUSNAME": "", - "FWBIRTHDATE": "2000-05-07", - "FWBIRTHDATEAPPROX":"", - "FWGENDER": "Female", - "FWWOMAGE": "", - "display_age": "", - "FWNHWOMSTRMEN": "", - "FWNHWOMHUSALV": "", - "FWNHWOMHUSLIV": "", - "FWNHWOMHUSSTR": "", - "FWELIGIBLE": "", - "id": "babcd9d2-b3e9-4f6d-8a06-2df8f5fbf01f" - } - ] - } - ] - } - }, - "serverVersion": 1430998001293 -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/new_household_registration/model.xml b/opensrp-form/src/test/resources/form/new_household_registration/model.xml deleted file mode 100755 index a0cabcad26..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration/model.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/opensrp-form/src/test/resources/form/new_household_registration_with_grouped_subform_data/form.json b/opensrp-form/src/test/resources/form/new_household_registration_with_grouped_subform_data/form.json deleted file mode 100755 index 99dadab7ad..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration_with_grouped_subform_data/form.json +++ /dev/null @@ -1,1100 +0,0 @@ -{ - "name": "FWNewHH", - "title": "নতুন খানা নিবন্ধন ফর্ম", - "sms_keyword": "FWNewHH", - "default_language": "Bengali", - "instance": { - "encounter_type": "New Household Registration" - }, - "version": "201510181114", - "id_string": "FWNewHH", - "type": "survey", - "children": [ - { - "type": "hidden", - "name": "version", - "label": { - "English": "TechVersion: v1.4 Aug 26, 2015\nFormVersion: v1.0" - } - }, - { - "type": "hidden", - "name": "changes", - "label": { - "English": "NN: \n1. Added a calculation field 'REGDATE' under 'woman' group\n2. Removed the conceptIDs which have Datatype N/A\n3. Define NID as person_attribute\nKZ: Dropped 9=DK from Vitsts choices\nCG: Added person_address mappings and NN added Variable Names for these address fields\nCG: Change NID back to person_identifier\nCG: Delete location_name field - need to communicate this change to Raihan - mauzapara name coming from existing_Mauzapara instead.\nCG: Added concept IDs for woman and husband unable to have children.\nKZ: 9/9\n1. Added photo capture of ID cards\n2. Added double entry of both IDs\n3. Added the which ID? screening question\n4. Changed the number of MWRAs in HH question to integer.\n5. Moved eligibility screening questions above ID questions, as in Census.\nCG: Updated address mappings so address5 is mapped to HHID\nCG: Added id_type to choices sheet.\n15/9\nKZ: Added Bangla to id_type choices, What type of ID and Re-Type National ID.\nKZ: Made FWWOMANYID field hidden until we come to a final decision on how to do this image capture.\nKZ: Removed leading zero from the '01' on the labels in HH Inhabitant number question.\nNN: Updated the constraint of 'How many member....' from \"regex(., '^(?!0{2})[0-9]{2}$')\" to \" .< 31 or .=99\"\nNN: Updated the 'relevant' logic of NID/BRID questions. added 'selected' logic\nKH: 16/9\n1. Added datatype / leading zeroes question as comment for FWNHHMBRNUM\n2. Changed constraint for FWNHHMBRNUM to exclude 0 as option\n3. Added \"Respondent Age\" concept UID to FWWOMAGE for data collection/analysis.\n4. Added \"Meets eligibility criteria for clinical trial or study\" concept UID to FWELIGIBLE to match FD form\nNN: 22/9\n1. Added entity:concept for FWELIGIBLE\n---\nKZ: 27/9\n1. Changed HHNUMB to text, still need to update the constraint to match with text.\nNN: 28/9\nUpdated the constraint of 'How many member....' from \".< 3 1 or .=99\" to \"regex(., '^(?!0{2})[0-9]{2}$')\"\nKZ (28/9):\n1. Change NUMMWRA to select one with yesno responses. Removed hints and constraints\n2. Updated hints and constraints for HH INhabitants to include leading zeros\nNN (8/10):\nAdd DoB, Gender questions before 'eligible' group\nMade FWNHHMBRNUM and FWNHHMWRA required field\nUpdated the constraing of 'how many member....' --> (regex(., '^(?!0{2})[0-9]{2}$') and .<31) or .=99\nUpdated the logic of Age (should not accept less than 12 years\nUpdated the hint/constraint message with english numeric input e.g 13 instead of ১৩\nCG (15/10):\nAdd ELCO count calculation; strike-through MWRA calculation\nNN (18/10): \nRemoved the Strikethrough fields.\nAdded two hidden variables for developers use- user_type and external_user_ID" - } - }, - { - "instance": { - "openmrs_entity_id": "location_id", - "openmrs_entity": "encounter" - }, - "type": "hidden", - "name": "existing_location" - }, - { - "type": "hidden", - "name": "existing_Country" - }, - { - "type": "hidden", - "name": "existing_Division" - }, - { - "type": "hidden", - "name": "existing_District" - }, - { - "type": "hidden", - "name": "existing_Upazilla" - }, - { - "type": "hidden", - "name": "existing_Union" - }, - { - "type": "hidden", - "name": "existing_Ward" - }, - { - "type": "hidden", - "name": "existing_Subunit" - }, - { - "type": "hidden", - "name": "existing_Mauzapara" - }, - { - "instance": { - "openmrs_entity_id": "encounter_date", - "openmrs_entity": "encounter" - }, - "type": "today", - "name": "today" - }, - { - "instance": { - "openmrs_entity_id": "encounter_start", - "openmrs_entity": "encounter" - }, - "type": "start", - "name": "start" - }, - { - "instance": { - "openmrs_entity_id": "encounter_end", - "openmrs_entity": "encounter" - }, - "type": "end", - "name": "end" - }, - { - "name": "FWNHREGDATE", - "hint": { - "Bengali": "আজকের তারিখ দিন", - "English": "Please enter today's date." - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "আজকের তারিখের পরের কোন তারিখ\nহতে পারবে না", - "English": "Date cannot be greater than current date." - }, - "required": "yes", - "constraint": ".<=${today}" - }, - "label": { - "Bengali": "সাক্ষাৎকারের তারিখ", - "English": "Date of Interview" - }, - "instance": { - "openmrs_entity_id": "160753AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "date" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWGOBHHID", - "hint": { - "Bengali": "কালো কালিতে লেখা সরকারী খানা নম্বর (HHID) যেভাবে ঘরের দেয়াল বা দরজায় দেওয়া আছে সেভাবেই ইনপুট দিন।\nসরকারী খানা নম্বর (HHID) পাওয়া না গেলে ৯৯৯৯ ইনপুট দিন", - "English": "Please input the Black – painted Government household ID (HHID) as displayed on the door/wall of the HH. If there is no Government HHID, enter 9999." - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "অনুগ্রহ করে ০০০১ থেকে ৯৯৯৯ এর মধ্যে ৪ ডিজিটের GoB HHID টাইপ করুন", - "English": "Please enter 4 digits of GoB HHID from 0001 to 9999" - }, - "required": "yes", - "constraint": "regex(., '^(?!0{4})[0-9]{4}$')" - }, - "label": { - "Bengali": "GoB HHID", - "English": "GoB HHID" - }, - "instance": { - "openmrs_entity_id": "GoB_HHID", - "openmrs_entity": "person_attribute" - }, - "type": "text" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWJIVHHID", - "hint": { - "Bengali": "লাল কালিতে দেয়া জীবিতা খানা নম্বর (HHID) যেভাবে দেয়ালে বা দরজায় দেওয়া আছে সেভাবেই ইনপুট দিন ।\nজীবিতা খানা নম্বর (HHID) পাওয়া না গেলে ৯৯৯৯ ইনপুট দিন", - "English": "Please input the RED – painted JiVitA / Study household ID (HHID) as displayed on the door/wall of the HH. Enter 9999 if JiVitA HHID is not found." - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "অনুগ্রহ করে ০০০১ থেকে ৯৯৯৯ এর মধ্যে ৪ ডিজিটের JiVitA HHID টাইপ করুন", - "English": "Please enter 4 digits of JiVitA HHID from 0001 to 9999" - }, - "required": "yes", - "constraint": "regex(., '^(?!0{4})[0-9]{4}$')" - }, - "label": { - "Bengali": "JiVitA HHID", - "English": "JiVitA HHID" - }, - "instance": { - "openmrs_entity_id": "JiVitA_HHID", - "openmrs_entity": "person_attribute" - }, - "type": "text" - }, - { - "bind": { - "calculate": "${existing_Country}" - }, - "type": "calculate", - "name": "FWCOUNTRY", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "country", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Division}" - }, - "type": "calculate", - "name": "FWDIVISION", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "stateProvince", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_District}" - }, - "type": "calculate", - "name": "FWDISTRICT", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "countyDistrict", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Upazilla}" - }, - "type": "calculate", - "name": "FWUPAZILLA", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "cityVillage", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Union}" - }, - "type": "calculate", - "name": "FWUNION", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address1", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Ward}" - }, - "type": "calculate", - "name": "FWWARD", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address2", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Subunit}" - }, - "type": "calculate", - "name": "FWSUBUNIT", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address3", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Mauzapara}" - }, - "type": "calculate", - "name": "FWMAUZA_PARA", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address4", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${FWGOBHHID}" - }, - "type": "calculate", - "name": "FWGOB_HHID", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address5", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "required": "yes" - }, - "type": "geopoint", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "geopoint", - "openmrs_entity_parent": "usual_residence" - }, - "name": "FWNHHHGPS", - "label": { - "Bengali": "জি পি এস", - "English": "Collect GPS Location of HH" - } - }, - { - "bind": { - "required": "yes" - }, - "type": "text", - "instance": { - "openmrs_entity_id": "first_name", - "openmrs_entity": "person" - }, - "name": "FWHOHFNAME", - "label": { - "Bengali": "খানা প্রধানের নাম-", - "English": "Head of Household Name" - } - }, - { - "bind": { - "calculate": "\".\"" - }, - "type": "calculate", - "name": "FWHOHLNAME", - "instance": { - "openmrs_entity_id": "last_name", - "openmrs_entity": "person" - } - }, - { - "bind": { - "calculate": "\"1900-01-01\"" - }, - "type": "calculate", - "name": "FWHOHBIRTHDATE", - "instance": { - "openmrs_entity_id": "birthdate", - "openmrs_entity": "person" - } - }, - { - "name": "FWHOHGENDER", - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "খানা প্রধানের লিঙ্গ", - "English": "Head of Household Gender" - }, - "instance": { - "openmrs_entity_id": "gender", - "openmrs_entity": "person" - }, - "type": "select one", - "children": [ - { - "name": "1", - "label": { - "Bengali": "ছেলে", - "English": "Male" - } - }, - { - "name": "2", - "label": { - "Bengali": "মেয়ে", - "English": "Female" - } - } - ] - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWNHHMBRNUM", - "hint": { - "Bengali": "খানার সদস্য সংখ্যা লিখতে 01-29 লিখুন । 30 বা তার বেশী হলে 30 লিখুন। খানার সদস্যের সংখ্যা জানা না থাকলে 99 লিখুন ।", - "English": "Enter 01-29 for the number of household members. Enter 30 if 30 or more. Enter 99 if the total number is unknown." - }, - "bind": { - "jr:constraintMsg": { - "Bengali": "খানার সদস্য সংখ্যাকে দুই ডিজিট হিসেবে এন্ট্রি করতে হবে। খানার সদস্য সংখ্যা লিখতে 01- 29 লিখুন । খানার সদস্যের সংখ্যা 30 বা তার বেশি হলে 30 লিখুন। খানার সদস্যের সংখ্যা জানা না থাকলে 99 লিখুন ।", - "English": "Number should be entered as two digits. Enter 01-29 for the number of household members. Enter 30 if there are 30 or more household members. Enter 99 if the total number is unknown." - }, - "required": "yes", - "constraint": "(regex(., '^(?!0{2})[0-9]{2}$') and .<31) or .=99" - }, - "label": { - "Bengali": "এই খানায় বর্তমানে কতজন মানুষ বসবাস করছে?", - "English": "How many people are currently living in this household?" - }, - "instance": { - "openmrs_entity_id": "5611AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "text" - }, - { - "name": "FWNHHMWRA", - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "এই খানায় কি ১৫ থেকে ৪৯ বছর বয়সের কোন বিবাহিত মহিলা আছেন?", - "English": "Are there any married women between the ages of 15 - 49 live in this household?" - }, - "instance": { - "openmrs_entity_id": "1901AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - } - }, - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - } - }, - { - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "9", - "label": { - "Bengali": "জানি না", - "English": "Don't know" - } - } - ] - }, - { - "name": "woman", - "hint": { - "Bengali": "আমরা এখন মহিলাকে নিবন্ধন করব। তাকে জাতীয় পরিচয়পত্র এবং জন্ম নিবন্ধন সনদপত্র নিয়ে আসতে অনুরোধ করুন।", - "English": "We will now register the woman. Please ask her to bring her National ID Card and Birth Certificate." - }, - "bind": { - "relevant": "${FWNHHMWRA}='1'" - }, - "label": { - "Bengali": "মহিলার তথ্যঃ", - "English": "New Woman Registration" - }, - "instance": { - "openmrs_entity_id": "New Woman Registration", - "openmrs_entity": "person" - }, - "type": "repeat", - "children": [ - { - "bind": { - "calculate": "${FWGOBHHID}" - }, - "type": "calculate", - "name": "GOBHHID", - "instance": { - "openmrs_entity_id": "GoB_HHID", - "openmrs_entity": "person_attribute" - } - }, - { - "bind": { - "calculate": "${FWJIVHHID}" - }, - "type": "calculate", - "name": "JiVitAHHID", - "instance": { - "openmrs_entity_id": "JiVitA_HHID", - "openmrs_entity": "person_attribute" - } - }, - { - "bind": { - "calculate": "${FWNHREGDATE}" - }, - "type": "calculate", - "name": "REGDATE" - }, - { - "name": "FWWOMFNAME", - "hint": { - "Bengali": "মহিলার নাম টাইপ করুন", - "English": "Please type woman's name" - }, - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "মহিলার নাম-", - "English": "Woman Name" - }, - "instance": { - "openmrs_entity_id": "first_name", - "openmrs_entity": "person" - }, - "type": "text" - }, - { - "bind": { - "calculate": "\".\"" - }, - "type": "calculate", - "name": "FWWOMLNAME", - "instance": { - "openmrs_entity_id": "last_name", - "openmrs_entity": "person" - } - }, - { - "name": "FWBIRTHDATE", - "hint": { - "Bengali": "“যদি জন্মনিবন্ধন সনদপত্র থাকে তাহলে জন্মতারিখ সেখান থেকেই সংগ্রহ করুন। যদি জন্মতারিখ বলতে না পারে তাহলে মাসের ১৫ তারিখকে জন্মতারিখ হিসেবে বেছে নিন। যদি জন্মমাস বলতে না পারে তাহলে ৬ বা জুনকে মাস হিসেবে বেছে নিন এবং মহিলা যে বছরটিতে তার জন্ম বলবে সেটি এন্ট্রি করুন।”", - "English": "If birth certificate is available take date of birth from birth certificate. If date of birth is unknown choose 15 as the date of birth, if month is unknown choose 06 (June) as month of birth and enter the year of birth as mentioned by the woman." - }, - "default": "2000-01-02 00:00:00", - "bind": { - "jr:constraintMsg": { - "Bengali": "মহিলার বয়স অবশ্যই ১২ বছরের বেশী হবে", - "English": "Woman must be older than 12 years of age" - }, - "required": "yes", - "constraint": "((${FWBIRTHDATE})+4380) <= today()" - }, - "label": { - "Bengali": "মহিলার জন্ম তারিখ", - "English": "Woman's Date of Birth" - }, - "instance": { - "openmrs_entity_id": "birthdate", - "openmrs_entity": "person" - }, - "type": "date" - }, - { - "bind": { - "calculate": "\"female\"" - }, - "type": "calculate", - "name": "FWGENDER", - "instance": { - "openmrs_entity_id": "gender", - "openmrs_entity": "person" - } - }, - { - "bind": { - "calculate": "round(((${today} - ${FWBIRTHDATE}) div 365.25),0)" - }, - "type": "calculate", - "name": "FWWOMAGE", - "instance": { - "openmrs_entity_id": "1532AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - } - }, - { - "type": "note", - "name": "display_age", - "label": { - "Bengali": "মহিলার বয়স ${FWWOMAGE}", - "English": "The woman's age is ${FWWOMAGE}." - } - }, - { - "control": { - "appearance": "yes" - }, - "name": "FWNHWOMSTRMEN", - "label": { - "Bengali": "আপনার কি বর্তমানে মাসিক একেবারে উঠে গেছে বা আপনি কি বর্তমানে স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?", - "English": "Are you currently menopausal or sterilized?" - }, - "instance": { - "openmrs_entity_id": "163006AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - } - }, - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - } - }, - { - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "9", - "label": { - "Bengali": "জানি না", - "English": "Don't know" - } - } - ] - }, - { - "control": { - "appearance": "yes" - }, - "name": "FWNHWOMHUSLIV", - "bind": { - "relevant": "selected(${FWNHWOMSTRMEN}, '0') or selected(${FWNHWOMSTRMEN}, '9')" - }, - "label": { - "Bengali": "আপনি কি বর্তমানে আপনার স্বামীর সাথে বসবাস করছেন?", - "English": "Are you currently living with your husband?" - }, - "instance": { - "openmrs_entity_id": "162994AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - } - }, - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - } - }, - { - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "9", - "label": { - "Bengali": "জানি না", - "English": "Don't know" - } - } - ] - }, - { - "control": { - "appearance": "yes" - }, - "name": "FWNHWOMHUSALV", - "bind": { - "relevant": "selected(${FWNHWOMHUSLIV}, '0') or selected(${FWNHWOMHUSLIV}, '9')" - }, - "label": { - "Bengali": "আপনার স্বামী কি জীবিত আছেন?", - "English": "Is the husband alive?" - }, - "instance": { - "openmrs_entity_id": "5561AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - } - }, - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - } - } - ] - }, - { - "control": { - "appearance": "yes" - }, - "name": "FWNHWOMHUSSTR", - "bind": { - "relevant": "selected(${FWNHWOMHUSLIV}, '1') or (selected(${FWNHWOMHUSLIV}, '9') and selected(${FWNHWOMHUSALV}, '1'))" - }, - "label": { - "Bengali": "আপনার স্বামী কি স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?", - "English": "Is the husband sterilized?" - }, - "instance": { - "openmrs_entity_id": "162959AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "0", - "label": { - "Bengali": "না", - "English": "No" - } - }, - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "1", - "label": { - "Bengali": "হ্যাঁ", - "English": "Yes" - } - }, - { - "instance": { - "openmrs_code": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "9", - "label": { - "Bengali": "জানি না", - "English": "Don't know" - } - } - ] - }, - { - "bind": { - "calculate": "if(${FWNHWOMSTRMEN}='0' and ${FWNHWOMHUSLIV}='1' and ${FWNHWOMHUSSTR}='0','1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA','1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')" - }, - "type": "calculate", - "name": "FWELIGIBLE", - "instance": { - "openmrs_entity_id": "162699AAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - } - }, - { - "bind": { - "relevant": "${FWELIGIBLE}='1'" - }, - "type": "group", - "children": [ - { - "name": "FWWOMANYID", - "hint": { - "Bengali": "প্রযোজ্য সবগুলো উত্তর নির্বাচন করুন", - "English": "Select all that apply." - }, - "label": { - "Bengali": "নিচের কোন পরিচয় পত্রটি মহিলার কাছে আছে?", - "English": "Which of the following IDs does the woman have?" - }, - "instance": { - "openmrs_entity_id": "163087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select all that apply", - "children": [ - { - "instance": { - "openmrs_code": "163084AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "1", - "label": { - "Bengali": "জাতীয় পরিচয়পত্র নম্বর", - "English": "National ID Number" - } - }, - { - "instance": { - "openmrs_code": "163083AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "2", - "label": { - "Bengali": "জন্ম নিবন্ধন সনদপত্র নম্বর", - "English": "Birth Registration ID Number" - } - } - ] - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWWOMNID", - "hint": { - "Bengali": "জাতীয় পরিচয়পত্রে দেওয়া সরকারী নম্বর যেভাবে দেওয়া আছে সেভাবেই প্রবেশ করান", - "English": "Please input the Government ID as displayed on the national ID card" - }, - "bind": { - "relevant": "selected(${FWWOMANYID},'1')", - "jr:constraintMsg": { - "Bengali": "জাতীয় পরিচয়পত্র নং ১৩ অথবা ১৭ ডিজিটের হবে", - "English": "National ID should be 13 or 17 digits" - }, - "required": "yes", - "constraint": "regex(., '^(?!0{13})[0-9]{13}$') or regex(., '^(?!0{17})[0-9]{17}$')" - }, - "label": { - "Bengali": "মহিলার জাতীয় পরিচয়পত্র নং-", - "English": "Woman's National ID Number" - }, - "type": "text" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWWOMRETYPENID", - "hint": { - "Bengali": "জাতীয় পরিচয়পত্রের নম্বরটি পুনরায় প্রবেশ করান", - "English": "Please re-input the National ID number" - }, - "bind": { - "relevant": "selected(${FWWOMANYID},'1')", - "jr:constraintMsg": { - "Bengali": "এই নম্বরটি ও পূর্বের স্ক্রিনে দেওয়া জন্ম নিবন্ধন নম্বরটি একই হতে হবে", - "English": "This number and the one in the previous screen should be same" - }, - "required": "yes", - "constraint": ".=${FWWOMNID}" - }, - "label": { - "Bengali": "মহিলার জাতীয় পরিচয়পত্র নম্বরটি পুনরায় লিখুন", - "English": "Re-Type Woman's National ID Number" - }, - "instance": { - "openmrs_entity_id": "NID", - "openmrs_entity": "person_identifier" - }, - "type": "text" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWWOMBID", - "hint": { - "Bengali": "জন্ম নিবন্ধন সনদপত্রের সরকারী নম্বর যেভাবে দেওয়া আছে সেভাবেই ইনপুট দিন।", - "English": "Please input the Government ID as displayed on the birth certificate" - }, - "bind": { - "relevant": "selected(${FWWOMANYID},'2')", - "jr:constraintMsg": { - "Bengali": "জন্ম নিবন্ধন সনদ নং ১৭ ডিজিটের হবে", - "English": "Birth Registration ID should be 17 digits" - }, - "required": "yes", - "constraint": "regex(., '^(?!0{17})[0-9]{17}$')" - }, - "label": { - "Bengali": "মহিলার জন্ম নিবন্ধন সনদ নং-", - "English": "Woman's Birth Registration ID" - }, - "type": "text" - }, - { - "control": { - "appearance": "numbers" - }, - "name": "FWWOMRETYPEBID", - "hint": { - "Bengali": "জন্ম নিবন্ধন নম্বরটি পূনরায় প্রবেশ করান", - "English": "Please re-input the Birth Registration Number" - }, - "bind": { - "relevant": "selected(${FWWOMANYID},'2')", - "jr:constraintMsg": { - "Bengali": "এই নম্বরটি ও পূর্বের স্ক্রিনে দেওয়া জন্ম নিবন্ধন নম্বরটি একই হতে হবে", - "English": "This number and the one in the previous screen should be same" - }, - "required": "yes", - "constraint": ".=${FWWOMBID}" - }, - "label": { - "Bengali": "মহিলার জন্ম নিবন্ধন সনদ নং-", - "English": "Woman's Birth Registration ID" - }, - "instance": { - "openmrs_entity_id": "Birth Registration ID", - "openmrs_entity": "person_identifier" - }, - "type": "text" - }, - { - "name": "FWHUSNAME", - "hint": { - "Bengali": "স্বামীর নাম টাইপ করুন", - "English": "Please type husband's name" - }, - "bind": { - "required": "yes" - }, - "label": { - "Bengali": "স্বামীর নাম-", - "English": "Husband's Name" - }, - "instance": { - "openmrs_entity_id": "161135AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "text" - }, - { - "bind": { - "calculate": "${existing_Country}" - }, - "type": "calculate", - "name": "FWWOMCOUNTRY", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "country", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Division}" - }, - "type": "calculate", - "name": "FWWOMDIVISION", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "stateProvince", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_District}" - }, - "type": "calculate", - "name": "FWWOMDISTRICT", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "countyDistrict", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Upazilla}" - }, - "type": "calculate", - "name": "FWWOMUPAZILLA", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "cityVillage", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Union}" - }, - "type": "calculate", - "name": "FWWOMUNION", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address1", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Ward}" - }, - "type": "calculate", - "name": "FWWOMWARD", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address2", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Subunit}" - }, - "type": "calculate", - "name": "FWWOMSUBUNIT", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address3", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${existing_Mauzapara}" - }, - "type": "calculate", - "name": "FWWOMMAUZA_PARA", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address4", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${FWGOBHHID}" - }, - "type": "calculate", - "name": "FWWOMGOBHHID", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "address5", - "openmrs_entity_parent": "usual_residence" - } - }, - { - "bind": { - "calculate": "${FWNHHHGPS}" - }, - "type": "calculate", - "name": "FWWOMGPS", - "instance": { - "openmrs_entity": "person_address", - "openmrs_entity_id": "geopoint", - "openmrs_entity_parent": "usual_residence" - } - } - ], - "name": "eligible" - }, - { - "type": "note", - "name": "add_women", - "label": { - "Bengali": "নির্দেশনাঃ এই খানায় যদি আরও কোন মহিলা থাকে যাকে রেজিস্ট্রেশন করা হয়নি, তাহলে '+' এ ক্লিক করুন এবং একই প্রক্রিয়ায় পরবর্তী মহিলাকে রেজিস্ট্রেশন করুন", - "English": "If there are any additional unregistered women in this household, select the '+' to add them now." - } - } - ] - }, - { - "bind": { - "calculate": "sum(${FWELIGIBLE})" - }, - "type": "calculate", - "name": "ELCO" - }, - { - "default": "FWA", - "type": "hidden", - "name": "user_type" - }, - { - "type": "hidden", - "name": "external_user_ID" - }, - { - "control": { - "bodyless": true - }, - "type": "group", - "children": [ - { - "bind": { - "readonly": "true()", - "calculate": "concat('uuid:', uuid())" - }, - "type": "calculate", - "name": "instanceID" - } - ], - "name": "meta" - } - ] -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/new_household_registration_with_grouped_subform_data/form.xml b/opensrp-form/src/test/resources/form/new_household_registration_with_grouped_subform_data/form.xml deleted file mode 100755 index bda24f905a..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration_with_grouped_subform_data/form.xml +++ /dev/null @@ -1,31 +0,0 @@ - -
-

নতুন খানা নিবন্ধন ফর্ম

- - - - - - - -
খানা প্রধানের লিঙ্গHead of Household Gender* -
- -
এই খানায় কি ১৫ থেকে ৪৯ বছর বয়সের কোন বিবাহিত মহিলা আছেন?Are there any married women between the ages of 15 - 49 live in this household?* -
-

মহিলার তথ্যঃNew Woman Registration

আপনার কি বর্তমানে মাসিক একেবারে উঠে গেছে বা আপনি কি বর্তমানে স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?Are you currently menopausal or sterilized? -
আপনি কি বর্তমানে আপনার স্বামীর সাথে বসবাস করছেন?Are you currently living with your husband? -
আপনার স্বামী কি জীবিত আছেন?Is the husband alive? -
আপনার স্বামী কি স্থায়ী জন্মনিয়ন্ত্রন পদ্ধতি গ্রহণ করেছেন?Is the husband sterilized? -
নিচের কোন পরিচয় পত্রটি মহিলার কাছে আছে?Which of the following IDs does the woman have?প্রযোজ্য সবগুলো উত্তর নির্বাচন করুনSelect all that apply. -
-
-
-
- -
XML to HTML transformation for form took 0.05 secondsThis validation is yet not functional.
diff --git a/opensrp-form/src/test/resources/form/new_household_registration_with_grouped_subform_data/form_definition.json b/opensrp-form/src/test/resources/form/new_household_registration_with_grouped_subform_data/form_definition.json deleted file mode 100755 index 916bdf7aa8..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration_with_grouped_subform_data/form_definition.json +++ /dev/null @@ -1,290 +0,0 @@ -{ - "form_data_definition_version": "13", - "form": { - "default_bind_path": "/model/instance/FWNewHH", - "bind_type": "household", - "fields": [ - { - "name": "id", - "shouldLoadValue": true - }, - { - "name": "location_name", - "bind": "/model/instance/FWNewHH/existing_Mauzapara" - }, - { - "name": "existing_location", - "bind": "/model/instance/FWNewHH/existing_location" - }, - { - "name": "existing_Country", - "bind": "/model/instance/FWNewHH/existing_Country" - }, - { - "name": "existing_Division", - "bind": "/model/instance/FWNewHH/existing_Division" - }, - { - "name": "existing_District", - "bind": "/model/instance/FWNewHH/existing_District" - }, - { - "name": "existing_Upazilla", - "bind": "/model/instance/FWNewHH/existing_Upazilla" - }, - { - "name": "existing_Union", - "bind": "/model/instance/FWNewHH/existing_Union" - }, - { - "name": "existing_Ward", - "bind": "/model/instance/FWNewHH/existing_Ward" - }, - { - "name": "existing_Subunit", - "bind": "/model/instance/FWNewHH/existing_Subunit" - }, - { - "name": "existing_Mauzapara", - "bind": "/model/instance/FWNewHH/existing_Mauzapara" - }, - { - "name": "today", - "bind": "/model/instance/FWNewHH/today" - }, - { - "name": "start", - "bind": "/model/instance/FWNewHH/start" - }, - { - "name": "end", - "bind": "/model/instance/FWNewHH/end" - }, - { - "name": "FWNHREGDATE", - "bind": "/model/instance/FWNewHH/FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "bind": "/model/instance/FWNewHH/FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "bind": "/model/instance/FWNewHH/FWJIVHHID" - }, - { - "name": "FWCOUNTRY", - "bind": "/model/instance/FWNewHH/FWCOUNTRY" - }, - { - "name": "FWDIVISION", - "bind": "/model/instance/FWNewHH/FWDIVISION" - }, - { - "name": "FWDISTRICT", - "bind": "/model/instance/FWNewHH/FWDISTRICT" - }, - { - "name": "FWUPAZILLA", - "bind": "/model/instance/FWNewHH/FWUPAZILLA" - }, - { - "name": "FWUNION", - "bind": "/model/instance/FWNewHH/FWUNION" - }, - { - "name": "FWWARD", - "bind": "/model/instance/FWNewHH/FWWARD" - }, - { - "name": "FWSUBUNIT", - "bind": "/model/instance/FWNewHH/FWSUBUNIT" - }, - { - "name": "FWMAUZA_PARA", - "bind": "/model/instance/FWNewHH/FWMAUZA_PARA" - }, - { - "name": "FWNHHHGPS", - "bind": "/model/instance/FWNewHH/FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "bind": "/model/instance/FWNewHH/FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "bind": "/model/instance/FWNewHH/FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "bind": "/model/instance/FWNewHH/FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "bind": "/model/instance/FWNewHH/FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "bind": "/model/instance/FWNewHH/FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "bind": "/model/instance/FWNewHH/FWNHHMWRA" - }, - { - "name": "join_names", - "bind": "/model/instance/FWNewHH/join_names" - }, - { - "name": "ELCO", - "bind": "/model/instance/FWNewHH/ELCO" - }, - { - "name": "user_type", - "bind": "/model/instance/FWNewHH/user_type" - }, - { - "name": "external_user_ID", - "bind": "/model/instance/FWNewHH/external_user_ID" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "shouldLoadValue": true - }, - { - "name": "relationalid", - "shouldLoadValue": true - }, - { - "name": "WomanREGDATE", - "bind": "/model/instance/FWNewHH/woman/REGDATE" - }, - { - "name": "GOBHHID", - "bind": "/model/instance/FWNewHH/woman/GOBHHID" - }, - { - "name": "JiVitAHHID", - "bind": "/model/instance/FWNewHH/woman/JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "bind": "/model/instance/FWNewHH/woman/FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "bind": "/model/instance/FWNewHH/woman/FWWOMLNAME" - }, - { - "name": "FWBIRTHDATE", - "bind": "/model/instance/FWNewHH/woman/FWBIRTHDATE" - }, - { - "name": "FWGENDER", - "bind": "/model/instance/FWNewHH/woman/FWGENDER" - }, - { - "name": "FWWOMAGE", - "bind": "/model/instance/FWNewHH/woman/FWWOMAGE" - }, - { - "name": "display_age", - "bind": "/model/instance/FWNewHH/woman/display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "bind": "/model/instance/FWNewHH/woman/FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "bind": "/model/instance/FWNewHH/woman/FWELIGIBLE" - }, - { - "name": "FWWOMANYID", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMANYID" - }, - { - "name": "FWWOMNID", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMNID" - }, - { - "name": "FWWOMRETYPENID", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMRETYPENID" - }, - { - "name": "FWWOMBID", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMBID" - }, - { - "name": "FWWOMRETYPEBID", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMRETYPEBID" - }, - { - "name": "FWHUSNAME", - "bind": "/model/instance/FWNewHH/woman/eligible/FWHUSNAME" - }, - { - "name": "FWWOMCOUNTRY", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMCOUNTRY" - }, - { - "name": "FWWOMDIVISION", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMDIVISION" - }, - { - "name": "FWWOMDISTRICT", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMDISTRICT" - }, - { - "name": "FWWOMUPAZILLA", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMUPAZILLA" - }, - { - "name": "FWWOMUNION", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMUNION" - }, - { - "name": "FWWOMWARD", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMWARD" - }, - { - "name": "FWWOMSUBUNIT", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMSUBUNIT" - }, - { - "name": "FWWOMMAUZA_PARA", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMMAUZA_PARA" - }, - { - "name": "FWWOMGOBHHID", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMGOBHHID" - }, - { - "name": "FWWOMGPS", - "bind": "/model/instance/FWNewHH/woman/eligible/FWWOMGPS" - } - ] - } - ] - } -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/new_household_registration_with_grouped_subform_data/form_submission1.json b/opensrp-form/src/test/resources/form/new_household_registration_with_grouped_subform_data/form_submission1.json deleted file mode 100755 index 75775ca8cd..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration_with_grouped_subform_data/form_submission1.json +++ /dev/null @@ -1,363 +0,0 @@ -{ - "id": "5ec11f03071ef0929839079530028992", - "_rev": "2-ddf675dd499e017538671b94843aeefc", - "type": "FormSubmission", - "anmId": "opensrp", - "instanceId": "d304dbr7-3998-434f-8c5b-55d6f5fa4252", - "formName": "new_household_registration_with_grouped_subform_data", - "entityId": "4237d267-d438-49f2-7822-8968t555447c", - "clientVersion": 1444562091545, - "formDataDefinitionVersion": "12", - "formInstance": { - "form_data_definition_version": "12", - "form": { - "bind_type": "household", - "default_bind_path": "/model/instance/FWNewHH", - "fields": [ - { - "name": "id", - "value": "4237d267-d438-49f2-7822-8968t555447c", - "source": "household.id" - }, - { - "name": "location_name", - "value": "DASLIA-_ALL_PARAS", - "source": "household.location_name" - }, - { - "name": "existing_location", - "value": "2fc43738-ace5-g961-8e8f-ab7dg0e5bc63", - "source": "household.existing_location" - }, - { - "name": "existing_Country", - "value": "Bangladesh", - "source": "household.existing_Country" - }, - { - "name": "existing_Division", - "value": "RANGPUR", - "source": "household.existing_Division" - }, - { - "name": "existing_District", - "value": "GAIBANDHA", - "source": "household.existing_District" - }, - { - "name": "existing_Upazilla", - "value": "SADULLAPUR", - "source": "household.existing_Upazilla" - }, - { - "name": "existing_Union", - "value": "NALDANGA", - "source": "household.existing_Union" - }, - { - "name": "existing_Ward", - "value": "Ward-3", - "source": "household.existing_Ward" - }, - { - "name": "existing_Subunit", - "value": "3-KHA", - "source": "household.existing_Subunit" - }, - { - "name": "existing_Mauzapara", - "value": "DASLIA+-+ALL+PARAS", - "source": "household.existing_Mauzapara" - }, - { - "name": "today", - "value": "2015-10-11", - "source": "household.today" - }, - { - "name": "start", - "value": "2015-10-11T17:12:34.000+06:00", - "source": "household.start" - }, - { - "name": "end", - "value": "2015-10-11T17:12:34.000+06:00", - "source": "household.end" - }, - { - "name": "FWNHREGDATE", - "value": "2015-10-11", - "source": "household.FWNHREGDATE" - }, - { - "name": "FWGOBHHID", - "value": "2322", - "source": "household.FWGOBHHID" - }, - { - "name": "FWJIVHHID", - "value": "9889", - "source": "household.FWJIVHHID" - }, - { - "name": "FWCOUNTRY", - "value": "Bangladesh", - "source": "household.FWCOUNTRY" - }, - { - "name": "FWDIVISION", - "value": "RANGPUR", - "source": "household.FWDIVISION" - }, - { - "name": "FWDISTRICT", - "value": "GAIBANDHA", - "source": "household.FWDISTRICT" - }, - { - "name": "FWUPAZILLA", - "value": "SADULLAPUR", - "source": "household.FWUPAZILLA" - }, - { - "name": "FWUNION", - "value": "NALDANGA", - "source": "household.FWUNION" - }, - { - "name": "FWWARD", - "value": "Ward-3", - "source": "household.FWWARD" - }, - { - "name": "FWSUBUNIT", - "value": "3-KHA", - "source": "household.FWSUBUNIT" - }, - { - "name": "FWMAUZA_PARA", - "value": "DASLIA+-+ALL+PARAS", - "source": "household.FWMAUZA_PARA" - }, - { - "name": "FWNHHHGPS", - "value": "23.8002 90.4068 0 10", - "source": "household.FWNHHHGPS" - }, - { - "name": "FWHOHFNAME", - "value": "mango", - "source": "household.FWHOHFNAME" - }, - { - "name": "FWHOHLNAME", - "value": ".", - "source": "household.FWHOHLNAME" - }, - { - "name": "FWHOHBIRTHDATE", - "value": "1900-01-01", - "source": "household.FWHOHBIRTHDATE" - }, - { - "name": "FWHOHGENDER", - "value": "2", - "source": "household.FWHOHGENDER" - }, - { - "name": "FWNHHMBRNUM", - "value": "23", - "source": "household.FWNHHMBRNUM" - }, - { - "name": "FWNHHMWRA", - "value": "1", - "source": "household.FWNHHMWRA" - }, - { - "name": "join_names", - "value": "hoby", - "source": "household.join_names" - }, - { - "name": "MWRA", - "value": "1", - "source": "household.MWRA" - } - ], - "sub_forms": [ - { - "name": "elco_registration", - "bind_type": "elco", - "default_bind_path": "/model/instance/FWNewHH/woman", - "fields": [ - { - "name": "id", - "source": "elco.id" - }, - { - "name": "relationalid", - "source": "elco.relationalid" - }, - { - "name": "WomanREGDATE", - "source": "elco.WomanREGDATE" - }, - { - "name": "GOBHHID", - "source": "elco.GOBHHID" - }, - { - "name": "JiVitAHHID", - "source": "elco.JiVitAHHID" - }, - { - "name": "FWWOMFNAME", - "source": "elco.FWWOMFNAME" - }, - { - "name": "FWWOMLNAME", - "source": "elco.FWWOMLNAME" - }, - { - "name": "FWBIRTHDATE", - "source": "elco.FWBIRTHDATE" - }, - { - "name": "FWGENDER", - "source": "elco.FWGENDER" - }, - { - "name": "FWWOMAGE", - "source": "elco.FWWOMAGE" - }, - { - "name": "display_age", - "source": "elco.display_age" - }, - { - "name": "FWNHWOMSTRMEN", - "source": "elco.FWNHWOMSTRMEN" - }, - { - "name": "FWNHWOMHUSALV", - "source": "elco.FWNHWOMHUSALV" - }, - { - "name": "FWNHWOMHUSLIV", - "source": "elco.FWNHWOMHUSLIV" - }, - { - "name": "FWNHWOMHUSSTR", - "source": "elco.FWNHWOMHUSSTR" - }, - { - "name": "FWELIGIBLE", - "source": "elco.FWELIGIBLE" - }, - { - "name": "FWWOMANYID", - "source": "elco.FWWOMANYID" - }, - { - "name": "FWWOMNID", - "source": "elco.FWWOMNID" - }, - { - "name": "FWWOMRETYPENID", - "source": "elco.FWWOMRETYPENID" - }, - { - "name": "FWWOMBID", - "source": "elco.FWWOMBID" - }, - { - "name": "FWWOMRETYPEBID", - "source": "elco.FWWOMRETYPEBID" - }, - { - "name": "FWHUSNAME", - "source": "elco.FWHUSNAME" - }, - { - "name": "FWWOMCOUNTRY", - "source": "elco.FWWOMCOUNTRY" - }, - { - "name": "FWWOMDIVISION", - "source": "elco.FWWOMDIVISION" - }, - { - "name": "FWWOMDISTRICT", - "source": "elco.FWWOMDISTRICT" - }, - { - "name": "FWWOMUPAZILLA", - "source": "elco.FWWOMUPAZILLA" - }, - { - "name": "FWWOMUNION", - "source": "elco.FWWOMUNION" - }, - { - "name": "FWWOMWARD", - "source": "elco.FWWOMWARD" - }, - { - "name": "FWWOMSUBUNIT", - "source": "elco.FWWOMSUBUNIT" - }, - { - "name": "FWWOMMAUZA_PARA", - "source": "elco.FWWOMMAUZA_PARA" - }, - { - "name": "FWWOMGOBHHID", - "source": "elco.FWWOMGOBHHID" - }, - { - "name": "FWWOMGPS", - "source": "elco.FWWOMGPS" - } - ], - "instances": [ - { - "GOBHHID": "2322", - "JiVitAHHID": "9889", - "WomanREGDATE": "2015-10-11", - "FWWOMFNAME": "jackfruit", - "FWWOMLNAME": ".", - "FWBIRTHDATE": "1988-10-08", - "FWGENDER": "female", - "FWWOMAGE": "27", - "display_age": "", - "FWNHWOMSTRMEN": "0", - "FWNHWOMHUSLIV": "1", - "FWNHWOMHUSALV": "", - "FWNHWOMHUSSTR": "0", - "FWELIGIBLE": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "FWWOMANYID": "1 2", - "FWWOMNID": "7675788777775", - "FWWOMRETYPENID": "7675788777775", - "FWWOMBID": "98899998888888888", - "FWWOMRETYPEBID": "98899998888888888", - "FWHUSNAME": "zoom", - "FWWOMCOUNTRY": "Bangladesh", - "FWWOMDIVISION": "RANGPUR", - "FWWOMDISTRICT": "GAIBANDHA", - "FWWOMUPAZILLA": "SADULLAPUR", - "FWWOMUNION": "NALDANGA", - "FWWOMWARD": "Ward-3", - "FWWOMSUBUNIT": "3-KHA", - "FWWOMMAUZA_PARA": "DASLIA+-+ALL+PARAS", - "FWWOMGOBHHID": "2322", - "FWWOMGPS": "23.8002 90.4068 0 10", - "id": "ce71572a-8oc5-u32f-9d3b-4a6b568d5g77" - } - ] - } - ] - } - }, - "serverVersion": 1444734863350 -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/new_household_registration_with_grouped_subform_data/model.xml b/opensrp-form/src/test/resources/form/new_household_registration_with_grouped_subform_data/model.xml deleted file mode 100755 index 49e8d05084..0000000000 --- a/opensrp-form/src/test/resources/form/new_household_registration_with_grouped_subform_data/model.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2000-01-02 00:00:00 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FWA - - - - - - - \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/pnc_1st_registration/form.json b/opensrp-form/src/test/resources/form/pnc_1st_registration/form.json deleted file mode 100755 index ac61605e10..0000000000 --- a/opensrp-form/src/test/resources/form/pnc_1st_registration/form.json +++ /dev/null @@ -1,373 +0,0 @@ -{ - "name": "pnc_first_registration_motherdetails", - "title": "PNC Registration", - "sms_keyword": "pnc_1st_registration", - "default_language": "default", - "instance": { - "encounter_type": "PNC Registration" - }, - "version": "201504011203", - "id_string": "pnc_1st_registration", - "type": "survey", - "children": [ - { - "instance": { - "openmrs_entity_id": "location_id", - "openmrs_entity": "encounter" - }, - "type": "text", - "name": "location", - "label": "Location" - }, - { - "instance": { - "openmrs_entity_id": "encounter_date", - "openmrs_entity": "encounter" - }, - "type": "today", - "name": "today" - }, - { - "instance": { - "openmrs_entity_id": "encounter_start", - "openmrs_entity": "encounter" - }, - "type": "start", - "name": "start" - }, - { - "instance": { - "openmrs_entity_id": "encounter_end", - "openmrs_entity": "encounter" - }, - "type": "end", - "name": "end" - }, - { - "instance": { - "openmrs_entity_id": "OpenSRPID", - "openmrs_entity": "person_identifier" - }, - "type": "integer", - "name": "mother_id", - "label": "Mother ID number:" - }, - { - "name": "gender", - "bind": { - "required": "yes" - }, - "label": "Gender? ಮಗುವಿನ ಲಿಂಗ?", - "instance": { - "openmrs_entity_id": "gender", - "openmrs_entity": "person" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1534AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "male", - "label": "Male ಗಂಡು" - }, - { - "instance": { - "openmrs_code": "1535AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "female", - "label": "Female ಹೆಣ್ಣು" - } - ] - }, - { - "instance": { - "openmrs_entity_id": "birthdate", - "openmrs_entity": "person" - }, - "type": "date", - "name": "mother_birthdate", - "label": "Mother's DOB?" - }, - { - "instance": { - "openmrs_entity_id": "first_name", - "openmrs_entity": "person" - }, - "type": "text", - "name": "mother_first_name", - "label": "Mother's first name?" - }, - { - "instance": { - "openmrs_entity_id": "last_name", - "openmrs_entity": "person" - }, - "type": "text", - "name": "mother_last_name", - "label": "Mother's last name?" - }, - { - "bind": { - "required": "yes", - "constraint": ".<=${today}" - }, - "type": "date", - "instance": { - "openmrs_entity_id": "5599AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "name": "delivery_date", - "label": "Delivery date? ಹೆರಿಗೆ ದಿನಾಂಕ?" - }, - { - "instance": { - "openmrs_entity_id": "162724AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "text", - "name": "delivery_facility_name", - "label": "Name of delivery facility? ಹೆರಿಗೆಯಾದ ಸ್ಥಳದ ಹೆಸರು?" - }, - { - "name": "delivery_skilled", - "bind": { - "required": "yes" - }, - "label": "Delivery attended by SBA? ತರಬೇತಿ ಹೊಂದಿದ ಹೆರಿಗೆ ಸಹಾಯಕರು ಹೆರಿಗೆಯಲ್ಲಿ ಹಾಜರಿದ್ದರೆ?", - "instance": { - "openmrs_entity_id": "160083AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "yes", - "label": "Yes ಹೌದು" - }, - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "no", - "label": "No ಇಲ್ಲ" - } - ] - }, - { - "instance": { - "openmrs_entity_id": "5630AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "label": "Type of delivery? ಯಾವ ವಿಧದ ಹೆರಿಗೆ?", - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1170AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "normal", - "label": "Normal ಸಾಮಾನ್ಯ" - }, - { - "instance": { - "openmrs_code": "1171AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "cesarean", - "label": "Cesarean ಸಿಸೇರಿಯನ್" - }, - { - "instance": { - "openmrs_code": "118159AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "instrumental_forcep", - "label": "Instrumental / Forcep ಉಪಕರಣಗಳಿಂದ ಮಾಡುವ ಹೆರಿಗೆ" - } - ], - "name": "delivery_type" - }, - { - "name": "delivery_outcome", - "bind": { - "required": "yes" - }, - "label": "Delivery outcome? ಹೆರಿಗೆ ಫಲಿತಾಂಶವೇನು?", - "instance": { - "openmrs_entity_id": "159917AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "151849AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "live_birth", - "label": "Live Birth ಜೀವಂತ ಜನನ" - }, - { - "instance": { - "openmrs_code": "125872AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "still_birth", - "label": "Still Birth ನಿರ್ಜೀವ ಜನನ" - } - ] - }, - { - "instance": { - "openmrs_entity_id": "1053AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "int", - "name": "parity", - "label": "Parity" - }, - { - "bind": { - "relevant": "${delivery_outcome} = 'live_birth'" - }, - "type": "int", - "instance": { - "openmrs_entity_id": "160601AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "name": "num_livebirths", - "label": "Live births" - }, - { - "bind": { - "relevant": "${delivery_outcome} = 'still_birth'" - }, - "type": "int", - "instance": { - "openmrs_entity_id": "160077AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "name": "num_stillbirths", - "label": "Still births" - }, - { - "instance": { - "openmrs_entity_id": "1576AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "label": "What delivery complications were there? ಯಾವ ಹೆರಿಗೆ ತೊಂದರೆಗಳು ಉಂಟಾದವು?", - "type": "select all that apply", - "children": [ - { - "instance": { - "openmrs_code": "230AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "hemorrhage", - "label": "Hemorrhage ರಕ್ತಸ್ರಾವ" - }, - { - "instance": { - "openmrs_code": "114127AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "placenta_previa", - "label": "Placenta previa ಹಿಂದಿನ ಗರ್ಭದಲ್ಲಿ ಮಾಸು ಮುಂದಿರುವುದು" - }, - { - "instance": { - "openmrs_code": "128420AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "cord_prolapse", - "label": "Cord prolapse ಬಳ್ಳಿಯ ಸರಿತ" - }, - { - "instance": { - "openmrs_code": "115036AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "prolonged_labor", - "label": "Prolonged / obstructed labor ದೀರ್ಘಕಾಲೀನ / ಅಡಚಣೆಯನ್ನು ತಂದೊಡ್ಡುವ ಹೆರಿಗೆ ನೋವು" - }, - { - "instance": { - "openmrs_code": "1172AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "abnormal_presentation", - "label": "Abnormal presentation ಅಪಸಾಮಾನ್ಯ ಪ್ರಸ್ತುತಿ" - }, - { - "instance": { - "openmrs_code": "126886AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "perineal_tear_2nd_degree", - "label": "Perineal tear (2 degree)" - }, - { - "instance": { - "openmrs_code": "124857AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "perineal_tear_3rd_degree", - "label": "Perineal tear (3 degree)" - }, - { - "instance": { - "openmrs_code": "39911AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "perineal_tear_4th_degree", - "label": "Perineal tear (4 degree)" - }, - { - "instance": { - "openmrs_code": "120222AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "others", - "label": "Others ಇತರೆ" - } - ], - "name": "complications" - }, - { - "name": "woman_survived", - "bind": { - "required": "yes" - }, - "label": "Woman survived childbirth? ಮಗುವಿನ ಜನನದ ನಂತರ ಮಹಿಳೆ ಬದುಕುಳಿದರೆ?", - "instance": { - "openmrs_entity_id": "134612AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", - "openmrs_entity": "concept" - }, - "type": "select one", - "children": [ - { - "instance": { - "openmrs_code": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "yes", - "label": "Yes ಹೌದು" - }, - { - "instance": { - "openmrs_code": "1066AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" - }, - "name": "no", - "label": "No ಇಲ್ಲ" - } - ] - }, - { - "control": { - "bodyless": true - }, - "type": "group", - "children": [ - { - "bind": { - "readonly": "true()", - "calculate": "concat('uuid:', uuid())" - }, - "type": "calculate", - "name": "instanceID" - } - ], - "name": "meta" - } - ] -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/pnc_1st_registration/form.xml b/opensrp-form/src/test/resources/form/pnc_1st_registration/form.xml deleted file mode 100755 index d9501c2e3c..0000000000 --- a/opensrp-form/src/test/resources/form/pnc_1st_registration/form.xml +++ /dev/null @@ -1,29 +0,0 @@ - -
-

PNC Registration

- - - - -
Gender? ಮಗುವಿನ ಲಿಂಗ?* -
- - - - - -
Delivery attended by SBA? ತರಬೇತಿ ಹೊಂದಿದ ಹೆರಿಗೆ ಸಹಾಯಕರು ಹೆರಿಗೆಯಲ್ಲಿ ಹಾಜರಿದ್ದರೆ?* -
-
Type of delivery? ಯಾವ ವಿಧದ ಹೆರಿಗೆ? -
-
Delivery outcome? ಹೆರಿಗೆ ಫಲಿತಾಂಶವೇನು?* -
- - - -
What delivery complications were there? ಯಾವ ಹೆರಿಗೆ ತೊಂದರೆಗಳು ಉಂಟಾದವು? -
-
Woman survived childbirth? ಮಗುವಿನ ಜನನದ ನಂತರ ಮಹಿಳೆ ಬದುಕುಳಿದರೆ?* -
- -
XML to HTML transformation for form took 0.03 secondsThis validation is yet not functional.
diff --git a/opensrp-form/src/test/resources/form/pnc_1st_registration/form_definition.json b/opensrp-form/src/test/resources/form/pnc_1st_registration/form_definition.json deleted file mode 100755 index f715275a86..0000000000 --- a/opensrp-form/src/test/resources/form/pnc_1st_registration/form_definition.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "form_data_definition_version": "1", - "form": { - "default_bind_path": "/model/instance/pnc_first_registration_motherdetails", - "bind_type": "demo_mother", - "fields": [ - { - "name":"id", - "shouldLoadValue": true - }, - { - "name": "location", - "bind": "/model/instance/pnc_first_registration_motherdetails/location" - }, - { - "name": "today", - "bind": "/model/instance/pnc_first_registration_motherdetails/today" - }, - { - "name": "start", - "bind": "/model/instance/pnc_first_registration_motherdetails/start" - }, - { - "name": "end", - "bind": "/model/instance/pnc_first_registration_motherdetails/end" - }, - { - "name": "mother_id", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_id" - }, - { - "name": "gender", - "bind": "/model/instance/pnc_first_registration_motherdetails/gender" - }, - { - "name": "mother_birthdate", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_birthdate" - }, - { - "name": "mother_first_name", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_first_name" - }, - { - "name": "mother_last_name", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_last_name" - }, - { - "name": "delivery_date", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_date" - }, - { - "name": "delivery_facility_name", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_facility_name" - }, - { - "name": "delivery_skilled", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_skilled" - }, - { - "name": "delivery_type", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_type" - }, - { - "name": "delivery_outcome", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_outcome" - }, - { - "name": "parity", - "bind": "/model/instance/pnc_first_registration_motherdetails/parity" - }, - { - "name": "num_livebirths", - "bind": "/model/instance/pnc_first_registration_motherdetails/num_livebirths" - }, - { - "name": "num_stillbirths", - "bind": "/model/instance/pnc_first_registration_motherdetails/num_stillbirths" - }, - { - "name": "complications", - "bind": "/model/instance/pnc_first_registration_motherdetails/complications" - }, - { - "name": "woman_survived", - "bind": "/model/instance/pnc_first_registration_motherdetails/woman_survived" - } - ] - } -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/pnc_1st_registration/form_submission.json b/opensrp-form/src/test/resources/form/pnc_1st_registration/form_submission.json deleted file mode 100755 index 7cdcb1c63b..0000000000 --- a/opensrp-form/src/test/resources/form/pnc_1st_registration/form_submission.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "anmId": "admin", - "clientVersion": "1426830449320", - "entityId": "b716d938-1aea-40ae-a081-9ddddddcccc9", - "formDataDefinitionVersion": "5", - "formName": "pnc_1st_registration", - "formInstance": { - "form_data_definition_version": "1", - "form": { - "default_bind_path": "/model/instance/pnc_first_registration_motherdetails", - "bind_type": "demo_mother", - "fields": [ - { - "name": "id", - "shouldLoadValue": true, - "source": "demo_mother.id", - "value": "aec8e1a5-ab11-47ac-8bc0-ff1e7146e342" - }, - { - "name": "location", - "bind": "/model/instance/pnc_first_registration_motherdetails/location", - "source": "demo_mother.location", - "value": "testloc" - }, - { - "name": "today", - "bind": "/model/instance/pnc_first_registration_motherdetails/today", - "source": "demo_mother.today", - "value": "2015-04-02" - }, - { - "name": "start", - "bind": "/model/instance/pnc_first_registration_motherdetails/start", - "source": "demo_mother.start", - "value": "2015-04-02T04:49:16.000-00:00" - }, - { - "name": "end", - "bind": "/model/instance/pnc_first_registration_motherdetails/end", - "source": "demo_mother.end", - "value": "2015-04-02T04:49:16.000-00:00" - }, - { - "name": "mother_id", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_id", - "source": "demo_mother.mother_id", - "value": "234" - }, - { - "name": "gender", - "bind": "/model/instance/pnc_first_registration_motherdetails/gender", - "source": "demo_mother.gender", - "value": "male" - }, - { - "name": "mother_birthdate", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_birthdate", - "source": "demo_mother.mother_birthdate", - "value": "1989-01-31" - }, - { - "name": "mother_first_name", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_first_name", - "source": "demo_mother.mother_first_name", - "value": "jamila" - }, - { - "name": "mother_last_name", - "bind": "/model/instance/pnc_first_registration_motherdetails/mother_last_name", - "source": "demo_mother.mother_last_name", - "value": "rashid" - }, - { - "name": "delivery_date", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_date", - "source": "demo_mother.delivery_date", - "value": "2015-04-01" - }, - { - "name": "delivery_facility_name", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_facility_name", - "source": "demo_mother.delivery_facility_name", - "value": "moghbazar health center" - }, - { - "name": "delivery_skilled", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_skilled", - "source": "demo_mother.delivery_skilled", - "value": "yes" - }, - { - "name": "delivery_type", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_type", - "source": "demo_mother.delivery_type", - "value": "normal" - }, - { - "name": "delivery_outcome", - "bind": "/model/instance/pnc_first_registration_motherdetails/delivery_outcome", - "source": "demo_mother.delivery_outcome", - "value": "live_birth" - }, - { - "name": "parity", - "bind": "/model/instance/pnc_first_registration_motherdetails/parity", - "source": "demo_mother.parity", - "value": "1" - }, - { - "name": "num_livebirths", - "bind": "/model/instance/pnc_first_registration_motherdetails/num_livebirths", - "source": "demo_mother.num_livebirths", - "value": "1" - }, - { - "name": "num_stillbirths", - "bind": "/model/instance/pnc_first_registration_motherdetails/num_stillbirths", - "source": "demo_mother.num_stillbirths" - }, - { - "name": "complications", - "bind": "/model/instance/pnc_first_registration_motherdetails/complications", - "source": "demo_mother.complications", - "value": "hemorrhage" - }, - { - "name": "woman_survived", - "bind": "/model/instance/pnc_first_registration_motherdetails/woman_survived", - "source": "demo_mother.woman_survived", - "value": "yes" - } - ] - } - } -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/pnc_1st_registration/model.xml b/opensrp-form/src/test/resources/form/pnc_1st_registration/model.xml deleted file mode 100755 index 02529770ad..0000000000 --- a/opensrp-form/src/test/resources/form/pnc_1st_registration/model.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/repeatform/form.json b/opensrp-form/src/test/resources/form/repeatform/form.json deleted file mode 100755 index 5fd76f37d0..0000000000 --- a/opensrp-form/src/test/resources/form/repeatform/form.json +++ /dev/null @@ -1,1381 +0,0 @@ -{ - "default_language": "default", - "id_string": "Delivery_Outcome_EngKan", - "children": [ - { - "name": "today", - "type": "today" - }, - { - "name": "case_lmp", - "instance": { - "openmrs_entity_id": "1100282", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "delivery_date", - "bind": { - "required": "yes", - "constraint": ".<=${today}" - }, - "label": "Delivery date? ಹೆರಿಗೆ ದಿನಾಂಕ?", - "instance": { - "openmrs_entity_id": "2129182", - "openmrs_entity": "concept" - }, - "type": "date" - }, - { - "name": "delivery_reg_date", - "bind": { - "required": "yes", - "constraint": ".<=${today} and .>= ${delivery_date}" - }, - "label": "PNC registration date? ಬಾಣಂತಿ ದಾಖಲಾತಿ ದಿನಾಂಕ?", - "instance": { - "openmrs_entity_id": "encounter_date", - "openmrs_entity": "encounter" - }, - "type": "date" - }, - { - "children": [ - { - "name": "home", - "label": "Home ಮನೆ", - "instance": { - "openmrs_code": "32323213" - } - }, - { - "name": "subcenter", - "label": "Sub Center ಉಪ ಕೇಂದ್ರ", - "instance": { - "openmrs_code": "2321321" - } - }, - { - "name": "phc", - "label": "PHC ಪ್ರಾಥಮಿಕ ಆರೋಗ್ಯ ಕೇಂದ್ರ", - "instance": { - "openmrs_code": "323213" - } - }, - { - "name": "chc", - "label": "CHC ಸಮುದಾಯ ಆರೋಗ್ಯ ಕೇಂದ್ರ", - "instance": { - "openmrs_code": "1213213" - } - }, - { - "name": "sdh", - "label": "SDH ಉಪ ಜಿಲ್ಲಾ ಆಸ್ಪತ್ರೆ", - "instance": { - "openmrs_code": "23123" - } - }, - { - "name": "dh", - "label": "DH ಜಿಲ್ಲಾ ಆಸ್ಪತ್ರೆ", - "instance": { - "openmrs_code": "232113" - } - }, - { - "name": "private_facility", - "label": "Private ಖಾಸಗಿ", - "instance": { - "openmrs_code": "123123" - } - } - ], - "name": "place_delivery", - "bind": { - "required": "yes" - }, - "label": "Place of delivery? ಹೆರಿಗೆಯಾದ ಸ್ಥಳ?", - "instance": { - "openmrs_entity_id": "location_id", - "openmrs_entity": "encounter" - }, - "type": "select one" - }, - { - "name": "name_delivery_facility", - "bind": { - "relevant": "${place_delivery} != 'home'" - }, - "label": "Name of delivery place? ಹೆರಿಗೆಯಾದ ಸ್ಥಳದ ಹೆಸರು?", - "instance": { - "openmrs_entity_id": "4787232", - "openmrs_entity": "concept" - }, - "type": "text" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "only_delivery_facility", - "label": "Is this the only place woman went for delivery? ಹೆರಿಗೆಗೆ ಇದೊಂದೆ ಸ್ಥಳಕ್ಕೆ ಹೋಗಿದ್ದರೆ?", - "instance": { - "openmrs_entity_id": "120009", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "home", - "label": "Home ಮನೆ", - "instance": { - "openmrs_code": "32323213" - } - }, - { - "name": "subcenter", - "label": "Sub Center ಉಪ ಕೇಂದ್ರ", - "instance": { - "openmrs_code": "2321321" - } - }, - { - "name": "phc", - "label": "PHC ಪ್ರಾಥಮಿಕ ಆರೋಗ್ಯ ಕೇಂದ್ರ", - "instance": { - "openmrs_code": "323213" - } - }, - { - "name": "chc", - "label": "CHC ಸಮುದಾಯ ಆರೋಗ್ಯ ಕೇಂದ್ರ", - "instance": { - "openmrs_code": "1213213" - } - }, - { - "name": "sdh", - "label": "SDH ಉಪ ಜಿಲ್ಲಾ ಆಸ್ಪತ್ರೆ", - "instance": { - "openmrs_code": "23123" - } - }, - { - "name": "dh", - "label": "DH ಜಿಲ್ಲಾ ಆಸ್ಪತ್ರೆ", - "instance": { - "openmrs_code": "232113" - } - }, - { - "name": "private_facility", - "label": "Private ಖಾಸಗಿ", - "instance": { - "openmrs_code": "123123" - } - } - ], - "name": "addl_delivery_facility", - "bind": { - "relevant": "${only_delivery_facility} = 'no'" - }, - "label": "Where else did she go for delivery? ಹೆರಿಗೆಗೆ ಇನ್ಯಾವ ಸ್ಥಳಕ್ಕೆ ಹೋಗಿದ್ದರೆ?", - "instance": { - "openmrs_entity_id": "124433", - "openmrs_entity": "concept" - }, - "type": "select all that apply" - }, - { - "children": [ - { - "name": "no_staff", - "label": "No staff available for delivery ಹೆರಿಗೆಗೆ ಸಿಬ್ಬಂಧಿಯು ಲಭ್ಯವಿಲ್ಲ", - "instance": { - "openmrs_code": "4123" - } - }, - { - "name": "referred_higher_facility", - "label": "Referred to higher facility ಹೆಚ್ಚಿನ ಸೌಲಭ್ಯಕ್ಕೆ ರೆಫರ್ ಮಾಡಲಾಗಿದೆ", - "instance": { - "openmrs_code": "21312312" - } - }, - { - "name": "lack_of_supplies", - "label": "Lack of supplies ಸರಬರಾಜು ಕೊರತೆ", - "instance": { - "openmrs_code": "134134" - } - }, - { - "name": "no_electricity", - "label": "No electricity ವಿದ್ಯುತ್ ಇಲ್ಲ", - "instance": { - "openmrs_code": "34134134" - } - }, - { - "name": "family_insisted_elsewhere", - "label": "Family insisted on going elsewhere ಕುಟುಂಬಕ್ಕೆ ಬೇರೇಡೆಗೆ ಹೋಗಲು ಒತ್ತಾಯಿಸಿದರು", - "instance": { - "openmrs_code": "341341" - } - }, - { - "name": "no_money", - "label": "Not enough money ಸಾಕಷ್ಟು ಹಣವಿಲ್ಲ", - "instance": { - "openmrs_code": "43434432" - } - }, - { - "name": "others", - "label": "Others ಇತರೆ", - "instance": { - "openmrs_code": "323243224" - } - } - ], - "name": "reasons_addl_delivery_facility", - "bind": { - "relevant": "${only_delivery_facility} = 'no'" - }, - "label": "Select the reasons why more than one place. ಬೇರೆ ಸ್ಥಳಕ್ಕೆ ಹೋಗಿದ್ದಕ್ಕೆ ಕಾರಣವನ್ನು ಆಯ್ಕೆ ಮಾಡಿ.", - "instance": { - "openmrs_entity_id": "100933", - "openmrs_entity": "concept" - }, - "type": "select all that apply" - }, - { - "name": "other_reasons_addl_delivery_facility", - "bind": { - "relevant": "selected(${reasons_addl_delivery_facility}, 'others')" - }, - "label": "Others ಇತರೆ:", - "instance": { - "openmrs_entity_id": "2323233", - "openmrs_entity": "concept" - }, - "type": "text" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "skilled_delivery", - "bind": { - "relevant": "${place_delivery} = 'home'", - "required": "yes" - }, - "label": "Delivery attended by SBA? ತರಬೇತಿ ಹೊಂದಿದ ಹೆರಿಗೆ ಸಹಾಯಕರು ಹೆರಿಗೆಯಲ್ಲಿ ಹಾಜರಿದ್ದರೆ?", - "instance": { - "openmrs_entity_id": "3231212", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "normal", - "label": "Normal ಸಾಮಾನ್ಯ", - "instance": { - "openmrs_code": "43123" - } - }, - { - "name": "cesarean", - "label": "Cesarean ಸಿಸೇರಿಯನ್", - "instance": { - "openmrs_code": "3232" - } - }, - { - "name": "instrumental_forcep", - "label": "Instrumental / Forcep ಉಪಕರಣಗಳಿಂದ ಮಾಡುವ ಹೆರಿಗೆ", - "instance": { - "openmrs_code": "4134123" - } - } - ], - "name": "type_delivery", - "label": "Type of delivery? ಯಾವ ವಿಧದ ಹೆರಿಗೆ?", - "instance": { - "openmrs_entity_id": "120009", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "live_birth", - "label": "Live Birth ಜೀವಂತ ಜನನ", - "instance": { - "openmrs_code": "38493849" - } - }, - { - "name": "still_birth", - "label": "Still Birth ನಿರ್ಜೀವ ಜನನ", - "instance": { - "openmrs_code": "343434" - } - } - ], - "name": "delivery_outcome", - "bind": { - "required": "yes" - }, - "label": "Delivery outcome? ಹೆರಿಗೆ ಫಲಿತಾಂಶವೇನು?", - "instance": { - "openmrs_entity_id": "124433", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "name": "case_parity", - "instance": { - "openmrs_entity_id": "100933", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "parity", - "bind": { - "calculate": "${case_parity} + 1" - }, - "instance": { - "openmrs_entity_id": "434343", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "case_num_livebirths", - "instance": { - "openmrs_entity_id": "34324234", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "num_livebirths", - "bind": { - "relevant": "${delivery_outcome} = 'live_birth'", - "calculate": "${case_num_livebirths} + 1" - }, - "instance": { - "openmrs_entity_id": "3423423", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "youngestchild_date_of_birth", - "bind": { - "relevant": "${delivery_outcome} = 'live_birth'", - "calculate": "${delivery_date}" - }, - "instance": { - "openmrs_entity_id": "120009", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "youngestchild_age", - "bind": { - "calculate": "int((${today} - ${youngestchild_date_of_birth}) div 30)" - }, - "instance": { - "openmrs_entity_id": "124433", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "case_num_stillbirths", - "instance": { - "openmrs_entity_id": "100933", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "num_stillbirths", - "bind": { - "relevant": "${delivery_outcome} = 'still_birth'", - "calculate": "${case_num_stillbirths} + 1" - }, - "instance": { - "openmrs_entity_id": "3432434", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "children": [ - { - "children": [ - { - "name": "infection_during_preg", - "label": "Infection during pregnancy ಗರ್ಭಾವಸ್ಥೆಯಲ್ಲಿ ಸೋಂಕು", - "instance": { - "openmrs_code": "2323" - } - }, - { - "name": "gest_hypertension", - "label": "Gestational hypertension ಗರ್ಭಾಧಾರಣೆಯಲ್ಲಿನ ಅಧಿಕ ರಕ್ತದೊತ್ತಡ", - "instance": { - "openmrs_code": "2323" - } - }, - { - "name": "gest_diabetes", - "label": "Gestational diabetes ಗರ್ಭಾಧಾರಣೆಯಲ್ಲಿನ ಸಕ್ಕರೆ ಕಾಯಿಲೆ", - "instance": { - "openmrs_code": "23213" - } - }, - { - "name": "fetal_growth_restriction", - "label": "Fetal growth restriction ಭ್ರೂಣದ ಬೆಳವಣಿಗೆಯಲ್ಲಿ ನಿರ್ಬಂಧ", - "instance": { - "openmrs_code": "23123" - } - }, - { - "name": "birth_defects", - "label": "Birth defects ಜನ್ಮ ನ್ಯೂನ್ಯತೆಗಳು", - "instance": { - "openmrs_code": "23213" - } - }, - { - "name": "unknown", - "label": "Cause not identified ಕಾರಣವನ್ನು ಗುರುತಿಸಲ್ಪಟ್ಟಿಲ್ಲ", - "instance": { - "openmrs_code": "2323" - } - }, - { - "name": "others", - "label": "Others ಇತರೆ", - "instance": { - "openmrs_code": "23213" - } - } - ], - "name": "cause_of_still_birth", - "label": "Cause of still birth? ನಿರ್ಜೀವ ಜನನದ ಕಾರಣಗಳು?", - "instance": { - "openmrs_entity_parent": "65435", - "openmrs_entity_id": "4323232", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "woman_survived", - "bind": { - "required": "yes" - }, - "label": "Woman survived childbirth? ಮಗುವಿನ ಜನನದ ನಂತರ ಮಹಿಳೆ ಬದುಕುಳಿದರೆ?", - "instance": { - "openmrs_entity_parent": "65435", - "openmrs_entity_id": "100009", - "openmrs_entity": "concept" - }, - "type": "select one" - } - ], - "name": "still_birth_group", - "bind": { - "relevant": "${delivery_outcome} = 'still_birth'" - }, - "instance": { - "openmrs_entity_id": "65435", - "openmrs_entity": "concept" - }, - "type": "group" - }, - { - "children": [ - { - "children": [ - { - "children": [ - { - "name": "male", - "label": "Male ಗಂಡು", - "instance": { - "openmrs_code": "21321" - } - }, - { - "name": "female", - "label": "Female ಹೆಣ್ಣು", - "instance": { - "openmrs_code": "312312" - } - } - ], - "name": "sex_child", - "bind": { - "required": "yes" - }, - "label": "Sex of child? ಮಗುವಿನ ಲಿಂಗ?", - "instance": { - "openmrs_entity_id": "gender", - "openmrs_entity": "patient" - }, - "type": "select one" - }, - { - "name": "sex_child_female", - "bind": { - "calculate": "if(${sex_child} = 'female', 1, 0)" - }, - "type": "calculate" - }, - { - "name": "sex_child_male", - "bind": { - "calculate": "if(${sex_child} = 'male', 1, 0)" - }, - "type": "calculate" - }, - { - "name": "birthweight", - "label": "Child birthweight (in kgs)? ಹುಟ್ಟಿದ ಮಗುವಿನ ತೂಕ (ಕೆ.ಜಿ. ಗಳಲ್ಲಿ)?", - "instance": { - "openmrs_entity_id": "323232", - "openmrs_entity": "concept" - }, - "type": "decimal" - }, - { - "control": { - "appearance": "minimal" - }, - "children": [ - { - "name": "a_positive", - "label": "A+", - "instance": { - "openmrs_code": "34324" - } - }, - { - "name": "a_negative", - "label": "A-", - "instance": { - "openmrs_code": "34134" - } - }, - { - "name": "b_positive", - "label": "B+", - "instance": { - "openmrs_code": "1321312" - } - }, - { - "name": "b_negative", - "label": "B-", - "instance": { - "openmrs_code": "43434" - } - }, - { - "name": "ab_positive", - "label": "AB+", - "instance": { - "openmrs_code": "12323214" - } - }, - { - "name": "ab_negative", - "label": "AB-", - "instance": { - "openmrs_code": "11343141" - } - }, - { - "name": "o_positive", - "label": "O+", - "instance": { - "openmrs_code": "134343" - } - }, - { - "name": "o_negative", - "label": "O-", - "instance": { - "openmrs_code": "432434" - } - } - ], - "name": "child_blood_group", - "label": "Child blood group? ಮಗುವಿನ ರಕ್ತದ ಗುಂಪು?", - "instance": { - "openmrs_entity_id": "232112", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "bcg", - "label": "BCG ಬಿ.ಸಿ.ಜಿ", - "instance": { - "openmrs_code": "23123" - } - }, - { - "name": "opv_0", - "label": "OPV 0 ಒ.ಪಿ.ವಿ 0", - "instance": { - "openmrs_code": "12312" - } - }, - { - "name": "hepb_0", - "label": "Hep B 0 ಹೆಪಟೆಟಿಸ್ ಬಿ 0", - "instance": { - "openmrs_code": "213123" - } - } - ], - "name": "immunizations_atbirth", - "label": "Immunizations provided at birth? ಹುಟ್ಟಿದ ಮಗುವಿಗೆ ಇಮ್ಯುನೈಜೇಷನ್ ನೀಡಲಾಯಿತೆ?", - "instance": { - "openmrs_entity_id": "199277", - "openmrs_entity": "concept" - }, - "type": "select all that apply" - }, - { - "name": "case_hepb", - "instance": { - "openmrs_entity_id": "100285", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "hepb_prophylaxis_provided", - "bind": { - "relevant": "${case_hepb} != ''" - }, - "label": "Hep B prophylaxis provided? ಹೆಪಟೆಟಿಸ್ ಬಿ ರೋಗನಿರೋಧಕ ಚಿಕಿತ್ಸೆ ನೀಡಲಾಗಿದೆತೇ?", - "instance": { - "openmrs_entity_id": "3321323", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "name": "lbw", - "bind": { - "calculate": "if(${birthweight} >= 1.5 and ${birthweight} < 2.5, 'Low_Birth_Weight','')" - }, - "instance": { - "openmrs_entity_id": "1232132", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "vlbw", - "bind": { - "calculate": "if(${birthweight} < 1.5, 'Very_Low_Birth_Weight', '')" - }, - "instance": { - "openmrs_entity_id": "232133", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "num_preg_days", - "bind": { - "calculate": "int(date(${delivery_date}) - date(${case_lmp}))" - }, - "instance": { - "openmrs_entity_id": "232323", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "premature", - "bind": { - "calculate": "if(${num_preg_days} < 259, 'Premature', '')" - }, - "instance": { - "openmrs_entity_id": "232323", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "premature_message1", - "bind": { - "relevant": "${premature} != ''" - }, - "label": "Baby is premature! Advise kangaroo care and rooming in. ಅವಧಿಗೆ ಮುನ್ನ ಜನಿಸಿದ ಮಗು! ಕಾಂಗರೋ ಆರೈಕೆ ಮತ್ತು ಒಂದೇ ರೂಮಿನಲ್ಲಿಡುವಂತೆ ಸಲಹೆ ನೀಡಿ.", - "type": "note" - }, - { - "name": "is_child_high_risk1", - "bind": { - "calculate": "if(${premature} != '' or ${lbw} != '' or ${vlbw} != '', 'yes', 'no')" - }, - "instance": { - "openmrs_entity_id": "342343", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "child_high_risk_reasons", - "bind": { - "calculate": "concat(${premature}, ' ', ${lbw}, ' ', ${vlbw})" - }, - "instance": { - "openmrs_entity_id": "423434", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "high_risk_note_child", - "bind": { - "relevant": "${is_child_high_risk1} = 'yes'" - }, - "label": "Child is at risk because of, ಈಗ ಮಗು ಅಪಾಯದಲ್ಲಿದೆ ಏಕೆಂದರೆ: ${child_high_risk_reasons}", - "type": "note" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "is_child_high_risk", - "bind": { - "required": "yes" - }, - "label": "Do you want to mark child as HR (High Risk)? \nನೀವು ಮಗುವನ್ನು HR (ಹೆಚ್ಚು ಅಪಾಯವಿದೆ) ಎಂದು ಗುರುತಿಸಲು ಬಯಸುವಿರಾ?", - "instance": { - "openmrs_entity_id": "4342343", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "name": "addl_pnc_visit_message", - "bind": { - "relevant": "${is_child_high_risk1} = 'yes'" - }, - "label": "Child needs 3 more PNC visits on days 14, 21, and 28 because of, 14, 21 ಮತ್ತು 28 ನೇ ದಿನಗಳೊಂದು ಮಗುವಿಗೆ 3 ಹೆಚ್ಚಿನ ಭೇಟಿಯ ಅಗತ್ಯವಿದೆ, ಏಕೆಂದರೆ: ${child_high_risk_reasons}", - "type": "note" - } - ], - "name": "child", - "label": "Please enter birth information for each child born. ಜನನವಾದ ಪ್ರತಿ ಮಗುವಿನ ಜನ್ಮ ಮಾಹಿತಿಯನ್ನು ದಯವಿಟ್ಟು ನಮೂದಿಸಿ.", - "instance": { - "openmrs_entity_id": "100029", - "openmrs_entity": "concept" - }, - "type": "repeat" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "mother_survived", - "bind": { - "required": "yes" - }, - "label": "Mother survived childbirth? ಮಗುವಿನ ಜನನದ ನಂತರ ಮಹಿಳೆ ಬದುಕುಳಿದರೆ?", - "instance": { - "openmrs_entity_id": "343434", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "breastfeeding_postbirth", - "bind": { - "relevant": "${mother_survived} = 'yes'", - "required": "yes" - }, - "label": "Was breastfeeding started within 1 hour of birth? ಹುಟ್ಟಿದ ಒಂದು ಗಂಟೆಯ ಒಳಗೆ ಎದೆಹಾಲು ನೀಡಲಾಯಿತೆ?", - "instance": { - "openmrs_entity_id": "434343", - "openmrs_entity": "concept" - }, - "type": "select one" - } - ], - "name": "live_birth_group", - "bind": { - "relevant": "${delivery_outcome} = 'live_birth'" - }, - "type": "group" - }, - { - "name": "case_num_livingchildren", - "instance": { - "openmrs_entity_id": "434344", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "num_children_born", - "bind": { - "calculate": "if(${delivery_outcome} = 'still_birth', 0, count(${sex_child}))" - }, - "instance": { - "openmrs_entity_id": "43432", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "num_livingchildren", - "bind": { - "calculate": "${case_num_livingchildren} + ${num_children_born}" - }, - "instance": { - "openmrs_entity_id": "54541", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "case_numlivingchildren_female", - "instance": { - "openmrs_entity_id": "57467", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "num_female_children_born", - "bind": { - "calculate": "sum(${sex_child_female})" - }, - "instance": { - "openmrs_entity_id": "687832", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "numlivingchildren_female", - "bind": { - "calculate": "${case_numlivingchildren_female} + ${num_female_children_born}" - }, - "instance": { - "openmrs_entity_id": "098343", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "case_numlivingchildren_male", - "instance": { - "openmrs_entity_id": "98664", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "num_male_children_born", - "bind": { - "calculate": "sum(${sex_child_male})" - }, - "instance": { - "openmrs_entity_id": "4343656", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "numlivingchildren_male", - "bind": { - "calculate": "${case_numlivingchildren_male} + ${num_male_children_born}" - }, - "instance": { - "openmrs_entity_id": "342325", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "children": [ - { - "children": [ - { - "name": "prolonged_obstructed_labor", - "label": "Prolonged / obstructed labor ದೀರ್ಘಕಾಲೀನ / ಅಡಚಣೆಯನ್ನು ತಂದೊಡ್ಡುವ ಹೆರಿಗೆ ನೋವು", - "instance": { - "openmrs_code": "23123" - } - }, - { - "name": "hypertension_fits", - "label": "Severe hypertension / fits ತೀವ್ರತರವಾದ ಅಧಿಕ ರಕ್ತದೊತ್ತಡ / ಮೂರ್ಚೆರೋಗ", - "instance": { - "openmrs_code": "23213" - } - }, - { - "name": "bleeding_hemorrhage", - "label": "Bleeding / hemorrhage ರಕ್ತಸ್ರಾವ", - "instance": { - "openmrs_code": "23123" - } - }, - { - "name": "fever_infection", - "label": "High fever / infection ಅಧಿಕ ಜ್ವರ / ಸೊಂಕು", - "instance": { - "openmrs_code": "2323" - } - }, - { - "name": "cause_not_identified", - "label": "Cause not identified ಕಾರಣವನ್ನು ಗುರುತಿಸಲ್ಪಟ್ಟಿಲ್ಲ", - "instance": { - "openmrs_code": "23213" - } - }, - { - "name": "others", - "label": "Others ಇತರೆ", - "instance": { - "openmrs_code": "23213" - } - } - ], - "name": "maternal_death_cause", - "label": "Cause of maternal death? ತಾಯಿಯ ಮರಣಕ್ಕೆ ಕಾರಣಗಳು?", - "instance": { - "openmrs_entity_id": "43434", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "name": "other_maternal_death_cause", - "bind": { - "relevant": "${maternal_death_cause} = 'others'" - }, - "label": "Others ಇತರೆ:", - "instance": { - "openmrs_entity_id": "43221", - "openmrs_entity": "concept" - }, - "type": "text" - } - ], - "name": "maternal_death_group", - "bind": { - "relevant": "(${woman_survived} = 'no' or ${mother_survived} = 'no')" - }, - "type": "group" - }, - { - "children": [ - { - "name": "case_w_rh_negative", - "instance": { - "openmrs_entity_id": "4324234", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "rh_injection_given", - "bind": { - "relevant": "${case_w_rh_negative} != ''" - }, - "label": "Rh injection given to woman? ಮಹಿಳೆಗೆ Rh ಚುಚ್ಚುಮದ್ದು ನೀಡಲಾಯಿತೆ?", - "instance": { - "openmrs_entity_id": "32323", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "had_delivery_complications", - "label": "Were there delivery complications? ಹೆರಿಗೆಯಲ್ಲಿ ತೊಡಕುಂಟಾಯಿತೆ?", - "instance": { - "openmrs_entity_id": "233234", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "children": [ - { - "name": "hemorrhage", - "label": "Hemorrhage ರಕ್ತಸ್ರಾವ", - "instance": { - "openmrs_code": "4123213" - } - }, - { - "name": "placenta_previa", - "label": "Placenta previa ಹಿಂದಿನ ಗರ್ಭದಲ್ಲಿ ಮಾಸು ಮುಂದಿರುವುದು", - "instance": { - "openmrs_code": "2131413" - } - }, - { - "name": "cord_prolapse", - "label": "Cord prolapse ಬಳ್ಳಿಯ ಸರಿತ", - "instance": { - "openmrs_code": "4134123" - } - }, - { - "name": "prolonged_labor", - "label": "Prolonged / obstructed labor ದೀರ್ಘಕಾಲೀನ / ಅಡಚಣೆಯನ್ನು ತಂದೊಡ್ಡುವ ಹೆರಿಗೆ ನೋವು", - "instance": { - "openmrs_code": "213124123" - } - }, - { - "name": "abnormal_presentation", - "label": "Abnormal presentation ಅಪಸಾಮಾನ್ಯ ಪ್ರಸ್ತುತಿ", - "instance": { - "openmrs_code": "14123123" - } - }, - { - "name": "perineal_tear", - "label": "Perineal tear (2, 3, or 4 degree)", - "instance": { - "openmrs_code": "23123" - } - }, - { - "name": "others", - "label": "Others ಇತರೆ", - "instance": { - "openmrs_code": "32123" - } - } - ], - "name": "complications", - "bind": { - "relevant": "${had_delivery_complications} = 'yes'" - }, - "label": "What delivery complications were there? ಯಾವ ಹೆರಿಗೆ ತೊಂದರೆಗಳು ಉಂಟಾದವು?", - "instance": { - "openmrs_entity_id": "25343", - "openmrs_entity": "concept" - }, - "type": "select all that apply" - }, - { - "name": "delivery_complications_other", - "bind": { - "relevant": "selected(${complications}, 'others')" - }, - "label": "Others ಇತರೆ:", - "instance": { - "openmrs_entity_id": "2355435", - "openmrs_entity": "concept" - }, - "type": "text" - } - ], - "name": "woman_survived_group", - "bind": { - "relevant": "(${woman_survived} = 'yes' or ${mother_survived} = 'yes')" - }, - "type": "group" - }, - { - "name": "case_is_high_risk_till_pnc_close", - "instance": { - "openmrs_entity_id": "8768767", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "case_is_high_risk_till_pnc_close_reason", - "instance": { - "openmrs_entity_id": "676576", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "case_anaemic_status", - "instance": { - "openmrs_entity_id": "76767", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "case_pih", - "instance": { - "openmrs_entity_id": "36787", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "case_pre_eclampsia", - "instance": { - "openmrs_entity_id": "376784", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "case_jaundice", - "instance": { - "openmrs_entity_id": "343434", - "openmrs_entity": "concept" - }, - "type": "hidden" - }, - { - "name": "is_high_risk1", - "bind": { - "calculate": "if(${case_is_high_risk_till_pnc_close} = 'yes' or ${case_anaemic_status} != '' or ${case_pih} != '' or ${case_pre_eclampsia} != '' or ${case_jaundice} != '', 'yes', 'no')" - }, - "instance": { - "openmrs_entity_id": "4746767", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "high_risk_reason", - "bind": { - "calculate": "concat(${case_is_high_risk_till_pnc_close_reason}, ' ', ${case_anaemic_status}, ' ', ${case_pih}, ' ', ${case_pre_eclampsia}, ' ', ${case_jaundice})" - }, - "instance": { - "openmrs_entity_id": "5656", - "openmrs_entity": "concept" - }, - "type": "calculate" - }, - { - "name": "high_risk_note_mother", - "bind": { - "relevant": "${is_high_risk1} = 'yes'" - }, - "label": "Woman is still at risk because of, ಮಹಿಳೆಯು ಈಗಲೂ ಅಪಾಯದಲ್ಲಿದ್ದಾಳೆ ಏಕೆಂದರೆ: ${high_risk_reason}", - "type": "note" - }, - { - "children": [ - { - "name": "yes", - "label": "Yes ಹೌದು", - "instance": { - "openmrs_code": "1065" - } - }, - { - "name": "no", - "label": "No ಇಲ್ಲ", - "instance": { - "openmrs_code": "1066" - } - } - ], - "name": "is_high_risk", - "bind": { - "relevant": "(${woman_survived} = 'yes' or ${mother_survived} = 'yes')", - "required": "yes" - }, - "label": "Do you want to mark woman as HR (High Risk)?\nನೀವು ಮಹಿಳೆಯನ್ನು HR (ಹೆಚ್ಚು ಅಪಾಯವಿದೆ) ಎಂದು ಗುರುತಿಸಲು ಬಯಸುವಿರಾ?", - "instance": { - "openmrs_entity_id": "424253", - "openmrs_entity": "concept" - }, - "type": "select one" - }, - { - "control": { - "bodyless": true - }, - "children": [ - { - "name": "instanceID", - "bind": { - "readonly": "true()", - "calculate": "concat('uuid:', uuid())" - }, - "type": "calculate" - } - ], - "name": "meta", - "type": "group" - } - ], - "instance": { - "encounter_type": "PNC Registration" - }, - "version": "201504300627", - "type": "survey", - "name": "PNC_Registration_EngKan", - "sms_keyword": "Delivery_Outcome_EngKan", - "title": "PNC Registration" -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/repeatform/form_definition.json b/opensrp-form/src/test/resources/form/repeatform/form_definition.json deleted file mode 100755 index c64ffdc42f..0000000000 --- a/opensrp-form/src/test/resources/form/repeatform/form_definition.json +++ /dev/null @@ -1,315 +0,0 @@ -{ - "form_data_definition_version": "5", - "form": { - "bind_type": "mother", - "default_bind_path": "/model/instance/PNC_Registration_EngKan/", - "fields": [ - { - "name": "id", - "shouldLoadValue": true - }, - { - "name": "ecId", - "shouldLoadValue": true, - "source": "mother.eligible_couple.id" - }, - { - "name": "referenceDate", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_lmp" - }, - { - "name": "referenceDate", - "bind": "/model/instance/PNC_Registration_EngKan/delivery_date" - }, - { - "name": "deliveryRegistrationDate", - "bind": "/model/instance/PNC_Registration_EngKan/delivery_reg_date" - }, - { - "name": "deliveryPlace", - "bind": "/model/instance/PNC_Registration_EngKan/place_delivery" - }, - { - "name": "deliveryFacilityName", - "bind": "/model/instance/PNC_Registration_EngKan/name_delivery_facility" - }, - { - "name": "isThisOnlyDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/only_delivery_facility" - }, - { - "name": "additionalDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/addl_delivery_facility" - }, - { - "name": "reasonsForAdditionalDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/reasons_addl_delivery_facility" - }, - { - "name": "otherReasonsForAdditionalDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/other_reasons_addl_delivery_facility" - }, - { - "name": "isSkilledDelivery", - "bind": "/model/instance/PNC_Registration_EngKan/skilled_delivery" - }, - { - "name": "deliveryType", - "bind": "/model/instance/PNC_Registration_EngKan/type_delivery" - }, - { - "name": "deliveryOutcome", - "bind": "/model/instance/PNC_Registration_EngKan/delivery_outcome" - }, - { - "name": "parity", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_parity", - "source": "mother.eligible_couple.parity" - }, - { - "name": "parity", - "bind": "/model/instance/PNC_Registration_EngKan/parity", - "source": "mother.eligible_couple.parity" - }, - { - "name": "numberOfLiveBirths", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_num_livebirths", - "source": "mother.eligible_couple.numberOfLiveBirths" - }, - { - "name": "numberOfLiveBirths", - "bind": "/model/instance/PNC_Registration_EngKan/num_livebirths", - "source": "mother.eligible_couple.numberOfLiveBirths" - }, - { - "name": "numberOfStillBirths", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_num_stillbirths", - "source": "mother.eligible_couple.numberOfStillBirths" - }, - { - "name": "numberOfStillBirths", - "bind": "/model/instance/PNC_Registration_EngKan/num_stillbirths", - "source": "mother.eligible_couple.numberOfStillBirths" - }, - { - "name": "causeOfStillBirth", - "bind": "/model/instance/PNC_Registration_EngKan/still_birth_group/cause_of_still_birth" - }, - { - "name": "didWomanSurvive", - "bind": "/model/instance/PNC_Registration_EngKan/still_birth_group/woman_survived" - }, - { - "name": "didMotherSurvive", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/mother_survived" - }, - { - "name": "didBreastfeedingStart", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/breastfeeding_postbirth" - }, - { - "name": "maternalDeathCause", - "bind": "/model/instance/PNC_Registration_EngKan/maternal_death_group/maternal_death_cause" - }, - { - "name": "otherMaternalDeathCause", - "bind": "/model/instance/PNC_Registration_EngKan/maternal_death_group/other_maternal_death_cause" - }, - { - "name": "isRHNegative", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/case_w_rh_negative" - }, - { - "name": "isRHInjectionGiven", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/rh_injection_given" - }, - { - "name": "hadDeliveryComplications", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/had_delivery_complications" - }, - { - "name": "deliveryComplications", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/complications" - }, - { - "name": "otherDeliveryComplications", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/delivery_complications_other" - }, - { - "name": "isHighRiskTillPNCClose", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_is_high_risk_till_pnc_close" - }, - { - "name": "highRiskTillPNCCloseReason", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_is_high_risk_till_pnc_close_reason" - }, - { - "name": "anemicStatus", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_anaemic_status" - }, - { - "name": "pih", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_pih" - }, - { - "name": "preEclampsia", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_pre_eclampsia" - }, - { - "name": "jaundice", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_jaundice" - }, - { - "name": "isHighRisk", - "bind": "/model/instance/PNC_Registration_EngKan/is_high_risk" - }, - { - "name": "isBirthPlanningDone", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_birth_planning" - }, - { - "name": "highRiskReason", - "bind": "/model/instance/PNC_Registration_EngKan/high_risk_reason" - }, - { - "name": "submissionDate", - "bind": "/model/instance/PNC_Registration_EngKan/today" - }, - { - "name": "type", - "value": "PNC", - "source": "mother.type" - }, - { - "name": "numberOfLivingChildren", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_num_livingchildren", - "source": "mother.eligible_couple.numberOfLivingChildren" - }, - { - "name": "numberOfLivingChildren", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/num_livingchildren", - "source": "mother.eligible_couple.numberOfLivingChildren" - }, - { - "name": "numberOfChildrenBorn", - "bind": "/model/instance/PNC_Registration_EngKan/num_children_born" - }, - { - "name": "numberOfFemaleChildrenBorn", - "bind": "/model/instance/PNC_Registration_EngKan/num_female_children_born" - }, - { - "name": "numberOfMaleChildrenBorn", - "bind": "/model/instance/PNC_Registration_EngKan/num_male_children_born" - }, - { - "name": "numberOfLivingFemaleChild", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_numlivingchildren_female", - "source": "mother.eligible_couple.numberOfLivingChildrenFemale" - }, - { - "name": "numberOfLivingFemaleChild", - "bind": "/model/instance/PNC_Registration_EngKan/numlivingchildren_female", - "source": "mother.eligible_couple.numberOfLivingChildrenFemale" - }, - { - "name": "numberOfLivingMaleChild", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_numlivingchildren_male", - "source": "mother.eligible_couple.numberOfLivingMaleChild" - }, - { - "name": "numberOfLivingMaleChild", - "bind": "/model/instance/PNC_Registration_EngKan/numlivingchildren_male", - "source": "mother.eligible_couple.numberOfLivingMaleChild" - }, - { - "name": "youngestChildDOB", - "bind": "/model/instance/PNC_Registration_EngKan/youngestchild_date_of_birth", - "source": "mother.eligible_couple.youngestChildDOB" - }, - { - "name": "youngestChildAge", - "bind": "/model/instance/PNC_Registration_EngKan/youngestchild_age", - "source": "mother.eligible_couple.youngestChildAge" - } - ], - "sub_forms": [ - { - "name": "child_registration", - "bind_type": "child", - "default_bind_path": "/model/instance/PNC_Registration_EngKan/live_birth_group/child", - "fields": [ - { - "name": "id", - "shouldLoadValue": true - }, - { - "name": "gender", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/sex_child" - }, - { - "name": "weight", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/birthweight" - }, - { - "name": "bloodGroup", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/child_blood_group" - }, - { - "name": "immunizationsGiven", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/immunizations_atbirth" - }, - { - "name": "hepB", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/case_hepb" - }, - { - "name": "isHepBProphylaxisProvided", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/hepb_prophylaxis_provided" - }, - { - "name": "isChildHighRisk1", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/is_child_high_risk1" - }, - { - "name": "childHighRiskReasons", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/child_high_risk_reasons" - }, - { - "name": "isChildHighRisk", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/is_child_high_risk" - }, - { - "name": "lbw", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/lbw" - }, - { - "name": "vlbw", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/vlbw" - }, - { - "name": "premature", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/premature" - } - ] - } - ] - } -} diff --git a/opensrp-form/src/test/resources/form/repeatform/form_submission.json b/opensrp-form/src/test/resources/form/repeatform/form_submission.json deleted file mode 100755 index b3b6f6de29..0000000000 --- a/opensrp-form/src/test/resources/form/repeatform/form_submission.json +++ /dev/null @@ -1,452 +0,0 @@ -{ - "anmId": "admin", - "instanceId": "f7974258-1aea-40ae-6676-9ddddddcccc9", - "clientVersion": "1426830449320", - "entityId": "b716d938-1aea-40ae-a081-9ddddddcccc9", - "formDataDefinitionVersion": "5", - "formName": "repeatform", - "formInstance": { - "form_data_definition_version": "5", - "form": { - "bind_type": "mother", - "default_bind_path": "/model/instance/PNC_Registration_EngKan/", - "fields": [ - { - "name": "id", - "shouldLoadValue": true, - "source": "mother.id", - "value": "7efb9e31-0e26-496e-bd16-e09a3b0d1a31" - }, - { - "name": "ecId", - "shouldLoadValue": true, - "source": "mother.eligible_couple.id", - "value": "aa786612-e7a8-4fea-b733-3de4d898f4d6" - }, - { - "name": "referenceDate", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_lmp", - "source": "mother.referenceDate", - "value": "2014-02-20" - }, - { - "name": "referenceDate", - "bind": "/model/instance/PNC_Registration_EngKan/delivery_date", - "source": "mother.referenceDate", - "value": "2015-02-20" - }, - { - "name": "deliveryRegistrationDate", - "bind": "/model/instance/PNC_Registration_EngKan/delivery_reg_date", - "source": "mother.deliveryRegistrationDate", - "value": "2015-03-20" - }, - { - "name": "deliveryPlace", - "bind": "/model/instance/PNC_Registration_EngKan/place_delivery", - "source": "mother.deliveryPlace", - "value": "home" - }, - { - "name": "deliveryFacilityName", - "bind": "/model/instance/PNC_Registration_EngKan/name_delivery_facility", - "source": "mother.deliveryFacilityName" - }, - { - "name": "isThisOnlyDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/only_delivery_facility", - "source": "mother.isThisOnlyDeliveryFacility", - "value": "yes" - }, - { - "name": "additionalDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/addl_delivery_facility", - "source": "mother.additionalDeliveryFacility" - }, - { - "name": "reasonsForAdditionalDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/reasons_addl_delivery_facility", - "source": "mother.reasonsForAdditionalDeliveryFacility" - }, - { - "name": "otherReasonsForAdditionalDeliveryFacility", - "bind": "/model/instance/PNC_Registration_EngKan/other_reasons_addl_delivery_facility", - "source": "mother.otherReasonsForAdditionalDeliveryFacility" - }, - { - "name": "isSkilledDelivery", - "bind": "/model/instance/PNC_Registration_EngKan/skilled_delivery", - "source": "mother.isSkilledDelivery", - "value": "yes" - }, - { - "name": "deliveryType", - "bind": "/model/instance/PNC_Registration_EngKan/type_delivery", - "source": "mother.deliveryType", - "value": "normal" - }, - { - "name": "deliveryOutcome", - "bind": "/model/instance/PNC_Registration_EngKan/delivery_outcome", - "source": "mother.deliveryOutcome", - "value": "live_birth" - }, - { - "name": "parity", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_parity", - "source": "mother.eligible_couple.parity", - "value": "0" - }, - { - "name": "parity", - "bind": "/model/instance/PNC_Registration_EngKan/parity", - "source": "mother.eligible_couple.parity", - "value": "1" - }, - { - "name": "numberOfLiveBirths", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_num_livebirths", - "source": "mother.eligible_couple.numberOfLiveBirths", - "value": "0" - }, - { - "name": "numberOfLiveBirths", - "bind": "/model/instance/PNC_Registration_EngKan/num_livebirths", - "source": "mother.eligible_couple.numberOfLiveBirths", - "value": "1" - }, - { - "name": "numberOfStillBirths", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_num_stillbirths", - "source": "mother.eligible_couple.numberOfStillBirths", - "value": "0" - }, - { - "name": "numberOfStillBirths", - "bind": "/model/instance/PNC_Registration_EngKan/num_stillbirths", - "source": "mother.eligible_couple.numberOfStillBirths" - }, - { - "name": "causeOfStillBirth", - "bind": "/model/instance/PNC_Registration_EngKan/still_birth_group/cause_of_still_birth", - "source": "mother.causeOfStillBirth" - }, - { - "name": "didWomanSurvive", - "bind": "/model/instance/PNC_Registration_EngKan/still_birth_group/woman_survived", - "source": "mother.didWomanSurvive" - }, - { - "name": "didMotherSurvive", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/mother_survived", - "source": "mother.didMotherSurvive", - "value": "yes" - }, - { - "name": "didBreastfeedingStart", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/breastfeeding_postbirth", - "source": "mother.didBreastfeedingStart", - "value": "yes" - }, - { - "name": "maternalDeathCause", - "bind": "/model/instance/PNC_Registration_EngKan/maternal_death_group/maternal_death_cause", - "source": "mother.maternalDeathCause" - }, - { - "name": "otherMaternalDeathCause", - "bind": "/model/instance/PNC_Registration_EngKan/maternal_death_group/other_maternal_death_cause", - "source": "mother.otherMaternalDeathCause" - }, - { - "name": "isRHNegative", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/case_w_rh_negative", - "source": "mother.isRHNegative" - }, - { - "name": "isRHInjectionGiven", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/rh_injection_given", - "source": "mother.isRHInjectionGiven" - }, - { - "name": "hadDeliveryComplications", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/had_delivery_complications", - "source": "mother.hadDeliveryComplications", - "value": "yes" - }, - { - "name": "deliveryComplications", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/complications", - "source": "mother.deliveryComplications", - "value": "hemorrhage placenta_previa" - }, - { - "name": "otherDeliveryComplications", - "bind": "/model/instance/PNC_Registration_EngKan/woman_survived_group/delivery_complications_other", - "source": "mother.otherDeliveryComplications" - }, - { - "name": "isHighRiskTillPNCClose", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_is_high_risk_till_pnc_close", - "source": "mother.isHighRiskTillPNCClose", - "value": "no" - }, - { - "name": "highRiskTillPNCCloseReason", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_is_high_risk_till_pnc_close_reason", - "source": "mother.highRiskTillPNCCloseReason" - }, - { - "name": "anemicStatus", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_anaemic_status", - "source": "mother.anemicStatus" - }, - { - "name": "pih", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_pih", - "source": "mother.pih" - }, - { - "name": "preEclampsia", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_pre_eclampsia", - "source": "mother.preEclampsia" - }, - { - "name": "jaundice", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_jaundice", - "source": "mother.jaundice" - }, - { - "name": "isHighRisk", - "bind": "/model/instance/PNC_Registration_EngKan/is_high_risk", - "source": "mother.isHighRisk", - "value": "yes" - }, - { - "name": "isBirthPlanningDone", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_birth_planning", - "source": "mother.isBirthPlanningDone" - }, - { - "name": "highRiskReason", - "bind": "/model/instance/PNC_Registration_EngKan/high_risk_reason", - "source": "mother.highRiskReason" - }, - { - "name": "submissionDate", - "bind": "/model/instance/PNC_Registration_EngKan/today", - "source": "mother.submissionDate", - "value": "2015-03-20" - }, - { - "name": "type", - "value": "PNC", - "source": "mother.type" - }, - { - "name": "numberOfLivingChildren", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_num_livingchildren", - "source": "mother.eligible_couple.numberOfLivingChildren", - "value": "0" - }, - { - "name": "numberOfLivingChildren", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/num_livingchildren", - "source": "mother.eligible_couple.numberOfLivingChildren", - "value": "3" - }, - { - "name": "numberOfChildrenBorn", - "bind": "/model/instance/PNC_Registration_EngKan/num_children_born", - "source": "mother.numberOfChildrenBorn", - "value": "3" - }, - { - "name": "numberOfFemaleChildrenBorn", - "bind": "/model/instance/PNC_Registration_EngKan/num_female_children_born", - "source": "mother.numberOfFemaleChildrenBorn", - "value": "1" - }, - { - "name": "numberOfMaleChildrenBorn", - "bind": "/model/instance/PNC_Registration_EngKan/num_male_children_born", - "source": "mother.numberOfMaleChildrenBorn", - "value": "2" - }, - { - "name": "numberOfLivingFemaleChild", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_numlivingchildren_female", - "source": "mother.eligible_couple.numberOfLivingChildrenFemale" - }, - { - "name": "numberOfLivingFemaleChild", - "bind": "/model/instance/PNC_Registration_EngKan/numlivingchildren_female", - "source": "mother.eligible_couple.numberOfLivingChildrenFemale", - "value": "NaN" - }, - { - "name": "numberOfLivingMaleChild", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/case_numlivingchildren_male", - "source": "mother.eligible_couple.numberOfLivingMaleChild" - }, - { - "name": "numberOfLivingMaleChild", - "bind": "/model/instance/PNC_Registration_EngKan/numlivingchildren_male", - "source": "mother.eligible_couple.numberOfLivingMaleChild", - "value": "NaN" - }, - { - "name": "youngestChildDOB", - "bind": "/model/instance/PNC_Registration_EngKan/youngestchild_date_of_birth", - "source": "mother.eligible_couple.youngestChildDOB", - "value": "2015-02-20" - }, - { - "name": "youngestChildAge", - "bind": "/model/instance/PNC_Registration_EngKan/youngestchild_age", - "source": "mother.eligible_couple.youngestChildAge", - "value": "0" - } - ], - "sub_forms": [ - { - "name": "child_registration", - "bind_type": "child", - "default_bind_path": "/model/instance/PNC_Registration_EngKan/live_birth_group/child", - "fields": [ - { - "name": "id", - "shouldLoadValue": true, - "source": "child.id" - }, - { - "name": "gender", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/sex_child", - "source": "child.gender" - }, - { - "name": "weight", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/birthweight", - "source": "child.weight" - }, - { - "name": "bloodGroup", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/child_blood_group", - "source": "child.bloodGroup" - }, - { - "name": "immunizationsGiven", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/immunizations_atbirth", - "source": "child.immunizationsGiven" - }, - { - "name": "hepB", - "shouldLoadValue": true, - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/case_hepb", - "source": "child.hepB" - }, - { - "name": "isHepBProphylaxisProvided", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/hepb_prophylaxis_provided", - "source": "child.isHepBProphylaxisProvided" - }, - { - "name": "isChildHighRisk1", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/is_child_high_risk1", - "source": "child.isChildHighRisk1" - }, - { - "name": "childHighRiskReasons", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/child_high_risk_reasons", - "source": "child.childHighRiskReasons" - }, - { - "name": "isChildHighRisk", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/is_child_high_risk", - "source": "child.isChildHighRisk" - }, - { - "name": "lbw", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/lbw", - "source": "child.lbw" - }, - { - "name": "vlbw", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/vlbw", - "source": "child.vlbw" - }, - { - "name": "premature", - "bind": "/model/instance/PNC_Registration_EngKan/live_birth_group/child/premature", - "source": "child.premature" - } - ], - "instances": [ - { - "gender": "male", - "weight": "2", - "bloodGroup": "a_negative", - "immunizationsGiven": "bcg", - "hepB": "", - "isHepBProphylaxisProvided": "", - "lbw": "Low_Birth_Weight", - "vlbw": "", - "premature": "", - "isChildHighRisk1": "yes", - "childHighRiskReasons": " Low_Birth_Weight ", - "isChildHighRisk": "yes", - "id": "e9a91c61-0d33-42d3-bf9b-560b4d08c74f" - }, - { - "gender": "male", - "weight": "", - "bloodGroup": "a_negative", - "immunizationsGiven": "bcg", - "hepB": "", - "isHepBProphylaxisProvided": "", - "lbw": "", - "vlbw": "", - "premature": "", - "isChildHighRisk1": "no", - "childHighRiskReasons": "", - "isChildHighRisk": "yes", - "id": "c7305d21-0b90-4c15-a88f-b08338d3aed9" - }, - { - "gender": "female", - "weight": "", - "bloodGroup": "a_negative", - "immunizationsGiven": "bcg", - "hepB": "", - "isHepBProphylaxisProvided": "", - "lbw": "", - "vlbw": "", - "premature": "", - "isChildHighRisk1": "no", - "childHighRiskReasons": "", - "isChildHighRisk": "no", - "id": "6c2d772b-7d6a-4a05-a83d-5168c183ef42" - } - ] - } - ] - } - }, - "serverVersion": "1426877779320" -} \ No newline at end of file diff --git a/opensrp-form/src/test/resources/form/repeatform/model.xml b/opensrp-form/src/test/resources/form/repeatform/model.xml deleted file mode 100755 index 21130a05e8..0000000000 --- a/opensrp-form/src/test/resources/form/repeatform/model.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-interface/pom.xml b/opensrp-interface/pom.xml deleted file mode 100755 index 9b95ec085d..0000000000 --- a/opensrp-interface/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - 4.0.0 - - - opensrp - org.opensrp - 0.1-SNAPSHOT - - - opensrp-interface - opensrp-interface - http://github.com/OpenSRP/opensrp-server - - - ${project.basedir}/.. - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - 1.7 - 1.7 - UTF-8 - - - - - - - - org.apache.commons - commons-lang3 - 3.1 - - - joda-time - joda-time - 2.0 - - - org.codehaus.jackson - jackson-core-asl - ${jackson.version} - - - junit - junit - 4.8.2 - test - - - nl.jqno.equalsverifier - equalsverifier - 2.3 - test - - - com.openpojo - openpojo - 0.8.3 - - - \ No newline at end of file diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/ANMDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/ANMDTO.java deleted file mode 100644 index 9ac0117f67..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/ANMDTO.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.opensrp.dto; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class ANMDTO { - - @JsonProperty - private String identifier; - - @JsonProperty - private String name; - - @JsonProperty - private LocationDTO location; - - public ANMDTO(String identifier, String name, LocationDTO location) { - this.identifier = identifier; - this.name = name; - this.location = location; - } - - public String getIdentifier() { - return identifier; - } - - public String getName() { - return name; - } - - public LocationDTO getLocation() { - return location; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/Action.java b/opensrp-interface/src/main/java/org/opensrp/dto/Action.java deleted file mode 100644 index 507730864e..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/Action.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.opensrp.dto; - -import java.util.Map; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class Action { - - @JsonProperty - private String caseID; - - @JsonProperty - private Map data; - - @JsonProperty - private String actionTarget; - - @JsonProperty - private String actionType; - - @JsonProperty - private String timeStamp; - - @JsonProperty - private Boolean isActionActive; - - @JsonProperty - private Map details; - - public Action(String caseID, String actionTarget, String actionType, Map data, String timeStamp, - Boolean isActionActive, Map details) { - this.caseID = caseID; - this.data = data; - this.timeStamp = timeStamp; - this.actionTarget = actionTarget; - this.actionType = actionType; - this.isActionActive = isActionActive; - this.details = details; - } - - public Action() { - } - - public String getCaseID() { - return caseID; - } - - public String getActionTarget() { - return this.actionTarget; - } - - public String getActionType() { - return this.actionType; - } - - public Boolean getIsActionActive() { - return this.isActionActive; - } - - public String getTimeStamp() { - return this.timeStamp; - } - - public String get(String key) { - return data.get(key); - } - - public Map getData() { - return this.data; - } - - public Map getDetails() { - return this.details; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/ActionData.java b/opensrp-interface/src/main/java/org/opensrp/dto/ActionData.java deleted file mode 100644 index e15c9cd2d1..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/ActionData.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.opensrp.dto; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.joda.time.DateTime; - -public class ActionData { - - public static final String BENEFICIARY_TYPE = "beneficiaryType"; - - public static final String SCHEDULE_NAME = "scheduleName"; - - public static final String VISIT_CODE = "visitCode"; - - public static final String ALERT_STATUS = "alertStatus"; - - public static final String START_DATE = "startDate"; - - public static final String EXPIRY_DATE = "expiryDate"; - - public static final String TARGET = "alert"; - - public static final String TYPE = "createAlert"; - - public static final String COMPLETION_DATE = "completionDate"; - - public static final String ANNUAL_TARGET = "annualTarget"; - - public static final String MONTHLY_SUMMARIES = "monthlySummaries"; - - public static final String REASON_FOR_CLOSE = "reasonForClose"; - - private Map data; - - private String target; - - private String type; - - private Map details; - - public static ActionData createAlert(String beneficiaryType, String scheduleName, String visitCode, - AlertStatus alertStatus, DateTime startDate, DateTime expiryDate) { - return new ActionData(TARGET, TYPE).with(BENEFICIARY_TYPE, beneficiaryType).with(SCHEDULE_NAME, scheduleName) - .with(VISIT_CODE, visitCode).with(ALERT_STATUS, alertStatus.value()) - .with(START_DATE, startDate.toLocalDate().toString()).with(EXPIRY_DATE, expiryDate.toLocalDate().toString()); - } - - public static ActionData markAlertAsClosed(String visitCode, String completionDate) { - return new ActionData(TARGET, "closeAlert").with(VISIT_CODE, visitCode).with(COMPLETION_DATE, completionDate); - } - - public static ActionData reportForIndicator(String indicator, String annualTarget, String monthSummaries) { - return new ActionData("report", indicator).with(ANNUAL_TARGET, annualTarget).with(MONTHLY_SUMMARIES, monthSummaries); - } - - public static ActionData closeBeneficiary(String target, String reasonForClose) { - return new ActionData(target, "close").with(REASON_FOR_CLOSE, reasonForClose); - } - - public static ActionData from(String actionType, String actionTarget, Map data, - Map details) { - ActionData actionData = new ActionData(actionTarget, actionType); - actionData.data.putAll(data); - actionData.details.putAll(details); - return actionData; - } - - private ActionData(String target, String type) { - this.target = target; - this.type = type; - data = new HashMap(); - details = new HashMap(); - } - - private ActionData with(String key, String value) { - data.put(key, value); - return this; - } - - public Map getData() { - return this.data; - } - - public String getTarget() { - return target; - } - - public String getType() { - return type; - } - - public Map getDetails() { - return details; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - - return ToStringBuilder.reflectionToString(this); - - } - -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/AlertStatus.java b/opensrp-interface/src/main/java/org/opensrp/dto/AlertStatus.java deleted file mode 100644 index c419be146d..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/AlertStatus.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.opensrp.dto; - -public enum AlertStatus { - upcoming("upcoming"), - normal("normal"), - urgent("urgent"), - expired("expired"), - complete("complete"), - closed("closed"), - defaulted("defaulted"); - - private String value; - - AlertStatus(String value) { - this.value = value; - } - - public static AlertStatus from(String alertStatus) { - return valueOf(alertStatus); - } - - public String value() { - return value; - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/BeneficiaryType.java b/opensrp-interface/src/main/java/org/opensrp/dto/BeneficiaryType.java deleted file mode 100644 index b90890b1e9..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/BeneficiaryType.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.opensrp.dto; - -public enum BeneficiaryType { - child("child"), - mother("mother"), - ec("ec"); - - private String value; - - BeneficiaryType(String value) { - this.value = value; - } - - public String value() { - return value; - } - - public static BeneficiaryType from(String beneficiaryType) { - return valueOf(beneficiaryType); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/LocationDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/LocationDTO.java deleted file mode 100644 index e5f458bda7..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/LocationDTO.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.opensrp.dto; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class LocationDTO { - - @JsonProperty - private String sub_center; - - @JsonProperty - private String phc; - - @JsonProperty - private String taluka; - - @JsonProperty - private String district; - - @JsonProperty - private String state; - - public LocationDTO(String sub_center, String phc, String taluka, String district, String state) { - this.state = state; - this.district = district; - this.taluka = taluka; - this.phc = phc; - this.sub_center = sub_center; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/MonthSummaryDatum.java b/opensrp-interface/src/main/java/org/opensrp/dto/MonthSummaryDatum.java deleted file mode 100644 index 8d1b82474c..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/MonthSummaryDatum.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.opensrp.dto; - -import java.util.List; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; - -public class MonthSummaryDatum { - - private String month; - - private String year; - - private String currentProgress; - - private String aggregatedProgress; - - private List externalIDs; - - public MonthSummaryDatum(String month, String year, String currentProgress, String aggregatedProgress, - List externalIDs) { - this.month = month; - this.year = year; - this.currentProgress = currentProgress; - this.aggregatedProgress = aggregatedProgress; - this.externalIDs = externalIDs; - } - - public MonthSummaryDatum() { - } - - public String getMonth() { - return month; - } - - public String getYear() { - return year; - } - - public String getCurrentProgress() { - return currentProgress; - } - - public String getAggregatedProgress() { - return aggregatedProgress; - } - - public List getExternalIDs() { - return externalIDs; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/VillagesDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/VillagesDTO.java deleted file mode 100644 index 518dda0d59..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/VillagesDTO.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.opensrp.dto; - -import java.util.List; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class VillagesDTO { - - @JsonProperty - private String district; - - @JsonProperty - private String phcName; - - @JsonProperty - private String phcIdentifier; - - @JsonProperty - private String subCenter; - - @JsonProperty - private List villages; - - public VillagesDTO(String district, String phcName, String phcIdentifier, String subCenter, List villages) { - this.district = district; - this.phcName = phcName; - this.phcIdentifier = phcIdentifier; - this.subCenter = subCenter; - this.villages = villages; - } - - public String getDistrict() { - return district; - } - - public String getPhcName() { - return phcName; - } - - public String getPhcIdentifier() { - return phcIdentifier; - } - - public String getSubCenter() { - return subCenter; - } - - public List getVillages() { - return villages; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/aggregatorResponse/AggregatorResponseDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/aggregatorResponse/AggregatorResponseDTO.java deleted file mode 100644 index 04eee9f9da..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/aggregatorResponse/AggregatorResponseDTO.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.opensrp.dto.aggregatorResponse; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class AggregatorResponseDTO { - - @JsonProperty - private String indicator; - - @JsonProperty - private Integer nrhm_report_indicator_count; - - public AggregatorResponseDTO(String indicator, Integer nrhm_report_indicator_count) { - this.indicator = indicator; - this.nrhm_report_indicator_count = nrhm_report_indicator_count; - } - - public String indicator() { - return indicator; - } - - public Integer count() { - return nrhm_report_indicator_count; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/form/FormSubmissionDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/form/FormSubmissionDTO.java deleted file mode 100644 index 6cb95d0019..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/form/FormSubmissionDTO.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.opensrp.dto.form; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class FormSubmissionDTO { - - @JsonProperty - private String anmId; - - @JsonProperty - private String instanceId; - - @JsonProperty - private String entityId; - - @JsonProperty - private String formName; - - @JsonProperty - private String formInstance; - - @JsonProperty - private String clientVersion; - - @JsonProperty - private String serverVersion; - - @JsonProperty - private String formDataDefinitionVersion; - - private FormSubmissionDTO() { - - } - - public FormSubmissionDTO(String anmId, String instanceId, String entityId, String formName, String formInstance, - String clientVersion, String formDataDefinitionVersion) { - this.anmId = anmId; - this.instanceId = instanceId; - this.entityId = entityId; - this.formName = formName; - this.formInstance = formInstance; - this.clientVersion = clientVersion; - this.formDataDefinitionVersion = formDataDefinitionVersion; - } - - public FormSubmissionDTO withServerVersion(String version) { - this.serverVersion = version; - return this; - } - - public String getAnmId() { - return this.anmId; - } - - public String getInstanceId() { - return this.instanceId; - } - - public String getEntityId() { - return this.entityId; - } - - public String getFormName() { - return this.formName; - } - - public String getFormInstance() { - return this.formInstance; - } - - public String getClientVersion() { - return this.clientVersion; - } - - public String getFormDataDefinitionVersion() { - return this.formDataDefinitionVersion; - } - - public String getServerVersion() { - return serverVersion; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/form/MultimediaDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/form/MultimediaDTO.java deleted file mode 100644 index e81a68ea52..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/form/MultimediaDTO.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.opensrp.dto.form; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class MultimediaDTO { - - @JsonProperty - private String caseId; - - @JsonProperty - private String providerId; - - @JsonProperty - private String contentType; - - @JsonProperty - private String filePath; - - @JsonProperty - private String fileCategory; - - public MultimediaDTO() { - - } - - public MultimediaDTO(String caseId, String providerId, String contentType, String filePath, String fileCategory) { - this.caseId = caseId; - this.providerId = providerId; - this.contentType = contentType; - this.filePath = filePath; - this.fileCategory = fileCategory; - } - - public String getCaseId() { - return this.caseId; - } - - public String getProviderId() { - return this.providerId; - } - - public String getContentType() { - return this.contentType; - } - - public String getFilePath() { - return this.filePath; - } - - public String getFileCategory() { - return this.fileCategory; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - public MultimediaDTO withFilePath(String filePath) { - this.filePath = filePath; - return this; - } - -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/ANCRegisterDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/ANCRegisterDTO.java deleted file mode 100644 index e9c8e413d2..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/ANCRegisterDTO.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.opensrp.dto.register; - -import java.util.List; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class ANCRegisterDTO { - - @JsonProperty - private List ancRegisterEntries; - - public ANCRegisterDTO(List ancRegisterEntries) { - this.ancRegisterEntries = ancRegisterEntries; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/ANCRegisterEntryDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/ANCRegisterEntryDTO.java deleted file mode 100644 index 84a426867c..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/ANCRegisterEntryDTO.java +++ /dev/null @@ -1,426 +0,0 @@ -package org.opensrp.dto.register; - -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class ANCRegisterEntryDTO { - - @JsonProperty - private String ancNumber; - - @JsonProperty - private String registrationDate; - - @JsonProperty - private String ecNumber; - - @JsonProperty - private String thayiCardNumber; - - @JsonProperty - private String aadharCardNumber; - - @JsonProperty - private String wifeName; - - @JsonProperty - private String husbandName; - - @JsonProperty - private String address; - - @JsonProperty - private String wifeDOB; - - @JsonProperty - private String phoneNumber; - - @JsonProperty - private String wifeEducationLevel; - - @JsonProperty - private String husbandEducationLevel; - - @JsonProperty - private String caste; - - @JsonProperty - private String religion; - - @JsonProperty - private String economicStatus; - - @JsonProperty - private String bplCardNumber; - - @JsonProperty - private String jsyBeneficiary; - - @JsonProperty - private String gravida; - - @JsonProperty - private String parity; - - @JsonProperty - private String numberOfLivingChildren; - - @JsonProperty - private String numberOfStillBirths; - - @JsonProperty - private String numberOfAbortions; - - @JsonProperty - private String youngestChildDOB; - - @JsonProperty - private String lmp; - - @JsonProperty - private String edd; - - @JsonProperty - private String height; - - @JsonProperty - private String bloodGroup; - - @JsonProperty - private String isHRP; - - @JsonProperty - private List> ancVisits; - - @JsonProperty - private List> ifaTablets; - - @JsonProperty - private List> ttDoses; - - @JsonProperty - private List> hbTests; - - @JsonProperty - private List> ancInvestigations; - - public ANCRegisterEntryDTO() { - } - - public ANCRegisterEntryDTO withANCNumber(String ancNumber) { - this.ancNumber = ancNumber; - return this; - } - - public ANCRegisterEntryDTO withRegistrationDate(String registrationDate) { - this.registrationDate = registrationDate; - return this; - } - - public ANCRegisterEntryDTO withECNumber(String ecNumber) { - this.ecNumber = ecNumber; - return this; - } - - public ANCRegisterEntryDTO withThayiCardNumber(String thayiCardNumber) { - this.thayiCardNumber = thayiCardNumber; - return this; - } - - public ANCRegisterEntryDTO withAadharCardNumber(String aadharCardNumber) { - this.aadharCardNumber = aadharCardNumber; - return this; - } - - public ANCRegisterEntryDTO withWifeName(String wifeName) { - this.wifeName = wifeName; - return this; - } - - public ANCRegisterEntryDTO withHusbandName(String husbandName) { - this.husbandName = husbandName; - return this; - } - - public ANCRegisterEntryDTO withAddress(String address) { - this.address = address; - return this; - } - - public ANCRegisterEntryDTO withWifeDOB(String wifeDOB) { - this.wifeDOB = wifeDOB; - return this; - } - - public ANCRegisterEntryDTO withPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - return this; - } - - public ANCRegisterEntryDTO withWifeEducationLevel(String wifeEducationLevel) { - this.wifeEducationLevel = wifeEducationLevel; - return this; - } - - public ANCRegisterEntryDTO withHusbandEducationLevel(String husbandEducationLevel) { - this.husbandEducationLevel = husbandEducationLevel; - return this; - } - - public ANCRegisterEntryDTO withCaste(String caste) { - this.caste = caste; - return this; - } - - public ANCRegisterEntryDTO withReligion(String religion) { - this.religion = religion; - return this; - } - - public ANCRegisterEntryDTO withEconomicStatus(String economicStatus) { - this.economicStatus = economicStatus; - return this; - } - - public ANCRegisterEntryDTO withBPLCardNumber(String bplCardNumber) { - this.bplCardNumber = bplCardNumber; - return this; - } - - public ANCRegisterEntryDTO withJSYBeneficiary(String jsyBeneficiary) { - this.jsyBeneficiary = jsyBeneficiary; - return this; - } - - public ANCRegisterEntryDTO withGravida(String gravida) { - this.gravida = gravida; - return this; - } - - public ANCRegisterEntryDTO withParity(String parity) { - this.parity = parity; - return this; - } - - public ANCRegisterEntryDTO withNumberOfLivingChildren(String numberOfLivingChildren) { - this.numberOfLivingChildren = numberOfLivingChildren; - return this; - } - - public ANCRegisterEntryDTO withNumberOfStillBirths(String numberOfStillBirths) { - this.numberOfStillBirths = numberOfStillBirths; - return this; - } - - public ANCRegisterEntryDTO withNumberOfAbortions(String numberOfAbortions) { - this.numberOfAbortions = numberOfAbortions; - return this; - } - - public ANCRegisterEntryDTO withYoungestChildDOB(String youngestChildAge) { - this.youngestChildDOB = youngestChildAge; - return this; - } - - public ANCRegisterEntryDTO withLMP(String lmp) { - this.lmp = lmp; - return this; - } - - public ANCRegisterEntryDTO withEDD(String edd) { - this.edd = edd; - return this; - } - - public ANCRegisterEntryDTO withHeight(String height) { - this.height = height; - return this; - } - - public ANCRegisterEntryDTO withBloodGroup(String bloodGroup) { - this.bloodGroup = bloodGroup; - return this; - } - - public ANCRegisterEntryDTO withIsHRP(String isHRP) { - this.isHRP = isHRP; - return this; - } - - public ANCRegisterEntryDTO withANCVisits(List> ancVisits) { - this.ancVisits = ancVisits; - return this; - } - - public ANCRegisterEntryDTO withIFATablets(List> ifaTablets) { - this.ifaTablets = ifaTablets; - return this; - } - - public ANCRegisterEntryDTO withTTDoses(List> ttDoses) { - this.ttDoses = ttDoses; - return this; - } - - public ANCRegisterEntryDTO withHBTests(List> hbTests) { - this.hbTests = hbTests; - return this; - } - - public ANCRegisterEntryDTO withANCInvestigations(List> ancInvestigations) { - this.ancInvestigations = ancInvestigations; - return this; - } - - public String getAncNumber() { - return ancNumber; - } - - public String getRegistrationDate() { - return registrationDate; - } - - public String getEcNumber() { - return ecNumber; - } - - public String getThayiCardNumber() { - return thayiCardNumber; - } - - public String getAadharCardNumber() { - return aadharCardNumber; - } - - public String getWifeName() { - return wifeName; - } - - public String getHusbandName() { - return husbandName; - } - - public String getAddress() { - return address; - } - - public String getWifeDOB() { - return wifeDOB; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public String getWifeEducationLevel() { - return wifeEducationLevel; - } - - public String getHusbandEducationLevel() { - return husbandEducationLevel; - } - - public String getCaste() { - return caste; - } - - public String getReligion() { - return religion; - } - - public String getEconomicStatus() { - return economicStatus; - } - - public String getBplCardNumber() { - return bplCardNumber; - } - - public String getJsyBeneficiary() { - return jsyBeneficiary; - } - - public String getGravida() { - return gravida; - } - - public String getParity() { - return parity; - } - - public String getNumberOfLivingChildren() { - return numberOfLivingChildren; - } - - public String getNumberOfStillBirths() { - return numberOfStillBirths; - } - - public String getNumberOfAbortions() { - return numberOfAbortions; - } - - public String getYoungestChildDOB() { - return youngestChildDOB; - } - - public String getLmp() { - return lmp; - } - - public String getEdd() { - return edd; - } - - public String getHeight() { - return height; - } - - public String getBloodGroup() { - return bloodGroup; - } - - public String getIsHRP() { - return isHRP; - } - - public List> getAncVisits() { - return ancVisits; - } - - public List> getIfaTablets() { - return ifaTablets; - } - - public List> getTtDoses() { - return ttDoses; - } - - public List> getHbTests() { - return hbTests; - } - - public List> getAncInvestigations() { - return ancInvestigations; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/ANMDetailDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/ANMDetailDTO.java deleted file mode 100644 index e58d0674d0..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/ANMDetailDTO.java +++ /dev/null @@ -1,125 +0,0 @@ -package org.opensrp.dto.register; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; -import org.opensrp.dto.LocationDTO; - -public class ANMDetailDTO { - - @JsonProperty - private String identifier; - - @JsonProperty - private String name; - - @JsonProperty - private LocationDTO location; - - @JsonProperty - private int ecCount; - - @JsonProperty - private int fpCount; - - @JsonProperty - private int ancCount; - - @JsonProperty - private int pncCount; - - @JsonProperty - private int childCount; - - public ANMDetailDTO(String identifier, String name, LocationDTO location, int ecCount, int fpCount, int ancCount, - int pncCount, int childCount) { - this.identifier = identifier; - this.name = name; - this.location = location; - this.ecCount = ecCount; - this.fpCount = fpCount; - this.ancCount = ancCount; - this.pncCount = pncCount; - this.childCount = childCount; - } - - public String getIdentifier() { - return identifier; - } - - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public LocationDTO getLocation() { - return location; - } - - public void setLocation(LocationDTO location) { - this.location = location; - } - - public int getEcCount() { - return ecCount; - } - - public void setEcCount(int ecCount) { - this.ecCount = ecCount; - } - - public int getFpCount() { - return fpCount; - } - - public void setFpCount(int fpCount) { - this.fpCount = fpCount; - } - - public int getAncCount() { - return ancCount; - } - - public void setAncCount(int ancCount) { - this.ancCount = ancCount; - } - - public int getPncCount() { - return pncCount; - } - - public void setPncCount(int pncCount) { - this.pncCount = pncCount; - } - - public int getChildCount() { - return childCount; - } - - public void setChildCount(int childCount) { - this.childCount = childCount; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/ANMDetailsDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/ANMDetailsDTO.java deleted file mode 100644 index e8fc2eb741..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/ANMDetailsDTO.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.opensrp.dto.register; - -import java.util.List; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class ANMDetailsDTO { - - @JsonProperty - private List anmDetails; - - public ANMDetailsDTO(List anmDetails) { - this.anmDetails = anmDetails; - } - - public List getAnmDetails() { - return anmDetails; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/ChildRegisterDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/ChildRegisterDTO.java deleted file mode 100644 index 66f1d2f3ef..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/ChildRegisterDTO.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.opensrp.dto.register; - -import java.util.List; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class ChildRegisterDTO { - - @JsonProperty - private List childRegisterEntries; - - public ChildRegisterDTO(List childRegisterEntries) { - this.childRegisterEntries = childRegisterEntries; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/ChildRegisterEntryDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/ChildRegisterEntryDTO.java deleted file mode 100644 index 77bb3280b7..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/ChildRegisterEntryDTO.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.opensrp.dto.register; - -import java.util.Map; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class ChildRegisterEntryDTO { - - @JsonProperty - private String thayiCardNumber; - - @JsonProperty - private String wifeName; - - @JsonProperty - private String husbandName; - - @JsonProperty - private String village; - - @JsonProperty - private String subCenter; - - @JsonProperty - private String wifeDOB; - - @JsonProperty - private String dob; - - @JsonProperty - private Map immunizations; - - @JsonProperty - private Map vitaminADoses; - - public ChildRegisterEntryDTO withThayiCardNumber(String thayiCardNumber) { - this.thayiCardNumber = thayiCardNumber; - return this; - } - - public ChildRegisterEntryDTO withWifeName(String wifeName) { - this.wifeName = wifeName; - return this; - } - - public ChildRegisterEntryDTO withHusbandName(String husbandName) { - this.husbandName = husbandName; - return this; - } - - public ChildRegisterEntryDTO withVillage(String village) { - this.village = village; - return this; - } - - public ChildRegisterEntryDTO withSubCenter(String subCenter) { - this.subCenter = subCenter; - return this; - } - - public ChildRegisterEntryDTO withWifeDOB(String wifeDOB) { - this.wifeDOB = wifeDOB; - return this; - } - - public ChildRegisterEntryDTO withDOB(String DOB) { - this.dob = DOB; - return this; - } - - public ChildRegisterEntryDTO withImmunizations(Map immunizations) { - this.immunizations = immunizations; - return this; - } - - public ChildRegisterEntryDTO withVitaminADoses(Map vitaminADoses) { - this.vitaminADoses = vitaminADoses; - return this; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/CondomFPDetailsDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/CondomFPDetailsDTO.java deleted file mode 100644 index 3bac4e330d..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/CondomFPDetailsDTO.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.opensrp.dto.register; - -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class CondomFPDetailsDTO { - - @JsonProperty - private String fpAcceptanceDate; - - @JsonProperty - private List> refills; - - public CondomFPDetailsDTO(String fpAcceptanceDate, List> refills) { - this.fpAcceptanceDate = fpAcceptanceDate; - this.refills = refills; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/CondomRegisterEntryDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/CondomRegisterEntryDTO.java deleted file mode 100644 index 28ad7632d9..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/CondomRegisterEntryDTO.java +++ /dev/null @@ -1,180 +0,0 @@ -package org.opensrp.dto.register; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class CondomRegisterEntryDTO { - - @JsonProperty - private String ecNumber; - - @JsonProperty - private String wifeName; - - @JsonProperty - private String husbandName; - - @JsonProperty - private String village; - - @JsonProperty - private String subCenter; - - @JsonProperty - private String wifeAge; - - @JsonProperty - private String caste; - - @JsonProperty - private String religion; - - @JsonProperty - private String numberOfLivingMaleChildren; - - @JsonProperty - private String numberOfLivingFemaleChildren; - - @JsonProperty - private String wifeEducationLevel; - - @JsonProperty - private String husbandEducationLevel; - - @JsonProperty - private CondomFPDetailsDTO fpDetails; - - public String getEcNumber() { - return ecNumber; - } - - public String getWifeName() { - return wifeName; - } - - public String getHusbandName() { - return husbandName; - } - - public String getVillage() { - return village; - } - - public String getSubCenter() { - return subCenter; - } - - public String getWifeAge() { - return wifeAge; - } - - public String getCaste() { - return caste; - } - - public String getReligion() { - return religion; - } - - public String getNumberOfLivingMaleChildren() { - return numberOfLivingMaleChildren; - } - - public String getNumberOfLivingFemaleChildren() { - return numberOfLivingFemaleChildren; - } - - public String getWifeEducationLevel() { - return wifeEducationLevel; - } - - public String getHusbandEducationLevel() { - return husbandEducationLevel; - } - - public CondomFPDetailsDTO getFpDetails() { - return fpDetails; - } - - public CondomRegisterEntryDTO withEcNumber(String ecNumber) { - this.ecNumber = ecNumber; - return this; - } - - public CondomRegisterEntryDTO withWifeName(String wifeName) { - this.wifeName = wifeName; - return this; - } - - public CondomRegisterEntryDTO withHusbandName(String husbandName) { - this.husbandName = husbandName; - return this; - } - - public CondomRegisterEntryDTO withVillage(String village) { - this.village = village; - return this; - } - - public CondomRegisterEntryDTO withSubCenter(String subCenter) { - this.subCenter = subCenter; - return this; - } - - public CondomRegisterEntryDTO withWifeAge(String wifeAge) { - this.wifeAge = wifeAge; - return this; - } - - public CondomRegisterEntryDTO withCaste(String caste) { - this.caste = caste; - return this; - } - - public CondomRegisterEntryDTO withReligion(String religion) { - this.religion = religion; - return this; - } - - public CondomRegisterEntryDTO withNumberOfLivingMaleChildren(String numberOfLivingMaleChildren) { - this.numberOfLivingMaleChildren = numberOfLivingMaleChildren; - return this; - } - - public CondomRegisterEntryDTO withNumberOfLivingFemaleChildren(String numberOfLivingFemaleChildren) { - this.numberOfLivingFemaleChildren = numberOfLivingFemaleChildren; - return this; - } - - public CondomRegisterEntryDTO withWifeEducationLevel(String wifeEducationLevel) { - this.wifeEducationLevel = wifeEducationLevel; - return this; - } - - public CondomRegisterEntryDTO withHusbandEducationLevel(String husbandEducationLevel) { - this.husbandEducationLevel = husbandEducationLevel; - return this; - } - - public CondomRegisterEntryDTO withFpDetails(CondomFPDetailsDTO fpDetails) { - this.fpDetails = fpDetails; - return this; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/ECRegisterDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/ECRegisterDTO.java deleted file mode 100644 index 1dd54142af..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/ECRegisterDTO.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.opensrp.dto.register; - -import java.util.List; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class ECRegisterDTO { - - @JsonProperty - private List ecRegisterEntries; - - public ECRegisterDTO(List ecRegisterEntries) { - this.ecRegisterEntries = ecRegisterEntries; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/ECRegisterEntryDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/ECRegisterEntryDTO.java deleted file mode 100644 index 4634323af7..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/ECRegisterEntryDTO.java +++ /dev/null @@ -1,248 +0,0 @@ -package org.opensrp.dto.register; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class ECRegisterEntryDTO { - - @JsonProperty - private String registrationDate; - - @JsonProperty - private String ecNumber; - - @JsonProperty - private String wifeName; - - @JsonProperty - private String husbandName; - - @JsonProperty - private String householdAddress; - - @JsonProperty - private String householdNumber; - - @JsonProperty - private String headOfHousehold; - - @JsonProperty - private String village; - - @JsonProperty - private String subCenter; - - @JsonProperty - private String phc; - - @JsonProperty - private String wifeAge; - - @JsonProperty - private String husbandAge; - - @JsonProperty - private String wifeEducationLevel; - - @JsonProperty - private String husbandEducationLevel; - - @JsonProperty - private String caste; - - @JsonProperty - private String religion; - - @JsonProperty - private String economicStatus; - - @JsonProperty - private String gravida; - - @JsonProperty - private String parity; - - @JsonProperty - private String numberOfLivingChildren; - - @JsonProperty - private String numberOfStillBirths; - - @JsonProperty - private String numberOfAbortions; - - @JsonProperty - private String numberOfLivingMaleChildren; - - @JsonProperty - private String numberOfLivingFemaleChildren; - - @JsonProperty - private String youngestChildAge; - - @JsonProperty - private String currentFPMethod; - - @JsonProperty - private String currentFPMethodStartDate; - - @JsonProperty - private String isPregnant; - - public ECRegisterEntryDTO withRegistrationDate(String registrationDate) { - this.registrationDate = registrationDate; - return this; - } - - public ECRegisterEntryDTO withECNumber(String ecNumber) { - this.ecNumber = ecNumber; - return this; - } - - public ECRegisterEntryDTO withWifeName(String wifeName) { - this.wifeName = wifeName; - return this; - } - - public ECRegisterEntryDTO withHusbandName(String husbandName) { - this.husbandName = husbandName; - return this; - } - - public ECRegisterEntryDTO withWifeAge(String wifeAge) { - this.wifeAge = wifeAge; - return this; - } - - public ECRegisterEntryDTO withHusbandAge(String husbandAge) { - this.husbandAge = husbandAge; - return this; - } - - public ECRegisterEntryDTO withHouseholdAddress(String householdAddress) { - this.householdAddress = householdAddress; - return this; - } - - public ECRegisterEntryDTO withWifeEducationLevel(String wifeEducationLevel) { - this.wifeEducationLevel = wifeEducationLevel; - return this; - } - - public ECRegisterEntryDTO withHouseholdNumber(String householdNumber) { - this.householdNumber = householdNumber; - return this; - } - - public ECRegisterEntryDTO withHeadOfHousehold(String headOfHousehold) { - this.headOfHousehold = headOfHousehold; - return this; - } - - public ECRegisterEntryDTO withSubCenter(String subCenter) { - this.subCenter = subCenter; - return this; - } - - public ECRegisterEntryDTO withPHC(String phc) { - this.phc = phc; - return this; - } - - public ECRegisterEntryDTO withVillage(String village) { - this.village = village; - return this; - } - - public ECRegisterEntryDTO withHusbandEducationLevel(String husbandEducationLevel) { - this.husbandEducationLevel = husbandEducationLevel; - return this; - } - - public ECRegisterEntryDTO withCaste(String caste) { - this.caste = caste; - return this; - } - - public ECRegisterEntryDTO withReligion(String religion) { - this.religion = religion; - return this; - } - - public ECRegisterEntryDTO withEconomicStatus(String economicStatus) { - this.economicStatus = economicStatus; - return this; - } - - public ECRegisterEntryDTO withGravida(String gravida) { - this.gravida = gravida; - return this; - } - - public ECRegisterEntryDTO withParity(String parity) { - this.parity = parity; - return this; - } - - public ECRegisterEntryDTO withNumberOfLivingChildren(String numberOfLivingChildren) { - this.numberOfLivingChildren = numberOfLivingChildren; - return this; - } - - public ECRegisterEntryDTO withNumberOfStillBirths(String numberOfStillBirths) { - this.numberOfStillBirths = numberOfStillBirths; - return this; - } - - public ECRegisterEntryDTO withNumberOfAbortions(String numberOfAbortions) { - this.numberOfAbortions = numberOfAbortions; - return this; - } - - public ECRegisterEntryDTO withNumberOfLivingMaleChildren(String numberOfLivingMaleChildren) { - this.numberOfLivingMaleChildren = numberOfLivingMaleChildren; - return this; - } - - public ECRegisterEntryDTO withNumberOfLivingFemaleChildren(String numberOfLivingFemaleChildren) { - this.numberOfLivingFemaleChildren = numberOfLivingFemaleChildren; - return this; - } - - public ECRegisterEntryDTO withYoungestChildAge(String youngestChildAge) { - this.youngestChildAge = youngestChildAge; - return this; - } - - public ECRegisterEntryDTO withCurrentFPMethod(String fpMethod) { - this.currentFPMethod = fpMethod; - return this; - } - - public ECRegisterEntryDTO withCurrentFPMethodStartDate(String startDate) { - this.currentFPMethodStartDate = startDate; - return this; - } - - public ECRegisterEntryDTO withPregnancyStatus(String isPregnant) { - this.isPregnant = isPregnant; - return this; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/EntityDetailDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/EntityDetailDTO.java deleted file mode 100644 index 7ad80c9943..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/EntityDetailDTO.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.opensrp.dto.register; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class EntityDetailDTO { - - @JsonProperty - private String entityId; - - @JsonProperty - private String entityType; - - @JsonProperty - private String thayiCardNumber; - - @JsonProperty - private String ecNumber; - - @JsonProperty - private String anmIdentifier; - - public String getEntityId() { - return entityId; - } - - public String getEntityType() { - return entityType; - } - - public String getThayiCardNumber() { - return thayiCardNumber; - } - - public String getEcNumber() { - return ecNumber; - } - - public String getAnmIdentifier() { - return anmIdentifier; - } - - public EntityDetailDTO withThayiCardNumber(String thayiCardNumber) { - this.thayiCardNumber = thayiCardNumber; - return this; - } - - public EntityDetailDTO withECNumber(String ecNumber) { - this.ecNumber = ecNumber; - return this; - } - - public EntityDetailDTO withEntityID(String entityId) { - this.entityId = entityId; - return this; - } - - public EntityDetailDTO withANMIdentifier(String anmIdentifier) { - this.anmIdentifier = anmIdentifier; - return this; - } - - public EntityDetailDTO withEntityType(String type) { - this.entityType = type; - return this; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/FPRegisterDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/FPRegisterDTO.java deleted file mode 100644 index 8f0c8514e7..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/FPRegisterDTO.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.opensrp.dto.register; - -import java.util.List; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class FPRegisterDTO { - - @JsonProperty - private List iudRegisterEntries; - - @JsonProperty - private List condomRegisterEntries; - - @JsonProperty - private List ocpRegisterEntries; - - @JsonProperty - private List maleSterilizationRegisterEntries; - - @JsonProperty - private List femaleSterilizationRegisterEntries; - - @JsonProperty - private Integer reportingYear; - - public Integer getReportingYear() { - return reportingYear; - } - - public FPRegisterDTO(List iudRegisterEntries, List condomRegisterEntries, - List ocpRegisterEntries, - List maleSterilizationRegisterEntries, - List femaleSterilizationRegisterEntries, Integer reportingYear) { - this.iudRegisterEntries = iudRegisterEntries; - this.condomRegisterEntries = condomRegisterEntries; - this.ocpRegisterEntries = ocpRegisterEntries; - this.maleSterilizationRegisterEntries = maleSterilizationRegisterEntries; - this.femaleSterilizationRegisterEntries = femaleSterilizationRegisterEntries; - this.reportingYear = reportingYear; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/FemaleSterilizationFPDetailsDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/FemaleSterilizationFPDetailsDTO.java deleted file mode 100644 index ccb5fc938c..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/FemaleSterilizationFPDetailsDTO.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.opensrp.dto.register; - -import java.util.List; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class FemaleSterilizationFPDetailsDTO { - - @JsonProperty - private String typeOfSterilization; - - @JsonProperty - private String sterilizationDate; - - @JsonProperty - private List followupVisitDates; - - public String getTypeOfSterilization() { - return typeOfSterilization; - } - - public String getSterilizationDate() { - return sterilizationDate; - } - - public List getFollowupVisitDates() { - return followupVisitDates; - } - - public FemaleSterilizationFPDetailsDTO(String typeOfSterilization, String sterilizationDate, - List followupVisitDates) { - this.typeOfSterilization = typeOfSterilization; - this.sterilizationDate = sterilizationDate; - this.followupVisitDates = followupVisitDates; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/FemaleSterilizationRegisterEntryDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/FemaleSterilizationRegisterEntryDTO.java deleted file mode 100644 index f2315fd9ad..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/FemaleSterilizationRegisterEntryDTO.java +++ /dev/null @@ -1,192 +0,0 @@ -package org.opensrp.dto.register; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class FemaleSterilizationRegisterEntryDTO { - - @JsonProperty - private String ecNumber; - - @JsonProperty - private String wifeName; - - @JsonProperty - private String husbandName; - - @JsonProperty - private String village; - - @JsonProperty - private String subCenter; - - @JsonProperty - private String wifeAge; - - @JsonProperty - private String husbandAge; - - @JsonProperty - private String caste; - - @JsonProperty - private String religion; - - @JsonProperty - private String numberOfLivingMaleChildren; - - @JsonProperty - private String numberOfLivingFemaleChildren; - - @JsonProperty - private String wifeEducationLevel; - - @JsonProperty - private String husbandEducationLevel; - - @JsonProperty - private FemaleSterilizationFPDetailsDTO fpDetails; - - public String getEcNumber() { - return ecNumber; - } - - public String getWifeName() { - return wifeName; - } - - public String getHusbandName() { - return husbandName; - } - - public String getVillage() { - return village; - } - - public String getSubCenter() { - return subCenter; - } - - public String getWifeAge() { - return wifeAge; - } - - public String getHusbandAge() { - return husbandAge; - } - - public String getCaste() { - return caste; - } - - public String getReligion() { - return religion; - } - - public String getNumberOfLivingMaleChildren() { - return numberOfLivingMaleChildren; - } - - public String getNumberOfLivingFemaleChildren() { - return numberOfLivingFemaleChildren; - } - - public String getWifeEducationLevel() { - return wifeEducationLevel; - } - - public String getHusbandEducationLevel() { - return husbandEducationLevel; - } - - public FemaleSterilizationFPDetailsDTO getFpDetails() { - return fpDetails; - } - - public FemaleSterilizationRegisterEntryDTO withEcNumber(String ecNumber) { - this.ecNumber = ecNumber; - return this; - } - - public FemaleSterilizationRegisterEntryDTO withWifeName(String wifeName) { - this.wifeName = wifeName; - return this; - } - - public FemaleSterilizationRegisterEntryDTO withHusbandName(String husbandName) { - this.husbandName = husbandName; - return this; - } - - public FemaleSterilizationRegisterEntryDTO withVillage(String village) { - this.village = village; - return this; - } - - public FemaleSterilizationRegisterEntryDTO withSubCenter(String subCenter) { - this.subCenter = subCenter; - return this; - } - - public FemaleSterilizationRegisterEntryDTO withWifeAge(String wifeAge) { - this.wifeAge = wifeAge; - return this; - } - - public FemaleSterilizationRegisterEntryDTO withHusbandAge(String husbandAge) { - this.husbandAge = husbandAge; - return this; - } - - public FemaleSterilizationRegisterEntryDTO withCaste(String caste) { - this.caste = caste; - return this; - } - - public FemaleSterilizationRegisterEntryDTO withReligion(String religion) { - this.religion = religion; - return this; - } - - public FemaleSterilizationRegisterEntryDTO withNumberOfLivingMaleChildren(String numberOfLivingMaleChildren) { - this.numberOfLivingMaleChildren = numberOfLivingMaleChildren; - return this; - } - - public FemaleSterilizationRegisterEntryDTO withNumberOfLivingFemaleChildren(String numberOfLivingFemaleChildren) { - this.numberOfLivingFemaleChildren = numberOfLivingFemaleChildren; - return this; - } - - public FemaleSterilizationRegisterEntryDTO withWifeEducationLevel(String wifeEducationLevel) { - this.wifeEducationLevel = wifeEducationLevel; - return this; - } - - public FemaleSterilizationRegisterEntryDTO withHusbandEducationLevel(String husbandEducationLevel) { - this.husbandEducationLevel = husbandEducationLevel; - return this; - } - - public FemaleSterilizationRegisterEntryDTO withFpDetails(FemaleSterilizationFPDetailsDTO fpDetails) { - this.fpDetails = fpDetails; - return this; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/IUDFPDetailsDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/IUDFPDetailsDTO.java deleted file mode 100644 index 3dfe000ecb..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/IUDFPDetailsDTO.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.opensrp.dto.register; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class IUDFPDetailsDTO { - - @JsonProperty - private String fpAcceptanceDate; - - @JsonProperty - private String iudPlace; - - @JsonProperty - private String lmpDate; - - @JsonProperty - private String uptResult; - - public IUDFPDetailsDTO(String fpAcceptanceDate, String iudPlace, String lmpDate, String uptResult) { - this.fpAcceptanceDate = fpAcceptanceDate; - this.iudPlace = iudPlace; - this.lmpDate = lmpDate; - this.uptResult = uptResult; - } - - public String getFpAcceptanceDate() { - return fpAcceptanceDate; - } - - public String getIudPlace() { - return iudPlace; - } - - public String getLmpDate() { - return lmpDate; - } - - public String getUptResult() { - return uptResult; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/IUDRegisterEntryDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/IUDRegisterEntryDTO.java deleted file mode 100644 index d2af0aa413..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/IUDRegisterEntryDTO.java +++ /dev/null @@ -1,216 +0,0 @@ -package org.opensrp.dto.register; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class IUDRegisterEntryDTO { - - @JsonProperty - private String ecNumber; - - @JsonProperty - private String wifeName; - - @JsonProperty - private String husbandName; - - @JsonProperty - private String village; - - @JsonProperty - private String subCenter; - - @JsonProperty - private String wifeAge; - - @JsonProperty - private String husbandAge; - - @JsonProperty - private String caste; - - @JsonProperty - private String religion; - - @JsonProperty - private String numberOfLivingMaleChildren; - - @JsonProperty - private String numberOfLivingFemaleChildren; - - @JsonProperty - private String lmpDate; - - @JsonProperty - private String uptResult; - - @JsonProperty - private String wifeEducationLevel; - - @JsonProperty - private String husbandEducationLevel; - - @JsonProperty - private IUDFPDetailsDTO fpDetails; - - public String getEcNumber() { - return ecNumber; - } - - public String getWifeName() { - return wifeName; - } - - public String getHusbandName() { - return husbandName; - } - - public String getVillage() { - return village; - } - - public String getSubCenter() { - return subCenter; - } - - public String getWifeAge() { - return wifeAge; - } - - public String getHusbandAge() { - return husbandAge; - } - - public String getCaste() { - return caste; - } - - public String getReligion() { - return religion; - } - - public String getNumberOfLivingMaleChildren() { - return numberOfLivingMaleChildren; - } - - public String getNumberOfLivingFemaleChildren() { - return numberOfLivingFemaleChildren; - } - - public String getLmpDate() { - return lmpDate; - } - - public String getUptResult() { - return uptResult; - } - - public String getWifeEducationLevel() { - return wifeEducationLevel; - } - - public String getHusbandEducationLevel() { - return husbandEducationLevel; - } - - public IUDFPDetailsDTO getFpDetails() { - return fpDetails; - } - - public IUDRegisterEntryDTO withEcNumber(String ecNumber) { - this.ecNumber = ecNumber; - return this; - } - - public IUDRegisterEntryDTO withWifeName(String wifeName) { - this.wifeName = wifeName; - return this; - } - - public IUDRegisterEntryDTO withHusbandName(String husbandName) { - this.husbandName = husbandName; - return this; - } - - public IUDRegisterEntryDTO withVillage(String village) { - this.village = village; - return this; - } - - public IUDRegisterEntryDTO withSubCenter(String subCenter) { - this.subCenter = subCenter; - return this; - } - - public IUDRegisterEntryDTO withWifeAge(String wifeAge) { - this.wifeAge = wifeAge; - return this; - } - - public IUDRegisterEntryDTO withHusbandAge(String husbandAge) { - this.husbandAge = husbandAge; - return this; - } - - public IUDRegisterEntryDTO withCaste(String caste) { - this.caste = caste; - return this; - } - - public IUDRegisterEntryDTO withReligion(String religion) { - this.religion = religion; - return this; - } - - public IUDRegisterEntryDTO withNumberOfLivingMaleChildren(String numberOfLivingMaleChildren) { - this.numberOfLivingMaleChildren = numberOfLivingMaleChildren; - return this; - } - - public IUDRegisterEntryDTO withNumberOfLivingFemaleChildren(String numberOfLivingFemaleChildren) { - this.numberOfLivingFemaleChildren = numberOfLivingFemaleChildren; - return this; - } - - public IUDRegisterEntryDTO withLmpDate(String lmpDate) { - this.lmpDate = lmpDate; - return this; - } - - public IUDRegisterEntryDTO withUptResult(String uptResult) { - this.uptResult = uptResult; - return this; - } - - public IUDRegisterEntryDTO withWifeEducationLevel(String wifeEducationLevel) { - this.wifeEducationLevel = wifeEducationLevel; - return this; - } - - public IUDRegisterEntryDTO withHusbandEducationLevel(String husbandEducationLevel) { - this.husbandEducationLevel = husbandEducationLevel; - return this; - } - - public IUDRegisterEntryDTO withFpDetails(IUDFPDetailsDTO fpDetails) { - this.fpDetails = fpDetails; - return this; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/MaleSterilizationFPDetailsDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/MaleSterilizationFPDetailsDTO.java deleted file mode 100644 index 33f82a8f5b..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/MaleSterilizationFPDetailsDTO.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.opensrp.dto.register; - -import java.util.List; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class MaleSterilizationFPDetailsDTO { - - @JsonProperty - private String typeOfSterilization; - - @JsonProperty - private String sterilizationDate; - - @JsonProperty - private List followupVisitDates; - - public String getTypeOfSterilization() { - return typeOfSterilization; - } - - public String getSterilizationDate() { - return sterilizationDate; - } - - public List getFollowupVisitDates() { - return followupVisitDates; - } - - public MaleSterilizationFPDetailsDTO(String typeOfSterilization, String sterilizationDate, - List followupVisitDates) { - this.typeOfSterilization = typeOfSterilization; - this.sterilizationDate = sterilizationDate; - this.followupVisitDates = followupVisitDates; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/MaleSterilizationRegisterEntryDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/MaleSterilizationRegisterEntryDTO.java deleted file mode 100644 index 477a6e2995..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/MaleSterilizationRegisterEntryDTO.java +++ /dev/null @@ -1,192 +0,0 @@ -package org.opensrp.dto.register; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class MaleSterilizationRegisterEntryDTO { - - @JsonProperty - private String ecNumber; - - @JsonProperty - private String wifeName; - - @JsonProperty - private String husbandName; - - @JsonProperty - private String village; - - @JsonProperty - private String subCenter; - - @JsonProperty - private String wifeAge; - - @JsonProperty - private String husbandAge; - - @JsonProperty - private String caste; - - @JsonProperty - private String religion; - - @JsonProperty - private String numberOfLivingMaleChildren; - - @JsonProperty - private String numberOfLivingFemaleChildren; - - @JsonProperty - private String wifeEducationLevel; - - @JsonProperty - private String husbandEducationLevel; - - @JsonProperty - private MaleSterilizationFPDetailsDTO fpDetails; - - public String getEcNumber() { - return ecNumber; - } - - public String getWifeName() { - return wifeName; - } - - public String getHusbandName() { - return husbandName; - } - - public String getVillage() { - return village; - } - - public String getSubCenter() { - return subCenter; - } - - public String getWifeAge() { - return wifeAge; - } - - public String getHusbandAge() { - return husbandAge; - } - - public String getCaste() { - return caste; - } - - public String getReligion() { - return religion; - } - - public String getNumberOfLivingMaleChildren() { - return numberOfLivingMaleChildren; - } - - public String getNumberOfLivingFemaleChildren() { - return numberOfLivingFemaleChildren; - } - - public String getWifeEducationLevel() { - return wifeEducationLevel; - } - - public String getHusbandEducationLevel() { - return husbandEducationLevel; - } - - public MaleSterilizationFPDetailsDTO getFpDetails() { - return fpDetails; - } - - public MaleSterilizationRegisterEntryDTO withEcNumber(String ecNumber) { - this.ecNumber = ecNumber; - return this; - } - - public MaleSterilizationRegisterEntryDTO withWifeName(String wifeName) { - this.wifeName = wifeName; - return this; - } - - public MaleSterilizationRegisterEntryDTO withHusbandName(String husbandName) { - this.husbandName = husbandName; - return this; - } - - public MaleSterilizationRegisterEntryDTO withVillage(String village) { - this.village = village; - return this; - } - - public MaleSterilizationRegisterEntryDTO withSubCenter(String subCenter) { - this.subCenter = subCenter; - return this; - } - - public MaleSterilizationRegisterEntryDTO withWifeAge(String wifeAge) { - this.wifeAge = wifeAge; - return this; - } - - public MaleSterilizationRegisterEntryDTO withHusbandAge(String husbandAge) { - this.husbandAge = husbandAge; - return this; - } - - public MaleSterilizationRegisterEntryDTO withCaste(String caste) { - this.caste = caste; - return this; - } - - public MaleSterilizationRegisterEntryDTO withReligion(String religion) { - this.religion = religion; - return this; - } - - public MaleSterilizationRegisterEntryDTO withNumberOfLivingMaleChildren(String numberOfLivingMaleChildren) { - this.numberOfLivingMaleChildren = numberOfLivingMaleChildren; - return this; - } - - public MaleSterilizationRegisterEntryDTO withNumberOfLivingFemaleChildren(String numberOfLivingFemaleChildren) { - this.numberOfLivingFemaleChildren = numberOfLivingFemaleChildren; - return this; - } - - public MaleSterilizationRegisterEntryDTO withWifeEducationLevel(String wifeEducationLevel) { - this.wifeEducationLevel = wifeEducationLevel; - return this; - } - - public MaleSterilizationRegisterEntryDTO withHusbandEducationLevel(String husbandEducationLevel) { - this.husbandEducationLevel = husbandEducationLevel; - return this; - } - - public MaleSterilizationRegisterEntryDTO withFpDetails(MaleSterilizationFPDetailsDTO fpDetails) { - this.fpDetails = fpDetails; - return this; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/OCPFPDetailsDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/OCPFPDetailsDTO.java deleted file mode 100644 index ceb6d7962f..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/OCPFPDetailsDTO.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.opensrp.dto.register; - -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class OCPFPDetailsDTO { - - @JsonProperty - private String fpAcceptanceDate; - - @JsonProperty - private List> refills; - - @JsonProperty - private String lmpDate; - - @JsonProperty - private String uptResult; - - public OCPFPDetailsDTO(String fpAcceptanceDate, List> refills, String lmpDate, String uptResult) { - this.fpAcceptanceDate = fpAcceptanceDate; - this.refills = refills; - this.lmpDate = lmpDate; - this.uptResult = uptResult; - } - - public String getFpAcceptanceDate() { - return fpAcceptanceDate; - } - - public List> getRefills() { - return refills; - } - - public String getLmpDate() { - return lmpDate; - } - - public String getUptResult() { - return uptResult; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/OCPRegisterEntryDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/OCPRegisterEntryDTO.java deleted file mode 100644 index b1529f9871..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/OCPRegisterEntryDTO.java +++ /dev/null @@ -1,204 +0,0 @@ -package org.opensrp.dto.register; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class OCPRegisterEntryDTO { - - @JsonProperty - private String ecNumber; - - @JsonProperty - private String wifeName; - - @JsonProperty - private String husbandName; - - @JsonProperty - private String village; - - @JsonProperty - private String subCenter; - - @JsonProperty - private String wifeAge; - - @JsonProperty - private String caste; - - @JsonProperty - private String religion; - - @JsonProperty - private String numberOfLivingMaleChildren; - - @JsonProperty - private String numberOfLivingFemaleChildren; - - @JsonProperty - private String lmpDate; - - @JsonProperty - private String uptResult; - - @JsonProperty - private String wifeEducationLevel; - - @JsonProperty - private String husbandEducationLevel; - - @JsonProperty - private OCPFPDetailsDTO fpDetails; - - public String getEcNumber() { - return ecNumber; - } - - public String getWifeName() { - return wifeName; - } - - public String getHusbandName() { - return husbandName; - } - - public String getVillage() { - return village; - } - - public String getSubCenter() { - return subCenter; - } - - public String getWifeAge() { - return wifeAge; - } - - public String getCaste() { - return caste; - } - - public String getReligion() { - return religion; - } - - public String getNumberOfLivingMaleChildren() { - return numberOfLivingMaleChildren; - } - - public String getNumberOfLivingFemaleChildren() { - return numberOfLivingFemaleChildren; - } - - public String getLmpDate() { - return lmpDate; - } - - public String getUptResult() { - return uptResult; - } - - public String getWifeEducationLevel() { - return wifeEducationLevel; - } - - public String getHusbandEducationLevel() { - return husbandEducationLevel; - } - - public OCPFPDetailsDTO getFpDetails() { - return fpDetails; - } - - public OCPRegisterEntryDTO withEcNumber(String ecNumber) { - this.ecNumber = ecNumber; - return this; - } - - public OCPRegisterEntryDTO withWifeName(String wifeName) { - this.wifeName = wifeName; - return this; - } - - public OCPRegisterEntryDTO withHusbandName(String husbandName) { - this.husbandName = husbandName; - return this; - } - - public OCPRegisterEntryDTO withVillage(String village) { - this.village = village; - return this; - } - - public OCPRegisterEntryDTO withSubCenter(String subCenter) { - this.subCenter = subCenter; - return this; - } - - public OCPRegisterEntryDTO withWifeAge(String wifeAge) { - this.wifeAge = wifeAge; - return this; - } - - public OCPRegisterEntryDTO withCaste(String caste) { - this.caste = caste; - return this; - } - - public OCPRegisterEntryDTO withReligion(String religion) { - this.religion = religion; - return this; - } - - public OCPRegisterEntryDTO withNumberOfLivingMaleChildren(String numberOfLivingMaleChildren) { - this.numberOfLivingMaleChildren = numberOfLivingMaleChildren; - return this; - } - - public OCPRegisterEntryDTO withNumberOfLivingFemaleChildren(String numberOfLivingFemaleChildren) { - this.numberOfLivingFemaleChildren = numberOfLivingFemaleChildren; - return this; - } - - public OCPRegisterEntryDTO withLmpDate(String lmpDate) { - this.lmpDate = lmpDate; - return this; - } - - public OCPRegisterEntryDTO withUptResult(String uptResult) { - this.uptResult = uptResult; - return this; - } - - public OCPRegisterEntryDTO withWifeEducationLevel(String wifeEducationLevel) { - this.wifeEducationLevel = wifeEducationLevel; - return this; - } - - public OCPRegisterEntryDTO withHusbandEducationLevel(String husbandEducationLevel) { - this.husbandEducationLevel = husbandEducationLevel; - return this; - } - - public OCPRegisterEntryDTO withFpDetails(OCPFPDetailsDTO fpDetails) { - this.fpDetails = fpDetails; - return this; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/PNCRegisterDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/PNCRegisterDTO.java deleted file mode 100644 index a9b9b9f686..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/PNCRegisterDTO.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.opensrp.dto.register; - -import java.util.List; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class PNCRegisterDTO { - - @JsonProperty - private List pncRegisterEntries; - - public PNCRegisterDTO(List pncRegisterEntries) { - this.pncRegisterEntries = pncRegisterEntries; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/PNCRegisterEntryDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/PNCRegisterEntryDTO.java deleted file mode 100644 index faa6a28db8..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/PNCRegisterEntryDTO.java +++ /dev/null @@ -1,148 +0,0 @@ -package org.opensrp.dto.register; - -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class PNCRegisterEntryDTO { - - @JsonProperty - private String registrationDate; - - @JsonProperty - private String thayiCardNumber; - - @JsonProperty - private String wifeName; - - @JsonProperty - private String husbandName; - - @JsonProperty - private String wifeDOB; - - @JsonProperty - private String address; - - @JsonProperty - private String dateOfDelivery; - - @JsonProperty - private String placeOfDelivery; - - @JsonProperty - private String typeOfDelivery; - - @JsonProperty - private String dischargeDate; - - @JsonProperty - private String fpMethodName; - - @JsonProperty - private String fpMethodDate; - - @JsonProperty - private String deliveryComplications; - - @JsonProperty - private List> childrenDetails; - - @JsonProperty - private List pncVisits; - - public PNCRegisterEntryDTO withRegistrationDate(String registrationDate) { - this.registrationDate = registrationDate; - return this; - } - - public PNCRegisterEntryDTO withThayiCardNumber(String thayiCardNumber) { - this.thayiCardNumber = thayiCardNumber; - return this; - } - - public PNCRegisterEntryDTO withWifeName(String wifeName) { - this.wifeName = wifeName; - return this; - } - - public PNCRegisterEntryDTO withHusbandName(String husbandName) { - this.husbandName = husbandName; - return this; - } - - public PNCRegisterEntryDTO withWifeDOB(String wifeDOB) { - this.wifeDOB = wifeDOB; - return this; - } - - public PNCRegisterEntryDTO withAddress(String address) { - this.address = address; - return this; - } - - public PNCRegisterEntryDTO withDateOfDelivery(String dateOfDelivery) { - this.dateOfDelivery = dateOfDelivery; - return this; - } - - public PNCRegisterEntryDTO withPlaceOfDelivery(String placeOfDelivery) { - this.placeOfDelivery = placeOfDelivery; - return this; - } - - public PNCRegisterEntryDTO withTypeOfDelivery(String typeOfDelivery) { - this.typeOfDelivery = typeOfDelivery; - return this; - } - - public PNCRegisterEntryDTO withDischargeDate(String dischargeDate) { - this.dischargeDate = dischargeDate; - return this; - } - - public PNCRegisterEntryDTO withFPMethodName(String fpMethodName) { - this.fpMethodName = fpMethodName; - return this; - } - - public PNCRegisterEntryDTO withFPMethodDate(String fpMethodDate) { - this.fpMethodDate = fpMethodDate; - return this; - } - - public PNCRegisterEntryDTO withDeliveryComplications(String deliveryComplications) { - this.deliveryComplications = deliveryComplications; - return this; - } - - public PNCRegisterEntryDTO withChildrenDetails(List> childrenDetails) { - this.childrenDetails = childrenDetails; - return this; - } - - public PNCRegisterEntryDTO withPNCVisits(List pncVisits) { - this.pncVisits = pncVisits; - return this; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/register/PNCVisitDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/register/PNCVisitDTO.java deleted file mode 100644 index 6751f94592..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/register/PNCVisitDTO.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.opensrp.dto.register; - -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; - -public class PNCVisitDTO { - - @JsonProperty - private String date; - - @JsonProperty - private String person; - - @JsonProperty - private String place; - - @JsonProperty - private String difficulties; - - @JsonProperty - private String abdominalProblems; - - @JsonProperty - private String vaginalProblems; - - @JsonProperty - private String urinalProblems; - - @JsonProperty - private String breastProblems; - - @JsonProperty - private List> childrenDetails; - - public PNCVisitDTO withDate(String date) { - this.date = date; - return this; - } - - public PNCVisitDTO withPerson(String person) { - this.person = person; - return this; - } - - public PNCVisitDTO withPlace(String place) { - this.place = place; - return this; - } - - public PNCVisitDTO withDifficulties(String difficulties) { - this.difficulties = difficulties; - return this; - } - - public PNCVisitDTO withAbdominalProblems(String abdominalProblems) { - this.abdominalProblems = abdominalProblems; - return this; - } - - public PNCVisitDTO withVaginalProblems(String vaginalProblems) { - this.vaginalProblems = vaginalProblems; - return this; - } - - public PNCVisitDTO withUrinalProblems(String urinalProblems) { - this.urinalProblems = urinalProblems; - return this; - } - - public PNCVisitDTO withBreastProblems(String breastProblems) { - this.breastProblems = breastProblems; - return this; - } - - public PNCVisitDTO withChildrenDetails(List> childrenDetails) { - this.childrenDetails = childrenDetails; - return this; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/report/AggregatedReportsDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/report/AggregatedReportsDTO.java deleted file mode 100644 index baba0f9383..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/report/AggregatedReportsDTO.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.opensrp.dto.report; - -import java.util.Map; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; -import org.opensrp.dto.LocationDTO; - -public class AggregatedReportsDTO { - - @JsonProperty - private Map ind; - - @JsonProperty - private LocationDTO loc; - - public AggregatedReportsDTO(Map indicatorSummary, LocationDTO loc) { - this.ind = indicatorSummary; - this.loc = loc; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/main/java/org/opensrp/dto/report/ServiceProvidedReportDTO.java b/opensrp-interface/src/main/java/org/opensrp/dto/report/ServiceProvidedReportDTO.java deleted file mode 100644 index 026ee984fc..0000000000 --- a/opensrp-interface/src/main/java/org/opensrp/dto/report/ServiceProvidedReportDTO.java +++ /dev/null @@ -1,155 +0,0 @@ -package org.opensrp.dto.report; - -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.codehaus.jackson.annotate.JsonProperty; -import org.joda.time.LocalDate; - -public class ServiceProvidedReportDTO { - - @JsonProperty - private Integer id; - - @JsonProperty - private String anm_identifier; - - @JsonProperty - private String type; - - @JsonProperty - private String indicator; - - @JsonProperty - private LocalDate reported_date; - - @JsonProperty - private Integer nrhm_report_month; - - @JsonProperty - private Integer nrhm_report_year; - - @JsonProperty - private String village; - - @JsonProperty - private String sub_center; - - @JsonProperty - private String phc; - - @JsonProperty - private String taluka; - - @JsonProperty - private String district; - - @JsonProperty - private String state; - - public ServiceProvidedReportDTO(Integer id, String anm_identifier, String type, String indicator, - LocalDate reported_date, String village, String sub_center, String phc, String taluka, String district, - String state) { - this.id = id; - this.anm_identifier = anm_identifier; - this.type = type; - this.indicator = indicator; - this.reported_date = reported_date; - this.village = village; - this.sub_center = sub_center; - this.phc = phc; - this.taluka = taluka; - this.district = district; - this.state = state; - } - - public ServiceProvidedReportDTO() { - } - - public ServiceProvidedReportDTO withId(Integer id) { - this.id = id; - return this; - } - - public ServiceProvidedReportDTO withNRHMReportMonth(Integer month) { - this.nrhm_report_month = month; - return this; - } - - public ServiceProvidedReportDTO withNRHMReportYear(Integer year) { - this.nrhm_report_year = year; - return this; - } - - public ServiceProvidedReportDTO withDate(LocalDate date) { - this.reported_date = date; - return this; - } - - public Integer getId() { - return id; - } - - public String getAnm_identifier() { - return anm_identifier; - } - - public String getType() { - return type; - } - - public String getIndicator() { - return indicator; - } - - public LocalDate getReported_date() { - return reported_date; - } - - public Integer getNrhm_report_month() { - return nrhm_report_month; - } - - public Integer getNrhm_report_year() { - return nrhm_report_year; - } - - public String getVillage() { - return village; - } - - public String getSub_center() { - return sub_center; - } - - public String getPhc() { - return phc; - } - - public String getTaluka() { - return taluka; - } - - public String getDistrict() { - return district; - } - - public String getState() { - return state; - } - - @Override - public final boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o); - } - - @Override - public final int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/ANMDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/ANMDTOTest.java deleted file mode 100755 index 2fd48cef60..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/ANMDTOTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.opensrp.dto; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import static org.junit.Assert.*; - -public class ANMDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(ANMDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(ANMDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToString() { - String sub_center = "nandanpur"; - String district = "luxmipur"; - LocationDTO locationDTO = new LocationDTO(sub_center, "", "", district, ""); - String name = "1971"; - ANMDTO anmdto = new ANMDTO("", name, locationDTO); - - assertEquals("1971", anmdto.getName()); - assertNotSame("xyz", anmdto.getIdentifier()); - - assertTrue(anmdto.getLocation().toString().contains("sub_center=nandanpur")); - assertFalse(anmdto.toString().contains("district=dhaka")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/ActionDataTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/ActionDataTest.java deleted file mode 100755 index 09bb4d468e..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/ActionDataTest.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.opensrp.dto; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.joda.time.DateTime; -import org.joda.time.LocalDate; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.*; - -public class ActionDataTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(ActionData.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(ActionData.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testCreateAlert() { - String dateString = "2017-07-20"; - DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); - DateTime dt = formatter.parseDateTime(dateString); - AlertStatus alertStatus = AlertStatus.closed; - DateTime startDate = dt; - DateTime expiryDate = dt; - - ActionData actionData = ActionData.createAlert(BeneficiaryType.mother.toString(), ActionData.SCHEDULE_NAME, - ActionData.VISIT_CODE, alertStatus, startDate, expiryDate); - assertEquals("alert", actionData.getTarget()); - assertEquals("createAlert", actionData.getType()); - assertNotSame("xyz", actionData.getTarget()); - - assertEquals("mother", actionData.getData().get(ActionData.BENEFICIARY_TYPE)); - assertEquals("2017-07-20", actionData.getData().get(ActionData.START_DATE)); - assertNotSame(new DateTime().toLocalDate().toString(), actionData.getData().get(ActionData.START_DATE)); - - assertTrue(actionData.toString().contains("alert")); - assertFalse(actionData.toString().contains("Hooooooooo")); - } - - @Test - public void testMarkAlertAsClosed() { - ActionData actionData = ActionData.markAlertAsClosed(ActionData.VISIT_CODE, ActionData.COMPLETION_DATE); - assertEquals("closeAlert", actionData.getType()); - assertNotSame("createAlert", actionData.getType()); - - assertEquals("visitCode", actionData.getData().get(ActionData.VISIT_CODE)); - assertEquals("completionDate", actionData.getData().get(ActionData.COMPLETION_DATE)); - assertNotSame("Habijabi", actionData.getData().get(ActionData.COMPLETION_DATE)); - } - - @Test - public void testreportForIndicator() { - ActionData actionData = ActionData.reportForIndicator("", ActionData.ANNUAL_TARGET, ActionData.MONTHLY_SUMMARIES); - assertEquals("report", actionData.getTarget()); - assertNotSame("indicator", actionData.getType()); - - assertEquals("annualTarget", actionData.getData().get(ActionData.ANNUAL_TARGET)); - assertEquals("monthlySummaries", actionData.getData().get(ActionData.MONTHLY_SUMMARIES)); - assertNotSame("Habijabi", actionData.getData().get(ActionData.ANNUAL_TARGET)); - } - - @Test - public void testcloseBeneficiary() { - ActionData actionData = ActionData.closeBeneficiary("", ActionData.REASON_FOR_CLOSE); - assertEquals("close", actionData.getType()); - assertNotSame("target", actionData.getTarget()); - - assertEquals("reasonForClose", actionData.getData().get(ActionData.REASON_FOR_CLOSE)); - assertNotSame("Habijabi", actionData.getData().get(ActionData.REASON_FOR_CLOSE)); - } - - @Test - public void testFrom() { - Map dataMap = new HashMap<>(); - dataMap.put(BeneficiaryType.child.toString(), "khuki"); - Map detailsMap = new HashMap<>(); - detailsMap.put("village", "nandanpur"); - detailsMap.put("district", "luxmipur"); - String actionType = "type"; - String actionTarget = "actionTarget"; - ActionData actionData = ActionData.from(actionType, actionTarget, dataMap, detailsMap); - - assertEquals("type", actionData.getType()); - assertNotSame("target", actionData.getTarget()); - - - assertEquals("khuki", actionData.getData().get(BeneficiaryType.child.toString())); - assertEquals("luxmipur", actionData.getDetails().get("district")); - assertNotSame("gangapur", actionData.getDetails().get("village")); - - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/ActionTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/ActionTest.java deleted file mode 100755 index d0da559def..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/ActionTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.opensrp.dto; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -public class ActionTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(Action.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(Action.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToStringAndConstructor() { - String caseID = "AAA7"; - String actionTarget = ""; - String actionType = ""; - Map dataMap = new HashMap<>(); - dataMap.put("1", "data1"); - dataMap.put("2", "data2"); - String timeStamp = ""; - Boolean isActionActive = true; - Map detailsMapd = new HashMap<>(); - Action action = new Action(caseID, actionTarget, actionType, dataMap, timeStamp, isActionActive, detailsMapd); - assertEquals("data2", action.get("2")); - assertTrue(action.toString().contains(caseID)); - assertFalse(action.toString().contains("80%")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/MonthSummaryDatumTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/MonthSummaryDatumTest.java deleted file mode 100755 index d6923eb469..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/MonthSummaryDatumTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.opensrp.dto; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.*; - -public class MonthSummaryDatumTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(MonthSummaryDatum.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(MonthSummaryDatum.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToStringAndConstructors() { - List externalIDsList = new ArrayList<>(); - externalIDsList.add("999"); - String month = "7"; - String year = "2017"; - String currentProgress = "80%"; - String aggregatedProgress = "50%"; - MonthSummaryDatum monthSummaryDatum = new MonthSummaryDatum(month, year, currentProgress, aggregatedProgress, externalIDsList); - - assertEquals("7", monthSummaryDatum.getMonth()); - assertNotSame("2018", monthSummaryDatum.getYear()); - - assertTrue(monthSummaryDatum.toString().contains(currentProgress)); - assertFalse(monthSummaryDatum.toString().contains("898")); - - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/VillagesDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/VillagesDTOTest.java deleted file mode 100755 index 3d3f59c24a..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/VillagesDTOTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.opensrp.dto; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.*; - -public class VillagesDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(VillagesDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(VillagesDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - - @Test - public void testToString() { - String sub_center = "nandanpur"; - String district = "luxmipur"; - List villagesList = new ArrayList<>(); - VillagesDTO villagesDTO = new VillagesDTO(district, "", "", sub_center, villagesList); - System.out.println(villagesDTO.toString()); - assertEquals("luxmipur", villagesDTO.getDistrict()); - assertNotSame("xyz", villagesDTO.getPhcIdentifier()); - - assertTrue(villagesDTO.toString().contains("subCenter=nandanpur")); - assertFalse(villagesDTO.toString().contains("district=dhaka")); - } - -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/aggregatorResponse/AggregatorResponseDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/aggregatorResponse/AggregatorResponseDTOTest.java deleted file mode 100755 index 130d51f10a..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/aggregatorResponse/AggregatorResponseDTOTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.opensrp.dto.aggregatorResponse; - - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertTrue; - -/** - * Created by real on 13/07/17. - */ -public class AggregatorResponseDTOTest { - @Test - public void testConstructorsNGetters() { - AggregatorResponseDTO aggregatorResponseDTO = new AggregatorResponseDTO("indicator", 7); - assertEquals("indicator", aggregatorResponseDTO.indicator()); - assertNotSame("no Indicator", aggregatorResponseDTO.indicator()); - - assertEquals((Integer) 7, aggregatorResponseDTO.count()); - assertNotSame((Integer) 8, aggregatorResponseDTO.count()); - - assertTrue(aggregatorResponseDTO.toString().contains("indicator=indicator")); - assertFalse(aggregatorResponseDTO.toString().contains("nrhm_report_indicator_count=3")); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(AggregatorResponseDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/form/FormSubmissionDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/form/FormSubmissionDTOTest.java deleted file mode 100755 index f484db663c..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/form/FormSubmissionDTOTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.opensrp.dto.form; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import static org.junit.Assert.*; - -/** - * Created by real on 13/07/17. - */ -public class FormSubmissionDTOTest { - - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(FormSubmissionDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(FormSubmissionDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testWithServerVersion() { - FormSubmissionDTO formSubmissionDTO = new FormSubmissionDTO("anmId", "hi", "", "", "", "", ""); - formSubmissionDTO.withServerVersion("version"); - assertEquals("version", formSubmissionDTO.getServerVersion()); - assertNotSame("null ", formSubmissionDTO.getServerVersion()); - - assertTrue(formSubmissionDTO.toString().contains("anmId=anmId")); - assertFalse(formSubmissionDTO.toString().contains("instanceId=instanceId")); - } -} - diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/form/MultimediaDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/form/MultimediaDTOTest.java deleted file mode 100755 index b075b0c6f9..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/form/MultimediaDTOTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.opensrp.dto.form; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import static org.junit.Assert.*; - - -/** - * Created by real on 13/07/17. - */ -public class MultimediaDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(MultimediaDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(MultimediaDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testWithFilePath_Constructor_toString() { - MultimediaDTO multimediaDTO = new MultimediaDTO("786", "", "", "", ""); - multimediaDTO.withFilePath("desktop"); - assertEquals("desktop", multimediaDTO.getFilePath()); - assertNotSame("home", multimediaDTO.getFilePath()); - - assertTrue(multimediaDTO.toString().contains("caseId=786")); - assertFalse(multimediaDTO.toString().contains("providerId=222")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/ANCRegisterDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/ANCRegisterDTOTest.java deleted file mode 100755 index 7670484efc..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/ANCRegisterDTOTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.opensrp.dto.register; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -/** - * Created by real on 13/07/17. - */ -public class ANCRegisterDTOTest { - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(ANCRegisterDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testConstructor_toString() { - List ancRegisterEntries = new ArrayList<>(); - ANCRegisterEntryDTO ancRegisterEntryDTO = new ANCRegisterEntryDTO(); - ancRegisterEntries.add(ancRegisterEntryDTO.withANCNumber("anc1")); - ANCRegisterDTO ancRegisterDTO = new ANCRegisterDTO(ancRegisterEntries); - - assertTrue(ancRegisterDTO.toString().contains("ancNumber=anc1")); - assertFalse(ancRegisterDTO.toString().contains("registrationDate=2017-07-13")); - } - -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/ANCRegisterEntryDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/ANCRegisterEntryDTOTest.java deleted file mode 100755 index fa53c2777c..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/ANCRegisterEntryDTOTest.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -/** - * Created by real on 13/07/17. - */ -public class ANCRegisterEntryDTOTest { - - @Test - public void testWithANCNumber() { - Map mapUtils = new HashMap<>(); - mapUtils.put("key", "value"); - - List> ancVisitsList = new ArrayList<>(); - ancVisitsList.add(mapUtils); - - List> ifaTabletsList = new ArrayList<>(); - ifaTabletsList.add(mapUtils); - - List> ttDosesList = new ArrayList<>(); - ttDosesList.add(mapUtils); - - List> hbTestsList = new ArrayList<>(); - hbTestsList.add(mapUtils); - - List> ancInvestigationsList = new ArrayList<>(); - ancInvestigationsList.add(mapUtils); - - ANCRegisterEntryDTO ancRegisterEntryDTO = new ANCRegisterEntryDTO() - .withANCNumber("anc1") - .withRegistrationDate("registrationDate") - .withECNumber("") - .withThayiCardNumber("") - .withAadharCardNumber("") - .withWifeName("") - .withHusbandName("") - .withAddress("") - .withWifeDOB("") - .withPhoneNumber("") - .withWifeEducationLevel("") - .withHusbandEducationLevel("") - .withCaste("") - .withReligion("") - .withEconomicStatus("") - .withBPLCardNumber("") - .withJSYBeneficiary("") - .withGravida("") - .withParity("") - .withNumberOfLivingChildren("") - .withNumberOfStillBirths("") - .withNumberOfAbortions("") - .withYoungestChildDOB("") - .withLMP("") - .withEDD("") - .withHeight("") - .withBloodGroup("") - .withIsHRP("") - .withANCVisits(ancVisitsList) - .withIFATablets(ifaTabletsList) - .withTTDoses(ttDosesList) - .withHBTests(hbTestsList) - .withANCInvestigations(ancInvestigationsList); - System.out.println(ancRegisterEntryDTO.toString()); - - assertTrue(ancRegisterEntryDTO.toString().contains("ancNumber=anc1")); - assertFalse(ancRegisterEntryDTO.toString().contains("husbandName=real")); - } - - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(ANCRegisterEntryDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(ANCRegisterEntryDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/ANMDetailDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/ANMDetailDTOTest.java deleted file mode 100755 index 58f8e20763..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/ANMDetailDTOTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.LocationDTO; -import org.opensrp.dto.utils.PojoTestUtils; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -/** - * Created by real on 13/07/17. - */ -public class ANMDetailDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(ANMDetailDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(ANMDetailDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToString() { - LocationDTO location = new LocationDTO("nandanpur", "", "", "", ""); - ANMDetailDTO anmDetailDTO = new ANMDetailDTO("", "real", location, 1, 2, 3, 4, 5); - assertTrue(anmDetailDTO.toString().contains("name=real")); - assertFalse(anmDetailDTO.toString().contains("identifier= 123")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/ANMDetailsDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/ANMDetailsDTOTest.java deleted file mode 100755 index 1bac0d060f..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/ANMDetailsDTOTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.LocationDTO; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -/** - * Created by real on 13/07/17. - */ -public class ANMDetailsDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(ANMDetailsDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(ANMDetailsDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testConstructorAndToString() { - List anmDetailList = new ArrayList<>(); - LocationDTO location = new LocationDTO("nandanpur", "", "", "", ""); - ANMDetailDTO anmDetailDTO = new ANMDetailDTO("", "real", location, 1, 2, 3, 4, 5); - anmDetailList.add(anmDetailDTO); - ANMDetailsDTO anmDetailsDTO = new ANMDetailsDTO(anmDetailList); - - assertTrue(anmDetailsDTO.toString().contains("name=real")); - assertTrue(anmDetailsDTO.toString().contains("sub_center=nandanpur")); - assertFalse(anmDetailsDTO.toString().contains("district= luxmipur")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/ChildRegisterDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/ChildRegisterDTOTest.java deleted file mode 100755 index 248b4fd9cc..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/ChildRegisterDTOTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -/** - * Created by real on 17/07/17. - */ -public class ChildRegisterDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(ChildRegisterDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(ChildRegisterDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToStringOfChildRegisterDTO() { - ChildRegisterEntryDTO childRegisterEntryDTO = new ChildRegisterEntryDTO().withVillage("gangapur"); - List childRegisterEntriesList = new ArrayList<>(); - childRegisterEntriesList.add(childRegisterEntryDTO); - - ChildRegisterDTO childRegisterDTO = new ChildRegisterDTO(childRegisterEntriesList); - assertTrue(childRegisterDTO.toString().contains("village=gangapur")); - assertFalse(childRegisterDTO.toString().contains("thayiCardNumber=19945114390000347")); - - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/ChildRegisterEntryDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/ChildRegisterEntryDTOTest.java deleted file mode 100755 index a77f4245ba..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/ChildRegisterEntryDTOTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class ChildRegisterEntryDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(ChildRegisterEntryDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(ChildRegisterEntryDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testSettersOfChildRegisterEntryDTO() { - Map immunizationsMap = new HashMap<>(); - immunizationsMap.put("1", "sunday"); - Map vitaminADosesMap = new HashMap<>(); - vitaminADosesMap.put("1", "vitamin A"); - - ChildRegisterEntryDTO childRegisterEntryDTO = new ChildRegisterEntryDTO(); - childRegisterEntryDTO.withThayiCardNumber(""); - childRegisterEntryDTO.withWifeName(""); - childRegisterEntryDTO.withHusbandName("real"); - childRegisterEntryDTO.withVillage("nandanpur"); - childRegisterEntryDTO.withSubCenter(""); - childRegisterEntryDTO.withWifeDOB(""); - childRegisterEntryDTO.withDOB(""); - childRegisterEntryDTO.withImmunizations(immunizationsMap); - childRegisterEntryDTO.withVitaminADoses(vitaminADosesMap); - - //System.out.println(childRegisterEntryDTO.toString()); - assertTrue(childRegisterEntryDTO.toString().contains("village=nandanpur")); - assertTrue(childRegisterEntryDTO.toString().contains("vitaminADoses={1=vitamin A}")); - assertFalse(childRegisterEntryDTO.toString().contains("husband=mamun")); - - - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/CondomFPDetailsDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/CondomFPDetailsDTOTest.java deleted file mode 100755 index 2cd98a6d5b..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/CondomFPDetailsDTOTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class CondomFPDetailsDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(CondomFPDetailsDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(CondomFPDetailsDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToString() { - Map map = new HashMap<>(); - List> refillsList = new ArrayList<>(); - map.put("a", "panther"); - map.put("b", "raja"); - refillsList.add(map); - CondomFPDetailsDTO condomFPDetailsDTO = new CondomFPDetailsDTO("19-07-2017", refillsList); - - assertTrue(condomFPDetailsDTO.toString().contains("fpAcceptanceDate=19-07-2017")); - assertTrue(condomFPDetailsDTO.toString().contains("a=panther")); - assertFalse(condomFPDetailsDTO.toString().contains("b=sensation")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/CondomRegisterEntryDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/CondomRegisterEntryDTOTest.java deleted file mode 100755 index 3e32d4ae7f..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/CondomRegisterEntryDTOTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class CondomRegisterEntryDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(CondomRegisterEntryDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(CondomRegisterEntryDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToString() { - Map map = new HashMap<>(); - List> refillsList = new ArrayList<>(); - map.put("a", "panther"); - map.put("b", "raja"); - refillsList.add(map); - CondomFPDetailsDTO condomFPDetailsDTO = new CondomFPDetailsDTO("19-07-2017", refillsList); - - CondomRegisterEntryDTO condomRegisterEntryDTO = new CondomRegisterEntryDTO().withEcNumber("") - .withWifeName("akhi") - .withHusbandName("") - .withVillage("gangapur") - .withSubCenter("nandanpur") - .withWifeAge("16") - .withCaste("") - .withReligion("") - .withNumberOfLivingMaleChildren("") - .withNumberOfLivingFemaleChildren("") - .withHusbandEducationLevel("") - .withWifeEducationLevel("") - .withFpDetails(condomFPDetailsDTO); - - assertTrue(condomRegisterEntryDTO.toString().contains("wifeName=akhi")); - assertFalse(condomRegisterEntryDTO.toString().contains("wifeAge=18")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/ECRegisterDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/ECRegisterDTOTest.java deleted file mode 100755 index ccfbd4ed7b..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/ECRegisterDTOTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class ECRegisterDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(ECRegisterDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(ECRegisterDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToString() { - List ecRegisterEntriesList = new ArrayList<>(); - ECRegisterEntryDTO ecRegisterEntryDTO = new ECRegisterEntryDTO().withVillage("nandanpur"); - ecRegisterEntriesList.add(ecRegisterEntryDTO); - - ECRegisterDTO ecRegisterDTO = new ECRegisterDTO(ecRegisterEntriesList); - - assertTrue(ecRegisterDTO.toString().contains("village=nandanpur")); - assertFalse(ecRegisterDTO.toString().contains("wifeAge=18")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/ECRegisterEntryDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/ECRegisterEntryDTOTest.java deleted file mode 100755 index 5b4072ebcf..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/ECRegisterEntryDTOTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - -public class ECRegisterEntryDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(ECRegisterEntryDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(ECRegisterEntryDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToStringAndSetters() { - String headOfHousehold = "shawpan"; - String village = "gangpapur"; - ECRegisterEntryDTO ecRegisterEntryDTO = new ECRegisterEntryDTO() - .withRegistrationDate("") - .withECNumber("") - .withWifeName("") - .withHusbandName("") - .withHouseholdAddress("") - .withHouseholdNumber("") - .withHeadOfHousehold(headOfHousehold) - .withVillage(village) - .withSubCenter("") - .withPHC("") - .withWifeAge("") - .withWifeEducationLevel("") - .withHusbandAge("") - .withHusbandEducationLevel("") - .withCaste("") - .withReligion("") - .withEconomicStatus("") - .withGravida("") - .withParity("") - .withNumberOfAbortions("") - .withNumberOfLivingChildren("") - .withNumberOfLivingFemaleChildren("") - .withNumberOfLivingMaleChildren("") - .withNumberOfStillBirths("") - .withYoungestChildAge("") - .withCurrentFPMethod("") - .withCurrentFPMethodStartDate("") - .withPregnancyStatus(""); - - assertTrue(ecRegisterEntryDTO.toString().contains("village=gangpapur")); - assertFalse(ecRegisterEntryDTO.toString().contains("wifeAge=18")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/EntityDetailDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/EntityDetailDTOTest.java deleted file mode 100755 index 3ea4de8887..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/EntityDetailDTOTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class EntityDetailDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(EntityDetailDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(EntityDetailDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToStringAndSetters() { - String entityId = "x2"; - String type = "private"; - final String anmIdentifier = ""; - EntityDetailDTO entityDetailDTO = new EntityDetailDTO() - .withEntityID(entityId) - .withEntityType(type) - .withThayiCardNumber("") - .withECNumber("") - .withANMIdentifier(anmIdentifier); - assertTrue(entityDetailDTO.toString().contains(entityId)); - assertFalse(entityDetailDTO.toString().contains("anmIdentifier=boss")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/FPRegisterDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/FPRegisterDTOTest.java deleted file mode 100755 index 6f1a4201dd..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/FPRegisterDTOTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class FPRegisterDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(FPRegisterDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(FPRegisterDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToStringAndSetters() { - List iudRegisterEntriesList = new ArrayList<>(); - String husbandName = "sajid"; - IUDRegisterEntryDTO iudRegisterEntryDTO = new IUDRegisterEntryDTO().withHusbandName(husbandName); - iudRegisterEntriesList.add(iudRegisterEntryDTO); - - List condomRegisterEntriesList = new ArrayList<>(); - List ocpRegisterEntriesList = new ArrayList<>(); - List maleSterilizationRegisterEntriesList = new ArrayList<>(); - List femaleSterilizationRegisterEntriesList = new ArrayList<>(); - - Integer reportingYear = 2017; - FPRegisterDTO fpRegisterDTO = new FPRegisterDTO(iudRegisterEntriesList, condomRegisterEntriesList, - ocpRegisterEntriesList, maleSterilizationRegisterEntriesList, femaleSterilizationRegisterEntriesList, reportingYear); - - assertEquals((Integer) 2017, fpRegisterDTO.getReportingYear()); - assertTrue(fpRegisterDTO.toString().contains(husbandName)); - assertFalse(fpRegisterDTO.toString().contains("lmpDate=2017-08-19")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/FemaleSterilizationFPDetailsDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/FemaleSterilizationFPDetailsDTOTest.java deleted file mode 100755 index adf58e7d3b..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/FemaleSterilizationFPDetailsDTOTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - -public class FemaleSterilizationFPDetailsDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(FemaleSterilizationFPDetailsDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(FemaleSterilizationFPDetailsDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToString() { - List followupVisitDatesList = new ArrayList<>(); - String sterilization = "pill"; - FemaleSterilizationFPDetailsDTO femaleSterilizationFPDetailsDTO = new FemaleSterilizationFPDetailsDTO - (sterilization, "", followupVisitDatesList); - assertSame("pill", femaleSterilizationFPDetailsDTO.getTypeOfSterilization()); - assertTrue(femaleSterilizationFPDetailsDTO.toString().contains(sterilization)); - assertFalse(femaleSterilizationFPDetailsDTO.toString().contains("sterilizationDate=2017-07-19")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/FemaleSterilizationRegisterEntryDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/FemaleSterilizationRegisterEntryDTOTest.java deleted file mode 100755 index 939400b6d6..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/FemaleSterilizationRegisterEntryDTOTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - -public class FemaleSterilizationRegisterEntryDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(FemaleSterilizationRegisterEntryDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(FemaleSterilizationRegisterEntryDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToStringAndSetters() { - List followupVisitDatesList = new ArrayList<>(); - String sterilization = "pill"; - FemaleSterilizationFPDetailsDTO femaleSterilizationFPDetailsDTO = new FemaleSterilizationFPDetailsDTO - (sterilization, "", followupVisitDatesList); - - String wifeAge = "16"; - String husbandName = "sajid"; - String husbandAge = "24"; - FemaleSterilizationRegisterEntryDTO femaleSterilizationRegisterEntryDTO = new FemaleSterilizationRegisterEntryDTO() - .withEcNumber("") - .withWifeName("") - .withWifeAge(wifeAge) - .withWifeEducationLevel("") - .withHusbandName(husbandName) - .withHusbandAge(husbandAge) - .withHusbandEducationLevel("") - .withVillage("charpara") - .withSubCenter("") - .withReligion("islam") - .withNumberOfLivingFemaleChildren("") - .withNumberOfLivingMaleChildren("") - .withCaste("") - .withFpDetails(femaleSterilizationFPDetailsDTO); - - assertSame("sajid", femaleSterilizationRegisterEntryDTO.getHusbandName()); - assertTrue(femaleSterilizationRegisterEntryDTO.toString().contains(wifeAge)); - assertFalse(femaleSterilizationRegisterEntryDTO.toString().contains("village=nandanpur")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/IUDFPDetailsDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/IUDFPDetailsDTOTest.java deleted file mode 100755 index bc9287bb24..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/IUDFPDetailsDTOTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import static org.junit.Assert.*; - -public class IUDFPDetailsDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(IUDFPDetailsDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(IUDFPDetailsDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToString() { - String fpAcceptanceDate = "2017-07-19"; - IUDFPDetailsDTO iudfpDetailsDTO = new IUDFPDetailsDTO(fpAcceptanceDate, "", "", ""); - System.out.println(iudfpDetailsDTO.toString()); - assertEquals("2017-07-19", iudfpDetailsDTO.getFpAcceptanceDate()); - assertTrue(iudfpDetailsDTO.toString().contains(fpAcceptanceDate)); - assertFalse(iudfpDetailsDTO.toString().contains("lmpDate=2017-08-19")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/IUDRegisterEntryDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/IUDRegisterEntryDTOTest.java deleted file mode 100755 index 82683b8b0d..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/IUDRegisterEntryDTOTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class IUDRegisterEntryDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(IUDRegisterEntryDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(IUDRegisterEntryDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToStringAndSetters() { - String wifeAge = "16"; - String husbandName = "sajid"; - String husbandAge = "24"; - String fpAcceptanceDate = "2017-07-19"; - IUDFPDetailsDTO iudfpDetailsDTO = new IUDFPDetailsDTO(fpAcceptanceDate, "", "", ""); - - IUDRegisterEntryDTO iudRegisterEntryDTO = new IUDRegisterEntryDTO() - .withEcNumber("") - .withWifeName("") - .withWifeAge(wifeAge) - .withWifeEducationLevel("") - .withHusbandName(husbandName) - .withHusbandAge(husbandAge) - .withHusbandEducationLevel("") - .withVillage("charpara") - .withSubCenter("") - .withReligion("islam") - .withNumberOfLivingFemaleChildren("") - .withNumberOfLivingMaleChildren("") - .withCaste("") - .withLmpDate("") - .withUptResult("") - .withFpDetails(iudfpDetailsDTO); - - assertEquals("sajid", iudRegisterEntryDTO.getHusbandName()); - assertTrue(iudRegisterEntryDTO.toString().contains(wifeAge)); - assertFalse(iudRegisterEntryDTO.toString().contains("lmpDate=2017-08-19")); - } - -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/MaleSterilizationFPDetailsDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/MaleSterilizationFPDetailsDTOTest.java deleted file mode 100755 index 66c47c4a84..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/MaleSterilizationFPDetailsDTOTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - -public class MaleSterilizationFPDetailsDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(MaleSterilizationFPDetailsDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(MaleSterilizationFPDetailsDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToString() { - List followupVisitDatesList = new ArrayList<>(); - - String typeOfSterilization = "oldness"; - MaleSterilizationFPDetailsDTO maleSterilizationFPDetailsDTO = new MaleSterilizationFPDetailsDTO(typeOfSterilization, "", followupVisitDatesList); - assertSame("oldness", maleSterilizationFPDetailsDTO.getTypeOfSterilization()); - assertTrue(maleSterilizationFPDetailsDTO.toString().contains(typeOfSterilization)); - assertFalse(maleSterilizationFPDetailsDTO.toString().contains("sterilizationDate=2017-07-19")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/MaleSterilizationRegisterEntryDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/MaleSterilizationRegisterEntryDTOTest.java deleted file mode 100755 index 22771bd4f0..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/MaleSterilizationRegisterEntryDTOTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - -public class MaleSterilizationRegisterEntryDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(MaleSterilizationRegisterEntryDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(MaleSterilizationRegisterEntryDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToStringAndSetters() { - List followupVisitDatesList = new ArrayList<>(); - - String typeOfSterilization = "oldness"; - MaleSterilizationFPDetailsDTO maleSterilizationFPDetailsDTO = new MaleSterilizationFPDetailsDTO - (typeOfSterilization, "", followupVisitDatesList); - String wifeAge = "16"; - String husbandName = "sajid"; - String husbandAge = "24"; - MaleSterilizationRegisterEntryDTO maleSterilizationRegisterEntryDTO = new MaleSterilizationRegisterEntryDTO() - .withEcNumber("") - .withWifeName("") - .withWifeAge(wifeAge) - .withWifeEducationLevel("") - .withHusbandName(husbandName) - .withHusbandAge(husbandAge) - .withHusbandEducationLevel("") - .withVillage("charpara") - .withSubCenter("") - .withReligion("islam") - .withNumberOfLivingFemaleChildren("") - .withNumberOfLivingMaleChildren("") - .withCaste("") - .withFpDetails(maleSterilizationFPDetailsDTO); - - assertSame("sajid", maleSterilizationRegisterEntryDTO.getHusbandName()); - assertTrue(maleSterilizationRegisterEntryDTO.toString().contains(wifeAge)); - assertFalse(maleSterilizationRegisterEntryDTO.toString().contains("village=nandanpur")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/OCPFPDetailsDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/OCPFPDetailsDTOTest.java deleted file mode 100755 index f03ac8e0cd..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/OCPFPDetailsDTOTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class OCPFPDetailsDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(OCPFPDetailsDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(OCPFPDetailsDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToString() { - String fpAcceptanceDate = "2017-07-19"; - Map map = new HashMap<>(); - List> refillsList = new ArrayList<>(); - map.put("a", "femicon"); - map.put("b", "omicon"); - refillsList.add(map); - OCPFPDetailsDTO ocpfpDetailsDTO = new OCPFPDetailsDTO(fpAcceptanceDate, refillsList, "", ""); - - assertEquals("2017-07-19", ocpfpDetailsDTO.getFpAcceptanceDate()); - assertTrue(ocpfpDetailsDTO.toString().contains(fpAcceptanceDate)); - assertFalse(ocpfpDetailsDTO.toString().contains("lmpDate=2017-08-19")); - } -} - diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/OCPRegisterEntryDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/OCPRegisterEntryDTOTest.java deleted file mode 100755 index f37069269a..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/OCPRegisterEntryDTOTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class OCPRegisterEntryDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(OCPRegisterEntryDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(OCPRegisterEntryDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToStringAndSetters() { - String wifeAge = "16"; - String husbandName = "sajid"; - String husbandAge = "24"; - - String fpAcceptanceDate = "2017-07-19"; - Map map = new HashMap<>(); - List> refillsList = new ArrayList<>(); - map.put("a", "femicon"); - map.put("b", "omicon"); - refillsList.add(map); - OCPFPDetailsDTO ocpfpDetailsDTO = new OCPFPDetailsDTO(fpAcceptanceDate, refillsList, "", ""); - - OCPRegisterEntryDTO ocpRegisterEntryDTO = new OCPRegisterEntryDTO() - .withEcNumber("") - .withWifeName("") - .withWifeAge(wifeAge) - .withWifeEducationLevel("") - .withHusbandName(husbandName) - .withHusbandEducationLevel("") - .withVillage("charpara") - .withSubCenter("") - .withReligion("islam") - .withNumberOfLivingFemaleChildren("") - .withNumberOfLivingMaleChildren("") - .withCaste("") - .withLmpDate("") - .withUptResult("") - .withFpDetails(ocpfpDetailsDTO); - - assertEquals("sajid", ocpRegisterEntryDTO.getHusbandName()); - assertTrue(ocpRegisterEntryDTO.toString().contains(wifeAge)); - assertFalse(ocpRegisterEntryDTO.toString().contains("lmpDate=2017-08-19")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/PNCRegisterDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/PNCRegisterDTOTest.java deleted file mode 100755 index b8c23b7b01..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/PNCRegisterDTOTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class PNCRegisterDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(PNCRegisterDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(PNCRegisterDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToString() { - List pncRegisterEntriesList = new ArrayList<>(); - String address = "mPower"; - PNCRegisterEntryDTO pncRegisterEntryDTO = new PNCRegisterEntryDTO().withAddress(address); - pncRegisterEntriesList.add(pncRegisterEntryDTO); - PNCRegisterDTO pncRegisterDTO = new PNCRegisterDTO(pncRegisterEntriesList); - - assertTrue(pncRegisterDTO.toString().contains(address)); - assertFalse(pncRegisterDTO.toString().contains("wifeName=Sadna")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/PNCRegisterEntryDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/PNCRegisterEntryDTOTest.java deleted file mode 100755 index 1952aa7983..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/PNCRegisterEntryDTOTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class PNCRegisterEntryDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(PNCRegisterEntryDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(PNCRegisterEntryDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToStringAndSetters() { - String husbandName = "sajid"; - - List> childrenDetailsList = new ArrayList<>(); - List pncVisitsList = new ArrayList<>(); - - PNCRegisterEntryDTO pncRegisterEntryDTO = new PNCRegisterEntryDTO(); - pncRegisterEntryDTO.withRegistrationDate(""); - pncRegisterEntryDTO.withThayiCardNumber(""); - pncRegisterEntryDTO.withWifeName(""); - pncRegisterEntryDTO.withHusbandName(husbandName); - pncRegisterEntryDTO.withWifeDOB(""); - pncRegisterEntryDTO.withAddress(""); - pncRegisterEntryDTO.withDateOfDelivery(""); - pncRegisterEntryDTO.withPlaceOfDelivery(""); - pncRegisterEntryDTO.withTypeOfDelivery(""); - pncRegisterEntryDTO.withDischargeDate(""); - pncRegisterEntryDTO.withFPMethodName(""); - pncRegisterEntryDTO.withFPMethodDate(""); - pncRegisterEntryDTO.withDeliveryComplications(""); - pncRegisterEntryDTO.withChildrenDetails(childrenDetailsList); - pncRegisterEntryDTO.withPNCVisits(pncVisitsList); - - assertTrue(pncRegisterEntryDTO.toString().contains(husbandName)); - assertFalse(pncRegisterEntryDTO.toString().contains("wifeDob=2017-08-19")); - - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/register/PNCVisitDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/register/PNCVisitDTOTest.java deleted file mode 100755 index 5ef07e45d2..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/register/PNCVisitDTOTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.opensrp.dto.register; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class PNCVisitDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(PNCVisitDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(PNCVisitDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testToStringAndSetters() { - String person = "khusi"; - String place = "rupnagar"; - List> childrenDetailsList = new ArrayList<>(); - - PNCVisitDTO pncVisitDTO = new PNCVisitDTO() - .withDate("") - .withPerson(person) - .withPlace(place) - .withDifficulties("") - .withAbdominalProblems("") - .withVaginalProblems("") - .withUrinalProblems("") - .withBreastProblems("") - .withChildrenDetails(childrenDetailsList); - - assertTrue(pncVisitDTO.toString().contains(person)); - assertFalse(pncVisitDTO.toString().contains("difficulties=no")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/report/AggregatedReportsDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/report/AggregatedReportsDTOTest.java deleted file mode 100755 index 5992e5a626..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/report/AggregatedReportsDTOTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.opensrp.dto.report; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.junit.Test; -import org.opensrp.dto.LocationDTO; -import org.opensrp.dto.utils.PojoTestUtils; - -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -/** - * Created by real on 13/07/17. - */ -public class AggregatedReportsDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(AggregatedReportsDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(AggregatedReportsDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testConstructorAndtoString() { - Map indicatorSummary = new HashMap<>(); - indicatorSummary.put("one", 1); - LocationDTO loc = new LocationDTO("", "", "", "", ""); - AggregatedReportsDTO aggregatedReportsDTO = new AggregatedReportsDTO(indicatorSummary, loc); - assertTrue(aggregatedReportsDTO.toString().contains("ind={one=1}")); - assertFalse(aggregatedReportsDTO.toString().contains("ind=null")); - } -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/report/ServiceProvidedReportDTOTest.java b/opensrp-interface/src/test/java/org.opensrp.dto/report/ServiceProvidedReportDTOTest.java deleted file mode 100755 index dceb1c940f..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/report/ServiceProvidedReportDTOTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.opensrp.dto.report; - -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; -import org.joda.time.LocalDate; -import org.junit.Test; -import org.opensrp.dto.utils.PojoTestUtils; - -import static org.junit.Assert.*; - -/** - * Created by real on 13/07/17. - */ -public class ServiceProvidedReportDTOTest { - @Test - public void testAccesors_shouldAccessProperField() { - PojoTestUtils.validateAccessors(ServiceProvidedReportDTO.class); - } - - @Test - public void testEqualsAndHashCode() { - EqualsVerifier.forClass(ServiceProvidedReportDTO.class).suppress(Warning.NONFINAL_FIELDS).verify(); - } - - @Test - public void testConstructorAndwithSettersAndtoString() { - ServiceProvidedReportDTO serviceProvidedReportDTO, serviceProvidedReportDTO2; - serviceProvidedReportDTO = new ServiceProvidedReportDTO(); - serviceProvidedReportDTO.withId(3); - serviceProvidedReportDTO.withDate(new LocalDate()); - serviceProvidedReportDTO.withNRHMReportMonth(7); - serviceProvidedReportDTO.withNRHMReportYear(2017); - assertEquals((Integer) 3, serviceProvidedReportDTO.getId()); - assertNotSame((Integer) 8, serviceProvidedReportDTO.getNrhm_report_month()); - - serviceProvidedReportDTO2 = new ServiceProvidedReportDTO(1, "", "", "", new LocalDate(), "", "", "", "", "", ""); - assertTrue(serviceProvidedReportDTO2.toString().contains("id=1")); - assertFalse(serviceProvidedReportDTO2.toString().contains("village=gangapur")); - } - -} diff --git a/opensrp-interface/src/test/java/org.opensrp.dto/utils/PojoTestUtils.java b/opensrp-interface/src/test/java/org.opensrp.dto/utils/PojoTestUtils.java deleted file mode 100755 index 2374ea91ca..0000000000 --- a/opensrp-interface/src/test/java/org.opensrp.dto/utils/PojoTestUtils.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.opensrp.dto.utils; - -import com.openpojo.reflection.impl.PojoClassFactory; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -/** - * Created by real on 13/07/17. - */ -public class PojoTestUtils { - private static final Validator ACCESSOR_VALIDATOR = ValidatorBuilder.create() - .with(new GetterTester()) - .with(new SetterTester()) - .build(); - - public static void validateAccessors(final Class clazz) { - ACCESSOR_VALIDATOR.validate(PojoClassFactory.getPojoClass(clazz)); - } -} diff --git a/opensrp-register/LICENSE b/opensrp-register/LICENSE new file mode 100755 index 0000000000..8d7ce5b6a3 --- /dev/null +++ b/opensrp-register/LICENSE @@ -0,0 +1,17 @@ +Open Smart Register Platform (OpenSRP), formerly Dristhi software + +Copyright 2012-2017 + +Foundation for Research in Health Systems; Sustainable Engineering Lab; Columbia University; and The Special Programme of Research, +Development and Research Training in Human Reproduction (HRP) of the World Health Organization; Ona; mPower Social Enterprise Bangladesh; +Interactive Health Solutions; Summit Institute of Development; Interactive Research and Development; Johns Hopkins University Global +mHealth Institute; Harvard University School of Public Health + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may +obtain a copy of the License at: + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions +and limitations under the License. diff --git a/opensrp-register/README.md b/opensrp-register/README.md new file mode 100755 index 0000000000..ce672d24b0 --- /dev/null +++ b/opensrp-register/README.md @@ -0,0 +1,21 @@ +# opensrp-server-register + +OpenSRP Server Register Module + +[![Build Status](https://travis-ci.org/OpenSRP/opensrp-server-register.svg?branch=master)](https://travis-ci.org/OpenSRP/opensrp-server-register) [![Coverage Status](https://coveralls.io/repos/github/OpenSRP/opensrp-server-register/badge.svg)](https://coveralls.io/github/OpenSRP/opensrp-server-register) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/1214d62440104f048259b1ade69ede3f)](https://www.codacy.com/app/OpenSRP/opensrp-server-register?utm_source=github.com&utm_medium=referral&utm_content=OpenSRP/opensrp-server-register&utm_campaign=Badge_Grade) + +Schedule handlers and services + +#### Relevant Wiki Pages #### +* OpenSRP Server Refactor and Cleanup + * [Refactor and Cleanup](https://smartregister.atlassian.net/wiki/spaces/Documentation/pages/562659330/OpenSRP+Server+Refactor+and+Clean+up) + * [How to upload and use maven jar artifacts](https://smartregister.atlassian.net/wiki/spaces/Documentation/pages/564428801/How+to+upload+and+use+maven+jar+artifacts) + * [Managing Server Wide Properties](https://smartregister.atlassian.net/wiki/spaces/Documentation/pages/602570753/Managing+Server+Wide+Properties) + * [Server Web Build](https://smartregister.atlassian.net/wiki/spaces/Documentation/pages/616595457/Server+Web+Build) +* [OpenSRP Server Build](https://smartregister.atlassian.net/wiki/display/Documentation/OpenSRP+Server+Build) +* Deployment + * [Docker Setup](https://smartregister.atlassian.net/wiki/display/Documentation/Docker+Setup) + * [Docker Compose Setup](https://smartregister.atlassian.net/wiki/spaces/Documentation/pages/52690976/Docker+Compose+Setup) + * [Ansible Playbooks](https://smartregister.atlassian.net/wiki/spaces/Documentation/pages/540901377/Ansible+Playbooks) +* [Postgres Database Support](https://smartregister.atlassian.net/wiki/spaces/Documentation/pages/251068417/Postgres+Database+Support+as+Main+Datastore) +* [OpenSRP Load Testing](https://smartregister.atlassian.net/wiki/spaces/Documentation/pages/268075009/OpenSRP+Load+Testing) diff --git a/opensrp-register/pom.xml b/opensrp-register/pom.xml index d3db7adb15..a49a998dd0 100755 --- a/opensrp-register/pom.xml +++ b/opensrp-register/pom.xml @@ -1,13 +1,13 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.smartregister opensrp-server-register jar - 1.0.1 + 1.0.1-KIP-SNAPSHOT opensrp-server-register OpenSRP Server register module @@ -157,7 +157,7 @@ - ../build + configs/build true maven.properties @@ -168,7 +168,7 @@ org/opensrp/register/thrivepk - ../modules/core/ziggy + configs/modules/core/ziggy ziggy diff --git a/opensrp-register/src/main/java/org/opensrp/register/service/handler/ANCScheduleHandler.java b/opensrp-register/src/main/java/org/opensrp/register/service/handler/ANCScheduleHandler.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/service/handler/BNFScheduleHandler.java b/opensrp-register/src/main/java/org/opensrp/register/service/handler/BNFScheduleHandler.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/service/handler/BaseScheduleHandler.java b/opensrp-register/src/main/java/org/opensrp/register/service/handler/BaseScheduleHandler.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/service/handler/ChildScheduleHandler.java b/opensrp-register/src/main/java/org/opensrp/register/service/handler/ChildScheduleHandler.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/service/handler/ElcoScheduleHandler.java b/opensrp-register/src/main/java/org/opensrp/register/service/handler/ElcoScheduleHandler.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/service/handler/EventsHandlerMapper.java b/opensrp-register/src/main/java/org/opensrp/register/service/handler/EventsHandlerMapper.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/service/handler/HHScheduleHandler.java b/opensrp-register/src/main/java/org/opensrp/register/service/handler/HHScheduleHandler.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/service/handler/PNCScheduleHandler.java b/opensrp-register/src/main/java/org/opensrp/register/service/handler/PNCScheduleHandler.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/service/handler/VaccinesScheduleHandler.java b/opensrp-register/src/main/java/org/opensrp/register/service/handler/VaccinesScheduleHandler.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/service/scheduling/AnteNatalCareSchedulesService.java b/opensrp-register/src/main/java/org/opensrp/register/service/scheduling/AnteNatalCareSchedulesService.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/service/scheduling/BNFSchedulesService.java b/opensrp-register/src/main/java/org/opensrp/register/service/scheduling/BNFSchedulesService.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/service/scheduling/ELCOScheduleService.java b/opensrp-register/src/main/java/org/opensrp/register/service/scheduling/ELCOScheduleService.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/service/scheduling/ENCCSchedulesService.java b/opensrp-register/src/main/java/org/opensrp/register/service/scheduling/ENCCSchedulesService.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/service/scheduling/HHSchedulesService.java b/opensrp-register/src/main/java/org/opensrp/register/service/scheduling/HHSchedulesService.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/service/scheduling/PNCSchedulesService.java b/opensrp-register/src/main/java/org/opensrp/register/service/scheduling/PNCSchedulesService.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/thrivepk/FormSubmissionView.java b/opensrp-register/src/main/java/org/opensrp/register/thrivepk/FormSubmissionView.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/thrivepk/RegisterConstants.java b/opensrp-register/src/main/java/org/opensrp/register/thrivepk/RegisterConstants.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/main/java/org/opensrp/register/thrivepk/Schedule.java b/opensrp-register/src/main/java/org/opensrp/register/thrivepk/Schedule.java old mode 100644 new mode 100755 diff --git a/opensrp-register/src/test/java/org/opensrp/register/service/handler/TestResourceLoader.java b/opensrp-register/src/test/java/org/opensrp/register/service/handler/TestResourceLoader.java index 01135ab196..5b3107a5ef 100755 --- a/opensrp-register/src/test/java/org/opensrp/register/service/handler/TestResourceLoader.java +++ b/opensrp-register/src/test/java/org/opensrp/register/service/handler/TestResourceLoader.java @@ -34,7 +34,8 @@ public class TestResourceLoader { public String getFile() throws IOException { ResourceLoader loader = new DefaultResourceLoader(); - String scheduleConfigFilesPath = "./../assets/schedules/schedule-configs"; + String scheduleConfigFilesPath = "configs/assets/schedules/schedule-configs"; + File scheduleConfigsFolder = null; if (scheduleConfigsFolder == null && loader.getResource(scheduleConfigFilesPath).exists()) scheduleConfigFilesPath = loader.getResource(scheduleConfigFilesPath).getURI().getPath(); diff --git a/opensrp-reporting/pom.xml b/opensrp-reporting/pom.xml deleted file mode 100755 index 9d7c385bce..0000000000 --- a/opensrp-reporting/pom.xml +++ /dev/null @@ -1,434 +0,0 @@ - - 4.0.0 - org.smartregister - - opensrp-server-reporting - jar - - 1.0.1 - - opensrp-server-reporting - OpenSRP Server reporting module - http://github.com/OpenSRP/opensrp-server-reporting - - - 0.11 - 3.1.0.RELEASE - always - 1.5.1 - 5.1.36 - 1.0.1 - 1.0.1 - UTF-8 - - - - - nexus-snapshots - Nexus Snapshots Repository - https://oss.sonatype.org/content/repositories/snapshots - false - - - nexus-releases - https://oss.sonatype.org/service/local/staging/deploy/maven2 - - - - - scm:git:git@github.com:OpenSRP/opensrp-server-reporting.git - scm:git:git@github.com:OpenSRP/opensrp-server-reporting.git - https://github.com/OpenSRP/opensrp-server-reporting - - - - - Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0.txt - repo - Open Smart Register Platform (OpenSRP) is Licensed under the Apache License, Version 2.0 - - - - - - opensrp_developer - OpenSRP Developer - info@smartregister.org - https://groups.google.com/forum/#!forum/opensrp-dev - OpenSRP - http://smartregister.org - - developer - - Africa/Nairobi - - - - - snapshots-repo - https://oss.sonatype.org/content/repositories/snapshots - - false - - - true - - - - motech.opensrp - Motech Snapshots Repository - http://nexus.motechproject.org/content/repositories/opensrp-server - - true - ${opensrp.updatePolicy} - - - - motech.nexus - Motech Snapshots Repository - http://nexus.motechproject.org/content/repositories/snapshots - - true - ${opensrp.updatePolicy} - - - - motech.nexus.release - Motech Snapshots Repository - http://nexus.motechproject.org/content/repositories/releases - - - - - - org.smartregister - opensrp-server-common - ${opensrp.common.version} - - - - org.springframework - spring-webmvc - ${spring.version} - - - org.springframework - spring-web - ${spring.version} - - - commons-logging - commons-logging - - - - - junit - junit - 4.8.2 - test - - - com.googlecode.flyway - flyway-core - 2.0.2 - - - net.sf.ehcache - ehcache-core - 2.1.0 - - - javax.transaction - jta - 1.1 - - - org.hibernate - hibernate - 3.3.1.GA - - - net.sf.ehcache - ehcache - - - pom - - - org.hibernate - hibernate-annotations - 3.3.1.GA - - - org.hibernate - hibernate-commons-annotations - 3.1.0.GA - - - org.hibernate - hibernate-entitymanager - 3.3.2.GA - - - org.hibernate - hibernate-c3p0 - 3.3.2.GA - - - org.springframework - spring-orm - 3.0.5.RELEASE - - - postgresql - postgresql - 9.1-901.jdbc4 - - - mysql - mysql-connector-java - ${mysql.connector.version} - - - org.slf4j - slf4j-log4j12 - 1.6.0 - - - log4j - log4j - 1.2.16 - - - org.slf4j - slf4j-api - 1.6.0 - - - org.slf4j - jcl-over-slf4j - 1.6.1 - - - joda-time - joda-time - 2.0 - - - com.googlecode.lambdaj - lambdaj - 2.3.3 - - - org.mockito - mockito-all - 1.8.5 - - - org.motechproject - motech-platform-server-api - ${motech.version} - - - org.motechproject - motech-scheduletracking-api - ${motech.version} - - - org.motechproject - motech-testing-utils - ${motech.version} - test - - - - org.smartregister - opensrp-server-interface - ${opensrp.interface.version} - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.7 - 1.7 - UTF-8 - - - - org.apache.maven.plugins - maven-resources-plugin - 2.5 - - UTF-8 - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.3 - - - **/*.properties - - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - - jar - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - none - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${nexus-staging-maven-plugin.version} - - - default-deploy - deploy - - deploy - - - - - nexus-snapshots - https://oss.sonatype.org/ - true - - - - org.jacoco - jacoco-maven-plugin - 0.7.9 - - ${basedir}/target/coverage-reports/jacoco-unit.exec - ${basedir}/target/coverage-reports/jacoco-unit.exec - - - - jacoco-initialize - - prepare-agent - - - - jacoco-site - test - - report - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.20 - - true - - **/it/** - - - - - - org.eluder.coveralls - coveralls-maven-plugin - 4.0.0 - - - - - - ../build - true - - maven.properties - - - - ../assets/config - - - src/main/resources - - - - - - release - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.5.1 - - - default-deploy - deploy - - deploy - - - - - nexus-releases - https://oss.sonatype.org/ - false - true - - - - - - - \ No newline at end of file diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/DristhiEntityIdMissingException.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/DristhiEntityIdMissingException.java deleted file mode 100644 index f8e94f1aba..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/DristhiEntityIdMissingException.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.opensrp.reporting; - -import java.text.MessageFormat; - -import org.opensrp.common.domain.ReportDataDeleteRequest; - -public class DristhiEntityIdMissingException extends Exception { - - public DristhiEntityIdMissingException(ReportDataDeleteRequest request) { - super(MessageFormat.format("Cannot delete {0} report for the report data, as the DristhiEntityId is missing.", - request.type())); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/HttpHeaderFactory.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/HttpHeaderFactory.java deleted file mode 100644 index a2485b1b3b..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/HttpHeaderFactory.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.opensrp.reporting; - -import org.opensrp.common.AllConstants; -import org.springframework.http.HttpHeaders; - -public class HttpHeaderFactory { - - public static HttpHeaders allowOrigin(String origin) { - HttpHeaders headers = new HttpHeaders(); - headers.add(AllConstants.HTTP.ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, origin); - return headers; - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/ReportDataMissingException.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/ReportDataMissingException.java deleted file mode 100644 index 7804ce5598..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/ReportDataMissingException.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.opensrp.reporting; - -import java.text.MessageFormat; -import java.util.ArrayList; - -import org.opensrp.common.domain.ReportingData; - -public class ReportDataMissingException extends Exception { - - public ReportDataMissingException(ReportingData reportingData, ArrayList missingData) { - super(MessageFormat.format("Cannot report for the report data: {0}, as the following report data is missing: {1}", - reportingData, missingData)); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/ANMController.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/ANMController.java deleted file mode 100644 index d69b4b0f48..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/ANMController.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.opensrp.reporting.controller; - -import static ch.lambdaj.collection.LambdaCollections.with; -import static org.opensrp.reporting.HttpHeaderFactory.allowOrigin; -import static org.springframework.http.HttpStatus.OK; - -import java.util.List; - -import org.opensrp.common.domain.UserDetail; -import org.opensrp.common.util.HttpAgent; -import org.opensrp.common.util.HttpResponse; -import org.opensrp.dto.ANMDTO; -import org.opensrp.dto.LocationDTO; -import org.opensrp.reporting.domain.Location; -import org.opensrp.reporting.domain.SP_ANM; -import org.opensrp.reporting.factory.DetailsFetcherFactory; -import org.opensrp.reporting.service.ANMService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; - -import ch.lambdaj.function.convert.Converter; - -@Controller -public class ANMController { - - private String opensrpSiteUrl; - - private String opensrpUserDetailsUrl; - - private ANMService anmService; - - private HttpAgent httpAgent; - - private DetailsFetcherFactory detailsFetcherFactory; - - @Autowired - public ANMController(@Value("#{opensrp['opensrp.site.url']}") String opensrpSiteUrl, - @Value("#{opensrp['opensrp.user.details.url']}") String opensrpUserDetailsUrl, ANMService anmService, - HttpAgent httpAgent, DetailsFetcherFactory detailsFetcherFactory) { - this.opensrpSiteUrl = opensrpSiteUrl; - this.opensrpUserDetailsUrl = opensrpUserDetailsUrl; - this.anmService = anmService; - this.httpAgent = httpAgent; - this.detailsFetcherFactory = detailsFetcherFactory; - } - - @RequestMapping(method = { RequestMethod.GET, RequestMethod.OPTIONS }, value = "/anm-details") - @ResponseBody - public ResponseEntity> all(@RequestParam("anm-id") String anmIdentifier) { - HttpResponse response; - try { - response = httpAgent.get(opensrpUserDetailsUrl + "?anm-id=" + anmIdentifier); - UserDetail userDetail = new Gson().fromJson(response.body(), new TypeToken() {}.getType()); - ANMDetailsFetcher anmDetailsFetcher = detailsFetcherFactory.detailsFetcher(userDetail.getRoles()); - - List anmDTOList = convertToDTO(anmDetailsFetcher.fetchDetails(anmIdentifier)); - return new ResponseEntity<>(anmDTOList, allowOrigin(opensrpSiteUrl), OK); - } - catch (Exception e) { - e.printStackTrace(); - } - return new ResponseEntity<>(null, allowOrigin(opensrpSiteUrl), OK); - } - - private List convertToDTO(List anms) { - return with(anms).convert(new Converter() { - - @Override - public ANMDTO convert(SP_ANM anm) { - LocationDTO location = convertToDTO(anmService.getLocation(anm.identifier())); - return new ANMDTO(anm.identifier(), anm.name(), location); - } - - private LocationDTO convertToDTO(Location location) { - return new LocationDTO(location.subCenter(), location.phcName(), location.taluka(), location.district(), - location.state()); - } - }); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/ANMDetailsFetcher.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/ANMDetailsFetcher.java deleted file mode 100644 index 07dc09c519..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/ANMDetailsFetcher.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.opensrp.reporting.controller; - -import java.util.List; - -import org.opensrp.reporting.domain.SP_ANM; -import org.opensrp.reporting.service.ANMService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public abstract class ANMDetailsFetcher { - - protected ANMService anmService; - - @Autowired - protected ANMDetailsFetcher(ANMService anmService) { - this.anmService = anmService; - } - - public abstract List fetchDetails(String anmIdentifier); -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/AggregatedReportController.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/AggregatedReportController.java deleted file mode 100644 index d4162ff616..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/AggregatedReportController.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.opensrp.reporting.controller; - -import static org.opensrp.reporting.HttpHeaderFactory.allowOrigin; -import static org.springframework.http.HttpStatus.OK; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; -import org.opensrp.dto.LocationDTO; -import org.opensrp.dto.aggregatorResponse.AggregatorResponseDTO; -import org.opensrp.dto.report.AggregatedReportsDTO; -import org.opensrp.reporting.domain.Location; -import org.opensrp.reporting.service.ANMService; -import org.opensrp.reporting.service.AggregateReportsService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -@Controller -public class AggregatedReportController { - - private final AggregateReportsService aggregateReportsService; - - private final String opensrpSiteUrl; - - private final ANMService anmService; - - @Autowired - public AggregatedReportController(AggregateReportsService aggregateReportsService, - @Value("#{opensrp['opensrp.site.url']}") String opensrpSiteUrl, ANMService anmService) { - this.aggregateReportsService = aggregateReportsService; - this.opensrpSiteUrl = opensrpSiteUrl; - this.anmService = anmService; - } - - @ResponseBody - @RequestMapping(value = "/report/aggregated-reports", method = RequestMethod.GET) - public ResponseEntity get(@RequestParam("anm-id") String anmIdentifier, - @RequestParam("month") int month, @RequestParam("year") int year) { - Map indicatorSummary = buildIndicatorSummary(anmIdentifier, month, year); - LocationDTO locationDTO = getLocation(anmIdentifier); - return new ResponseEntity<>(new AggregatedReportsDTO(indicatorSummary, locationDTO), allowOrigin(opensrpSiteUrl), - OK); - } - - private LocationDTO getLocation(String anmIdentifier) { - Location location = anmService.getLocation(anmIdentifier); - return new LocationDTO(StringUtils.capitalize(location.subCenter()), location.phcName(), location.taluka(), - location.district(), location.state()); - } - - private Map buildIndicatorSummary(String anmIdentifier, int month, int year) { - List aggregatorResponseDTO = aggregateReportsService.getAggregatedReports(anmIdentifier, - month, year); - Map indicatorSummary = new HashMap<>(); - for (AggregatorResponseDTO responseDTO : aggregatorResponseDTO) { - indicatorSummary.put(responseDTO.indicator(), responseDTO.count()); - } - return indicatorSummary; - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/FakeReportDataController.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/FakeReportDataController.java deleted file mode 100644 index ec323da1e7..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/FakeReportDataController.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.opensrp.reporting.controller; - -import org.opensrp.reporting.service.AggregateReportsService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; - -@Controller -public class FakeReportDataController { - - private AggregateReportsService aggregateReportsService; - - private static final Logger logger = LoggerFactory.getLogger(FakeReportDataController.class); - - @Autowired - public FakeReportDataController(AggregateReportsService aggregateReportsService) { - this.aggregateReportsService = aggregateReportsService; - } - - @RequestMapping(value = "/report/force-aggregate", method = RequestMethod.GET) - @ResponseBody - public String forceAggregateReports() { - logger.info("Forcing report aggregation."); - aggregateReportsService.sendReportsToAggregator(); - return "Done"; - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/LocationController.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/LocationController.java deleted file mode 100644 index 97ad74310f..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/LocationController.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.opensrp.reporting.controller; - -import static ch.lambdaj.Lambda.collect; -import static ch.lambdaj.Lambda.on; -import static org.springframework.http.HttpStatus.OK; - -import java.util.List; - -import org.opensrp.dto.VillagesDTO; -import org.opensrp.reporting.domain.Location; -import org.opensrp.reporting.service.ANMService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; - -@Controller -public class LocationController { - - private ANMService anmService; - - @Autowired - public LocationController(ANMService anmService) { - this.anmService = anmService; - } - - @RequestMapping(method = { RequestMethod.GET, RequestMethod.OPTIONS }, value = "/villages") - public ResponseEntity villagesForANM(@RequestParam("anm-id") String anmIdentifier) { - List villagesForANM = anmService.getVillagesForANM(anmIdentifier); - VillagesDTO villagesDTO = null; - if (villagesForANM != null) { - Location anmLocation = (Location) villagesForANM.get(0); - List villages = collect(villagesForANM, on(Location.class).village()); - villagesDTO = new VillagesDTO(anmLocation.district().toLowerCase(), anmLocation.phcName(), - anmLocation.phc().phcIdentifier(), anmLocation.subCenter(), villages); - } - return new ResponseEntity<>(villagesDTO, OK); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/PHCUserDetailsFetcher.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/PHCUserDetailsFetcher.java deleted file mode 100644 index 743c87851c..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/PHCUserDetailsFetcher.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.opensrp.reporting.controller; - -import java.util.List; - -import org.opensrp.reporting.domain.SP_ANM; -import org.opensrp.reporting.service.ANMService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class PHCUserDetailsFetcher extends ANMDetailsFetcher { - - @Autowired - protected PHCUserDetailsFetcher(ANMService anmService) { - super(anmService); - } - - @Override - public List fetchDetails(String anmIdentifier) { - return anmService.anmsInTheSamePHC(anmIdentifier); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/ReportDataController.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/ReportDataController.java deleted file mode 100644 index 422027dd83..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/ReportDataController.java +++ /dev/null @@ -1,140 +0,0 @@ -package org.opensrp.reporting.controller; - -import static org.apache.commons.lang3.StringUtils.isBlank; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; - -import org.opensrp.common.AllConstants.ReportDataParameters; -import org.opensrp.common.domain.ANMReport; -import org.opensrp.common.domain.ReportDataDeleteRequest; -import org.opensrp.common.domain.ReportDataUpdateRequest; -import org.opensrp.common.domain.ReportingData; -import org.opensrp.reporting.DristhiEntityIdMissingException; -import org.opensrp.reporting.ReportDataMissingException; -import org.opensrp.reporting.repository.ANMReportsRepository; -import org.opensrp.reporting.repository.ServicesProvidedRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; - -@Controller -public class ReportDataController { - - private ServicesProvidedRepository servicesProvidedRepository; - - private ANMReportsRepository anmReportsRepository; - - private static final Logger logger = LoggerFactory.getLogger(ReportDataController.class); - - @Autowired - public ReportDataController(ServicesProvidedRepository servicesProvidedRepository, - ANMReportsRepository anmReportsRepository) { - this.servicesProvidedRepository = servicesProvidedRepository; - this.anmReportsRepository = anmReportsRepository; - } - - @RequestMapping(value = "/report/submit", method = RequestMethod.POST) - @ResponseBody - public String submit(@RequestBody ReportingData reportingData) throws ReportDataMissingException { - logger.info("Reporting on: " + reportingData); - if (ReportDataParameters.SERVICE_PROVIDED_DATA_TYPE.equals(reportingData.type())) { - throwExceptionIfMandatoryDataIsNotPresentForServiceProvidedReport(reportingData); - servicesProvidedRepository.save(reportingData.get(ReportDataParameters.ANM_IDENTIFIER), - reportingData.get(ReportDataParameters.SERVICE_PROVIDER_TYPE), - reportingData.get(ReportDataParameters.EXTERNAL_ID), reportingData.get(ReportDataParameters.INDICATOR), - reportingData.get(ReportDataParameters.SERVICE_PROVIDED_DATE), - reportingData.get(ReportDataParameters.VILLAGE), reportingData.get(ReportDataParameters.SUB_CENTER), - reportingData.get(ReportDataParameters.PHC), reportingData.get(ReportDataParameters.QUANTITY), - reportingData.get(ReportDataParameters.DRISTHI_ENTITY_ID)); - } else if (ReportDataParameters.ANM_REPORT_DATA_TYPE.equals(reportingData.type())) { - throwExceptionIfMandatoryDataIsNotPresentForANMReport(reportingData); - anmReportsRepository.save(reportingData.get(ReportDataParameters.ANM_IDENTIFIER), - reportingData.get(ReportDataParameters.EXTERNAL_ID), reportingData.get(ReportDataParameters.INDICATOR), - reportingData.get(ReportDataParameters.SERVICE_PROVIDED_DATE), - reportingData.get(ReportDataParameters.QUANTITY)); - } - return "Success."; - } - - @RequestMapping(headers = { "Accept=application/json" }, value = "/report/update", method = RequestMethod.POST) - @ResponseBody - public String updateReports(@RequestBody ReportDataUpdateRequest request) throws ReportDataMissingException { - logger.info( - MessageFormat.format("Flushing reports for reporting month {0} to {1} for indicator {2} for service type {3}", - request.startDate(), request.endDate(), request.indicator(), request.type())); - List reportingData = request.reportingData(); - if (ReportDataParameters.SERVICE_PROVIDED_DATA_TYPE.equals(request.type())) { - throwExceptionIfMandatoryDataIsNotPresentForServiceProvidedReport(reportingData); - servicesProvidedRepository.update(request); - } else if (ReportDataParameters.ANM_REPORT_DATA_TYPE.equals(request.type())) { - throwExceptionIfMandatoryDataIsNotPresentForANMReport(reportingData); - anmReportsRepository.update(request); - } - return "Success."; - } - - @RequestMapping(headers = { "Accept=application/json" }, value = "/report/delete", method = RequestMethod.POST) - @ResponseBody - public String deleteReports(@RequestBody ReportDataDeleteRequest request) throws DristhiEntityIdMissingException { - logger.info(MessageFormat.format("Deleting {0} reports for entity with entity id: {1}", request.type(), - request.dristhiEntityId())); - throwExceptionIfDristhiEntityIdIsNotPresent(request); - if (ReportDataParameters.SERVICE_PROVIDED_DATA_TYPE.equals(request.type())) { - servicesProvidedRepository.delete(request); - } else if (ReportDataParameters.ANM_REPORT_DATA_TYPE.equals(request.type())) { - anmReportsRepository.delete(request); - } - return "Success."; - } - - @RequestMapping(value = "/report/fetchForAllANMs", method = RequestMethod.GET) - @ResponseBody - public List getAllANMsIndicatorSummaries() { - return anmReportsRepository.fetchAllANMsReport(); - } - - private void throwExceptionIfMandatoryDataIsNotPresentForANMReport(ReportingData reportingData) - throws ReportDataMissingException { - ArrayList missingData = reportingData.getMissingReportDataForANMReport(); - if (!missingData.isEmpty()) { - throw new ReportDataMissingException(reportingData, missingData); - } - } - - private void throwExceptionIfMandatoryDataIsNotPresentForServiceProvidedReport(ReportingData reportingData) - throws ReportDataMissingException { - ArrayList missingData = reportingData.getMissingReportDataForServiceProvided(); - if (!missingData.isEmpty()) { - throw new ReportDataMissingException(reportingData, missingData); - } - } - - private void throwExceptionIfMandatoryDataIsNotPresentForANMReport(List reportingData) - throws ReportDataMissingException { - for (ReportingData data : reportingData) { - throwExceptionIfMandatoryDataIsNotPresentForANMReport(data); - } - } - - private void throwExceptionIfMandatoryDataIsNotPresentForServiceProvidedReport(List reportingData) - throws ReportDataMissingException { - for (ReportingData data : reportingData) { - throwExceptionIfMandatoryDataIsNotPresentForServiceProvidedReport(data); - } - } - - private void throwExceptionIfDristhiEntityIdIsNotPresent(ReportDataDeleteRequest request) - throws DristhiEntityIdMissingException { - if (isBlank(request.dristhiEntityId())) { - throw new DristhiEntityIdMissingException(request); - } - } - -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/SCUserDetailsFetcher.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/SCUserDetailsFetcher.java deleted file mode 100644 index f4bb03bd6e..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/controller/SCUserDetailsFetcher.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.opensrp.reporting.controller; - -import java.util.List; - -import org.opensrp.reporting.domain.SP_ANM; -import org.opensrp.reporting.service.ANMService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class SCUserDetailsFetcher extends ANMDetailsFetcher { - - @Autowired - public SCUserDetailsFetcher(ANMService anmService) { - super(anmService); - } - - @Override - public List fetchDetails(String anmIdentifier) { - return anmService.anmsInTheSameSC(anmIdentifier); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ANM.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ANM.java deleted file mode 100644 index 98db426e3a..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ANM.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.opensrp.reporting.domain; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.NamedQuery; -import javax.persistence.Table; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -@Entity -@Table(name = "dim_anm") -@NamedQuery(name = ANM.FIND_BY_ANM_ID, query = "select r from ANM r where r.anmIdentifier=:anmIdentifier") -public class ANM { - - public static final String FIND_BY_ANM_ID = "find.by.anm.id"; - - @Id - @Column(name = "id") - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Integer id; - - @Column(name = "anmIdentifier") - private String anmIdentifier; - - private ANM() { - } - - public ANM(String anmIdentifier) { - this(0, anmIdentifier); - } - - public ANM(Integer id, String anmIdentifier) { - this.id = id; - this.anmIdentifier = anmIdentifier; - } - - public Integer id() { - return id; - } - - public String anmIdentifier() { - return anmIdentifier; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, new String[] { "id" }); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, new String[] { "id" }); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ANMReportData.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ANMReportData.java deleted file mode 100644 index 861c13506b..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ANMReportData.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.opensrp.reporting.domain; - -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.Table; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -@Entity -@Table(name = "anm_report_data") -@NamedQueries({ - @NamedQuery(name = ANMReportData.FIND_BY_ANM_IDENTIFIER_AND_DATE, query = "select r from ANMReportData r, ANM a " - + "where r.anm=a.id and a.anmIdentifier=:anmIdentifier and r.date >= :date"), - @NamedQuery(name = ANMReportData.FIND_BY_ANM_IDENTIFIER_WITH_INDICATOR_FOR_MONTH, query = "select r from ANMReportData r, ANM a, Indicator i " - + "where r.anm=a.id and r.indicator = i.id and i.indicator = ? and r.date >= ? and r.date < ?"), - @NamedQuery(name = ANMReportData.FIND_BY_ANM_IDENTIFIER_FOR_REPORTING_MONTH, query = "select r from ANMReportData r, ANM a, Indicator i " - + "where r.anm=a.id and r.indicator = i.id and a.anmIdentifier = ? and r.date >= ? and r.date < ?"), - @NamedQuery(name = ANMReportData.FIND_BY_EXTERNAL_IDENTIFIER, query = "select r from ANMReportData r where r.externalId = ?") }) -public class ANMReportData { - - public static final String FIND_BY_ANM_IDENTIFIER_AND_DATE = "find.by.anm.identifier.and.date"; - - public static final String FIND_BY_ANM_IDENTIFIER_WITH_INDICATOR_FOR_MONTH = "find.by.anm.identifier.with.indicator.for.month"; - - public static final String FIND_BY_ANM_IDENTIFIER_FOR_REPORTING_MONTH = "find.by.anm.identifier.for.reporting.month"; - - public static final String FIND_BY_EXTERNAL_IDENTIFIER = "find.by.external.identifier"; - - public String id() { - return id.toString(); - } - - @Id - @Column(name = "id") - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Integer id; - - @ManyToOne - @JoinColumn(name = "anmIdentifier", insertable = true, updatable = true) - private ANM anm; - - @Column(name = "externalId") - private String externalId; - - @Column(name = "date_") - private Date date; - - @ManyToOne - @JoinColumn(name = "indicator", insertable = true, updatable = true) - private Indicator indicator; - - private ANMReportData() { - } - - public ANMReportData(ANM anm, String externalId, Indicator indicator, Date date) { - this.anm = anm; - this.externalId = externalId; - this.indicator = indicator; - this.date = date; - } - - public Indicator indicator() { - return indicator; - } - - public Date date() { - return date; - } - - public String externalId() { - return externalId; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, new String[] { "id" }); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, new String[] { "id" }); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - public String anmIdentifier() { - return anm.anmIdentifier(); - } - -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/AnnualTarget.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/AnnualTarget.java deleted file mode 100644 index 6616b11aed..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/AnnualTarget.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.opensrp.reporting.domain; - -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.NamedQuery; -import javax.persistence.Table; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -@Entity -@Table(name = "annual_target") -@NamedQuery(name = AnnualTarget.FIND_BY_ANM_AND_INDICATOR_AND_DATE, query = "select r from AnnualTarget r, ANM a, Indicator i where r.anmIdentifier=a.id and r.indicator=i.id and a.anmIdentifier=:anmIdentifier and i.indicator=:indicator and r.startDate<=:reportDate and r.endDate>=:reportDate") -public class AnnualTarget { - - public static final String FIND_BY_ANM_AND_INDICATOR_AND_DATE = "find.by.anm.and.indicator.and.date"; - - @Id - @Column(name = "id") - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Integer id; - - @Column(name = "anmIdentifier") - private Integer anmIdentifier; - - @Column(name = "indicator") - private Integer indicator; - - @Column(name = "target") - private String target; - - @Column(name = "start_date") - public Date startDate; - - @Column(name = "end_date") - public Date endDate; - - private AnnualTarget() { - } - - public AnnualTarget(Integer anmIdentifier, Integer indicator, String target, Date startDate, Date endDate) { - this.anmIdentifier = anmIdentifier; - this.indicator = indicator; - this.target = target; - this.startDate = startDate; - this.endDate = endDate; - } - - public String target() { - return target; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, new String[] { "id" }); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, new String[] { "id" }); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/Indicator.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/Indicator.java deleted file mode 100644 index 6c59ef2f20..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/Indicator.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.opensrp.reporting.domain; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.NamedQuery; -import javax.persistence.Table; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -@Entity -@Table(name = "dim_indicator") -@NamedQuery(name = Indicator.FIND_BY_INDICATOR, query = "select r from Indicator r where r.indicator=:indicator") -public class Indicator { - - public static final String FIND_BY_INDICATOR = "find.by.indicator"; - - @Id - @Column(name = "id") - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Integer id; - - @Column(name = "indicator") - private String indicator; - - private Indicator() { - } - - public Indicator(String indicator) { - this(0, indicator); - } - - public Indicator(Integer id, String indicator) { - this.id = id; - this.indicator = indicator; - } - - public Integer id() { - return id; - } - - public String indicator() { - return indicator; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, new String[] { "id" }); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, new String[] { "id" }); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/Location.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/Location.java deleted file mode 100644 index 20df4f0405..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/Location.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.opensrp.reporting.domain; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.Table; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -@Entity -@Table(name = "dim_location") -@NamedQueries({ - @NamedQuery(name = Location.FIND_BY_VILLAGE_SUBCENTER_AND_PHC_IDENTIFIER, query = "select r from Location r, PHC p where r.phc=p.id and r.village=:village and r.subCenter=:subCenter and p.phcIdentifier=:phcIdentifier"), - @NamedQuery(name = Location.FIND_BY_ANM_IDENTIFIER, query = "select r from Location r, PHC p, SP_ANM a where r.phc=p.id and r.subCenter=a.subCenter and a.anmIdentifier=:anmIdentifier"), - @NamedQuery(name = Location.FIND_VILLAGES_BY_PHC_AND_SUBCENTER, query = "select r from Location r, PHC p where r.phc = p.id and p.phcIdentifier = :phcIdentifier and r.subCenter =:subCenter") }) -public class Location { - - public static final String FIND_BY_VILLAGE_SUBCENTER_AND_PHC_IDENTIFIER = "find.by.village.subcenter.and.phcIdentifier"; - - public static final String FIND_BY_ANM_IDENTIFIER = "find.by.anmIdentifier"; - - public static final String FIND_VILLAGES_BY_PHC_AND_SUBCENTER = "find.villages.by.phc.and.subcenter"; - - @Id - @Column(name = "id") - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Integer id; - - @Column(name = "village") - private String village; - - @Column(name = "subCenter") - private String subCenter; - - @JoinColumn(name = "phc", insertable = true, updatable = true) - @ManyToOne - private PHC phc; - - @Column(name = "taluka") - private String taluka; - - @Column(name = "district") - private String district; - - @Column(name = "state") - private String state; - - private Location() { - } - - public Location(Integer id, String village, String subCenter, PHC phc, String taluka, String district, String state) { - this.id = id; - this.village = village; - this.subCenter = subCenter; - this.phc = phc; - this.taluka = taluka; - this.district = district; - this.state = state; - } - - public Location(String village, String subCenter, PHC phc, String taluka, String district, String state) { - this(0, village, subCenter, phc, taluka, district, state); - } - - public Integer id() { - return id; - } - - public String village() { - return village; - } - - public String subCenter() { - return subCenter; - } - - public PHC phc() { - return phc; - } - - public String phcName() { - return phc.name(); - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, new String[] { "id" }); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, new String[] { "id" }); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - public String taluka() { - return taluka; - } - - public String district() { - return district; - } - - public String state() { - return state; - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/PHC.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/PHC.java deleted file mode 100644 index 170548ac68..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/PHC.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.opensrp.reporting.domain; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.NamedQuery; -import javax.persistence.Table; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -@Entity -@Table(name = "dim_phc") -@NamedQuery(name = PHC.FIND_BY_PHC_IDENTIFIER, query = "select r from PHC r where r.phcIdentifier=:phcIdentifier") -public class PHC { - - public static final String FIND_BY_PHC_IDENTIFIER = "find.by.phc.identifier"; - - @Id - @Column(name = "id") - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Integer id; - - @Column(name = "phcIdentifier") - private String phcIdentifier; - - @Column(name = "name") - private String name; - - private PHC() { - } - - public PHC(String phcIdentifier, String name) { - this(0, phcIdentifier, name); - } - - public PHC(Integer id, String phcIdentifier, String name) { - this.id = id; - this.phcIdentifier = phcIdentifier; - this.name = name; - } - - public Integer id() { - return id; - } - - public String phcIdentifier() { - return phcIdentifier; - } - - public String name() { - return name; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, new String[] { "id" }); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, new String[] { "id" }); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/SP_ANM.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/SP_ANM.java deleted file mode 100644 index b08bb2e9bd..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/SP_ANM.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.opensrp.reporting.domain; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.Table; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -@Entity -@Table(name = "dim_anm") -@NamedQueries({ - @NamedQuery(name = SP_ANM.FIND_ANMS_IN_SAME_PHC, query = "select a from SP_ANM a where a.phcId=(select anm.phcId from SP_ANM anm where anm.anmIdentifier=:anmIdentifier)"), - @NamedQuery(name = SP_ANM.FIND_ANMS_IN_SAME_SC, query = "select a from SP_ANM a where a.subCenter=(select anm.subCenter from SP_ANM anm where anm.anmIdentifier=:anmIdentifier)") }) -public class SP_ANM { - - public static final String FIND_ANMS_IN_SAME_PHC = "find.anms.in.same.phc"; - - public static final String FIND_ANMS_IN_SAME_SC = "find.anms.in.same.sc"; - - @Id - @Column(name = "id") - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Integer id; - - @Column(name = "anmIdentifier") - private String anmIdentifier; - - @Column(name = "phc") - private Integer phcId; - - @Column(name = "subcenter") - private String subCenter; - - @Column(name = "name") - private String name; - - private SP_ANM() { - } - - public SP_ANM(String identifier, String name, String subCenter, Integer phcId) { - this.anmIdentifier = identifier; - this.subCenter = subCenter; - this.phcId = phcId; - this.name = name; - } - - public Integer id() { - return id; - } - - public String identifier() { - return anmIdentifier; - } - - public String name() { - return name; - } - - public String subCenter() { - return subCenter; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, new String[] { "id" }); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, new String[] { "id" }); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ServiceProvided.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ServiceProvided.java deleted file mode 100644 index bd7aab80a4..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ServiceProvided.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.opensrp.reporting.domain; - -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.Table; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -@Entity -@Table(name = "service_provided") -@NamedQueries({ - @NamedQuery(name = ServiceProvided.FIND_BY_ANM_IDENTIFIER_WITH_INDICATOR_FOR_MONTH, query = "select r from ServiceProvided r, Indicator i " - + "where r.indicator = i.id and i.indicator = ? and r.date >= ? and r.date < ?"), - @NamedQuery(name = ServiceProvided.FIND_SERVICE_PROVIDED_FOR_REPORTING_MONTH, query = "select r from ServiceProvided r, Indicator i,ServiceProvider p, ServiceProviderType spt" - + " where r.indicator = i.id and r.serviceProvider = p.id and p.type = spt.id" - + " and r.date >= ? and r.date < ?"), - @NamedQuery(name = ServiceProvided.FIND_SERVICE_PROVIDED_FOR_DRISTHI_ENTITY_ID, query = "select r from ServiceProvided r where r.dristhiEntityId = ?") }) - -public class ServiceProvided { - - public static final String FIND_BY_ANM_IDENTIFIER_WITH_INDICATOR_FOR_MONTH = "find.service.provided.by.anm.identifier.with.indicator.for.month"; - - public static final String FIND_SERVICE_PROVIDED_FOR_REPORTING_MONTH = "find.service.provided.for.reporting.month"; - - public static final String FIND_SERVICE_PROVIDED_FOR_DRISTHI_ENTITY_ID = "find.service.provided.for.dristhi.entity.id"; - - @Id - @Column(name = "id") - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Integer id; - - @ManyToOne - @JoinColumn(name = "service_provider") - private ServiceProvider serviceProvider; - - @Column(name = "externalId") - private String externalId; - - @ManyToOne - @JoinColumn(name = "indicator") - private Indicator indicator; - - public String id() { - return id.toString(); - } - - public String serviceProviderType() { - return serviceProvider.getType().getType(); - } - - public String indicator() { - return indicator.indicator(); - } - - public String date() { - return date.toString(); - } - - public String dristhiEntityId() { - return this.dristhiEntityId; - } - - public org.opensrp.common.domain.Location location() { - return new org.opensrp.common.domain.Location(location.village(), location.subCenter(), - location.phc().phcIdentifier()); - } - - @Column(name = "date_") - private Date date; - - @Column(name = "dristhi_entity_id") - private String dristhiEntityId; - - @ManyToOne - @JoinColumn(name = "location") - private Location location; - - private ServiceProvided() { - } - - public ServiceProvided(ServiceProvider serviceProvider, String externalId, Indicator indicator, Date date, - Location location, String dristhiEntityId) { - this.serviceProvider = serviceProvider; - this.externalId = externalId; - this.indicator = indicator; - this.date = date; - this.location = location; - this.dristhiEntityId = dristhiEntityId; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, new String[] { "id", "revision" }); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, new String[] { "id", "revision" }); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ServiceProvidedReport.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ServiceProvidedReport.java deleted file mode 100644 index 3030477aad..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ServiceProvidedReport.java +++ /dev/null @@ -1,143 +0,0 @@ -package org.opensrp.reporting.domain; - -import java.text.SimpleDateFormat; -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.NamedQuery; -import javax.persistence.Table; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -@Entity -@Table(name = "service_provided_report_view") -@NamedQuery(name = ServiceProvidedReport.FIND_NEW_SERVICE_PROVIDED, query = "select r from ServiceProvidedReport r where r.id > ? order by r.id") -public class ServiceProvidedReport { - - public static final String FIND_NEW_SERVICE_PROVIDED = "find.new.service.provided"; - - @Id - @Column(name = "id", insertable = false, updatable = false) - private Integer id; - - @Column(name = "anmidentifier", insertable = false, updatable = false) - private String anmIdentifier; - - @Column(name = "service_provided_type", insertable = false, updatable = false) - private String type; - - @Column(name = "indicator", insertable = false, updatable = false) - private String indicator; - - @Column(name = "service_date", insertable = false, updatable = false) - private Date date; - - @Column(name = "village", insertable = false, updatable = false) - private String village; - - @Column(name = "subcenter", insertable = false, updatable = false) - private String subCenter; - - @Column(name = "phc", insertable = false, updatable = false) - private String phc; - - @Column(name = "taluka", insertable = false, updatable = false) - private String taluka; - - @Column(name = "district", insertable = false, updatable = false) - private String district; - - @Column(name = "state", insertable = false, updatable = false) - private String state; - - public ServiceProvidedReport(Integer id, String anmIdentifier, String type, String indicator, Date date, String village, - String subCenter, String phc, String taluka, String district, String state) { - this.id = id; - this.anmIdentifier = anmIdentifier; - this.type = type; - this.indicator = indicator; - this.date = date; - this.village = village; - this.subCenter = subCenter; - this.phc = phc; - this.taluka = taluka; - this.district = district; - this.state = state; - } - - public ServiceProvidedReport() { - } - - public Integer id() { - return id; - } - - public String anmIdentifier() { - return anmIdentifier; - } - - public String type() { - return type; - } - - public String indicator() { - return indicator; - } - - public String date() { - return new SimpleDateFormat("yyyy-MM-dd").format(date); - } - - public String village() { - return village; - } - - public String subCenter() { - return subCenter; - } - - public String phc() { - return phc; - } - - public String taluka() { - return taluka; - } - - public String district() { - return district; - } - - public String state() { - return state; - } - - public ServiceProvidedReport withId(Integer id) { - this.id = id; - return this; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, new String[] { "id" }); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, new String[] { "id" }); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - public ServiceProvidedReport withDate(Date date) { - this.date = date; - return this; - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ServiceProvider.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ServiceProvider.java deleted file mode 100644 index 00325966c4..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ServiceProvider.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.opensrp.reporting.domain; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.Table; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -@Entity -@Table(name = "dim_service_provider") -@NamedQueries({ - @NamedQuery(name = ServiceProvider.FIND_BY_PHC_IDENTIFIER, query = "select r from ServiceProvider r, PHC p, ServiceProviderType s where r.serviceProvider = p.id and r.type = s.id and p.phcIdentifier=:phcIdentifier and s.type='PHC'"), - @NamedQuery(name = ServiceProvider.FIND_BY_ANM_IDENTIFIER, query = "select r from ServiceProvider r, SP_ANM a, ServiceProviderType s where r.serviceProvider = a.id and r.type = s.id and a.anmIdentifier=:anmIdentifier and s.type='ANM'") }) -public class ServiceProvider { - - public static final String FIND_BY_PHC_IDENTIFIER = "find.service.provider.by.phc.identifier"; - - public static final String FIND_BY_ANM_IDENTIFIER = "find.service.provider.by.anm.identifier"; - - @Id - @Column(name = "id") - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Integer id; - - @Column(name = "service_provider") - private Integer serviceProvider; - - @ManyToOne - @JoinColumn(name = "type", insertable = true, updatable = true) - private ServiceProviderType type; - - private ServiceProvider() { - } - - public ServiceProvider(Integer id, Integer serviceProvider, ServiceProviderType type) { - this.id = id; - this.serviceProvider = serviceProvider; - this.type = type; - } - - public ServiceProvider(Integer serviceProvider, ServiceProviderType type) { - this.serviceProvider = serviceProvider; - this.type = type; - } - - public Integer id() { - return id; - } - - public Integer serviceProviderId() { - return serviceProvider; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, new String[] { "id" }); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, new String[] { "id" }); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - public ServiceProviderType getType() { - return type; - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ServiceProviderType.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ServiceProviderType.java deleted file mode 100644 index 4a70afee5a..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/ServiceProviderType.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.opensrp.reporting.domain; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -@Entity -@Table(name = "dim_service_provider_type") -public class ServiceProviderType { - - public static final ServiceProviderType PHC = new ServiceProviderType("PHC"); - - public static final ServiceProviderType ANM = new ServiceProviderType("ANM"); - - @Id - @Column(name = "id") - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Integer id; - - public String getType() { - return type; - } - - @Column(name = "type") - private String type; - - private ServiceProviderType() { - } - - public ServiceProviderType(String type) { - this.type = type; - } - - public Integer id() { - return id; - } - - public static ServiceProviderType parse(String serviceProviderType) { - return ANM.type.equalsIgnoreCase(serviceProviderType) ? ANM : PHC; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, new String[] { "id" }); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, new String[] { "id" }); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - public String type() { - return type; - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/Token.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/Token.java deleted file mode 100644 index 228b5b518a..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/domain/Token.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.opensrp.reporting.domain; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.NamedQuery; -import javax.persistence.Table; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -@Entity -@Table(name = "token") -@NamedQuery(name = Token.FIND_TOKEN_BY_NAME, query = "select t from Token t where t.name = :name") -public class Token { - - public static final String FIND_TOKEN_BY_NAME = "find.token.by.name"; - - @Id - @Column(name = "id") - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Integer id; - - @Column(name = "name") - private String name; - - @Column(name = "value") - private String value; - - private Token() { - } - - public Token(String name, String value) { - this.name = name; - this.value = value; - } - - public Integer id() { - return id; - } - - public String name() { - return name; - } - - public String value() { - return value; - } - - public Token withValue(String value) { - this.value = value; - return this; - } - - @Override - public boolean equals(Object o) { - return EqualsBuilder.reflectionEquals(this, o, new String[] { "id" }); - } - - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this, new String[] { "id" }); - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/factory/DetailsFetcherFactory.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/factory/DetailsFetcherFactory.java deleted file mode 100644 index 0dadd691b6..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/factory/DetailsFetcherFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.opensrp.reporting.factory; - -import java.util.List; - -import org.opensrp.reporting.controller.ANMDetailsFetcher; -import org.opensrp.reporting.controller.PHCUserDetailsFetcher; -import org.opensrp.reporting.controller.SCUserDetailsFetcher; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class DetailsFetcherFactory { - - private static String PHC_USER_ROLE = "ROLE_PHC_USER"; - - private static String SC_USER_ROLE = "ROLE_USER"; - - private SCUserDetailsFetcher scUserDetailsFetcher; - - private PHCUserDetailsFetcher phcUserDetailsFetcher; - - @Autowired - public DetailsFetcherFactory(SCUserDetailsFetcher scUserDetailsFetcher, PHCUserDetailsFetcher phcUserDetailsFetcher) { - this.scUserDetailsFetcher = scUserDetailsFetcher; - this.phcUserDetailsFetcher = phcUserDetailsFetcher; - } - - public ANMDetailsFetcher detailsFetcher(List roles) { - if (roles.contains(PHC_USER_ROLE)) { - return phcUserDetailsFetcher; - } - return scUserDetailsFetcher; - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/listener/AggregateReportsEventListener.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/listener/AggregateReportsEventListener.java deleted file mode 100644 index 1fffa24d28..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/listener/AggregateReportsEventListener.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.opensrp.reporting.listener; - -import org.motechproject.scheduler.domain.MotechEvent; -import org.motechproject.server.event.annotations.MotechListener; -import org.opensrp.reporting.service.AggregateReportsService; -import org.opensrp.scheduler.AggregateReportsScheduler; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class AggregateReportsEventListener { - - private AggregateReportsService aggregateReportsService; - - @Autowired - public AggregateReportsEventListener(AggregateReportsService aggregateReportsService) { - this.aggregateReportsService = aggregateReportsService; - } - - @MotechListener(subjects = AggregateReportsScheduler.SUBJECT) - public void aggregate(MotechEvent event) { - aggregateReportsService.sendReportsToAggregator(); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/listener/ReportApplicationStartupListener.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/listener/ReportApplicationStartupListener.java deleted file mode 100644 index 5ecaf7d27b..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/listener/ReportApplicationStartupListener.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.opensrp.reporting.listener; - -import java.text.MessageFormat; - -import org.opensrp.scheduler.AggregateReportsScheduler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.ApplicationListener; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.stereotype.Component; - -@Component -public class ReportApplicationStartupListener implements ApplicationListener { - - private static Logger logger = LoggerFactory.getLogger(ReportApplicationStartupListener.class.toString()); - - private String APPLICATION_ID; - - private AggregateReportsScheduler aggregateReportsScheduler; - - @Autowired - public ReportApplicationStartupListener(@Value("#{opensrp['application.context']}") String applicationContext, - AggregateReportsScheduler aggregateReportsScheduler) { - APPLICATION_ID = applicationContext; - this.aggregateReportsScheduler = aggregateReportsScheduler; - } - - @Override - public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { - logger.info(MessageFormat.format("OpenSRP report service is starting. Application id: {0}", - contextRefreshedEvent.getApplicationContext().getId())); - if (APPLICATION_ID.equals(contextRefreshedEvent.getApplicationContext().getId())) { - aggregateReportsScheduler.startTimedScheduler(); - logger.info("Aggregation of Reports scheduled..."); - } - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/ANMReportsRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/ANMReportsRepository.java deleted file mode 100644 index 83a0dced06..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/ANMReportsRepository.java +++ /dev/null @@ -1,192 +0,0 @@ -package org.opensrp.reporting.repository; - -import static ch.lambdaj.Lambda.collect; -import static ch.lambdaj.Lambda.filter; -import static ch.lambdaj.Lambda.having; -import static ch.lambdaj.Lambda.on; -import static ch.lambdaj.Lambda.selectDistinct; -import static java.lang.String.valueOf; -import static org.hamcrest.Matchers.allOf; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.greaterThanOrEqualTo; -import static org.hamcrest.Matchers.lessThanOrEqualTo; -import static org.opensrp.common.AllConstants.ReportDataParameters.ANM_IDENTIFIER; -import static org.opensrp.common.AllConstants.ReportDataParameters.EXTERNAL_ID; -import static org.opensrp.common.AllConstants.ReportDataParameters.QUANTITY; -import static org.opensrp.common.AllConstants.ReportDataParameters.SERVICE_PROVIDED_DATE; -import static org.opensrp.common.monitor.Metric.REPORTING_ANM_REPORTS_CACHE_TIME; -import static org.opensrp.common.monitor.Metric.REPORTING_ANM_REPORTS_INSERT_TIME; -import static org.opensrp.common.util.DateUtil.today; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.joda.time.LocalDate; -import org.opensrp.common.domain.ANMIndicatorSummary; -import org.opensrp.common.domain.ANMReport; -import org.opensrp.common.domain.MonthSummary; -import org.opensrp.common.domain.ReportDataDeleteRequest; -import org.opensrp.common.domain.ReportDataUpdateRequest; -import org.opensrp.common.domain.ReportMonth; -import org.opensrp.common.domain.ReportingData; -import org.opensrp.common.monitor.Monitor; -import org.opensrp.common.monitor.Probe; -import org.opensrp.reporting.domain.ANM; -import org.opensrp.reporting.domain.ANMReportData; -import org.opensrp.reporting.domain.AnnualTarget; -import org.opensrp.reporting.domain.Indicator; -import org.opensrp.reporting.repository.cache.ANMCacheableRepository; -import org.opensrp.reporting.repository.cache.IndicatorCacheableRepository; -import org.opensrp.reporting.repository.cache.ReadOnlyCachingRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Repository -public class ANMReportsRepository { - - private ReportMonth reportMonth; - - private AllANMReportDataRepository anmReportDataRepository; - - private AllAnnualTargetsRepository annualTargetsRepository; - - private Monitor monitor; - - private ReadOnlyCachingRepository cachedANMs; - - private ReadOnlyCachingRepository cachedIndicators; - - protected ANMReportsRepository() { - } - - @Autowired - public ANMReportsRepository(ANMCacheableRepository anmRepository, - @Qualifier("anmReportsIndicatorRepository") IndicatorCacheableRepository indicatorRepository, - AllANMReportDataRepository anmReportDataRepository, AllAnnualTargetsRepository annualTargetsRepository, - Monitor monitor, ReportMonth reportMonth) { - this.anmReportDataRepository = anmReportDataRepository; - this.annualTargetsRepository = annualTargetsRepository; - this.monitor = monitor; - this.reportMonth = reportMonth; - cachedANMs = new ReadOnlyCachingRepository<>(anmRepository); - cachedIndicators = new ReadOnlyCachingRepository<>(indicatorRepository); - } - - @Transactional("anm_report") - public void save(String anmIdentifier, String externalId, String indicator, String date, String quantity) { - Probe probeForCache = monitor.start(REPORTING_ANM_REPORTS_CACHE_TIME); - ANM anm = cachedANMs.fetch(new ANM(anmIdentifier)); - Indicator fetchedIndicator = cachedIndicators.fetch(new Indicator(indicator)); - monitor.end(probeForCache); - - int count = getCount(quantity); - Probe probeForInsert = monitor.start(REPORTING_ANM_REPORTS_INSERT_TIME); - for (int i = 0; i < count; i++) { - try { - anmReportDataRepository.save(anm, externalId, fetchedIndicator, LocalDate.parse(date).toDate()); - } - catch (Exception e) { - cachedANMs.clear(anm); - cachedIndicators.clear(fetchedIndicator); - } - } - monitor.end(probeForInsert); - } - - //Todo: Need to refactor - @Transactional("anm_report") - public List fetchANMSummary(String anmIdentifier) { - List anmIndicatorSummaries = new ArrayList<>(); - - List allReportData = anmReportDataRepository.fetchByANMIdAndDate(anmIdentifier, - reportMonth.startDateOfReportingYear()); - - Collection indicators = getDistinctIndicators(allReportData); - for (Indicator indicator : indicators) { - List allReportDataForIndicator = filterReportsByIndicator(allReportData, indicator); - int aggregatedProgress = 0; - List monthSummaries = new ArrayList<>(); - - for (LocalDate indexDate = new LocalDate(reportMonth.startDateOfReportingYear()); indexDate - .isBefore(reportMonth.startDateOfNextReportingMonth(today())); indexDate = indexDate.plusMonths(1)) { - LocalDate reportingMonthEndDate = new LocalDate(indexDate).plusMonths(1); - List allReportDataForAMonth = filterReportsByMonth(allReportDataForIndicator, indexDate, - reportMonth.endDateOfReportingMonthGivenStartDate(indexDate)); - if (allReportDataForAMonth.size() == 0) { - continue; - } - - int currentProgress = allReportDataForAMonth.size(); - aggregatedProgress += currentProgress; - List externalIds = getAllExternalIds(allReportDataForAMonth); - - monthSummaries.add(new MonthSummary(valueOf(reportingMonthEndDate.getMonthOfYear()), - valueOf(reportingMonthEndDate.getYear()), valueOf(currentProgress), valueOf(aggregatedProgress), - externalIds)); - } - AnnualTarget annualTarget = annualTargetsRepository.fetchFor(anmIdentifier, indicator, today().toDate()); - String target = annualTarget == null ? null : annualTarget.target(); - anmIndicatorSummaries.add(new ANMIndicatorSummary(indicator.indicator(), target, monthSummaries)); - } - return anmIndicatorSummaries; - } - - @Transactional("anm_report") - public List fetchAllANMsReport() { - List allANMs = cachedANMs.fetchAll(); - ArrayList anmReports = new ArrayList<>(); - for (ANM anm : allANMs) { - anmReports.add(new ANMReport(anm.anmIdentifier(), fetchANMSummary(anm.anmIdentifier()))); - } - return anmReports; - } - - private List getAllExternalIds(List reportDataList) { - Collection externalIds = selectDistinct(collect(reportDataList, on(ANMReportData.class).externalId())); - return new ArrayList<>(externalIds); - } - - private Collection getDistinctIndicators(List reportDataList) { - return selectDistinct(collect(reportDataList, on(ANMReportData.class).indicator())); - } - - private List filterReportsByMonth(List reportDataList, LocalDate startDate, - LocalDate endDate) { - return filter(having(on(ANMReportData.class).date(), - allOf(greaterThanOrEqualTo(startDate.toDate()), lessThanOrEqualTo(endDate.toDate()))), reportDataList); - } - - private List filterReportsByIndicator(List reportDataList, Indicator indicator) { - return filter(having(on(ANMReportData.class).indicator(), equalTo(indicator)), reportDataList); - } - - private int getCount(String quantity) { - return quantity == null ? 1 : Integer.parseInt(quantity); - } - - @Transactional("anm_report") - public void update(ReportDataUpdateRequest request) { - anmReportDataRepository.delete(request.indicator(), request.startDate(), request.endDate()); - saveReportDataForIndicator(request.reportingData(), request.indicator()); - } - - private void saveReportDataForIndicator(List reportingData, String indicator) { - for (ReportingData data : reportingData) { - save(data.get(ANM_IDENTIFIER), data.get(EXTERNAL_ID), indicator, data.get(SERVICE_PROVIDED_DATE), - data.get(QUANTITY)); - } - } - - @Transactional("anm_report") - public List getReportsFor(String anmId, String startDate, String endDate) { - return anmReportDataRepository.getReportsFor(anmId, startDate, endDate); - } - - @Transactional("anm_report") - public void delete(ReportDataDeleteRequest request) { - anmReportDataRepository.deleteReportsForExternalId(request.dristhiEntityId()); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllANMReportDataRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllANMReportDataRepository.java deleted file mode 100644 index f87f1724bb..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllANMReportDataRepository.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.opensrp.reporting.repository; - -import static org.opensrp.reporting.domain.ANMReportData.FIND_BY_ANM_IDENTIFIER_AND_DATE; -import static org.opensrp.reporting.domain.ANMReportData.FIND_BY_ANM_IDENTIFIER_FOR_REPORTING_MONTH; -import static org.opensrp.reporting.domain.ANMReportData.FIND_BY_ANM_IDENTIFIER_WITH_INDICATOR_FOR_MONTH; -import static org.opensrp.reporting.domain.ANMReportData.FIND_BY_EXTERNAL_IDENTIFIER; - -import java.util.Date; -import java.util.List; - -import org.joda.time.LocalDate; -import org.opensrp.reporting.domain.ANM; -import org.opensrp.reporting.domain.ANMReportData; -import org.opensrp.reporting.domain.Indicator; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllANMReportDataRepository { - - private DataAccessTemplate dataAccessTemplate; - - protected AllANMReportDataRepository() { - } - - @Autowired - public AllANMReportDataRepository(@Qualifier("anmReportsDataAccessTemplate") DataAccessTemplate dataAccessTemplate) { - this.dataAccessTemplate = dataAccessTemplate; - } - - public void save(ANM anm, String externalId, Indicator indicator, Date date) { - dataAccessTemplate.save(new ANMReportData(anm, externalId, indicator, date)); - } - - public List fetchByANMIdAndDate(String anmIdentifier, Date date) { - return (List) dataAccessTemplate.findByNamedQueryAndNamedParam(FIND_BY_ANM_IDENTIFIER_AND_DATE, - new String[] { "anmIdentifier", "date" }, new Object[] { anmIdentifier, date }); - - } - - public void delete(String indicator, String startDate, String endDate) { - List result = dataAccessTemplate.findByNamedQuery(FIND_BY_ANM_IDENTIFIER_WITH_INDICATOR_FOR_MONTH, - new Object[] { indicator, LocalDate.parse(startDate).toDate(), LocalDate.parse(endDate).toDate() }); - dataAccessTemplate.deleteAll(result); - } - - public List getReportsFor(String anmId, String startDate, String endDate) { - return dataAccessTemplate.findByNamedQuery(FIND_BY_ANM_IDENTIFIER_FOR_REPORTING_MONTH, - new Object[] { anmId, LocalDate.parse(startDate).toDate(), LocalDate.parse(endDate).toDate() }); - } - - public List getReportsForExternalId(String externalId) { - return dataAccessTemplate.findByNamedQuery(FIND_BY_EXTERNAL_IDENTIFIER, externalId); - } - - public void deleteReportsForExternalId(String externalId) { - dataAccessTemplate.deleteAll(getReportsForExternalId(externalId)); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllANMsRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllANMsRepository.java deleted file mode 100644 index 90fddbd201..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllANMsRepository.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.opensrp.reporting.repository; - -import static org.opensrp.reporting.domain.ANM.FIND_BY_ANM_ID; - -import java.util.List; - -import org.opensrp.reporting.domain.ANM; -import org.opensrp.reporting.repository.cache.ANMCacheableRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllANMsRepository implements ANMCacheableRepository { - - private DataAccessTemplate dataAccessTemplate; - - protected AllANMsRepository() { - } - - @Autowired - public AllANMsRepository(@Qualifier("anmReportsDataAccessTemplate") DataAccessTemplate dataAccessTemplate) { - this.dataAccessTemplate = dataAccessTemplate; - } - - @Override - public ANM fetch(ANM object) { - return (ANM) dataAccessTemplate.getUniqueResult(FIND_BY_ANM_ID, new String[] { "anmIdentifier" }, - new Object[] { object.anmIdentifier() }); - } - - @Override - public List fetchAll() { - return dataAccessTemplate.loadAll(ANM.class); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllAnnualTargetsRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllAnnualTargetsRepository.java deleted file mode 100644 index da66f390e4..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllAnnualTargetsRepository.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.opensrp.reporting.repository; - -import static org.opensrp.reporting.domain.AnnualTarget.FIND_BY_ANM_AND_INDICATOR_AND_DATE; - -import java.util.Date; - -import org.opensrp.reporting.domain.AnnualTarget; -import org.opensrp.reporting.domain.Indicator; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllAnnualTargetsRepository { - - private DataAccessTemplate dataAccessTemplate; - - protected AllAnnualTargetsRepository() { - } - - @Autowired - public AllAnnualTargetsRepository(@Qualifier("anmReportsDataAccessTemplate") DataAccessTemplate dataAccessTemplate) { - this.dataAccessTemplate = dataAccessTemplate; - } - - public AnnualTarget fetchFor(String anmIdentifier, Indicator indicator, Date reportDate) { - return (AnnualTarget) dataAccessTemplate.getUniqueResult(FIND_BY_ANM_AND_INDICATOR_AND_DATE, - new String[] { "anmIdentifier", "indicator", "reportDate" }, - new Object[] { anmIdentifier, indicator.indicator(), reportDate }); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllIndicatorsRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllIndicatorsRepository.java deleted file mode 100644 index 15147e74ef..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllIndicatorsRepository.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.opensrp.reporting.repository; - -import static org.opensrp.reporting.domain.Indicator.FIND_BY_INDICATOR; - -import java.util.List; - -import org.opensrp.reporting.domain.Indicator; -import org.opensrp.reporting.repository.cache.IndicatorCacheableRepository; -import org.springframework.stereotype.Repository; - -@Repository -public class AllIndicatorsRepository implements IndicatorCacheableRepository { - - private DataAccessTemplate dataAccessTemplate; - - protected AllIndicatorsRepository() { - } - - public AllIndicatorsRepository(DataAccessTemplate dataAccessTemplate) { - this.dataAccessTemplate = dataAccessTemplate; - } - - @Override - public Indicator fetch(Indicator objectWhichShouldBeFilledWithMoreInformation) { - return (Indicator) dataAccessTemplate.getUniqueResult(FIND_BY_INDICATOR, new String[] { "indicator" }, - new Object[] { objectWhichShouldBeFilledWithMoreInformation.indicator() }); - } - - @Override - public List fetchAll() { - return dataAccessTemplate.loadAll(Indicator.class); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllLocationsRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllLocationsRepository.java deleted file mode 100644 index f0dc901952..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllLocationsRepository.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.opensrp.reporting.repository; - -import java.util.List; - -import org.opensrp.reporting.domain.Location; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllLocationsRepository { - - private DataAccessTemplate dataAccessTemplate; - - protected AllLocationsRepository() { - } - - @Autowired - public AllLocationsRepository(@Qualifier("serviceProvidedDataAccessTemplate") DataAccessTemplate dataAccessTemplate) { - this.dataAccessTemplate = dataAccessTemplate; - } - - public Location fetchBy(String village, String subCenter, String phcIdentifier) { - return (Location) dataAccessTemplate.getUniqueResult(Location.FIND_BY_VILLAGE_SUBCENTER_AND_PHC_IDENTIFIER, - new String[] { "village", "subCenter", "phcIdentifier" }, new Object[] { village, subCenter, phcIdentifier }); - - } - - public Location fetchByANMIdentifier(String anmIdentifier) { - return (Location) dataAccessTemplate.findByNamedQueryAndNamedParam(Location.FIND_BY_ANM_IDENTIFIER, - new String[] { "anmIdentifier" }, new Object[] { anmIdentifier }).get(0); - } - - public List fetchVillagesForANM(String anmIdentifier) { - Location location = fetchByANMIdentifier(anmIdentifier); - if (location == null) - return null; - return dataAccessTemplate.findByNamedQueryAndNamedParam(Location.FIND_VILLAGES_BY_PHC_AND_SUBCENTER, - new String[] { "phcIdentifier", "subCenter" }, - new Object[] { location.phc().phcIdentifier(), location.subCenter() }); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllSP_ANMsRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllSP_ANMsRepository.java deleted file mode 100644 index 9bd436bcba..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllSP_ANMsRepository.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.opensrp.reporting.repository; - -import java.util.List; - -import org.opensrp.reporting.domain.SP_ANM; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Repository -public class AllSP_ANMsRepository { - - private DataAccessTemplate dataAccessTemplate; - - protected AllSP_ANMsRepository() { - } - - @Autowired - public AllSP_ANMsRepository(@Qualifier("serviceProvidedDataAccessTemplate") DataAccessTemplate dataAccessTemplate) { - this.dataAccessTemplate = dataAccessTemplate; - } - - @Transactional("service_provided") - public List fetchAll() { - return dataAccessTemplate.loadAll(SP_ANM.class); - } - - @Transactional("service_provided") - public List fetchAllANMSInSameSC(String anmIdentifier) { - return (List) dataAccessTemplate.findByNamedQueryAndNamedParam(SP_ANM.FIND_ANMS_IN_SAME_SC, - new String[] { "anmIdentifier" }, new Object[] { anmIdentifier }); - } - - @Transactional("service_provided") - public List fetchAllANMSInSamePHC(String anmIdentifier) { - return (List) dataAccessTemplate.findByNamedQueryAndNamedParam(SP_ANM.FIND_ANMS_IN_SAME_PHC, - new String[] { "anmIdentifier" }, new Object[] { anmIdentifier }); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllServiceProvidersRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllServiceProvidersRepository.java deleted file mode 100644 index 9af610f96c..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllServiceProvidersRepository.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.opensrp.reporting.repository; - -import static org.opensrp.reporting.domain.ServiceProvider.FIND_BY_ANM_IDENTIFIER; -import static org.opensrp.reporting.domain.ServiceProvider.FIND_BY_PHC_IDENTIFIER; -import static org.opensrp.reporting.domain.ServiceProviderType.ANM; - -import org.opensrp.reporting.domain.ServiceProvider; -import org.opensrp.reporting.domain.ServiceProviderType; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllServiceProvidersRepository { - - private DataAccessTemplate dataAccessTemplate; - - protected AllServiceProvidersRepository() { - } - - @Autowired - public AllServiceProvidersRepository( - @Qualifier("serviceProvidedDataAccessTemplate") DataAccessTemplate dataAccessTemplate) { - this.dataAccessTemplate = dataAccessTemplate; - } - - public ServiceProvider fetchBy(String serviceProviderIdentifier, ServiceProviderType type) { - if (ANM.equals(type)) { - return (ServiceProvider) dataAccessTemplate.getUniqueResult(FIND_BY_ANM_IDENTIFIER, - new String[] { "anmIdentifier" }, new Object[] { serviceProviderIdentifier }); - } - return (ServiceProvider) dataAccessTemplate.getUniqueResult(FIND_BY_PHC_IDENTIFIER, new String[] { "phcIdentifier" }, - new Object[] { serviceProviderIdentifier }); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllServicesProvidedRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllServicesProvidedRepository.java deleted file mode 100644 index c1437bb6d2..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllServicesProvidedRepository.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.opensrp.reporting.repository; - -import java.util.Date; -import java.util.List; - -import org.joda.time.LocalDate; -import org.opensrp.reporting.domain.Indicator; -import org.opensrp.reporting.domain.Location; -import org.opensrp.reporting.domain.ServiceProvided; -import org.opensrp.reporting.domain.ServiceProvidedReport; -import org.opensrp.reporting.domain.ServiceProvider; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllServicesProvidedRepository { - - private DataAccessTemplate dataAccessTemplate; - - protected AllServicesProvidedRepository() { - } - - @Autowired - public AllServicesProvidedRepository( - @Qualifier("serviceProvidedDataAccessTemplate") DataAccessTemplate dataAccessTemplate) { - this.dataAccessTemplate = dataAccessTemplate; - } - - public void save(ServiceProvider serviceProvider, String externalId, Indicator indicator, Date date, Location location, - String dristhiEntityId) { - dataAccessTemplate - .save(new ServiceProvided(serviceProvider, externalId, indicator, date, location, dristhiEntityId)); - } - - public void delete(String indicator, String startDate, String endDate) { - List result = dataAccessTemplate.findByNamedQuery(ServiceProvided.FIND_BY_ANM_IDENTIFIER_WITH_INDICATOR_FOR_MONTH, - indicator, LocalDate.parse(startDate).toDate(), LocalDate.parse(endDate).toDate()); - dataAccessTemplate.deleteAll(result); - } - - public List getNewReports(Integer token) { - return dataAccessTemplate.findByNamedQuery(ServiceProvidedReport.FIND_NEW_SERVICE_PROVIDED, token); - } - - public List getAllReportsForDristhiEntityID(String dristhiEntityID) { - return dataAccessTemplate.findByNamedQuery(ServiceProvided.FIND_SERVICE_PROVIDED_FOR_DRISTHI_ENTITY_ID, - dristhiEntityID); - } - - public List getNewReports(Integer token, int numberOfRowsToFetch) { - return dataAccessTemplate.getSessionFactory().getCurrentSession() - .getNamedQuery(ServiceProvidedReport.FIND_NEW_SERVICE_PROVIDED).setParameter(0, token) - .setMaxResults(numberOfRowsToFetch).list(); - - } - - public void deleteReportsFor(String dristhiEntityId) { - dataAccessTemplate.deleteAll(getAllReportsForDristhiEntityID(dristhiEntityId)); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllTokensRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllTokensRepository.java deleted file mode 100644 index 459856ccde..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/AllTokensRepository.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.opensrp.reporting.repository; - -import org.opensrp.common.util.IntegerUtil; -import org.opensrp.reporting.domain.Token; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; - -@Repository -public class AllTokensRepository { - - private static final String NAME_PARAMETER = "name"; - - private static final String AGGREGATE_REPORTS_TOKEN_NAME = "aggregate-reports-token"; - - private DataAccessTemplate dataAccessTemplate; - - @Autowired - public AllTokensRepository(@Qualifier("serviceProvidedDataAccessTemplate") DataAccessTemplate dataAccessTemplate) { - this.dataAccessTemplate = dataAccessTemplate; - } - - public Integer getAggregateReportsToken() { - Token token = (Token) dataAccessTemplate.getUniqueResult(Token.FIND_TOKEN_BY_NAME, new String[] { NAME_PARAMETER }, - new String[] { AGGREGATE_REPORTS_TOKEN_NAME }); - return token == null ? 0 : IntegerUtil.tryParse(token.value(), 0); - } - - public void saveAggregateReportsToken(Integer newToken) { - Token token = (Token) dataAccessTemplate.getUniqueResult(Token.FIND_TOKEN_BY_NAME, new String[] { NAME_PARAMETER }, - new String[] { AGGREGATE_REPORTS_TOKEN_NAME }); - if (token == null) { - dataAccessTemplate.save(new Token(AGGREGATE_REPORTS_TOKEN_NAME, newToken.toString())); - } else { - dataAccessTemplate.save(token.withValue(newToken.toString())); - } - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/DataAccessTemplate.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/DataAccessTemplate.java deleted file mode 100644 index fc284a58da..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/DataAccessTemplate.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opensrp.reporting.repository; - -import org.hibernate.SessionFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.dao.support.DataAccessUtils; -import org.springframework.orm.hibernate3.HibernateTemplate; -import org.springframework.stereotype.Component; - -@Component -@Scope(value = "prototype") -public class DataAccessTemplate extends HibernateTemplate { - - @Autowired - public DataAccessTemplate(SessionFactory sessionFactory) { - super(sessionFactory); - setAllowCreate(false); - } - - public Object getUniqueResult(String namedQueryName, String[] parameterNames, Object[] parameterValues) { - return DataAccessUtils.uniqueResult(findByNamedQueryAndNamedParam(namedQueryName, parameterNames, parameterValues)); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/ServicesProvidedRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/ServicesProvidedRepository.java deleted file mode 100644 index fdf9f2a018..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/ServicesProvidedRepository.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.opensrp.reporting.repository; - -import static org.opensrp.common.monitor.Metric.REPORTING_SERVICE_PROVIDED_CACHE_TIME; -import static org.opensrp.common.monitor.Metric.REPORTING_SERVICE_PROVIDED_INSERT_TIME; -import static org.opensrp.reporting.domain.ServiceProviderType.parse; - -import java.util.Date; -import java.util.List; - -import org.joda.time.LocalDate; -import org.opensrp.common.AllConstants; -import org.opensrp.common.domain.ReportDataDeleteRequest; -import org.opensrp.common.domain.ReportDataUpdateRequest; -import org.opensrp.common.domain.ReportingData; -import org.opensrp.common.monitor.Monitor; -import org.opensrp.common.monitor.Probe; -import org.opensrp.reporting.domain.Indicator; -import org.opensrp.reporting.domain.Location; -import org.opensrp.reporting.domain.ServiceProvidedReport; -import org.opensrp.reporting.domain.ServiceProvider; -import org.opensrp.reporting.repository.cache.IndicatorCacheableRepository; -import org.opensrp.reporting.repository.cache.ReadOnlyCachingRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -@Repository -public class ServicesProvidedRepository { - - private AllServiceProvidersRepository serviceProvidersRepository; - - private AllServicesProvidedRepository servicesProvidedRepository; - - private Monitor monitor; - - private ReadOnlyCachingRepository cachedIndicators; - - private AllLocationsRepository locationRepository; - - protected ServicesProvidedRepository() { - } - - @Autowired - public ServicesProvidedRepository( - @Qualifier("serviceProvidedIndicatorRepository") IndicatorCacheableRepository indicatorRepository, - AllLocationsRepository locationRepository, AllServiceProvidersRepository serviceProvidersRepository, - AllServicesProvidedRepository servicesProvidedRepository, Monitor monitor) { - this.serviceProvidersRepository = serviceProvidersRepository; - this.servicesProvidedRepository = servicesProvidedRepository; - this.monitor = monitor; - cachedIndicators = new ReadOnlyCachingRepository<>(indicatorRepository); - this.locationRepository = locationRepository; - } - - @Transactional("service_provided") - public void save(String serviceProviderIdentifier, String serviceProviderType, String externalId, String indicator, - String date, String village, String subCenter, String phcIdentifier, String quantity, String dristhiEntityId) { - Probe probeForCache = monitor.start(REPORTING_SERVICE_PROVIDED_CACHE_TIME); - Indicator fetchedIndicator = cachedIndicators.fetch(new Indicator(indicator)); - Date dates = LocalDate.parse(date).toDate(); - Location location = locationRepository.fetchBy(village, subCenter, phcIdentifier); - ServiceProvider serviceProvider = serviceProvidersRepository.fetchBy(serviceProviderIdentifier, - parse(serviceProviderType)); - monitor.end(probeForCache); - - int count = getCount(quantity); - Probe probeForInsert = monitor.start(REPORTING_SERVICE_PROVIDED_INSERT_TIME); - for (int i = 0; i < count; i++) { - try { - servicesProvidedRepository.save(serviceProvider, externalId, fetchedIndicator, dates, location, - dristhiEntityId); - } - catch (Exception e) { - cachedIndicators.clear(fetchedIndicator); - } - } - monitor.end(probeForInsert); - } - - @Transactional("service_provided") - public void update(ReportDataUpdateRequest request) { - servicesProvidedRepository.delete(request.indicator(), request.startDate(), request.endDate()); - saveReportingDataForIndicator(request.reportingData(), request.indicator()); - } - - private void saveReportingDataForIndicator(List reportingData, String indicator) { - for (ReportingData data : reportingData) { - this.save(data.get(AllConstants.ReportDataParameters.ANM_IDENTIFIER), - data.get(AllConstants.ReportDataParameters.SERVICE_PROVIDER_TYPE), - data.get(AllConstants.ReportDataParameters.EXTERNAL_ID), indicator, - data.get(AllConstants.ReportDataParameters.SERVICE_PROVIDED_DATE), - data.get(AllConstants.ReportDataParameters.VILLAGE), data.get(AllConstants.ReportDataParameters.SUB_CENTER), - data.get(AllConstants.ReportDataParameters.PHC), data.get(AllConstants.ReportDataParameters.QUANTITY), - data.get(AllConstants.ReportDataParameters.DRISTHI_ENTITY_ID)); - } - } - - private int getCount(String quantity) { - return quantity == null ? 1 : Integer.parseInt(quantity); - } - - @Transactional("service_provided") - public List getNewReports(Integer token) { - return servicesProvidedRepository.getNewReports(token); - } - - @Transactional("service_provided") - public List getNewReports(Integer token, int numberOfRowsToFetch) { - return servicesProvidedRepository.getNewReports(token, numberOfRowsToFetch); - } - - @Transactional("service_provided") - public void delete(ReportDataDeleteRequest request) { - servicesProvidedRepository.deleteReportsFor(request.dristhiEntityId()); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/ANMCacheableRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/ANMCacheableRepository.java deleted file mode 100644 index a2f20e8bee..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/ANMCacheableRepository.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.opensrp.reporting.repository.cache; - -import org.opensrp.reporting.domain.ANM; - -public interface ANMCacheableRepository extends ReadOnlyCacheableRepository {} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/CacheableRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/CacheableRepository.java deleted file mode 100644 index 6c9e840883..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/CacheableRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.opensrp.reporting.repository.cache; - -import java.util.List; - -public interface CacheableRepository { - - public void save(T objectToBeSaved); - - public T fetch(T objectWhichShouldBeFilledWithMoreInformation); - - public List fetchAll(); - - void flush(); -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/CachingRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/CachingRepository.java deleted file mode 100644 index 91d5435cf6..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/CachingRepository.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.opensrp.reporting.repository.cache; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.locks.ReentrantLock; - -public class CachingRepository { - - private CacheableRepository cacheableRepository; - - private Map cache; - - private static ReentrantLock lock = new ReentrantLock(); - - public CachingRepository(CacheableRepository cacheableRepository) { - this.cacheableRepository = cacheableRepository; - cache = new HashMap<>(); - } - - public T fetch(T object) { - if (cache.containsKey(object)) { - return cache.get(object); - } - - saveToCache(object); - return cache.get(object); - } - - public void clear(T object) { - if (cache.containsKey(object)) { - cache.remove(object); - } - } - - private void saveToCache(T object) { - lock.lock(); - try { - if (cache.containsKey(object)) { - return; - } - - T objectInDB = cacheableRepository.fetch(object); - if (objectInDB == null) { - cacheableRepository.save(object); - cacheableRepository.flush(); - objectInDB = cacheableRepository.fetch(object); - } - cache.put(object, objectInDB); - } - finally { - lock.unlock(); - } - } - - public List fetchAll() { - return cacheableRepository.fetchAll(); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/IndicatorCacheableRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/IndicatorCacheableRepository.java deleted file mode 100644 index bc2edf74e6..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/IndicatorCacheableRepository.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.opensrp.reporting.repository.cache; - -import org.opensrp.reporting.domain.Indicator; - -public interface IndicatorCacheableRepository extends ReadOnlyCacheableRepository {} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/ReadOnlyCacheableRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/ReadOnlyCacheableRepository.java deleted file mode 100644 index 7a60eb6d51..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/ReadOnlyCacheableRepository.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.opensrp.reporting.repository.cache; - -import java.util.List; - -public interface ReadOnlyCacheableRepository { - - T fetch(T object); - - List fetchAll(); -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/ReadOnlyCachingRepository.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/ReadOnlyCachingRepository.java deleted file mode 100644 index c1c28dfe03..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/repository/cache/ReadOnlyCachingRepository.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.opensrp.reporting.repository.cache; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.locks.ReentrantLock; - -public class ReadOnlyCachingRepository { - - private ReadOnlyCacheableRepository cacheableRepository; - - private Map cache; - - private static ReentrantLock lock = new ReentrantLock(); - - public ReadOnlyCachingRepository(ReadOnlyCacheableRepository cacheableRepository) { - this.cacheableRepository = cacheableRepository; - cache = new HashMap<>(); - } - - public T fetch(T object) { - if (cache.containsKey(object)) { - return cache.get(object); - } - - return writeToCache(object); - } - - public void clear(T object) { - if (cache.containsKey(object)) { - cache.remove(object); - } - } - - private T writeToCache(T object) { - lock.lock(); - try { - if (cache.containsKey(object)) { - return cache.get(object); - } - - T objectInDB = cacheableRepository.fetch(object); - if (objectInDB == null) { - return null; - } - cache.put(object, objectInDB); - } - finally { - lock.unlock(); - } - return cache.get(object); - } - - public List fetchAll() { - return cacheableRepository.fetchAll(); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/service/ANMService.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/service/ANMService.java deleted file mode 100644 index 83db3c0ca3..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/service/ANMService.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.opensrp.reporting.service; - -import java.util.List; - -import org.opensrp.reporting.domain.Location; -import org.opensrp.reporting.domain.SP_ANM; -import org.opensrp.reporting.repository.AllLocationsRepository; -import org.opensrp.reporting.repository.AllSP_ANMsRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -public class ANMService { - - private AllSP_ANMsRepository allANMsRepository; - - private AllLocationsRepository allLocationsRepository; - - protected ANMService() { - } - - @Autowired - public ANMService(AllSP_ANMsRepository allANMsRepository, AllLocationsRepository allLocationsRepository) { - this.allANMsRepository = allANMsRepository; - this.allLocationsRepository = allLocationsRepository; - } - - @Transactional("service_provided") - public List all() { - return allANMsRepository.fetchAll(); - } - - @Transactional("service_provided") - public Location getLocation(String anmIdentifier) { - return allLocationsRepository.fetchByANMIdentifier(anmIdentifier); - } - - @Transactional("service_provided") - public List getVillagesForANM(String anmIdentifier) { - return allLocationsRepository.fetchVillagesForANM(anmIdentifier); - } - - @Transactional("service_provided") - public List anmsInTheSameSC(String anmIdentifier) { - return allANMsRepository.fetchAllANMSInSameSC(anmIdentifier); - } - - @Transactional("service_provided") - public List anmsInTheSamePHC(String anmIdentifier) { - return allANMsRepository.fetchAllANMSInSamePHC(anmIdentifier); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/reporting/service/AggregateReportsService.java b/opensrp-reporting/src/main/java/org/opensrp/reporting/service/AggregateReportsService.java deleted file mode 100644 index e42cc98d56..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/reporting/service/AggregateReportsService.java +++ /dev/null @@ -1,150 +0,0 @@ -package org.opensrp.reporting.service; - -import static java.text.MessageFormat.format; -import static java.util.Arrays.asList; -import static org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace; -import static org.opensrp.common.util.EasyMap.mapOf; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.locks.ReentrantLock; - -import org.apache.http.client.utils.URLEncodedUtils; -import org.apache.http.message.BasicNameValuePair; -import org.joda.time.LocalDate; -import org.opensrp.common.domain.ReportMonth; -import org.opensrp.common.util.HttpAgent; -import org.opensrp.common.util.HttpResponse; -import org.opensrp.dto.aggregatorResponse.AggregatorResponseDTO; -import org.opensrp.dto.report.ServiceProvidedReportDTO; -import org.opensrp.reporting.domain.ServiceProvidedReport; -import org.opensrp.reporting.repository.AllTokensRepository; -import org.opensrp.reporting.repository.ServicesProvidedRepository; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; - -@Service -public class AggregateReportsService { - - private static Logger logger = LoggerFactory.getLogger(AggregateReportsService.class); - - private static final ReentrantLock lock = new ReentrantLock(); - - private String aggregatorDataSetUrl; - - private String aggregatedDataSetUrl; - - private HttpAgent httpAgent; - - private AllTokensRepository tokenRepository; - - private ServicesProvidedRepository servicesProvidedRepository; - - private ReportMonth reportMonth; - - private int numberOfReportsSentInABatch; - - protected AggregateReportsService() { - } - - @Autowired - public AggregateReportsService(@Value("#{opensrp['aggregator.dataset.url']}") String aggregatorDataSetUrl, - @Value("#{opensrp['aggregated.dataset.url']}") String aggregatedDataSetUrl, - @Value("#{opensrp['number.of.reports.sent.in.a.batch']}") int numberOfReportsSentInABatch, HttpAgent httpAgent, - AllTokensRepository tokenRepository, ServicesProvidedRepository servicesProvidedRepository, - ReportMonth reportMonth) { - this.aggregatorDataSetUrl = aggregatorDataSetUrl; - this.aggregatedDataSetUrl = aggregatedDataSetUrl; - this.numberOfReportsSentInABatch = numberOfReportsSentInABatch; - this.httpAgent = httpAgent; - this.tokenRepository = tokenRepository; - this.servicesProvidedRepository = servicesProvidedRepository; - this.reportMonth = reportMonth; - } - - @Transactional("service_provided") - public void sendReportsToAggregator() { - if (!lock.tryLock()) { - logger.warn("Not Aggregating reports. It is already in progress."); - return; - } - try { - Integer token = tokenRepository.getAggregateReportsToken(); - logger.info(format("Trying to aggregate reports. Report Token: {0}", token)); - List reports = servicesProvidedRepository.getNewReports(token, - this.numberOfReportsSentInABatch); - if (reports.isEmpty()) { - logger.info("No new reports to aggregate."); - return; - } - logger.info(format("Got reports to aggregate. Number of reports: {0}", reports.size())); - update(reports); - } - catch (Exception e) { - logger.error( - MessageFormat.format("{0} occurred while trying to aggregate reports. Message: {1} with stack trace {2}", - e.toString(), e.getMessage(), getFullStackTrace(e))); - throw e; - } - finally { - lock.unlock(); - } - } - - private void update(List reports) { - String reportJson = new Gson().toJson(mapDomainToDTO(reports)); - HttpResponse response = sendToAggregator(reportJson); - - if (!response.isSuccess()) { - throw new RuntimeException(format("Updating data to Aggregator with url {0} failed with error: {0}", - aggregatorDataSetUrl, response.body())); - } - - Integer id = reports.get(reports.size() - 1).id(); - tokenRepository.saveAggregateReportsToken(id); - logger.info(format("Updated report token to: {0}", id)); - } - - private List mapDomainToDTO(List reports) { - List serviceProvidedReportDTOs = new ArrayList<>(); - for (ServiceProvidedReport report : reports) { - serviceProvidedReportDTOs.add(mapDomainToDTO(report)); - } - return serviceProvidedReportDTOs; - } - - private ServiceProvidedReportDTO mapDomainToDTO(ServiceProvidedReport report) { - return new ServiceProvidedReportDTO(report.id(), report.anmIdentifier(), report.type(), report.indicator(), - LocalDate.parse(report.date()), report.village(), report.subCenter(), report.phc(), report.taluka(), - report.district(), report.state()) - .withNRHMReportMonth(reportMonth.reportingMonth(LocalDate.parse(report.date()))) - .withNRHMReportYear(reportMonth.reportingYear(LocalDate.parse(report.date()))); - } - - private HttpResponse sendToAggregator(String reportJson) { - logger.info( - format("Sending report data to Aggregator. URL: {0}, data: {1}", aggregatorDataSetUrl, "update=" + reportJson)); - return httpAgent.put(aggregatorDataSetUrl, mapOf("update", reportJson)); - } - - public List getAggregatedReports(String anmIdentifier, int month, int year) { - //http://bamboo.io/datasets/c67218ce415e4722a9f3b00882cd5a7b\?query\='{"anm_identifier": "demo1","nrhm_report_year":2013, "nrhm_report_month":10}' - String queryParams = URLEncodedUtils.format(asList(whereClauseParam(anmIdentifier, month, year)), "UTF-8"); - String url = MessageFormat.format("{0}?{1}", aggregatedDataSetUrl, queryParams); - HttpResponse response = httpAgent.get(url); - return new Gson().fromJson(response.body(), new TypeToken>() {}.getType()); - } - - private BasicNameValuePair whereClauseParam(String anmIdentifier, int month, int year) { - return new BasicNameValuePair("query", "{\"anm_identifier\": \"" + anmIdentifier + "\",\"nrhm_report_year\":" + year - + ", \"nrhm_report_month\":" + month + "}"); - } -} diff --git a/opensrp-reporting/src/main/java/org/opensrp/scheduler/AggregateReportsScheduler.java b/opensrp-reporting/src/main/java/org/opensrp/scheduler/AggregateReportsScheduler.java deleted file mode 100644 index d356d09d46..0000000000 --- a/opensrp-reporting/src/main/java/org/opensrp/scheduler/AggregateReportsScheduler.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.opensrp.scheduler; - -import static org.joda.time.DateTimeConstants.MILLIS_PER_MINUTE; - -import java.util.Date; - -import org.motechproject.scheduler.MotechSchedulerService; -import org.motechproject.scheduler.domain.MotechEvent; -import org.motechproject.scheduler.domain.RepeatingSchedulableJob; -import org.opensrp.common.util.DateTimeUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -@Component -public class AggregateReportsScheduler { - - private static Logger logger = LoggerFactory.getLogger(AggregateReportsScheduler.class.toString()); - - public static final String SUBJECT = "REPORT_AGGREGATOR_SCHEDULE"; - - public static final int START_DELAY_IN_MINUTES = 10; - - public static long REPEAT_INTERVAL_IN_MINUTES = 10L; - - private MotechSchedulerService schedulerService; - - @Autowired - public AggregateReportsScheduler(@Value("#{opensrp['batch.update.time.interval']}") long batchUpdateTimeInterval, - MotechSchedulerService schedulerService) { - this.schedulerService = schedulerService; - REPEAT_INTERVAL_IN_MINUTES = batchUpdateTimeInterval; - } - - public void startTimedScheduler() { - logger.info("Scheduling report aggregator job..."); - - Date startTime = DateTimeUtil.now().plusMinutes(START_DELAY_IN_MINUTES).toDate(); - MotechEvent event = new MotechEvent(SUBJECT); - RepeatingSchedulableJob job = new RepeatingSchedulableJob(event, startTime, null, - REPEAT_INTERVAL_IN_MINUTES * MILLIS_PER_MINUTE); - schedulerService.safeScheduleRepeatingJob(job); - } -} diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_10__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_10__Adding_Indicators.sql deleted file mode 100755 index 8ae3058efe..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_10__Adding_Indicators.sql +++ /dev/null @@ -1,20 +0,0 @@ -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('M_LIVE_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('F_LIVE_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_IFA_100'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_IMMUNIZATION_DEATH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_VIT_A_5_3YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_VIT_A_9_3YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_DPTBOOSTER_2_5YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_HYPERTENSION'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MMR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_DPT'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_OPV'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_M_ALL_VACC_2Y'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_F_ALL_VACC_2Y'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ALL_VACC_2Y'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('ANC_GT_12'); -UPDATE anm_report.dim_indicator SET indicator = 'IB_LT_1Y' where indicator = 'IB<1Y'; -UPDATE anm_report.dim_indicator SET indicator = 'IB_LT_5Y' where indicator = 'IB<5Y'; -UPDATE anm_report.dim_indicator SET indicator = 'ANC_LT_12' where indicator = 'ANC<12'; -UPDATE anm_report.dim_indicator SET indicator = 'MTP_LT_12' where indicator = 'MTP<12'; -UPDATE anm_report.dim_indicator SET indicator = 'MTP_GT_12' where indicator = 'MTP>12'; diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_11__Migrating_date_in_ANM_Report.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_11__Migrating_date_in_ANM_Report.sql deleted file mode 100755 index 7e1c85f7fa..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_11__Migrating_date_in_ANM_Report.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Only thing required is to drop FK on date_ to dim_date and make is nullable -ALTER TABLE anm_report.anm_report_data DROP FOREIGN KEY FK_ARD_DD_ID; -ALTER TABLE anm_report.anm_report_data MODIFY COLUMN date_ DATE; diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_12__Adding_Missing_Training_Users.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_12__Adding_Missing_Training_Users.sql deleted file mode 100755 index 13a8913160..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_12__Adding_Missing_Training_Users.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('suresh'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('nirmala'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_13__Removing_Dim_Date.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_13__Removing_Dim_Date.sql deleted file mode 100755 index c2d422d9fa..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_13__Removing_Dim_Date.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE IF EXISTS anm_report.dim_date; diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_14__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_14__Adding_Indicators.sql deleted file mode 100755 index d20a355b1a..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_14__Adding_Indicators.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_LIVE_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_STILL_BIRTH'); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_15__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_15__Adding_Indicators.sql deleted file mode 100755 index 139e93ec75..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_15__Adding_Indicators.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('OPV3'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('OPV_BOOSTER'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('DPT_BOOSTER_1'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_16__Adding_User_Data.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_16__Adding_User_Data.sql deleted file mode 100755 index 049dd7a26d..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_16__Adding_User_Data.sql +++ /dev/null @@ -1,7 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('demo4'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('demo5'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('demo6'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('demo7'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('demo8'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('demo9'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('demo10'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_17__Adding_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_17__Adding_ANMs.sql deleted file mode 100755 index 3038d7a33f..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_17__Adding_ANMs.sql +++ /dev/null @@ -1,50 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('kana1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('kana2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('kana3'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('kara1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('kara2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('sri1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('sri2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('ane1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('bud1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('hosa1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('mush1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('mush2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('musl1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('musl2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('musl3'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('nava1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('here1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('here2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('alw1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('bet1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('bha1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('hir1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('hir2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('hit1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('hit2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('hit3'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('hit4'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('irk1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('taw1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('cha1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('cha2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('dot1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('han1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('hanl1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('hanl2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('hire1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('hmp1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('hmp2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('hul1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('mud1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('man1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('man2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('ban1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('ban2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('ben1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('gan1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('mul1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('mul2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('san1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('vaj1'); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_18__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_18__Adding_Indicators.sql deleted file mode 100755 index 0503de624e..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_18__Adding_Indicators.sql +++ /dev/null @@ -1,7 +0,0 @@ -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ANC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ANC_LT_12'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_TT1'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_SUB_TT'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_BF_POST_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_SPONTANEOUS_ABORTION'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_VIT_A_1'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_19__Adding_Ten_More_User_Data_For_Training.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_19__Adding_Ten_More_User_Data_For_Training.sql deleted file mode 100755 index 7d565c7875..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_19__Adding_Ten_More_User_Data_For_Training.sql +++ /dev/null @@ -1,25 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer3'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer4'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer5'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user11'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user12'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user13'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user14'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user15'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user16'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user17'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user18'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user19'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user20'); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_1__Initial_Setup.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_1__Initial_Setup.sql deleted file mode 100755 index 718234757f..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_1__Initial_Setup.sql +++ /dev/null @@ -1,23 +0,0 @@ -CREATE TABLE anm_report.dim_anm (ID INT(11) NOT NULL AUTO_INCREMENT , anmIdentifier VARCHAR(255) NOT NULL, - CONSTRAINT pk_dim_anm PRIMARY KEY (ID), - CONSTRAINT U_DA_AN UNIQUE (anmIdentifier)); - -CREATE TABLE anm_report.dim_indicator (ID INT(11) NOT NULL AUTO_INCREMENT , indicator VARCHAR(255) NOT NULL, - CONSTRAINT pk_dim_indicator PRIMARY KEY (ID), - CONSTRAINT U_DI_IN UNIQUE (indicator)); - -CREATE TABLE anm_report.dim_date (ID INT(11) NOT NULL AUTO_INCREMENT , date_ DATE NOT NULL, - CONSTRAINT pk_dim_date PRIMARY KEY (ID), - CONSTRAINT U_DD_DT UNIQUE (date_)); - -CREATE TABLE anm_report.annual_target (ID INT(11) NOT NULL AUTO_INCREMENT , anmIdentifier INT(11) NOT NULL, indicator INT(11) NOT NULL, target VARCHAR(255) NOT NULL, start_date DATE NOT NULL, end_date DATE NOT NULL, - CONSTRAINT pk_annual_target PRIMARY KEY (ID), - CONSTRAINT FK_AT_DA_ID FOREIGN KEY (anmIdentifier) REFERENCES anm_report.dim_anm (ID), - CONSTRAINT FK_AT_DI_ID FOREIGN KEY (indicator) REFERENCES anm_report.dim_indicator (ID), - CONSTRAINT U_AT_AI_IN_TA_SD_ED UNIQUE (anmIdentifier, indicator, start_date, end_date)); - -CREATE TABLE anm_report.anm_report_data (ID INT(11) NOT NULL AUTO_INCREMENT , anmIdentifier INT(11) NOT NULL, externalId VARCHAR(255) NOT NULL, indicator INT(11) NOT NULL, date_ INT(11) NOT NULL, - CONSTRAINT pk_anm_report_data PRIMARY KEY (ID), - CONSTRAINT FK_ARD_DA_ID FOREIGN KEY (anmIdentifier) REFERENCES anm_report.dim_anm (ID), - CONSTRAINT FK_ARD_DI_ID FOREIGN KEY (indicator) REFERENCES anm_report.dim_indicator (ID), - CONSTRAINT FK_ARD_DD_ID FOREIGN KEY (date_) REFERENCES anm_report.dim_date (ID)); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_20__Adding_Duplicate_User_For_The_ANM.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_20__Adding_Duplicate_User_For_The_ANM.sql deleted file mode 100755 index f3c392ea89..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_20__Adding_Duplicate_User_For_The_ANM.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('srir1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('budg1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('karat1'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_21__Adding_Ten_More_User_Data_For_Third_Batch_of_Training.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_21__Adding_Ten_More_User_Data_For_Third_Batch_of_Training.sql deleted file mode 100755 index a68783c2e6..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_21__Adding_Ten_More_User_Data_For_Third_Batch_of_Training.sql +++ /dev/null @@ -1,27 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user21'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user22'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user23'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user24'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user25'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user26'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user27'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user28'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user29'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user30'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user31'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user32'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user33'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user34'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user35'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user36'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user37'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user38'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user39'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user40'); - - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer6'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer7'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer8'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer9'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer10'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_22__Adding_Annual_Targets_for_Koppal_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_22__Adding_Annual_Targets_for_Koppal_ANMs.sql deleted file mode 100755 index 12f8602ac4..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_22__Adding_Annual_Targets_for_Koppal_ANMs.sql +++ /dev/null @@ -1,384 +0,0 @@ --- Annual targets for here1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),161, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),161, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),120, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),150, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),46, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),65, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),65, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),147, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),147, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),147, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),147, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),147, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),147, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),147, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),147, '2014-03-26', '2015-03-25'); --- Annual targets for here2 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),205, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),205, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),205, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),205, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),14, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),27, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),124, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),190, '2014-03-26', '2015-03-25'); --- Annual targets for alw1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),140, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),140, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),140, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),140, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),49, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),62, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),65, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),128, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),128, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),128, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),128, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),128, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),128, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),128, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),128, '2014-03-26', '2015-03-25'); --- Annual targets for bet1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),160, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),160, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),160, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),160, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),52, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),58, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),66, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),152, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),152, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),152, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),152, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),152, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),152, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),152, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),152, '2014-03-26', '2015-03-25'); --- Annual targets for bha1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),411, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),390, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),411, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),214, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),104, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),95, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),168, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),360, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),360, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),360, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),360, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),360, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),360, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),371, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),371, '2014-03-26', '2015-03-25'); --- Annual targets for hir1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),225, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),225, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),225, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),225, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),20, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),51, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),100, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),215, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),215, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),215, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),215, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),210, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),210, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),210, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),210, '2014-03-26', '2015-03-25'); --- Annual targets for hir2 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),235, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),235, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),235, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),235, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),42, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),40, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),106, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),218, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),218, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),218, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),218, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),218, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),218, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),218, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),218, '2014-03-26', '2015-03-25'); --- Annual targets for hit1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),22, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),26, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),58, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),102, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),102, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),102, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),102, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),102, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),102, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),102, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),102, '2014-03-26', '2015-03-25'); --- Annual targets for hit2 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),135, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),14, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),135, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),112, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),17, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),18, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),65, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),135, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),136, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),142, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),135, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),135, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),135, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),135, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),135, '2014-03-26', '2015-03-25'); --- Annual targets for hit3 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),111, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),111, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),111, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),111, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),22, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),28, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),55, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),97, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),97, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),97, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),104, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),104, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),104, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),104, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),104, '2014-03-26', '2015-03-25'); --- Annual targets for irk1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),248, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),206, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),248, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),248, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),20, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),28, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),58, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),192, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),224, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),210, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),214, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),214, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),200, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),190, '2014-03-26', '2015-03-25'); --- Annual targets for kana1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),220, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),220, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),220, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),220, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),62, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),42, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),86, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),207, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),207, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),207, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),207, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),207, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),207, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),207, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),207, '2014-03-26', '2015-03-25'); --- Annual targets for kana2 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),150, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),134, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),144, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),144, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),21, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),22, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),58, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),130, '2014-03-26', '2015-03-25'); --- Annual targets for kana3 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),120, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),95, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),120, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),120, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),25, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),25, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),50, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),108, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),108, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),108, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),108, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),108, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),108, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),108, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),108, '2014-03-26', '2015-03-25'); --- Annual targets for karat1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),473, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),450, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),349, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),281, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),70, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),70, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),170, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),170, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),170, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),170, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),170, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),170, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),170, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),170, '2014-03-26', '2015-03-25'); --- Annual targets for kara2 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),25, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),42, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),84, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),185, '2014-03-26', '2015-03-25'); --- Annual targets for srir1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),118, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),96, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),22, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),20, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),54, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),110, '2014-03-26', '2015-03-25'); --- Annual targets for sri2 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),156, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),156, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),156, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),156, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),10, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),15, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),60, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),133, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),133, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),133, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),133, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),133, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),133, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),133, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),133, '2014-03-26', '2015-03-25'); --- Annual targets for ane1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),59, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),59, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),59, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),59, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),19, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),19, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),29, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),54, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),54, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),54, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),54, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),54, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),54, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),56, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),56, '2014-03-26', '2015-03-25'); --- Annual targets for budg1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),45, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),55, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),55, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),230, '2014-03-26', '2015-03-25'); --- Annual targets for mul1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),203, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),203, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),203, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),203, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),52, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),41, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),81, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),173, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),173, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),173, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),173, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),173, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),173, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),173, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),173, '2014-03-26', '2015-03-25'); --- Annual targets for mush1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),192, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),192, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),192, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),192, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),29, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),38, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),78, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),174, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),174, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),174, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),174, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),174, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),174, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),174, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),174, '2014-03-26', '2015-03-25'); --- Annual targets for mush2 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),150, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),150, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),150, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),120, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),28, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),26, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),57, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),139, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),139, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),139, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),139, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),139, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),139, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),139, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),139, '2014-03-26', '2015-03-25'); --- Annual targets for nava1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),168, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),145, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),13, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),32, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),68, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),158, '2014-03-26', '2015-03-25'); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_23__Adding_Ten_More_User_Data_For_Last_Batch_Training.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_23__Adding_Ten_More_User_Data_For_Last_Batch_Training.sql deleted file mode 100755 index fc3cd9e995..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_23__Adding_Ten_More_User_Data_For_Last_Batch_Training.sql +++ /dev/null @@ -1,29 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer11'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer12'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer13'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer14'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer15'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user41'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user42'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user43'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user44'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user45'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user46'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user47'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user48'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user49'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user50'); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_24__Adding_Duplicate_User_For_The_ANM.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_24__Adding_Duplicate_User_For_The_ANM.sql deleted file mode 100755 index 38e2a1b578..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_24__Adding_Duplicate_User_For_The_ANM.sql +++ /dev/null @@ -1 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES('muslim3'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_2__Adding_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_2__Adding_ANMs.sql deleted file mode 100755 index de7ad9adae..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_2__Adding_ANMs.sql +++ /dev/null @@ -1,10 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('bhe1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('bhe2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('bhe3'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('bhe4'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('bhe5'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('klp1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('klp2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('klp3'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('klp4'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_3__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_3__Adding_Indicators.sql deleted file mode 100755 index 8ea761d52b..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_3__Adding_Indicators.sql +++ /dev/null @@ -1,67 +0,0 @@ -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('DPT'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('DPT_BOOSTER_2'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('HEP'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('OPV'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MEASLES'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('BCG'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('ANC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('ANC<12'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('LIVE_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('STILL_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('OCP'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IUD'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MALE_STERILIZATION'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('FEMALE_STERILIZATION'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('CONDOM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('DMPA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('FP_TRADITIONAL'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('LAM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('SUB_TT'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('TT1'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('TT2'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('TTB'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('LBW'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MTP<12'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MTP>12'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('SPONTANEOUS_ABORTION'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('DELIVERY'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('INSTITUTIONAL_DELIVERY'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('BF_POST_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('WEIGHED_AT_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('ENM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('LNM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('UFM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MMA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MMD'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MMP'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('VIT_A_1'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('VIT_A_2'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('ANC4'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('PNC3'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('D_HOM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('D_SC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('D_PHC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('D_CHC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('D_SDH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('D_DH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('D_PRI'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('DPT3_OPV3'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('DPTB_OPVB'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('PENT1'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('PENT2'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('PENT3'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MMR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('JE'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('OCP_ST'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('OCP_SC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('OCP_C_OTHERS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('FS_APL'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('FS_BPL'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('CESAREAN'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('CESAREAN_GOV'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('CESAREAN_PRI'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('INFANT_REG'); - diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_4__Adding_AnnualTargets_For_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_4__Adding_AnnualTargets_For_ANMs.sql deleted file mode 100755 index 6539b64602..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_4__Adding_AnnualTargets_For_ANMs.sql +++ /dev/null @@ -1,99 +0,0 @@ -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 12, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 12, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 7, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 11, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 10, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 16, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 11, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 17, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 17, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 37, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 35, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 28, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 72, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 39, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 48, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 94, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 126, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 63, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 48, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 58, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 2, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 52, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 38, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 78, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 61, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 90, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 40, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 72, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 4, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 52, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 38, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 72, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 39, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 48, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 94, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 126, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 63, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 53, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 33, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 56, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 41, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 80, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 93, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 57, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 53, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 33, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 56, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 41, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 80, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 93, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 57, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 58, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 59, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 49, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 37, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 68, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 84, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 45, '2012-03-26', '2013-03-25'); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_5__Adding_Annual_Targets_For_Test_User.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_5__Adding_Annual_Targets_For_Test_User.sql deleted file mode 100755 index 992dfdb753..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_5__Adding_Annual_Targets_For_Test_User.sql +++ /dev/null @@ -1,157 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('c'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('demo1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('demo2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('demo3'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_6__Adding_User_Data_For_Training.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_6__Adding_User_Data_For_Training.sql deleted file mode 100755 index 78568006e4..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_6__Adding_User_Data_For_Training.sql +++ /dev/null @@ -1,23 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer1'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer2'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user1'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user2'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user3'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user4'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user5'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user6'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user7'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user8'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user9'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user10'); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_7__Adding_Annual_Targets_For_Training.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_7__Adding_Annual_Targets_For_Training.sql deleted file mode 100755 index 13dec29d4a..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_7__Adding_Annual_Targets_For_Training.sql +++ /dev/null @@ -1,167 +0,0 @@ --- Annual targets for 'trainer1' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'trainer2' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user1' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user2' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user3' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user4' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user5' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user6' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user7' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user8' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user9' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user10' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_8__Adding_Annual_Targets_For_ANMs_For_2013_2014.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_8__Adding_Annual_Targets_For_ANMs_For_2013_2014.sql deleted file mode 100755 index 478afa2e3e..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_8__Adding_Annual_Targets_For_ANMs_For_2013_2014.sql +++ /dev/null @@ -1,27 +0,0 @@ --- Annual targets for 'bhe2' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'bhe4' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 15, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 15, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 23, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 23, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 62, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 50, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 62, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 62, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 56, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 56, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 56, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 56, '2013-03-26', '2014-03-25'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_9__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_9__Adding_Indicators.sql deleted file mode 100755 index 90a9049e0d..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/anmReport/V1_0_9__Adding_Indicators.sql +++ /dev/null @@ -1,78 +0,0 @@ -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('CHILD_DIARRHEA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('F_VIT_A_1'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('F_VIT_A_2'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('M_VIT_A_1'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('M_VIT_A_2'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('CMD'); -UPDATE anm_report.dim_indicator SET indicator = 'PENTAVALENT3_OPV3' where indicator = 'DPT3_OPV3'; -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('F_VIT_A_5'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('F_VIT_A_9'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('M_VIT_A_5'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('M_VIT_A_9'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('F_VIT_A'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('M_VIT_A'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('INFANT_LEFT'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('CONDOM_QTY'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IBT'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IB_OH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IB_1Y'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ANC3'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_JSY_REG'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_SBA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_NON_SBA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_HB_LEVEL'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_PNC24'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_SC_DEL'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_48HRS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_PNC_V_2D'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_PNC_V_14D'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_IUDREM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_OCP_STRIPS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IB_OA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IB<1Y'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IB<5Y'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IB_BAL'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_CENTCHROMAN_PILLS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ECP'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_M_S_COMP'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_F_S_COMP'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_S_COMP'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('ANCS_AND_PNCS_WITH_BPL'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_M_S_FAILURE'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_F_S_FAILURE'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_S_FAILURE'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_M_S_DEATH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_F_S_DEATH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_S_DEATH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MEASLES'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_DIARRHEA_DEHYDRATION'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MALARIA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_24HRS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_SEPSIS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_ASPHYXIA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_LBW'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_PNEUMONIA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_DIARRHEA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_FEVER_RELATED'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_MEASLES'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_OTHERS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_BCG_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_PENT_1_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_PENT_2_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_PENT_3_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_OPV_0_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_OPV_1_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_OPV_2_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_OPV_3_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_HEPB_0_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MEASLES_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MD_ABORTION'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MD_LABOR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MD_FITS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MD_BLEEDING'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MD_H_FEVER'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MD_OTHER'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MEASLES_BOOSTER_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_M_ALL_VAC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_F_ALL_VAC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ALL_VAC'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_10__Adding_User_Data_For_Training.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_10__Adding_User_Data_For_Training.sql deleted file mode 100755 index 28aa5ae476..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_10__Adding_User_Data_For_Training.sql +++ /dev/null @@ -1,83 +0,0 @@ --- trainer1 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('trainer1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer1'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- trainer2 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('trainer2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer2'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user1 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user1'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user2 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user2'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user3 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user3'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user4 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user4', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user4'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user5 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user5', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user5'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user6 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user6', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user6'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user7 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user7', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user7'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user8 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user8', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user8'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user9 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user9', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user9'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user10 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user10', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user10'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_11__Adding_Annual_Targets_For_Training.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_11__Adding_Annual_Targets_For_Training.sql deleted file mode 100755 index 6536aa3001..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_11__Adding_Annual_Targets_For_Training.sql +++ /dev/null @@ -1,167 +0,0 @@ --- Annual targets for 'trainer1' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'trainer2' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user1' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user2' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user3' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user4' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user5' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user6' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user7' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user8' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user9' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'user10' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_12__Adding_Annual_Targets_For_ANMs_For_2013_2014.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_12__Adding_Annual_Targets_For_ANMs_For_2013_2014.sql deleted file mode 100755 index d912768985..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_12__Adding_Annual_Targets_For_ANMs_For_2013_2014.sql +++ /dev/null @@ -1,27 +0,0 @@ --- Annual targets for 'bhe2' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - --- Annual targets for 'bhe4' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 15, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 15, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 23, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 23, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 62, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 50, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 62, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 62, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 56, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 56, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 56, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 56, '2013-03-26', '2014-03-25'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_13__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_13__Adding_Indicators.sql deleted file mode 100755 index c4d7929deb..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_13__Adding_Indicators.sql +++ /dev/null @@ -1,83 +0,0 @@ -INSERT INTO report.dim_indicator (indicator) VALUES ('CHILD_DIARRHEA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('F_VIT_A_1'); -INSERT INTO report.dim_indicator (indicator) VALUES ('F_VIT_A_2'); -INSERT INTO report.dim_indicator (indicator) VALUES ('M_VIT_A_1'); -INSERT INTO report.dim_indicator (indicator) VALUES ('M_VIT_A_2'); -INSERT INTO report.dim_indicator (indicator) VALUES ('CMD'); -UPDATE report.dim_indicator SET indicator = 'PENTAVALENT3_OPV3' where indicator = 'DPT3_OPV3'; -INSERT INTO report.dim_indicator (indicator) VALUES ('F_VIT_A_5'); -INSERT INTO report.dim_indicator (indicator) VALUES ('F_VIT_A_9'); -INSERT INTO report.dim_indicator (indicator) VALUES ('M_VIT_A_5'); -INSERT INTO report.dim_indicator (indicator) VALUES ('M_VIT_A_9'); -INSERT INTO report.dim_indicator (indicator) VALUES ('F_VIT_A'); -INSERT INTO report.dim_indicator (indicator) VALUES ('M_VIT_A'); -INSERT INTO report.dim_indicator (indicator) VALUES ('INFANT_LEFT'); -INSERT INTO report.dim_indicator (indicator) VALUES ('CONDOM_QTY'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IBT'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IB_OH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IB_1Y'); -INSERT INTO report.dim_indicator (indicator) VALUES ('PENT1'); -INSERT INTO report.dim_indicator (indicator) VALUES ('PENT2'); -INSERT INTO report.dim_indicator (indicator) VALUES ('PENT3'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MMR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('JE'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ANC3'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_JSY_REG'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_SBA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_NON_SBA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_HB_LEVEL'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_PNC24'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_SC_DEL'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_48HRS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_PNC_V_2D'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_PNC_V_14D'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_IUDREM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_OCP_STRIPS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IB_OA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IB<1Y'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IB<5Y'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IB_BAL'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_CENTCHROMAN_PILLS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ECP'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_M_S_COMP'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_F_S_COMP'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_S_COMP'); -INSERT INTO report.dim_indicator (indicator) VALUES ('ANCS_AND_PNCS_WITH_BPL'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_M_S_FAILURE'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_F_S_FAILURE'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_S_FAILURE'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_M_S_DEATH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_F_S_DEATH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_S_DEATH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MEASLES'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_DIARRHEA_DEHYDRATION'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MALARIA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_24HRS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_SEPSIS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_ASPHYXIA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_LBW'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_PNEUMONIA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_DIARRHEA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_FEVER_RELATED'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_MEASLES'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_OTHERS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_BCG_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_PENT_1_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_PENT_2_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_PENT_3_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_OPV_0_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_OPV_1_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_OPV_2_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_OPV_3_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_HEPB_0_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MEASLES_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MD_ABORTION'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MD_LABOR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MD_FITS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MD_BLEEDING'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MD_H_FEVER'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MD_OTHER'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MEASLES_BOOSTER_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_M_ALL_VAC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_F_ALL_VAC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ALL_VAC'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_14__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_14__Adding_Indicators.sql deleted file mode 100755 index 1b52cf0cae..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_14__Adding_Indicators.sql +++ /dev/null @@ -1,20 +0,0 @@ -INSERT INTO report.dim_indicator (indicator) VALUES ('M_LIVE_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('F_LIVE_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_IFA_100'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_IMMUNIZATION_DEATH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_VIT_A_5_3YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_VIT_A_9_3YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_DPTBOOSTER_2_5YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_HYPERTENSION'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MMR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_DPT'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_OPV'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_M_ALL_VACC_2Y'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_F_ALL_VACC_2Y'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ALL_VACC_2Y'); -INSERT INTO report.dim_indicator (indicator) VALUES ('ANC_GT_12'); -UPDATE report.dim_indicator SET indicator = 'IB_LT_1Y' where indicator = 'IB<1Y'; -UPDATE report.dim_indicator SET indicator = 'IB_LT_5Y' where indicator = 'IB<5Y'; -UPDATE report.dim_indicator SET indicator = 'ANC_LT_12' where indicator = 'ANC<12'; -UPDATE report.dim_indicator SET indicator = 'MTP_LT_12' where indicator = 'MTP<12'; -UPDATE report.dim_indicator SET indicator = 'MTP_GT_12' where indicator = 'MTP>12'; \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_15__Migrating_Date_Service_Provided_Table.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_15__Migrating_Date_Service_Provided_Table.sql deleted file mode 100755 index ddc368853a..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_15__Migrating_Date_Service_Provided_Table.sql +++ /dev/null @@ -1,3 +0,0 @@ --- Only thing required is to drop FK on date_ to dim_date and make is nullable -ALTER TABLE report.service_provided DROP FOREIGN KEY FK_SP_DD_ID; -ALTER TABLE report.service_provided MODIFY COLUMN date_ DATE; diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_16__Creating_View_for_Reporting.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_16__Creating_View_for_Reporting.sql deleted file mode 100755 index a09c5a35a7..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_16__Creating_View_for_Reporting.sql +++ /dev/null @@ -1,31 +0,0 @@ -DROP VIEW IF EXISTS report.service_provided_report_view; -CREATE VIEW report.service_provided_report_view -AS -(SELECT - a.id AS "id", - g.anmIdentifier AS "anmidentifier", - f.type "service_provided_type", - c.indicator AS "indicator", - a.date_ AS "service_date", - e.village AS "village", - e.subcenter AS "subcenter", - h.phcidentifier AS "phc", - e.taluka AS "taluka", - e.district AS "district", - e.state AS "state" -FROM - report.service_provided a, - report.dim_service_provider b, - report.dim_indicator c, - report.dim_location e, - report.dim_service_provider_type f, - report.dim_anm g, - report.dim_phc h -WHERE - a.service_provider=b.id AND - a.indicator=c.id AND - a.location=e.id AND - b.type=f.id AND - b.service_provider=g.id AND - e.phc=h.id -); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_17__Creating_Token_Table.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_17__Creating_Token_Table.sql deleted file mode 100755 index 60f18b914b..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_17__Creating_Token_Table.sql +++ /dev/null @@ -1,3 +0,0 @@ -CREATE TABLE report.token (ID INT(11) NOT NULL AUTO_INCREMENT , name VARCHAR(255) NOT NULL, value VARCHAR(255) NOT NULL, - CONSTRAINT pk_token PRIMARY KEY (ID), - CONSTRAINT U_TOKEN_NAME UNIQUE (name)); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_18__Adding_Sub_Center_Column_To_ANM_Table.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_18__Adding_Sub_Center_Column_To_ANM_Table.sql deleted file mode 100755 index 036f060e05..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_18__Adding_Sub_Center_Column_To_ANM_Table.sql +++ /dev/null @@ -1,21 +0,0 @@ -ALTER TABLE report.dim_anm ADD COLUMN subcenter VARCHAR(100); - -UPDATE report.dim_anm SET subcenter='bherya_a' WHERE anmidentifier='bhe1'; - -UPDATE report.dim_anm SET subcenter='bherya_b' WHERE anmidentifier='bhe2'; - -UPDATE report.dim_anm SET subcenter='g_a_guppe' WHERE anmidentifier='bhe3'; - -UPDATE report.dim_anm SET subcenter='hosa_agrahara' WHERE anmidentifier='bhe4'; - -UPDATE report.dim_anm SET subcenter='munjanahalli' WHERE anmidentifier='bhe5'; - -UPDATE report.dim_anm SET subcenter='keelanapura_a' WHERE anmidentifier='klp4'; - -UPDATE report.dim_anm SET subcenter='keelanapura_b' WHERE anmidentifier='klp2'; - -UPDATE report.dim_anm SET subcenter='puttegowdanahundi' WHERE anmidentifier='klp1'; - -UPDATE report.dim_anm SET subcenter='vajamangala' WHERE anmidentifier='klp3'; - -UPDATE report.dim_anm SET subcenter='munjanahalli' WHERE subcenter IS NULL; \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_19__Adding_Name_Column_To_ANM_Table.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_19__Adding_Name_Column_To_ANM_Table.sql deleted file mode 100755 index 9bf73af3af..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_19__Adding_Name_Column_To_ANM_Table.sql +++ /dev/null @@ -1,51 +0,0 @@ -ALTER TABLE report.dim_anm ADD COLUMN name varchar(100); - -UPDATE report.dim_anm SET name='Elizebeth D''souza' WHERE anmidentifier='bhe1'; - -UPDATE report.dim_anm SET name='Jyothilakshmi' WHERE anmidentifier='bhe2'; - -UPDATE report.dim_anm SET name='Jayanthi' WHERE anmidentifier='bhe3'; - -UPDATE report.dim_anm SET name='Hemalatha' WHERE anmidentifier='bhe4'; - -UPDATE report.dim_anm SET name='Latha' WHERE anmidentifier='bhe5'; - -UPDATE report.dim_anm SET name='Hemavathi' WHERE anmidentifier='klp4'; - -UPDATE report.dim_anm SET name='N.R. Kamalakshi' WHERE anmidentifier='klp2'; - -UPDATE report.dim_anm SET name='Dhakshakanya' WHERE anmidentifier='klp1'; - -UPDATE report.dim_anm SET name='B.T. Indira' WHERE anmidentifier='klp3'; - -UPDATE report.dim_anm SET name='C' WHERE anmidentifier='c'; - -UPDATE report.dim_anm SET name='Demo1' WHERE anmidentifier='demo1'; - -UPDATE report.dim_anm SET name='Demo2' WHERE anmidentifier='demo2'; - -UPDATE report.dim_anm SET name='Demo3' WHERE anmidentifier='demo3'; - -UPDATE report.dim_anm SET name='Trainer1' WHERE anmidentifier='trainer1'; - -UPDATE report.dim_anm SET name='Trainer2' WHERE anmidentifier='trainer2'; - -UPDATE report.dim_anm SET name='User1' WHERE anmidentifier='user1'; - -UPDATE report.dim_anm SET name='User2' WHERE anmidentifier='user2'; - -UPDATE report.dim_anm SET name='User3' WHERE anmidentifier='user3'; - -UPDATE report.dim_anm SET name='User4' WHERE anmidentifier='user4'; - -UPDATE report.dim_anm SET name='User5' WHERE anmidentifier='user5'; - -UPDATE report.dim_anm SET name='User6' WHERE anmidentifier='user6'; - -UPDATE report.dim_anm SET name='User7' WHERE anmidentifier='user7'; - -UPDATE report.dim_anm SET name='User8' WHERE anmidentifier='user8'; - -UPDATE report.dim_anm SET name='User9' WHERE anmidentifier='user9'; - -UPDATE report.dim_anm SET name='User10' WHERE anmidentifier='user10'; \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_1__Initial_Setup.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_1__Initial_Setup.sql deleted file mode 100755 index 771926c3dc..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_1__Initial_Setup.sql +++ /dev/null @@ -1,45 +0,0 @@ -CREATE TABLE report.dim_phc (ID INT(11) NOT NULL AUTO_INCREMENT , phcIdentifier VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, - CONSTRAINT pk_dim_phc PRIMARY KEY (ID), - CONSTRAINT U_DP_PI UNIQUE (phcIdentifier)); - -CREATE TABLE report.dim_anm (ID INT(11) NOT NULL AUTO_INCREMENT , anmIdentifier VARCHAR(255) NOT NULL, phc INT(11) NOT NULL, - CONSTRAINT pk_dim_anm PRIMARY KEY (ID), - CONSTRAINT FK_DA_DP_ID FOREIGN KEY (phc) REFERENCES report.dim_phc (ID), - CONSTRAINT U_DA_AN UNIQUE (anmIdentifier)); - -CREATE TABLE report.dim_indicator (ID INT(11) NOT NULL AUTO_INCREMENT , indicator VARCHAR(255) NOT NULL, - CONSTRAINT pk_dim_indicator PRIMARY KEY (ID), - CONSTRAINT U_DI_IN UNIQUE (indicator)); - -CREATE TABLE report.dim_date (ID INT(11) NOT NULL AUTO_INCREMENT , date_ DATE NOT NULL, - CONSTRAINT pk_dim_date PRIMARY KEY (ID), - CONSTRAINT U_DD_DT UNIQUE (date_)); - -CREATE TABLE report.dim_location (ID INT(11) NOT NULL AUTO_INCREMENT , village VARCHAR(255) NOT NULL, subCenter VARCHAR(255) NOT NULL, phc INT(11) NOT NULL, taluka VARCHAR(255) NOT NULL, district VARCHAR(255) NOT NULL, state VARCHAR(255) NOT NULL, - CONSTRAINT pk_dim_location PRIMARY KEY (ID), - CONSTRAINT FK_DL_DP_ID FOREIGN KEY (phc) REFERENCES report.dim_phc (ID), - CONSTRAINT U_DL_VI_SU_PH UNIQUE (village, subCenter, phc), - CONSTRAINT U_DL_VI_SU_PH_TK_DT_ST UNIQUE (village, subCenter, phc, taluka, district, state)); - -CREATE TABLE report.dim_service_provider_type (ID INT(11) NOT NULL AUTO_INCREMENT , type VARCHAR(255) NOT NULL, - CONSTRAINT pk_dim_service_provider_type PRIMARY KEY (ID), - CONSTRAINT U_DSPT_TY UNIQUE (type), - CONSTRAINT CK_SPT CHECK (type = 'ANM' OR type = 'PHC')); - -CREATE TABLE report.dim_service_provider (ID INT(11) NOT NULL AUTO_INCREMENT , service_provider INT(11) NOT NULL, type INT(11) NOT NULL, - CONSTRAINT pk_dim_service_provider PRIMARY KEY (ID), - CONSTRAINT FK_DSP_DST_ID FOREIGN KEY (type) REFERENCES report.dim_service_provider_type (ID), - CONSTRAINT U_SP_TY UNIQUE (service_provider, type)); - -CREATE TABLE report.annual_target (ID INT(11) NOT NULL AUTO_INCREMENT , service_provider INT(11) NOT NULL, indicator INT(11) NOT NULL, target VARCHAR(255) NOT NULL, start_date DATE NOT NULL, end_date DATE NOT NULL, - CONSTRAINT pk_annual_target PRIMARY KEY (ID), - CONSTRAINT FK_AT_DSP_ID FOREIGN KEY (service_provider) REFERENCES report.dim_service_provider (ID), - CONSTRAINT FK_AT_DI_ID FOREIGN KEY (indicator) REFERENCES report.dim_indicator (ID), - CONSTRAINT U_AT_SP_IN_TA_SD_ED UNIQUE (service_provider, indicator, start_date, end_date)); - -CREATE TABLE report.service_provided (ID INT(11) NOT NULL AUTO_INCREMENT , service_provider INT(11) NOT NULL, externalId VARCHAR(255) NOT NULL, indicator INT(11) NOT NULL, date_ INT(11) NOT NULL, location INT(11) NOT NULL, - CONSTRAINT pk_service_provided PRIMARY KEY (ID), - CONSTRAINT FK_SP_DSP_ID FOREIGN KEY (service_provider) REFERENCES report.dim_service_provider (ID), - CONSTRAINT FK_SP_DI_ID FOREIGN KEY (indicator) REFERENCES report.dim_indicator (ID), - CONSTRAINT FK_SP_DD_ID FOREIGN KEY (date_) REFERENCES report.dim_date (ID), - CONSTRAINT FK_SP_DL_ID FOREIGN KEY (location) REFERENCES report.dim_location (ID)); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_20__Adding_Missing_Training_Users.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_20__Adding_Missing_Training_Users.sql deleted file mode 100755 index 359e549388..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_20__Adding_Missing_Training_Users.sql +++ /dev/null @@ -1,13 +0,0 @@ --- suresh -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) VALUES ('suresh', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Suresh', 'munjanahalli'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='suresh'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- nirmala -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) VALUES ('nirmala', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Nirmala', 'munjanahalli'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='nirmala'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_21__Removing_Dim_Date.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_21__Removing_Dim_Date.sql deleted file mode 100755 index c7a8fd3f81..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_21__Removing_Dim_Date.sql +++ /dev/null @@ -1 +0,0 @@ -DROP TABLE IF EXISTS report.dim_date; \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_22__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_22__Adding_Indicators.sql deleted file mode 100755 index d41825fde0..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_22__Adding_Indicators.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_LIVE_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_STILL_BIRTH'); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_23__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_23__Adding_Indicators.sql deleted file mode 100755 index 8a0fc4d916..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_23__Adding_Indicators.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO report.dim_indicator (indicator) VALUES ('OPV3'); -INSERT INTO report.dim_indicator (indicator) VALUES ('OPV_BOOSTER'); -INSERT INTO report.dim_indicator (indicator) VALUES ('DPT_BOOSTER_1'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_24__Adding_User_Data.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_24__Adding_User_Data.sql deleted file mode 100755 index 4afe658852..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_24__Adding_User_Data.sql +++ /dev/null @@ -1,15 +0,0 @@ -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'demo4', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Demo4', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'demo5', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Demo5', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'demo6', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Demo6', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'demo7', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Demo7', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'demo8', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Demo8', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'demo9', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Demo9', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'demo10', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Demo10', 'munjanahalli'); - -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo4'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo5'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo6'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo7'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo8'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo9'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo10'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_25__Adding_User_And_Location.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_25__Adding_User_And_Location.sql deleted file mode 100755 index d0f9d74691..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_25__Adding_User_And_Location.sql +++ /dev/null @@ -1,409 +0,0 @@ -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('chc_heresindogi', 'CHC Heresindogi'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('chc_kanakageri', 'CHC Kanakageri'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('chc_karatagi', 'CHC Karatagi'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('chc_mangalore', 'CHC Mangalore'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('chc_sriramnagar', 'CHC Sriramnagar'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('chc_tawargera', 'CHC Tawargera'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_alwandi', 'PHC Alwandi'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_anegundi', 'PHC Anegundi'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_bandihal', 'PHC Bandihal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_benakal', 'PHC Benakal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_betagera', 'PHC Betagera'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_bhagyanagar', 'PHC Bhagyanagar'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_budgumpa', 'PHC Budgumpa'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_chalgera', 'PHC Chalgera'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_dotihal', 'PHC Dotihal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_gandhal', 'PHC Gandhal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hanamsagar', 'PHC Hanamsagar'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hanmanhal', 'PHC Hanmanhal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hirebommanhal', 'PHC Hirebommanhal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hiregonnagar', 'PHC Hiregonnagar'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hiremannapur', 'PHC Hiremannapur'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hitnal', 'PHC Hitnal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hosakera', 'PHC Hosakera'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hulgera', 'PHC Hulgera'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_irkalgada', 'PHC Irkalgada'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_mudenoor', 'PHC Mudenoor'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_mudhol', 'PHC Mudhol'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_mushtur', 'PHC Mushtur'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_muslimpur', 'PHC muslimpur'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_navali', 'PHC Navali'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_sanganhal', 'PHC Sanganhal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_vajra_bandi', 'PHC Vajra Bandi'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'hulihydar', 'hanmanhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'hulihydar', 'hosgudda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'hulihydar', 'hulihyder'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'hulihydar', 'kanakapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'hulihydar', 'layadhunsi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'hulihydar', 'varankhed'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_a', 'anganwadi_1'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_a', 'anganwadi_15'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_a', 'anganwadi_17'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_a', 'anganwadi_2'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_a', 'anganwadi_3'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_a', 'anganwadi_7'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_a', 'anganwadi_9'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_b', 'anganwadi_11'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_b', 'anganwadi_12'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_b', 'anganwadi_14'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_b', 'anganwadi_16'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_b', 'anganwadi_18'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_b', 'anganwadi_19'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_b', 'anganwadi_5'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'karatagi_b', 'hale_juratgi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'karatagi_b', 'hosa_juratagi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'karatagi_b', 'karatagi_b'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'karatagi_b', 'ramnagar'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'salunchmara', 'hulkihal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'salunchmara', 'mari_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'salunchmara', 'marlanahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'salunchmara', 'salunchimara'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'sriramnagar_a', 'guntakal_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'sriramnagar_a', 'modal_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'sriramnagar_a', 'sriramnagar_a'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'sriramnagar_b', 'anjuri_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'sriramnagar_b', 'dangeri_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'sriramnagar_b', 'renuka_coliny'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'sriramnagar_b', 'sriramnagar_b'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_anegundi'), 'basvandurg', 'basvandurg'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_anegundi'), 'basvandurg', 'krishnapuradiggi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_anegundi'), 'basvandurg', 'kurihatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_anegundi'), 'basvandurg', 'ramdurg'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_anegundi'), 'basvandurg', 'ramdurg_camp'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'budgumpa', 'budgumpa'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'budgumpa', 'devicamp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'budgumpa', 'halasamudra'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'budgumpa', 'lakshmi_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'budgumpa', 'rajeev_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'budgumpa', 'shesagiri_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'budgumpa', 'timmapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hosakera'), 'heroor', 'b_r_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hosakera'), 'heroor', 'batterhanchnal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hosakera'), 'heroor', 'galemmacamp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hosakera'), 'heroor', 'gonal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hosakera'), 'heroor', 'herur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'chikka_jantkal', 'chikka_jantkal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'chikka_jantkal', 'hosahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'chikka_jantkal', 'nagarhalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'chikka_jantkal', 'vinoob_nagar'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'danapur', 'danapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'danapur', 'hebbal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'danapur', 'majjigi_camp'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'basarihal', 'bailakampur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'basarihal', 'basrihal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'basarihal', 'chikka_wadderkal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'basarihal', 'devlapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'basarihal', 'gouripur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'obalbanda', 'hulejali'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'obalbanda', 'kannermadu'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'obalbanda', 'naglapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'obalbanda', 'obalbanda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'obalbanda', 'ramdurg'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'obalbanda', 'rampur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'somsagara', 'a_b_chiktanda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'somsagara', 'a_b_doddatanda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'somsagara', 'advibhavi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'somsagara', 'somsagara'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_navali'), 'jeeral', 'chikka_dankankal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_navali'), 'jeeral', 'gandhi_nagar'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_navali'), 'jeeral', 'jeeral'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_navali'), 'jeeral', 'kalgudi_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_navali'), 'jeeral', 'new_kalgudi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_navali'), 'jeeral', 'old_kalgudi'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'bahaddurbandi', 'bahaddurbandi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'bahaddurbandi', 'belavinala'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'bahaddurbandi', 'chukankal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'bahaddurbandi', 'hosahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'bahaddurbandi', 'huvinhal'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'gondabal', 'hyati'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'gondabal', 'muddaballi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'gondabal', 'new_gondabal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'gondabal', 'old_gondabal'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_alwandi'), 'mainahalli', 'bikanhalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_alwandi'), 'mainahalli', 'handral'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_alwandi'), 'mainahalli', 'hanwal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_alwandi'), 'mainahalli', 'mainahalli'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_betagera'), 'katarki', 'adaramaggi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_betagera'), 'katarki', 'belur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_betagera'), 'katarki', 'gudlanuru'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_betagera'), 'katarki', 'katarki'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bhagyanagar'), 'bhagyanagar', 'bhagyanagar'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bhagyanagar'), 'bhagyanagar', 'ojanhalli'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'achartimmapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'challari'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'chikbommanhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'chiksulikeri'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'ganganhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'hirebommanhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'hiresulikeri'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'uplapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'arsinkera'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'arsinkera_thanda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'chamalapura'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'chilkmukki'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'gosaldoddi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'hasgal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'hosur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'jinnapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'jinnapur_chickthanda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'jinnapur_thanda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'metgal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'sidaganhalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'venktapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'agalkera', 'agalkera'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'bandi_harlapur', 'hosabandiharlapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'bandi_harlapur', 'kouli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'bandi_harlapur', 'mohammad_nagar'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'bandi_harlapur', 'shivapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'hitnal', 'hitnal'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'shivpur', 'kampasagar'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'shivpur', 'old_shivapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_irkalgada'), 'irkalgada', 'hanmanhatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_irkalgada'), 'irkalgada', 'irkalgada'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_irkalgada'), 'irkalgada', 'kodadhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_irkalgada'), 'irkalgada', 'taad_kanakapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_irkalgada'), 'irkalgada', 'wadderhatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_irkalgada'), 'irkalgada', 'yelamgera'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_10'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_13'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_14'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_15'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_2'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_4'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_5'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_6'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_7'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_8'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'gadderatti'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'benkanhal', 'benkanhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'benkanhal', 'kalalbandi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'benkanhal', 'madikera'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'benkanhal', 'yelbunchi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'benkanhal', 'zhoolkatti'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'talugeri', 'kordakera'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'talugeri', 'talugeri'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'talugeri', 'topalkatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'talugeri', 'vanageri'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_dotihal'), 'nidsesi', 'benchamatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_dotihal'), 'nidsesi', 'byalihal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_dotihal'), 'nidsesi', 'madalgatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_dotihal'), 'nidsesi', 'nidsesi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_dotihal'), 'nidsesi', 'shakapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanamsagar'), 'hanamsagar_a', 'beelagi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanamsagar'), 'hanamsagar_a', 'develapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanamsagar'), 'hanamsagar_a', 'hanamsagar_a'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanamsagar'), 'hanamsagar_a', 'mannerhal'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'nilogal', 'basapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'nilogal', 'bommanhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'nilogal', 'nilogal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'nilogal', 'rampur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'nilogal', 'vakkandurga'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'tuggaldoni', 'masbinkurbanhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'tuggaldoni', 'mittalkod'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'tuggaldoni', 'nirlakoppa'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'tuggaldoni', 'shadalgera'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'tuggaldoni', 'tuggaldoni'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiregonnagar'), 'hiregonnagar', 'chickgonnagar'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiregonnagar'), 'hiregonnagar', 'habalkatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiregonnagar'), 'hiregonnagar', 'hiregonnagar'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiregonnagar'), 'hiregonnagar', 'narsapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiregonnagar'), 'hiregonnagar', 'tumrikoppa'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiregonnagar'), 'hiregonnagar', 'varikal'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'gudadur', 'basapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'gudadur', 'gonhal_k'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'gudadur', 'gudadur_m'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'gudadur', 'hosur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'gudadur', 'madapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'gudadur', 'tengunti'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'hiremannapur', 'ganganhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'hiremannapur', 'gumgeri'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'hiremannapur', 'hiremannapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hulgera'), 'katapur', 'kabbargi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hulgera'), 'katapur', 'kalgonhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hulgera'), 'katapur', 'katapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudenoor'), 'muddalgundi', 'amarapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudenoor'), 'muddalgundi', 'kalmalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudenoor'), 'muddalgundi', 'kidadur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudenoor'), 'muddalgundi', 'muddalgundi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudenoor'), 'muddalgundi', 'muddalgundi_thanda'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'chendoor', 'arkeri'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'chendoor', 'chendoor'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'chendoor', 'muthalu'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'chendoor', 'sirur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'mangalore_a', 'anganwadi_10'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'mangalore_a', 'anganwadi_2'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'mangalore_a', 'anganwadi_4'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'mangalore_a', 'anganwadi_6'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bandihal'), 'bandihal', 'bandihal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bandihal'), 'bandihal', 'tondihal'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bandihal'), 'karmudi', 'karmudi'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_benakal'), 'benakal', 'benakal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_benakal'), 'benakal', 'veerapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_gandhal'), 'gandhal_a', 'bukkanhatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_gandhal'), 'gandhal_a', 'gandhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_gandhal'), 'gandhal_a', 'hire_waddarkal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_gandhal'), 'gandhal_a', 'katgihalli'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol'), 'hiremyageri', 'hiremyageri'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol'), 'hiremyageri', 'sompur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol'), 'mudhol', 'mudhol'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_sanganhal'), 'sanganhal', 'kallur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_sanganhal'), 'sanganhal', 'sanganhal'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_vajra_bandi'), 'hulegudda', 'hulegudda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_vajra_bandi'), 'hulegudda', 'makkahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_vajra_bandi'), 'hulegudda', 'murdi_thanda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_vajra_bandi'), 'hulegudda', 'salbhavi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_vajra_bandi'), 'hulegudda', 'talur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_vajra_bandi'), 'hulegudda', 'talur_thanda'); - --- ANM DATA -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'kana1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'Manjula', 'hulihydar'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'kana2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'K.Santha', 'kanakageri_a'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'kana3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'Jayasree', 'kanakageri_b'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'kara1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'Bhagyalakshmi', 'karatagi_b'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'kara2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'Santarayanagoudar', 'salunchmara'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'sri1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'Asha Begum', 'sriramnagar_a'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'sri2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'Santhavva', 'sriramnagar_b'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'ane1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_anegundi'), 'Manjula', 'basvandurg'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'bud1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'K.N.Bhairamatti', 'budgumpa'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'hosa1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hosakera'), 'Mulimani Khadarbi', 'heroor'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'mush1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'Gnaneswari', 'chikka_jantkal'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'mush2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'Kavita', 'danapur'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'musl1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'Kanaakava ( Kamalamma)', 'basarihal'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'musl2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'Aswani C', 'obalbanda'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'musl3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'Mahadevakka', 'somsagara'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'nava1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_navali'), 'Mangalabai', 'jeeral'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'here1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'Rose Henna', 'bahaddurbandi'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'here2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'Hasena Begum', 'gondabal'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'alw1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_alwandi'), 'Saraswati', 'mainahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'bet1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_betagera'), 'Saubhagyamma', 'katarki'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'bha1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bhagyanagar'), 'S.V.Mahendrakar', 'bhagyanagar'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'hir1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'Siddalingamma', 'chikbommanhal'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'hir2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'Manjula', 'hasgal'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'hit1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'Vijayalakshmi', 'agalkera'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'hit2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'J. Ambika', 'bandi_harlapur'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'hit3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'K.Bhagyamma', 'hitnal'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'hit4', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'Devakki Jaylaxmi', 'shivpur'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'irk1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_irkalgada'), 'Karibasamma', 'irkalgada'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'taw1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'Renuka', 'tawargera_a'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'cha1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'Sarvamangala', 'benkanhal'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'cha2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'Renuka.R.', 'talugeri'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'dot1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_dotihal'), 'Renuka.Hubli', 'nidsesi'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'han1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanamsagar'), 'Sharanamma Malipatil', 'hanamsagar_a'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'hanl1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'Rekha Immadi', 'nilogal'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'hanl2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'Mangalagauri Pirangi', 'tuggaldoni'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'hire1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiregonnagar'), 'Lalitavva', 'hiregonnagar'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'hmp1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'Channabasavva', 'gudadur'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'hmp2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'Nurajahan Begum', 'hiremannapur'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'hul1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hulgera'), 'Yashoda', 'katapur'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'mud1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudenoor'), 'Sis. Renuka', 'muddalgundi'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'man1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'Kumari Manjula', 'chendoor'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'man2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'Geeta', 'mangalore_a'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'ban1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bandihal'), 'Manjula.M', 'bandihal'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'ban2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bandihal'), 'Shobhabai', 'karmudi'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'ben1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_benakal'), 'Eramma Ryavanaki', 'benakal'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'gan1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_gandhal'), 'Kalavati.S.M', 'gandhal_a'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'mul1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol'), 'Hemakshi', 'hiremyageri'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'mul2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol'), 'Savitramma', 'mudhol'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'san1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_sanganhal'), 'Shantadevi', 'sanganhal'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'vaj1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_vajra_bandi'), 'Rajeshwari', 'hulegudda'); - -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='kara1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='sri1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='bud1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hosa1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='musl1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='musl2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='musl3'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hit4'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='taw1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='cha1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='cha2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='dot1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='han1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hanl1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hanl2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hire1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hmp1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hmp2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hul1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='mud1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='man1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='man2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='ban1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='ban2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='ben1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='gan1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='mul2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='san1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='vaj1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_26__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_26__Adding_Indicators.sql deleted file mode 100755 index 1047fcf3b7..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_26__Adding_Indicators.sql +++ /dev/null @@ -1,7 +0,0 @@ -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ANC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ANC_LT_12'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_TT1'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_SUB_TT'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_BF_POST_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_SPONTANEOUS_ABORTION'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_VIT_A_1'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_27__Adding_Ten_More_Training_User_Data.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_27__Adding_Ten_More_Training_User_Data.sql deleted file mode 100755 index 54f57028d9..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_27__Adding_Ten_More_Training_User_Data.sql +++ /dev/null @@ -1,90 +0,0 @@ --- trainer3 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('trainer3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer3'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- trainer4 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('trainer4', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer4'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- trainer5 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('trainer5', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer5'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user11 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user11', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user11'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user12 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user12', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user12'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user13 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user13', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user13'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user14 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user14', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user14'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user15 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user15', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user15'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user16 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user16', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user16'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user17 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user17', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user17'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user18 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user18', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user18'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user19 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user19', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user19'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - --- user20 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user20', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user20'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_28__Adding_Missing_Village_For_Koppal.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_28__Adding_Missing_Village_For_Koppal.sql deleted file mode 100755 index 80878417c6..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_28__Adding_Missing_Village_For_Koppal.sql +++ /dev/null @@ -1 +0,0 @@ -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) (SELECT 'Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'hiresulikeri_thanda'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_29__Updating_Names_For_Users.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_29__Updating_Names_For_Users.sql deleted file mode 100755 index 254e920b70..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_29__Updating_Names_For_Users.sql +++ /dev/null @@ -1,13 +0,0 @@ -UPDATE report.dim_anm SET name = 'User11' WHERE anmIdentifier = 'user11'; -UPDATE report.dim_anm SET name = 'User12' WHERE anmIdentifier = 'user12'; -UPDATE report.dim_anm SET name = 'User13' WHERE anmIdentifier = 'user13'; -UPDATE report.dim_anm SET name = 'User14' WHERE anmIdentifier = 'user14'; -UPDATE report.dim_anm SET name = 'User15' WHERE anmIdentifier = 'user15'; -UPDATE report.dim_anm SET name = 'User16' WHERE anmIdentifier = 'user16'; -UPDATE report.dim_anm SET name = 'User17' WHERE anmIdentifier = 'user17'; -UPDATE report.dim_anm SET name = 'User18' WHERE anmIdentifier = 'user18'; -UPDATE report.dim_anm SET name = 'User19' WHERE anmIdentifier = 'user19'; -UPDATE report.dim_anm SET name = 'User20' WHERE anmIdentifier = 'user20'; -UPDATE report.dim_anm SET name = 'Trainer3' WHERE anmIdentifier = 'trainer3'; -UPDATE report.dim_anm SET name = 'Trainer4' WHERE anmIdentifier = 'trainer4'; -UPDATE report.dim_anm SET name = 'Trainer5' WHERE anmIdentifier = 'trainer5'; \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_2__Adding_Service_Provider_Types.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_2__Adding_Service_Provider_Types.sql deleted file mode 100755 index 8c598c6d84..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_2__Adding_Service_Provider_Types.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO report.dim_service_provider_type (type) VALUES ('ANM'); -INSERT INTO report.dim_service_provider_type (type) VALUES ('PHC'); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_30__Adding_Duplicate_Users_For_The_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_30__Adding_Duplicate_Users_For_The_ANMs.sql deleted file mode 100755 index 2cadb8dbab..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_30__Adding_Duplicate_Users_For_The_ANMs.sql +++ /dev/null @@ -1,8 +0,0 @@ -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'srir1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'Asha Begum', 'sriramnagar_a'); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'budg1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'K.N.Bhairamatti', 'budgumpa'); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'karat1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'Bhagyalakshmi', 'karatagi_b'); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_31__Adding_EntityId_To_Service_Provided_Table.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_31__Adding_EntityId_To_Service_Provided_Table.sql deleted file mode 100755 index f63a86a8b8..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_31__Adding_EntityId_To_Service_Provided_Table.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE report.service_provided ADD COLUMN dristhi_entity_id VARCHAR(255); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_32__Adding_Ten_More_User_Data_For_Third_Batch_of_Training.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_32__Adding_Ten_More_User_Data_For_Third_Batch_of_Training.sql deleted file mode 100755 index 4fe905aa03..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_32__Adding_Ten_More_User_Data_For_Third_Batch_of_Training.sql +++ /dev/null @@ -1,55 +0,0 @@ -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user21', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User21', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user22', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User22', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user23', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User23', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user24', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User24', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user25', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User25', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user26', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User26', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user27', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User27', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user28', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User28', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user29', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User29', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user30', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User30', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user31', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User31', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user32', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User32', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user33', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User33', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user34', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User34', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user35', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User35', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user36', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User36', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user37', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User37', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user38', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User38', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user39', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User39', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user40', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User40', 'munjanahalli'); - -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user21'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user22'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user23'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user24'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user25'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user26'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user27'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user28'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user29'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user30'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user31'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user32'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user33'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user34'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user35'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user36'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user37'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user38'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user39'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user40'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - - --- Trainer data -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'trainer6', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer6', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'trainer7', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer7', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'trainer8', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer8', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'trainer9', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer9', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'trainer10', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer10', 'munjanahalli'); - -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer6'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer7'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer8'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer9'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer10'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_33__Adding_Missing_Villages_For_Kustagi.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_33__Adding_Missing_Villages_For_Kustagi.sql deleted file mode 100755 index cae9f932b6..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_33__Adding_Missing_Villages_For_Kustagi.sql +++ /dev/null @@ -1 +0,0 @@ -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) (SELECT 'Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudenoor'), 'muddalgundi', 'kalmalli_thanda'); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_34__Adding_Annual_targets_for_Koppal_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_34__Adding_Annual_targets_for_Koppal_ANMs.sql deleted file mode 100755 index 3111289fae..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_34__Adding_Annual_targets_for_Koppal_ANMs.sql +++ /dev/null @@ -1,384 +0,0 @@ --- Annual targets for here1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),161, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),161, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),120, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),150, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),46, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),65, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),65, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),147, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),147, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),147, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),147, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),147, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),147, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),147, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),147, '2014-03-26', '2015-03-25'); --- Annual targets for here2 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),205, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),205, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),205, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),205, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),14, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),27, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),124, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),190, '2014-03-26', '2015-03-25'); --- Annual targets for alw1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),140, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),140, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),140, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),140, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),49, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),62, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),65, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),128, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),128, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),128, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),128, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),128, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),128, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),128, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),128, '2014-03-26', '2015-03-25'); --- Annual targets for bet1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),160, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),160, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),160, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),160, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),52, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),58, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),66, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),152, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),152, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),152, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),152, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),152, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),152, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),152, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),152, '2014-03-26', '2015-03-25'); --- Annual targets for bha1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),411, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),390, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),411, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),214, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),104, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),95, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),168, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),360, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),360, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),360, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),360, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),360, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),360, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),371, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),371, '2014-03-26', '2015-03-25'); --- Annual targets for hir1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),225, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),225, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),225, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),225, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),20, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),51, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),100, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),215, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),215, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),215, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),215, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),210, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),210, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),210, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),210, '2014-03-26', '2015-03-25'); --- Annual targets for hir2 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),235, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),235, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),235, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),235, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),42, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),40, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),106, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),218, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),218, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),218, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),218, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),218, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),218, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),218, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),218, '2014-03-26', '2015-03-25'); --- Annual targets for hit1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),22, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),26, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),58, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),102, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),102, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),102, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),102, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),102, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),102, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),102, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),102, '2014-03-26', '2015-03-25'); --- Annual targets for hit2 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),135, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),14, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),135, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),112, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),17, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),18, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),65, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),135, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),136, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),142, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),135, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),135, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),135, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),135, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),135, '2014-03-26', '2015-03-25'); --- Annual targets for hit3 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),111, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),111, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),111, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),111, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),22, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),28, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),55, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),97, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),97, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),97, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),104, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),104, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),104, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),104, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),104, '2014-03-26', '2015-03-25'); --- Annual targets for irk1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),248, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),206, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),248, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),248, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),20, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),28, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),58, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),192, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),224, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),210, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),214, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),214, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),200, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),190, '2014-03-26', '2015-03-25'); --- Annual targets for kana1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),220, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),220, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),220, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),220, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),62, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),42, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),86, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),207, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),207, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),207, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),207, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),207, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),207, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),207, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),207, '2014-03-26', '2015-03-25'); --- Annual targets for kana2 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),150, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),134, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),144, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),144, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),21, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),22, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),58, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),130, '2014-03-26', '2015-03-25'); --- Annual targets for kana3 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),120, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),95, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),120, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),120, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),25, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),25, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),50, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),108, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),108, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),108, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),108, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),108, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),108, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),108, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),108, '2014-03-26', '2015-03-25'); --- Annual targets for karat1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),473, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),450, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),349, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),281, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),70, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),70, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),170, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),170, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),170, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),170, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),170, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),170, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),170, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),170, '2014-03-26', '2015-03-25'); --- Annual targets for kara2 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),25, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),42, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),84, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),185, '2014-03-26', '2015-03-25'); --- Annual targets for srir1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),118, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),96, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),22, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),20, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),54, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),110, '2014-03-26', '2015-03-25'); --- Annual targets for sri2 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),156, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),156, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),156, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),156, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),10, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),15, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),60, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),133, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),133, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),133, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),133, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),133, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),133, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),133, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),133, '2014-03-26', '2015-03-25'); --- Annual targets for ane1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),59, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),59, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),59, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),59, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),19, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),19, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),29, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),54, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),54, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),54, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),54, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),54, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),54, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),56, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),56, '2014-03-26', '2015-03-25'); --- Annual targets for budg1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),45, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),55, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),55, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),230, '2014-03-26', '2015-03-25'); --- Annual targets for mul1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),203, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),203, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),203, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),203, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),52, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),41, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),81, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),173, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),173, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),173, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),173, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),173, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),173, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),173, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),173, '2014-03-26', '2015-03-25'); --- Annual targets for mush1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),192, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),192, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),192, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),192, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),29, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),38, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),78, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),174, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),174, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),174, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),174, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),174, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),174, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),174, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),174, '2014-03-26', '2015-03-25'); --- Annual targets for mush2 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),150, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),150, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),150, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),120, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),28, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),26, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),57, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),139, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),139, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),139, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),139, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),139, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),139, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),139, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),139, '2014-03-26', '2015-03-25'); --- Annual targets for nava1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),168, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),145, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),13, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),32, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),68, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),158, '2014-03-26', '2015-03-25'); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_35__Adding_Ten_More_User_Data_For_Last_Batch_of_Training.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_35__Adding_Ten_More_User_Data_For_Last_Batch_of_Training.sql deleted file mode 100755 index 219d8e6c7e..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_35__Adding_Ten_More_User_Data_For_Last_Batch_of_Training.sql +++ /dev/null @@ -1,35 +0,0 @@ -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user41', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User41', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user42', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User42', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user43', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User43', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user44', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User44', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user45', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User45', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user46', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User46', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user47', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User47', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user48', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User48', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user49', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User49', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'user50', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User50', 'munjanahalli'); - -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user41'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user42'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user43'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user44'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user45'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user46'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user47'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user48'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user49'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user50'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - - --- Trainer data -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'trainer11', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer11', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'trainer12', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer12', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'trainer13', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer13', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'trainer14', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer14', 'munjanahalli'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'trainer15', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer15', 'munjanahalli'); - -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer11'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer12'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer13'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer14'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer15'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_36__Adding_Duplicate_Users_For_The_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_36__Adding_Duplicate_Users_For_The_ANMs.sql deleted file mode 100755 index c9f22e5b1c..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_36__Adding_Duplicate_Users_For_The_ANMs.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) (SELECT 'muslim3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'Mahadevakka', 'somsagara'); -INSERT INTO report.dim_service_provider (service_provider, type) (SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='muslim3'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_37__Adding_User_And_Location.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_37__Adding_User_And_Location.sql deleted file mode 100755 index 30eaf4db7b..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_37__Adding_User_And_Location.sql +++ /dev/null @@ -1,16 +0,0 @@ -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) (SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'chc_mangalore'), 'mangalore_a', 'hirebindal'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) (SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'chc_mangalore'), 'mangalore_a', 'kadralli'); - -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) (SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_1'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) (SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_2'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) (SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_4'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) (SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_5'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) (SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_6'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) (SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_7'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) (SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_8'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) (SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_9'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) (SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_10'); - -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) (SELECT 'Karnataka', 'Koppal', 'Kustagi' , (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'chc_tawargera'), 'tawargera_a', 'anganwadi_9'); - - diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_38__Updating_Sompur_Village_To_Hosure_S.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_38__Updating_Sompur_Village_To_Hosure_S.sql deleted file mode 100755 index 358240befc..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_38__Updating_Sompur_Village_To_Hosure_S.sql +++ /dev/null @@ -1 +0,0 @@ - UPDATE report.dim_location SET village = 'hosure_s' WHERE village= 'sompur'; \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_3__Adding_PHCs.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_3__Adding_PHCs.sql deleted file mode 100755 index 06630c8b6d..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_3__Adding_PHCs.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('bherya', 'Bherya'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('keelanapura', 'Keelanapura'); - diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_4__Adding_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_4__Adding_ANMs.sql deleted file mode 100755 index 0ea53d95c6..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_4__Adding_ANMs.sql +++ /dev/null @@ -1,21 +0,0 @@ -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('bhe1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('bhe2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('bhe3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('bhe4', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('bhe5', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); - -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('klp1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('klp2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('klp3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('klp4', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_6__Adding_Locations.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_6__Adding_Locations.sql deleted file mode 100755 index 693e5f59d7..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_6__Adding_Locations.sql +++ /dev/null @@ -1,43 +0,0 @@ -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_a', 'ardha_bherya'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_a', 'basavanapura'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_a', 'geradada'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_a', 'sambaravalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_a', 'somanahalli_colony'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_b', 'battiganahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_b', 'half_bherya'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_b', 'sugganahalli'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'g_a_guppe', 'arakere'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'g_a_guppe', 'g_a_guppe'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'g_a_guppe', 'udayagiri'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'hosa_agrahara', 'boregowdanakoppalu'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'hosa_agrahara', 'harambanahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'hosa_agrahara', 'harambanahalli_koppalu'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'hosa_agrahara', 'hosa_agrahara'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'hosa_agrahara', 'mandiganahalli'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'munjanahalli', 'chikkabherya'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'munjanahalli', 'kavalu_hosur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'munjanahalli', 'munjanahalli'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a', 'inam_uttanahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a', 'keelanapura'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a', 'm_c_hundi'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_b', 'gurukarapura'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_b', 'hosahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_b', 'madhavagere'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_b', 'megalapura'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'puttegowdanahundi', 'chattanahallipalya'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'puttegowdanahundi', 'chattanahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'puttegowdanahundi', 'duddagere'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'puttegowdanahundi', 'lakshmipura'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'puttegowdanahundi', 'mahadevi_colony'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'puttegowdanahundi', 'puttegowdanahundi'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'vajamangala', 'chikkahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'vajamangala', 'halagayanahundi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'vajamangala', 'vajamangala'); diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_7__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_7__Adding_Indicators.sql deleted file mode 100755 index 8ed1bf34da..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_7__Adding_Indicators.sql +++ /dev/null @@ -1,62 +0,0 @@ -INSERT INTO report.dim_indicator (indicator) VALUES ('DPT'); -INSERT INTO report.dim_indicator (indicator) VALUES ('DPT_BOOSTER_2'); -INSERT INTO report.dim_indicator (indicator) VALUES ('HEP'); -INSERT INTO report.dim_indicator (indicator) VALUES ('OPV'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MEASLES'); -INSERT INTO report.dim_indicator (indicator) VALUES ('BCG'); -INSERT INTO report.dim_indicator (indicator) VALUES ('ANC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('ANC<12'); -INSERT INTO report.dim_indicator (indicator) VALUES ('LIVE_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('STILL_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('OCP'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IUD'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MALE_STERILIZATION'); -INSERT INTO report.dim_indicator (indicator) VALUES ('FEMALE_STERILIZATION'); -INSERT INTO report.dim_indicator (indicator) VALUES ('CONDOM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('DMPA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('FP_TRADITIONAL'); -INSERT INTO report.dim_indicator (indicator) VALUES ('LAM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('SUB_TT'); -INSERT INTO report.dim_indicator (indicator) VALUES ('TT1'); -INSERT INTO report.dim_indicator (indicator) VALUES ('TT2'); -INSERT INTO report.dim_indicator (indicator) VALUES ('TTB'); -INSERT INTO report.dim_indicator (indicator) VALUES ('LBW'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MTP<12'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MTP>12'); -INSERT INTO report.dim_indicator (indicator) VALUES ('SPONTANEOUS_ABORTION'); -INSERT INTO report.dim_indicator (indicator) VALUES ('DELIVERY'); -INSERT INTO report.dim_indicator (indicator) VALUES ('INSTITUTIONAL_DELIVERY'); -INSERT INTO report.dim_indicator (indicator) VALUES ('BF_POST_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('WEIGHED_AT_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('ENM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('LNM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('UFM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MMA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MMD'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MMP'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('VIT_A_1'); -INSERT INTO report.dim_indicator (indicator) VALUES ('VIT_A_2'); -INSERT INTO report.dim_indicator (indicator) VALUES ('ANC4'); -INSERT INTO report.dim_indicator (indicator) VALUES ('PNC3'); -INSERT INTO report.dim_indicator (indicator) VALUES ('D_HOM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('D_SC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('D_PHC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('D_CHC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('D_SDH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('D_DH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('D_PRI'); -INSERT INTO report.dim_indicator (indicator) VALUES ('DPT3_OPV3'); -INSERT INTO report.dim_indicator (indicator) VALUES ('DPTB_OPVB'); -INSERT INTO report.dim_indicator (indicator) VALUES ('OCP_ST'); -INSERT INTO report.dim_indicator (indicator) VALUES ('OCP_SC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('OCP_C_OTHERS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('FS_APL'); -INSERT INTO report.dim_indicator (indicator) VALUES ('FS_BPL'); -INSERT INTO report.dim_indicator (indicator) VALUES ('CESAREAN'); -INSERT INTO report.dim_indicator (indicator) VALUES ('CESAREAN_GOV'); -INSERT INTO report.dim_indicator (indicator) VALUES ('CESAREAN_PRI'); -INSERT INTO report.dim_indicator (indicator) VALUES ('INFANT_REG'); - diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_8__Adding_AnnualTargets_For_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_8__Adding_AnnualTargets_For_ANMs.sql deleted file mode 100755 index 6a12171b5f..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_8__Adding_AnnualTargets_For_ANMs.sql +++ /dev/null @@ -1,100 +0,0 @@ -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 12, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 12, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 7, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 11, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 10, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 16, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 11, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 17, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 17, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 37, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 35, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 28, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 72, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 39, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 48, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 94, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 126, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 63, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 48, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 58, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 2, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 52, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 38, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 78, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 61, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 90, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 40, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 72, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 4, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 52, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 38, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 72, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 39, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 48, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 94, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 126, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 63, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 53, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 33, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 56, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 41, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 80, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 93, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 57, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 53, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 33, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 56, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 41, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 80, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 93, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 57, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 58, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 59, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 49, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 37, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 68, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 84, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 45, '2012-03-26', '2013-03-25'); - diff --git a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_9__Adding_Annual_Targets_For_Test_User.sql b/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_9__Adding_Annual_Targets_For_Test_User.sql deleted file mode 100755 index 858213292e..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/mysql/serviceProvided/V1_0_9__Adding_Annual_Targets_For_Test_User.sql +++ /dev/null @@ -1,176 +0,0 @@ -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('c', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='c'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('demo1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo1'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('demo2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo2'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('demo3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo3'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_10__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_10__Adding_Indicators.sql deleted file mode 100755 index 8ae3058efe..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_10__Adding_Indicators.sql +++ /dev/null @@ -1,20 +0,0 @@ -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('M_LIVE_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('F_LIVE_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_IFA_100'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_IMMUNIZATION_DEATH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_VIT_A_5_3YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_VIT_A_9_3YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_DPTBOOSTER_2_5YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_HYPERTENSION'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MMR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_DPT'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_OPV'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_M_ALL_VACC_2Y'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_F_ALL_VACC_2Y'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ALL_VACC_2Y'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('ANC_GT_12'); -UPDATE anm_report.dim_indicator SET indicator = 'IB_LT_1Y' where indicator = 'IB<1Y'; -UPDATE anm_report.dim_indicator SET indicator = 'IB_LT_5Y' where indicator = 'IB<5Y'; -UPDATE anm_report.dim_indicator SET indicator = 'ANC_LT_12' where indicator = 'ANC<12'; -UPDATE anm_report.dim_indicator SET indicator = 'MTP_LT_12' where indicator = 'MTP<12'; -UPDATE anm_report.dim_indicator SET indicator = 'MTP_GT_12' where indicator = 'MTP>12'; diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_11__Migrating_date_in_ANM_Report.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_11__Migrating_date_in_ANM_Report.sql deleted file mode 100755 index 81469c2a14..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_11__Migrating_date_in_ANM_Report.sql +++ /dev/null @@ -1,29 +0,0 @@ -ALTER TABLE anm_report.anm_report_data DROP COLUMN IF EXISTS new_date_; -ALTER TABLE anm_report.anm_report_data ADD COLUMN new_date_ DATE; - -DROP FUNCTION IF EXISTS merge_date_in_anm_report_data(); - -CREATE FUNCTION merge_date_in_anm_report_data() -RETURNS BOOLEAN AS $THIS$ -DECLARE - v_date DATE; - anm_report_data_row anm_report.anm_report_data%ROWTYPE; -BEGIN - FOR anm_report_data_row IN SELECT * FROM anm_report.anm_report_data LOOP - SELECT date_ INTO v_date FROM anm_report.dim_date WHERE id = anm_report_data_row.date_; - EXECUTE 'UPDATE anm_report.anm_report_data SET new_date_ = ''' || v_date || ''' where id = ' || anm_report_data_row.id; - END LOOP; - RETURN TRUE; -EXCEPTION - WHEN OTHERS THEN - RAISE NOTICE 'Exception: %', SQLERRM; - RETURN FALSE; -END; -$THIS$LANGUAGE plpgsql; - -SELECT * FROM merge_date_in_anm_report_data(); - -ALTER TABLE anm_report.anm_report_data DROP CONSTRAINT FK_ARD_DD_ID; -ALTER TABLE anm_report.anm_report_data RENAME COLUMN date_ TO old_date_; -ALTER TABLE anm_report.anm_report_data ALTER COLUMN old_date_ DROP NOT NULL; -ALTER TABLE anm_report.anm_report_data RENAME COLUMN new_date_ TO date_; diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_12__Adding_Missing_Training_Users.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_12__Adding_Missing_Training_Users.sql deleted file mode 100755 index 13a8913160..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_12__Adding_Missing_Training_Users.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('suresh'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('nirmala'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_13__Removing_Dim_Date.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_13__Removing_Dim_Date.sql deleted file mode 100755 index 4a94e69b6f..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_13__Removing_Dim_Date.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP TABLE IF EXISTS anm_report.dim_date; -ALTER TABLE anm_report.anm_report_data DROP COLUMN old_date_ RESTRICT; \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_14__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_14__Adding_Indicators.sql deleted file mode 100755 index d20a355b1a..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_14__Adding_Indicators.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_LIVE_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_STILL_BIRTH'); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_15__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_15__Adding_Indicators.sql deleted file mode 100755 index 139e93ec75..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_15__Adding_Indicators.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('OPV3'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('OPV_BOOSTER'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('DPT_BOOSTER_1'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_16__Adding_User_Data.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_16__Adding_User_Data.sql deleted file mode 100755 index 4dca25edd8..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_16__Adding_User_Data.sql +++ /dev/null @@ -1,7 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'demo4' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='demo4'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'demo5' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='demo5'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'demo6' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='demo6'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'demo7' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='demo7'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'demo8' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='demo8'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'demo9' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='demo9'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'demo10' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='demo10'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_17__Adding_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_17__Adding_ANMs.sql deleted file mode 100755 index 9d30b05151..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_17__Adding_ANMs.sql +++ /dev/null @@ -1,50 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'kana1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='kana1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'kana2' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='kana2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'kana3' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='kana3'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'kara1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='kara1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'kara2' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='kara2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'sri1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='sri1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'sri2' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='sri2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'ane1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='ane1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'bud1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='bud1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'hosa1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='hosa1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'mush1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='mush1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'mush2' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='mush2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'musl1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='musl1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'musl2' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='musl2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'musl3' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='musl3'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'nava1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='nava1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'here1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='here1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'here2' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='here2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'alw1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='alw1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'bet1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='bet1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'bha1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='bha1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'hir1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='hir1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'hir2' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='hir2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'hit1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='hit1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'hit2' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='hit2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'hit3' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='hit3'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'hit4' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='hit4'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'irk1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='irk1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'taw1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='taw1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'cha1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='cha1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'cha2' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='cha2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'dot1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='dot1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'han1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='han1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'hanl1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='hanl1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'hanl2' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='hanl2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'hire1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='hire1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'hmp1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='hmp1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'hmp2' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='hmp2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'hul1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='hul1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'mud1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='mud1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'man1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='man1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'man2' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='man2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'ban1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='ban1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'ban2' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='ban2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'ben1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='ben1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'gan1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='gan1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'mul1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='mul1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'mul2' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='mul2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'san1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='san1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'vaj1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='vaj1'); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_18__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_18__Adding_Indicators.sql deleted file mode 100755 index 0503de624e..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_18__Adding_Indicators.sql +++ /dev/null @@ -1,7 +0,0 @@ -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ANC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ANC_LT_12'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_TT1'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_SUB_TT'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_BF_POST_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_SPONTANEOUS_ABORTION'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_VIT_A_1'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_19__Adding_Ten_More_User_Data_For_Training.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_19__Adding_Ten_More_User_Data_For_Training.sql deleted file mode 100755 index 7d565c7875..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_19__Adding_Ten_More_User_Data_For_Training.sql +++ /dev/null @@ -1,25 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer3'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer4'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer5'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user11'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user12'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user13'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user14'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user15'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user16'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user17'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user18'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user19'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user20'); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_1__Initial_Setup.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_1__Initial_Setup.sql deleted file mode 100755 index d169ecf476..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_1__Initial_Setup.sql +++ /dev/null @@ -1,23 +0,0 @@ -CREATE TABLE anm_report.dim_anm (ID SERIAL, anmIdentifier VARCHAR NOT NULL, - CONSTRAINT pk_dim_anm PRIMARY KEY (ID), - CONSTRAINT U_DA_AN UNIQUE (anmIdentifier)); - -CREATE TABLE anm_report.dim_indicator (ID SERIAL, indicator VARCHAR NOT NULL, - CONSTRAINT pk_dim_indicator PRIMARY KEY (ID), - CONSTRAINT U_DI_IN UNIQUE (indicator)); - -CREATE TABLE anm_report.dim_date (ID SERIAL, date_ DATE NOT NULL, - CONSTRAINT pk_dim_date PRIMARY KEY (ID), - CONSTRAINT U_DD_DT UNIQUE (date_)); - -CREATE TABLE anm_report.annual_target (ID SERIAL, anmIdentifier INTEGER NOT NULL, indicator INTEGER NOT NULL, target VARCHAR NOT NULL, start_date DATE NOT NULL, end_date DATE NOT NULL, - CONSTRAINT pk_annual_target PRIMARY KEY (ID), - CONSTRAINT FK_AT_DA_ID FOREIGN KEY (anmIdentifier) REFERENCES anm_report.dim_anm (ID), - CONSTRAINT FK_AT_DI_ID FOREIGN KEY (indicator) REFERENCES anm_report.dim_indicator (ID), - CONSTRAINT U_AT_AI_IN_TA_SD_ED UNIQUE (anmIdentifier, indicator, start_date, end_date)); - -CREATE TABLE anm_report.anm_report_data (ID SERIAL, anmIdentifier INTEGER NOT NULL, externalId VARCHAR NOT NULL, indicator INTEGER NOT NULL, date_ INTEGER NOT NULL, - CONSTRAINT pk_anm_report_data PRIMARY KEY (ID), - CONSTRAINT FK_ARD_DA_ID FOREIGN KEY (anmIdentifier) REFERENCES anm_report.dim_anm (ID), - CONSTRAINT FK_ARD_DI_ID FOREIGN KEY (indicator) REFERENCES anm_report.dim_indicator (ID), - CONSTRAINT FK_ARD_DD_ID FOREIGN KEY (date_) REFERENCES anm_report.dim_date (ID)); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_20__Adding_Duplicate_User_For_The_ANM.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_20__Adding_Duplicate_User_For_The_ANM.sql deleted file mode 100755 index b309405dfc..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_20__Adding_Duplicate_User_For_The_ANM.sql +++ /dev/null @@ -1,5 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'srir1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='srir1'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'budg1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='budg1'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'karat1' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='karat1'); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_21__Adding_Ten_More_User_Data_For_Third_Batch_of_Training.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_21__Adding_Ten_More_User_Data_For_Third_Batch_of_Training.sql deleted file mode 100755 index a68783c2e6..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_21__Adding_Ten_More_User_Data_For_Third_Batch_of_Training.sql +++ /dev/null @@ -1,27 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user21'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user22'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user23'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user24'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user25'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user26'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user27'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user28'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user29'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user30'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user31'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user32'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user33'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user34'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user35'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user36'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user37'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user38'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user39'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user40'); - - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer6'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer7'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer8'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer9'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer10'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_22__Adding_Annual_Targets_for_Koppal_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_22__Adding_Annual_Targets_for_Koppal_ANMs.sql deleted file mode 100755 index 4560d07842..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_22__Adding_Annual_Targets_for_Koppal_ANMs.sql +++ /dev/null @@ -1,384 +0,0 @@ ---Annual targets for here1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),161, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),161, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),120, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),150, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),46, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),65, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),65, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),147, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),147, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),147, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),147, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),147, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),147, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),147, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),147, '2014-03-26', '2015-03-25'); ---Annual targets for here2 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),205, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),205, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),205, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),205, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),14, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),27, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),124, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),190, '2014-03-26', '2015-03-25'); ---Annual targets for alw1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),140, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),140, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),140, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),140, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),49, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),62, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),65, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),128, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),128, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),128, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),128, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),128, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),128, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),128, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),128, '2014-03-26', '2015-03-25'); ---Annual targets for bet1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),160, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),160, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),160, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),160, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),52, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),58, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),66, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),152, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),152, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),152, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),152, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),152, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),152, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),152, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),152, '2014-03-26', '2015-03-25'); ---Annual targets for bha1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),411, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),390, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),411, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),214, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),104, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),95, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),168, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),360, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),360, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),360, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),360, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),360, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),360, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),371, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),371, '2014-03-26', '2015-03-25'); ---Annual targets for hir1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),225, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),225, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),225, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),225, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),20, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),51, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),100, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),215, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),215, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),215, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),215, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),210, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),210, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),210, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),210, '2014-03-26', '2015-03-25'); ---Annual targets for hir2 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),235, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),235, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),235, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),235, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),42, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),40, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),106, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),218, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),218, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),218, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),218, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),218, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),218, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),218, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),218, '2014-03-26', '2015-03-25'); ---Annual targets for hit1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),22, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),26, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),58, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),102, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),102, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),102, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),102, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),102, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),102, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),102, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),102, '2014-03-26', '2015-03-25'); ---Annual targets for hit2 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),135, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),14, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),135, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),112, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),17, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),18, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),65, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),135, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),136, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),142, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),135, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),135, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),135, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),135, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),135, '2014-03-26', '2015-03-25'); ---Annual targets for hit3 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),111, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),111, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),111, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),111, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),22, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),28, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),55, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),97, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),97, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),97, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),104, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),104, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),104, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),104, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),104, '2014-03-26', '2015-03-25'); ---Annual targets for irk1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),248, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),206, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),248, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),248, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),20, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),28, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),58, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),192, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),224, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),210, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),214, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),214, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),200, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),190, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),190, '2014-03-26', '2015-03-25'); ---Annual targets for kana1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),220, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),220, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),220, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),220, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),62, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),42, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),86, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),207, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),207, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),207, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),207, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),207, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),207, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),207, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),207, '2014-03-26', '2015-03-25'); ---Annual targets for kana2 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),150, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),134, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),144, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),144, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),21, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),22, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),58, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),130, '2014-03-26', '2015-03-25'); ---Annual targets for kana3 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),120, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),95, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),120, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),120, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),25, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),25, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),50, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),108, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),108, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),108, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),108, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),108, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),108, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),108, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),108, '2014-03-26', '2015-03-25'); ---Annual targets for karat1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),473, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),450, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),349, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),281, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),70, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),70, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),170, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),170, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),170, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),170, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),170, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),170, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),170, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),170, '2014-03-26', '2015-03-25'); ---Annual targets for kara2 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),25, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),42, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),84, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),185, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),185, '2014-03-26', '2015-03-25'); ---Annual targets for srir1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),118, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),130, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),96, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),22, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),20, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),54, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),110, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),110, '2014-03-26', '2015-03-25'); ---Annual targets for sri2 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),156, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),156, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),156, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),156, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),10, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),15, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),60, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),133, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),133, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),133, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),133, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),133, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),133, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),133, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),133, '2014-03-26', '2015-03-25'); ---Annual targets for ane1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),59, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),59, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),59, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),59, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),19, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),19, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),29, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),54, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),54, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),54, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),54, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),54, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),54, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),56, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),56, '2014-03-26', '2015-03-25'); ---Annual targets for budg1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),45, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),55, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),55, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),230, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),230, '2014-03-26', '2015-03-25'); ---Annual targets for mul1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),203, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),203, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),203, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),203, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),52, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),41, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),81, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),173, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),173, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),173, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),173, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),173, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),173, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),173, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),173, '2014-03-26', '2015-03-25'); ---Annual targets for mush1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),192, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),192, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),192, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),192, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),29, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),38, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),78, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),174, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),174, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),174, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),174, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),174, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),174, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),174, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),174, '2014-03-26', '2015-03-25'); ---Annual targets for mush2 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),150, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),150, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),150, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),120, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),28, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),26, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),57, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),139, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),139, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),139, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),139, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),139, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),139, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),139, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),139, '2014-03-26', '2015-03-25'); ---Annual targets for nava1 -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'),168, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC_LT_12'),145, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'),13, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'),32, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),68, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT1'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT2'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PENT3'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV3'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),158, '2014-03-26', '2015-03-25'); -INSERT INTO anm_report.annual_target (anmidentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV_BOOSTER'),158, '2014-03-26', '2015-03-25'); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_23__Adding_Ten_More_User_Data_For_Last_Batch_Training.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_23__Adding_Ten_More_User_Data_For_Last_Batch_Training.sql deleted file mode 100755 index fc3cd9e995..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_23__Adding_Ten_More_User_Data_For_Last_Batch_Training.sql +++ /dev/null @@ -1,29 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer11'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer12'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer13'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer14'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer15'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user41'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user42'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user43'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user44'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user45'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user46'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user47'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user48'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user49'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user50'); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_24__Adding_Duplicate_User_For_The_ANM.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_24__Adding_Duplicate_User_For_The_ANM.sql deleted file mode 100755 index d328fb5c59..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_24__Adding_Duplicate_User_For_The_ANM.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) SELECT 'muslim3' WHERE NOT EXISTS (SELECT dim_anm FROM anm_report.dim_anm WHERE anmIdentifier='muslim3'); - diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_2__Adding_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_2__Adding_ANMs.sql deleted file mode 100755 index de7ad9adae..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_2__Adding_ANMs.sql +++ /dev/null @@ -1,10 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('bhe1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('bhe2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('bhe3'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('bhe4'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('bhe5'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('klp1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('klp2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('klp3'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('klp4'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_3__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_3__Adding_Indicators.sql deleted file mode 100755 index 8ea761d52b..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_3__Adding_Indicators.sql +++ /dev/null @@ -1,67 +0,0 @@ -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('DPT'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('DPT_BOOSTER_2'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('HEP'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('OPV'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MEASLES'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('BCG'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('ANC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('ANC<12'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('LIVE_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('STILL_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('OCP'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IUD'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MALE_STERILIZATION'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('FEMALE_STERILIZATION'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('CONDOM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('DMPA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('FP_TRADITIONAL'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('LAM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('SUB_TT'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('TT1'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('TT2'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('TTB'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('LBW'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MTP<12'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MTP>12'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('SPONTANEOUS_ABORTION'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('DELIVERY'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('INSTITUTIONAL_DELIVERY'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('BF_POST_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('WEIGHED_AT_BIRTH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('ENM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('LNM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('UFM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MMA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MMD'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MMP'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('VIT_A_1'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('VIT_A_2'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('ANC4'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('PNC3'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('D_HOM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('D_SC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('D_PHC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('D_CHC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('D_SDH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('D_DH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('D_PRI'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('DPT3_OPV3'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('DPTB_OPVB'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('PENT1'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('PENT2'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('PENT3'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('MMR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('JE'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('OCP_ST'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('OCP_SC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('OCP_C_OTHERS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('FS_APL'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('FS_BPL'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('CESAREAN'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('CESAREAN_GOV'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('CESAREAN_PRI'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('INFANT_REG'); - diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_4__Adding_AnnualTargets_For_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_4__Adding_AnnualTargets_For_ANMs.sql deleted file mode 100755 index 6539b64602..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_4__Adding_AnnualTargets_For_ANMs.sql +++ /dev/null @@ -1,99 +0,0 @@ -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 12, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 12, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 7, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 11, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 10, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 16, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 11, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 17, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 17, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 37, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 35, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 28, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 72, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 39, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 48, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 94, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 126, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 63, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 48, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 58, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 2, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 52, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 38, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 78, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 61, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 90, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 40, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 72, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 4, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 52, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 38, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 72, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 39, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 48, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 94, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 126, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 63, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 53, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 33, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 56, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 41, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 80, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 93, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 57, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 53, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 33, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 56, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 41, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 80, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 93, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 57, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 58, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 59, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 49, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 37, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 68, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 84, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 45, '2012-03-26', '2013-03-25'); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_5__Adding_Annual_Targets_For_Test_User.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_5__Adding_Annual_Targets_For_Test_User.sql deleted file mode 100755 index 992dfdb753..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_5__Adding_Annual_Targets_For_Test_User.sql +++ /dev/null @@ -1,157 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('c'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('demo1'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('demo2'); -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('demo3'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='c'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='demo3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_6__Adding_User_Data_For_Training.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_6__Adding_User_Data_For_Training.sql deleted file mode 100755 index 78568006e4..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_6__Adding_User_Data_For_Training.sql +++ /dev/null @@ -1,23 +0,0 @@ -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer1'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('trainer2'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user1'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user2'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user3'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user4'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user5'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user6'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user7'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user8'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user9'); - -INSERT INTO anm_report.dim_anm (anmIdentifier) VALUES ('user10'); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_7__Adding_Annual_Targets_For_Training.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_7__Adding_Annual_Targets_For_Training.sql deleted file mode 100755 index e246e44a28..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_7__Adding_Annual_Targets_For_Training.sql +++ /dev/null @@ -1,167 +0,0 @@ ---Annual targets for 'trainer1' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'trainer2' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='trainer2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user1' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user1'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user2' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user3' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user3'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user4' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user5' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user5'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user6' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user6'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user7' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user7'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user8' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user8'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user9' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user9'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user10' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='user10'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_8__Adding_Annual_Targets_For_ANMs_For_2013_2014.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_8__Adding_Annual_Targets_For_ANMs_For_2013_2014.sql deleted file mode 100755 index 3a6647e31b..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_8__Adding_Annual_Targets_For_ANMs_For_2013_2014.sql +++ /dev/null @@ -1,27 +0,0 @@ ---Annual targets for 'bhe2' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'bhe4' -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='OCP'), 15, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='IUD'), 15, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 23, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 23, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC'), 62, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC<12'), 50, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='ANC4'), 62, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='SUB_TT'), 62, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='BCG'), 56, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT3_OPV3'), 56, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='MEASLES'), 56, '2013-03-26', '2014-03-25'); -INSERT INTO anm_report.annual_target (anmIdentifier, indicator, target, start_date, end_date) VALUES ((SELECT ID FROM anm_report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM anm_report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 56, '2013-03-26', '2014-03-25'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_9__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_9__Adding_Indicators.sql deleted file mode 100755 index 90a9049e0d..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/anmReport/V1_0_9__Adding_Indicators.sql +++ /dev/null @@ -1,78 +0,0 @@ -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('CHILD_DIARRHEA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('F_VIT_A_1'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('F_VIT_A_2'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('M_VIT_A_1'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('M_VIT_A_2'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('CMD'); -UPDATE anm_report.dim_indicator SET indicator = 'PENTAVALENT3_OPV3' where indicator = 'DPT3_OPV3'; -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('F_VIT_A_5'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('F_VIT_A_9'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('M_VIT_A_5'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('M_VIT_A_9'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('F_VIT_A'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('M_VIT_A'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('INFANT_LEFT'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('CONDOM_QTY'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IBT'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IB_OH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IB_1Y'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ANC3'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_JSY_REG'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_SBA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_NON_SBA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_HB_LEVEL'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_PNC24'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_SC_DEL'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_48HRS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_PNC_V_2D'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_PNC_V_14D'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_IUDREM'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_OCP_STRIPS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IB_OA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IB<1Y'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IB<5Y'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('IB_BAL'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_CENTCHROMAN_PILLS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ECP'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_M_S_COMP'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_F_S_COMP'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_S_COMP'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('ANCS_AND_PNCS_WITH_BPL'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_M_S_FAILURE'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_F_S_FAILURE'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_S_FAILURE'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_M_S_DEATH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_F_S_DEATH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_S_DEATH'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MEASLES'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_DIARRHEA_DEHYDRATION'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MALARIA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_24HRS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_SEPSIS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_ASPHYXIA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_LBW'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_PNEUMONIA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_DIARRHEA'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_FEVER_RELATED'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_MEASLES'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ID_OTHERS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_BCG_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_PENT_1_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_PENT_2_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_PENT_3_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_OPV_0_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_OPV_1_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_OPV_2_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_OPV_3_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_HEPB_0_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MEASLES_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MD_ABORTION'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MD_LABOR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MD_FITS'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MD_BLEEDING'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MD_H_FEVER'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MD_OTHER'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_MEASLES_BOOSTER_1YR'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_M_ALL_VAC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_F_ALL_VAC'); -INSERT INTO anm_report.dim_indicator (indicator) VALUES ('NRHM_ALL_VAC'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_10__Adding_User_Data_For_Training.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_10__Adding_User_Data_For_Training.sql deleted file mode 100755 index 3038137c16..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_10__Adding_User_Data_For_Training.sql +++ /dev/null @@ -1,83 +0,0 @@ ---trainer1 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('trainer1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer1'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---trainer2 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('trainer2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer2'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user1 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user1'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user2 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user2'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user3 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user3'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user4 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user4', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user4'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user5 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user5', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user5'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user6 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user6', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user6'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user7 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user7', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user7'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user8 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user8', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user8'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user9 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user9', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user9'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user10 -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('user10', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user10'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_11__Adding_Annual_Targets_For_Training.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_11__Adding_Annual_Targets_For_Training.sql deleted file mode 100755 index 4603c2037e..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_11__Adding_Annual_Targets_For_Training.sql +++ /dev/null @@ -1,167 +0,0 @@ ---Annual targets for 'trainer1' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'trainer2' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='trainer2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user1' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user2' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user3' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user4' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user4'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user5' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user5'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user6' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user6'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user7' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user7'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user8' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user8'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user9' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user9'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'user10' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='user10'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_12__Adding_Annual_Targets_For_ANMs_For_2013_2014.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_12__Adding_Annual_Targets_For_ANMs_For_2013_2014.sql deleted file mode 100755 index a2c6da94ce..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_12__Adding_Annual_Targets_For_ANMs_For_2013_2014.sql +++ /dev/null @@ -1,27 +0,0 @@ ---Annual targets for 'bhe2' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 24, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 70, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 63, '2013-03-26', '2014-03-25'); - ---Annual targets for 'bhe4' -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 15, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 15, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 23, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 23, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 62, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 50, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 62, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 62, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 56, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 56, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 56, '2013-03-26', '2014-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 56, '2013-03-26', '2014-03-25'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_13__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_13__Adding_Indicators.sql deleted file mode 100755 index c4d7929deb..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_13__Adding_Indicators.sql +++ /dev/null @@ -1,83 +0,0 @@ -INSERT INTO report.dim_indicator (indicator) VALUES ('CHILD_DIARRHEA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('F_VIT_A_1'); -INSERT INTO report.dim_indicator (indicator) VALUES ('F_VIT_A_2'); -INSERT INTO report.dim_indicator (indicator) VALUES ('M_VIT_A_1'); -INSERT INTO report.dim_indicator (indicator) VALUES ('M_VIT_A_2'); -INSERT INTO report.dim_indicator (indicator) VALUES ('CMD'); -UPDATE report.dim_indicator SET indicator = 'PENTAVALENT3_OPV3' where indicator = 'DPT3_OPV3'; -INSERT INTO report.dim_indicator (indicator) VALUES ('F_VIT_A_5'); -INSERT INTO report.dim_indicator (indicator) VALUES ('F_VIT_A_9'); -INSERT INTO report.dim_indicator (indicator) VALUES ('M_VIT_A_5'); -INSERT INTO report.dim_indicator (indicator) VALUES ('M_VIT_A_9'); -INSERT INTO report.dim_indicator (indicator) VALUES ('F_VIT_A'); -INSERT INTO report.dim_indicator (indicator) VALUES ('M_VIT_A'); -INSERT INTO report.dim_indicator (indicator) VALUES ('INFANT_LEFT'); -INSERT INTO report.dim_indicator (indicator) VALUES ('CONDOM_QTY'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IBT'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IB_OH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IB_1Y'); -INSERT INTO report.dim_indicator (indicator) VALUES ('PENT1'); -INSERT INTO report.dim_indicator (indicator) VALUES ('PENT2'); -INSERT INTO report.dim_indicator (indicator) VALUES ('PENT3'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MMR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('JE'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ANC3'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_JSY_REG'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_SBA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_NON_SBA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_HB_LEVEL'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_PNC24'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_SC_DEL'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_48HRS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_PNC_V_2D'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_PNC_V_14D'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_IUDREM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_OCP_STRIPS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IB_OA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IB<1Y'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IB<5Y'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IB_BAL'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_CENTCHROMAN_PILLS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ECP'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_M_S_COMP'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_F_S_COMP'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_S_COMP'); -INSERT INTO report.dim_indicator (indicator) VALUES ('ANCS_AND_PNCS_WITH_BPL'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_M_S_FAILURE'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_F_S_FAILURE'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_S_FAILURE'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_M_S_DEATH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_F_S_DEATH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_S_DEATH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MEASLES'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_DIARRHEA_DEHYDRATION'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MALARIA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_24HRS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_SEPSIS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_ASPHYXIA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_LBW'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_PNEUMONIA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_DIARRHEA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_FEVER_RELATED'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_MEASLES'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ID_OTHERS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_BCG_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_PENT_1_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_PENT_2_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_PENT_3_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_OPV_0_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_OPV_1_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_OPV_2_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_OPV_3_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_HEPB_0_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MEASLES_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MD_ABORTION'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MD_LABOR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MD_FITS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MD_BLEEDING'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MD_H_FEVER'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MD_OTHER'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MEASLES_BOOSTER_1YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_M_ALL_VAC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_F_ALL_VAC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ALL_VAC'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_14__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_14__Adding_Indicators.sql deleted file mode 100755 index 1b52cf0cae..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_14__Adding_Indicators.sql +++ /dev/null @@ -1,20 +0,0 @@ -INSERT INTO report.dim_indicator (indicator) VALUES ('M_LIVE_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('F_LIVE_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_IFA_100'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_IMMUNIZATION_DEATH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_VIT_A_5_3YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_VIT_A_9_3YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_DPTBOOSTER_2_5YR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_HYPERTENSION'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_MMR'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_DPT'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_OPV'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_M_ALL_VACC_2Y'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_F_ALL_VACC_2Y'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ALL_VACC_2Y'); -INSERT INTO report.dim_indicator (indicator) VALUES ('ANC_GT_12'); -UPDATE report.dim_indicator SET indicator = 'IB_LT_1Y' where indicator = 'IB<1Y'; -UPDATE report.dim_indicator SET indicator = 'IB_LT_5Y' where indicator = 'IB<5Y'; -UPDATE report.dim_indicator SET indicator = 'ANC_LT_12' where indicator = 'ANC<12'; -UPDATE report.dim_indicator SET indicator = 'MTP_LT_12' where indicator = 'MTP<12'; -UPDATE report.dim_indicator SET indicator = 'MTP_GT_12' where indicator = 'MTP>12'; \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_15__Migrating_Date_Service_Provided_Table.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_15__Migrating_Date_Service_Provided_Table.sql deleted file mode 100755 index c37d08bca3..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_15__Migrating_Date_Service_Provided_Table.sql +++ /dev/null @@ -1,29 +0,0 @@ -ALTER TABLE report.service_provided DROP COLUMN IF EXISTS new_date_; -ALTER TABLE report.service_provided ADD COLUMN new_date_ DATE; - -DROP FUNCTION IF EXISTS merge_date_in_service_provided(); - -CREATE FUNCTION merge_date_in_service_provided() -RETURNS BOOLEAN AS $THIS$ -DECLARE - v_date DATE; - service_provided_row report.service_provided%ROWTYPE; -BEGIN - FOR service_provided_row IN SELECT * FROM report.service_provided LOOP - SELECT date_ INTO v_date FROM report.dim_date WHERE id = service_provided_row.date_; - EXECUTE 'UPDATE report.service_provided SET new_date_ = ''' || v_date || ''' where id = ' || service_provided_row.id; - END LOOP; - RETURN TRUE; -EXCEPTION - WHEN OTHERS THEN - RAISE NOTICE 'Exception: %', SQLERRM; - RETURN FALSE; -END; -$THIS$LANGUAGE plpgsql; - -SELECT * FROM merge_date_in_service_provided(); - -ALTER TABLE report.service_provided DROP CONSTRAINT FK_SP_DD_ID; -ALTER TABLE report.service_provided RENAME COLUMN date_ TO old_date_; -ALTER TABLE report.service_provided ALTER COLUMN old_date_ DROP NOT NULL; ; -ALTER TABLE report.service_provided RENAME COLUMN new_date_ TO date_; diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_16__Creating_View_for_Reporting.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_16__Creating_View_for_Reporting.sql deleted file mode 100755 index a09c5a35a7..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_16__Creating_View_for_Reporting.sql +++ /dev/null @@ -1,31 +0,0 @@ -DROP VIEW IF EXISTS report.service_provided_report_view; -CREATE VIEW report.service_provided_report_view -AS -(SELECT - a.id AS "id", - g.anmIdentifier AS "anmidentifier", - f.type "service_provided_type", - c.indicator AS "indicator", - a.date_ AS "service_date", - e.village AS "village", - e.subcenter AS "subcenter", - h.phcidentifier AS "phc", - e.taluka AS "taluka", - e.district AS "district", - e.state AS "state" -FROM - report.service_provided a, - report.dim_service_provider b, - report.dim_indicator c, - report.dim_location e, - report.dim_service_provider_type f, - report.dim_anm g, - report.dim_phc h -WHERE - a.service_provider=b.id AND - a.indicator=c.id AND - a.location=e.id AND - b.type=f.id AND - b.service_provider=g.id AND - e.phc=h.id -); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_17__Creating_Token_Table.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_17__Creating_Token_Table.sql deleted file mode 100755 index 75cd6287a0..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_17__Creating_Token_Table.sql +++ /dev/null @@ -1,3 +0,0 @@ -CREATE TABLE report.token (ID SERIAL, name VARCHAR NOT NULL, value VARCHAR NOT NULL, - CONSTRAINT pk_token PRIMARY KEY (ID), - CONSTRAINT U_TOKEN_NAME UNIQUE (name)); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_18__Adding_Sub_Center_Column_To_ANM_Table.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_18__Adding_Sub_Center_Column_To_ANM_Table.sql deleted file mode 100755 index 036f060e05..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_18__Adding_Sub_Center_Column_To_ANM_Table.sql +++ /dev/null @@ -1,21 +0,0 @@ -ALTER TABLE report.dim_anm ADD COLUMN subcenter VARCHAR(100); - -UPDATE report.dim_anm SET subcenter='bherya_a' WHERE anmidentifier='bhe1'; - -UPDATE report.dim_anm SET subcenter='bherya_b' WHERE anmidentifier='bhe2'; - -UPDATE report.dim_anm SET subcenter='g_a_guppe' WHERE anmidentifier='bhe3'; - -UPDATE report.dim_anm SET subcenter='hosa_agrahara' WHERE anmidentifier='bhe4'; - -UPDATE report.dim_anm SET subcenter='munjanahalli' WHERE anmidentifier='bhe5'; - -UPDATE report.dim_anm SET subcenter='keelanapura_a' WHERE anmidentifier='klp4'; - -UPDATE report.dim_anm SET subcenter='keelanapura_b' WHERE anmidentifier='klp2'; - -UPDATE report.dim_anm SET subcenter='puttegowdanahundi' WHERE anmidentifier='klp1'; - -UPDATE report.dim_anm SET subcenter='vajamangala' WHERE anmidentifier='klp3'; - -UPDATE report.dim_anm SET subcenter='munjanahalli' WHERE subcenter IS NULL; \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_19__Adding_Name_Column_To_ANM_Table.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_19__Adding_Name_Column_To_ANM_Table.sql deleted file mode 100755 index 9bf73af3af..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_19__Adding_Name_Column_To_ANM_Table.sql +++ /dev/null @@ -1,51 +0,0 @@ -ALTER TABLE report.dim_anm ADD COLUMN name varchar(100); - -UPDATE report.dim_anm SET name='Elizebeth D''souza' WHERE anmidentifier='bhe1'; - -UPDATE report.dim_anm SET name='Jyothilakshmi' WHERE anmidentifier='bhe2'; - -UPDATE report.dim_anm SET name='Jayanthi' WHERE anmidentifier='bhe3'; - -UPDATE report.dim_anm SET name='Hemalatha' WHERE anmidentifier='bhe4'; - -UPDATE report.dim_anm SET name='Latha' WHERE anmidentifier='bhe5'; - -UPDATE report.dim_anm SET name='Hemavathi' WHERE anmidentifier='klp4'; - -UPDATE report.dim_anm SET name='N.R. Kamalakshi' WHERE anmidentifier='klp2'; - -UPDATE report.dim_anm SET name='Dhakshakanya' WHERE anmidentifier='klp1'; - -UPDATE report.dim_anm SET name='B.T. Indira' WHERE anmidentifier='klp3'; - -UPDATE report.dim_anm SET name='C' WHERE anmidentifier='c'; - -UPDATE report.dim_anm SET name='Demo1' WHERE anmidentifier='demo1'; - -UPDATE report.dim_anm SET name='Demo2' WHERE anmidentifier='demo2'; - -UPDATE report.dim_anm SET name='Demo3' WHERE anmidentifier='demo3'; - -UPDATE report.dim_anm SET name='Trainer1' WHERE anmidentifier='trainer1'; - -UPDATE report.dim_anm SET name='Trainer2' WHERE anmidentifier='trainer2'; - -UPDATE report.dim_anm SET name='User1' WHERE anmidentifier='user1'; - -UPDATE report.dim_anm SET name='User2' WHERE anmidentifier='user2'; - -UPDATE report.dim_anm SET name='User3' WHERE anmidentifier='user3'; - -UPDATE report.dim_anm SET name='User4' WHERE anmidentifier='user4'; - -UPDATE report.dim_anm SET name='User5' WHERE anmidentifier='user5'; - -UPDATE report.dim_anm SET name='User6' WHERE anmidentifier='user6'; - -UPDATE report.dim_anm SET name='User7' WHERE anmidentifier='user7'; - -UPDATE report.dim_anm SET name='User8' WHERE anmidentifier='user8'; - -UPDATE report.dim_anm SET name='User9' WHERE anmidentifier='user9'; - -UPDATE report.dim_anm SET name='User10' WHERE anmidentifier='user10'; \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_1__Initial_Setup.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_1__Initial_Setup.sql deleted file mode 100755 index d1cd5de84c..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_1__Initial_Setup.sql +++ /dev/null @@ -1,45 +0,0 @@ -CREATE TABLE report.dim_phc (ID SERIAL, phcIdentifier VARCHAR NOT NULL, name VARCHAR NOT NULL, - CONSTRAINT pk_dim_phc PRIMARY KEY (ID), - CONSTRAINT U_DP_PI UNIQUE (phcIdentifier)); - -CREATE TABLE report.dim_anm (ID SERIAL, anmIdentifier VARCHAR NOT NULL, phc INTEGER NOT NULL, - CONSTRAINT pk_dim_anm PRIMARY KEY (ID), - CONSTRAINT FK_DA_DP_ID FOREIGN KEY (phc) REFERENCES report.dim_phc (ID), - CONSTRAINT U_DA_AN UNIQUE (anmIdentifier)); - -CREATE TABLE report.dim_indicator (ID SERIAL, indicator VARCHAR NOT NULL, - CONSTRAINT pk_dim_indicator PRIMARY KEY (ID), - CONSTRAINT U_DI_IN UNIQUE (indicator)); - -CREATE TABLE report.dim_date (ID SERIAL, date_ DATE NOT NULL, - CONSTRAINT pk_dim_date PRIMARY KEY (ID), - CONSTRAINT U_DD_DT UNIQUE (date_)); - -CREATE TABLE report.dim_location (ID SERIAL, village VARCHAR NOT NULL, subCenter VARCHAR NOT NULL, phc INTEGER NOT NULL, taluka VARCHAR NOT NULL, district VARCHAR NOT NULL, state VARCHAR NOT NULL, - CONSTRAINT pk_dim_location PRIMARY KEY (ID), - CONSTRAINT FK_DL_DP_ID FOREIGN KEY (phc) REFERENCES report.dim_phc (ID), - CONSTRAINT U_DL_VI_SU_PH UNIQUE (village, subCenter, phc), - CONSTRAINT U_DL_VI_SU_PH_TK_DT_ST UNIQUE (village, subCenter, phc, taluka, district, state)); - -CREATE TABLE report.dim_service_provider_type (ID SERIAL, type VARCHAR NOT NULL, - CONSTRAINT pk_dim_service_provider_type PRIMARY KEY (ID), - CONSTRAINT U_DSPT_TY UNIQUE (type), - CONSTRAINT CK_SPT CHECK (type = 'ANM' OR type = 'PHC')); - -CREATE TABLE report.dim_service_provider (ID SERIAL, service_provider INTEGER NOT NULL, type INTEGER NOT NULL, - CONSTRAINT pk_dim_service_provider PRIMARY KEY (ID), - CONSTRAINT FK_DSP_DST_ID FOREIGN KEY (type) REFERENCES report.dim_service_provider_type (ID), - CONSTRAINT U_SP_TY UNIQUE (service_provider, type)); - -CREATE TABLE report.annual_target (ID SERIAL, service_provider INTEGER NOT NULL, indicator INTEGER NOT NULL, target VARCHAR NOT NULL, start_date DATE NOT NULL, end_date DATE NOT NULL, - CONSTRAINT pk_annual_target PRIMARY KEY (ID), - CONSTRAINT FK_AT_DSP_ID FOREIGN KEY (service_provider) REFERENCES report.dim_service_provider (ID), - CONSTRAINT FK_AT_DI_ID FOREIGN KEY (indicator) REFERENCES report.dim_indicator (ID), - CONSTRAINT U_AT_SP_IN_TA_SD_ED UNIQUE (service_provider, indicator, start_date, end_date)); - -CREATE TABLE report.service_provided (ID SERIAL, service_provider INTEGER NOT NULL, externalId VARCHAR NOT NULL, indicator INTEGER NOT NULL, date_ INTEGER NOT NULL, location INTEGER NOT NULL, - CONSTRAINT pk_service_provided PRIMARY KEY (ID), - CONSTRAINT FK_SP_DSP_ID FOREIGN KEY (service_provider) REFERENCES report.dim_service_provider (ID), - CONSTRAINT FK_SP_DI_ID FOREIGN KEY (indicator) REFERENCES report.dim_indicator (ID), - CONSTRAINT FK_SP_DD_ID FOREIGN KEY (date_) REFERENCES report.dim_date (ID), - CONSTRAINT FK_SP_DL_ID FOREIGN KEY (location) REFERENCES report.dim_location (ID)); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_20__Adding_Missing_Training_Users.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_20__Adding_Missing_Training_Users.sql deleted file mode 100755 index 5bab2ac6ef..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_20__Adding_Missing_Training_Users.sql +++ /dev/null @@ -1,13 +0,0 @@ ---suresh -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) VALUES ('suresh', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Suresh', 'munjanahalli'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='suresh'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---nirmala -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) VALUES ('nirmala', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Nirmala', 'munjanahalli'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='nirmala'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_21__Removing_Dim_Date.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_21__Removing_Dim_Date.sql deleted file mode 100755 index b91124ffee..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_21__Removing_Dim_Date.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP TABLE IF EXISTS report.dim_date; -ALTER TABLE report.service_provided DROP COLUMN old_date_ RESTRICT; \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_22__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_22__Adding_Indicators.sql deleted file mode 100755 index d41825fde0..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_22__Adding_Indicators.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_LIVE_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_STILL_BIRTH'); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_23__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_23__Adding_Indicators.sql deleted file mode 100755 index 8a0fc4d916..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_23__Adding_Indicators.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO report.dim_indicator (indicator) VALUES ('OPV3'); -INSERT INTO report.dim_indicator (indicator) VALUES ('OPV_BOOSTER'); -INSERT INTO report.dim_indicator (indicator) VALUES ('DPT_BOOSTER_1'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_24__Adding_User_Data.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_24__Adding_User_Data.sql deleted file mode 100755 index a5e9c26ae5..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_24__Adding_User_Data.sql +++ /dev/null @@ -1,15 +0,0 @@ -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'demo4', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Demo4', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='demo4'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'demo5', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Demo5', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='demo5'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'demo6', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Demo6', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='demo6'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'demo7', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Demo7', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='demo7'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'demo8', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Demo8', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='demo8'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'demo9', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Demo9', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='demo9'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'demo10', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Demo10', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='demo10'); - -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo4'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo4')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo5'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo5')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo6'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo6')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo7'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo7')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo8'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo8')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo9'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo9')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo10'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo10')); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_25__Adding_User_And_Location.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_25__Adding_User_And_Location.sql deleted file mode 100755 index 8dc0fcc38c..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_25__Adding_User_And_Location.sql +++ /dev/null @@ -1,409 +0,0 @@ -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('chc_heresindogi', 'CHC Heresindogi'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('chc_kanakageri', 'CHC Kanakageri'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('chc_karatagi', 'CHC Karatagi'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('chc_mangalore', 'CHC Mangalore'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('chc_sriramnagar', 'CHC Sriramnagar'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('chc_tawargera', 'CHC Tawargera'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_alwandi', 'PHC Alwandi'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_anegundi', 'PHC Anegundi'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_bandihal', 'PHC Bandihal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_benakal', 'PHC Benakal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_betagera', 'PHC Betagera'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_bhagyanagar', 'PHC Bhagyanagar'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_budgumpa', 'PHC Budgumpa'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_chalgera', 'PHC Chalgera'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_dotihal', 'PHC Dotihal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_gandhal', 'PHC Gandhal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hanamsagar', 'PHC Hanamsagar'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hanmanhal', 'PHC Hanmanhal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hirebommanhal', 'PHC Hirebommanhal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hiregonnagar', 'PHC Hiregonnagar'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hiremannapur', 'PHC Hiremannapur'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hitnal', 'PHC Hitnal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hosakera', 'PHC Hosakera'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_hulgera', 'PHC Hulgera'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_irkalgada', 'PHC Irkalgada'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_mudenoor', 'PHC Mudenoor'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_mudhol', 'PHC Mudhol'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_mushtur', 'PHC Mushtur'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_muslimpur', 'PHC muslimpur'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_navali', 'PHC Navali'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_sanganhal', 'PHC Sanganhal'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('phc_vajra_bandi', 'PHC Vajra Bandi'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'hulihydar', 'hanmanhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'hulihydar', 'hosgudda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'hulihydar', 'hulihyder'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'hulihydar', 'kanakapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'hulihydar', 'layadhunsi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'hulihydar', 'varankhed'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_a', 'anganwadi_1'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_a', 'anganwadi_15'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_a', 'anganwadi_17'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_a', 'anganwadi_2'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_a', 'anganwadi_3'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_a', 'anganwadi_7'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_a', 'anganwadi_9'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_b', 'anganwadi_11'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_b', 'anganwadi_12'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_b', 'anganwadi_14'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_b', 'anganwadi_16'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_b', 'anganwadi_18'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_b', 'anganwadi_19'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'kanakageri_b', 'anganwadi_5'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'karatagi_b', 'hale_juratgi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'karatagi_b', 'hosa_juratagi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'karatagi_b', 'karatagi_b'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'karatagi_b', 'ramnagar'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'salunchmara', 'hulkihal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'salunchmara', 'mari_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'salunchmara', 'marlanahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'salunchmara', 'salunchimara'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'sriramnagar_a', 'guntakal_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'sriramnagar_a', 'modal_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'sriramnagar_a', 'sriramnagar_a'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'sriramnagar_b', 'anjuri_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'sriramnagar_b', 'dangeri_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'sriramnagar_b', 'renuka_coliny'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'sriramnagar_b', 'sriramnagar_b'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_anegundi'), 'basvandurg', 'basvandurg'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_anegundi'), 'basvandurg', 'krishnapuradiggi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_anegundi'), 'basvandurg', 'kurihatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_anegundi'), 'basvandurg', 'ramdurg'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_anegundi'), 'basvandurg', 'ramdurg_camp'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'budgumpa', 'budgumpa'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'budgumpa', 'devicamp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'budgumpa', 'halasamudra'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'budgumpa', 'lakshmi_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'budgumpa', 'rajeev_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'budgumpa', 'shesagiri_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'budgumpa', 'timmapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hosakera'), 'heroor', 'b_r_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hosakera'), 'heroor', 'batterhanchnal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hosakera'), 'heroor', 'galemmacamp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hosakera'), 'heroor', 'gonal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hosakera'), 'heroor', 'herur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'chikka_jantkal', 'chikka_jantkal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'chikka_jantkal', 'hosahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'chikka_jantkal', 'nagarhalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'chikka_jantkal', 'vinoob_nagar'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'danapur', 'danapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'danapur', 'hebbal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'danapur', 'majjigi_camp'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'basarihal', 'bailakampur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'basarihal', 'basrihal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'basarihal', 'chikka_wadderkal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'basarihal', 'devlapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'basarihal', 'gouripur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'obalbanda', 'hulejali'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'obalbanda', 'kannermadu'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'obalbanda', 'naglapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'obalbanda', 'obalbanda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'obalbanda', 'ramdurg'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'obalbanda', 'rampur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'somsagara', 'a_b_chiktanda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'somsagara', 'a_b_doddatanda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'somsagara', 'advibhavi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'somsagara', 'somsagara'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_navali'), 'jeeral', 'chikka_dankankal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_navali'), 'jeeral', 'gandhi_nagar'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_navali'), 'jeeral', 'jeeral'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_navali'), 'jeeral', 'kalgudi_camp'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_navali'), 'jeeral', 'new_kalgudi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Gangavati', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_navali'), 'jeeral', 'old_kalgudi'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'bahaddurbandi', 'bahaddurbandi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'bahaddurbandi', 'belavinala'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'bahaddurbandi', 'chukankal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'bahaddurbandi', 'hosahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'bahaddurbandi', 'huvinhal'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'gondabal', 'hyati'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'gondabal', 'muddaballi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'gondabal', 'new_gondabal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'gondabal', 'old_gondabal'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_alwandi'), 'mainahalli', 'bikanhalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_alwandi'), 'mainahalli', 'handral'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_alwandi'), 'mainahalli', 'hanwal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_alwandi'), 'mainahalli', 'mainahalli'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_betagera'), 'katarki', 'adaramaggi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_betagera'), 'katarki', 'belur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_betagera'), 'katarki', 'gudlanuru'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_betagera'), 'katarki', 'katarki'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bhagyanagar'), 'bhagyanagar', 'bhagyanagar'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bhagyanagar'), 'bhagyanagar', 'ojanhalli'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'achartimmapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'challari'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'chikbommanhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'chiksulikeri'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'ganganhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'hirebommanhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'hiresulikeri'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'uplapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'arsinkera'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'arsinkera_thanda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'chamalapura'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'chilkmukki'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'gosaldoddi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'hasgal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'hosur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'jinnapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'jinnapur_chickthanda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'jinnapur_thanda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'metgal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'sidaganhalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'hasgal', 'venktapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'agalkera', 'agalkera'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'bandi_harlapur', 'hosabandiharlapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'bandi_harlapur', 'kouli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'bandi_harlapur', 'mohammad_nagar'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'bandi_harlapur', 'shivapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'hitnal', 'hitnal'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'shivpur', 'kampasagar'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'shivpur', 'old_shivapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_irkalgada'), 'irkalgada', 'hanmanhatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_irkalgada'), 'irkalgada', 'irkalgada'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_irkalgada'), 'irkalgada', 'kodadhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_irkalgada'), 'irkalgada', 'taad_kanakapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_irkalgada'), 'irkalgada', 'wadderhatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_irkalgada'), 'irkalgada', 'yelamgera'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_10'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_13'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_14'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_15'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_2'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_4'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_5'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_6'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_7'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'anganwadi_8'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'tawargera_a', 'gadderatti'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'benkanhal', 'benkanhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'benkanhal', 'kalalbandi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'benkanhal', 'madikera'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'benkanhal', 'yelbunchi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'benkanhal', 'zhoolkatti'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'talugeri', 'kordakera'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'talugeri', 'talugeri'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'talugeri', 'topalkatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'talugeri', 'vanageri'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_dotihal'), 'nidsesi', 'benchamatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_dotihal'), 'nidsesi', 'byalihal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_dotihal'), 'nidsesi', 'madalgatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_dotihal'), 'nidsesi', 'nidsesi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_dotihal'), 'nidsesi', 'shakapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanamsagar'), 'hanamsagar_a', 'beelagi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanamsagar'), 'hanamsagar_a', 'develapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanamsagar'), 'hanamsagar_a', 'hanamsagar_a'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanamsagar'), 'hanamsagar_a', 'mannerhal'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'nilogal', 'basapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'nilogal', 'bommanhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'nilogal', 'nilogal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'nilogal', 'rampur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'nilogal', 'vakkandurga'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'tuggaldoni', 'masbinkurbanhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'tuggaldoni', 'mittalkod'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'tuggaldoni', 'nirlakoppa'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'tuggaldoni', 'shadalgera'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'tuggaldoni', 'tuggaldoni'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiregonnagar'), 'hiregonnagar', 'chickgonnagar'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiregonnagar'), 'hiregonnagar', 'habalkatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiregonnagar'), 'hiregonnagar', 'hiregonnagar'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiregonnagar'), 'hiregonnagar', 'narsapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiregonnagar'), 'hiregonnagar', 'tumrikoppa'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiregonnagar'), 'hiregonnagar', 'varikal'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'gudadur', 'basapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'gudadur', 'gonhal_k'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'gudadur', 'gudadur_m'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'gudadur', 'hosur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'gudadur', 'madapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'gudadur', 'tengunti'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'hiremannapur', 'ganganhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'hiremannapur', 'gumgeri'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'hiremannapur', 'hiremannapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hulgera'), 'katapur', 'kabbargi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hulgera'), 'katapur', 'kalgonhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hulgera'), 'katapur', 'katapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudenoor'), 'muddalgundi', 'amarapur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudenoor'), 'muddalgundi', 'kalmalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudenoor'), 'muddalgundi', 'kidadur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudenoor'), 'muddalgundi', 'muddalgundi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudenoor'), 'muddalgundi', 'muddalgundi_thanda'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'chendoor', 'arkeri'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'chendoor', 'chendoor'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'chendoor', 'muthalu'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'chendoor', 'sirur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'mangalore_a', 'anganwadi_10'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'mangalore_a', 'anganwadi_2'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'mangalore_a', 'anganwadi_4'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'mangalore_a', 'anganwadi_6'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bandihal'), 'bandihal', 'bandihal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bandihal'), 'bandihal', 'tondihal'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bandihal'), 'karmudi', 'karmudi'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_benakal'), 'benakal', 'benakal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_benakal'), 'benakal', 'veerapur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_gandhal'), 'gandhal_a', 'bukkanhatti'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_gandhal'), 'gandhal_a', 'gandhal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_gandhal'), 'gandhal_a', 'hire_waddarkal'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_gandhal'), 'gandhal_a', 'katgihalli'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol'), 'hiremyageri', 'hiremyageri'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol'), 'hiremyageri', 'sompur'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol'), 'mudhol', 'mudhol'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_sanganhal'), 'sanganhal', 'kallur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_sanganhal'), 'sanganhal', 'sanganhal'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_vajra_bandi'), 'hulegudda', 'hulegudda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_vajra_bandi'), 'hulegudda', 'makkahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_vajra_bandi'), 'hulegudda', 'murdi_thanda'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_vajra_bandi'), 'hulegudda', 'salbhavi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_vajra_bandi'), 'hulegudda', 'talur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_vajra_bandi'), 'hulegudda', 'talur_thanda'); - --- ANM DATA -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'kana1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'Manjula', 'hulihydar' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='kana1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'kana2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'K.Santha', 'kanakageri_a' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='kana2'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'kana3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_kanakageri'), 'Jayasree', 'kanakageri_b' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='kana3'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'kara1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'Bhagyalakshmi', 'karatagi_b' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='kara1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'kara2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'Santarayanagoudar', 'salunchmara' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='kara2'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'sri1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'Asha Begum', 'sriramnagar_a' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='sri1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'sri2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'Santhavva', 'sriramnagar_b' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='sri2'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'ane1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_anegundi'), 'Manjula', 'basvandurg' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='ane1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'bud1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'K.N.Bhairamatti', 'budgumpa' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='bud1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'hosa1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hosakera'), 'Mulimani Khadarbi', 'heroor' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='hosa1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'mush1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'Gnaneswari', 'chikka_jantkal' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='mush1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'mush2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mushtur'), 'Kavita', 'danapur' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='mush2'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'musl1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'Kanaakava ( Kamalamma)', 'basarihal' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='musl1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'musl2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'Aswani C', 'obalbanda' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='musl2'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'musl3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'Mahadevakka', 'somsagara' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='musl3'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'nava1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_navali'), 'Mangalabai', 'jeeral' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='nava1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'here1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'Rose Henna', 'bahaddurbandi' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='here1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'here2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_heresindogi'), 'Hasena Begum', 'gondabal' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='here2'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'alw1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_alwandi'), 'Saraswati', 'mainahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='alw1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'bet1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_betagera'), 'Saubhagyamma', 'katarki' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='bet1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'bha1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bhagyanagar'), 'S.V.Mahendrakar', 'bhagyanagar' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='bha1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'hir1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'Siddalingamma', 'chikbommanhal' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='hir1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'hir2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'Manjula', 'hasgal' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='hir2'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'hit1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'Vijayalakshmi', 'agalkera' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='hit1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'hit2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'J. Ambika', 'bandi_harlapur' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='hit2'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'hit3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'K.Bhagyamma', 'hitnal' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='hit3'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'hit4', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hitnal'), 'Devakki Jaylaxmi', 'shivpur' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='hit4'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'irk1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_irkalgada'), 'Karibasamma', 'irkalgada' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='irk1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'taw1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera'), 'Renuka', 'tawargera_a' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='taw1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'cha1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'Sarvamangala', 'benkanhal' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='cha1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'cha2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_chalgera'), 'Renuka.R.', 'talugeri' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='cha2'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'dot1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_dotihal'), 'Renuka.Hubli', 'nidsesi' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='dot1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'han1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanamsagar'), 'Sharanamma Malipatil', 'hanamsagar_a' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='han1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'hanl1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'Rekha Immadi', 'nilogal' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='hanl1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'hanl2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hanmanhal'), 'Mangalagauri Pirangi', 'tuggaldoni' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='hanl2'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'hire1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiregonnagar'), 'Lalitavva', 'hiregonnagar' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='hire1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'hmp1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'Channabasavva', 'gudadur' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='hmp1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'hmp2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hiremannapur'), 'Nurajahan Begum', 'hiremannapur' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='hmp2'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'hul1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hulgera'), 'Yashoda', 'katapur' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='hul1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'mud1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudenoor'), 'Sis. Renuka', 'muddalgundi' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='mud1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'man1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'Kumari Manjula', 'chendoor' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='man1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'man2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore'), 'Geeta', 'mangalore_a' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='man2'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'ban1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bandihal'), 'Manjula.M', 'bandihal' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='ban1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'ban2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_bandihal'), 'Shobhabai', 'karmudi' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='ban2'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'ben1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_benakal'), 'Eramma Ryavanaki', 'benakal' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='ben1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'gan1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_gandhal'), 'Kalavati.S.M', 'gandhal_a' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='gan1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'mul1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol'), 'Hemakshi', 'hiremyageri' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='mul1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'mul2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol'), 'Savitramma', 'mudhol' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='mul2'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'san1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_sanganhal'), 'Shantadevi', 'sanganhal' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='san1'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'vaj1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_vajra_bandi'), 'Rajeshwari', 'hulegudda' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='vaj1'); - -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='kana1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='kana1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='kana2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='kana2')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='kana3'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='kana3')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='kara1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='kara1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='kara2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='kara2')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='sri1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='sri1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='sri2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='sri2')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='ane1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='ane1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='bud1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='bud1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hosa1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='hosa1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='mush1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='mush1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='mush2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='mush2')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='musl1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='musl1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='musl2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='musl2')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='musl3'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='musl3')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='nava1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='nava1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='here1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='here1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='here2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='here2')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='alw1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='alw1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='bet1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='bet1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='bha1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='bha1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hir1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='hir1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hir2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='hir2')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hit1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='hit1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hit2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='hit2')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hit3'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='hit3')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hit4'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='hit4')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='irk1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='irk1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='taw1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='taw1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='cha1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='cha1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='cha2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='cha2')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='dot1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='dot1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='han1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='han1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hanl1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='hanl1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hanl2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='hanl2')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hire1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='hire1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hmp1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='hmp1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hmp2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='hmp2')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='hul1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='hul1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='mud1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='mud1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='man1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='man1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='man2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='man2')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='ban1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='ban1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='ban2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='ban2')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='ben1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='ben1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='gan1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='gan1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='mul1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='mul1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='mul2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='mul2')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='san1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='san1')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='vaj1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='vaj1')); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_26__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_26__Adding_Indicators.sql deleted file mode 100755 index 1047fcf3b7..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_26__Adding_Indicators.sql +++ /dev/null @@ -1,7 +0,0 @@ -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ANC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_ANC_LT_12'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_TT1'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_SUB_TT'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_BF_POST_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_SPONTANEOUS_ABORTION'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NRHM_VIT_A_1'); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_27__Adding_Ten_More_Training_User_Data.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_27__Adding_Ten_More_Training_User_Data.sql deleted file mode 100755 index 1fc4a88ecf..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_27__Adding_Ten_More_Training_User_Data.sql +++ /dev/null @@ -1,90 +0,0 @@ ---trainer3 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('trainer3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer3'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---trainer4 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('trainer4', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer4'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---trainer5 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('trainer5', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer5'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user11 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user11', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user11'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user12 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user12', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user12'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user13 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user13', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user13'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user14 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user14', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user14'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user15 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user15', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user15'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user16 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user16', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user16'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user17 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user17', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user17'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user18 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user18', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user18'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user19 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user19', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user19'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - ---user20 -INSERT INTO report.dim_anm (anmIdentifier, phc, subcenter) VALUES ('user20', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a'); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user20'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_28__Adding_Missing_Village_For_Koppal.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_28__Adding_Missing_Village_For_Koppal.sql deleted file mode 100755 index 1647c0490a..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_28__Adding_Missing_Village_For_Koppal.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) SELECT 'Karnataka', 'Koppal', 'Koppal', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_hirebommanhal'), 'chikbommanhal', 'hiresulikeri_thanda' WHERE NOT EXISTS (SELECT village FROM report.dim_location where village = 'hiresulikeri_thanda'); - diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_29__Updating_Names_For_Users.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_29__Updating_Names_For_Users.sql deleted file mode 100755 index 254e920b70..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_29__Updating_Names_For_Users.sql +++ /dev/null @@ -1,13 +0,0 @@ -UPDATE report.dim_anm SET name = 'User11' WHERE anmIdentifier = 'user11'; -UPDATE report.dim_anm SET name = 'User12' WHERE anmIdentifier = 'user12'; -UPDATE report.dim_anm SET name = 'User13' WHERE anmIdentifier = 'user13'; -UPDATE report.dim_anm SET name = 'User14' WHERE anmIdentifier = 'user14'; -UPDATE report.dim_anm SET name = 'User15' WHERE anmIdentifier = 'user15'; -UPDATE report.dim_anm SET name = 'User16' WHERE anmIdentifier = 'user16'; -UPDATE report.dim_anm SET name = 'User17' WHERE anmIdentifier = 'user17'; -UPDATE report.dim_anm SET name = 'User18' WHERE anmIdentifier = 'user18'; -UPDATE report.dim_anm SET name = 'User19' WHERE anmIdentifier = 'user19'; -UPDATE report.dim_anm SET name = 'User20' WHERE anmIdentifier = 'user20'; -UPDATE report.dim_anm SET name = 'Trainer3' WHERE anmIdentifier = 'trainer3'; -UPDATE report.dim_anm SET name = 'Trainer4' WHERE anmIdentifier = 'trainer4'; -UPDATE report.dim_anm SET name = 'Trainer5' WHERE anmIdentifier = 'trainer5'; \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_2__Adding_Service_Provider_Types.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_2__Adding_Service_Provider_Types.sql deleted file mode 100755 index 8c598c6d84..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_2__Adding_Service_Provider_Types.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO report.dim_service_provider_type (type) VALUES ('ANM'); -INSERT INTO report.dim_service_provider_type (type) VALUES ('PHC'); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_30__Adding_Duplicate_Users_For_The_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_30__Adding_Duplicate_Users_For_The_ANMs.sql deleted file mode 100755 index dfd7aab2b7..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_30__Adding_Duplicate_Users_For_The_ANMs.sql +++ /dev/null @@ -1,11 +0,0 @@ -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'srir1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_sriramnagar'), 'Asha Begum', 'sriramnagar_a' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='srir1'); - -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='srir1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='srir1')); - -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'budg1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_budgumpa'), 'K.N.Bhairamatti', 'budgumpa' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='budg1'); - -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='budg1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='budg1')); - -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'karat1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_karatagi'), 'Bhagyalakshmi', 'karatagi_b' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='karat1'); - -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='karat1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='karat1')); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_31__Adding_EntityId_To_Service_Provided_Table.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_31__Adding_EntityId_To_Service_Provided_Table.sql deleted file mode 100755 index 8f4a7e57dd..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_31__Adding_EntityId_To_Service_Provided_Table.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE report.service_provided ADD COLUMN dristhi_entity_id VARCHAR; \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_32__Adding_Ten_More_User_Data_For_Third_Batch_of_Training.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_32__Adding_Ten_More_User_Data_For_Third_Batch_of_Training.sql deleted file mode 100755 index 0993005b0d..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_32__Adding_Ten_More_User_Data_For_Third_Batch_of_Training.sql +++ /dev/null @@ -1,55 +0,0 @@ -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user21', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User21', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user21'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user22', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User22', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user22'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user23', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User23', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user23'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user24', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User24', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user24'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user25', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User25', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user25'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user26', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User26', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user26'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user27', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User27', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user27'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user28', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User28', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user28'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user29', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User29', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user29'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user30', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User30', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user30'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user31', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User31', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user31'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user32', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User32', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user32'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user33', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User33', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user33'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user34', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User34', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user34'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user35', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User35', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user35'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user36', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User36', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user36'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user37', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User37', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user37'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user38', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User38', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user38'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user39', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User39', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user39'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user40', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User40', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user40'); - -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user21'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user21')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user22'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user22')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user23'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user23')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user24'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user24')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user25'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user25')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user26'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user26')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user27'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user27')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user28'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user28')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user29'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user29')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user30'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user30')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user31'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user31')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user32'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user32')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user33'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user33')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user34'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user34')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user35'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user35')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user36'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user36')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user37'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user37')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user38'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user38')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user39'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user39')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user40'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user40')); - - ---Trainer data -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'trainer6', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer6', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='trainer6'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'trainer7', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer7', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='trainer7'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'trainer8', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer8', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='trainer8'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'trainer9', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer9', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='trainer9'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'trainer10', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer10', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='trainer10'); - -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer6'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer6')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer7'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer7')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer8'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer8')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer9'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer9')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer10'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer10')); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_33__Adding_Missing_Villages_For_Kustagi.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_33__Adding_Missing_Villages_For_Kustagi.sql deleted file mode 100755 index 45a5b7e54c..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_33__Adding_Missing_Villages_For_Kustagi.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) SELECT 'Karnataka', 'Koppal', 'Kustagi', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudenoor'), 'muddalgundi', 'kalmalli_thanda' WHERE NOT EXISTS (SELECT dim_location FROM report.dim_location WHERE state='Karnataka' AND district='Koppal' AND taluka='Kustagi' AND phc=(SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudenoor') AND subCenter='muddalgundi' AND village='kalmalli_thanda'); - diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_34__Adding_Annual_targets_for_Koppal_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_34__Adding_Annual_targets_for_Koppal_ANMs.sql deleted file mode 100755 index 248ce2a30e..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_34__Adding_Annual_targets_for_Koppal_ANMs.sql +++ /dev/null @@ -1,384 +0,0 @@ ---Annual targets for here1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),161, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),161, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),120, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),150, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),46, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),65, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),65, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),147, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),147, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),147, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),147, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),147, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),147, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),147, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),147, '2014-03-26', '2015-03-25'); ---Annual targets for here2 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),205, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),205, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),205, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),205, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),14, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),27, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),124, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='here2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),190, '2014-03-26', '2015-03-25'); ---Annual targets for alw1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),140, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),140, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),140, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),140, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),49, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),62, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),65, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),128, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),128, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),128, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),128, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),128, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),128, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),128, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='alw1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),128, '2014-03-26', '2015-03-25'); ---Annual targets for bet1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),160, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),160, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),160, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),160, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),52, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),58, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),66, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),152, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),152, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),152, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),152, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),152, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),152, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),152, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bet1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),152, '2014-03-26', '2015-03-25'); ---Annual targets for bha1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),411, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),390, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),411, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),214, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),104, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),95, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),168, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),360, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),360, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),360, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),360, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),360, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),360, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),371, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='bha1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),371, '2014-03-26', '2015-03-25'); ---Annual targets for hir1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),225, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),225, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),225, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),225, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),20, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),51, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),100, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),215, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),215, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),215, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),215, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),210, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),210, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),210, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),210, '2014-03-26', '2015-03-25'); ---Annual targets for hir2 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),235, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),235, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),235, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),235, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),42, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),40, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),106, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),218, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),218, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),218, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),218, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),218, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),218, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),218, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hir2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),218, '2014-03-26', '2015-03-25'); ---Annual targets for hit1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),22, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),26, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),58, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),102, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),102, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),102, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),102, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),102, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),102, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),102, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),102, '2014-03-26', '2015-03-25'); ---Annual targets for hit2 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),135, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),14, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),135, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),112, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),17, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),18, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),65, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),135, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),136, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),142, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),135, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),135, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),135, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),135, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),135, '2014-03-26', '2015-03-25'); ---Annual targets for hit3 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),111, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),111, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),111, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),111, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),22, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),28, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),55, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),97, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),97, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),97, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),104, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),104, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),104, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),104, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='hit3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),104, '2014-03-26', '2015-03-25'); ---Annual targets for irk1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),248, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),206, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),248, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),248, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),20, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),28, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),58, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),192, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),224, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),210, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),214, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),214, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),200, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),190, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='irk1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),190, '2014-03-26', '2015-03-25'); ---Annual targets for kana1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),220, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),220, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),220, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),220, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),62, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),42, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),86, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),207, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),207, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),207, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),207, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),207, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),207, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),207, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),207, '2014-03-26', '2015-03-25'); ---Annual targets for kana2 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),150, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),134, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),144, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),144, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),21, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),22, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),58, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),130, '2014-03-26', '2015-03-25'); ---Annual targets for kana3 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),120, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),95, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),120, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),120, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),25, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),25, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),50, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),108, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),108, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),108, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),108, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),108, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),108, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),108, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kana3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),108, '2014-03-26', '2015-03-25'); ---Annual targets for karat1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),473, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),450, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),349, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),281, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),70, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),70, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),170, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),170, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),170, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),170, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),170, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),170, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),170, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='karat1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),170, '2014-03-26', '2015-03-25'); ---Annual targets for kara2 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),25, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),42, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),84, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),185, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='kara2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),185, '2014-03-26', '2015-03-25'); ---Annual targets for srir1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),118, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),130, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),96, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),22, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),20, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),54, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),110, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='srir1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),110, '2014-03-26', '2015-03-25'); ---Annual targets for sri2 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),156, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),156, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),156, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),156, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),10, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),15, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),60, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),133, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),133, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),133, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),133, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),133, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),133, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),133, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='sri2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),133, '2014-03-26', '2015-03-25'); ---Annual targets for ane1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),59, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),59, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),59, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),59, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),19, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),19, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),29, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),54, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),54, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),54, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),54, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),54, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),54, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),56, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='ane1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),56, '2014-03-26', '2015-03-25'); ---Annual targets for budg1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),45, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),55, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),55, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),230, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='budg1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),230, '2014-03-26', '2015-03-25'); ---Annual targets for mul1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),203, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),203, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),203, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),203, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),52, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),41, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),81, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),173, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),173, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),173, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),173, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),173, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),173, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),173, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mul1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),173, '2014-03-26', '2015-03-25'); ---Annual targets for mush1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),192, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),192, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),192, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),192, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),29, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),38, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),78, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),174, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),174, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),174, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),174, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),174, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),174, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),174, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),174, '2014-03-26', '2015-03-25'); ---Annual targets for mush2 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),150, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),150, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),150, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),120, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),28, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),26, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),57, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),139, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),139, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),139, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),139, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),139, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),139, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),139, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='mush2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),139, '2014-03-26', '2015-03-25'); ---Annual targets for nava1 -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'),168, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC_LT_12'),145, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'),13, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'),32, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'),68, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT1'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT2'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PENT3'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV3'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_1'),158, '2014-03-26', '2015-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.id FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id AND anmidentifier='nava1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV_BOOSTER'),158, '2014-03-26', '2015-03-25'); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_35__Adding_Ten_More_User_Data_For_Last_Batch_of_Training.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_35__Adding_Ten_More_User_Data_For_Last_Batch_of_Training.sql deleted file mode 100755 index 220448ba85..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_35__Adding_Ten_More_User_Data_For_Last_Batch_of_Training.sql +++ /dev/null @@ -1,35 +0,0 @@ -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user41', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User41', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user41'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user42', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User42', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user42'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user43', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User43', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user43'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user44', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User44', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user44'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user45', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User45', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user45'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user46', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User46', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user46'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user47', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User47', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user47'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user48', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User48', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user48'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user49', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User49', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user49'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'user50', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'User50', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='user50'); - -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user41'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user41')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user42'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user42')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user43'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user43')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user44'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user44')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user45'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user45')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user46'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user46')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user47'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user47')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user48'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user48')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user49'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user49')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='user50'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='user50')); - - ---Trainer data -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'trainer11', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer11', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='trainer11'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'trainer12', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer12', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='trainer12'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'trainer13', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer13', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='trainer13'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'trainer14', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer14', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='trainer14'); -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'trainer15', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'Trainer15', 'munjanahalli' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='trainer15'); - -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer11'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer11')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer12'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer12')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer13'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer13')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer14'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer14')); -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer15'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='trainer15')); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_36__Adding_Duplicate_Users_For_The_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_36__Adding_Duplicate_Users_For_The_ANMs.sql deleted file mode 100755 index 2978a18a85..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_36__Adding_Duplicate_Users_For_The_ANMs.sql +++ /dev/null @@ -1,4 +0,0 @@ -INSERT INTO report.dim_anm (anmIdentifier, phc, name, subcenter) SELECT 'muslim3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_muslimpur'), 'Mahadevakka', 'somsagara' WHERE NOT EXISTS (SELECT dim_anm FROM report.dim_anm WHERE anmIdentifier='muslim3'); - -INSERT INTO report.dim_service_provider (service_provider, type) SELECT (SELECT ID FROM report.dim_anm WHERE anmIdentifier='muslim3'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM') WHERE NOT EXISTS (SELECT service_provider FROM report.dim_service_provider WHERE service_provider=(SELECT ID FROM report.dim_anm WHERE anmIdentifier='muslim3')); - diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_37__Adding_User_And_Location.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_37__Adding_User_And_Location.sql deleted file mode 100755 index baa54d6a42..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_37__Adding_User_And_Location.sql +++ /dev/null @@ -1,16 +0,0 @@ -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'chc_mangalore'), 'mangalore_a', 'hirebindal' WHERE NOT EXISTS (SELECT dim_location FROM report.dim_location WHERE state='Karnataka' AND district='Koppal' AND taluka='Yalburga' AND phc=(SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore') AND subCenter='mangalore_a' AND village='hirebindal'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'chc_mangalore'), 'mangalore_a', 'kadralli' WHERE NOT EXISTS (SELECT dim_location FROM report.dim_location WHERE state='Karnataka' AND district='Koppal' AND taluka='Yalburga' AND phc=(SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_mangalore') AND subCenter='mangalore_a' AND village='kadralli'); - -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_1' WHERE NOT EXISTS (SELECT dim_location FROM report.dim_location WHERE state='Karnataka' AND district='Koppal' AND taluka='Yalburga' AND phc=(SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol') AND subCenter='mudhol' AND village='anganwadi_1'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_2' WHERE NOT EXISTS (SELECT dim_location FROM report.dim_location WHERE state='Karnataka' AND district='Koppal' AND taluka='Yalburga' AND phc=(SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol') AND subCenter='mudhol' AND village='anganwadi_2'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_4' WHERE NOT EXISTS (SELECT dim_location FROM report.dim_location WHERE state='Karnataka' AND district='Koppal' AND taluka='Yalburga' AND phc=(SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol') AND subCenter='mudhol' AND village='anganwadi_4'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_5' WHERE NOT EXISTS (SELECT dim_location FROM report.dim_location WHERE state='Karnataka' AND district='Koppal' AND taluka='Yalburga' AND phc=(SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol') AND subCenter='mudhol' AND village='anganwadi_5'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_6' WHERE NOT EXISTS (SELECT dim_location FROM report.dim_location WHERE state='Karnataka' AND district='Koppal' AND taluka='Yalburga' AND phc=(SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol') AND subCenter='mudhol' AND village='anganwadi_6'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_7' WHERE NOT EXISTS (SELECT dim_location FROM report.dim_location WHERE state='Karnataka' AND district='Koppal' AND taluka='Yalburga' AND phc=(SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol') AND subCenter='mudhol' AND village='anganwadi_7'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_8' WHERE NOT EXISTS (SELECT dim_location FROM report.dim_location WHERE state='Karnataka' AND district='Koppal' AND taluka='Yalburga' AND phc=(SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol') AND subCenter='mudhol' AND village='anganwadi_8'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_9' WHERE NOT EXISTS (SELECT dim_location FROM report.dim_location WHERE state='Karnataka' AND district='Koppal' AND taluka='Yalburga' AND phc=(SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol') AND subCenter='mudhol' AND village='anganwadi_9'); -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) SELECT 'Karnataka', 'Koppal', 'Yalburga', (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'phc_mudhol'), 'mudhol', 'anganwadi_10' WHERE NOT EXISTS (SELECT dim_location FROM report.dim_location WHERE state='Karnataka' AND district='Koppal' AND taluka='Yalburga' AND phc=(SELECT ID FROM report.dim_phc WHERE phcIdentifier='phc_mudhol') AND subCenter='mudhol' AND village='anganwadi_10'); - -INSERT INTO report.dim_location (state, district, taluka, phc, subCenter, village) SELECT 'Karnataka', 'Koppal', 'Kustagi' , (SELECT ID FROM report.dim_phc WHERE phcIdentifier = 'chc_tawargera'), 'tawargera_a', 'anganwadi_9' WHERE NOT EXISTS (SELECT dim_location FROM report.dim_location WHERE state='Karnataka' AND district='Koppal' AND taluka='Kustagi' AND phc=(SELECT ID FROM report.dim_phc WHERE phcIdentifier='chc_tawargera') AND subCenter='tawargera_a' AND village='anganwadi_9'); - - diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_38__Updating_Sompur_Village_To_Hosure_S.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_38__Updating_Sompur_Village_To_Hosure_S.sql deleted file mode 100755 index 358240befc..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_38__Updating_Sompur_Village_To_Hosure_S.sql +++ /dev/null @@ -1 +0,0 @@ - UPDATE report.dim_location SET village = 'hosure_s' WHERE village= 'sompur'; \ No newline at end of file diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_3__Adding_PHCs.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_3__Adding_PHCs.sql deleted file mode 100755 index 06630c8b6d..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_3__Adding_PHCs.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('bherya', 'Bherya'); -INSERT INTO report.dim_phc(phcIdentifier, name) VALUES ('keelanapura', 'Keelanapura'); - diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_4__Adding_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_4__Adding_ANMs.sql deleted file mode 100755 index 0ea53d95c6..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_4__Adding_ANMs.sql +++ /dev/null @@ -1,21 +0,0 @@ -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('bhe1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('bhe2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('bhe3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('bhe4', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('bhe5', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); - -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('klp1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('klp2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('klp3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('klp4', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='bhe1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='bhe2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='bhe3'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='bhe4'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='bhe5'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='klp1'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='klp2'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='klp3'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ((SELECT ID FROM report.dim_anm WHERE anmIdentifier='klp4'), (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_6__Adding_Locations.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_6__Adding_Locations.sql deleted file mode 100755 index 693e5f59d7..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_6__Adding_Locations.sql +++ /dev/null @@ -1,43 +0,0 @@ -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_a', 'ardha_bherya'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_a', 'basavanapura'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_a', 'geradada'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_a', 'sambaravalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_a', 'somanahalli_colony'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_b', 'battiganahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_b', 'half_bherya'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'bherya_b', 'sugganahalli'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'g_a_guppe', 'arakere'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'g_a_guppe', 'g_a_guppe'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'g_a_guppe', 'udayagiri'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'hosa_agrahara', 'boregowdanakoppalu'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'hosa_agrahara', 'harambanahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'hosa_agrahara', 'harambanahalli_koppalu'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'hosa_agrahara', 'hosa_agrahara'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'hosa_agrahara', 'mandiganahalli'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'munjanahalli', 'chikkabherya'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'munjanahalli', 'kavalu_hosur'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'K.R. Nagar', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya'), 'munjanahalli', 'munjanahalli'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a', 'inam_uttanahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a', 'keelanapura'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_a', 'm_c_hundi'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_b', 'gurukarapura'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_b', 'hosahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_b', 'madhavagere'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'keelanapura_b', 'megalapura'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'puttegowdanahundi', 'chattanahallipalya'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'puttegowdanahundi', 'chattanahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'puttegowdanahundi', 'duddagere'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'puttegowdanahundi', 'lakshmipura'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'puttegowdanahundi', 'mahadevi_colony'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'puttegowdanahundi', 'puttegowdanahundi'); - -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'vajamangala', 'chikkahalli'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'vajamangala', 'halagayanahundi'); -INSERT INTO report.dim_location(state, district, taluka, phc, subCenter, village) VALUES ('Karnataka', 'Mysore', 'Mysore', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='keelanapura'), 'vajamangala', 'vajamangala'); diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_7__Adding_Indicators.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_7__Adding_Indicators.sql deleted file mode 100755 index 8ed1bf34da..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_7__Adding_Indicators.sql +++ /dev/null @@ -1,62 +0,0 @@ -INSERT INTO report.dim_indicator (indicator) VALUES ('DPT'); -INSERT INTO report.dim_indicator (indicator) VALUES ('DPT_BOOSTER_2'); -INSERT INTO report.dim_indicator (indicator) VALUES ('HEP'); -INSERT INTO report.dim_indicator (indicator) VALUES ('OPV'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MEASLES'); -INSERT INTO report.dim_indicator (indicator) VALUES ('BCG'); -INSERT INTO report.dim_indicator (indicator) VALUES ('ANC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('ANC<12'); -INSERT INTO report.dim_indicator (indicator) VALUES ('LIVE_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('STILL_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('OCP'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IUD'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MALE_STERILIZATION'); -INSERT INTO report.dim_indicator (indicator) VALUES ('FEMALE_STERILIZATION'); -INSERT INTO report.dim_indicator (indicator) VALUES ('CONDOM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('DMPA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('FP_TRADITIONAL'); -INSERT INTO report.dim_indicator (indicator) VALUES ('LAM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('SUB_TT'); -INSERT INTO report.dim_indicator (indicator) VALUES ('TT1'); -INSERT INTO report.dim_indicator (indicator) VALUES ('TT2'); -INSERT INTO report.dim_indicator (indicator) VALUES ('TTB'); -INSERT INTO report.dim_indicator (indicator) VALUES ('LBW'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MTP<12'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MTP>12'); -INSERT INTO report.dim_indicator (indicator) VALUES ('SPONTANEOUS_ABORTION'); -INSERT INTO report.dim_indicator (indicator) VALUES ('DELIVERY'); -INSERT INTO report.dim_indicator (indicator) VALUES ('INSTITUTIONAL_DELIVERY'); -INSERT INTO report.dim_indicator (indicator) VALUES ('BF_POST_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('WEIGHED_AT_BIRTH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('ENM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('NM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('LNM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('IM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('UFM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MMA'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MMD'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MMP'); -INSERT INTO report.dim_indicator (indicator) VALUES ('MM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('VIT_A_1'); -INSERT INTO report.dim_indicator (indicator) VALUES ('VIT_A_2'); -INSERT INTO report.dim_indicator (indicator) VALUES ('ANC4'); -INSERT INTO report.dim_indicator (indicator) VALUES ('PNC3'); -INSERT INTO report.dim_indicator (indicator) VALUES ('D_HOM'); -INSERT INTO report.dim_indicator (indicator) VALUES ('D_SC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('D_PHC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('D_CHC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('D_SDH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('D_DH'); -INSERT INTO report.dim_indicator (indicator) VALUES ('D_PRI'); -INSERT INTO report.dim_indicator (indicator) VALUES ('DPT3_OPV3'); -INSERT INTO report.dim_indicator (indicator) VALUES ('DPTB_OPVB'); -INSERT INTO report.dim_indicator (indicator) VALUES ('OCP_ST'); -INSERT INTO report.dim_indicator (indicator) VALUES ('OCP_SC'); -INSERT INTO report.dim_indicator (indicator) VALUES ('OCP_C_OTHERS'); -INSERT INTO report.dim_indicator (indicator) VALUES ('FS_APL'); -INSERT INTO report.dim_indicator (indicator) VALUES ('FS_BPL'); -INSERT INTO report.dim_indicator (indicator) VALUES ('CESAREAN'); -INSERT INTO report.dim_indicator (indicator) VALUES ('CESAREAN_GOV'); -INSERT INTO report.dim_indicator (indicator) VALUES ('CESAREAN_PRI'); -INSERT INTO report.dim_indicator (indicator) VALUES ('INFANT_REG'); - diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_8__Adding_AnnualTargets_For_ANMs.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_8__Adding_AnnualTargets_For_ANMs.sql deleted file mode 100755 index 6a12171b5f..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_8__Adding_AnnualTargets_For_ANMs.sql +++ /dev/null @@ -1,100 +0,0 @@ -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 12, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 12, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 7, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 13, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 11, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 10, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 16, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 11, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 17, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 13, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 15, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 17, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 37, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 35, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 28, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 72, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 39, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 48, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 94, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 126, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 63, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 48, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 58, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 2, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 52, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 38, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 78, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 61, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 90, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 40, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 72, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 4, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 52, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 38, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 0, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 72, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 39, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 48, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 94, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 126, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 63, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 53, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 63, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 33, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 56, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 41, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 80, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 93, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 57, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 53, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 63, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 33, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 56, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 41, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 80, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 65, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 93, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 57, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 58, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 59, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe4'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 49, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='bhe5'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 37, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 68, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 84, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='klp4'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 45, '2012-03-26', '2013-03-25'); - diff --git a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_9__Adding_Annual_Targets_For_Test_User.sql b/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_9__Adding_Annual_Targets_For_Test_User.sql deleted file mode 100755 index 858213292e..0000000000 --- a/opensrp-reporting/src/main/resources/migrations/postgres/serviceProvided/V1_0_9__Adding_Annual_Targets_For_Test_User.sql +++ /dev/null @@ -1,176 +0,0 @@ -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('c', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='c'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('demo1', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo1'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('demo2', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo2'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - -INSERT INTO report.dim_anm (anmIdentifier, phc) VALUES ('demo3', (SELECT ID FROM report.dim_phc WHERE phcIdentifier='bherya')); - -INSERT INTO report.dim_service_provider (service_provider, type) VALUES ( - (SELECT ID FROM report.dim_anm WHERE anmIdentifier='demo3'), - (SELECT ID FROM report.dim_service_provider_type WHERE type='ANM')); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='c'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo1'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo2'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT_BOOSTER_2'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='HEP'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OPV'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MEASLES'), 45, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='BCG'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC<12'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='OCP'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='IUD'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='MALE_STERILIZATION'), 60, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='FEMALE_STERILIZATION'), 400, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='CONDOM'), 55, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DMPA'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='FP_TRADITIONAL'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='LAM'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='SUB_TT'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT1'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='TT2'), 10, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='TTB'), 30, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='LIVE_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='INSTITUTIONAL_DELIVERY'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='BF_POST_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='WEIGHED_AT_BIRTH'), 200, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_1'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='VIT_A_2'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='ANC4'), 50, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='PNC3'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_HOM'), 20, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SC'), 21, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PHC'), 22, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_CHC'), 23, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_SDH'), 24, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_DH'), 25, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='D_PRI'), 26, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPT3_OPV3'), 40, '2012-03-26', '2013-03-25'); -INSERT INTO report.annual_target (service_provider, indicator, target, start_date, end_date) VALUES ((SELECT sp.ID FROM report.dim_service_provider sp, report.dim_anm a WHERE sp.service_provider = a.id and anmIdentifier='demo3'), (SELECT ID FROM report.dim_indicator WHERE indicator='DPTB_OPVB'), 45, '2012-03-26', '2013-03-25'); - diff --git a/opensrp-reporting/src/main/resources/spring/applicationContext-opensrp-reporting.xml b/opensrp-reporting/src/main/resources/spring/applicationContext-opensrp-reporting.xml deleted file mode 100755 index c76633bf09..0000000000 --- a/opensrp-reporting/src/main/resources/spring/applicationContext-opensrp-reporting.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/opensrp-reporting/src/main/resources/spring/applicationContext-reporting-repository.xml b/opensrp-reporting/src/main/resources/spring/applicationContext-reporting-repository.xml deleted file mode 100755 index f35f34a916..0000000000 --- a/opensrp-reporting/src/main/resources/spring/applicationContext-reporting-repository.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - ${hibernate.dialect} - ${hibernate.show_sql} - ${hibernate.format_sql} - ${hibernate.auto_commit} - ${db.reporting.report} - - - - - - - - - - - - - - - - - - - - - - - ${hibernate.dialect} - ${hibernate.show_sql} - ${hibernate.format_sql} - ${hibernate.auto_commit} - ${db.reporting.anm} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/opensrp-reporting/src/main/webapp/WEB-INF/spring/webmvc-config.xml b/opensrp-reporting/src/main/webapp/WEB-INF/spring/webmvc-config.xml deleted file mode 100755 index a4813e95c3..0000000000 --- a/opensrp-reporting/src/main/webapp/WEB-INF/spring/webmvc-config.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/opensrp-reporting/src/main/webapp/WEB-INF/web.xml b/opensrp-reporting/src/main/webapp/WEB-INF/web.xml deleted file mode 100755 index 5e96709de3..0000000000 --- a/opensrp-reporting/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - opensrp-reporting - - OpenSRP Reporting Application - - - contextConfigLocation - classpath*:spring/applicationContext-opensrp-reporting.xml - - - - org.springframework.web.context.ContextLoaderListener - - - - opensrp - org.springframework.web.servlet.DispatcherServlet - - contextConfigLocation - /WEB-INF/spring/webmvc-config.xml - - 1 - - - - opensrp - / - - - - 120 - - - diff --git a/opensrp-reporting/src/main/webapp/index.html b/opensrp-reporting/src/main/webapp/index.html deleted file mode 100755 index beb5ce5a92..0000000000 --- a/opensrp-reporting/src/main/webapp/index.html +++ /dev/null @@ -1,5 +0,0 @@ - - -

Welcome to OpenSRP reporting!

- - diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/AggregateReportsSchedulerTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/AggregateReportsSchedulerTest.java deleted file mode 100755 index 2d356b4cf3..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/AggregateReportsSchedulerTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.opensrp.reporting; - -import org.opensrp.common.util.DateTimeUtil; -import org.joda.time.DateTimeConstants; -import org.joda.time.LocalDateTime; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentMatcher; -import org.mockito.Matchers; -import org.mockito.Mock; -import org.motechproject.scheduler.MotechSchedulerService; -import org.motechproject.scheduler.domain.RepeatingSchedulableJob; - -import static org.mockito.Mockito.verify; -import static org.mockito.MockitoAnnotations.initMocks; -import org.opensrp.scheduler.AggregateReportsScheduler; - -public class AggregateReportsSchedulerTest { - - @Mock - private MotechSchedulerService schedulerService; - private AggregateReportsScheduler scheduler; - private final int REPEAT_INTERVAL_IN_MINUTES = 10; - - @Before - public void setUp() throws Exception { - initMocks(this); - scheduler = new AggregateReportsScheduler(REPEAT_INTERVAL_IN_MINUTES, schedulerService); - } - - @Test - public void shouldScheduleARepeatingJob() throws Exception { - DateTimeUtil.fakeIt(LocalDateTime.parse("2013-01-01T12:00:00.000")); - - scheduler.startTimedScheduler(); - - verify(schedulerService).safeScheduleRepeatingJob(verifyJob()); - } - - private RepeatingSchedulableJob verifyJob() { - return Matchers.argThat(new ArgumentMatcher() { - @Override - public boolean matches(Object o) { - RepeatingSchedulableJob job = (RepeatingSchedulableJob) o; - return LocalDateTime.parse("2013-01-01T12:00:00.000").plusMinutes(10).toDate() - .equals(job.getStartTime()) - && DateTimeConstants.MILLIS_PER_MINUTE * REPEAT_INTERVAL_IN_MINUTES == job.getRepeatIntervalInMilliSeconds() - && "REPORT_AGGREGATOR_SCHEDULE".equals(job.getMotechEvent().getSubject()); - } - }); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/ANMControllerTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/ANMControllerTest.java deleted file mode 100755 index 974f8800df..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/ANMControllerTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.opensrp.reporting.controller; - -import com.google.gson.Gson; -import org.opensrp.common.domain.UserDetail; -import org.opensrp.common.util.HttpAgent; -import org.opensrp.common.util.HttpResponse; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.opensrp.dto.ANMDTO; -import org.opensrp.dto.LocationDTO; -import org.opensrp.reporting.controller.ANMController; -import org.opensrp.reporting.controller.ANMDetailsFetcher; -import org.opensrp.reporting.domain.Location; -import org.opensrp.reporting.domain.SP_ANM; -import org.opensrp.reporting.factory.DetailsFetcherFactory; -import org.opensrp.reporting.service.ANMService; -import org.springframework.http.ResponseEntity; - -import java.util.List; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -public class ANMControllerTest { - - @Mock - private ANMService anmService; - @Mock - private Location location; - @Mock - private HttpAgent httpAgent; - @Mock - private DetailsFetcherFactory detailsFetcherFactory; - @Mock - private ANMDetailsFetcher anmDetailsFetcher; - - - private ANMController controller; - - @Before - public void setUp() throws Exception { - initMocks(this); - controller = new ANMController("site-url", "http://user-details-endpoint/user-details", anmService, httpAgent, detailsFetcherFactory); - } - - @Test - public void shouldReturnListOfANMs() throws Exception { - List roles = asList("ROLE_USER"); - when(httpAgent.get("http://user-details-endpoint/user-details?anm-id=username1")). - thenReturn(new HttpResponse(true, - new Gson().toJson(new UserDetail("username1", roles)))); - - when(detailsFetcherFactory.detailsFetcher(roles)).thenReturn(anmDetailsFetcher); - when(anmDetailsFetcher.fetchDetails("username1")).thenReturn(asList( - new SP_ANM("username1", "user1 name", "Sub Center 1", 0), - new SP_ANM("username2", "user2 name", "Sub Center 1", 0) - )); - when(location.district()).thenReturn("district"); - when(location.phcName()).thenReturn("phc"); - when(location.state()).thenReturn("state"); - when(location.taluka()).thenReturn("taluka"); - when(location.village()).thenReturn("village"); - when(location.subCenter()).thenReturn("subcenter"); - - when(anmService.getLocation("username1")).thenReturn(location); - when(anmService.getLocation("username2")).thenReturn(location); - - ResponseEntity> response = controller.all("username1"); - LocationDTO locationDTO = new LocationDTO(location.subCenter(), location.phcName(), location.taluka(), location.district(), location.state()); - assertEquals(asList(new ANMDTO("username1", "user1 name", locationDTO), new ANMDTO("username2", "user2 name", locationDTO)), response.getBody()); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/AggregatedReportControllerTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/AggregatedReportControllerTest.java deleted file mode 100755 index 176f9e3be8..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/AggregatedReportControllerTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.opensrp.reporting.controller; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.opensrp.dto.LocationDTO; -import org.opensrp.dto.aggregatorResponse.AggregatorResponseDTO; -import org.opensrp.dto.report.AggregatedReportsDTO; -import org.opensrp.reporting.controller.AggregatedReportController; -import org.opensrp.reporting.domain.Location; -import org.opensrp.reporting.domain.PHC; -import org.opensrp.reporting.service.ANMService; -import org.opensrp.reporting.service.AggregateReportsService; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; - -import static java.util.Arrays.asList; -import static org.opensrp.common.util.EasyMap.create; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -public class AggregatedReportControllerTest { - - @Mock - private AggregateReportsService aggregateReportsService; - @Mock - private ANMService anmService; - - private AggregatedReportController controller; - - @Before - public void setUp() throws Exception { - initMocks(this); - controller = new AggregatedReportController(aggregateReportsService, "http://dristhi_site_url", anmService); - } - - @Test - public void shouldReturnAggregatedReportDataForAGivenANMMonthAndYear() { - when(aggregateReportsService.getAggregatedReports("demo1", 12, 2013)).thenReturn(asList(new AggregatorResponseDTO("OCP", 4), new AggregatorResponseDTO("OPV_1", 2))); - when(anmService.getLocation("demo1")).thenReturn(new Location("Bherya", "sub Center", new PHC(1, "PHC 1", "Bherya"), "taluka", "mysore", "karnataka")); - - ResponseEntity aggregatedReports = controller.get("demo1", 12, 2013); - - assertEquals(new AggregatedReportsDTO(create("OCP", 4).put("OPV_1", 2).map(), new LocationDTO("Sub Center", "Bherya", "taluka", "mysore", "karnataka")), aggregatedReports.getBody()); - assertEquals(HttpStatus.OK, aggregatedReports.getStatusCode()); - assertTrue(aggregatedReports.getHeaders().containsKey("Access-Control-Allow-Origin")); - assertEquals("http://dristhi_site_url", aggregatedReports.getHeaders().getFirst("Access-Control-Allow-Origin")); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/LocationControllerTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/LocationControllerTest.java deleted file mode 100755 index 7f3cbf1b07..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/LocationControllerTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.opensrp.reporting.controller; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.opensrp.dto.VillagesDTO; -import org.opensrp.reporting.controller.LocationController; -import org.opensrp.reporting.domain.Location; -import org.opensrp.reporting.domain.PHC; -import org.opensrp.reporting.service.ANMService; -import org.springframework.http.ResponseEntity; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; - -public class LocationControllerTest { - - @Mock - private ANMService anmService; - @Mock - private Location location; - @Mock - private PHC phc; - private LocationController controller; - - @Before - public void setUp() throws Exception { - initMocks(this); - controller = new LocationController(anmService); - } - - @Test - public void shouldReturnListOfVillagesForANM() throws Exception { - when(anmService.getVillagesForANM("demo1")).thenReturn( - asList( - new Location("village1", "sc", phc, "taluk", "District", "state"), - new Location("village2", "sc", phc, "taluk", "District", "state") - )); - - when(anmService.getLocation("demo1")).thenReturn(location); - when(location.phc()).thenReturn(phc); - when(location.subCenter()).thenReturn("sc"); - when(phc.phcIdentifier()).thenReturn("phc1"); - when(phc.name()).thenReturn("PHC X"); - when(location.phcName()).thenReturn("PHC X"); - - ResponseEntity response = controller.villagesForANM("demo1"); - - VillagesDTO villagesDTO = new VillagesDTO("district", "PHC X", "phc1", "sc", asList("village1", "village2")); - assertEquals(villagesDTO, response.getBody()); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/PHCUserDetailsFetcherTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/PHCUserDetailsFetcherTest.java deleted file mode 100755 index 9e48e0fd03..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/PHCUserDetailsFetcherTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.opensrp.reporting.controller; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; - -import static org.mockito.Mockito.verify; -import static org.mockito.MockitoAnnotations.initMocks; -import org.opensrp.reporting.controller.PHCUserDetailsFetcher; -import org.opensrp.reporting.service.ANMService; - -public class PHCUserDetailsFetcherTest { - - @Mock - private ANMService anmService; - private PHCUserDetailsFetcher phcUserDetailsFetcher; - - @Before - public void setUp() throws Exception { - initMocks(this); - phcUserDetailsFetcher = new PHCUserDetailsFetcher(anmService); - } - - @Test - public void shouldDelegateToANMServiceToFetchANMsFromSamePHC() { - phcUserDetailsFetcher.fetchDetails("demo1"); - - verify(anmService).anmsInTheSamePHC("demo1"); - } - -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/ReportDataControllerTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/ReportDataControllerTest.java deleted file mode 100755 index 3a7f6aef75..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/ReportDataControllerTest.java +++ /dev/null @@ -1,191 +0,0 @@ -package org.opensrp.reporting.controller; - -import org.opensrp.common.domain.ANMReport; -import org.opensrp.common.domain.ReportDataDeleteRequest; -import org.opensrp.common.domain.ReportDataUpdateRequest; -import org.opensrp.common.domain.ReportingData; -import org.opensrp.common.domain.Location; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; - -import java.util.Date; -import java.util.HashMap; -import java.util.List; - -import static java.util.Arrays.asList; -import static junit.framework.Assert.assertEquals; -import static org.opensrp.common.AllConstants.ReportDataParameters.*; -import static org.opensrp.common.domain.Indicator.*; -import static org.opensrp.common.domain.ReportingData.anmReportData; -import static org.opensrp.common.domain.ReportingData.serviceProvidedData; -import static org.opensrp.common.util.ANMIndicatorSummaryFactory.createSummaryForANC; -import static org.opensrp.common.util.ANMIndicatorSummaryFactory.createSummaryForIUD; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; -import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; -import org.opensrp.reporting.DristhiEntityIdMissingException; -import org.opensrp.reporting.ReportDataMissingException; -import org.opensrp.reporting.controller.ReportDataController; -import org.opensrp.reporting.domain.ANMReportData; -import org.opensrp.reporting.domain.ServiceProvided; -import org.opensrp.reporting.repository.ANMReportsRepository; -import org.opensrp.reporting.repository.ServicesProvidedRepository; - -public class ReportDataControllerTest { - @Mock - private ServicesProvidedRepository servicesProvidedRepository; - @Mock - private ANMReportsRepository anmReportsRepository; - @Mock - private ServiceProvided serviceProvided; - @Mock - private ANMReportData anmReportData; - @Mock - private Date date; - - private ReportDataController controller; - - @Before - public void setUp() throws Exception { - initMocks(this); - controller = new ReportDataController(servicesProvidedRepository, anmReportsRepository); - } - - @Test - public void shouldSaveServiceProvidedInDB() throws Exception { - ReportingData data = serviceProvidedData("ANM X", "TC 1", BCG, "2012-01-01", - new Location("bherya", "Sub Center", "PHC X"), "entity id 1").withQuantity("40"); - - controller.submit(data); - - verify(servicesProvidedRepository).save("ANM X", "ANM", "TC 1", "BCG", "2012-01-01", "bherya", "Sub Center", "PHC X", "40", "entity id 1"); - } - - @Test - public void shouldSaveANMReportDataInDB() throws Exception { - ReportingData data = anmReportData("ANM X", "EC Number 1", FP_IUD, "2012-01-01").withQuantity("40"); - - controller.submit(data); - - verify(anmReportsRepository).save("ANM X", "EC Number 1", "IUD", "2012-01-01", "40"); - } - - @Test(expected = ReportDataMissingException.class) - public void shouldThrowExceptionWhenANMReportDataDoesNotHaveAllTheNecessaryInformation() throws Exception { - ReportingData data = anmReportData(null, null, FP_CONDOM, null); - - controller.submit(data); - } - - @Test(expected = ReportDataMissingException.class) - public void shouldThrowExceptionWhenServiceProvidedReportDataDoesNotHaveAllTheNecessaryInformation() throws Exception { - ReportingData data = serviceProvidedData("", null, BCG, null, new Location(null, null, null), null); - - controller.submit(data); - } - - @Test - public void shouldReturnListOfANMIndicatorSummaryForAllANMs() throws Exception { - ANMReport anmXReport = new ANMReport("ANM X", asList(createSummaryForIUD())); - ANMReport anmYReport = new ANMReport("ANM Y", asList(createSummaryForANC())); - when(anmReportsRepository.fetchAllANMsReport()).thenReturn(asList(anmXReport, anmYReport)); - - List summaries = controller.getAllANMsIndicatorSummaries(); - - assertEquals(asList(anmXReport, anmYReport), summaries); - } - - @Test - public void shouldUpdateListOfServiceProvidedIndicatorRowsForReportingMonthForAllANMs() throws Exception { - - HashMap data = new HashMap(); - String type = "serviceProvided"; - data.put(SERVICE_PROVIDER_TYPE, type); - data.put(EXTERNAL_ID, "external id 1"); - data.put(SERVICE_PROVIDED_DATE, "2013-01-26"); - data.put(VILLAGE, "village 1"); - data.put(SUB_CENTER, "sub center 1"); - data.put(PHC, "phc"); - data.put(QUANTITY, "1"); - data.put(INDICATOR, "INDICATOR 1"); - data.put(ANM_IDENTIFIER, "anm id 1"); - data.put(DRISTHI_ENTITY_ID, "entity id 1"); - ReportingData reportingData = new ReportingData("serviceProvided", data); - - ReportDataUpdateRequest reportDataUpdateRequest = new ReportDataUpdateRequest() - .withType(type) - .withStartDate("2013-01-26") - .withEndDate("2013-02-25") - .withReportingData(asList(reportingData)); - - String result = controller.updateReports(reportDataUpdateRequest); - - verify(servicesProvidedRepository).update(reportDataUpdateRequest); - assertEquals("Success.", result); - } - - @Test - public void shouldDeleteAllServiceProvidedReportsGivenAnEntityID() throws Exception { - ReportDataDeleteRequest deleteRequest = new ReportDataDeleteRequest() - .withType("serviceProvided") - .withDristhiEntityId("entity id 1"); - - String result = controller.deleteReports(deleteRequest); - - verify(servicesProvidedRepository).delete(deleteRequest); - verifyZeroInteractions(anmReportsRepository); - assertEquals("Success.", result); - } - - @Test - public void shouldDeleteAllANMReportsGivenAnEntityID() throws Exception { - ReportDataDeleteRequest deleteRequest = new ReportDataDeleteRequest() - .withType("anmReportData") - .withDristhiEntityId("entity id 1"); - - String result = controller.deleteReports(deleteRequest); - - verify(anmReportsRepository).delete(deleteRequest); - verifyZeroInteractions(servicesProvidedRepository); - assertEquals("Success.", result); - } - - @Test(expected = DristhiEntityIdMissingException.class) - public void shouldThrowExceptionWhenDristhiEntityIdIsNotPresent() throws Exception { - ReportDataDeleteRequest deleteRequestWithoutDristhiEntityId = new ReportDataDeleteRequest() - .withType("serviceProvided"); - controller.deleteReports(deleteRequestWithoutDristhiEntityId); - } - - @Test - public void shouldDeleteListOfANMReportsIndicatorRowsForReportingMonthForAllANMs() throws Exception { - String indicator = "INDICATOR 1"; - String startDate = "2013-01-26"; - String endDate = "2013-02-25"; - HashMap data = new HashMap(); - data.put(SERVICE_PROVIDER_TYPE, "anmReport"); - data.put(EXTERNAL_ID, "external id 1"); - data.put(SERVICE_PROVIDED_DATE, startDate); - data.put(VILLAGE, "village 1"); - data.put(SUB_CENTER, "sub center 1"); - data.put(PHC, "phc"); - data.put(QUANTITY, "1"); - data.put(INDICATOR, indicator); - data.put(ANM_IDENTIFIER, "anm id 1"); - - ReportingData reportingData = new ReportingData("anmReportData", data); - ReportDataUpdateRequest reportDataUpdateRequest = new ReportDataUpdateRequest() - .withType("anmReportData") - .withReportingData(asList(reportingData)) - .withStartDate(startDate) - .withEndDate(endDate) - .withIndicator(indicator); - - String result = controller.updateReports(reportDataUpdateRequest); - - verify(anmReportsRepository).update(reportDataUpdateRequest); - assertEquals("Success.", result); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/SCUserDetailsFetcherTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/SCUserDetailsFetcherTest.java deleted file mode 100755 index ace124e419..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/controller/SCUserDetailsFetcherTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.opensrp.reporting.controller; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; - -import static org.mockito.Mockito.verify; -import static org.mockito.MockitoAnnotations.initMocks; -import org.opensrp.reporting.controller.SCUserDetailsFetcher; -import org.opensrp.reporting.service.ANMService; - -public class SCUserDetailsFetcherTest { - - @Mock - private ANMService anmService; - private SCUserDetailsFetcher scUserDetailsFetcher; - - @Before - public void setUp() throws Exception { - initMocks(this); - scUserDetailsFetcher = new SCUserDetailsFetcher(anmService); - } - - @Test - public void shouldDelegateToANMServiceToFetchANMsFromSameSC() { - scUserDetailsFetcher.fetchDetails("demo1"); - - verify(anmService).anmsInTheSameSC("demo1"); - } - -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/factory/DetailsFetcherFactoryTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/factory/DetailsFetcherFactoryTest.java deleted file mode 100755 index 7af8b662be..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/factory/DetailsFetcherFactoryTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.opensrp.reporting.factory; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertTrue; -import static org.mockito.MockitoAnnotations.initMocks; -import org.opensrp.reporting.controller.ANMDetailsFetcher; -import org.opensrp.reporting.controller.PHCUserDetailsFetcher; -import org.opensrp.reporting.controller.SCUserDetailsFetcher; -import org.opensrp.reporting.factory.DetailsFetcherFactory; - -public class DetailsFetcherFactoryTest { - - @Mock - private SCUserDetailsFetcher scUserDetailsFetcher; - @Mock - private PHCUserDetailsFetcher phcUserDetailsFetcher; - private DetailsFetcherFactory detailsFetcherFactory; - - @Before - public void setUp() throws Exception { - initMocks(this); - detailsFetcherFactory = new DetailsFetcherFactory(scUserDetailsFetcher, phcUserDetailsFetcher); - } - - @Test - public void shouldReturnPHCDetailsFetcherWhenUserRoleIsPHCUser() { - ANMDetailsFetcher anmDetailsFetcher = detailsFetcherFactory.detailsFetcher(asList("ROLE_PHC_USER", "ROLE_USER")); - assertTrue(anmDetailsFetcher instanceof PHCUserDetailsFetcher); - } - - @Test - public void shouldReturnPHCDetailsFetcherWhenUserRoleIsSCUser() { - ANMDetailsFetcher anmDetailsFetcher = detailsFetcherFactory.detailsFetcher(asList("ROLE_USER")); - assertTrue(anmDetailsFetcher instanceof SCUserDetailsFetcher); - } - -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/ANMReportsRepositoryTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/ANMReportsRepositoryTest.java deleted file mode 100755 index e56c1862d4..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/ANMReportsRepositoryTest.java +++ /dev/null @@ -1,325 +0,0 @@ -package org.opensrp.reporting.repository; - -import org.opensrp.common.domain.*; -import org.opensrp.common.monitor.Monitor; -import org.opensrp.common.util.DateUtil; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; - -import java.util.Date; -import java.util.HashMap; -import java.util.List; - -import static java.util.Arrays.asList; -import static junit.framework.Assert.assertEquals; -import static org.opensrp.common.AllConstants.ReportDataParameters.*; -import static org.opensrp.common.util.ANMIndicatorSummaryFactory.*; -import static org.joda.time.LocalDate.parse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.*; -import static org.mockito.MockitoAnnotations.initMocks; -import org.opensrp.reporting.domain.ANM; -import org.opensrp.reporting.domain.ANMReportData; -import org.opensrp.reporting.domain.AnnualTarget; -import org.opensrp.reporting.domain.Indicator; -import org.opensrp.reporting.repository.ANMReportsRepository; -import org.opensrp.reporting.repository.AllANMReportDataRepository; -import org.opensrp.reporting.repository.AllAnnualTargetsRepository; -import org.opensrp.reporting.repository.cache.ANMCacheableRepository; -import org.opensrp.reporting.repository.cache.CacheableRepository; -import org.opensrp.reporting.repository.cache.IndicatorCacheableRepository; -import org.opensrp.reporting.repository.cache.ReadOnlyCacheableRepository; - -public class ANMReportsRepositoryTest { - @Mock - private ANMCacheableRepository anmRepository; - - @Mock - private IndicatorCacheableRepository indicatorRepository; - - @Mock - private AllANMReportDataRepository anmReportDataRepository; - - @Mock - private Monitor monitor; - - @Mock - private AllAnnualTargetsRepository annualTargetsRepository; - - private ANMReportsRepository repository; - - @Before - public void setUp() throws Exception { - initMocks(this); - repository = new ANMReportsRepository(anmRepository, indicatorRepository, - anmReportDataRepository, annualTargetsRepository, monitor, new ReportMonth()); - } - - @Test - public void shouldSaveANMReportsAndUseCachedRepositories() throws Exception { - String anmIdentifier = "ANM X"; - String externalId = "EC CASE 1"; - String indicator = "IUD"; - Date date = parse("2012-04-04").toDate(); - - Indicator fetchedIndicator = new Indicator(2, indicator); - ANM anm = new ANM(2, anmIdentifier); - - when(anmRepository.fetch(new ANM((anmIdentifier)))).thenReturn(anm); - when(indicatorRepository.fetch(new Indicator(indicator))).thenReturn(fetchedIndicator); - - repository.save(anmIdentifier, externalId, indicator, "2012-04-04", null); - repository.save(anmIdentifier, externalId, indicator, "2012-04-04", null); - - verifyCallsToReadOnlyCachedRepository(anmRepository, new ANM(anmIdentifier)); - verifyCallsToReadOnlyCachedRepository(indicatorRepository, fetchedIndicator); - - verify(anmReportDataRepository, times(2)).save(anm, externalId, fetchedIndicator, date); - } - - - @Test - public void shouldSaveAsPerQuantityIfQuantityIsNotNull() throws Exception { - String anmIdentifier = "ANM X"; - String externalId = "EC CASE 1"; - String indicator = "IUD"; - Date date = parse("2012-04-04").toDate(); - - Indicator fetchedIndicator = new Indicator(2, indicator); - ANM anm = new ANM(2, anmIdentifier); - - when(anmRepository.fetch(new ANM((anmIdentifier)))).thenReturn(anm); - when(indicatorRepository.fetch(new Indicator(indicator))).thenReturn(fetchedIndicator); - - repository.save(anmIdentifier, externalId, indicator, "2012-04-04", "50"); - - verify(anmReportDataRepository, times(50)).save(anm, externalId, fetchedIndicator, date); - } - - @Test - public void shouldFetchANMIndicatorSummaries() throws Exception { - DateUtil.fakeIt(parse("2012-06-30")); - ANM anm = new ANM("ANM X"); - Date date1 = parse("2012-03-29").toDate(); - Date date2 = parse("2012-05-15").toDate(); - Date date3 = parse("2012-05-30").toDate(); - Indicator indicator1 = new Indicator("IUD"); - Indicator indicator2 = new Indicator("ANC"); - when(anmReportDataRepository.fetchByANMIdAndDate("ANM X", parse("2012-03-26").toDate())).thenReturn(asList( - new ANMReportData(anm, "CASE 1", indicator1, date1), - new ANMReportData(anm, "CASE 2", indicator1, date1), - new ANMReportData(anm, "CASE 3", indicator1, date2), - new ANMReportData(anm, "CASE 4", indicator1, date2), - new ANMReportData(anm, "CASE 5", indicator2, date3), - new ANMReportData(anm, "CASE 6", indicator2, date3))); - when(annualTargetsRepository.fetchFor("ANM X", indicator1, parse("2012-06-30").toDate())).thenReturn(new AnnualTarget(1, 1, "40", parse("2012-03-26").toDate(), parse("2013-03-25").toDate())); - when(annualTargetsRepository.fetchFor("ANM X", indicator2, parse("2012-06-30").toDate())).thenReturn(new AnnualTarget(1, 1, "30", parse("2012-03-26").toDate(), parse("2013-03-25").toDate())); - - List anmIndicatorSummaries = repository.fetchANMSummary("ANM X"); - - assertTrue(anmIndicatorSummaries.containsAll(asList(createSummaryForANC(), createSummaryForIUD()))); - assertEquals(2, anmIndicatorSummaries.size()); - } - - @Test - public void shouldSetMonthOfSummaryToBeNextYearsInCaseOfLastMonthOfTheYear() throws Exception { - DateUtil.fakeIt(parse("2013-01-30")); - ANM anm = new ANM("ANM X"); - Date date = parse("2012-12-29").toDate(); - Indicator indicator = new Indicator("IUD"); - when(anmReportDataRepository.fetchByANMIdAndDate("ANM X", parse("2012-03-26").toDate())).thenReturn(asList(new ANMReportData(anm, "CASE 1", indicator, date))); - when(annualTargetsRepository.fetchFor("ANM X", indicator, parse("2013-01-30").toDate())).thenReturn(new AnnualTarget(1, 1, "40", parse("2012-03-26").toDate(), parse("2013-03-25").toDate())); - - List anmIndicatorSummaries = repository.fetchANMSummary("ANM X"); - - assertEquals(asList(new ANMIndicatorSummary("IUD", "40", asList(new MonthSummary("1", "2013", "1", "1", asList("CASE 1"))))), anmIndicatorSummaries); - } - - @Test - public void shouldFetchANMIndicatorSummariesIncludingAllServicesProvidedTillTheCurrentMonth() throws Exception { - DateUtil.fakeIt(parse("2013-01-15")); - ANM anm = new ANM("ANM X"); - Date january = parse("2013-01-11").toDate(); - Indicator indicator1 = new Indicator("IUD"); - when(anmReportDataRepository.fetchByANMIdAndDate("ANM X", parse("2012-03-26").toDate())).thenReturn(asList( - new ANMReportData(anm, "CASE 1", indicator1, january))); - when(annualTargetsRepository.fetchFor("ANM X", indicator1, parse("2013-01-15").toDate())).thenReturn(new AnnualTarget(1, 1, "40", parse("2012-03-26").toDate(), parse("2013-03-25").toDate())); - - List anmIndicatorSummaries = repository.fetchANMSummary("ANM X"); - - assertEquals(1, anmIndicatorSummaries.size()); - assertEquals(1, anmIndicatorSummaries.get(0).monthlySummaries().size()); - } - - @Test - public void shouldFetchANMIndicatorSummariesWithDistinctExternalIds() throws Exception { - DateUtil.fakeIt(parse("2013-03-22")); - ANM anm = new ANM("ANM X"); - Date dates = parse("2013-03-21").toDate(); - Indicator indicator = new Indicator("CONDOM"); - when(anmReportDataRepository.fetchByANMIdAndDate("ANM X", parse("2012-03-26").toDate())).thenReturn(asList( - new ANMReportData(anm, "CASE 7", indicator, dates), - new ANMReportData(anm, "CASE 7", indicator, dates))); - when(annualTargetsRepository.fetchFor("ANM X", indicator, parse("2013-03-22").toDate())).thenReturn(new AnnualTarget(1, 1, "20", parse("2012-03-26").toDate(), parse("2013-03-25").toDate())); - - List anmIndicatorSummaries = repository.fetchANMSummary("ANM X"); - - System.out.println(anmIndicatorSummaries); - assertTrue(anmIndicatorSummaries.containsAll(asList(createSummaryForCondom()))); - assertEquals(1, anmIndicatorSummaries.size()); - } - - @Test - public void shouldFetchANMIndicatorSummariesForCurrentReportingYear() throws Exception { - DateUtil.fakeIt(parse("2013-01-02")); - - repository.fetchANMSummary("ANM X"); - - verify(anmReportDataRepository).fetchByANMIdAndDate("ANM X", parse("2012-03-26").toDate()); - } - - @Test - public void shouldFetchReportsForCurrentYearIfCurrentDayIsFirstDayOfTheReportingYear() throws Exception { - DateUtil.fakeIt(parse("2012-03-26")); - - repository.fetchANMSummary("ANM X"); - - verify(anmReportDataRepository).fetchByANMIdAndDate("ANM X", parse("2012-03-26").toDate()); - } - - @Test - public void shouldFetchReportsForPreviousYearIfCurrentDayIsLastDayOfTheReportingYear() throws Exception { - DateUtil.fakeIt(parse("2013-03-25")); - - repository.fetchANMSummary("ANM X"); - - verify(anmReportDataRepository).fetchByANMIdAndDate("ANM X", parse("2012-03-26").toDate()); - } - - @Test - public void shouldReturnEmptyANMIndicatorSummariesWhenThereIsNoDataForANM() throws Exception { - DateUtil.fakeIt(parse("2012-03-31")); - when(anmReportDataRepository.fetchByANMIdAndDate("ANM X", parse("2012-01-01").toDate())).thenReturn(null); - - List anmIndicatorSummaries = repository.fetchANMSummary("ANM X"); - - assertEquals(0, anmIndicatorSummaries.size()); - } - - @Test - public void shouldReturnANMIndicatorSummariesWithNullAnnualTargetWhenThereIsNoAnnualTargetForANM() throws Exception { - DateUtil.fakeIt(parse("2012-06-30")); - ANM anm = new ANM("ANM X"); - Date date1 = parse("2012-03-29").toDate(); - Date date2 = parse("2012-05-15").toDate(); - Indicator indicator = new Indicator("IUD"); - when(anmReportDataRepository.fetchByANMIdAndDate("ANM X", parse("2012-03-26").toDate())).thenReturn(asList( - new ANMReportData(anm, "CASE 1", indicator, date1), - new ANMReportData(anm, "CASE 2", indicator, date1), - new ANMReportData(anm, "CASE 3", indicator, date2), - new ANMReportData(anm, "CASE 4", indicator, date2))); - when(annualTargetsRepository.fetchFor("ANM X", new Indicator("IUD"), parse("2012-06-30").toDate())).thenReturn(null); - - List anmIndicatorSummaries = repository.fetchANMSummary("ANM X"); - - ANMIndicatorSummary expectedANMIUDSummary = createSummaryForIUD(null); - assertEquals(asList(expectedANMIUDSummary), anmIndicatorSummaries); - } - - @Test - public void shouldReturnAllANMReports() throws Exception { - DateUtil.fakeIt(parse("2012-06-30")); - ANM anmX = new ANM("ANM X"); - ANM anmY = new ANM("ANM Y"); - Date date1 = parse("2012-03-29").toDate(); - Date date2 = parse("2012-04-30").toDate(); - Date date3 = parse("2012-05-27").toDate(); - Indicator indicator1 = new Indicator("IUD"); - Indicator indicator2 = new Indicator("ANC"); - when(anmReportDataRepository.fetchByANMIdAndDate("ANM X", parse("2012-03-26").toDate())).thenReturn(asList( - new ANMReportData(anmX, "CASE 1", indicator1, date1), - new ANMReportData(anmX, "CASE 2", indicator1, date1), - new ANMReportData(anmX, "CASE 3", indicator1, date2), - new ANMReportData(anmX, "CASE 4", indicator1, date2))); - when(anmReportDataRepository.fetchByANMIdAndDate("ANM Y", parse("2012-03-26").toDate())).thenReturn(asList( - new ANMReportData(anmY, "CASE 5", indicator2, date3), - new ANMReportData(anmY, "CASE 6", indicator2, date3))); - when(annualTargetsRepository.fetchFor("ANM X", indicator1, parse("2012-06-30").toDate())).thenReturn(new AnnualTarget(1, 1, "40", parse("2012-03-26").toDate(), parse("2013-03-25").toDate())); - when(annualTargetsRepository.fetchFor("ANM Y", indicator2, parse("2012-06-30").toDate())).thenReturn(new AnnualTarget(1, 1, "30", parse("2012-03-26").toDate(), parse("2013-03-25").toDate())); - when(anmRepository.fetchAll()).thenReturn(asList(anmX, anmY)); - - List anmReports = repository.fetchAllANMsReport(); - - ANMReport anmXReport = new ANMReport("ANM X", asList(createSummaryForIUD())); - ANMReport anmYReport = new ANMReport("ANM Y", asList(createSummaryForANC())); - - assertTrue(anmReports.containsAll(asList(anmXReport, anmYReport))); - assertEquals(2, anmReports.size()); - } - - @Test - public void shouldUpdateAllIndicatorsForReportingMonthForAllANMS() { - String anmIdentifier = "ANM X"; - String externalId = "EC CASE 1"; - String indicator = "INDICATOR 1"; - String reportDate = "2013-01-26"; - Date date = parse(reportDate).toDate(); - - Indicator fetchedIndicator = new Indicator(2, indicator); - ANM anm = new ANM(2, anmIdentifier); - HashMap data = new HashMap(); - data.put(SERVICE_PROVIDER_TYPE, "ANM"); - data.put(SERVICE_PROVIDED_DATE, reportDate); - data.put(EXTERNAL_ID, externalId); - data.put(PHC, "phc"); - data.put(QUANTITY, "1"); - data.put(INDICATOR, indicator); - data.put(ANM_IDENTIFIER, anmIdentifier); - - ReportingData reportingData = new ReportingData("type", data) - .withQuantity("1"); - - ReportDataUpdateRequest request = new ReportDataUpdateRequest().withType("type") - .withIndicator(indicator) - .withStartDate("2013-01-26") - .withEndDate("2013-02-25") - .withReportingData(asList(reportingData)); - - when(anmRepository.fetch(new ANM((anmIdentifier)))).thenReturn(anm); - when(indicatorRepository.fetch(new Indicator(indicator))).thenReturn(fetchedIndicator); - - repository.update(request); - - verify(anmReportDataRepository).delete("INDICATOR 1", "2013-01-26", "2013-02-25"); - verify(anmReportDataRepository).save(anm, externalId, fetchedIndicator, date); - } - - @Test - public void shouldCallANMReportRepositoryForReports() { - repository.getReportsFor("ANM X", "2013-10-26", "2013-11-25"); - - verify(anmReportDataRepository).getReportsFor("ANM X", "2013-10-26", "2013-11-25"); - } - - @Test - public void shouldDeleteANMReportsForGivenExternalId() { - ReportDataDeleteRequest request = new ReportDataDeleteRequest() - .withType("type") - .withDristhiEntityId("entity id 1"); - repository.delete(request); - verify(anmReportDataRepository).deleteReportsForExternalId("entity id 1"); - } - - private void verifyCallsToReadOnlyCachedRepository(ReadOnlyCacheableRepository repo, T object) { - verify(repo, times(1)).fetch(object); - verifyNoMoreInteractions(repo); - } - - - private void verifyCallsToCachedRepository(CacheableRepository blah, T obj) { - verify(blah, times(1)).fetch(obj); - verify(blah, times(0)).save(obj); - verifyNoMoreInteractions(blah); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/ServicesProvidedRepositoryTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/ServicesProvidedRepositoryTest.java deleted file mode 100755 index f79c2f7422..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/ServicesProvidedRepositoryTest.java +++ /dev/null @@ -1,183 +0,0 @@ -package org.opensrp.reporting.repository; - -import org.opensrp.common.domain.ReportDataDeleteRequest; -import org.opensrp.common.domain.ReportDataUpdateRequest; -import org.opensrp.common.domain.ReportingData; -import org.opensrp.common.monitor.Monitor; -import org.opensrp.reporting.domain.*; -import org.joda.time.LocalDate; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; - -import java.util.Date; -import java.util.HashMap; - -import static java.util.Arrays.asList; -import static org.opensrp.common.AllConstants.ReportDataParameters.*; -import static org.mockito.Mockito.*; -import static org.mockito.MockitoAnnotations.initMocks; -import org.opensrp.reporting.domain.Indicator; -import org.opensrp.reporting.domain.Location; -import org.opensrp.reporting.domain.PHC; -import org.opensrp.reporting.domain.ServiceProvider; - -import org.opensrp.reporting.repository.AllLocationsRepository; -import org.opensrp.reporting.repository.AllServiceProvidersRepository; -import org.opensrp.reporting.repository.AllServicesProvidedRepository; -import org.opensrp.reporting.repository.ServicesProvidedRepository; -import org.opensrp.reporting.repository.cache.CacheableRepository; -import org.opensrp.reporting.repository.cache.IndicatorCacheableRepository; -import org.opensrp.reporting.repository.cache.ReadOnlyCacheableRepository; - -import static org.opensrp.reporting.domain.ServiceProviderType.ANM; - -public class ServicesProvidedRepositoryTest { - @Mock - private IndicatorCacheableRepository indicatorRepository; - - @Mock - private AllLocationsRepository locationRepository; - - @Mock - private AllServiceProvidersRepository serviceProvidersRepository; - - @Mock - private AllServicesProvidedRepository servicesProvidedRepository; - - @Mock - private Monitor monitor; - - private ServicesProvidedRepository repository; - - @Before - public void setUp() throws Exception { - initMocks(this); - repository = new ServicesProvidedRepository(indicatorRepository, locationRepository, serviceProvidersRepository, servicesProvidedRepository, monitor); - } - - @Test - public void shouldSaveReportDataAndUseCachedRepositories() throws Exception { - String anmIdentifier = "ANM X"; - String externalId = "12345"; - String indicator = "ANC"; - String village = "Bherya"; - String subCenter = "Sub Center"; - Date date = LocalDate.parse("2012-04-04").toDate(); - PHC phc = new PHC(34, "PHC X", "PHC"); - String dristhiEntityId = "entity id 1"; - ServiceProvider serviceProvider = new ServiceProvider(2, 2, ANM); - Indicator fetchedIndicator = new Indicator(2, indicator); - Location location = new Location(2, village, subCenter, phc, "taluka", "mysore", "karnataka"); - when(serviceProvidersRepository.fetchBy("ANM X", ANM)).thenReturn(serviceProvider); - when(indicatorRepository.fetch(new Indicator(indicator))).thenReturn(fetchedIndicator); - when(locationRepository.fetchBy(village, subCenter, phc.phcIdentifier())).thenReturn(location); - - repository.save(anmIdentifier, "ANM", externalId, indicator, "2012-04-04", village, subCenter, phc.phcIdentifier(), null, dristhiEntityId); - repository.save(anmIdentifier, "ANM", externalId, indicator, "2012-04-04", village, subCenter, phc.phcIdentifier(), null, dristhiEntityId); - - verifyCallsToReadOnlyCachedRepository(indicatorRepository, new Indicator(indicator)); - verify(locationRepository, times(2)).fetchBy(village, subCenter, phc.phcIdentifier()); - verify(serviceProvidersRepository, times(2)).fetchBy(anmIdentifier, ANM); - verify(servicesProvidedRepository, times(2)).save(serviceProvider, "12345", fetchedIndicator, date, location, dristhiEntityId); - } - - @Test - public void shouldSaveAsPerQuantityIfQuantityIsNotNull() throws Exception { - String anmIdentifier = "ANM X"; - String externalId = "12345"; - String indicator = "ANC"; - String village = "Bherya"; - String subCenter = "Sub Center"; - String dristhiEntityId = "entity id 1"; - Date date = LocalDate.parse("2012-04-04").toDate(); - PHC phc = new PHC(34, "PHC X", "PHC"); - - ServiceProvider serviceProvider = new ServiceProvider(2, 2, ANM); - Indicator fetchedIndicator = new Indicator(2, indicator); - Location location = new Location(2, village, subCenter, phc, "taluka", "mysore", "karnataka"); - when(serviceProvidersRepository.fetchBy("ANM X", ANM)).thenReturn(serviceProvider); - when(indicatorRepository.fetch(new Indicator(indicator))).thenReturn(fetchedIndicator); - when(locationRepository.fetchBy(village, subCenter, phc.phcIdentifier())).thenReturn(location); - - repository.save(anmIdentifier, "ANM", externalId, indicator, "2012-04-04", village, subCenter, phc.phcIdentifier(), "40", dristhiEntityId); - - verify(servicesProvidedRepository, times(40)).save(serviceProvider, "12345", fetchedIndicator, date, location, dristhiEntityId); - } - - @Test - public void shouldUpdateListOfServiceProvidedIndicatorRowsForReportingMonthForAllANMs() throws Exception { - String anmIdentifier = "ANM X"; - String externalId = "12345"; - String indicator = "INDICATOR 1"; - String village = "Bherya"; - String subCenter = "Sub Center"; - String startDate = "2013-01-26"; - String endDate = "2013-02-25"; - - HashMap data = new HashMap(); - data.put(SERVICE_PROVIDER_TYPE, "ANM"); - data.put(EXTERNAL_ID, externalId); - data.put(SERVICE_PROVIDED_DATE, startDate); - data.put(VILLAGE, village); - data.put(SUB_CENTER, subCenter); - data.put(PHC,"phc"); - data.put(QUANTITY, "1"); - data.put(INDICATOR, indicator); - data.put(ANM_IDENTIFIER, anmIdentifier); - data.put(DRISTHI_ENTITY_ID, "entity id 1"); - ReportingData reportingData = new ReportingData("type", data); - - ReportDataUpdateRequest request = new ReportDataUpdateRequest() - .withType("type") - .withIndicator(indicator) - .withStartDate(startDate) - .withEndDate(endDate) - .withReportingData(asList(reportingData)); - - Date date = LocalDate.parse(startDate).toDate(); - PHC phc = new PHC(34, "phc", "PHC"); - - ServiceProvider serviceProvider = new ServiceProvider(2, 2, ANM); - Indicator fetchedIndicator = new Indicator(2, indicator); - Location location = new Location(2, village, subCenter, phc, "taluka", "mysore", "karnataka"); - when(serviceProvidersRepository.fetchBy(anmIdentifier, ANM)).thenReturn(serviceProvider); - when(indicatorRepository.fetch(new Indicator(indicator))).thenReturn(fetchedIndicator); - when(locationRepository.fetchBy(village, subCenter, phc.phcIdentifier())).thenReturn(location); - - repository.update(request); - - verify(servicesProvidedRepository).delete(indicator, startDate, endDate); - verify(servicesProvidedRepository).save(serviceProvider, "12345", fetchedIndicator, date, location, "entity id 1"); - } - - @Test - public void shouldDeleteAllReportsForGivenDristhiEntityID() throws Exception { - ReportDataDeleteRequest request = new ReportDataDeleteRequest() - .withType("type") - .withDristhiEntityId("entity id 1"); - - repository.delete(request); - - verify(servicesProvidedRepository).deleteReportsFor("entity id 1"); - } - - @Test - public void shouldCallServiceProvidedRepositoryForReports() { - repository.getNewReports(1232); - - verify(servicesProvidedRepository).getNewReports(1232); - } - - - private void verifyCallsToReadOnlyCachedRepository(ReadOnlyCacheableRepository repo, T object) { - verify(repo, times(1)).fetch(object); - verifyNoMoreInteractions(repo); - } - - private void verifyCallsToCachedRepository(CacheableRepository repo, T object) { - verify(repo, times(1)).fetch(object); - verify(repo, times(0)).save(object); - verifyNoMoreInteractions(repo); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/TestANMReportDataAccessTemplate.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/TestANMReportDataAccessTemplate.java deleted file mode 100755 index 29702d6f9d..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/TestANMReportDataAccessTemplate.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.opensrp.reporting.repository; - -import org.hibernate.SessionFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Scope; -import org.springframework.orm.hibernate3.HibernateTemplate; -import org.springframework.stereotype.Component; - -@Component -@Scope(value = "prototype") -public class TestANMReportDataAccessTemplate extends HibernateTemplate { - @Autowired - public TestANMReportDataAccessTemplate(@Qualifier(value = "anmReportsSessionFactory") SessionFactory sessionFactory) { - super(sessionFactory); - setAllowCreate(true); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/TestServiceProvidedDataAccessTemplate.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/TestServiceProvidedDataAccessTemplate.java deleted file mode 100755 index 7d4ae78dc0..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/TestServiceProvidedDataAccessTemplate.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.opensrp.reporting.repository; - -import org.hibernate.SessionFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Scope; -import org.springframework.orm.hibernate3.HibernateTemplate; -import org.springframework.stereotype.Component; - -@Component -@Scope(value = "prototype") -public class TestServiceProvidedDataAccessTemplate extends HibernateTemplate { - @Autowired - public TestServiceProvidedDataAccessTemplate(@Qualifier(value = "serviceProvidedSessionFactory") SessionFactory sessionFactory) { - super(sessionFactory); - setAllowCreate(true); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/cache/ReadOnlyCachingRepositoryTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/cache/ReadOnlyCachingRepositoryTest.java deleted file mode 100755 index 40defac72b..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/cache/ReadOnlyCachingRepositoryTest.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.opensrp.reporting.repository.cache; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.*; -import static org.mockito.MockitoAnnotations.initMocks; -import org.opensrp.reporting.domain.ANM; -import org.opensrp.reporting.domain.Indicator; -import org.opensrp.reporting.repository.cache.ANMCacheableRepository; -import org.opensrp.reporting.repository.cache.IndicatorCacheableRepository; -import org.opensrp.reporting.repository.cache.ReadOnlyCacheableRepository; -import org.opensrp.reporting.repository.cache.ReadOnlyCachingRepository; - -public class ReadOnlyCachingRepositoryTest { - @Mock - private ANMCacheableRepository anmsRepository; - @Mock - private IndicatorCacheableRepository indicatorRepository; - - @Before - public void setUp() throws Exception { - initMocks(this); - } - - @Test - public void shouldOnlyFetchNewANMsAndFetchOldOnesFromCache() throws Exception { - assertCacheableReadOnly(anmsRepository, new FactoryForReadOnlyCache() { - @Override - public ANM objectNotInDB() { - return new ANM(1, "ANM Y"); - } - - @Override - public ANM objectInDB() { - return new ANM(4, "ANM X"); - } - }); - } - - @Test - public void shouldOnlyFetchNewIndicationsAndFetchOldOnesFromCache() throws Exception { - assertCacheableReadOnly(indicatorRepository, new FactoryForReadOnlyCache() { - @Override - public Indicator objectNotInDB() { - return new Indicator(1, "BCG"); - } - - @Override - public Indicator objectInDB() { - return new Indicator(4, "IUD"); - } - }); - } - - private void assertCacheableReadOnly(ReadOnlyCacheableRepository cacheableRepository, final FactoryForReadOnlyCache factory) { - ReadOnlyCachingRepository repository = new ReadOnlyCachingRepository<>(cacheableRepository); - - T objectInDB = factory.objectInDB(); - T objectNotInDB = factory.objectNotInDB(); - when(cacheableRepository.fetch(objectInDB)).thenReturn(objectInDB); - when(cacheableRepository.fetch(objectNotInDB)).thenReturn(null); - - assertEquals(objectInDB, repository.fetch(objectInDB)); - assertEquals(objectInDB, repository.fetch(objectInDB)); - assertEquals(null, repository.fetch(objectNotInDB)); - - verify(cacheableRepository, times(1)).fetch(objectInDB); - verify(cacheableRepository, times(1)).fetch(objectNotInDB); - verifyNoMoreInteractions(cacheableRepository); - } - - private abstract class FactoryForReadOnlyCache { - public abstract T objectNotInDB(); - - public abstract T objectInDB(); - } - - -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/ANMReportDataIntegrationTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/ANMReportDataIntegrationTest.java deleted file mode 100755 index c3e1a53588..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/ANMReportDataIntegrationTest.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.opensrp.reporting.repository.it; - -import org.joda.time.LocalDate; -import org.junit.Test; -import org.opensrp.reporting.domain.ANM; -import org.opensrp.reporting.domain.ANMReportData; -import org.opensrp.reporting.domain.Indicator; -import org.opensrp.reporting.repository.AllANMReportDataRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.annotation.Rollback; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Date; -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertTrue; - -public class ANMReportDataIntegrationTest extends ANMReportsIntegrationTestBase { - @Autowired - private AllANMReportDataRepository repository; - - @Test - @Transactional("anm_report") - @Rollback - public void shouldSaveANMReportData() throws Exception { - ANM anm = new ANM("ANM X"); - Date dates = LocalDate.now().toDate(); - Indicator indicator = new Indicator("ANC Indicator"); - template.save(anm); - template.save(indicator); - - repository.save(anm, "EC CASE X", indicator, dates); - - assertEquals(1, template.loadAll(ANMReportData.class).size()); - } - - @Test - @Transactional("anm_report") - @Rollback - public void shouldLoadDataWithDimensions() throws Exception { - ANM anm = new ANM("ANM X"); - Date dates = LocalDate.now().toDate(); - Indicator indicator = new Indicator("ANC Indicator"); - template.save(anm); - template.save(indicator); - - repository.save(anm, "EC CASE X", indicator, dates); - - ANMReportData anmReportData = template.loadAll(ANMReportData.class).get(0); - - assertEquals(indicator, anmReportData.indicator()); - assertEquals(dates, anmReportData.date()); - } - - @Test - @Transactional("anm_report") - @Rollback - public void shouldFetchReportDataByANMIdAndDate() throws Exception { - ANM anm1 = new ANM("ANM X"); - ANM anm2 = new ANM("ANM Y"); - Date date = LocalDate.parse("2012-03-31").toDate(); - Indicator indicator = new Indicator("ANC Indicator"); - template.save(anm1); - template.save(anm2); - template.save(indicator); - repository.save(anm1, "EC CASE X", indicator, date); - repository.save(anm2, "EC CASE Y", indicator, date); - - List anmReportDataList = repository.fetchByANMIdAndDate(anm1.anmIdentifier(), LocalDate.parse("2012-01-01").toDate()); - - assertTrue(anmReportDataList.contains(new ANMReportData(anm1, "EC CASE X", indicator, date))); - assertEquals(1, anmReportDataList.size()); - } - - @Test - @Transactional("anm_report") - @Rollback - public void shouldFetchReportDataOnOrAfterGivenDate() throws Exception { - ANM anm1 = new ANM("ANM X"); - ANM anm2 = new ANM("ANM Y"); - Date dates1 = LocalDate.parse("2012-03-30").toDate(); - Date dates2 = LocalDate.parse("2012-03-31").toDate(); - Date dates3 = LocalDate.parse("2012-04-01").toDate(); - Indicator indicator = new Indicator("ANC Indicator"); - template.save(anm1); - template.save(anm2); - template.save(indicator); - repository.save(anm1, "EC CASE X", indicator, dates1); - repository.save(anm1, "EC CASE X", indicator, dates2); - repository.save(anm1, "EC CASE X", indicator, dates3); - repository.save(anm2, "EC CASE Y", indicator, dates2); - - List anmReportDataList = repository.fetchByANMIdAndDate(anm1.anmIdentifier(), LocalDate.parse("2012-03-31").toDate()); - - assertTrue(anmReportDataList.contains(new ANMReportData(anm1, "EC CASE X", indicator, dates2))); - assertTrue(anmReportDataList.contains(new ANMReportData(anm1, "EC CASE X", indicator, dates3))); - assertEquals(2, anmReportDataList.size()); - } - - @Test - @Transactional("anm_report") - @Rollback - public void shouldDeleteAllIndicatorsForReportingMonthForAllANMs() throws Exception { - ANM anm = new ANM("ANM X"); - Date startDate = LocalDate.parse("2013-01-26").toDate(); - Date endDate = LocalDate.parse("2013-02-25").toDate(); - Indicator indicator = new Indicator("ANC Indicator"); - template.save(anm); - template.save(indicator); - - repository.delete("ANC Indicator", "2013-01-26", "2013-02-25"); - - assertEquals(0, template.loadAll(ANMReportData.class).size()); - } - - @Test - @Transactional("anm_report") - @Rollback - public void shouldFetchANMReportDataForReportingMonth() throws Exception { - ANM anm = new ANM("ANM X"); - Date startDate = LocalDate.parse("2012-10-26").toDate(); - Indicator indicator = new Indicator("INDICATOR 1"); - template.save(anm); - template.save(indicator); - repository.save(anm, "123", indicator, startDate); - - List result = repository.getReportsFor("ANM X", "2012-10-26", "2012-11-25"); - - assertEquals(1, result.size()); - } - - @Test - @Transactional("anm_report") - @Rollback - public void shouldFetchAllReportDataForGivenExternalId() throws Exception { - ANM anm = new ANM("ANM X"); - Date startDate = LocalDate.parse("2012-10-26").toDate(); - Indicator indicator = new Indicator("INDICATOR 1"); - String externalId = "entity id 1"; - template.save(anm); - template.save(indicator); - repository.save(anm, externalId, indicator, startDate); - - List result = repository.getReportsForExternalId("entity id 1"); - - assertEquals(1, result.size()); - } - - @Test - @Transactional("anm_report") - @Rollback - public void shouldDeleteAllReportDataForGivenExternalId() throws Exception { - ANM anm = new ANM("ANM X"); - Date startDate = LocalDate.parse("2012-10-26").toDate(); - Indicator indicator = new Indicator("INDICATOR 1"); - String externalId = "entity id 1"; - String anotherExternalId = "entity id 2"; - template.save(anm); - template.save(indicator); - repository.save(anm, externalId, indicator, startDate); - repository.save(anm, anotherExternalId, indicator, startDate); - - repository.deleteReportsForExternalId("entity id 1"); - - assertEquals(0, repository.getReportsForExternalId("entity id 1").size()); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/ANMReportsIntegrationTestBase.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/ANMReportsIntegrationTestBase.java deleted file mode 100755 index c5182874b1..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/ANMReportsIntegrationTestBase.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.opensrp.reporting.repository.it; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.reporting.repository.TestANMReportDataAccessTemplate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:spring/applicationContext-opensrp-reporting-test.xml") -public class ANMReportsIntegrationTestBase { - @Autowired - protected TestANMReportDataAccessTemplate template; - - @Test - public void test(){ - - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllANMsRepositoryIntegrationTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllANMsRepositoryIntegrationTest.java deleted file mode 100755 index 2d4f8530fa..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllANMsRepositoryIntegrationTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.opensrp.reporting.repository.it; - -import org.junit.Test; -import org.opensrp.reporting.domain.ANM; -import org.opensrp.reporting.repository.AllANMsRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.annotation.Rollback; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -import static java.util.Arrays.asList; -import static junit.framework.Assert.assertTrue; - -public class AllANMsRepositoryIntegrationTest extends ANMReportsIntegrationTestBase { - @Autowired - private AllANMsRepository repository; - - @Test - @Transactional("anm_report") - @Rollback - public void shouldFetchAllANMs() throws Exception { - ANM anmX = new ANM("ANM X"); - ANM anmY = new ANM("ANM Y"); - template.save(anmX); - template.save(anmY); - - List anms = repository.fetchAll(); - - assertTrue(anms.containsAll(asList(anmX, anmY))); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllAnnualTargetsRepositoryIntegrationTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllAnnualTargetsRepositoryIntegrationTest.java deleted file mode 100755 index 71c45ab866..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllAnnualTargetsRepositoryIntegrationTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.opensrp.reporting.repository.it; - -import org.junit.Test; -import org.opensrp.reporting.domain.ANM; -import org.opensrp.reporting.domain.AnnualTarget; -import org.opensrp.reporting.domain.Indicator; -import org.opensrp.reporting.repository.AllAnnualTargetsRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.annotation.Rollback; -import org.springframework.transaction.annotation.Transactional; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNull; -import static org.joda.time.LocalDate.parse; - -public class AllAnnualTargetsRepositoryIntegrationTest extends ANMReportsIntegrationTestBase { - @Autowired - private AllAnnualTargetsRepository repository; - - @Test - @Transactional("anm_report") - @Rollback - public void shouldFetchAnnualTargetForGivenANMAndIndicator() throws Exception { - Indicator indicator = new Indicator("INDICATOR"); - ANM anm = new ANM("ANM X"); - template.save(indicator); - template.save(anm); - template.save(new AnnualTarget(anm.id(), indicator.id(), "40", parse("2012-03-26").toDate(), parse("2013-03-25").toDate())); - - AnnualTarget annualTarget = repository.fetchFor(anm.anmIdentifier(), indicator, parse("2012-03-31").toDate()); - - assertEquals("40", annualTarget.target()); - } - - @Test - @Transactional("anm_report") - @Rollback - public void shouldFetchNoAnnualTargetIfReportDateIsNotWithinRange() throws Exception { - Indicator indicator = new Indicator("INDICATOR"); - ANM anm = new ANM("ANM X"); - template.save(indicator); - template.save(anm); - template.save(new AnnualTarget(anm.id(), indicator.id(), "40", parse("2012-03-26").toDate(), parse("2013-03-25").toDate())); - - AnnualTarget annualTarget = repository.fetchFor(anm.anmIdentifier(), indicator, parse("2012-02-28").toDate()); - - assertNull(annualTarget); - } - - @Test - @Transactional("anm_report") - @Rollback - public void shouldFetchAnnualTargetIfReportDateIsStartOrEndOfRange() throws Exception { - Indicator firstIndicator = new Indicator("INDICATOR1"); - Indicator secondIndicator = new Indicator("INDICATOR2"); - ANM anm = new ANM("ANM X"); - template.save(firstIndicator); - template.save(secondIndicator); - template.save(anm); - template.save(new AnnualTarget(anm.id(), firstIndicator.id(), "40", parse("2012-03-26").toDate(), parse("2013-03-25").toDate())); - template.save(new AnnualTarget(anm.id(), secondIndicator.id(), "80", parse("2012-03-26").toDate(), parse("2013-03-25").toDate())); - - AnnualTarget annualTargetForFirstIndicator = repository.fetchFor(anm.anmIdentifier(), firstIndicator, parse("2012-03-26").toDate()); - AnnualTarget annualTargetForSecondIndicator = repository.fetchFor(anm.anmIdentifier(), secondIndicator, parse("2013-03-25").toDate()); - - assertEquals("40", annualTargetForFirstIndicator.target()); - assertEquals("80", annualTargetForSecondIndicator.target()); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllIndicatorsRepositoryIntegrationTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllIndicatorsRepositoryIntegrationTest.java deleted file mode 100755 index 305a67bdef..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllIndicatorsRepositoryIntegrationTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.opensrp.reporting.repository.it; - -import org.junit.Test; -import org.opensrp.reporting.domain.Indicator; -import org.opensrp.reporting.repository.AllIndicatorsRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.test.annotation.Rollback; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -import static java.util.Arrays.asList; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertTrue; - -public class AllIndicatorsRepositoryIntegrationTest extends ServicesProvidedIntegrationTestBase { - @Autowired - @Qualifier("serviceProvidedIndicatorRepository") - private AllIndicatorsRepository repository; - - @Test - @Transactional("service_provided") - @Rollback - public void shouldSaveAndFetchIndicator() throws Exception { - Indicator indicator = new Indicator("ANC indicator"); - template.save(indicator); - - Indicator fetchedIndicator = repository.fetch(indicator); - assertEquals(indicator.indicator(), fetchedIndicator.indicator()); - assertTrue("ID should be non-zero.", fetchedIndicator.id() != 0); - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldFetchAllIndicators() throws Exception { - Indicator indicator1 = new Indicator("ANC indicator"); - Indicator indicator2 = new Indicator("IUD indicator"); - template.save(indicator1); - template.save(indicator2); - - List indicators = repository.fetchAll(); - - assertTrue(indicators.containsAll(asList(indicator1, indicator2))); - assertTrue("ID should be non-zero.", indicators.get(0).id() != 0); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllLocationsRepositoryIntegrationTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllLocationsRepositoryIntegrationTest.java deleted file mode 100755 index 02658f34db..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllLocationsRepositoryIntegrationTest.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.opensrp.reporting.repository.it; - -import org.junit.Test; -import org.opensrp.reporting.domain.Location; -import org.opensrp.reporting.domain.PHC; -import org.opensrp.reporting.domain.SP_ANM; -import org.opensrp.reporting.repository.AllLocationsRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.annotation.Rollback; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertTrue; - -public class AllLocationsRepositoryIntegrationTest extends ServicesProvidedIntegrationTestBase { - @Autowired - private AllLocationsRepository repository; - - @Test - @Transactional("service_provided") - @Rollback - public void shouldFetchLocationByVillageSCAndPHC() throws Exception { - PHC phc = new PHC("PHC X", "Bherya"); - PHC anotherPHC = new PHC("PHC Y", "Bherya"); - template.save(phc); - template.save(anotherPHC); - Location location = new Location("Bherya", "Sub Center", phc, "taluka", "mysore", "karnataka"); - Location anotherLocation = new Location("Keelanapura", "Sub Center 2", anotherPHC, "taluka", "mysore", "karnataka"); - template.save(location); - template.save(anotherLocation); - - Location fetchedLocation = repository.fetchBy("Bherya", "Sub Center", "PHC X"); - - assertEquals("Bherya", fetchedLocation.village()); - assertEquals("Sub Center", fetchedLocation.subCenter()); - assertEquals(phc, fetchedLocation.phc()); - assertEquals("taluka", fetchedLocation.taluka()); - assertEquals("mysore", fetchedLocation.district()); - assertEquals("karnataka", fetchedLocation.state()); - assertTrue("ID should be non-zero.", fetchedLocation.id() != 0); - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldFetchLocationByANMIdentifier() throws Exception { - PHC phc = new PHC("PHC X", "Bherya"); - PHC anotherPHC = new PHC("PHC Y", "Bherya"); - template.save(phc); - template.save(anotherPHC); - Location location = new Location("Bherya", "Sub Center", phc, "taluka", "mysore", "karnataka"); - Location anotherLocation = new Location("Keelanapura", "Sub Center 2", anotherPHC, "taluka", "mysore", "karnataka"); - template.save(location); - template.save(anotherLocation); - SP_ANM anm = new SP_ANM("anm1", "anm1 name", "Sub Center", phc.id()); - SP_ANM anotherANMForPHCX = new SP_ANM("anm2", "anm2 name", "Sub Center 1", phc.id()); - SP_ANM anmForPHCY = new SP_ANM("anm3", "anm3 name", "Sub Center 2", anotherPHC.id()); - template.save(anm); - template.save(anotherANMForPHCX); - template.save(anmForPHCY); - - Location fetchedLocation = repository.fetchByANMIdentifier("anm1"); - - assertEquals("Bherya", fetchedLocation.village()); - assertEquals("Sub Center", fetchedLocation.subCenter()); - assertEquals(phc, fetchedLocation.phc()); - assertEquals("taluka", fetchedLocation.taluka()); - assertEquals("mysore", fetchedLocation.district()); - assertEquals("karnataka", fetchedLocation.state()); - assertTrue("ID should be non-zero.", fetchedLocation.id() != 0); - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldFetchAllVillagesFromPHCAndSubCenterOfANM() throws Exception { - PHC phc = new PHC("PHC X", "Bherya"); - PHC anotherPHC = new PHC("PHC Y", "Bherya"); - template.save(phc); - template.save(anotherPHC); - Location village1InBheryaPHC = new Location("Village 1", "Sub Center 1", phc, "taluka", "mysore", "karnataka"); - Location village2InBheryaPHC = new Location("Village 2", "Sub Center 1", phc, "taluka", "mysore", "karnataka"); - Location anotherVillageInBheryaPHC = new Location("Village", "Sub Center 2", phc, "taluka", "mysore", "karnataka"); - Location villageInKeelanpuraPHC = new Location("Keelanapura", "Sub Center 2", anotherPHC, "taluka", "mysore", "karnataka"); - SP_ANM anm = new SP_ANM("anm1", "anm1 name", "Sub Center 1", phc.id()); - - template.save(village1InBheryaPHC); - template.save(village2InBheryaPHC); - template.save(anotherVillageInBheryaPHC); - template.save(villageInKeelanpuraPHC); - template.save(anm); - - List villages = repository.fetchVillagesForANM(anm.identifier()); - - assertEquals(2, villages.size()); - assertTrue(villages.contains(new Location("Village 1", "Sub Center 1", phc, "taluka", "mysore", "karnataka"))); - assertTrue(villages.contains(new Location("Village 2", "Sub Center 1", phc, "taluka", "mysore", "karnataka"))); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllSP_ANMsRepositoryIntegrationTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllSP_ANMsRepositoryIntegrationTest.java deleted file mode 100755 index 788bbb9080..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllSP_ANMsRepositoryIntegrationTest.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.opensrp.reporting.repository.it; - -import org.junit.Test; -import org.opensrp.reporting.domain.PHC; -import org.opensrp.reporting.domain.SP_ANM; -import org.opensrp.reporting.repository.AllSP_ANMsRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.annotation.Rollback; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -import static java.util.Arrays.asList; -import static junit.framework.Assert.assertTrue; - -public class AllSP_ANMsRepositoryIntegrationTest extends ServicesProvidedIntegrationTestBase { - @Autowired - private AllSP_ANMsRepository repository; - - @Test - @Transactional("service_provided") - @Rollback - public void shouldFetchAllANMs() throws Exception { - PHC phc1 = new PHC("phc1", "PHC 1"); - PHC phc2 = new PHC("phc2", "PHC 2"); - template.save(phc1); - template.save(phc2); - SP_ANM anm1 = new SP_ANM("ANM 1", "anm1 name", "Sub Center 1", phc1.id()); - SP_ANM anm2 = new SP_ANM("ANM 2", "anm2 name", "Sub Center 1", phc2.id()); - template.save(anm1); - template.save(anm2); - - List anmList = repository.fetchAll(); - - assertTrue(anmList.containsAll(asList(anm1, anm2))); - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldFetchAllANMsInTheSameSC() throws Exception { - PHC phc1 = new PHC("phc1", "PHC 1"); - PHC phc2 = new PHC("phc2", "PHC 2"); - template.save(phc1); - template.save(phc2); - SP_ANM anm1 = new SP_ANM("ANM 1", "anm1 name", "Sub Center 1", phc1.id()); - SP_ANM anm2 = new SP_ANM("ANM 2", "anm2 name", "Sub Center 1", phc1.id()); - SP_ANM anm3 = new SP_ANM("ANM 3", "anm3 name", "Sub Center 2", phc1.id()); - template.save(anm1); - template.save(anm2); - template.save(anm3); - - List anmList = repository.fetchAllANMSInSameSC("ANM 1"); - - assertTrue(anmList.containsAll(asList(anm1, anm2))); - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldFetchAllANMsInTheSamePHC() throws Exception { - PHC phc1 = new PHC("phc1", "PHC 1"); - PHC phc2 = new PHC("phc2", "PHC 2"); - template.save(phc1); - template.save(phc2); - SP_ANM anm1 = new SP_ANM("ANM 1", "anm1 name", "Sub Center 1", phc1.id()); - SP_ANM anm2 = new SP_ANM("ANM 2", "anm2 name", "Sub Center 1", phc1.id()); - SP_ANM anm3 = new SP_ANM("ANM 3", "anm3 name", "Sub Center 2", phc2.id()); - template.save(anm1); - template.save(anm2); - template.save(anm3); - - List anmList = repository.fetchAllANMSInSamePHC("ANM 1"); - - assertTrue(anmList.containsAll(asList(anm1, anm2))); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllServiceProvidersRepositoryIntegrationTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllServiceProvidersRepositoryIntegrationTest.java deleted file mode 100755 index 2693cec1a5..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllServiceProvidersRepositoryIntegrationTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.opensrp.reporting.repository.it; - -import org.junit.Test; -import org.opensrp.reporting.domain.PHC; -import org.opensrp.reporting.domain.SP_ANM; -import org.opensrp.reporting.domain.ServiceProvider; -import org.opensrp.reporting.domain.ServiceProviderType; -import org.opensrp.reporting.repository.AllServiceProvidersRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.annotation.Rollback; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -import static ch.lambdaj.Lambda.having; -import static ch.lambdaj.Lambda.on; -import static ch.lambdaj.Lambda.selectUnique; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertTrue; -import static org.hamcrest.Matchers.equalTo; -import static org.opensrp.reporting.domain.ServiceProviderType.ANM; -import static org.opensrp.reporting.domain.ServiceProviderType.PHC; - -public class AllServiceProvidersRepositoryIntegrationTest extends ServicesProvidedIntegrationTestBase { - @Autowired - private AllServiceProvidersRepository repository; - - @Test - @Transactional("service_provided") - @Rollback - public void shouldFetchServiceProviderThatIsPHC() throws Exception { - PHC phc = new PHC("bhe", "Bherya"); - template.save(phc); - List serviceProviderTypes = template.loadAll(ServiceProviderType.class); - ServiceProviderType phcServiceProvider = selectUnique(serviceProviderTypes, having(on(ServiceProviderType.class).type(), equalTo(PHC.type()))); - ServiceProvider bheryaPHC = new ServiceProvider(phc.id(), phcServiceProvider); - template.save(bheryaPHC); - - ServiceProvider serviceProvider = repository.fetchBy(phc.phcIdentifier(), PHC); - - assertEquals(phc.id(), serviceProvider.serviceProviderId()); - assertTrue("ID should be non-zero.", serviceProvider.id() != 0); - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldFetchServiceProviderThatIsANM() throws Exception { - PHC phc = new PHC("bhe", "Bherya"); - template.save(phc); - SP_ANM anm = new SP_ANM("bhe1anm", "bhe1anm name", "Sub Center 1", phc.id()); - template.save(anm); - List serviceProviderTypes = template.loadAll(ServiceProviderType.class); - ServiceProviderType anmServiceProvider = selectUnique(serviceProviderTypes, having(on(ServiceProviderType.class).type(), equalTo(ANM.type()))); - ServiceProvider bheryaANM = new ServiceProvider(anm.id(), anmServiceProvider); - template.save(bheryaANM); - - ServiceProvider serviceProvider = repository.fetchBy(anm.identifier(), ANM); - - assertEquals(anm.id(), serviceProvider.serviceProviderId()); - assertTrue("ID should be non-zero.", serviceProvider.id() != 0); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllServicesProvidedIntegrationTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllServicesProvidedIntegrationTest.java deleted file mode 100755 index ebc2e3483d..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllServicesProvidedIntegrationTest.java +++ /dev/null @@ -1,229 +0,0 @@ -package org.opensrp.reporting.repository.it; - -import org.opensrp.reporting.domain.*; -import org.joda.time.LocalDate; -import org.junit.Test; -import org.opensrp.reporting.domain.Indicator; -import org.opensrp.reporting.domain.Location; -import org.opensrp.reporting.domain.PHC; -import org.opensrp.reporting.domain.SP_ANM; -import org.opensrp.reporting.domain.ServiceProvided; -import org.opensrp.reporting.domain.ServiceProvidedReport; -import org.opensrp.reporting.domain.ServiceProvider; -import org.opensrp.reporting.domain.ServiceProviderType; -import org.opensrp.reporting.domain.Token; -import org.opensrp.reporting.repository.AllServicesProvidedRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.annotation.Rollback; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Date; -import java.util.List; - -import static ch.lambdaj.Lambda.*; -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.*; -import static org.opensrp.reporting.domain.ServiceProviderType.ANM; - -public class AllServicesProvidedIntegrationTest extends ServicesProvidedIntegrationTestBase { - @Autowired - private AllServicesProvidedRepository repository; - - @Test - @Transactional("service_provided") - @Rollback - public void shouldSaveAService() throws Exception { - PHC phc = new PHC("bhe", "Bherya"); - template.save(phc); - SP_ANM anm = new SP_ANM("ANM X", "anmx name", "Sub Center 1", phc.id()); - template.save(anm); - Date dates = LocalDate.now().toDate(); - Indicator indicator = new Indicator("ANC indicator"); - Location location = new Location("Bherya", "Sub Center", phc, "taluka", "mysore", "karnataka"); - String dristhiEntityId = "entity id 1"; - List serviceProviderTypes = template.loadAll(ServiceProviderType.class); - ServiceProviderType anmServiceProvider = selectUnique(serviceProviderTypes, having(on(ServiceProviderType.class).type(), equalTo(ANM.type()))); - ServiceProvider serviceProvider = new ServiceProvider(anm.id(), anmServiceProvider); - template.save(location); - template.save(indicator); - template.save(serviceProvider); - - repository.save(serviceProvider, "123", indicator, dates, location, dristhiEntityId); - - List servicesProvided = template.loadAll(ServiceProvided.class); - assertTrue(servicesProvided.contains(new ServiceProvided(serviceProvider, "123", indicator, dates, location, dristhiEntityId))); - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldUpdateIndicatorForReportingMonth() throws Exception { - PHC phc = new PHC("bhe", "Bherya"); - template.save(phc); - SP_ANM anm = new SP_ANM("ANM X", "anmx name", "Sub Center 1", phc.id()); - template.save(anm); - Indicator indicatorToDelete = new Indicator("INDICATOR 1"); - Indicator otherIndicator = new Indicator("INDICATOR 2"); - Location location = new Location("Bherya", "Sub Center", phc, "taluka", "mysore", "karnataka"); - Date startDate = LocalDate.parse("2013-01-26").toDate(); - String dristhiEntityId = "entity id 1"; - List serviceProviderTypes = template.loadAll(ServiceProviderType.class); - ServiceProviderType anmServiceProvider = selectUnique(serviceProviderTypes, having(on(ServiceProviderType.class).type(), equalTo(ANM.type()))); - ServiceProvider serviceProvider = new ServiceProvider(anm.id(), anmServiceProvider); - template.save(location); - template.save(indicatorToDelete); - template.save(otherIndicator); - template.save(serviceProvider); - repository.save(serviceProvider, "123", indicatorToDelete, startDate, location, dristhiEntityId); - - repository.delete("INDICATOR 1", "2013-01-26", "2013-02-02"); - - List servicesProvided = template.loadAll(ServiceProvided.class); - assertFalse( - servicesProvided.contains( - new ServiceProvided(serviceProvider, null, indicatorToDelete, startDate, location, dristhiEntityId)) - ); - - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldFetchAllReportsWhenTokenIsZero() throws Exception { - createServiceProvidedData(); - - List reports = repository.getNewReports(0); - - assertTrue( - reports.contains( - new ServiceProvidedReport(1, "ANM X", ANM.type(), "INDICATOR", - LocalDate.parse("2013-01-26").toDate(), "Bherya", "Sub Center", "bhe", - "taluka", "mysore", "karnataka") - ) - ); - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldNotFetchNewReportsWhenTokenIsEqualToMostRecentReport() throws Exception { - createServiceProvidedData(); - List servicesProvided = template.loadAll(ServiceProvided.class); - ServiceProvided mostRecentServiceProvided = servicesProvided.get(servicesProvided.size() - 1); - Token token = new Token("aggregate-reports-token", mostRecentServiceProvided.id()); - template.save(token); - - List reports = repository.getNewReports(Integer.valueOf(token.value())); - - assertFalse( - reports.contains( - new ServiceProvidedReport(1, "ANM X", ANM.type(), "INDICATOR", - LocalDate.parse("2013-01-26").toDate(), "Bherya", "Sub Center", "bhe", - "taluka", "mysore", "karnataka") - ) - ); - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldNotFetchNewReportsWhenTokenValueIsHigherThanMostRecentReport() throws Exception { - createServiceProvidedData(); - List servicesProvided = template.loadAll(ServiceProvided.class); - ServiceProvided mostRecentServiceProvided = servicesProvided.get(servicesProvided.size() - 1); - Token token = new Token("aggregate-reports-token", mostRecentServiceProvided.id() + 1); - template.save(token); - - List reports = repository.getNewReports(Integer.valueOf(token.value())); - - assertFalse( - reports.contains( - new ServiceProvidedReport(1, "ANM X", ANM.type(), "INDICATOR", - LocalDate.parse("2013-01-26").toDate(), "Bherya", "Sub Center", "bhe", - "taluka", "mysore", "karnataka") - ) - ); - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldFetchOnlyAFixedBatchSizeOfReportsFromTheGivenToken() throws Exception { - createMultipleServiceProvidedData(); - - List reports = repository.getNewReports(0, 1); - - assertEquals(1, reports.size()); - assertTrue( - reports.contains( - new ServiceProvidedReport(1, "ANM X", ANM.type(), "INDICATOR", - LocalDate.parse("2013-01-26").toDate(), "Bherya", "Sub Center", "bhe", - "taluka", "mysore", "karnataka") - ) - ); - } - - private void createServiceProvidedData() { - PHC phc = new PHC("bhe", "Bherya"); - template.save(phc); - SP_ANM anm = new SP_ANM("ANM X", "anmx name", "Sub Center 1", phc.id()); - template.save(anm); - Indicator indicator = new Indicator("INDICATOR"); - Location location = new Location("Bherya", "Sub Center", phc, "taluka", "mysore", "karnataka"); - Date date = LocalDate.parse("2013-01-26").toDate(); - String dristhiEntityId = "entity id 1"; - List serviceProviderTypes = template.loadAll(ServiceProviderType.class); - ServiceProviderType anmServiceProvider = selectUnique(serviceProviderTypes, having(on(ServiceProviderType.class).type(), equalTo(ANM.type()))); - ServiceProvider serviceProvider = new ServiceProvider(anm.id(), anmServiceProvider); - template.save(location); - template.save(indicator); - template.save(serviceProvider); - repository.save(serviceProvider, "1", indicator, date, location, dristhiEntityId); - } - - private void createMultipleServiceProvidedData() { - PHC phc = new PHC("bhe", "Bherya"); - template.save(phc); - SP_ANM anm = new SP_ANM("ANM X", "anmx name", "Sub Center 1", phc.id()); - template.save(anm); - SP_ANM anm1 = new SP_ANM("ANM Y", "anmy name", "Sub Center 1", phc.id()); - template.save(anm1); - Indicator indicator = new Indicator("INDICATOR"); - Location location = new Location("Bherya", "Sub Center", phc, "taluka", "mysore", "karnataka"); - Date date = LocalDate.parse("2013-01-26").toDate(); - String dristhiEntityId = "entity id 1"; - List serviceProviderTypes = template.loadAll(ServiceProviderType.class); - ServiceProviderType anmServiceProvider = selectUnique(serviceProviderTypes, having(on(ServiceProviderType.class).type(), equalTo(ANM.type()))); - ServiceProvider serviceProvider = new ServiceProvider(anm.id(), anmServiceProvider); - ServiceProvider anotherServiceProvider = new ServiceProvider(anm1.id(), anmServiceProvider); - template.save(location); - template.save(indicator); - template.save(serviceProvider); - template.save(anotherServiceProvider); - - repository.save(serviceProvider, "1", indicator, date, location, dristhiEntityId); - repository.save(anotherServiceProvider, "2", indicator, date, location, dristhiEntityId); - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldDeleteServiceProvidedReportForAGivenEntityID() throws Exception { - createMultipleServiceProvidedData(); - - repository.deleteReportsFor("entity id 1"); - - assertEquals(0, repository.getAllReportsForDristhiEntityID("entity id 1").size()); - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldFetchAllServiceProvidedReportForAGivenEntityID() throws Exception { - createMultipleServiceProvidedData(); - - List reports = repository.getAllReportsForDristhiEntityID("entity id 1"); - - assertEquals(2, reports.size()); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllTokenRepositoryIntegrationTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllTokenRepositoryIntegrationTest.java deleted file mode 100755 index c9a796945c..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/AllTokenRepositoryIntegrationTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.opensrp.reporting.repository.it; - -import org.junit.Test; -import org.opensrp.reporting.domain.Token; -import org.opensrp.reporting.repository.AllTokensRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.annotation.Rollback; -import org.springframework.transaction.annotation.Transactional; - -import static org.junit.Assert.assertEquals; - -public class AllTokenRepositoryIntegrationTest extends ServicesProvidedIntegrationTestBase { - @Autowired - private AllTokensRepository repository; - - @Test - @Transactional("service_provided") - @Rollback - public void shouldFetchToken() throws Exception { - template.save(new Token("aggregate-reports-token", ((Integer) 1).toString())); - template.save(new Token("another-token", ((Integer) 2).toString())); - - assertEquals((Integer) 1, repository.getAggregateReportsToken()); - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldDefaultTokenToZeroWhenItDoesNotExist() throws Exception { - assertEquals((Integer) 0, repository.getAggregateReportsToken()); - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldCreateTokenWhenItDoesNotExist() throws Exception { - repository.saveAggregateReportsToken(2); - - assertEquals((Integer) 2, repository.getAggregateReportsToken()); - } - - @Test - @Transactional("service_provided") - @Rollback - public void shouldUpdateTokenWhenItExists() throws Exception { - template.save(new Token("aggregate-reports-token", ((Integer) 1).toString())); - - repository.saveAggregateReportsToken(2); - - assertEquals((Integer) 2, repository.getAggregateReportsToken()); - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/ServicesProvidedIntegrationTestBase.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/ServicesProvidedIntegrationTestBase.java deleted file mode 100755 index d04d551bea..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/repository/it/ServicesProvidedIntegrationTestBase.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.opensrp.reporting.repository.it; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.opensrp.reporting.repository.TestServiceProvidedDataAccessTemplate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:spring/applicationContext-opensrp-reporting-test.xml") -public class ServicesProvidedIntegrationTestBase { - @Autowired - protected TestServiceProvidedDataAccessTemplate template; - - @Test - public void test(){ - - } -} diff --git a/opensrp-reporting/src/test/java/org/opensrp/reporting/service/AggregateReportsServiceTest.java b/opensrp-reporting/src/test/java/org/opensrp/reporting/service/AggregateReportsServiceTest.java deleted file mode 100755 index 44960be394..0000000000 --- a/opensrp-reporting/src/test/java/org/opensrp/reporting/service/AggregateReportsServiceTest.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.opensrp.reporting.service; - -import com.google.gson.Gson; -import org.opensrp.common.domain.ReportMonth; -import org.opensrp.common.util.HttpAgent; -import org.opensrp.common.util.HttpResponse; -import org.joda.time.LocalDate; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.opensrp.dto.aggregatorResponse.AggregatorResponseDTO; -import org.opensrp.dto.report.ServiceProvidedReportDTO; -import org.opensrp.reporting.domain.ServiceProvidedReport; -import org.opensrp.reporting.repository.AllTokensRepository; -import org.opensrp.reporting.repository.ServicesProvidedRepository; -import org.opensrp.reporting.service.AggregateReportsService; - -import java.util.Collections; -import java.util.List; - -import static java.util.Arrays.asList; -import static org.opensrp.common.util.EasyMap.mapOf; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.*; -import static org.mockito.MockitoAnnotations.initMocks; - -public class AggregateReportsServiceTest { - - private AggregateReportsService aggregateReportsService; - private int batchSizeToUpdate = 10; - @Mock - private HttpAgent httpAgent; - @Mock - private AllTokensRepository tokenRepository; - @Mock - private ServicesProvidedRepository servicesProvidedRepository; - @Mock - private ReportMonth reportMonth; - - @Before - public void setUp() throws Exception { - initMocks(this); - aggregateReportsService = new AggregateReportsService("bamboo.url", "bamboo.aggregated.url", batchSizeToUpdate, httpAgent, tokenRepository, servicesProvidedRepository, reportMonth); - } - - @Test - public void shouldSendReportsWithNRHMReportingMonthToAggregator() throws Exception { - when(tokenRepository.getAggregateReportsToken()).thenReturn(0); - when(servicesProvidedRepository.getNewReports(0, batchSizeToUpdate)) - .thenReturn(asList(new ServiceProvidedReport().withId(1).withDate(LocalDate.parse("2012-11-26").toDate()), - new ServiceProvidedReport().withId(2).withDate(LocalDate.parse("2012-12-28").toDate()))); - when(reportMonth.reportingMonth(LocalDate.parse("2012-11-26"))).thenReturn(12); - when(reportMonth.reportingYear(LocalDate.parse("2012-11-26"))).thenReturn(2012); - - when(reportMonth.reportingMonth(LocalDate.parse("2012-12-28"))).thenReturn(1); - when(reportMonth.reportingYear(LocalDate.parse("2012-12-28"))).thenReturn(2013); - - String reportJson = new Gson().toJson(asList( - new ServiceProvidedReportDTO().withDate(LocalDate.parse("2012-11-26")).withNRHMReportMonth(12).withNRHMReportYear(2012).withId(1), - new ServiceProvidedReportDTO().withDate(LocalDate.parse("2012-12-28")).withNRHMReportMonth(1).withNRHMReportYear(2013).withId(2))); - when(httpAgent.put("bamboo.url", mapOf("update", reportJson))).thenReturn(new HttpResponse(true, "")); - - aggregateReportsService.sendReportsToAggregator(); - - verify(httpAgent).put("bamboo.url", mapOf("update", reportJson)); - verify(tokenRepository).saveAggregateReportsToken(2); - } - - @Test(expected = RuntimeException.class) - public void shouldThrowExceptionWhenReportsAreNotSent() throws Exception { - when(tokenRepository.getAggregateReportsToken()).thenReturn(0); - ServiceProvidedReport firstServiceProvidedReport = new ServiceProvidedReport().withId(1); - ServiceProvidedReport secondServiceProvidedReport = new ServiceProvidedReport().withId(2); - when(servicesProvidedRepository.getNewReports(0, batchSizeToUpdate)).thenReturn(asList(firstServiceProvidedReport, secondServiceProvidedReport)); - String firstReportJson = new Gson().toJson(firstServiceProvidedReport); - String secondReportAsJson = new Gson().toJson(secondServiceProvidedReport); - when(httpAgent.put("bamboo.url", mapOf("update", firstReportJson))).thenReturn(new HttpResponse(false, "")); - - aggregateReportsService.sendReportsToAggregator(); - - verify(httpAgent).put("bamboo.url", mapOf("update", firstReportJson)); - verify(httpAgent, never()).put("bamboo.url", mapOf("update", secondReportAsJson)); - } - - @Test - public void shouldNotAggregateReportsWhenThereIsNoNewReport() throws Exception { - when(tokenRepository.getAggregateReportsToken()).thenReturn(12345); - when(servicesProvidedRepository.getNewReports(12345, batchSizeToUpdate)).thenReturn(Collections.emptyList()); - - aggregateReportsService.sendReportsToAggregator(); - - verify(httpAgent, never()).put(anyString(), anyMap()); - verify(tokenRepository, never()).saveAggregateReportsToken(anyInt()); - } - - @Test - public void shouldCallAggregatorToGetAggregatedReports() throws Exception { - when(httpAgent.get("bamboo.aggregated.url?query=%7B%22anm_identifier%22%3A+%22demo1%22%2C%22nrhm_report_year%22%3A2013%2C+%22nrhm_report_month%22%3A10%7D")) - .thenReturn(new HttpResponse(true, "[{\"nrhm_report_month\": 10, \"indicator\": \"OCP\", \"nrhm_report_indicator_count\": 2, \"nrhm_report_year\": 2013, \"anm_identifier\": \"demo1\"}, {\"nrhm_report_month\": 10, \"indicator\": \"OPV_1\", \"nrhm_report_indicator_count\": 1, \"nrhm_report_year\": 2013, \"anm_identifier\": \"demo1\"}]")); - - List aggregatorResponse = aggregateReportsService.getAggregatedReports("demo1", 10, 2013); - - assertEquals(asList(new AggregatorResponseDTO("OCP", 2), new AggregatorResponseDTO("OPV_1", 1)), aggregatorResponse); - } -} diff --git a/opensrp-reporting/src/test/resources/spring/applicationContext-opensrp-reporting-test.xml b/opensrp-reporting/src/test/resources/spring/applicationContext-opensrp-reporting-test.xml deleted file mode 100755 index 0e7a3ab8ad..0000000000 --- a/opensrp-reporting/src/test/resources/spring/applicationContext-opensrp-reporting-test.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/opensrp-reporting/src/test/resources/spring/applicationContext-reporting-repository-test.xml b/opensrp-reporting/src/test/resources/spring/applicationContext-reporting-repository-test.xml deleted file mode 100755 index fe8e067ab9..0000000000 --- a/opensrp-reporting/src/test/resources/spring/applicationContext-reporting-repository-test.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - ${hibernate.dialect} - ${hibernate.show_sql} - ${hibernate.format_sql} - ${hibernate.auto_commit} - ${db.reporting.report} - - - - - - - - - - - - - - - - - - - - - - - - ${hibernate.dialect} - ${hibernate.show_sql} - ${hibernate.format_sql} - ${hibernate.auto_commit} - ${db.reporting.anm} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/opensrp-tools/formdefintion/README.rst b/opensrp-tools/formdefintion/README.rst deleted file mode 100755 index 7244053609..0000000000 --- a/opensrp-tools/formdefintion/README.rst +++ /dev/null @@ -1,5 +0,0 @@ -Simple html javascript page that takes formhub's formJSON as input, -and converts it into a form definition JSON for use with drishti. - -You can run 'python -m SimpleHTTPServer 8900' and access it via -http://localhost:8900. diff --git a/opensrp-tools/formdefintion/index.html b/opensrp-tools/formdefintion/index.html deleted file mode 100755 index 1a3d4187ae..0000000000 --- a/opensrp-tools/formdefintion/index.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - -
- - -
-

-        
-           
-    
-
diff --git a/opensrp-tools/formdefintion/js/app/formDefinition.js b/opensrp-tools/formdefintion/js/app/formDefinition.js
deleted file mode 100755
index afca7271fc..0000000000
--- a/opensrp-tools/formdefintion/js/app/formDefinition.js
+++ /dev/null
@@ -1,69 +0,0 @@
-define([], function () {
-    'use strict';
-    var formJsonToList = function (item, parent, toplevel) {
-        if (!item.children) {
-            return item;
-        }
-        var ls = [], rs, chls;
-        if (parent == undefined) {
-            parent = "/model/instance";
-        }
-        if (item.name != undefined) {
-            if (item.type != 'group') {
-                rs = {
-                    name: item.name
-                };
-                if (toplevel + "/" + item.name  != parent + "/" + item.name) {
-                    rs.bind = parent + "/" + item.name;
-                }
-                ls.push(rs);
-            }
-            if (parent == "/model/instance") {
-                toplevel = parent + "/" + item.name;
-            }
-            parent = parent + "/" + item.name;
-        }
-        chls = [];
-        item.children.forEach(function (child) {
-            if (child.type == undefined) {
-                return;
-            }
-            var tmp = formJsonToList(child, parent, toplevel);
-            rs = tmp.name == undefined ? tmp : {
-                name: tmp.name
-            };
-            if (tmp.name != undefined && toplevel + "/" + item.name  != parent + "/" + item.name) {
-                rs.bind = parent + "/" + tmp.name;
-            }
-            chls.push(rs);
-        });
-        if (chls.length) {
-            ls.push(chls);
-        }
-        return ls;
-    }, flattenFields = function (alist, targetList) {
-        if (alist instanceof Array) {
-            alist.forEach(function (item) {
-                if (item instanceof Array) {
-                    flattenFields(item, targetList);
-                } else {
-                    targetList.push(item);
-                }
-            });
-        }
-        return targetList;
-    };
-
-    return {
-        generateFormDefinition: function (fJson) {
-            var k = formJsonToList(fJson), f_def = {};
-            if (k.length > 1) {
-                f_def.bind_type = k[0].name;
-                f_def.default_bind_path = k[0].bind + "/";
-                f_def.fields = [];
-                flattenFields(k[1], f_def.fields);
-            }
-            return f_def;
-        }
-    };
-});
diff --git a/opensrp-web/pom.xml b/opensrp-web/pom.xml
index 84dc13afa0..15684dc49d 100755
--- a/opensrp-web/pom.xml
+++ b/opensrp-web/pom.xml
@@ -8,7 +8,7 @@
     opensrp-server-web
     war
 
-    1.6.4-SNAPSHOT
+    1.6.0-SNAPSHOT
 
     opensrp-server-web
     OpenSRP Server Web Application
@@ -27,9 +27,9 @@
         1.9.7
         0.11
         1.5.1
-        1.3.8-SNAPSHOT
-        1.0.6-SNAPSHOT
-        1.0.0-SNAPSHOT
+        1.3.4-SNAPSHOT
+        1.0.6KIP-SNAPSHOT
+        1.0.1-KIP-SNAPSHOT
         1.0.3-SNAPSHOT
 
     
@@ -103,11 +103,6 @@
                 true
             
         
-        
-            spring-libs-release
-            Spring Libs Maven Release Repository
-            https://repo.spring.io/libs-release/
-        
         
             motech.opensrp
             Motech Snapshots Repository
@@ -339,6 +334,14 @@
                 ../assets/form
                 form
             
+            
+                ../assets/security
+                security
+            
+            
+                ../assets/security/certificates
+                certificates
+            
             
                 ../build
                 true
@@ -648,18 +651,6 @@
 
             
         
-        
-            openmrs-sync
-            
-                openmrs-sync
-            
-        
-        
-            dhis2-sync
-            
-                dhis2-sync
-            
-        
         
             skip-integration-tests
             
diff --git a/opensrp-web/src/main/java/org/opensrp/web/GzipBodyDecompressFilter.java b/opensrp-web/src/main/java/org/opensrp/web/GzipBodyDecompressFilter.java
index 8de66c0050..d6144c8b0f 100644
--- a/opensrp-web/src/main/java/org/opensrp/web/GzipBodyDecompressFilter.java
+++ b/opensrp-web/src/main/java/org/opensrp/web/GzipBodyDecompressFilter.java
@@ -107,7 +107,7 @@ final class GzippedInputStreamWrapper extends HttpServletRequestWrapper {
 		 * stream.
 		 *
 		 * @param request request which input stream will be wrapped.
-		 * @throws java.io.IOException when input stream reqtieval failed.
+		 * @throws IOException when input stream reqtieval failed.
 		 */
 		public GzippedInputStreamWrapper(final HttpServletRequest request) throws IOException {
 			super(request);
diff --git a/opensrp-web/src/main/java/org/opensrp/web/controller/UserController.java b/opensrp-web/src/main/java/org/opensrp/web/controller/UserController.java
index 9b1d27e990..eb5a61f537 100644
--- a/opensrp-web/src/main/java/org/opensrp/web/controller/UserController.java
+++ b/opensrp-web/src/main/java/org/opensrp/web/controller/UserController.java
@@ -90,7 +90,7 @@ public class UserController {
 
 	@Autowired
 	public UserController(OpenmrsLocationService openmrsLocationService, OpenmrsUserService openmrsUserService,
-			DrishtiAuthenticationProvider opensrpAuthenticationProvider, OpenmrsRelationshipService openmrsRelationshipService) {
+						  DrishtiAuthenticationProvider opensrpAuthenticationProvider, OpenmrsRelationshipService openmrsRelationshipService) {
 		this.openmrsLocationService = openmrsLocationService;
 		this.openmrsUserService = openmrsUserService;
 		this.opensrpAuthenticationProvider = opensrpAuthenticationProvider;
@@ -154,7 +154,7 @@ public Time getServerTime() {
 
 	@RequestMapping(method = RequestMethod.GET, value = "/user-details")
 	public ResponseEntity getUserDetails(Authentication authentication,
-			@RequestParam(value = "anm-id", required = false) String anmIdentifier, HttpServletRequest request) {
+													 @RequestParam(value = "anm-id", required = false) String anmIdentifier, HttpServletRequest request) {
 		Authentication auth;
 		if (authentication == null) {
 			auth = getAuthenticationAdvisor(request);
@@ -304,7 +304,7 @@ private ResponseEntity authenticateUsingOrganization(HttpServletRequest
 						openMRSIds.add(openMRSIdsMap.get(locationId));
 					} else {
 						openMRSIds.add(locationService.getLocation(locationId, false).getProperties().getCustomProperties()
-						        .get("OpenMRS_Id"));
+								.get("OpenMRS_Id"));
 					}
 				}
 			}
@@ -378,4 +378,4 @@ public void setOpensrpAuthenticationProvider(DrishtiAuthenticationProvider opens
 		this.opensrpAuthenticationProvider = opensrpAuthenticationProvider;
 	}
 
-}
+}
\ No newline at end of file
diff --git a/opensrp-web/src/main/java/org/opensrp/web/rest/EventResource.java b/opensrp-web/src/main/java/org/opensrp/web/rest/EventResource.java
index 735fb34db4..67281af99e 100644
--- a/opensrp-web/src/main/java/org/opensrp/web/rest/EventResource.java
+++ b/opensrp-web/src/main/java/org/opensrp/web/rest/EventResource.java
@@ -7,7 +7,6 @@
 import com.mysql.jdbc.StringUtils;
 import java.text.ParseException;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -26,7 +25,6 @@
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
@@ -71,15 +69,13 @@ public class EventResource extends RestResource {
 	
 	@Value("#{opensrp['opensrp.sync.search.missing.client']}")
 	private boolean searchMissingClients;
-
-	public static final String DATE_DELETED = "dateDeleted";
-
+	
 	@Autowired
 	public EventResource(ClientService clientService, EventService eventService) {
 		this.clientService = clientService;
 		this.eventService = eventService;
 	}
-
+	
 	@Override
 	public Event getByUniqueId(String uniqueId) {
 		return eventService.find(uniqueId);
@@ -412,12 +408,11 @@ public List filter(String query) {
 	        MediaType.APPLICATION_JSON_VALUE })
 	@ResponseBody
 	protected ResponseEntity getAllIdsByEventType(
-	        @RequestParam(value = EVENT_TYPE, required = false) String eventType,
-			@RequestParam(value = DATE_DELETED, required = false ) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) Date dateDeleted) {
-
+	        @RequestParam(value = "eventType", required = false) String eventType) {
+		
 		try {
 			
-			List eventIds = eventService.findAllIdsByEventType(eventType, dateDeleted);
+			List eventIds = eventService.findAllIdsByEventType(eventType);
 			return new ResponseEntity<>(gson.toJson(eventIds), RestUtils.getJSONUTF8Headers(), HttpStatus.OK);
 			
 		}
@@ -426,13 +421,5 @@ protected ResponseEntity getAllIdsByEventType(
 			return new ResponseEntity<>(INTERNAL_SERVER_ERROR);
 		}
 	}
-
-	public void setEventService(EventService eventService) {
-		this.eventService = eventService;
-	}
-
-	public void setClientService(ClientService clientService) {
-		this.clientService = clientService;
-	}
 	
 }
diff --git a/opensrp-web/src/main/java/org/opensrp/web/utils/SearchHelper.java b/opensrp-web/src/main/java/org/opensrp/web/utils/SearchHelper.java
index 0c5325e951..2ca2a35969 100644
--- a/opensrp-web/src/main/java/org/opensrp/web/utils/SearchHelper.java
+++ b/opensrp-web/src/main/java/org/opensrp/web/utils/SearchHelper.java
@@ -73,11 +73,17 @@ public static SearchEntityWrapper childSearchParamProcessor(HttpServletRequest r
 			searchBean.setBirthdateFrom(birthdate[0]);
 			searchBean.setBirthdateTo(birthdate[1]);
 		}
+		String OPENMRS_ID_KEY = "OPENMRS_ID";
 		Map identifiers = new HashMap();
 		//
 		if (!StringUtils.isEmptyOrWhitespaceOnly(zeirId)) {
 			identifiers.put(ZEIR_ID, zeirId);
-			identifiers.put("ZEIR_ID", zeirId); //Maintains backward compatibility with upper case key
+			identifiers.put("OPENMRS_ID", zeirId); //Maintains backward compatibility with upper case key
+		}
+
+		if (!StringUtils.isEmptyOrWhitespaceOnly(zeirId)) {
+			zeirId = formatChildUniqueId(zeirId);
+			identifiers.put(OPENMRS_ID_KEY, zeirId);
 		}
 
 		if (!StringUtils.isEmptyOrWhitespaceOnly(opensrpId)) {
@@ -300,4 +306,16 @@ public static String getRelationalId(Client c, String relationshipKey) {
 		
 		return null;
 	}
+
+	private static String formatChildUniqueId(String unformattedId) {
+		if (!StringUtils.isEmptyOrWhitespaceOnly(unformattedId)) {
+			if (unformattedId.contains("-")) {
+				unformattedId = unformattedId.split("-")[0];
+			} else if (unformattedId.length() > 6) {
+				unformattedId = unformattedId.substring(0, 6);
+			}
+		}
+
+		return unformattedId;
+	}
 }
diff --git a/opensrp-web/src/main/resources/quartz.properties b/opensrp-web/src/main/resources/quartz.properties
index 9a43b4a4a5..544d759337 100644
--- a/opensrp-web/src/main/resources/quartz.properties
+++ b/opensrp-web/src/main/resources/quartz.properties
@@ -10,8 +10,8 @@ org.quartz.jobStore.misfireThreshold = 300000
 
 org.quartz.dataSource.motechDS.driver = com.mysql.jdbc.Driver
 org.quartz.dataSource.motechDS.URL = jdbc:mysql://localhost:3306/motechquartz
-org.quartz.dataSource.motechDS.user = openmrs
-org.quartz.dataSource.motechDS.password = openmrs
+org.quartz.dataSource.motechDS.user = remote
+org.quartz.dataSource.motechDS.password = r3m0t3
 org.quartz.dataSource.motechDS.maxConnections = 30
 
 #org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
diff --git a/opensrp-web/src/main/webapp/WEB-INF/web.xml b/opensrp-web/src/main/webapp/WEB-INF/web.xml
index 51adc8a962..8dc2352b85 100644
--- a/opensrp-web/src/main/webapp/WEB-INF/web.xml
+++ b/opensrp-web/src/main/webapp/WEB-INF/web.xml
@@ -109,7 +109,7 @@
 
 	
 		spring.profiles.active
-		${opensrp.database.profile},${opensrp.redis.client.profile},${opensrp.security.profile},${openmrs.sync.enabled},${dhis2.sync.enabled}
+		${opensrp.database.profile},${opensrp.redis.client.profile},${opensrp.security.profile}
 	
 
     
diff --git a/opensrp-web/src/test/java/org/opensrp/web/rest/BaseResourceTest.java b/opensrp-web/src/test/java/org/opensrp/web/rest/BaseResourceTest.java
index 912e56f64f..f00c912025 100644
--- a/opensrp-web/src/test/java/org/opensrp/web/rest/BaseResourceTest.java
+++ b/opensrp-web/src/test/java/org/opensrp/web/rest/BaseResourceTest.java
@@ -2,10 +2,6 @@
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
 import java.util.List;
 import org.junit.Before;
 import org.junit.runner.RunWith;
@@ -40,8 +36,6 @@ public abstract class BaseResourceTest {
 
     protected ObjectMapper mapper = new ObjectMapper().enableDefaultTyping();
 
-    protected final String ISO_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
-
     @Before
     public void bootStrap() {
         this.mockMvc = MockMvcBuilders.webApplicationContextSetup(this.webApplicationContext).build();
@@ -124,16 +118,5 @@ protected String deleteRequestWithJsonContent(String url, String parameter, Resu
 
     /** Objects in the list should have a unique uuid identifier field **/
     protected abstract void assertListsAreSameIgnoringOrder(List expectedList, List actualList);
-
-    protected Date convertDate(String dateString, String dateFormat) {
-        DateFormat format = new SimpleDateFormat(dateFormat);
-        Date date = null;
-        try {
-            date = format.parse(dateString);
-        } catch (ParseException e) {
-            e.printStackTrace();
-        }
-        return date;
-    }
 }
 
diff --git a/opensrp-web/src/test/java/org/opensrp/web/rest/EventResourceTest.java b/opensrp-web/src/test/java/org/opensrp/web/rest/EventResourceTest.java
deleted file mode 100644
index 1da74b50b0..0000000000
--- a/opensrp-web/src/test/java/org/opensrp/web/rest/EventResourceTest.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.opensrp.web.rest;
-
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.opensrp.common.AllConstants;
-import org.opensrp.domain.Event;
-import org.opensrp.service.EventService;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.springframework.test.web.server.result.MockMvcResultMatchers.status;
-
-public class EventResourceTest extends BaseResourceTest {
-
-    private final static String BASE_URL = "/rest/event";
-
-    private String dateDeletedString = "2000-10-31T01:30:00.000-05:00";
-
-    private String eventType = "Spray";
-
-    private EventService eventService;
-
-    @Captor
-    private ArgumentCaptor stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
-
-    @Captor
-    private ArgumentCaptor dateArgumentCaptor = ArgumentCaptor.forClass(Date.class);
-
-    public EventResourceTest() throws IOException {
-        super();
-    }
-
-    @Before
-    public void setUp() {
-        eventService = mock(EventService.class);
-        EventResource eventResource = webApplicationContext.getBean(EventResource.class);
-        eventResource.setEventService(eventService);
-    }
-
-    @Test
-    public void testFindAllEventIds() throws Exception {
-        List expectedEventIdList = new ArrayList<>();
-
-        expectedEventIdList.add("event_1");
-        expectedEventIdList.add("event_2");
-
-        doReturn(expectedEventIdList).when(eventService).findAllIdsByEventType(null, null);
-
-        String actualEventIdString = getResponseAsString(BASE_URL + "/findIdsByEventType", null, status().isOk());
-        List actualEventIdList = new Gson().fromJson(actualEventIdString, new TypeToken>(){}.getType());
-
-        verify(eventService).findAllIdsByEventType(stringArgumentCaptor.capture(), dateArgumentCaptor.capture());
-        assertNull(stringArgumentCaptor.getValue());
-        assertNull(dateArgumentCaptor.getValue());
-
-        assertNotNull(actualEventIdList);
-        assertEquals(2, actualEventIdList.size());
-        assertEquals(expectedEventIdList.get(0), actualEventIdList.get(0));
-        assertEquals(expectedEventIdList.get(1), actualEventIdList.get(1));
-
-    }
-
-    @Test
-    public void testFindAllEventIdsByEventType() throws Exception {
-        List expectedEventIdList = new ArrayList<>();
-
-        expectedEventIdList.add("event_1");
-        expectedEventIdList.add("event_2");
-
-        doReturn(expectedEventIdList).when(eventService).findAllIdsByEventType(eventType, null);
-
-        String parameter = AllConstants.Event.EVENT_TYPE + "=" + eventType;
-        String actualEventIdString = getResponseAsString(BASE_URL + "/findIdsByEventType", parameter, status().isOk());
-        List actualEventIdList = new Gson().fromJson(actualEventIdString, new TypeToken>(){}.getType());
-
-        verify(eventService).findAllIdsByEventType(stringArgumentCaptor.capture(), dateArgumentCaptor.capture());
-        assertEquals(stringArgumentCaptor.getValue(), eventType);
-        assertNull(dateArgumentCaptor.getValue());
-
-        assertNotNull(actualEventIdList);
-        assertEquals(2, actualEventIdList.size());
-        assertEquals(expectedEventIdList.get(0), actualEventIdList.get(0));
-        assertEquals(expectedEventIdList.get(1), actualEventIdList.get(1));
-
-    }
-
-    @Test
-    public void testFindAllDeletedEventIdsByEventType() throws Exception {
-        List expectedEventIdList = new ArrayList<>();
-
-        expectedEventIdList.add("event_1");
-        expectedEventIdList.add("event_2");
-
-        Date dateDeleted = convertDate(dateDeletedString, ISO_DATE_TIME_FORMAT);
-
-        doReturn(expectedEventIdList).when(eventService).findAllIdsByEventType(eventType, dateDeleted);
-
-        String parameter = AllConstants.Event.EVENT_TYPE + "=" + eventType + "&" + EventResource.DATE_DELETED + "=" + dateDeletedString;
-        String actualEventIdString = getResponseAsString(BASE_URL + "/findIdsByEventType", parameter, status().isOk());
-        List actualEventIdList = new Gson().fromJson(actualEventIdString, new TypeToken>(){}.getType());
-
-        verify(eventService).findAllIdsByEventType(stringArgumentCaptor.capture(), dateArgumentCaptor.capture());
-        assertEquals(stringArgumentCaptor.getValue(), eventType);
-        assertEquals(dateArgumentCaptor.getValue(), dateDeleted);
-
-        assertNotNull(actualEventIdList);
-        assertEquals(2, actualEventIdList.size());
-        assertEquals(expectedEventIdList.get(0), actualEventIdList.get(0));
-        assertEquals(expectedEventIdList.get(1), actualEventIdList.get(1));
-
-    }
-
-    @Test
-    public void testFindAllDeletedEventIds() throws Exception {
-        List expectedEventIdList = new ArrayList<>();
-
-        expectedEventIdList.add("event_1");
-        expectedEventIdList.add("event_2");
-
-        Date dateDeleted = convertDate(dateDeletedString, ISO_DATE_TIME_FORMAT);
-
-        doReturn(expectedEventIdList).when(eventService).findAllIdsByEventType(null, dateDeleted);
-
-        String parameter = EventResource.DATE_DELETED + "=" + dateDeletedString;
-        String actualEventIdString = getResponseAsString(BASE_URL + "/findIdsByEventType", parameter, status().isOk());
-        List actualEventIdList = new Gson().fromJson(actualEventIdString, new TypeToken>(){}.getType());
-
-        verify(eventService).findAllIdsByEventType(stringArgumentCaptor.capture(), dateArgumentCaptor.capture());
-        assertNull(stringArgumentCaptor.getValue());
-        assertEquals(dateArgumentCaptor.getValue(), dateDeleted);
-
-        assertNotNull(actualEventIdList);
-        assertEquals(2, actualEventIdList.size());
-        assertEquals(expectedEventIdList.get(0), actualEventIdList.get(0));
-        assertEquals(expectedEventIdList.get(1), actualEventIdList.get(1));
-
-    }
-
-
-    @Override
-    protected void assertListsAreSameIgnoringOrder(List expectedList, List actualList) {
-        if (expectedList == null || actualList == null) {
-            throw new AssertionError("One of the lists is null");
-        }
-
-        assertEquals(expectedList.size(), actualList.size());
-
-        Set expectedIds = new HashSet<>();
-        for (Event event : expectedList) {
-            expectedIds.add(event.getFormSubmissionId());
-        }
-
-        for (Event event : actualList) {
-            assertTrue(expectedIds.contains(event.getFormSubmissionId()));
-        }
-    }
-
-}
diff --git a/opensrp-web/src/test/java/org/opensrp/web/rest/shadow/EventResourceShadow.java b/opensrp-web/src/test/java/org/opensrp/web/rest/shadow/EventResourceShadow.java
deleted file mode 100644
index 0ea5e101e2..0000000000
--- a/opensrp-web/src/test/java/org/opensrp/web/rest/shadow/EventResourceShadow.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.opensrp.web.rest.shadow;
-
-import org.opensrp.service.ClientService;
-import org.opensrp.service.EventService;
-import org.opensrp.web.rest.EventResource;
-
-public class EventResourceShadow extends EventResource {
-
-    public EventResourceShadow(ClientService clientService, EventService eventService) {
-        super(clientService, eventService);
-    }
-
-    public EventResourceShadow() {
-        super(null, null);
-    }
-
-}
diff --git a/opensrp-web/src/test/resources/test-webmvc-config.xml b/opensrp-web/src/test/resources/test-webmvc-config.xml
index d0ef4683a4..f6b0114b81 100644
--- a/opensrp-web/src/test/resources/test-webmvc-config.xml
+++ b/opensrp-web/src/test/resources/test-webmvc-config.xml
@@ -22,6 +22,5 @@
 	
 	
 	
-	
 
 
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 64ae031340..ea8b0eca53 100755
--- a/pom.xml
+++ b/pom.xml
@@ -6,20 +6,14 @@
     org.opensrp
     opensrp
     pom
-    0.1-SNAPSHOT
+    2.0.0-SNAPSHOT
     opensrp
     http://github.com/OpenSRP/opensrp-server
 
     
-        opensrp-common
-        opensrp-api
-        opensrp-form
-        opensrp-core
-        opensrp-interface
-        opensrp-register
         opensrp-connector
         opensrp-web
-        
+        opensrp-register