diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000000..e4d0f50007
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,12 @@
+# Changelog
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [Unreleased]
+### Changed
+- Moved server default setting configurations to `../assets/server_defaults/` folder. Files follow a per project implementation hierachy pattern
+
+### Added
+- Client Server sync - settings functionality and rest endpoint. `../rest/settings/sync`
diff --git a/assets/config/opensrp.properties b/assets/config/opensrp.properties
index 33c63ad65a..40f8cb9be4 100644
--- a/assets/config/opensrp.properties
+++ b/assets/config/opensrp.properties
@@ -20,7 +20,7 @@ mcts-report-delay-in-days=10
mcts.poll.time.interval.in.minutes=10
# OpenMRS configuration
-openmrs.url=http://localhost:8080/openmrs/
+openmrs.url=https://openmrs.anc-stage.smartregister.org/openmrs/
openmrs.username=admin
openmrs.password=Admin123
openmrs.idgen.url=/module/idgen/exportIdentifiers.form
diff --git a/assets/migrations/generator/generatorConfig.xml b/assets/migrations/generator/generatorConfig.xml
index 86bd00cf80..b89ca44ca6 100644
--- a/assets/migrations/generator/generatorConfig.xml
+++ b/assets/migrations/generator/generatorConfig.xml
@@ -2,10 +2,10 @@
+ location="/Users/ndegwamartin/Workspace/opensrp-server/assets/migrations/drivers/postgresql-42.2.1.jar" />
-
@@ -62,7 +62,15 @@
-
-->
-
+
+
+
+
+
+
+ -->
+
+
diff --git a/assets/migrations/scripts/20180423072606_create_view_configurations_metadata_table.sql b/assets/migrations/scripts/20180423072606_create_view_configurations_metadata_table.sql
index d1715e7117..6bc095f594 100644
--- a/assets/migrations/scripts/20180423072606_create_view_configurations_metadata_table.sql
+++ b/assets/migrations/scripts/20180423072606_create_view_configurations_metadata_table.sql
@@ -28,9 +28,8 @@ CREATE TABLE core.view_configuration_metadata
)
WITH (
OIDS = FALSE
-);
+);
-- //@UNDO
-- SQL to undo the change goes here.
DROP TABLE core.view_configuration_metadata;
-
diff --git a/assets/migrations/scripts/20180904141214_create_settings_table.sql.sql b/assets/migrations/scripts/20180904141214_create_settings_table.sql.sql
new file mode 100644
index 0000000000..64474eb79f
--- /dev/null
+++ b/assets/migrations/scripts/20180904141214_create_settings_table.sql.sql
@@ -0,0 +1,33 @@
+--
+-- Copyright 2010-2016 the original author or authors.
+--
+-- 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.
+--
+
+-- // create_settings_table.sql
+-- Migration SQL that makes the change goes here.
+CREATE TABLE core.settings
+(
+ id bigserial NOT NULL,
+ json jsonb NOT NULL,
+ PRIMARY KEY (id)
+)
+WITH (
+ OIDS = FALSE
+)
+
+
+-- //@UNDO
+-- SQL to undo the change goes here.
+
+DROP TABLE core.settings
diff --git a/assets/migrations/scripts/20180904141237_create_settings_metadata_table.sql.sql b/assets/migrations/scripts/20180904141237_create_settings_metadata_table.sql.sql
new file mode 100644
index 0000000000..ff66cd356f
--- /dev/null
+++ b/assets/migrations/scripts/20180904141237_create_settings_metadata_table.sql.sql
@@ -0,0 +1,36 @@
+--
+-- Copyright 2010-2016 the original author or authors.
+--
+-- 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.
+--
+
+-- // create_settings_metadata_table.sql
+-- Migration SQL that makes the change goes here.
+
+CREATE TABLE core.settings_metadata
+(
+ id bigserial NOT NULL,
+ settings_id bigint REFERENCES core.settings (id),
+ document_id character varying UNIQUE NOT NULL,
+ identifier varchar UNIQUE,
+ server_version bigint,
+ PRIMARY KEY (id)
+)
+WITH (
+ OIDS = FALSE
+);
+
+-- //@UNDO
+-- SQL to undo the change goes here.
+
+DROP TABLE core.settings_metadata;
diff --git a/assets/migrations/scripts/20181012141507_add_settings_metadata_columns_team_id_team_location_id_and_provider_id.sql b/assets/migrations/scripts/20181012141507_add_settings_metadata_columns_team_id_team_location_id_and_provider_id.sql
new file mode 100644
index 0000000000..28121cb380
--- /dev/null
+++ b/assets/migrations/scripts/20181012141507_add_settings_metadata_columns_team_id_team_location_id_and_provider_id.sql
@@ -0,0 +1,31 @@
+--
+-- Copyright 2010-2016 the original author or authors.
+--
+-- 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.
+--
+
+-- // add settings metadata columns team id team location_id and provider id
+-- Migration SQL that makes the change goes here.
+
+ALTER TABLE core.settings_metadata ADD COLUMN team VARCHAR;
+ALTER TABLE core.settings_metadata ADD COLUMN team_id VARCHAR;
+ALTER TABLE core.settings_metadata ADD COLUMN provider_id VARCHAR;
+ALTER TABLE core.settings_metadata ADD COLUMN location_id VARCHAR;
+
+-- //@UNDO
+-- SQL to undo the change goes here.
+
+ALTER TABLE core.settings_metadata DROP COLUMN team;
+ALTER TABLE core.settings_metadata DROP COLUMN team_id;
+ALTER TABLE core.settings_metadata DROP COLUMN provider_id;
+ALTER TABLE core.settings_metadata DROP COLUMN location_id;
diff --git a/assets/migrations/scripts/20181012145616_alter_settings_metadata_column_identifier_remove_constraint.sql b/assets/migrations/scripts/20181012145616_alter_settings_metadata_column_identifier_remove_constraint.sql
new file mode 100644
index 0000000000..edd85a1407
--- /dev/null
+++ b/assets/migrations/scripts/20181012145616_alter_settings_metadata_column_identifier_remove_constraint.sql
@@ -0,0 +1,25 @@
+--
+-- Copyright 2010-2016 the original author or authors.
+--
+-- 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.
+--
+
+-- // alter settings metadata column identifier remove constraint
+-- Migration SQL that makes the change goes here.
+
+ALTER TABLE core.settings_metadata DROP CONSTRAINT settings_metadata_identifier_key
+
+-- //@UNDO
+-- SQL to undo the change goes here.
+
+ALTER TABLE core.settings_metadata ADD CONSTRAINT settings_metadata_identifier_key UNIQUE (identifier);
\ No newline at end of file
diff --git a/assets/server_defaults/anc/population_characteristics.json b/assets/server_defaults/anc/population_characteristics.json
new file mode 100644
index 0000000000..b014faa21b
--- /dev/null
+++ b/assets/server_defaults/anc/population_characteristics.json
@@ -0,0 +1,87 @@
+{
+ "_id": 2,
+ "_rev": 1,
+ "type": "SettingConfiguration",
+ "identifier": "population_characteristics",
+ "serverVersion": null,
+ "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 high.",
+ "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_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. "
+ }
+ ]
+}
\ No newline at end of file
diff --git a/assets/server_defaults/anc/site_characteristics.json b/assets/server_defaults/anc/site_characteristics.json
new file mode 100644
index 0000000000..fb405a9d6a
--- /dev/null
+++ b/assets/server_defaults/anc/site_characteristics.json
@@ -0,0 +1,37 @@
+{
+ "_id": "1",
+ "_rev": "v1",
+ "type": "SettingConfiguration",
+ "identifier": "site_characteristics",
+ "locationId": "",
+ "providerId": "",
+ "teamId": "",
+ "dateCreated": "1970-10-04T10:17:09.993+03:00",
+ "serverVersion": 1,
+ "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\n\ta. A protocol or standard operating procedure for Intimate Partner Violence (IPV); \r\n\tb. A health worker trained on how to ask about IPV and how to provide the minimum response or beyond;\r\n\tc. A private setting; \r\n\td. A way to ensure confidentiality; \r\n\te. Time to allow for appropriate disclosure; and\r\n\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?"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/assets/tbreach_default_view_configs/README.txt b/assets/server_defaults/tb-reach/view_configurations/README.txt
similarity index 100%
rename from assets/tbreach_default_view_configs/README.txt
rename to assets/server_defaults/tb-reach/view_configurations/README.txt
diff --git a/assets/tbreach_default_view_configs/common_register_header.json b/assets/server_defaults/tb-reach/view_configurations/common_register_header.json
similarity index 100%
rename from assets/tbreach_default_view_configs/common_register_header.json
rename to assets/server_defaults/tb-reach/view_configurations/common_register_header.json
diff --git a/assets/tbreach_default_view_configs/common_register_row.json b/assets/server_defaults/tb-reach/view_configurations/common_register_row.json
similarity index 100%
rename from assets/tbreach_default_view_configs/common_register_row.json
rename to assets/server_defaults/tb-reach/view_configurations/common_register_row.json
diff --git a/assets/tbreach_default_view_configs/component_patient_details_bmi.json b/assets/server_defaults/tb-reach/view_configurations/component_patient_details_bmi.json
similarity index 100%
rename from assets/tbreach_default_view_configs/component_patient_details_bmi.json
rename to assets/server_defaults/tb-reach/view_configurations/component_patient_details_bmi.json
diff --git a/assets/tbreach_default_view_configs/component_patient_details_contact_screening.json b/assets/server_defaults/tb-reach/view_configurations/component_patient_details_contact_screening.json
similarity index 100%
rename from assets/tbreach_default_view_configs/component_patient_details_contact_screening.json
rename to assets/server_defaults/tb-reach/view_configurations/component_patient_details_contact_screening.json
diff --git a/assets/tbreach_default_view_configs/component_patient_details_demographics.json b/assets/server_defaults/tb-reach/view_configurations/component_patient_details_demographics.json
similarity index 100%
rename from assets/tbreach_default_view_configs/component_patient_details_demographics.json
rename to assets/server_defaults/tb-reach/view_configurations/component_patient_details_demographics.json
diff --git a/assets/tbreach_default_view_configs/component_patient_details_followup.json b/assets/server_defaults/tb-reach/view_configurations/component_patient_details_followup.json
similarity index 100%
rename from assets/tbreach_default_view_configs/component_patient_details_followup.json
rename to assets/server_defaults/tb-reach/view_configurations/component_patient_details_followup.json
diff --git a/assets/tbreach_default_view_configs/component_patient_details_results.json b/assets/server_defaults/tb-reach/view_configurations/component_patient_details_results.json
similarity index 100%
rename from assets/tbreach_default_view_configs/component_patient_details_results.json
rename to assets/server_defaults/tb-reach/view_configurations/component_patient_details_results.json
diff --git a/assets/tbreach_default_view_configs/component_patient_details_service_history.json b/assets/server_defaults/tb-reach/view_configurations/component_patient_details_service_history.json
similarity index 100%
rename from assets/tbreach_default_view_configs/component_patient_details_service_history.json
rename to assets/server_defaults/tb-reach/view_configurations/component_patient_details_service_history.json
diff --git a/assets/tbreach_default_view_configs/home.json b/assets/server_defaults/tb-reach/view_configurations/home.json
similarity index 100%
rename from assets/tbreach_default_view_configs/home.json
rename to assets/server_defaults/tb-reach/view_configurations/home.json
diff --git a/assets/tbreach_default_view_configs/intreatment_register.json b/assets/server_defaults/tb-reach/view_configurations/intreatment_register.json
similarity index 100%
rename from assets/tbreach_default_view_configs/intreatment_register.json
rename to assets/server_defaults/tb-reach/view_configurations/intreatment_register.json
diff --git a/assets/tbreach_default_view_configs/intreatment_register_header.json b/assets/server_defaults/tb-reach/view_configurations/intreatment_register_header.json
similarity index 100%
rename from assets/tbreach_default_view_configs/intreatment_register_header.json
rename to assets/server_defaults/tb-reach/view_configurations/intreatment_register_header.json
diff --git a/assets/tbreach_default_view_configs/intreatment_register_row.json b/assets/server_defaults/tb-reach/view_configurations/intreatment_register_row.json
similarity index 100%
rename from assets/tbreach_default_view_configs/intreatment_register_row.json
rename to assets/server_defaults/tb-reach/view_configurations/intreatment_register_row.json
diff --git a/assets/tbreach_default_view_configs/lang_en.json b/assets/server_defaults/tb-reach/view_configurations/lang_en.json
similarity index 100%
rename from assets/tbreach_default_view_configs/lang_en.json
rename to assets/server_defaults/tb-reach/view_configurations/lang_en.json
diff --git a/assets/tbreach_default_view_configs/lang_fr.json b/assets/server_defaults/tb-reach/view_configurations/lang_fr.json
similarity index 100%
rename from assets/tbreach_default_view_configs/lang_fr.json
rename to assets/server_defaults/tb-reach/view_configurations/lang_fr.json
diff --git a/assets/tbreach_default_view_configs/lang_sw.json b/assets/server_defaults/tb-reach/view_configurations/lang_sw.json
similarity index 100%
rename from assets/tbreach_default_view_configs/lang_sw.json
rename to assets/server_defaults/tb-reach/view_configurations/lang_sw.json
diff --git a/assets/tbreach_default_view_configs/login.json b/assets/server_defaults/tb-reach/view_configurations/login.json
similarity index 100%
rename from assets/tbreach_default_view_configs/login.json
rename to assets/server_defaults/tb-reach/view_configurations/login.json
diff --git a/assets/tbreach_default_view_configs/main.json b/assets/server_defaults/tb-reach/view_configurations/main.json
similarity index 100%
rename from assets/tbreach_default_view_configs/main.json
rename to assets/server_defaults/tb-reach/view_configurations/main.json
diff --git a/assets/tbreach_default_view_configs/patient_details_intreatment.json b/assets/server_defaults/tb-reach/view_configurations/patient_details_intreatment.json
similarity index 100%
rename from assets/tbreach_default_view_configs/patient_details_intreatment.json
rename to assets/server_defaults/tb-reach/view_configurations/patient_details_intreatment.json
diff --git a/assets/tbreach_default_view_configs/patient_details_positive.json b/assets/server_defaults/tb-reach/view_configurations/patient_details_positive.json
similarity index 100%
rename from assets/tbreach_default_view_configs/patient_details_positive.json
rename to assets/server_defaults/tb-reach/view_configurations/patient_details_positive.json
diff --git a/assets/tbreach_default_view_configs/patient_details_presumptive.json b/assets/server_defaults/tb-reach/view_configurations/patient_details_presumptive.json
similarity index 100%
rename from assets/tbreach_default_view_configs/patient_details_presumptive.json
rename to assets/server_defaults/tb-reach/view_configurations/patient_details_presumptive.json
diff --git a/assets/tbreach_default_view_configs/positive_register.json b/assets/server_defaults/tb-reach/view_configurations/positive_register.json
similarity index 100%
rename from assets/tbreach_default_view_configs/positive_register.json
rename to assets/server_defaults/tb-reach/view_configurations/positive_register.json
diff --git a/assets/tbreach_default_view_configs/positive_register_header.json b/assets/server_defaults/tb-reach/view_configurations/positive_register_header.json
similarity index 100%
rename from assets/tbreach_default_view_configs/positive_register_header.json
rename to assets/server_defaults/tb-reach/view_configurations/positive_register_header.json
diff --git a/assets/tbreach_default_view_configs/positive_register_row.json b/assets/server_defaults/tb-reach/view_configurations/positive_register_row.json
similarity index 100%
rename from assets/tbreach_default_view_configs/positive_register_row.json
rename to assets/server_defaults/tb-reach/view_configurations/positive_register_row.json
diff --git a/assets/tbreach_default_view_configs/presumptive_register.json b/assets/server_defaults/tb-reach/view_configurations/presumptive_register.json
similarity index 100%
rename from assets/tbreach_default_view_configs/presumptive_register.json
rename to assets/server_defaults/tb-reach/view_configurations/presumptive_register.json
diff --git a/assets/tbreach_default_view_configs/presumptive_register_header.json b/assets/server_defaults/tb-reach/view_configurations/presumptive_register_header.json
similarity index 100%
rename from assets/tbreach_default_view_configs/presumptive_register_header.json
rename to assets/server_defaults/tb-reach/view_configurations/presumptive_register_header.json
diff --git a/assets/tbreach_default_view_configs/presumptive_register_row.json b/assets/server_defaults/tb-reach/view_configurations/presumptive_register_row.json
similarity index 100%
rename from assets/tbreach_default_view_configs/presumptive_register_row.json
rename to assets/server_defaults/tb-reach/view_configurations/presumptive_register_row.json
diff --git a/assets/tbreach_default_view_configs/setup_view_configs.sh b/assets/server_defaults/tb-reach/view_configurations/setup_view_configs.sh
similarity index 100%
rename from assets/tbreach_default_view_configs/setup_view_configs.sh
rename to assets/server_defaults/tb-reach/view_configurations/setup_view_configs.sh
diff --git a/opensrp-common/src/main/java/org/opensrp/common/AllConstants.java b/opensrp-common/src/main/java/org/opensrp/common/AllConstants.java
index 1ffeca436f..ae4152c7b3 100644
--- a/opensrp-common/src/main/java/org/opensrp/common/AllConstants.java
+++ b/opensrp-common/src/main/java/org/opensrp/common/AllConstants.java
@@ -1,374 +1,376 @@
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 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";
@@ -377,4 +379,9 @@ public static class DHIS2Constants {
public static final String DHIS2_TRACK_DATA_SYNCER_VERSION_MARKER_EVENT = "DHIS2 TRACK DATA SYNCER VERSION MARKER EVENT";
}
+
+ public static class KEY {
+
+ public static final String VALIDATED_RECORDS = "validated_records";
+ }
}
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
new file mode 100644
index 0000000000..931676a721
--- /dev/null
+++ b/opensrp-core/src/main/java/org/opensrp/domain/postgres/Settings.java
@@ -0,0 +1,69 @@
+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
new file mode 100644
index 0000000000..73652f6b33
--- /dev/null
+++ b/opensrp-core/src/main/java/org/opensrp/domain/postgres/SettingsExample.java
@@ -0,0 +1,456 @@
+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