Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

Commit

Permalink
Move server default configurations
Browse files Browse the repository at this point in the history
Fix issue server settings sync not updating
Add change log
  • Loading branch information
ndegwamartin committed Oct 3, 2018
1 parent 9255f63 commit 13c3fa2
Show file tree
Hide file tree
Showing 33 changed files with 138 additions and 1 deletion.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
87 changes: 87 additions & 0 deletions assets/server_defaults/anc/population_characteristics.json
Original file line number Diff line number Diff line change
@@ -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. "
}
]
}
37 changes: 37 additions & 0 deletions assets/server_defaults/anc/site_characteristics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"_id": "1",
"_rev": "v1",
"type": "SettingConfiguration",
"identifier": "site_characteristics",
"locationId": "",
"providerId": "",
"teamId": "",
"dateCreated": "",
"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\n1. A protocol or standard operating procedure for Intimate Partner Violence (IPV); \r\n2. A health worker trained on how to ask about IPV and how to provide the minimum response or beyond;\r\n3. A private setting; \r\n4. A way to ensure confidentiality; \r\n5. Time to allow for appropriate disclosure; and\r\n6. 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?"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.opensrp.repository.postgres;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.UUID;

Expand Down Expand Up @@ -243,6 +244,7 @@ public SettingsMetadata saveSetting(SettingConfiguration entity, SettingsMetadat
}

SettingsMetadata settingsMetadata = metadata != null ? metadata : createMetadata(entity, settings.getId());
settingsMetadata.setServerVersion(Calendar.getInstance().getTimeInMillis());
if (settingsMetadata != null) {

if (settingsMetadata.getId() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public synchronized SettingsMetadata saveSetting(String jsonSettingConfiguration
settingConfigurations.setId(String.valueOf(settings.getId()));

}

return settingRepository.saveSetting(settingConfigurations, metadata);
}

Expand Down

0 comments on commit 13c3fa2

Please sign in to comment.