├── shared ├── .gitignore ├── bin │ └── org │ │ ├── openmhealth │ │ └── dsu │ │ │ ├── domain │ │ │ ├── EndUser.class │ │ │ ├── EndUserUserDetails.class │ │ │ ├── EndUserRegistrationData.class │ │ │ └── EndUserRegistrationException.class │ │ │ ├── configuration │ │ │ ├── OAuth2Properties.class │ │ │ ├── TestConfiguration.class │ │ │ ├── JacksonConfiguration.class │ │ │ ├── ValidationConfiguration.class │ │ │ ├── MongoPersistenceConfiguration.class │ │ │ └── JdbcOAuth2SupportConfiguration.class │ │ │ └── converter │ │ │ ├── OffsetDateTimeToStringConverter.class │ │ │ └── StringToOffsetDateTimeConverter.class │ │ └── springframework │ │ └── data │ │ └── mapping │ │ └── model │ │ └── JsonPropertyPreservingFieldNamingStrategy.class ├── .settings │ └── org.eclipse.buildship.core.prefs ├── .classpath ├── .project ├── build.gradle └── src │ └── main │ └── java │ └── org │ ├── openmhealth │ └── dsu │ │ ├── configuration │ │ ├── TestConfiguration.java │ │ ├── OAuth2Properties.java │ │ ├── ValidationConfiguration.java │ │ ├── JacksonConfiguration.java │ │ └── JdbcOAuth2SupportConfiguration.java │ │ ├── converter │ │ ├── OffsetDateTimeToStringConverter.java │ │ └── StringToOffsetDateTimeConverter.java │ │ └── domain │ │ ├── EndUserUserDetails.java │ │ └── EndUserRegistrationException.java │ └── springframework │ └── data │ └── mapping │ └── model │ └── JsonPropertyPreservingFieldNamingStrategy.java ├── resource-server ├── .gitignore ├── src │ ├── main │ │ ├── resources │ │ │ ├── schema │ │ │ │ └── omh │ │ │ │ │ ├── header-1.x.json │ │ │ │ │ ├── date-time-1.x.json │ │ │ │ │ ├── full-date-1.x.json │ │ │ │ │ ├── schema-id-1.x.json │ │ │ │ │ ├── body-height-1.x.json │ │ │ │ │ ├── body-posture-1.x.json │ │ │ │ │ ├── body-weight-1.x.json │ │ │ │ │ ├── data-point-1.x.json │ │ │ │ │ ├── day-of-week-1.x.json │ │ │ │ │ ├── heart-rate-1.x.json │ │ │ │ │ ├── local-time-1.x.json │ │ │ │ │ ├── medication-1.x.json │ │ │ │ │ ├── part-of-day-1.x.json │ │ │ │ │ ├── rr-interval-1.x.json │ │ │ │ │ ├── step-count-1.x.json │ │ │ │ │ ├── time-frame-1.x.json │ │ │ │ │ ├── unit-value-1.x.json │ │ │ │ │ ├── activity-name-1.x.json │ │ │ │ │ ├── blood-glucose-1.x.json │ │ │ │ │ ├── blood-glucose-2.x.json │ │ │ │ │ ├── blood-pressure-1.x.json │ │ │ │ │ ├── blood-pressure-2.x.json │ │ │ │ │ ├── minute-volume-1.x.json │ │ │ │ │ ├── sleep-duration-1.x.json │ │ │ │ │ ├── time-interval-1.x.json │ │ │ │ │ ├── area-unit-value-1.x.json │ │ │ │ │ ├── body-mass-index-1.x.json │ │ │ │ │ ├── body-temperature-1.x.json │ │ │ │ │ ├── body-temperature-2.x.json │ │ │ │ │ ├── calories-burned-1.x.json │ │ │ │ │ ├── expiratory-time-1.x.json │ │ │ │ │ ├── inspiratory-time-1.x.json │ │ │ │ │ ├── kcal-unit-value-1.x.json │ │ │ │ │ ├── length-unit-value-1.x.json │ │ │ │ │ ├── mass-unit-value-1.x.json │ │ │ │ │ ├── oxygen-saturation-1.x.json │ │ │ │ │ ├── physical-activity-1.x.json │ │ │ │ │ ├── respiratory-rate-1.x.json │ │ │ │ │ ├── specimen-source-1.x.json │ │ │ │ │ ├── unit-value-range-1.x.json │ │ │ │ │ ├── volume-unit-value-1.x.json │ │ │ │ │ ├── ambient-temperature-1.x.json │ │ │ │ │ ├── blood-specimen-type-1.x.json │ │ │ │ │ ├── body-fat-percentage-1.x.json │ │ │ │ │ ├── duration-unit-value-1.x.json │ │ │ │ │ ├── breath-carbon-monoxide-1.x.json │ │ │ │ │ ├── descriptive-statistic-1.x.json │ │ │ │ │ ├── frequency-unit-value-1.x.json │ │ │ │ │ ├── medication-dose-unit-1.x.json │ │ │ │ │ ├── temperature-unit-value-1.x.json │ │ │ │ │ ├── ventilation-cycle-time-1.x.json │ │ │ │ │ ├── diastolic-blood-pressure-1.x.json │ │ │ │ │ ├── medication-prescription-1.x.json │ │ │ │ │ ├── medication-prescription-2.x.json │ │ │ │ │ ├── systolic-blood-pressure-1.x.json │ │ │ │ │ ├── duration-unit-value-range-1.x.json │ │ │ │ │ ├── medication-dose-unit-value-1.x.json │ │ │ │ │ ├── minutes-moderate-activity-1.x.json │ │ │ │ │ ├── patient-medication-schedule-1.x.json │ │ │ │ │ ├── patient-medication-schedule-2.x.json │ │ │ │ │ ├── position-during-measurement-1.x.json │ │ │ │ │ ├── medication-adherence-percent-1.x.json │ │ │ │ │ ├── medication-adherence-percent-2.x.json │ │ │ │ │ ├── single-medication-dose-taken-1.x.json │ │ │ │ │ ├── temporal-relationship-to-meal-1.x.json │ │ │ │ │ ├── medication-dose-unit-value-range-1.x.json │ │ │ │ │ ├── pharmacy-medication-dispensing-1.x.json │ │ │ │ │ ├── pharmacy-medication-dispensing-2.x.json │ │ │ │ │ ├── temporal-relationship-to-sleep-1.x.json │ │ │ │ │ ├── intervention-administration-route-2.x.json │ │ │ │ │ ├── reason-single-medication-dose-not-taken-1.x.json │ │ │ │ │ ├── temporal-relationship-to-physical-activity-1.x.json │ │ │ │ │ ├── local-time-1.0.json │ │ │ │ │ ├── full-date-1.0.json │ │ │ │ │ ├── specimen-source-1.0.json │ │ │ │ │ ├── date-time-1.0.json │ │ │ │ │ ├── data-point-1.0.json │ │ │ │ │ ├── activity-name-1.0.json │ │ │ │ │ ├── schema-id-1.0.json │ │ │ │ │ ├── systolic-blood-pressure-1.0.json │ │ │ │ │ ├── diastolic-blood-pressure-1.0.json │ │ │ │ │ ├── unit-value-1.0.json │ │ │ │ │ ├── medication-dose-unit-value-1.0.json │ │ │ │ │ ├── step-count-1.0.json │ │ │ │ │ ├── medication-dose-unit-value-range-1.0.json │ │ │ │ │ ├── schema-id-1.1.json │ │ │ │ │ ├── unit-value-range-1.0.json │ │ │ │ │ ├── temporal-relationship-to-sleep-1.0.json │ │ │ │ │ ├── kcal-unit-value-1.0.json │ │ │ │ │ ├── time-frame-1.0.json │ │ │ │ │ ├── reason-single-medication-dose-not-taken-1.0.json │ │ │ │ │ ├── blood-specimen-type-1.0.json │ │ │ │ │ ├── position-during-measurement-1.0.json │ │ │ │ │ ├── body-height-1.0.json │ │ │ │ │ ├── body-weight-1.0.json │ │ │ │ │ ├── ambient-temperature-1.0.json │ │ │ │ │ ├── calories-burned-1.0.json │ │ │ │ │ ├── accelerometer-1.0.json │ │ │ │ │ ├── ecg-1.0.json │ │ │ │ │ ├── physical-activity-1.0.json │ │ │ │ │ ├── patient-medication-schedule-1.0.json │ │ │ │ │ ├── patient-medication-schedule-2.0.json │ │ │ │ │ ├── area-unit-value-1.0.json │ │ │ │ │ ├── part-of-day-1.0.json │ │ │ │ │ ├── body-fat-percentage-1.0.json │ │ │ │ │ ├── minutes-moderate-activity-1.0.json │ │ │ │ │ ├── body-posture-1.0.json │ │ │ │ │ ├── duration-unit-value-1.0.json │ │ │ │ │ ├── duration-unit-value-range-1.0.json │ │ │ │ │ ├── sleep-duration-1.0.json │ │ │ │ │ ├── physical-activity-1.1.json │ │ │ │ │ ├── single-medication-dose-taken-1.0.json │ │ │ │ │ ├── temporal-relationship-to-physical-activity-1.0.json │ │ │ │ │ ├── frequency-unit-value-1.0.json │ │ │ │ │ ├── length-unit-value-1.0.json │ │ │ │ │ ├── medication-adherence-percent-1.0.json │ │ │ │ │ ├── medication-adherence-percent-2.0.json │ │ │ │ │ ├── mass-unit-value-1.0.json │ │ │ │ │ ├── breath-carbon-monoxide-1.0.json │ │ │ │ │ ├── blood-pressure-2.0.json │ │ │ │ │ ├── body-temperature-1.0.json │ │ │ │ │ ├── physical-activity-1.2.json │ │ │ │ │ ├── volume-unit-value-1.0.json │ │ │ │ │ ├── header-1.0.json │ │ │ │ │ ├── ventilation-cycle-time-1.0.json │ │ │ │ │ ├── day-of-week-1.0.json │ │ │ │ │ ├── blood-pressure-1.0.json │ │ │ │ │ ├── rr-interval-1.0.json │ │ │ │ │ ├── body-mass-index-1.0.json │ │ │ │ │ ├── temperature-unit-value-1.0.json │ │ │ │ │ ├── respiratory-rate-1.0.json │ │ │ │ │ ├── header-1.1.json │ │ │ │ │ ├── heart-rate-1.0.json │ │ │ │ │ ├── expiratory-time-1.0.json │ │ │ │ │ ├── inspiratory-time-1.0.json │ │ │ │ │ ├── descriptive-statistic-1.0.json │ │ │ │ │ ├── body-temperature-2.0.json │ │ │ │ │ ├── minute-volume-1.0.json │ │ │ │ │ ├── blood-glucose-1.0.json │ │ │ │ │ └── medication-dose-unit-1.0.json │ │ │ ├── validation │ │ │ │ └── omh │ │ │ │ │ └── validate-schemas │ │ │ │ │ ├── 1.0 │ │ │ │ │ └── shouldPass │ │ │ │ │ │ └── data.json │ │ │ │ │ └── 2.0 │ │ │ │ │ └── shouldPass │ │ │ │ │ └── data.json │ │ │ └── application.yml │ │ └── java │ │ │ ├── utils │ │ │ ├── DataFileValidationResult.java │ │ │ └── ValidationSummary.java │ │ │ └── org │ │ │ └── openmhealth │ │ │ └── dsu │ │ │ ├── repository │ │ │ ├── MongoDataPointRepository.java │ │ │ ├── CustomDataPointRepository.java │ │ │ ├── DataPointRepository.java │ │ │ └── ClientDetailsRepository.java │ │ │ ├── controller │ │ │ └── ApiController.java │ │ │ ├── service │ │ │ └── DataPointService.java │ │ │ ├── configuration │ │ │ ├── Application.java │ │ │ ├── MethodSecurityConfiguration.java │ │ │ ├── OAuth2ResourceServerConfiguration.java │ │ │ └── SecurityConfiguration.java │ │ │ └── domain │ │ │ └── SimpleClientDetails.java │ └── test │ │ └── java │ │ └── org │ │ └── openmhealth │ │ └── dsu │ │ ├── configuration │ │ └── IntegrationTestConfiguration.java │ │ └── repository │ │ ├── MongoDataPointRepositoryIntegrationTests.java │ │ └── MongoClientDetailsRepositoryIntegrationTests.java ├── docker │ └── Dockerfile ├── build.gradle ├── .settings │ └── org.eclipse.buildship.core.prefs ├── .project └── .classpath ├── authorization-server ├── .gitignore ├── build.gradle ├── bin │ ├── org │ │ └── openmhealth │ │ │ └── dsu │ │ │ ├── service │ │ │ ├── EndUserService.class │ │ │ ├── EndUserServiceImpl.class │ │ │ └── EndUserUserDetailsServiceImpl.class │ │ │ ├── configuration │ │ │ ├── Application.class │ │ │ ├── SecurityConfiguration.class │ │ │ ├── IntegrationTestConfiguration.class │ │ │ └── OAuth2AuthorizationServerConfiguration.class │ │ │ ├── controller │ │ │ ├── EndUserController.class │ │ │ ├── EndUserControllerIntegrationTests.class │ │ │ └── EndUserControllerIntegrationTests$Configuration.class │ │ │ └── repository │ │ │ ├── EndUserRepository.class │ │ │ ├── EndUserRepositoryIntegrationTests.class │ │ │ └── MongoEndUserRepositoryIntegrationTests.class │ └── application.yml ├── docker │ └── Dockerfile ├── .settings │ ├── org.eclipse.buildship.core.prefs │ └── org.eclipse.jdt.core.prefs ├── .project ├── .classpath └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── openmhealth │ │ │ └── dsu │ │ │ ├── service │ │ │ ├── EndUserService.java │ │ │ └── EndUserUserDetailsServiceImpl.java │ │ │ ├── repository │ │ │ └── EndUserRepository.java │ │ │ └── configuration │ │ │ ├── Application.java │ │ │ └── SecurityConfiguration.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── org │ └── openmhealth │ └── dsu │ ├── configuration │ └── IntegrationTestConfiguration.java │ └── repository │ └── MongoEndUserRepositoryIntegrationTests.java ├── resources ├── rdbms │ ├── postgresql │ │ ├── create-database.sql │ │ ├── Dockerfile │ │ └── oauth2-ddl.sql │ ├── common │ │ └── oauth2-sample-data.sql │ └── mysql │ │ └── oauth2-ddl.sql └── docker-hub │ └── deploy-to-docker-hub.sh ├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── settings.gradle ├── .settings └── org.eclipse.buildship.core.prefs ├── .project ├── docker-compose.yml ├── .travis.yml ├── docker-compose-build.yml ├── docker-compose-init-postgres.yml └── gradlew.bat /shared/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | -------------------------------------------------------------------------------- /resource-server/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | -------------------------------------------------------------------------------- /authorization-server/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | -------------------------------------------------------------------------------- /resources/rdbms/postgresql/create-database.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE omh; 2 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/header-1.x.json: -------------------------------------------------------------------------------- 1 | header-1.1.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/date-time-1.x.json: -------------------------------------------------------------------------------- 1 | date-time-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/full-date-1.x.json: -------------------------------------------------------------------------------- 1 | full-date-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/schema-id-1.x.json: -------------------------------------------------------------------------------- 1 | schema-id-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/body-height-1.x.json: -------------------------------------------------------------------------------- 1 | body-height-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/body-posture-1.x.json: -------------------------------------------------------------------------------- 1 | body-posture-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/body-weight-1.x.json: -------------------------------------------------------------------------------- 1 | body-weight-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/data-point-1.x.json: -------------------------------------------------------------------------------- 1 | data-point-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/day-of-week-1.x.json: -------------------------------------------------------------------------------- 1 | day-of-week-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/heart-rate-1.x.json: -------------------------------------------------------------------------------- 1 | heart-rate-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/local-time-1.x.json: -------------------------------------------------------------------------------- 1 | local-time-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/medication-1.x.json: -------------------------------------------------------------------------------- 1 | medication-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/part-of-day-1.x.json: -------------------------------------------------------------------------------- 1 | part-of-day-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/rr-interval-1.x.json: -------------------------------------------------------------------------------- 1 | rr-interval-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/step-count-1.x.json: -------------------------------------------------------------------------------- 1 | step-count-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/time-frame-1.x.json: -------------------------------------------------------------------------------- 1 | time-frame-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/unit-value-1.x.json: -------------------------------------------------------------------------------- 1 | unit-value-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/activity-name-1.x.json: -------------------------------------------------------------------------------- 1 | activity-name-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/blood-glucose-1.x.json: -------------------------------------------------------------------------------- 1 | blood-glucose-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/blood-glucose-2.x.json: -------------------------------------------------------------------------------- 1 | blood-glucose-2.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/blood-pressure-1.x.json: -------------------------------------------------------------------------------- 1 | blood-pressure-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/blood-pressure-2.x.json: -------------------------------------------------------------------------------- 1 | blood-pressure-2.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/minute-volume-1.x.json: -------------------------------------------------------------------------------- 1 | minute-volume-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/sleep-duration-1.x.json: -------------------------------------------------------------------------------- 1 | sleep-duration-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/time-interval-1.x.json: -------------------------------------------------------------------------------- 1 | time-interval-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/validation/omh/validate-schemas/1.0/shouldPass/data.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/validation/omh/validate-schemas/2.0/shouldPass/data.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/area-unit-value-1.x.json: -------------------------------------------------------------------------------- 1 | area-unit-value-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/body-mass-index-1.x.json: -------------------------------------------------------------------------------- 1 | body-mass-index-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/body-temperature-1.x.json: -------------------------------------------------------------------------------- 1 | body-temperature-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/body-temperature-2.x.json: -------------------------------------------------------------------------------- 1 | body-temperature-2.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/calories-burned-1.x.json: -------------------------------------------------------------------------------- 1 | calories-burned-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/expiratory-time-1.x.json: -------------------------------------------------------------------------------- 1 | expiratory-time-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/inspiratory-time-1.x.json: -------------------------------------------------------------------------------- 1 | inspiratory-time-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/kcal-unit-value-1.x.json: -------------------------------------------------------------------------------- 1 | kcal-unit-value-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/length-unit-value-1.x.json: -------------------------------------------------------------------------------- 1 | length-unit-value-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/mass-unit-value-1.x.json: -------------------------------------------------------------------------------- 1 | mass-unit-value-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/oxygen-saturation-1.x.json: -------------------------------------------------------------------------------- 1 | oxygen-saturation-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/physical-activity-1.x.json: -------------------------------------------------------------------------------- 1 | physical-activity-1.1.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/respiratory-rate-1.x.json: -------------------------------------------------------------------------------- 1 | respiratory-rate-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/specimen-source-1.x.json: -------------------------------------------------------------------------------- 1 | specimen-source-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/unit-value-range-1.x.json: -------------------------------------------------------------------------------- 1 | unit-value-range-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/volume-unit-value-1.x.json: -------------------------------------------------------------------------------- 1 | volume-unit-value-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/ambient-temperature-1.x.json: -------------------------------------------------------------------------------- 1 | ambient-temperature-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/blood-specimen-type-1.x.json: -------------------------------------------------------------------------------- 1 | blood-specimen-type-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/body-fat-percentage-1.x.json: -------------------------------------------------------------------------------- 1 | body-fat-percentage-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/duration-unit-value-1.x.json: -------------------------------------------------------------------------------- 1 | duration-unit-value-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/breath-carbon-monoxide-1.x.json: -------------------------------------------------------------------------------- 1 | breath-carbon-monoxide-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/descriptive-statistic-1.x.json: -------------------------------------------------------------------------------- 1 | descriptive-statistic-1.1.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/frequency-unit-value-1.x.json: -------------------------------------------------------------------------------- 1 | frequency-unit-value-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/medication-dose-unit-1.x.json: -------------------------------------------------------------------------------- 1 | medication-dose-unit-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/temperature-unit-value-1.x.json: -------------------------------------------------------------------------------- 1 | temperature-unit-value-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/ventilation-cycle-time-1.x.json: -------------------------------------------------------------------------------- 1 | ventilation-cycle-time-1.0.json -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .idea 3 | target 4 | 5 | *.jar 6 | !gradle/wrapper/gradle-wrapper.jar 7 | /.gradle/ 8 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/diastolic-blood-pressure-1.x.json: -------------------------------------------------------------------------------- 1 | diastolic-blood-pressure-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/medication-prescription-1.x.json: -------------------------------------------------------------------------------- 1 | medication-prescription-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/medication-prescription-2.x.json: -------------------------------------------------------------------------------- 1 | medication-prescription-2.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/systolic-blood-pressure-1.x.json: -------------------------------------------------------------------------------- 1 | systolic-blood-pressure-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/duration-unit-value-range-1.x.json: -------------------------------------------------------------------------------- 1 | duration-unit-value-range-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/medication-dose-unit-value-1.x.json: -------------------------------------------------------------------------------- 1 | medication-dose-unit-value-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/minutes-moderate-activity-1.x.json: -------------------------------------------------------------------------------- 1 | minutes-moderate-activity-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/patient-medication-schedule-1.x.json: -------------------------------------------------------------------------------- 1 | patient-medication-schedule-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/patient-medication-schedule-2.x.json: -------------------------------------------------------------------------------- 1 | patient-medication-schedule-2.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/position-during-measurement-1.x.json: -------------------------------------------------------------------------------- 1 | position-during-measurement-1.0.json -------------------------------------------------------------------------------- /authorization-server/build.gradle: -------------------------------------------------------------------------------- 1 | description = 'A simple OAuth2 authorisation server backed by a user data store.' 2 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/medication-adherence-percent-1.x.json: -------------------------------------------------------------------------------- 1 | medication-adherence-percent-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/medication-adherence-percent-2.x.json: -------------------------------------------------------------------------------- 1 | medication-adherence-percent-2.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/single-medication-dose-taken-1.x.json: -------------------------------------------------------------------------------- 1 | single-medication-dose-taken-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/temporal-relationship-to-meal-1.x.json: -------------------------------------------------------------------------------- 1 | temporal-relationship-to-meal-1.1.json -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/medication-dose-unit-value-range-1.x.json: -------------------------------------------------------------------------------- 1 | medication-dose-unit-value-range-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/pharmacy-medication-dispensing-1.x.json: -------------------------------------------------------------------------------- 1 | pharmacy-medication-dispensing-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/pharmacy-medication-dispensing-2.x.json: -------------------------------------------------------------------------------- 1 | pharmacy-medication-dispensing-2.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/temporal-relationship-to-sleep-1.x.json: -------------------------------------------------------------------------------- 1 | temporal-relationship-to-sleep-1.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/intervention-administration-route-2.x.json: -------------------------------------------------------------------------------- 1 | intervention-administration-route-2.0.json -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/reason-single-medication-dose-not-taken-1.x.json: -------------------------------------------------------------------------------- 1 | reason-single-medication-dose-not-taken-1.0.json -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'omh-dsu-ri' 2 | include 'shared' 3 | include 'authorization-server' 4 | include 'resource-server' 5 | 6 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/temporal-relationship-to-physical-activity-1.x.json: -------------------------------------------------------------------------------- 1 | temporal-relationship-to-physical-activity-1.0.json -------------------------------------------------------------------------------- /shared/bin/org/openmhealth/dsu/domain/EndUser.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/shared/bin/org/openmhealth/dsu/domain/EndUser.class -------------------------------------------------------------------------------- /shared/bin/org/openmhealth/dsu/domain/EndUserUserDetails.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/shared/bin/org/openmhealth/dsu/domain/EndUserUserDetails.class -------------------------------------------------------------------------------- /shared/bin/org/openmhealth/dsu/configuration/OAuth2Properties.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/shared/bin/org/openmhealth/dsu/configuration/OAuth2Properties.class -------------------------------------------------------------------------------- /shared/bin/org/openmhealth/dsu/domain/EndUserRegistrationData.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/shared/bin/org/openmhealth/dsu/domain/EndUserRegistrationData.class -------------------------------------------------------------------------------- /shared/bin/org/openmhealth/dsu/configuration/TestConfiguration.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/shared/bin/org/openmhealth/dsu/configuration/TestConfiguration.class -------------------------------------------------------------------------------- /shared/bin/org/openmhealth/dsu/configuration/JacksonConfiguration.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/shared/bin/org/openmhealth/dsu/configuration/JacksonConfiguration.class -------------------------------------------------------------------------------- /shared/bin/org/openmhealth/dsu/domain/EndUserRegistrationException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/shared/bin/org/openmhealth/dsu/domain/EndUserRegistrationException.class -------------------------------------------------------------------------------- /authorization-server/bin/org/openmhealth/dsu/service/EndUserService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/authorization-server/bin/org/openmhealth/dsu/service/EndUserService.class -------------------------------------------------------------------------------- /shared/bin/org/openmhealth/dsu/configuration/ValidationConfiguration.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/shared/bin/org/openmhealth/dsu/configuration/ValidationConfiguration.class -------------------------------------------------------------------------------- /authorization-server/bin/org/openmhealth/dsu/configuration/Application.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/authorization-server/bin/org/openmhealth/dsu/configuration/Application.class -------------------------------------------------------------------------------- /authorization-server/bin/org/openmhealth/dsu/service/EndUserServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/authorization-server/bin/org/openmhealth/dsu/service/EndUserServiceImpl.class -------------------------------------------------------------------------------- /authorization-server/bin/org/openmhealth/dsu/controller/EndUserController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/authorization-server/bin/org/openmhealth/dsu/controller/EndUserController.class -------------------------------------------------------------------------------- /authorization-server/bin/org/openmhealth/dsu/repository/EndUserRepository.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/authorization-server/bin/org/openmhealth/dsu/repository/EndUserRepository.class -------------------------------------------------------------------------------- /shared/bin/org/openmhealth/dsu/configuration/MongoPersistenceConfiguration.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/shared/bin/org/openmhealth/dsu/configuration/MongoPersistenceConfiguration.class -------------------------------------------------------------------------------- /shared/bin/org/openmhealth/dsu/converter/OffsetDateTimeToStringConverter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/shared/bin/org/openmhealth/dsu/converter/OffsetDateTimeToStringConverter.class -------------------------------------------------------------------------------- /shared/bin/org/openmhealth/dsu/converter/StringToOffsetDateTimeConverter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/shared/bin/org/openmhealth/dsu/converter/StringToOffsetDateTimeConverter.class -------------------------------------------------------------------------------- /shared/bin/org/openmhealth/dsu/configuration/JdbcOAuth2SupportConfiguration.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/shared/bin/org/openmhealth/dsu/configuration/JdbcOAuth2SupportConfiguration.class -------------------------------------------------------------------------------- /authorization-server/bin/org/openmhealth/dsu/configuration/SecurityConfiguration.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/authorization-server/bin/org/openmhealth/dsu/configuration/SecurityConfiguration.class -------------------------------------------------------------------------------- /authorization-server/bin/org/openmhealth/dsu/service/EndUserUserDetailsServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/authorization-server/bin/org/openmhealth/dsu/service/EndUserUserDetailsServiceImpl.class -------------------------------------------------------------------------------- /authorization-server/bin/org/openmhealth/dsu/configuration/IntegrationTestConfiguration.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/authorization-server/bin/org/openmhealth/dsu/configuration/IntegrationTestConfiguration.class -------------------------------------------------------------------------------- /authorization-server/bin/org/openmhealth/dsu/controller/EndUserControllerIntegrationTests.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/authorization-server/bin/org/openmhealth/dsu/controller/EndUserControllerIntegrationTests.class -------------------------------------------------------------------------------- /authorization-server/bin/org/openmhealth/dsu/repository/EndUserRepositoryIntegrationTests.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/authorization-server/bin/org/openmhealth/dsu/repository/EndUserRepositoryIntegrationTests.class -------------------------------------------------------------------------------- /shared/bin/org/springframework/data/mapping/model/JsonPropertyPreservingFieldNamingStrategy.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/shared/bin/org/springframework/data/mapping/model/JsonPropertyPreservingFieldNamingStrategy.class -------------------------------------------------------------------------------- /authorization-server/bin/org/openmhealth/dsu/repository/MongoEndUserRepositoryIntegrationTests.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/authorization-server/bin/org/openmhealth/dsu/repository/MongoEndUserRepositoryIntegrationTests.class -------------------------------------------------------------------------------- /authorization-server/bin/org/openmhealth/dsu/configuration/OAuth2AuthorizationServerConfiguration.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/authorization-server/bin/org/openmhealth/dsu/configuration/OAuth2AuthorizationServerConfiguration.class -------------------------------------------------------------------------------- /authorization-server/bin/org/openmhealth/dsu/controller/EndUserControllerIntegrationTests$Configuration.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmhealth/omh-dsu-ri/HEAD/authorization-server/bin/org/openmhealth/dsu/controller/EndUserControllerIntegrationTests$Configuration.class -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Mar 04 12:08:15 CET 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-bin.zip 7 | -------------------------------------------------------------------------------- /.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | connection.arguments= 2 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 3 | connection.gradle.user.home=null 4 | connection.java.home=null 5 | connection.jvm.arguments= 6 | connection.project.dir= 7 | derived.resources=.gradle,build 8 | eclipse.preferences.version=1 9 | project.path=\: 10 | -------------------------------------------------------------------------------- /resources/rdbms/postgresql/Dockerfile: -------------------------------------------------------------------------------- 1 | # This image adds the authorization schema and sample OAuth 2.0 credentials to a PostgreSQL database. 2 | 3 | FROM postgres:latest 4 | MAINTAINER Emerson Farrugia 5 | # Originally contributed by Matthew Schulkind . 6 | 7 | COPY create-database.sql oauth2-ddl.sql /docker-entrypoint-initdb.d/ 8 | -------------------------------------------------------------------------------- /resource-server/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM java:openjdk-8-jre 2 | MAINTAINER Emerson Farrugia 3 | 4 | ENV SERVER_PREFIX /opt/omh-dsu-ri/resource-server 5 | 6 | RUN mkdir -p $SERVER_PREFIX 7 | ADD resource-server.jar $SERVER_PREFIX/ 8 | EXPOSE 8083 9 | 10 | CMD /usr/bin/java -jar $SERVER_PREFIX/resource-server.jar --spring.config.location=file:$SERVER_PREFIX/ 11 | -------------------------------------------------------------------------------- /resource-server/build.gradle: -------------------------------------------------------------------------------- 1 | description = 'An OAuth 2.0 resource server that manages data point resources.' 2 | 3 | dependencies { 4 | compile 'com.github.fge:json-schema-validator:2.2.5' 5 | compile "org.openmhealth.schema:omh-schema-sdk:${omhSchemaSdkVersion}" 6 | compile group: 'org.json', name: 'json', version: '20090211' 7 | 8 | testCompile 'com.jayway.jsonpath:json-path' 9 | } -------------------------------------------------------------------------------- /authorization-server/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM java:openjdk-8-jre 2 | MAINTAINER Emerson Farrugia 3 | 4 | ENV SERVER_PREFIX /opt/omh-dsu-ri/authorization-server 5 | 6 | RUN mkdir -p $SERVER_PREFIX 7 | ADD authorization-server.jar $SERVER_PREFIX/ 8 | EXPOSE 8082 9 | 10 | CMD /usr/bin/java -jar $SERVER_PREFIX/authorization-server.jar --spring.config.location=file:$SERVER_PREFIX/ 11 | -------------------------------------------------------------------------------- /resources/rdbms/common/oauth2-sample-data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO oauth_client_details ( 2 | client_id, 3 | client_secret, 4 | scope, 5 | resource_ids, 6 | authorized_grant_types, 7 | authorities 8 | ) 9 | VALUES ( 10 | 'testClient', 11 | 'testClientSecret', 12 | 'read_data_points,write_data_points,delete_data_points', 13 | 'dataPoints', 14 | 'authorization_code,implicit,password,refresh_token', 15 | 'ROLE_CLIENT' 16 | ); -------------------------------------------------------------------------------- /shared/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | build.commands=org.eclipse.jdt.core.javabuilder 2 | connection.arguments= 3 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 4 | connection.gradle.user.home=null 5 | connection.java.home=null 6 | connection.jvm.arguments= 7 | connection.project.dir=.. 8 | derived.resources=.gradle,build 9 | eclipse.preferences.version=1 10 | natures=org.eclipse.jdt.core.javanature 11 | project.path=\:shared 12 | -------------------------------------------------------------------------------- /resource-server/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | build.commands=org.eclipse.jdt.core.javabuilder 2 | connection.arguments= 3 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 4 | connection.gradle.user.home=null 5 | connection.java.home=null 6 | connection.jvm.arguments= 7 | connection.project.dir=.. 8 | derived.resources=.gradle,build 9 | eclipse.preferences.version=1 10 | natures=org.eclipse.jdt.core.javanature 11 | project.path=\:resource-server 12 | -------------------------------------------------------------------------------- /authorization-server/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | build.commands=org.eclipse.jdt.core.javabuilder 2 | connection.arguments= 3 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 4 | connection.gradle.user.home=null 5 | connection.java.home=null 6 | connection.jvm.arguments= 7 | connection.project.dir=.. 8 | derived.resources=.gradle,build 9 | eclipse.preferences.version=1 10 | natures=org.eclipse.jdt.core.javanature 11 | project.path=\:authorization-server 12 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | omh-dsu-ri 4 | Project omh-dsu-ri created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/local-time-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "string", 4 | "description": "This schema describes local time in a 24-hour clock format (with optional milliseconds).", 5 | "references": [ 6 | { 7 | "description": "Reference RFC 3339 5.6 for details.", 8 | "url": "http://tools.ietf.org/html/rfc3339#section-5.6" 9 | } 10 | ], 11 | "pattern": "^([01]\\d|2[0-3]):[0-5]\\d:([0-5]\\d|60)(.\\d{1,3})?$" 12 | } 13 | -------------------------------------------------------------------------------- /shared/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/full-date-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a full date (for example: 2014-11-20). See RFC 3339 5.6 for details.", 5 | "type": "string", 6 | 7 | "references": [ 8 | { 9 | "description": "The SNOMED code represents Date (qualifier value).", 10 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/410672004" 11 | } 12 | ], 13 | 14 | "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" 15 | } 16 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | # MongoDB is used to store data points and user account information. 2 | mongo: 3 | image: mongo:latest 4 | 5 | # PostgreSQL is used to store OAuth 2.0 client credentials and access tokens. 6 | postgres: 7 | image: postgres:latest 8 | 9 | authorizationserver: 10 | image: openmhealth/omh-dsu-authorization-server:latest 11 | links: 12 | - mongo:omh-mongo 13 | - postgres:omh-postgres 14 | ports: 15 | - "8082:8082" 16 | 17 | resourceserver: 18 | image: openmhealth/omh-dsu-resource-server:latest 19 | links: 20 | - mongo:omh-mongo 21 | - postgres:omh-postgres 22 | ports: 23 | - "8083:8083" 24 | -------------------------------------------------------------------------------- /shared/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | shared 4 | Project shared created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.buildship.core.gradleprojectnature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk8 4 | 5 | notifications: 6 | slack: 7 | rooms: 8 | secure: HxrF1m7dSi+gSAAqHtV9+a4DO6T2ggRTxzJ3F8lJRgnA+mPj7uoOfyoUVipf6G0YNAGqeV6mDsvM1U//qEAgoUOUxLwCc8xvEu5moF8oiAuYDoEVBE/JZeiUGMZ7/xcqt9WlS7ef4uMNeN9BDIhnlCZs4IjXHUuRUFDsWquleFo= 9 | sudo: false 10 | 11 | cache: 12 | directories: 13 | - $HOME/.gradle/wrapper/dists/gradle-2.11-bin 14 | 15 | addons: 16 | hosts: 17 | - omh-mongo 18 | - omh-postgres 19 | 20 | services: 21 | - mongodb 22 | - postgresql 23 | 24 | before_script: 25 | - psql -f resources/rdbms/postgresql/create-database.sql -U postgres 26 | - psql -f resources/rdbms/postgresql/oauth2-ddl.sql -U postgres 27 | 28 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/specimen-source-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "type": "string", 5 | "description": "The source of the specimen analyzed. This is an incomplete value set. More values will be added soon.", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents Body substance sample (specimen)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/309050000" 10 | } 11 | ], 12 | 13 | "enum": [ 14 | "interstitial fluid", 15 | "capillary blood", 16 | "plasma", 17 | "serum", 18 | "tears", 19 | "whole blood" 20 | ] 21 | } -------------------------------------------------------------------------------- /resource-server/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | resource-server 4 | Project resource-server created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.buildship.core.gradleprojectnature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /authorization-server/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | authorization-server 4 | Project authorization-server created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.buildship.core.gradleprojectnature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/date-time-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "description": "This schema represents a point in time (ISO8601). If a timezone is not included, the timezone is assumed to be UTC.", 4 | "type": "string", 5 | "references": [ 6 | { 7 | "description": "Reference RFC 3339 5.6 for details.", 8 | "url": "http://tools.ietf.org/html/rfc3339#section-5.6" 9 | }, 10 | { 11 | "description": "The SNOMED codes represent Single point in time (qualifier value).", 12 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/123029007" 13 | } 14 | ], 15 | "format": "date-time" 16 | } 17 | -------------------------------------------------------------------------------- /authorization-server/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=1.8 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.source=1.8 13 | -------------------------------------------------------------------------------- /shared/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile 'org.springframework.data:spring-data-commons' 3 | compile 'org.springframework.data:spring-data-mongodb' 4 | compile 'org.springframework:spring-jdbc' 5 | compile 'org.springframework:spring-tx' 6 | // the tomcat-jdbc dependency chooses the connection pool to use when talking to a relational database and triggers 7 | // the creation of a javax.sql.DataSource by DataSourceAutoConfiguration 8 | runtime 'org.apache.tomcat:tomcat-jdbc' 9 | 10 | testCompile 'org.mongodb:mongo-java-driver' 11 | // if you're using MySQL instead of PostgreSQL, pull in the mysql-connector-java dependency 12 | // testCompile 'mysql:mysql-connector-java' 13 | testCompile "org.postgresql:postgresql" 14 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/data-point-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "This schema represents a data point.", 5 | 6 | "definitions": { 7 | "header": { 8 | "$ref": "header-1.x.json" 9 | } 10 | }, 11 | 12 | "properties": { 13 | "header": { 14 | "description": "The header of the data point.", 15 | "$ref": "#/definitions/header" 16 | }, 17 | "body": { 18 | "description": "The body of the data point. This object should conform to the schema identifier in the header property.", 19 | "type": "object" 20 | } 21 | }, 22 | "required": ["header", "body"] 23 | } -------------------------------------------------------------------------------- /docker-compose-build.yml: -------------------------------------------------------------------------------- 1 | # MongoDB is used to store data points and user account information. 2 | mongo: 3 | image: mongo:latest 4 | 5 | # PostgreSQL is used to store OAuth 2.0 client credentials and access tokens. Instead of running the vanilla image, 6 | # this Compose file adds initialization scripts to the vanilla image and runs that. The scripts create the database 7 | # tables necessary to store credentials and tokens. 8 | postgres: 9 | build: resources/rdbms/postgresql 10 | 11 | authorizationserver: 12 | build: authorization-server/docker 13 | links: 14 | - mongo:omh-mongo 15 | - postgres:omh-postgres 16 | ports: 17 | - "8082:8082" 18 | 19 | resourceserver: 20 | build: resource-server/docker 21 | links: 22 | - mongo:omh-mongo 23 | - postgres:omh-postgres 24 | ports: 25 | - "8083:8083" 26 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/activity-name-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "The name(s) of the physical activity(ies) in which the person is engaged. It is recommended that the activity name be drawn from the CDC guidelines to facilitate mapping to standard energy expenditure values (METs)", 5 | 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents Activity", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/257733005" 10 | }, 11 | { 12 | "description": "CDC guidelines on standard energy expenditure values (METs).", 13 | "url": "http://www.startwalkingnow.org/documents/PA_Intensity_table_2_1.pdf" 14 | } 15 | ], 16 | "type": "string" 17 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/schema-id-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a JSON Schema identifier.", 5 | 6 | "type": "object", 7 | 8 | "properties": { 9 | "namespace": { 10 | "description": "The namespace of the schema. A namespace serves to disambiguate schemas with conflicting names.", 11 | "type": "string" 12 | }, 13 | "name": { 14 | "description": "The name of the schema.", 15 | "type": "string" 16 | }, 17 | "version": { 18 | "description": "The version of the schema, e.g. 1.0.", 19 | "type": "string" 20 | } 21 | }, 22 | "required": [ 23 | "namespace", 24 | "name", 25 | "version" 26 | ] 27 | } -------------------------------------------------------------------------------- /docker-compose-init-postgres.yml: -------------------------------------------------------------------------------- 1 | # MongoDB is used to store data points and user account information. 2 | mongo: 3 | image: mongo:latest 4 | 5 | # PostgreSQL is used to store OAuth 2.0 client credentials and access tokens. Instead of running the vanilla image, 6 | # this Compose file adds initialization scripts to the vanilla image and runs that. The scripts create the database 7 | # tables necessary to store credentials and tokens. 8 | postgres: 9 | build: resources/rdbms/postgresql 10 | 11 | authorizationserver: 12 | image: openmhealth/omh-dsu-authorization-server:latest 13 | links: 14 | - mongo:omh-mongo 15 | - postgres:omh-postgres 16 | ports: 17 | - "8082:8082" 18 | 19 | resourceserver: 20 | image: openmhealth/omh-dsu-resource-server:latest 21 | links: 22 | - mongo:omh-mongo 23 | - postgres:omh-postgres 24 | ports: 25 | - "8083:8083" 26 | -------------------------------------------------------------------------------- /authorization-server/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/systolic-blood-pressure-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "This schema represents a person's systolic blood pressure.", 5 | "references": [ 6 | { 7 | "description": "The SNOMED code represents systolic blood pressure (observable entity)", 8 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/271649006" 9 | } 10 | ], 11 | 12 | "definitions": { 13 | "unit_value": { 14 | "$ref": "unit-value-1.x.json" 15 | } 16 | }, 17 | 18 | "allOf": [ 19 | { 20 | "$ref": "#/definitions/unit_value" 21 | }, 22 | { 23 | "properties": { 24 | "unit": { 25 | "enum": ["mmHg"] 26 | } 27 | } 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/diastolic-blood-pressure-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "This schema represents a person's diastolic blood pressure.", 5 | "references": [ 6 | { 7 | "description": "The SNOMED code represents diastolic blood pressure (observable entity)", 8 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/271650006" 9 | } 10 | ], 11 | 12 | "definitions": { 13 | "unit_value": { 14 | "$ref": "unit-value-1.x.json" 15 | } 16 | }, 17 | 18 | "allOf": [ 19 | { 20 | "$ref": "#/definitions/unit_value" 21 | }, 22 | { 23 | "properties": { 24 | "unit": { 25 | "enum": ["mmHg"] 26 | } 27 | } 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /resources/docker-hub/deploy-to-docker-hub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BASEDIR=$(pwd) 4 | TAG=$(git describe --exact-match) 5 | 6 | if [[ ! ${TAG} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then 7 | echo "The tag ${TAG} isn't a valid version tag." 8 | exit 9 | fi 10 | 11 | VERSION=${TAG#v} 12 | 13 | cd ${BASEDIR}/authorization-server/docker 14 | docker build -t "openmhealth/omh-dsu-authorization-server:latest" . 15 | docker build -t "openmhealth/omh-dsu-authorization-server:${VERSION}" . 16 | docker push "openmhealth/omh-dsu-authorization-server:latest" 17 | docker push "openmhealth/omh-dsu-authorization-server:${VERSION}" 18 | 19 | cd ${BASEDIR}/resource-server/docker 20 | docker build -t "openmhealth/omh-dsu-resource-server:latest" . 21 | docker build -t "openmhealth/omh-dsu-resource-server:${VERSION}" . 22 | docker push "openmhealth/omh-dsu-resource-server:latest" 23 | docker push "openmhealth/omh-dsu-resource-server:${VERSION}" 24 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/unit-value-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a numerical value with a unit of measure.", 5 | 6 | "type": "object", 7 | 8 | "properties": { 9 | "value": { 10 | "description": "The numeric value of the element.", 11 | "type": "number" 12 | }, 13 | "unit": { 14 | "references": [ 15 | { 16 | "description": "The unit of measure of the element. Allowed values are drawn from the Common synonyms (non-UCUM) column of [subset of] UCUM, SI and English units. ", 17 | "url": "http://download.hl7.de/documents/ucum/ucumdata.html" 18 | } 19 | ], 20 | "type": "string" 21 | } 22 | }, 23 | "required": [ 24 | "value", 25 | "unit" 26 | ] 27 | } -------------------------------------------------------------------------------- /resource-server/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /resource-server/src/main/java/utils/DataFileValidationResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package utils; 18 | 19 | /** 20 | * An enumeration of possible results when validating a {@link DataFile}. 21 | * 22 | * @author Emerson Farrugia 23 | */ 24 | public enum DataFileValidationResult { 25 | 26 | PASS, 27 | FAIL; 28 | } 29 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/medication-dose-unit-value-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "This schema represents the dose of a therapeutic agent.", 5 | "references": [ 6 | { 7 | "description": "The NCIT code represents Dose", 8 | "url": "https://ncim.nci.nih.gov/ncimbrowser/ConceptReport.jsp?dictionary=NCI%20MetaThesaurus&code=C0178602" 9 | } 10 | ], 11 | "definitions": { 12 | "medication_dose_unit": { 13 | "$ref": "medication-dose-unit-1.x.json" 14 | } 15 | }, 16 | 17 | "allOf": [ 18 | { 19 | "$ref": "unit-value-1.x.json" 20 | }, 21 | { 22 | "properties": { 23 | "unit": { 24 | "$ref": "#/definitions/medication_dose_unit" 25 | } 26 | } 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/step-count-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a single measurement of number of steps. The ability to represent descriptive statistics (e.g., mean, median) will be added shortly. ", 5 | 6 | "type": "object", 7 | "references": [ 8 | { 9 | "description": "The LOINC code refers to Number of steps in unspecified time Pedometer", 10 | "url": "http://purl.bioontology.org/ontology/LNC/55423-8" 11 | } 12 | ], 13 | 14 | "definitions": { 15 | "time_frame": { 16 | "$ref": "time-frame-1.x.json" 17 | } 18 | }, 19 | 20 | "properties": { 21 | "step_count": { 22 | "type": "number" 23 | }, 24 | "effective_time_frame": { 25 | "$ref": "#/definitions/time_frame" 26 | } 27 | }, 28 | 29 | "required": ["step_count"] 30 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/medication-dose-unit-value-range-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "This schema represents the dose of a therapeutic agent as a range.", 5 | "references": [ 6 | { 7 | "description": "The NCIT code represents Dose", 8 | "url": "https://ncim.nci.nih.gov/ncimbrowser/ConceptReport.jsp?dictionary=NCI%20MetaThesaurus&code=C0178602" 9 | } 10 | ], 11 | "definitions": { 12 | "medication_dose_unit": { 13 | "$ref": "medication-dose-unit-1.x.json" 14 | } 15 | }, 16 | 17 | "allOf": [ 18 | { 19 | "$ref": "unit-value-range-1.x.json" 20 | }, 21 | { 22 | "properties": { 23 | "unit": { 24 | "$ref": "#/definitions/medication_dose_unit" 25 | } 26 | } 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /resources/rdbms/postgresql/oauth2-ddl.sql: -------------------------------------------------------------------------------- 1 | \c omh 2 | 3 | CREATE TABLE oauth_access_token ( 4 | token_id VARCHAR(256), 5 | token BYTEA, 6 | authentication_id VARCHAR(256), 7 | user_name VARCHAR(256), 8 | client_id VARCHAR(256), 9 | authentication BYTEA, 10 | refresh_token VARCHAR(256) 11 | ); 12 | 13 | CREATE TABLE oauth_refresh_token ( 14 | token_id VARCHAR(256), 15 | token BYTEA, 16 | authentication BYTEA 17 | ); 18 | 19 | CREATE TABLE oauth_client_details ( 20 | client_id VARCHAR(256) PRIMARY KEY, 21 | resource_ids VARCHAR(256), 22 | client_secret VARCHAR(256), 23 | scope VARCHAR(256), 24 | authorized_grant_types VARCHAR(256), 25 | web_server_redirect_uri VARCHAR(256), 26 | authorities VARCHAR(256), 27 | access_token_validity INTEGER, 28 | refresh_token_validity INTEGER, 29 | additional_information VARCHAR(4096), 30 | autoapprove VARCHAR(256) 31 | ); 32 | 33 | -------------------------------------------------------------------------------- /resources/rdbms/mysql/oauth2-ddl.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE omh; 2 | USE omh; 3 | 4 | CREATE TABLE oauth_access_token ( 5 | token_id VARCHAR(256), 6 | token BLOB, 7 | authentication_id VARCHAR(256), 8 | user_name VARCHAR(256), 9 | client_id VARCHAR(256), 10 | authentication BLOB, 11 | refresh_token VARCHAR(256) 12 | ); 13 | 14 | CREATE TABLE oauth_refresh_token ( 15 | token_id VARCHAR(256), 16 | token BLOB, 17 | authentication BLOB 18 | ); 19 | 20 | CREATE TABLE oauth_client_details ( 21 | client_id VARCHAR(256) PRIMARY KEY, 22 | resource_ids VARCHAR(256), 23 | client_secret VARCHAR(256), 24 | scope VARCHAR(256), 25 | authorized_grant_types VARCHAR(256), 26 | web_server_redirect_uri VARCHAR(256), 27 | authorities VARCHAR(256), 28 | access_token_validity INTEGER, 29 | refresh_token_validity INTEGER, 30 | additional_information VARCHAR(4096), 31 | autoapprove VARCHAR(256) 32 | ); 33 | 34 | 35 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/schema-id-1.1.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a JSON Schema identifier.", 5 | 6 | "type": "object", 7 | 8 | "properties": { 9 | "namespace": { 10 | "description": "The namespace of the schema. A namespace serves to disambiguate schemas with conflicting names.", 11 | "type": "string" 12 | }, 13 | "name": { 14 | "description": "The name of the schema.", 15 | "type": "string" 16 | }, 17 | "version": { 18 | "description": "The version of the schema, e.g. 1.0.", 19 | "type": "string" 20 | }, 21 | "url": { 22 | "description": "A URL to retrieve the schema. If a URL is not specified, it is assumed that the schema can be located using other means.", 23 | "type": "string", 24 | "format": "uri" 25 | } 26 | }, 27 | "required": [ 28 | "namespace", 29 | "name", 30 | "version" 31 | ] 32 | } -------------------------------------------------------------------------------- /resource-server/src/main/java/org/openmhealth/dsu/repository/MongoDataPointRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.repository; 18 | 19 | /** 20 | * A data point repository interface for MongoDB. This interface is necessary to get Spring Data to link up its 21 | * generated {@link DataPointRepository} implementation with {@link MongoDataPointRepositoryImpl}. 22 | * 23 | * @author Emerson Farrugia 24 | */ 25 | public interface MongoDataPointRepository extends DataPointRepository { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/unit-value-range-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a range of numerical values with a unit of measure. The lower and upper boundaries are included in the interval.", 5 | 6 | "type": "object", 7 | 8 | "properties": { 9 | "low_value": { 10 | "description": "The lower boundary of the range.", 11 | "type": "number" 12 | }, 13 | "high_value": { 14 | "description": "The upper boundary of the range.", 15 | "type": "number" 16 | }, 17 | "unit": { 18 | "references": [ 19 | { 20 | "description": "The unit of measure of the element. Allowed values are drawn from the Common synonyms (non-UCUM) column of [subset of] UCUM, SI and English units. ", 21 | "url": "http://download.hl7.de/documents/ucum/ucumdata.html" 22 | } 23 | ], 24 | "type": "string" 25 | } 26 | }, 27 | "required": [ 28 | "low_value", 29 | "high_value", 30 | "unit" 31 | ] 32 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/temporal-relationship-to-sleep-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "type": "string", 5 | "description": "The temporal relationship of a clinical measure or assessment to sleep. (Will add phases of sleep later, depending on use case.)", 6 | "references": [ 7 | { 8 | "value": "before sleeping", 9 | "description": "The SNOMED code represents Before sleeping (qualifier value)", 10 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/307155000" 11 | }, 12 | { 13 | "value": "during sleep", 14 | "description": "The SNOMED code represents During sleep (qualifier value)", 15 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/309610004" 16 | }, 17 | { 18 | "value": "on waking", 19 | "description": "The SNOMED code represents On waking (qualifier value)", 20 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/307156004" 21 | } 22 | ], 23 | "enum": [ 24 | "before sleeping", 25 | "during sleep", 26 | "on waking" 27 | ] 28 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/kcal-unit-value-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents an amount (value) of kilocalories (unit of measure).", 5 | 6 | "type": "object", 7 | 8 | "references": [ 9 | { 10 | "description": "The SNOMED code represents kilocalorie (kcal)", 11 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/258791007" 12 | } 13 | ], 14 | "allOf": [ 15 | { 16 | "$ref": "unit-value-1.x.json" 17 | }, 18 | { 19 | "properties": { 20 | "unit": { 21 | "references": [ 22 | { 23 | "description": "The unit of measure of the element. The allowed value is kcal. This is not a standard (see http://unitsofmeasure.org/ucum.html#para-43), but it is the one commonly and widely used.", 24 | "url": "http://unitsofmeasure.org/ucum.html#datyp2apdxatblxmp" 25 | } 26 | ], 27 | "enum": ["kcal"] 28 | } 29 | } 30 | } 31 | ] 32 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/time-frame-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema describes a time frame as a point in time or a time interval.", 5 | 6 | "type": "object", 7 | "references": [ 8 | { 9 | "description": "The SNOMED codes represent Time frame (qualifier value).", 10 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/7389001" 11 | } 12 | ], 13 | 14 | "definitions": { 15 | "date_time": { 16 | "$ref": "date-time-1.x.json" 17 | }, 18 | 19 | "time_interval": { 20 | "$ref": "time-interval-1.x.json" 21 | } 22 | }, 23 | 24 | "oneOf": [ 25 | { 26 | "properties": { 27 | "date_time": { 28 | "$ref": "#/definitions/date_time" 29 | } 30 | }, 31 | "required": [ "date_time"] 32 | }, 33 | { 34 | "properties": { 35 | "time_interval": { 36 | "$ref": "#/definitions/time_interval" 37 | } 38 | }, 39 | "required": [ "time_interval"] 40 | } 41 | ] 42 | } -------------------------------------------------------------------------------- /resource-server/src/test/java/org/openmhealth/dsu/configuration/IntegrationTestConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.configuration; 18 | 19 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 20 | import org.springframework.context.annotation.Configuration; 21 | 22 | 23 | /** 24 | * An integration test configuration which enables Spring Boot auto-configuration. 25 | * 26 | * @author Emerson Farrugia 27 | */ 28 | // TODO set up Gradle in a way that this class can be shared 29 | @Configuration 30 | @EnableAutoConfiguration 31 | public class IntegrationTestConfiguration { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /authorization-server/src/main/java/org/openmhealth/dsu/service/EndUserService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.service; 18 | 19 | import org.openmhealth.dsu.domain.EndUser; 20 | import org.openmhealth.dsu.domain.EndUserRegistrationData; 21 | 22 | import java.util.Optional; 23 | 24 | 25 | /** 26 | * A service that manages user accounts. 27 | * 28 | * @author Emerson Farrugia 29 | */ 30 | public interface EndUserService { 31 | 32 | boolean doesUserExist(String username); 33 | 34 | void registerUser(EndUserRegistrationData registrationData); 35 | 36 | Optional findUser(String username); 37 | } 38 | -------------------------------------------------------------------------------- /authorization-server/src/test/java/org/openmhealth/dsu/configuration/IntegrationTestConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.configuration; 18 | 19 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 20 | import org.springframework.context.annotation.Configuration; 21 | 22 | 23 | /** 24 | * An integration test configuration which enables Spring Boot auto-configuration. 25 | * 26 | * @author Emerson Farrugia 27 | */ 28 | // TODO set up Gradle in a way that this class can be shared 29 | @Configuration 30 | @EnableAutoConfiguration 31 | public class IntegrationTestConfiguration { 32 | 33 | } 34 | -------------------------------------------------------------------------------- /shared/src/main/java/org/openmhealth/dsu/configuration/TestConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.configuration; 18 | 19 | import org.springframework.context.annotation.Configuration; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | 27 | /** 28 | * A {@link Configuration} used for a particular test. 29 | * 30 | * @author emerson 31 | */ 32 | @Configuration 33 | @Target(ElementType.TYPE) 34 | @Retention(RetentionPolicy.RUNTIME) 35 | public @interface TestConfiguration { 36 | 37 | } -------------------------------------------------------------------------------- /shared/src/main/java/org/openmhealth/dsu/configuration/OAuth2Properties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.configuration; 18 | 19 | /** 20 | * An interface containing shared properties for OAuth2 configurations. 21 | * 22 | * @author Emerson Farrugia 23 | */ 24 | public interface OAuth2Properties { 25 | 26 | String CLIENT_ROLE = "ROLE_CLIENT"; 27 | String END_USER_ROLE = "ROLE_END_USER"; 28 | String DATA_POINT_RESOURCE_ID = "dataPoints"; 29 | String DATA_POINT_READ_SCOPE = "read_data_points"; 30 | String DATA_POINT_WRITE_SCOPE = "write_data_points"; 31 | String DATA_POINT_DELETE_SCOPE = "delete_data_points"; 32 | } 33 | -------------------------------------------------------------------------------- /authorization-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2014 Open mHealth 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # FIXME revise this if mixing data stores 18 | dataStore: mongo 19 | 20 | server: 21 | port: 8082 22 | 23 | spring: 24 | application: 25 | name: Open mHealth DSU authorisation server 26 | data: 27 | mongodb: 28 | host: localhost 29 | database: omh 30 | #port: 27017 31 | datasource: 32 | driverClassName: org.postgresql.Driver 33 | url: jdbc:postgresql://localhost:5432/omh 34 | username: postgres 35 | password: postgres 36 | jackson: 37 | serialization: 38 | INDENT_OUTPUT: true 39 | 40 | logging: 41 | level: 42 | org.springframework: INFO 43 | -------------------------------------------------------------------------------- /resource-server/src/main/java/org/openmhealth/dsu/controller/ApiController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.controller; 18 | 19 | import org.springframework.stereotype.Controller; 20 | import org.springframework.web.bind.annotation.RequestMapping; 21 | 22 | import java.lang.annotation.*; 23 | 24 | 25 | /** 26 | * A specialisation of the {@link Controller} annotation that controls the version number of the DSU API. 27 | * 28 | * @author Emerson Farrugia 29 | */ 30 | @Target({ElementType.TYPE}) 31 | @Retention(RetentionPolicy.RUNTIME) 32 | @Documented 33 | @Controller 34 | @RequestMapping("/v1.0.M1") 35 | public @interface ApiController { 36 | 37 | } 38 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/reason-single-medication-dose-not-taken-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents the given reason for missing a single prescribed dose of a medication.", 5 | 6 | "type": "object", 7 | "references": [ 8 | { 9 | "description": "The SNOMED code represents Medication regimen behavior finding (finding)", 10 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/422979000" 11 | } 12 | ], 13 | "definitions": { 14 | "medication": { 15 | "$ref": "medication-1.x.json" 16 | }, 17 | "time_frame": { 18 | "$ref": "time-frame-1.x.json" 19 | } 20 | }, 21 | 22 | "properties": { 23 | "medication": { 24 | "$ref": "#/definitions/medication" 25 | }, 26 | "effective_time_frame": { 27 | "description": "The time frame of the dose missed.", 28 | "$ref": "#/definitions/time_frame" 29 | }, 30 | "reason_for_missing_dose": { 31 | "type": "string" 32 | } 33 | }, 34 | "required": [ 35 | "medication", 36 | "effective_time_frame", 37 | "reason_for_missing_dose" 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /resource-server/src/main/java/org/openmhealth/dsu/repository/CustomDataPointRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.repository; 18 | 19 | import org.openmhealth.dsu.domain.DataPointSearchCriteria; 20 | import org.openmhealth.schema.domain.omh.DataPoint; 21 | 22 | import javax.annotation.Nullable; 23 | 24 | 25 | /** 26 | * A set of data point repository methods not automatically implemented by Spring Data repositories. 27 | * 28 | * @author Emerson Farrugia 29 | */ 30 | public interface CustomDataPointRepository { 31 | 32 | Iterable findBySearchCriteria(DataPointSearchCriteria searchCriteria, @Nullable Integer offset, 33 | @Nullable Integer limit); 34 | } 35 | -------------------------------------------------------------------------------- /shared/src/main/java/org/openmhealth/dsu/converter/OffsetDateTimeToStringConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.converter; 18 | 19 | import org.springframework.core.convert.converter.Converter; 20 | import org.springframework.stereotype.Component; 21 | 22 | import java.time.OffsetDateTime; 23 | 24 | 25 | /** 26 | * @author Emerson Farrugia 27 | */ 28 | @Component 29 | public class OffsetDateTimeToStringConverter implements Converter { 30 | 31 | @Override 32 | public String convert(OffsetDateTime source) { 33 | 34 | if (source == null) { 35 | return null; 36 | } 37 | 38 | return source.toString(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/blood-specimen-type-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "deprecation": { 4 | "reason": "This schema is now deprecated, in favor of the more generic specimen-source, which can be subset for specific usage.", 5 | "supersededBy": "omh:specimen-source:1.x", 6 | "date": "2015-10-13" 7 | }, 8 | "type": "string", 9 | "description": "The type of blood specimen analyzed.", 10 | "references": [ 11 | { 12 | "value": "whole blood", 13 | "description": "The SNOMED code represents Whole blood (substance)", 14 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/420135007" 15 | }, 16 | { 17 | "value": "plasma", 18 | "description": "The SNOMED code represents Plasma (substance)", 19 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/50863008" 20 | }, 21 | { 22 | "value": "serum", 23 | "description": "Serum is plasma without coagulating factors. The SNOMED code represents Serum (substance)", 24 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/67922002" 25 | } 26 | ], 27 | 28 | "enum": [ 29 | "whole blood", 30 | "plasma", 31 | "serum" 32 | ] 33 | } -------------------------------------------------------------------------------- /shared/src/main/java/org/openmhealth/dsu/converter/StringToOffsetDateTimeConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.converter; 18 | 19 | import org.springframework.core.convert.converter.Converter; 20 | import org.springframework.stereotype.Component; 21 | 22 | import java.time.OffsetDateTime; 23 | 24 | 25 | /** 26 | * @author Emerson Farrugia 27 | */ 28 | @Component 29 | public class StringToOffsetDateTimeConverter implements Converter { 30 | 31 | @Override 32 | public OffsetDateTime convert(String source) { 33 | 34 | if (source == null) { 35 | return null; 36 | } 37 | 38 | return OffsetDateTime.parse(source); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/position-during-measurement-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "deprecation": { 4 | "reason": "This schema is now deprecated, in favor of the more generic body-posture, which can be used to describe more than the position during a measurement.", 5 | "supersededBy": "omh:body-posture:1.x", 6 | "date": "2015-11-23" 7 | }, 8 | "type": "string", 9 | "description": "The position of the subject during a clinical measurement.", 10 | "references": [ 11 | { 12 | "value": "sitting", 13 | "description": "The SNOMED code represents Sitting position", 14 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/33586001" 15 | }, 16 | { 17 | "value": "lying down", 18 | "description": "The SNOMED code represents Recumbent body position", 19 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/102538003" 20 | }, 21 | { 22 | "value": "standing", 23 | "description": "The SNOMED code represents Orthostatic body position", 24 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/10904000" 25 | } 26 | ], 27 | "enum": [ 28 | "sitting", 29 | "lying down", 30 | "standing" 31 | ] 32 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/body-height-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a person's body height, either a single body height measurement, or the result of aggregating several measurements made over time (see Numeric descriptor schema for a list of aggregate measures)", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents Body height measure (observable entity)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/50373000" 10 | } 11 | ], 12 | "definitions": { 13 | "length_unit_value": { 14 | "$ref": "length-unit-value-1.x.json" 15 | }, 16 | "time_frame": { 17 | "$ref": "time-frame-1.x.json" 18 | }, 19 | "descriptive_statistic": { 20 | "$ref": "descriptive-statistic-1.x.json" 21 | } 22 | }, 23 | 24 | "properties": { 25 | "body_height": { 26 | "$ref": "#/definitions/length_unit_value" 27 | }, 28 | "effective_time_frame": { 29 | "$ref": "#/definitions/time_frame" 30 | }, 31 | "descriptive_statistic": { 32 | "$ref": "#/definitions/descriptive_statistic" 33 | } 34 | }, 35 | 36 | "required": [ "body_height"] 37 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/body-weight-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a person's body weight, either a single body weight measurement, or for the result of aggregating several measurements made over time (see Numeric descriptor schema for a list of aggregate measures)", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents Body weight measure (observable entity)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/363808001" 10 | } 11 | ], 12 | "definitions": { 13 | "mass_unit_value": { 14 | "$ref": "mass-unit-value-1.x.json" 15 | }, 16 | "time_frame": { 17 | "$ref": "time-frame-1.x.json" 18 | }, 19 | "descriptive_statistic": { 20 | "$ref": "descriptive-statistic-1.x.json" 21 | } 22 | }, 23 | 24 | "properties": { 25 | "body_weight": { 26 | "$ref": "#/definitions/mass_unit_value" 27 | }, 28 | "effective_time_frame": { 29 | "$ref": "#/definitions/time_frame" 30 | }, 31 | "descriptive_statistic": { 32 | "$ref": "#/definitions/descriptive_statistic" 33 | } 34 | }, 35 | 36 | "required": [ "body_weight"] 37 | } -------------------------------------------------------------------------------- /shared/src/main/java/org/openmhealth/dsu/domain/EndUserUserDetails.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.domain; 18 | 19 | 20 | import org.springframework.security.core.authority.SimpleGrantedAuthority; 21 | import org.springframework.security.core.userdetails.User; 22 | 23 | import java.util.Collections; 24 | 25 | import static org.openmhealth.dsu.configuration.OAuth2Properties.END_USER_ROLE; 26 | 27 | 28 | /** 29 | * A user's authentication details. 30 | * 31 | * @author Emerson Farrugia 32 | */ 33 | public class EndUserUserDetails extends User { 34 | 35 | public EndUserUserDetails(String username, String password) { 36 | super(username, password, Collections.singleton(new SimpleGrantedAuthority(END_USER_ROLE))); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2014 Open mHealth 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # FIXME revise this if mixing data stores 18 | dataStore: mongo 19 | 20 | server: 21 | port: 8083 22 | max-http-post-size: 10Mb 23 | 24 | spring: 25 | http: 26 | multipart: 27 | max-file-size: 10Mb 28 | max-request-size: 10Mb 29 | application: 30 | name: Open mHealth DSU resource server 31 | data: 32 | mongodb: 33 | host: localhost 34 | database: omh 35 | #port: 27017 36 | datasource: 37 | driverClassName: org.postgresql.Driver 38 | url: jdbc:postgresql://localhost:5432/omh 39 | username: postgres 40 | password: postgres 41 | jackson: 42 | serialization: 43 | INDENT_OUTPUT: true 44 | 45 | logging: 46 | level: 47 | org.springframework: INFO 48 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/ambient-temperature-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents the ambient temperature, either a single measurement, or the result of aggregating several measurements made over time (see Descriptive schema for a list of aggregate measures)", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents Ambient temperature (observable entity)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/250825003" 10 | } 11 | ], 12 | 13 | "definitions": { 14 | "temperature_unit_value": { 15 | "$ref": "temperature-unit-value-1.x.json" 16 | }, 17 | "time_frame": { 18 | "$ref": "time-frame-1.x.json" 19 | }, 20 | "descriptive_statistic": { 21 | "$ref": "descriptive-statistic-1.x.json" 22 | } 23 | }, 24 | 25 | "properties": { 26 | "ambient_temperature": { 27 | "$ref": "#/definitions/temperature_unit_value" 28 | }, 29 | "effective_time_frame": { 30 | "$ref": "#/definitions/time_frame" 31 | }, 32 | "descriptive_statistic": { 33 | "$ref": "#/definitions/descriptive_statistic" 34 | } 35 | }, 36 | 37 | "required": ["ambient_temperature"] 38 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/calories-burned-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a single measurement of amount of calories burned in kilocalories (kcal). The ability to represent descriptive statistics (e.g., mean, median) will be added shortly.", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The LOINC code represents Calories burned:Power = Energy/Time:Point in time:^Patient:Quantitative, that is, a Quantitative measure of Calories burned by a Patient at a Point in time", 9 | "url": "http://purl.bioontology.org/ontology/LNC/41981-2" 10 | } 11 | ], 12 | 13 | "definitions": { 14 | "kcal_unit_value": { 15 | "$ref": "kcal-unit-value-1.x.json" 16 | }, 17 | "time_frame": { 18 | "$ref": "time-frame-1.x.json" 19 | }, 20 | "activity_name": { 21 | "$ref": "activity-name-1.x.json" 22 | } 23 | }, 24 | 25 | "properties": { 26 | "kcal_burned": { 27 | "$ref": "#/definitions/kcal_unit_value" 28 | }, 29 | "effective_time_frame": { 30 | "$ref": "#/definitions/time_frame" 31 | }, 32 | "activity_name": { 33 | "$ref": "#/definitions/activity_name" 34 | } 35 | }, 36 | 37 | "required": ["kcal_burned"] 38 | } -------------------------------------------------------------------------------- /authorization-server/src/test/java/org/openmhealth/dsu/repository/MongoEndUserRepositoryIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.repository; 18 | 19 | import org.junit.runner.RunWith; 20 | import org.openmhealth.dsu.configuration.IntegrationTestConfiguration; 21 | import org.openmhealth.dsu.configuration.MongoPersistenceConfiguration; 22 | import org.springframework.boot.test.SpringApplicationConfiguration; 23 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 24 | 25 | 26 | /** 27 | * @author Emerson Farrugia 28 | */ 29 | @RunWith(SpringJUnit4ClassRunner.class) 30 | @SpringApplicationConfiguration(classes = { 31 | IntegrationTestConfiguration.class, 32 | MongoPersistenceConfiguration.class 33 | }) 34 | public class MongoEndUserRepositoryIntegrationTests extends EndUserRepositoryIntegrationTests { 35 | 36 | } 37 | -------------------------------------------------------------------------------- /resource-server/src/test/java/org/openmhealth/dsu/repository/MongoDataPointRepositoryIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.repository; 18 | 19 | import org.junit.runner.RunWith; 20 | import org.openmhealth.dsu.configuration.IntegrationTestConfiguration; 21 | import org.openmhealth.dsu.configuration.MongoPersistenceConfiguration; 22 | import org.springframework.boot.test.SpringApplicationConfiguration; 23 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 24 | 25 | 26 | /** 27 | * @author Emerson Farrugia 28 | */ 29 | @RunWith(SpringJUnit4ClassRunner.class) 30 | @SpringApplicationConfiguration(classes = { 31 | IntegrationTestConfiguration.class, 32 | MongoPersistenceConfiguration.class 33 | }) 34 | public class MongoDataPointRepositoryIntegrationTests extends DataPointRepositoryIntegrationTests { 35 | 36 | } 37 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/accelerometer-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "Accelerometer measure of a person", 5 | 6 | "type": "object", 7 | 8 | "definitions": { 9 | 10 | "time_frame": { 11 | "$ref": "time-frame-1.x.json" 12 | }, 13 | 14 | "temporal_relationship_to_physical_activity": { 15 | "$ref": "temporal-relationship-to-physical-activity-1.x.json" 16 | }, 17 | 18 | "unit":{ 19 | "type":"string", 20 | "enum":["mS"] 21 | } 22 | }, 23 | 24 | "properties": { 25 | 26 | "effective_time_frame": { 27 | "$ref": "#/definitions/time_frame" 28 | }, 29 | 30 | "temporal_relationship_to_physical_activity": { 31 | "$ref": "#/definitions/temporal_relationship_to_physical_activity" 32 | }, 33 | 34 | "accelerometer": { 35 | "type": "object", 36 | "properties": { 37 | 38 | "values": { 39 | "type": "object", 40 | "properties": { 41 | 42 | "x": {"type": "integer"}, 43 | 44 | "y": {"type": "integer"}, 45 | 46 | "z": {"type": "integer"} 47 | } 48 | }, 49 | 50 | "unit": { 51 | "$ref": "#/definitions/unit" 52 | } 53 | }, 54 | "required": ["values", "unit"] 55 | } 56 | 57 | }, 58 | "required": ["accelerometer", "effective_time_frame"] 59 | } 60 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/ecg-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "description": "This schema represents a part of ecg", 4 | 5 | "type": "object", 6 | 7 | "definitions": { 8 | "time_frame": { 9 | "$ref": "time-frame-1.x.json" 10 | }, 11 | "temporal_relationship_to_physical_activity": { 12 | "$ref": "temporal-relationship-to-physical-activity-1.x.json" 13 | }, 14 | 15 | "values": { 16 | "type":"array", 17 | "items":{ 18 | "type": "integer", 19 | "maximum":250, 20 | "minimum":0 21 | }, 22 | "minItems":500, 23 | "maxItems":1000 24 | }, 25 | 26 | "unit":{ 27 | "type":"string", 28 | "enum":["microVolt", "uV"] 29 | } 30 | }, 31 | 32 | "properties":{ 33 | "ecg": { 34 | "type":"object", 35 | "properties":{ 36 | "values": { 37 | "$ref": "#/definitions/values" 38 | }, 39 | "unit": { 40 | "$ref": "#/definitions/unit" 41 | } 42 | }, 43 | "required": ["values", "unit"] 44 | }, 45 | 46 | "effective_time_frame": { 47 | "$ref": "#/definitions/time_frame" 48 | }, 49 | 50 | "temporal_relationship_to_physical_activity": { 51 | "$ref": "#/definitions/temporal_relationship_to_physical_activity" 52 | } 53 | }, 54 | 55 | "required": ["ecg", "effective_time_frame"] 56 | } 57 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/physical-activity-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a single episode of physical activity.", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents Physical activity (observable entity)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/68130003" 10 | } 11 | ], 12 | "definitions": { 13 | "activity_name": { 14 | "$ref": "activity-name-1.x.json" 15 | }, 16 | "length_unit_value": { 17 | "$ref": "length-unit-value-1.x.json" 18 | }, 19 | "time_frame": { 20 | "$ref": "time-frame-1.x.json" 21 | } 22 | }, 23 | 24 | "properties": { 25 | "activity_name": { 26 | "$ref": "#/definitions/activity_name" 27 | }, 28 | "effective_time_frame": { 29 | "$ref": "#/definitions/time_frame" 30 | }, 31 | "distance": { 32 | "description": "The distance covered, if applicable.", 33 | "$ref": "#/definitions/length_unit_value" 34 | }, 35 | "reported_activity_intensity": { 36 | "description": "Self-reported intensity of the activity performed.", 37 | "type": "string", 38 | "enum": ["light", "moderate", "vigorous"] 39 | } 40 | }, 41 | 42 | "required": ["activity_name"] 43 | } 44 | -------------------------------------------------------------------------------- /resource-server/src/test/java/org/openmhealth/dsu/repository/MongoClientDetailsRepositoryIntegrationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.repository; 18 | 19 | import org.junit.runner.RunWith; 20 | import org.openmhealth.dsu.configuration.IntegrationTestConfiguration; 21 | import org.openmhealth.dsu.configuration.MongoPersistenceConfiguration; 22 | import org.springframework.boot.test.SpringApplicationConfiguration; 23 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 24 | 25 | 26 | /** 27 | * @author Emerson Farrugia 28 | */ 29 | @RunWith(SpringJUnit4ClassRunner.class) 30 | @SpringApplicationConfiguration(classes = { 31 | IntegrationTestConfiguration.class, 32 | MongoPersistenceConfiguration.class 33 | }) 34 | public class MongoClientDetailsRepositoryIntegrationTests extends ClientDetailsRepositoryIntegrationTests { 35 | 36 | } 37 | -------------------------------------------------------------------------------- /shared/src/main/java/org/openmhealth/dsu/domain/EndUserRegistrationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.domain; 18 | 19 | /** 20 | * An exception thrown to indicate a problem registering an end user. 21 | * 22 | * @author Emerson Farrugia 23 | */ 24 | public class EndUserRegistrationException extends RuntimeException { 25 | 26 | private EndUserRegistrationData registrationData; 27 | 28 | public EndUserRegistrationException(EndUserRegistrationData registrationData) { 29 | this.registrationData = registrationData; 30 | } 31 | 32 | public EndUserRegistrationException(EndUserRegistrationData registrationData, Throwable cause) { 33 | super(cause); 34 | this.registrationData = registrationData; 35 | } 36 | 37 | public EndUserRegistrationData getRegistrationData() { 38 | return registrationData; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /authorization-server/bin/application.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2014 Open mHealth 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # FIXME revise this if mixing data stores 18 | dataStore: mongo 19 | 20 | server: 21 | port: 8082 22 | 23 | spring: 24 | application: 25 | name: Open mHealth DSU authorisation server 26 | data: 27 | mongodb: 28 | host: localhost 29 | database: omh 30 | #port: 27017 31 | datasource: 32 | driverClassName: org.postgresql.Driver 33 | url: jdbc:postgresql://localhost:5432/omh 34 | username: postgres 35 | password: postgres 36 | jackson: 37 | serialization: 38 | INDENT_OUTPUT: true 39 | 40 | logging: 41 | level: 42 | org.springframework: INFO 43 | 44 | #security.oauth2.client.clientId: testClient 45 | #security.oauth2.client.clientSecret: testClientSecret 46 | #security.oauth2.client.authorized-grant-types: authorization_code,refresh_token,password 47 | #security.oauth2.client.scope: openid 48 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/patient-medication-schedule-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a medication schedule, based on the prescription e.g., atenolol 50 mg, 1 tablet at 8:00 and and 0.5 tablet at 8 pm for 30 days, with a window of +/- 1 hour.", 5 | 6 | "type": "object", 7 | 8 | "definitions": { 9 | "medication_prescription": { 10 | "$ref": "medication-prescription-1.x.json" 11 | }, 12 | "duration_unit_value": { 13 | "$ref": "duration-unit-value-1.x.json" 14 | } 15 | }, 16 | 17 | "allOf": [ 18 | { 19 | "$ref": "#/definitions/medication_prescription" 20 | }, 21 | { 22 | "properties": { 23 | "acceptable_window": { 24 | "type": "object", 25 | "description": "The amount of time before and after the set time during which it is still acceptable to take a dose of the medication. If missing, the dose must be taken at the exact time.", 26 | "properties": { 27 | "before": { 28 | "$ref": "#/definitions/duration_unit_value" 29 | }, 30 | "after": { 31 | "$ref": "#/definitions/duration_unit_value" 32 | } 33 | } 34 | } 35 | } 36 | } 37 | ] 38 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/patient-medication-schedule-2.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a medication schedule, based on the prescription e.g., atenolol 50 mg, 1 tablet at 8:00 and and 0.5 tablet at 8 pm for 30 days, with a window of +/- 1 hour.", 5 | 6 | "type": "object", 7 | 8 | "definitions": { 9 | "medication_prescription": { 10 | "$ref": "medication-prescription-2.x.json" 11 | }, 12 | "duration_unit_value": { 13 | "$ref": "duration-unit-value-1.x.json" 14 | } 15 | }, 16 | 17 | "allOf": [ 18 | { 19 | "$ref": "#/definitions/medication_prescription" 20 | }, 21 | { 22 | "properties": { 23 | "acceptable_window": { 24 | "type": "object", 25 | "description": "The amount of time before and after the set time during which it is still acceptable to take a dose of the medication. If missing, the dose must be taken at the exact time.", 26 | "properties": { 27 | "before": { 28 | "$ref": "#/definitions/duration_unit_value" 29 | }, 30 | "after": { 31 | "$ref": "#/definitions/duration_unit_value" 32 | } 33 | } 34 | } 35 | } 36 | } 37 | ] 38 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/area-unit-value-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "This schema represents an area (measure of a surface)", 5 | "references": [ 6 | { 7 | "description": "The SNOMED code represents Area", 8 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/42798000" 9 | } 10 | ], 11 | "allOf": [ 12 | { 13 | "$ref": "unit-value-1.x.json" 14 | }, 15 | { 16 | "properties": { 17 | "unit": { 18 | "references": [ 19 | { 20 | "description": "The unit of measure of the element. Basic unit is meter (m). Allowed values are drawn from the SI Area Units and English Area Units Common Synonyms (non-UCUM). The valid UCUM code is different for square inch ([sin_i]), square foot ([sft_i]), square yard ([syd_i]).", 21 | "url": "http://download.hl7.de/documents/ucum/ucumdata.html" 22 | } 23 | ], 24 | "enum": [ 25 | "mm^2", 26 | "cm^2", 27 | "m^2", 28 | "km^2", 29 | "in^2", 30 | "ft^2", 31 | "yd^2", 32 | "mi^2" 33 | ] 34 | } 35 | } 36 | } 37 | ] 38 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/part-of-day-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "The period of time in which a day is commonly divided.", 5 | 6 | "type": "string", 7 | 8 | "references": [ 9 | { 10 | "description": "The SNOMED code represents Temporal periods of day (qualifier value)", 11 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/272106006" 12 | }, 13 | { 14 | "value": "morning", 15 | "description": "The SNOMED code represents Morning (temporal qualifier)", 16 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/73775008" 17 | }, 18 | { 19 | "value": "afternoon", 20 | "description": "The SNOMED code represents Afternoon (temporal qualifier)", 21 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/422133006" 22 | }, 23 | { 24 | "value": "evening", 25 | "description": "The SNOMED code represents Evening (temporal qualifier)", 26 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/3157002" 27 | }, 28 | { 29 | "value": "night", 30 | "description": "The SNOMED code represents Night time (temporal qualifier)", 31 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/2546009" 32 | } 33 | ], 34 | "enum": [ 35 | "morning", 36 | "afternoon", 37 | "evening", 38 | "night" 39 | ] 40 | } -------------------------------------------------------------------------------- /shared/src/main/java/org/openmhealth/dsu/configuration/ValidationConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.configuration; 18 | 19 | import org.springframework.context.annotation.Bean; 20 | import org.springframework.context.annotation.Configuration; 21 | import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; 22 | 23 | import javax.validation.Validator; 24 | 25 | 26 | /** 27 | * A configuration that creates a JSR-303 Bean Validation API validator. 28 | * 29 | * @author Emerson Farrugia 30 | */ 31 | @Configuration 32 | public class ValidationConfiguration { 33 | 34 | @Bean 35 | public LocalValidatorFactoryBean localValidatorFactoryBean() { 36 | 37 | return new LocalValidatorFactoryBean(); 38 | } 39 | 40 | @Bean 41 | public Validator validator(LocalValidatorFactoryBean factoryBean) { 42 | 43 | return factoryBean.getValidator(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/body-fat-percentage-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "description": "This schema represents a person's body fat percentage.", 4 | "type": "object", 5 | "references": [ 6 | { 7 | "description": "The LOINC code represents Body fat percentage:Mass Fraction:Point in time:^Patient:Quantitative:Measured", 8 | "url": "http://purl.bioontology.org/ontology/LNC/41982-0" 9 | } 10 | ], 11 | "definitions": { 12 | "unit_value": { 13 | "$ref": "unit-value-1.x.json" 14 | }, 15 | "time_frame": { 16 | "$ref": "time-frame-1.x.json" 17 | }, 18 | "descriptive_statistic": { 19 | "$ref": "descriptive-statistic-1.x.json" 20 | } 21 | }, 22 | 23 | "properties": { 24 | "body_fat_percentage": { 25 | "allOf": [ 26 | { 27 | "$ref": "#/definitions/unit_value" 28 | }, 29 | { 30 | "properties": { 31 | "unit": { 32 | "enum": ["%"] 33 | } 34 | } 35 | } 36 | ] 37 | }, 38 | "effective_time_frame": { 39 | "$ref": "#/definitions/time_frame" 40 | }, 41 | "descriptive_statistic": { 42 | "$ref": "#/definitions/descriptive_statistic" 43 | } 44 | }, 45 | 46 | "required": ["body_fat_percentage"] 47 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/minutes-moderate-activity-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "This schema represents a single measurement of minutes of moderate-intensity activity performed. The ability to represent descriptive statistics (e.g., mean, median) will be added shortly.", 5 | "references": [ 6 | { 7 | "description": "The SNOMED code represents Physical activity target moderate exercise (finding)", 8 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/408581006" 9 | } 10 | ], 11 | "definitions": { 12 | "duration_unit_value": { 13 | "$ref": "duration-unit-value-1.x.json" 14 | }, 15 | "time_frame": { 16 | "$ref": "time-frame-1.x.json" 17 | } 18 | }, 19 | 20 | "properties": { 21 | "minutes_moderate_activity": { 22 | "allOf": [ 23 | { 24 | "$ref": "#/definitions/duration_unit_value" 25 | }, 26 | { 27 | "properties": { 28 | "unit": { 29 | "enum": [ 30 | "min" 31 | ] 32 | } 33 | } 34 | } 35 | ] 36 | }, 37 | "effective_time_frame": { 38 | "$ref": "#/definitions/time_frame" 39 | } 40 | }, 41 | 42 | "required": [ "minutes_moderate_activity"] 43 | } -------------------------------------------------------------------------------- /authorization-server/src/main/java/org/openmhealth/dsu/repository/EndUserRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.repository; 18 | 19 | import org.openmhealth.dsu.domain.EndUser; 20 | import org.springframework.data.repository.Repository; 21 | 22 | import java.util.Optional; 23 | 24 | 25 | /** 26 | * A repository of user accounts. 27 | * 28 | * @author Emerson Farrugia 29 | */ 30 | public interface EndUserRepository extends Repository { 31 | 32 | /** 33 | * @see org.springframework.data.repository.CrudRepository#findOne(java.io.Serializable) 34 | */ 35 | Optional findOne(String username); 36 | 37 | /** 38 | * @see org.springframework.data.repository.CrudRepository#save(Object) 39 | */ 40 | EndUser save(EndUser endUser); 41 | 42 | /** 43 | * @see org.springframework.data.repository.CrudRepository#delete(java.io.Serializable) 44 | */ 45 | void delete(String username); 46 | } 47 | -------------------------------------------------------------------------------- /resource-server/src/main/java/org/openmhealth/dsu/service/DataPointService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.service; 18 | 19 | import org.openmhealth.dsu.domain.DataPointSearchCriteria; 20 | import org.openmhealth.schema.domain.omh.DataPoint; 21 | 22 | import javax.annotation.Nullable; 23 | import java.util.Optional; 24 | 25 | 26 | /** 27 | * A service that manages data points. 28 | * 29 | * @author Emerson Farrugia 30 | */ 31 | public interface DataPointService { 32 | 33 | boolean exists(String id); 34 | 35 | Optional findOne(String id); 36 | 37 | Iterable findBySearchCriteria(DataPointSearchCriteria searchCriteria, @Nullable Integer offset, 38 | @Nullable Integer limit); 39 | 40 | DataPoint save(DataPoint dataPoint); 41 | 42 | Iterable save(Iterable dataPoints); 43 | 44 | void delete(String id); 45 | 46 | Long deleteByIdAndUserId(String id, String userId); 47 | } 48 | -------------------------------------------------------------------------------- /resource-server/src/main/java/org/openmhealth/dsu/repository/DataPointRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.repository; 18 | 19 | import org.openmhealth.schema.domain.omh.DataPoint; 20 | import org.springframework.data.repository.NoRepositoryBean; 21 | import org.springframework.data.repository.Repository; 22 | 23 | import java.util.Optional; 24 | 25 | 26 | /** 27 | * A repository of data points. 28 | * 29 | * @see org.springframework.data.repository.CrudRepository 30 | * @author Emerson Farrugia 31 | */ 32 | @NoRepositoryBean 33 | public interface DataPointRepository extends Repository, CustomDataPointRepository { 34 | 35 | boolean exists(String id); 36 | 37 | Optional findOne(String id); 38 | 39 | DataPoint save(DataPoint dataPoint); 40 | 41 | Iterable save(Iterable dataPoints); 42 | 43 | void delete(String id); 44 | 45 | Long deleteByIdAndHeaderUserId(String id, String userId); 46 | } 47 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/body-posture-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "type": "string", 5 | "description": "The posture of the subject (for example, during a clinical measurement). This value set is not exhaustive.", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents Position of body and posture (observable entity)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/271605009" 10 | }, 11 | { 12 | "value": "sitting", 13 | "description": "The SNOMED code represents Sitting position (finding)", 14 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/33586001" 15 | }, 16 | { 17 | "value": "lying down", 18 | "description": "The SNOMED code represents Lying (Recumbent) position (finding)", 19 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/102538003" 20 | }, 21 | { 22 | "value": "standing", 23 | "description": "The SNOMED code represents Standing position (finding)", 24 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/10904000" 25 | }, 26 | { 27 | "value": "semi-recumbent", 28 | "description": "The SNOMED code represents Semi-recumbent position (finding)", 29 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/272580008" 30 | } 31 | ], 32 | "enum": [ 33 | "sitting", 34 | "lying down", 35 | "standing", 36 | "semi-recumbent" 37 | ] 38 | } -------------------------------------------------------------------------------- /resource-server/src/main/java/utils/ValidationSummary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package utils; 18 | 19 | import java.util.concurrent.atomic.AtomicInteger; 20 | 21 | 22 | /** 23 | * @author Emerson Farrugia 24 | */ 25 | public class ValidationSummary { 26 | 27 | private AtomicInteger attempted = new AtomicInteger(); 28 | private AtomicInteger succeeded = new AtomicInteger(); 29 | private AtomicInteger failed = new AtomicInteger(); 30 | 31 | public void incrementAttempted() { 32 | attempted.incrementAndGet(); 33 | } 34 | 35 | public int getAttempted() { 36 | return attempted.get(); 37 | } 38 | 39 | public void incrementSucceeded() { 40 | succeeded.incrementAndGet(); 41 | } 42 | 43 | public int getSucceeded() { 44 | return succeeded.get(); 45 | } 46 | 47 | public void incrementFailed() { 48 | failed.incrementAndGet(); 49 | } 50 | 51 | public int getFailed() { 52 | return failed.get(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/duration-unit-value-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a duration or length of time.", 5 | 6 | "type": "object", 7 | 8 | "references": [ 9 | { 10 | "description": "The SNOMED code represents Duration (qualifier value)", 11 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/103335007" 12 | } 13 | ], 14 | 15 | "allOf": [ 16 | { 17 | "$ref": "unit-value-1.x.json" 18 | }, 19 | { 20 | "properties": { 21 | "unit": { 22 | "references": [ 23 | { 24 | "description": "The unit of measure of the element. Basic unit is second (s). Allowed values are drawn from the Time Units Common Synonyms (non-UCUM). The valid UCUM code is different for second (s), month (mo) and year (a).", 25 | "url": "http://download.hl7.de/documents/ucum/ucumdata.html" 26 | } 27 | ], 28 | "enum": [ 29 | "ps", 30 | "ns", 31 | "us", 32 | "ms", 33 | "sec", 34 | "min", 35 | "h", 36 | "d", 37 | "wk", 38 | "Mo", 39 | "yr" 40 | ] 41 | } 42 | } 43 | } 44 | ] 45 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/duration-unit-value-range-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a range of duration or length of time.", 5 | 6 | "type": "object", 7 | 8 | "references": [ 9 | { 10 | "description": "The SNOMED code represents Duration (qualifier value)", 11 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/103335007" 12 | } 13 | ], 14 | 15 | "allOf": [ 16 | { 17 | "$ref": "unit-value-range-1.x.json" 18 | }, 19 | { 20 | "properties": { 21 | "unit": { 22 | "references": [ 23 | { 24 | "description": "The unit of measure of the element. Basic unit is second (s). Allowed values are drawn from the Time Units Common Synonyms (non-UCUM). The valid UCUM code is different for second (s), month (mo) and year (a).", 25 | "url": "http://download.hl7.de/documents/ucum/ucumdata.html" 26 | } 27 | ], 28 | "enum": [ 29 | "ps", 30 | "ns", 31 | "us", 32 | "ms", 33 | "sec", 34 | "min", 35 | "h", 36 | "d", 37 | "wk", 38 | "Mo", 39 | "yr" 40 | ] 41 | } 42 | } 43 | } 44 | ] 45 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/sleep-duration-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "This schema represents a single measurement of sleep duration. The ability to represent descriptive statistics (e.g., mean, median) will be added shortly.", 5 | "references": [ 6 | { 7 | "description": "The SNOMED code represents Duration of sleep (observable entity)", 8 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/248263006" 9 | } 10 | ], 11 | 12 | "definitions": { 13 | "duration_unit_value": { 14 | "$ref": "duration-unit-value-1.x.json" 15 | }, 16 | "time_frame": { 17 | "$ref": "time-frame-1.x.json" 18 | } 19 | }, 20 | 21 | "properties": { 22 | "sleep_duration": { 23 | "allOf": [ 24 | { 25 | "$ref": "#/definitions/duration_unit_value" 26 | }, 27 | { 28 | "properties": { 29 | "unit": { 30 | "enum": [ 31 | "sec", 32 | "min", 33 | "h" 34 | ] 35 | } 36 | } 37 | } 38 | ] 39 | }, 40 | "effective_time_frame": { 41 | "$ref": "#/definitions/time_frame" 42 | }, 43 | "user_notes": { 44 | "type": "string" 45 | } 46 | }, 47 | 48 | "required": ["sleep_duration"] 49 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/physical-activity-1.1.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a single episode of physical activity.", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents Physical activity (observable entity)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/68130003" 10 | } 11 | ], 12 | "definitions": { 13 | "activity_name": { 14 | "$ref": "activity-name-1.x.json" 15 | }, 16 | "length_unit_value": { 17 | "$ref": "length-unit-value-1.x.json" 18 | }, 19 | "time_frame": { 20 | "$ref": "time-frame-1.x.json" 21 | } 22 | }, 23 | 24 | "properties": { 25 | "activity_name": { 26 | "$ref": "#/definitions/activity_name" 27 | }, 28 | "effective_time_frame": { 29 | "$ref": "#/definitions/time_frame" 30 | }, 31 | "distance": { 32 | "description": "The distance covered, if applicable.", 33 | "$ref": "#/definitions/length_unit_value" 34 | }, 35 | "reported_activity_intensity": { 36 | "description": "Self-reported intensity of the activity performed.", 37 | "type": "string", 38 | "enum": ["light", "moderate", "vigorous"] 39 | }, 40 | "met_value": { 41 | "description": "Metabolic Equivalent of Task value for the activity", 42 | "type": "number" 43 | } 44 | }, 45 | 46 | "required": ["activity_name"] 47 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/single-medication-dose-taken-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents assumption of a single dose of a medication.", 5 | 6 | "type": "object", 7 | "references": [ 8 | { 9 | "description": "The SNOMED code represents Medication regimen behavior finding (finding)", 10 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/422979000" 11 | } 12 | ], 13 | "definitions": { 14 | "medication": { 15 | "$ref": "medication-1.x.json" 16 | }, 17 | "medication_dose_unit_value": { 18 | "$ref": "medication-dose-unit-value-1.x.json" 19 | }, 20 | "time_frame": { 21 | "$ref": "time-frame-1.x.json" 22 | } 23 | }, 24 | 25 | "properties": { 26 | "medication": { 27 | "$ref": "#/definitions/medication" 28 | }, 29 | "dose": { 30 | "description": "This is the dose actually taken, which may differ from the dose prescribed.", 31 | "$ref": "#/definitions/medication_dose_unit_value" 32 | }, 33 | "effective_time_frame": { 34 | "$ref": "#/definitions/time_frame" 35 | }, 36 | "reason_dose_taken_not_as_prescribed": { 37 | "description": "This is to describe cases of under or over-dosing or medication taken outside the prescribed acceptable window.", 38 | "type": "string" 39 | } 40 | }, 41 | "required": [ 42 | "medication", 43 | "dose", 44 | "effective_time_frame" 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/temporal-relationship-to-physical-activity-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "type": "string", 5 | "description": "The temporal relationship of a clinical measure or assessment to physical activity. ", 6 | "references": [ 7 | { 8 | "value": "at rest", 9 | "description": "The SNOMED code represents At rest (qualifier value)", 10 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/263678003" 11 | }, 12 | { 13 | "value": "active", 14 | "description": "The SNOMED code represents Active (qualifier value).", 15 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/55561003" 16 | }, 17 | { 18 | "value": "before exercise", 19 | "description": "The SNOMED code represents Before exercise (qualifier value)", 20 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/307166007" 21 | }, 22 | { 23 | "value": "after exercise", 24 | "description": "The SNOMED code represents After exercise (qualifier value)", 25 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/255214003" 26 | }, 27 | { 28 | "value": "during exercise", 29 | "description": "The SNOMED code represents During exercise (qualifier value)", 30 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/309604004" 31 | } 32 | ], 33 | "enum": [ 34 | "at rest", 35 | "active", 36 | "before exercise", 37 | "after exercise", 38 | "during exercise" 39 | ] 40 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/frequency-unit-value-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents the frequency of an event as number of times over a duration, e.g., 1/14 d meaning once every 14 days, or a duration range.", 5 | 6 | "type": "object", 7 | 8 | "references": [ 9 | { 10 | "description": "The SNOMED code represents Frequency (quantitative concept)", 11 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/260864003" 12 | } 13 | ], 14 | "definitions": { 15 | "duration": { 16 | "$ref": "duration-unit-value-1.x.json" 17 | }, 18 | "duration_range": { 19 | "$ref": "duration-unit-value-range-1.x.json" 20 | } 21 | }, 22 | 23 | "properties": { 24 | "number_of_times": { 25 | "definition": "How many times the event occurs or should occur in the time window: e.g., in twice a day every other day --> 2 times in 1 day every 2 days, number of times is 2", 26 | "type": "number" 27 | }, 28 | "time_window": { 29 | "definition": "Time window in which the event occurs or should occur: e.g., in twice a day every other day --> 2 times in 1 day every 2 days, time window is 1 day", 30 | "oneOf": [ 31 | { 32 | "$ref": "#/definitions/duration" 33 | }, 34 | { 35 | "$ref": "#/definitions/duration_range" 36 | } 37 | ] 38 | } 39 | }, 40 | "required": [ 41 | "number_of_times", 42 | "time_window" 43 | ] 44 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/length-unit-value-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a length or a distance.", 5 | "type": "object", 6 | 7 | "references": [ 8 | { 9 | "description": "The SNOMED code represents Length", 10 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/410668003" 11 | } 12 | ], 13 | 14 | "allOf": [ 15 | { 16 | "$ref": "unit-value-1.x.json" 17 | }, 18 | { 19 | "properties": { 20 | "unit": { 21 | "references": [ 22 | { 23 | "description": "The unit of measure of the element. Basic unit is meter (m) [ http://unitsofmeasure.org/ucum.html#para-28 ]. Allowed values are drawn from the SI Length Units and English Length Units Common Synonyms (non-UCUM). The valid UCUM code is different for inch ([in_i]), foot ([ft_i]), yard ([yd_i]) and mile ([mi_i]).", 24 | "url": "http://download.hl7.de/documents/ucum/ucumdata.html" 25 | } 26 | ], 27 | "enum": [ 28 | "fm", 29 | "pm", 30 | "nm", 31 | "um", 32 | "mm", 33 | "cm", 34 | "m", 35 | "km", 36 | "in", 37 | "ft", 38 | "yd", 39 | "mi" 40 | ] 41 | } 42 | } 43 | } 44 | ] 45 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/medication-adherence-percent-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents summary adherence to a prescription as percent over a time period.", 5 | 6 | "type": "object", 7 | "references": [ 8 | { 9 | "description": "The SNOMED code represents Adherence to medication regime", 10 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/418633004" 11 | } 12 | ], 13 | "definitions": { 14 | "medication_prescription": { 15 | "$ref": "medication-prescription-1.x.json" 16 | }, 17 | "unit_value": { 18 | "$ref": "unit-value-1.x.json" 19 | }, 20 | "time_frame": { 21 | "$ref": "time-frame-1.x.json" 22 | } 23 | }, 24 | "properties": { 25 | "medication_prescription": { 26 | "$ref": "#/definitions/medication_prescription" 27 | }, 28 | "effective_time_frame": { 29 | "$ref": "#/definitions/time_frame" 30 | }, 31 | "medication_adherence_percent": { 32 | "allOf": [ 33 | { 34 | "$ref": "#/definitions/unit_value" 35 | }, 36 | { 37 | "properties": { 38 | "unit": { 39 | "enum": [ 40 | "%" 41 | ] 42 | } 43 | } 44 | } 45 | ] 46 | } 47 | }, 48 | "required": [ 49 | "medication_prescription", 50 | "medication_adherence_percent" 51 | ] 52 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/medication-adherence-percent-2.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents summary adherence to a prescription as percent over a time period.", 5 | 6 | "type": "object", 7 | "references": [ 8 | { 9 | "description": "The SNOMED code represents Adherence to medication regime", 10 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/418633004" 11 | } 12 | ], 13 | "definitions": { 14 | "medication_prescription": { 15 | "$ref": "medication-prescription-2.x.json" 16 | }, 17 | "unit_value": { 18 | "$ref": "unit-value-1.x.json" 19 | }, 20 | "time_frame": { 21 | "$ref": "time-frame-1.x.json" 22 | } 23 | }, 24 | "properties": { 25 | "medication_prescription": { 26 | "$ref": "#/definitions/medication_prescription" 27 | }, 28 | "effective_time_frame": { 29 | "$ref": "#/definitions/time_frame" 30 | }, 31 | "medication_adherence_percent": { 32 | "allOf": [ 33 | { 34 | "$ref": "#/definitions/unit_value" 35 | }, 36 | { 37 | "properties": { 38 | "unit": { 39 | "enum": [ 40 | "%" 41 | ] 42 | } 43 | } 44 | } 45 | ] 46 | } 47 | }, 48 | "required": [ 49 | "medication_prescription", 50 | "medication_adherence_percent" 51 | ] 52 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/mass-unit-value-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a mass.", 5 | 6 | "type": "object", 7 | 8 | "references": [ 9 | { 10 | "description": "The SNOMED code represents Mass", 11 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/118538004" 12 | } 13 | ], 14 | 15 | "allOf": [ 16 | { 17 | "$ref": "unit-value-1.x.json" 18 | }, 19 | { 20 | "properties": { 21 | "unit": { 22 | "references": [ 23 | { 24 | "description": "The unit of measure of the element. Basic unit is gram (g) [ http://unitsofmeasure.org/ucum.html#para-28 ]. Allowed values are drawn from the SI Mass Units and English Mass Units Common Synonyms (non-UCUM) columns of the 'Mass Units' section. The valid UCUM code is different for metric ton (t), grain ([gr]), ounce ([oz_av]), pound ([lb_av]) and Ton ([ston_av]).", 25 | "url": "http://download.hl7.de/documents/ucum/ucumdata.html" 26 | } 27 | ], 28 | "enum": [ 29 | "fg", 30 | "pg", 31 | "ng", 32 | "ug", 33 | "mg", 34 | "g", 35 | "kg", 36 | "Metric Ton", 37 | "gr", 38 | "oz", 39 | "lb", 40 | "Ton" 41 | ] 42 | } 43 | } 44 | } 45 | ] 46 | } -------------------------------------------------------------------------------- /resource-server/src/main/java/org/openmhealth/dsu/configuration/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.configuration; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 21 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 22 | import org.springframework.context.annotation.ComponentScan; 23 | import org.springframework.context.annotation.Configuration; 24 | 25 | 26 | /** 27 | * A configuration for the application as a whole. This also serves as the application entry point when launching the 28 | * application using Spring Boot. 29 | * 30 | * @author Emerson Farrugia 31 | */ 32 | @Configuration 33 | @ComponentScan( 34 | basePackages = "org.openmhealth", 35 | excludeFilters = { 36 | @ComponentScan.Filter(value = EnableAutoConfiguration.class) 37 | }) 38 | @EnableAutoConfiguration 39 | @EnableConfigurationProperties 40 | public class Application { 41 | 42 | public static void main(String[] args) { 43 | 44 | SpringApplication.run(Application.class, args); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /shared/src/main/java/org/openmhealth/dsu/configuration/JacksonConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.configuration; 18 | 19 | import com.fasterxml.jackson.databind.ObjectMapper; 20 | import com.fasterxml.jackson.databind.PropertyNamingStrategy; 21 | import com.fasterxml.jackson.databind.SerializationFeature; 22 | import org.springframework.context.annotation.Bean; 23 | import org.springframework.context.annotation.Configuration; 24 | 25 | 26 | /** 27 | * A configuration for Jackson. 28 | * 29 | * @author Emerson Farrugia 30 | */ 31 | @Configuration 32 | public class JacksonConfiguration { 33 | 34 | @Bean 35 | public ObjectMapper objectMapper() { 36 | 37 | ObjectMapper objectMapper = new ObjectMapper(); 38 | objectMapper.findAndRegisterModules(); 39 | 40 | // serialise timestamps in an ISO8601 textual representation 41 | objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); 42 | 43 | // serialise keys in snake_case 44 | objectMapper.setPropertyNamingStrategy(new PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy()); 45 | 46 | return objectMapper; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/breath-carbon-monoxide-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents the concentration of carbon monoxide (CO) in a person's expired breath, either a single measurement, or the result of aggregating several measurements made over time (see Descriptive statistic schema for a list of aggregate measures)", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents Expired carbon monoxide concentration", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/251900003" 10 | } 11 | ], 12 | 13 | "definitions": { 14 | "unit_value": { 15 | "$ref": "unit-value-1.x.json" 16 | }, 17 | "time_frame": { 18 | "$ref": "time-frame-1.x.json" 19 | }, 20 | "descriptive_statistic": { 21 | "$ref": "descriptive-statistic-1.x.json" 22 | } 23 | }, 24 | 25 | "properties": { 26 | "breath_carbon_monoxide": { 27 | "allOf": [ 28 | { 29 | "$ref": "#/definitions/unit_value" 30 | }, 31 | { 32 | "properties": { 33 | "unit": { 34 | "enum": [ 35 | "ppm" 36 | ] 37 | } 38 | } 39 | } 40 | ] 41 | }, 42 | "effective_time_frame": { 43 | "$ref": "#/definitions/time_frame" 44 | }, 45 | "descriptive_statistic": { 46 | "$ref": "#/definitions/descriptive_statistic" 47 | } 48 | }, 49 | 50 | "required": ["breath_carbon_monoxide"] 51 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/blood-pressure-2.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a person's blood pressure as a combination of systolic and diastolic blood pressure.", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED codes represents Blood pressure (observable entity)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/75367002" 10 | } 11 | ], 12 | "definitions": { 13 | "systolic_blood_pressure": { 14 | "$ref": "systolic-blood-pressure-1.x.json" 15 | }, 16 | "diastolic_blood_pressure": { 17 | "$ref": "diastolic-blood-pressure-1.x.json" 18 | }, 19 | "time_frame": { 20 | "$ref": "time-frame-1.x.json" 21 | }, 22 | "body_posture": { 23 | "$ref": "body-posture-1.x.json" 24 | }, 25 | "descriptive_statistic": { 26 | "$ref": "descriptive-statistic-1.x.json" 27 | } 28 | }, 29 | 30 | "properties": { 31 | "systolic_blood_pressure": { 32 | "$ref": "#/definitions/systolic_blood_pressure" 33 | }, 34 | "diastolic_blood_pressure": { 35 | "$ref": "#/definitions/diastolic_blood_pressure" 36 | }, 37 | "effective_time_frame": { 38 | "$ref": "#/definitions/time_frame" 39 | }, 40 | "body_posture": { 41 | "$ref": "#/definitions/body_posture" 42 | }, 43 | "descriptive_statistic": { 44 | "$ref": "#/definitions/descriptive_statistic" 45 | }, 46 | "user_notes": { 47 | "type": "string" 48 | } 49 | }, 50 | 51 | "required": ["systolic_blood_pressure", "diastolic_blood_pressure"] 52 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/body-temperature-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a person's body temperature, either a single measurement, or the result of aggregating several measurements made over time (see Descriptive statistic schema for a list of aggregate measures)", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents body temperature (observable entity)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/386725007" 10 | } 11 | ], 12 | 13 | "definitions": { 14 | "temperature_unit_value": { 15 | "$ref": "temperature-unit-value-1.x.json" 16 | }, 17 | "time_frame": { 18 | "$ref": "time-frame-1.x.json" 19 | }, 20 | "descriptive_statistic": { 21 | "$ref": "descriptive-statistic-1.x.json" 22 | }, 23 | "measurement_location": { 24 | "type": "string", 25 | "enum": [ 26 | "oral", 27 | "rectal", 28 | "vaginal", 29 | "axillary", 30 | "otic", 31 | "wrist", 32 | "chest", 33 | "temporal" 34 | ] 35 | } 36 | }, 37 | 38 | "properties": { 39 | "body_temperature": { 40 | "$ref": "#/definitions/temperature_unit_value" 41 | }, 42 | "effective_time_frame": { 43 | "$ref": "#/definitions/time_frame" 44 | }, 45 | "descriptive_statistic": { 46 | "$ref": "#/definitions/descriptive_statistic" 47 | }, 48 | "measurement_location": { 49 | "$ref": "#/definitions/measurement_location" 50 | } 51 | }, 52 | 53 | "required": ["body_temperature"] 54 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/physical-activity-1.2.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a single episode of physical activity.", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents Physical activity (observable entity)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/68130003" 10 | } 11 | ], 12 | "definitions": { 13 | "activity_name": { 14 | "$ref": "activity-name-1.x.json" 15 | }, 16 | "length_unit_value": { 17 | "$ref": "length-unit-value-1.x.json" 18 | }, 19 | "kcal_unit_value": { 20 | "$ref": "kcal-unit-value-1.x.json" 21 | }, 22 | "time_frame": { 23 | "$ref": "time-frame-1.x.json" 24 | } 25 | }, 26 | 27 | "properties": { 28 | "activity_name": { 29 | "$ref": "#/definitions/activity_name" 30 | }, 31 | "effective_time_frame": { 32 | "$ref": "#/definitions/time_frame" 33 | }, 34 | "distance": { 35 | "description": "The distance covered, if applicable.", 36 | "$ref": "#/definitions/length_unit_value" 37 | }, 38 | "kcal_burned": { 39 | "description": "The calories burned during the activity.", 40 | "$ref": "#/definitions/kcal_unit_value" 41 | }, 42 | "reported_activity_intensity": { 43 | "description": "Self-reported intensity of the activity performed.", 44 | "type": "string", 45 | "enum": ["light", "moderate", "vigorous"] 46 | }, 47 | "met_value": { 48 | "description": "Metabolic Equivalent of Task value for the activity", 49 | "type": "number" 50 | } 51 | }, 52 | 53 | "required": ["activity_name"] 54 | } -------------------------------------------------------------------------------- /resource-server/src/main/java/org/openmhealth/dsu/configuration/MethodSecurityConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.configuration; 18 | 19 | import org.springframework.context.annotation.Configuration; 20 | import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler; 21 | import org.springframework.security.access.prepost.PostAuthorize; 22 | import org.springframework.security.access.prepost.PreAuthorize; 23 | import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; 24 | import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration; 25 | import org.springframework.security.oauth2.provider.expression.OAuth2MethodSecurityExpressionHandler; 26 | 27 | 28 | /** 29 | * A configuration that enables {@link PreAuthorize} and {@link PostAuthorize} annotations. 30 | * 31 | * @author Emerson Farrugia 32 | */ 33 | @Configuration 34 | @EnableGlobalMethodSecurity(prePostEnabled = true, proxyTargetClass = true) 35 | public class MethodSecurityConfiguration extends GlobalMethodSecurityConfiguration { 36 | 37 | @Override 38 | protected MethodSecurityExpressionHandler createExpressionHandler() { 39 | return new OAuth2MethodSecurityExpressionHandler(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/volume-unit-value-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a volume.", 5 | 6 | "type": "object", 7 | 8 | "references": [ 9 | { 10 | "description": "The SNOMED code represents Volume", 11 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/118565006" 12 | } 13 | ], 14 | "allOf": [ 15 | { 16 | "$ref": "unit-value-1.x.json" 17 | }, 18 | { 19 | "properties": { 20 | "unit": { 21 | "references": [ 22 | { 23 | "description": "The unit of measure of the element. Basic unit is liter (L). Allowed values are drawn from the Volume Units and English Volume Units Common Synonyms (non-UCUM). The valid UCUM code is different for fluid ounce ([foz_us]), cubic inch ([cin_i]), cup ([cup_us]), pint ([pt_us]), quart ([qt_us]), gallon ([gal_us]). 1 teaspoon = 5 ml; 1 tablespoon = 3 teaspoons = 15 ml.", 24 | "url": "http://download.hl7.de/documents/ucum/ucumdata.html" 25 | } 26 | ], 27 | "enum": [ 28 | "fL", 29 | "pL", 30 | "nL", 31 | "uL", 32 | "mL", 33 | "cL", 34 | "dL", 35 | "L", 36 | "kL", 37 | "fl oz", 38 | "Cup", 39 | "in^3", 40 | "pt", 41 | "qt", 42 | "gal", 43 | "tsp", 44 | "tbsp" 45 | ] 46 | } 47 | } 48 | } 49 | ] 50 | } -------------------------------------------------------------------------------- /resource-server/src/main/java/org/openmhealth/dsu/configuration/OAuth2ResourceServerConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.configuration; 18 | 19 | import org.springframework.context.annotation.Configuration; 20 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 21 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; 22 | import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; 23 | import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer; 24 | 25 | 26 | /** 27 | * A configuration that enables and configures the OAuth 2.0 resource server that ships with Spring Security OAuth. 28 | * 29 | * @author Emerson Farrugia 30 | */ 31 | @Configuration 32 | @EnableResourceServer 33 | public class OAuth2ResourceServerConfiguration extends ResourceServerConfigurerAdapter { 34 | 35 | @Override 36 | public void configure(ResourceServerSecurityConfigurer resources) { 37 | resources.resourceId(OAuth2Properties.DATA_POINT_RESOURCE_ID); 38 | } 39 | 40 | @Override 41 | public void configure(HttpSecurity http) throws Exception { 42 | 43 | http.authorizeRequests() 44 | .anyRequest().authenticated(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/header-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents the header of a data transaction.", 5 | "type": "object", 6 | 7 | "definitions": { 8 | "date_time": { 9 | "$ref": "date-time-1.x.json" 10 | }, 11 | "schema_id": { 12 | "$ref": "schema-id-1.x.json" 13 | } 14 | }, 15 | 16 | "properties": { 17 | "id": { 18 | "description": "The identifier of this data point. We strongly recommend this to be a globally unique value.", 19 | "type": "string" 20 | }, 21 | "creation_date_time": { 22 | "description": "The date time this data point was created.", 23 | "$ref": "#/definitions/date_time" 24 | }, 25 | "schema_id": { 26 | "description": "The schema identifier of the body of the data point.", 27 | "$ref": "#/definitions/schema_id" 28 | }, 29 | "acquisition_provenance": { 30 | "type": "object", 31 | "properties": { 32 | "source_name": { 33 | "description": "The name of the source of the data.", 34 | "type": "string" 35 | }, 36 | "source_creation_date_time": { 37 | "description": "The date time (timestamp) of data creation at the source.", 38 | "$ref": "#/definitions/date_time" 39 | }, 40 | "modality": { 41 | "description": "The modality whereby the measure is obtained.", 42 | "type": "string", 43 | "enum": ["sensed","self-reported"] 44 | } 45 | }, 46 | "required": ["source_name"] 47 | } 48 | }, 49 | 50 | "required": [ 51 | "id", 52 | "creation_date_time", 53 | "schema_id" 54 | ] 55 | } -------------------------------------------------------------------------------- /resource-server/src/main/java/org/openmhealth/dsu/configuration/SecurityConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.configuration; 18 | 19 | import org.springframework.context.annotation.Bean; 20 | import org.springframework.context.annotation.Configuration; 21 | import org.springframework.security.authentication.AuthenticationManager; 22 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 23 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 24 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 25 | 26 | 27 | /** 28 | * A Spring Security configuration that provides an empty authentication manager, since authentication will happen on 29 | * the authorization server. 30 | * 31 | * @author Emerson Farrugia 32 | */ 33 | @Configuration 34 | @EnableWebSecurity 35 | public class SecurityConfiguration extends WebSecurityConfigurerAdapter { 36 | 37 | @Override 38 | public void configure(AuthenticationManagerBuilder auth) throws Exception { 39 | auth.inMemoryAuthentication(); 40 | } 41 | 42 | @Bean(name = "authenticationManager") 43 | @Override 44 | public AuthenticationManager authenticationManagerBean() throws Exception { 45 | return super.authenticationManagerBean(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/ventilation-cycle-time-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents the duration of a person's complete respiration.", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents Ventilation cycle time (observable entity)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/250818005" 10 | } 11 | ], 12 | 13 | "definitions": { 14 | "duration_unit_value": { 15 | "$ref": "duration-unit-value-1.x.json" 16 | }, 17 | "time_frame": { 18 | "$ref": "time-frame-1.x.json" 19 | }, 20 | "descriptive_statistic": { 21 | "$ref": "descriptive-statistic-1.x.json" 22 | }, 23 | "temporal_relationship_to_physical_activity": { 24 | "$ref": "temporal-relationship-to-physical-activity-1.x.json" 25 | } 26 | }, 27 | 28 | "properties": { 29 | "ventilation_cycle_time": { 30 | "allOf": [ 31 | { 32 | "$ref": "#/definitions/duration_unit_value" 33 | }, 34 | { 35 | "properties": { 36 | "unit": { 37 | "enum": [ 38 | "sec" 39 | ] 40 | } 41 | } 42 | } 43 | ] 44 | }, 45 | "effective_time_frame": { 46 | "$ref": "#/definitions/time_frame" 47 | }, 48 | "descriptive_statistic": { 49 | "$ref": "#/definitions/descriptive_statistic" 50 | }, 51 | "temporal_relationship_to_physical_activity": { 52 | "$ref": "#/definitions/temporal_relationship_to_physical_activity" 53 | } 54 | }, 55 | 56 | "required": [ 57 | "ventilation_cycle_time", 58 | "effective_time_frame" 59 | ] 60 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/day-of-week-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "The names of the days of week.", 5 | 6 | "type": "string", 7 | 8 | "references": [ 9 | { 10 | "description": "The SNOMED code represents Days of the week (temporal qualifier)", 11 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/307144000" 12 | }, 13 | { 14 | "value": "Monday", 15 | "description": "The SNOMED code represents Monday (temporal qualifier)", 16 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/307145004" 17 | }, 18 | { 19 | "value": "Tuesday", 20 | "description": "The SNOMED code represents Tuesday (temporal qualifier)", 21 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/307147007" 22 | }, 23 | { 24 | "value": "Wednesday", 25 | "description": "The SNOMED code represents Wednesday (temporal qualifier)", 26 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/307148002" 27 | }, 28 | { 29 | "value": "Thursday", 30 | "description": "The SNOMED code represents Thursday (temporal qualifier)", 31 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/307149005" 32 | }, 33 | { 34 | "value": "Friday", 35 | "description": "The SNOMED code represents Friday (temporal qualifier)", 36 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/307150005" 37 | }, 38 | { 39 | "value": "Saturday", 40 | "description": "The SNOMED code represents Saturday (temporal qualifier)", 41 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/307151009" 42 | }, 43 | { 44 | "value": "Sunday", 45 | "description": "The SNOMED code represents Sunday (temporal qualifier)", 46 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/307146003" 47 | } 48 | ], 49 | "enum": [ 50 | "Monday", 51 | "Tuesday", 52 | "Wednesday", 53 | "Thursday", 54 | "Friday", 55 | "Saturday", 56 | "Sunday" 57 | ] 58 | } -------------------------------------------------------------------------------- /authorization-server/src/main/java/org/openmhealth/dsu/service/EndUserUserDetailsServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.service; 18 | 19 | import org.openmhealth.dsu.domain.EndUser; 20 | import org.openmhealth.dsu.domain.EndUserUserDetails; 21 | import org.springframework.beans.factory.annotation.Autowired; 22 | import org.springframework.security.core.userdetails.UserDetails; 23 | import org.springframework.security.core.userdetails.UserDetailsService; 24 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 25 | import org.springframework.stereotype.Service; 26 | 27 | import java.util.Optional; 28 | 29 | 30 | /** 31 | * A user details service that loads user details from an end user service. 32 | * 33 | * @author Emerson Farrugia 34 | */ 35 | @Service 36 | public class EndUserUserDetailsServiceImpl implements UserDetailsService { 37 | 38 | @Autowired 39 | private EndUserService endUserService; 40 | 41 | @Override 42 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 43 | 44 | Optional user = endUserService.findUser(username); 45 | 46 | if (!user.isPresent()) { 47 | throw new UsernameNotFoundException("A user with username '" + username + "' doesn't exist."); 48 | } 49 | 50 | return new EndUserUserDetails(user.get().getUsername(), user.get().getPasswordHash()); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/blood-pressure-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a person's blood pressure as a combination of systolic and diastolic blood pressure, either a single blood pressure measurement, or the result of aggregating several measurements made over time (see Numeric descriptor schema for a list of aggregate measures)", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED codes represents Blood pressure (observable entity)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/75367002" 10 | } 11 | ], 12 | "definitions": { 13 | "systolic_blood_pressure": { 14 | "$ref": "systolic-blood-pressure-1.x.json" 15 | }, 16 | "diastolic_blood_pressure": { 17 | "$ref": "diastolic-blood-pressure-1.x.json" 18 | }, 19 | "time_frame": { 20 | "$ref": "time-frame-1.x.json" 21 | }, 22 | "position_during_measurement": { 23 | "$ref": "position-during-measurement-1.x.json" 24 | }, 25 | "descriptive_statistic": { 26 | "$ref": "descriptive-statistic-1.x.json" 27 | } 28 | }, 29 | 30 | "properties": { 31 | "systolic_blood_pressure": { 32 | "$ref": "#/definitions/systolic_blood_pressure" 33 | }, 34 | "diastolic_blood_pressure": { 35 | "$ref": "#/definitions/diastolic_blood_pressure" 36 | }, 37 | "effective_time_frame": { 38 | "$ref": "#/definitions/time_frame" 39 | }, 40 | "position_during_measurement": { 41 | "$ref": "#/definitions/position_during_measurement" 42 | }, 43 | "descriptive_statistic": { 44 | "$ref": "#/definitions/descriptive_statistic" 45 | }, 46 | "user_notes": { 47 | "type": "string" 48 | } 49 | }, 50 | 51 | "required": ["systolic_blood_pressure", "diastolic_blood_pressure"] 52 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/rr-interval-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents the time measurement between the R wave of a person's successive heartbeats.", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The NCIT code represents the time measurement between the R wave of successive heartbeats as measured in milliseconds.", 9 | "url": "https://ncim.nci.nih.gov/ncimbrowser/ConceptReport.jsp?dictionary=NCI%20MetaThesaurus&code=C0489636" 10 | } 11 | ], 12 | 13 | "definitions": { 14 | "duration_unit_value": { 15 | "$ref": "duration-unit-value-1.x.json" 16 | }, 17 | "time_frame": { 18 | "$ref": "time-frame-1.x.json" 19 | }, 20 | "descriptive_statistic": { 21 | "$ref": "descriptive-statistic-1.x.json" 22 | }, 23 | "temporal_relationship_to_physical_activity": { 24 | "$ref": "temporal-relationship-to-physical-activity-1.x.json" 25 | } 26 | }, 27 | 28 | "properties": { 29 | "rr_interval": { 30 | "allOf": [ 31 | { 32 | "$ref": "#/definitions/duration_unit_value" 33 | }, 34 | { 35 | "properties": { 36 | "unit": { 37 | "enum": [ 38 | "ms" 39 | ] 40 | } 41 | } 42 | } 43 | ] 44 | }, 45 | "effective_time_frame": { 46 | "$ref": "#/definitions/time_frame" 47 | }, 48 | "descriptive_statistic": { 49 | "$ref": "#/definitions/descriptive_statistic" 50 | }, 51 | "temporal_relationship_to_physical_activity": { 52 | "$ref": "#/definitions/temporal_relationship_to_physical_activity" 53 | } 54 | }, 55 | 56 | "required": ["rr_interval"] 57 | } -------------------------------------------------------------------------------- /authorization-server/src/main/java/org/openmhealth/dsu/configuration/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.configuration; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 21 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 22 | import org.springframework.context.annotation.ComponentScan; 23 | import org.springframework.context.annotation.Configuration; 24 | 25 | 26 | /** 27 | * A configuration for the authorisation server. This also serves as the application entry point when launching the 28 | * application using Spring Boot. 29 | * 30 | * @author Emerson Farrugia 31 | */ 32 | @Configuration 33 | @ComponentScan( 34 | basePackages = "org.openmhealth", 35 | excludeFilters = { 36 | // this exclusion avoids duplicate auto-configurations, especially in integration tests 37 | @ComponentScan.Filter(value = EnableAutoConfiguration.class), 38 | // this exclusion avoids pulling in test-specific @Configuration in other integration tests 39 | @ComponentScan.Filter(value = TestConfiguration.class), 40 | }) 41 | @EnableAutoConfiguration 42 | @EnableConfigurationProperties 43 | public class Application { 44 | 45 | public static void main(String[] args) { 46 | SpringApplication.run(Application.class, args); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/body-mass-index-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "description": "This schema represents a person's body mass index (BMI), either a single BMI measurement, or the result of aggregating several measurements made over time (see Numeric descriptor schema for a list of aggregate measures)", 4 | "type": "object", 5 | "references": [ 6 | { 7 | "description": "The SNOMED code represents Body mass index (observable entity)", 8 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/60621009" 9 | } 10 | ], 11 | "definitions": { 12 | "unit_value": { 13 | "$ref": "unit-value-1.x.json" 14 | }, 15 | "time_frame": { 16 | "$ref": "time-frame-1.x.json" 17 | }, 18 | "descriptive_statistic": { 19 | "$ref": "descriptive-statistic-1.x.json" 20 | } 21 | }, 22 | 23 | "properties": { 24 | "body_mass_index": { 25 | "allOf": [ 26 | { 27 | "$ref": "#/definitions/unit_value" 28 | }, 29 | { 30 | "properties": { 31 | "unit": { 32 | "references": [ 33 | { 34 | "description": "The unit of measure the element. Allowed value is from Areic mass units (UCUM code)", 35 | "url": "http://download.hl7.de/documents/ucum/ucumdata.html" 36 | } 37 | ], 38 | "enum": ["kg/m2"] 39 | } 40 | } 41 | } 42 | ] 43 | }, 44 | "effective_time_frame": { 45 | "$ref": "#/definitions/time_frame" 46 | }, 47 | "descriptive_statistic": { 48 | "$ref": "#/definitions/descriptive_statistic" 49 | } 50 | }, 51 | 52 | "required": ["body_mass_index"] 53 | } -------------------------------------------------------------------------------- /resource-server/src/main/java/org/openmhealth/dsu/repository/ClientDetailsRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.repository; 18 | 19 | import org.openmhealth.dsu.domain.SimpleClientDetails; 20 | import org.springframework.data.repository.Repository; 21 | import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService; 22 | 23 | import java.util.Optional; 24 | 25 | 26 | /** 27 | * A repository of OAuth 2.0 client details. This infrastructure code is similar to {@link JdbcClientDetailsService}, 28 | * but allows persistence to be backed by any Spring Data compatible data source, notably MongoDB. 29 | * 30 | * @author Emerson Farrugia 31 | */ 32 | public interface ClientDetailsRepository extends Repository { 33 | 34 | /** 35 | * @see org.springframework.data.repository.CrudRepository#findOne(java.io.Serializable) 36 | */ 37 | Optional findOne(String clientId); 38 | 39 | /** 40 | * @see org.springframework.data.repository.CrudRepository#findAll() 41 | */ 42 | Iterable findAll(); 43 | 44 | /** 45 | * @see org.springframework.data.repository.CrudRepository#save(Object) 46 | */ 47 | SimpleClientDetails save(SimpleClientDetails clientDetails); 48 | 49 | /** 50 | * @see org.springframework.data.repository.CrudRepository#delete(java.io.Serializable) 51 | */ 52 | void delete(String clientId); 53 | } 54 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/temperature-unit-value-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "This schema represents a temperature (intensity of heat)", 5 | "references": [ 6 | { 7 | "description": "The SNOMED code represents Temperature (observable entity)", 8 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/703421000" 9 | } 10 | ], 11 | "allOf": [ 12 | { 13 | "$ref": "unit-value-1.x.json" 14 | }, 15 | { 16 | "properties": { 17 | "unit": { 18 | "references": [ 19 | { 20 | "description": "The unit of measure of the element. Basic unit is degree Kelvin (K). Allowed values are drawn from the Temperature Units Common Synonyms (non-UCUM). The valid UCUM code is different for Celsius (C) and Fahrenheit ([degF]).", 21 | "url": "http://download.hl7.de/documents/ucum/ucumdata.html" 22 | }, 23 | { 24 | "description": "The SNOMED code represents Degrees Kelvin", 25 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/258713009" 26 | }, 27 | { 28 | "description": "The SNOMED code represents Degrees Fahrenheit", 29 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/258712004" 30 | }, 31 | { 32 | "description": "The SNOMED code represents Degrees Celsius", 33 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/258710007" 34 | } 35 | ], 36 | "enum": [ 37 | "K", 38 | "F", 39 | "C" 40 | ] 41 | } 42 | } 43 | } 44 | ] 45 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/respiratory-rate-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a person's respiratory rate (inhalation and exhalation), either a single respiratory rate measurement, or the result of aggregating several measurements made over time (see Descriptive statistic schema for a list of aggregate measures)", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents respiratory rate (observable entity)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/86290005" 10 | } 11 | ], 12 | 13 | "definitions": { 14 | "unit_value": { 15 | "$ref": "unit-value-1.x.json" 16 | }, 17 | "time_frame": { 18 | "$ref": "time-frame-1.x.json" 19 | }, 20 | "descriptive_statistic": { 21 | "$ref": "descriptive-statistic-1.x.json" 22 | }, 23 | "temporal_relationship_to_physical_activity": { 24 | "$ref": "temporal-relationship-to-physical-activity-1.x.json" 25 | } 26 | }, 27 | 28 | "properties": { 29 | "respiratory_rate": { 30 | "allOf": [ 31 | { 32 | "$ref": "#/definitions/unit_value" 33 | }, 34 | { 35 | "properties": { 36 | "unit": { 37 | "enum": [ 38 | "breaths/min" 39 | ] 40 | } 41 | } 42 | } 43 | ] 44 | }, 45 | "effective_time_frame": { 46 | "$ref": "#/definitions/time_frame" 47 | }, 48 | "descriptive_statistic": { 49 | "$ref": "#/definitions/descriptive_statistic" 50 | }, 51 | "temporal_relationship_to_physical_activity": { 52 | "$ref": "#/definitions/temporal_relationship_to_physical_activity" 53 | } 54 | }, 55 | 56 | "required": ["respiratory_rate"] 57 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/header-1.1.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents the header of a data transaction.", 5 | "type": "object", 6 | 7 | "definitions": { 8 | "date_time": { 9 | "$ref": "date-time-1.x.json" 10 | }, 11 | "schema_id": { 12 | "$ref": "schema-id-1.x.json" 13 | } 14 | }, 15 | 16 | "properties": { 17 | "id": { 18 | "description": "The identifier of this data point. We strongly recommend this to be a globally unique value.", 19 | "type": "string" 20 | }, 21 | "creation_date_time": { 22 | "description": "The date time this data point was created.", 23 | "$ref": "#/definitions/date_time" 24 | }, 25 | "schema_id": { 26 | "description": "The schema identifier of the body of the data point.", 27 | "$ref": "#/definitions/schema_id" 28 | }, 29 | "acquisition_provenance": { 30 | "type": "object", 31 | "properties": { 32 | "source_name": { 33 | "description": "The name of the source of the data.", 34 | "type": "string" 35 | }, 36 | "source_creation_date_time": { 37 | "description": "The date time (timestamp) of data creation at the source.", 38 | "$ref": "#/definitions/date_time" 39 | }, 40 | "modality": { 41 | "description": "The modality whereby the measure is obtained.", 42 | "type": "string", 43 | "enum": ["sensed","self-reported"] 44 | } 45 | }, 46 | "required": ["source_name"] 47 | }, 48 | "user_id": { 49 | "description": "The user this data point belongs to.", 50 | "type": "string" 51 | } 52 | }, 53 | 54 | "required": [ 55 | "id", 56 | "creation_date_time", 57 | "schema_id" 58 | ] 59 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/heart-rate-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a person's heart rate, either a single heart rate measurement, or the result of aggregating several measurements made over time (see Numeric descriptor schema for a list of aggregate measures)", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents Pulse rate (observable entity)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/78564009" 10 | } 11 | ], 12 | 13 | "definitions": { 14 | "unit_value": { 15 | "$ref": "unit-value-1.x.json" 16 | }, 17 | "time_frame": { 18 | "$ref": "time-frame-1.x.json" 19 | }, 20 | "descriptive_statistic": { 21 | "$ref": "descriptive-statistic-1.x.json" 22 | }, 23 | "temporal_relationship_to_physical_activity": { 24 | "$ref": "temporal-relationship-to-physical-activity-1.x.json" 25 | } 26 | }, 27 | 28 | "properties": { 29 | "heart_rate": { 30 | "allOf": [ 31 | { 32 | "$ref": "#/definitions/unit_value" 33 | }, 34 | { 35 | "properties": { 36 | "unit": { 37 | "enum": [ 38 | "beats/min" 39 | ] 40 | } 41 | }, 42 | "required": ["value", "unit"] 43 | } 44 | ] 45 | }, 46 | "effective_time_frame": { 47 | "$ref": "#/definitions/time_frame" 48 | }, 49 | "descriptive_statistic": { 50 | "$ref": "#/definitions/descriptive_statistic" 51 | }, 52 | "temporal_relationship_to_physical_activity": { 53 | "$ref": "#/definitions/temporal_relationship_to_physical_activity" 54 | }, 55 | "user_notes": { 56 | "type": "string" 57 | } 58 | }, 59 | 60 | "required": ["heart_rate"] 61 | } 62 | -------------------------------------------------------------------------------- /shared/src/main/java/org/springframework/data/mapping/model/JsonPropertyPreservingFieldNamingStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.springframework.data.mapping.model; 18 | 19 | import com.fasterxml.jackson.annotation.JsonProperty; 20 | import org.springframework.data.mapping.PersistentProperty; 21 | 22 | 23 | /** 24 | * A composite field naming strategy that uses a Jackson {@link JsonProperty} annotation value if present, 25 | * or delegates to a backing strategy otherwise. 26 | * 27 | * @author Emerson Farrugia 28 | */ 29 | public class JsonPropertyPreservingFieldNamingStrategy implements FieldNamingStrategy { 30 | 31 | private FieldNamingStrategy backingStrategy; 32 | 33 | /** 34 | * @param backingStrategy the field naming strategy to use if the {@link JsonProperty} annotation isn't present 35 | */ 36 | public JsonPropertyPreservingFieldNamingStrategy(FieldNamingStrategy backingStrategy) { 37 | 38 | if (backingStrategy == null) { 39 | throw new NullPointerException("A backing strategy hasn't been specified."); 40 | } 41 | 42 | this.backingStrategy = backingStrategy; 43 | } 44 | 45 | @Override 46 | public String getFieldName(PersistentProperty property) { 47 | 48 | JsonProperty jsonPropertyAnnotation = property.findAnnotation(JsonProperty.class); 49 | 50 | if (jsonPropertyAnnotation != null) { 51 | return jsonPropertyAnnotation.value(); 52 | } 53 | else { 54 | return backingStrategy.getFieldName(property); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/expiratory-time-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents the duration of a person's expiration (the time interval between the initiation of exhalation and the time at which no further lung volume reduction occurs), either a single measurement, or the result of aggregating several measurements made over time (see Descriptive statistic schema for a list of aggregate measures)", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents Expiratory time", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/250820008" 10 | } 11 | ], 12 | 13 | "definitions": { 14 | "duration_unit_value": { 15 | "$ref": "duration-unit-value-1.x.json" 16 | }, 17 | "time_frame": { 18 | "$ref": "time-frame-1.x.json" 19 | }, 20 | "descriptive_statistic": { 21 | "$ref": "descriptive-statistic-1.x.json" 22 | }, 23 | "temporal_relationship_to_physical_activity": { 24 | "$ref": "temporal-relationship-to-physical-activity-1.x.json" 25 | } 26 | }, 27 | 28 | "properties": { 29 | "expiratory_time": { 30 | "allOf": [ 31 | { 32 | "$ref": "#/definitions/duration_unit_value" 33 | }, 34 | { 35 | "properties": { 36 | "unit": { 37 | "enum": [ 38 | "sec" 39 | ] 40 | } 41 | } 42 | } 43 | ] 44 | }, 45 | "effective_time_frame": { 46 | "$ref": "#/definitions/time_frame" 47 | }, 48 | "descriptive_statistic": { 49 | "$ref": "#/definitions/descriptive_statistic" 50 | }, 51 | "temporal_relationship_to_physical_activity": { 52 | "$ref": "#/definitions/temporal_relationship_to_physical_activity" 53 | } 54 | }, 55 | 56 | "required": ["expiratory_time"] 57 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/inspiratory-time-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents the duration of a person's inspiration (i.e., the time interval between the initiation of inhalation and the point at which no further lung volume expansion occurs), either a single measurement, or the result of aggregating several measurements made over time (see Descriptive statistic schema for a list of aggregate measures)", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents Inspiratory time (observable entity)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/250819002" 10 | } 11 | ], 12 | 13 | "definitions": { 14 | "duration_unit_value": { 15 | "$ref": "duration-unit-value-1.x.json" 16 | }, 17 | "time_frame": { 18 | "$ref": "time-frame-1.x.json" 19 | }, 20 | "descriptive_statistic": { 21 | "$ref": "descriptive-statistic-1.x.json" 22 | }, 23 | "temporal_relationship_to_physical_activity": { 24 | "$ref": "temporal-relationship-to-physical-activity-1.x.json" 25 | } 26 | }, 27 | 28 | "properties": { 29 | "inspiratory_time": { 30 | "allOf": [ 31 | { 32 | "$ref": "#/definitions/duration_unit_value" 33 | }, 34 | { 35 | "properties": { 36 | "unit": { 37 | "enum": [ 38 | "sec" 39 | ] 40 | } 41 | } 42 | } 43 | ] 44 | }, 45 | "effective_time_frame": { 46 | "$ref": "#/definitions/time_frame" 47 | }, 48 | "descriptive_statistic": { 49 | "$ref": "#/definitions/descriptive_statistic" 50 | }, 51 | "temporal_relationship_to_physical_activity": { 52 | "$ref": "#/definitions/temporal_relationship_to_physical_activity" 53 | } 54 | }, 55 | 56 | "required": ["inspiratory_time"] 57 | } -------------------------------------------------------------------------------- /shared/src/main/java/org/openmhealth/dsu/configuration/JdbcOAuth2SupportConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.configuration; 18 | 19 | import org.springframework.beans.factory.annotation.Autowired; 20 | import org.springframework.context.annotation.Bean; 21 | import org.springframework.context.annotation.Configuration; 22 | import org.springframework.security.oauth2.provider.ClientDetailsService; 23 | import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService; 24 | import org.springframework.security.oauth2.provider.token.TokenStore; 25 | import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore; 26 | 27 | import javax.sql.DataSource; 28 | 29 | 30 | /** 31 | * A configuration of OAuth2 support objects backed by a relational database. The DDL files to create the corresponding 32 | * database schemas are available in the resources directory at the root of the project. 33 | * 34 | * @author Emerson Farrugia 35 | */ 36 | @Configuration 37 | public class JdbcOAuth2SupportConfiguration { 38 | 39 | @Autowired 40 | private DataSource dataSource; 41 | 42 | /** 43 | * @return the store used to persist OAuth2 access and refresh tokens 44 | */ 45 | @Bean 46 | public TokenStore tokenStore() { 47 | 48 | return new JdbcTokenStore(dataSource); 49 | } 50 | 51 | /** 52 | * @return the service used to retrieve OAuth2 client details 53 | */ 54 | @Bean 55 | public ClientDetailsService clientDetailsService() { 56 | 57 | return new JdbcClientDetailsService(dataSource); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/descriptive-statistic-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "The descriptive statistic of a set of measurements. A measurement value can be the result of combining various measurements and calculating descriptive statistics like average, maximum, minimum, etc. Additional descriptive statistics will be added as the need arises. A measurement value without a descriptive statistic is interpreted as being the result of an individual measurement.", 5 | "type": "string", 6 | 7 | "references": [ 8 | { 9 | "value": "average", 10 | "description": "The NCIT code represents average", 11 | "url": "http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C37917" 12 | }, 13 | { 14 | "value": "maximum", 15 | "description": "The NCIT code represents maximum", 16 | "url": "http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C25564" 17 | }, 18 | { 19 | "value": "minimum", 20 | "description": "The NCIT code represents minimum", 21 | "url": "http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C25570" 22 | }, 23 | { 24 | "value": "standard deviation", 25 | "description": "The NCIT code represents standard deviation", 26 | "url": "http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C53322" 27 | }, 28 | { 29 | "value": "variance", 30 | "description": "The NCIT code represents variance", 31 | "url": "http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C48918" 32 | }, 33 | { 34 | "value": "sum", 35 | "description": "The NCIT code represents sum", 36 | "url": "http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C25697" 37 | }, 38 | { 39 | "value": "median", 40 | "description": "The NCIT code represents median", 41 | "url": "http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#C28007" 42 | } 43 | ], 44 | "enum": [ 45 | "average", 46 | "maximum", 47 | "minimum", 48 | "standard deviation", 49 | "variance", 50 | "sum", 51 | "median" 52 | ] 53 | } -------------------------------------------------------------------------------- /resource-server/src/main/java/org/openmhealth/dsu/domain/SimpleClientDetails.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.domain; 18 | 19 | import org.springframework.data.annotation.Id; 20 | import org.springframework.security.oauth2.provider.ClientDetails; 21 | import org.springframework.security.oauth2.provider.client.BaseClientDetails; 22 | 23 | 24 | /** 25 | * The details of an OAuth 2.0 client. This class only exists to extend {@link BaseClientDetails} and mark the client 26 | * identifier as the Spring Data identifier used for persistence. 27 | * 28 | * @author Emerson Farrugia 29 | */ 30 | public class SimpleClientDetails extends BaseClientDetails { 31 | 32 | @Id 33 | private String id; 34 | 35 | public SimpleClientDetails() { 36 | } 37 | 38 | public SimpleClientDetails(ClientDetails prototype) { 39 | super(prototype); 40 | this.id = getClientId(); 41 | } 42 | 43 | public SimpleClientDetails(String clientId, String resourceIds, String scopes, String grantTypes, 44 | String authorities) { 45 | 46 | super(clientId, resourceIds, scopes, grantTypes, authorities); 47 | this.id = getClientId(); 48 | } 49 | 50 | public SimpleClientDetails(String clientId, String resourceIds, String scopes, String grantTypes, 51 | String authorities, String redirectUris) { 52 | 53 | super(clientId, resourceIds, scopes, grantTypes, authorities, redirectUris); 54 | this.id = getClientId(); 55 | } 56 | 57 | public String getId() { 58 | return id; 59 | } 60 | 61 | public void setId(String id) { 62 | setClientId(id); 63 | } 64 | 65 | @Override 66 | public void setClientId(String clientId) { 67 | super.setClientId(clientId); 68 | this.id = clientId; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/body-temperature-2.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a person's body temperature.", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents body temperature (observable entity)", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/386725007" 10 | } 11 | ], 12 | 13 | "definitions": { 14 | "temperature_unit_value": { 15 | "$ref": "temperature-unit-value-1.x.json" 16 | }, 17 | "time_frame": { 18 | "$ref": "time-frame-1.x.json" 19 | }, 20 | "descriptive_statistic": { 21 | "$ref": "descriptive-statistic-1.x.json" 22 | }, 23 | "temporal_relationship_to_sleep": { 24 | "$ref": "temporal-relationship-to-sleep-1.x.json" 25 | } 26 | }, 27 | 28 | "properties": { 29 | "body_temperature": { 30 | "$ref": "#/definitions/temperature_unit_value" 31 | }, 32 | "effective_time_frame": { 33 | "$ref": "#/definitions/time_frame" 34 | }, 35 | "descriptive_statistic": { 36 | "$ref": "#/definitions/descriptive_statistic" 37 | }, 38 | "measurement_location": { 39 | "description": "The value set is taken from SNOMED CT and LOINC. For common temperature locations, the adjective is used rather than the actual location name (e.g., axillary rather than armpit). Forehead indicates the use of a disposable strip.", 40 | "type": "string", 41 | "enum": [ 42 | "axillary", 43 | "finger", 44 | "forehead", 45 | "oral", 46 | "rectal", 47 | "temporal artery", 48 | "toe", 49 | "tympanic", 50 | "wrist", 51 | "vagina" 52 | ] 53 | }, 54 | 55 | "temporal_relationship_to_sleep": { 56 | "description": "The temporal relationship to sleep of the temperature measurement(s). The lowest body temperature attained during rest, usually estimated by a temperature measurement immediately on waking up and before any physical activity has been undertaken is called basal temperature.", 57 | "$ref": "#/definitions/temporal_relationship_to_sleep" 58 | } 59 | }, 60 | "required": ["body_temperature"] 61 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/minute-volume-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents the minute volume of a person's respiration, i.e., the volume of air inhaled (inhaled minute volume) and/or exhaled (exhaled minute volume) from a person’s lungs in one minute, either a single measurement, or the result of aggregating several measurements made over time (see Descriptive statistic schema for a list of aggregate measures). Note that although its name implies that it is a volume, minute volume is actually a flow (it represents a volume change over time).", 5 | "type": "object", 6 | "references": [ 7 | { 8 | "description": "The SNOMED code represents Minute volume", 9 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/250811004" 10 | } 11 | ], 12 | 13 | "definitions": { 14 | "unit_value": { 15 | "$ref": "unit-value-1.x.json" 16 | }, 17 | "time_frame": { 18 | "$ref": "time-frame-1.x.json" 19 | }, 20 | "descriptive_statistic": { 21 | "$ref": "descriptive-statistic-1.x.json" 22 | }, 23 | "temporal_relationship_to_physical_activity": { 24 | "$ref": "temporal-relationship-to-physical-activity-1.x.json" 25 | } 26 | }, 27 | 28 | "properties": { 29 | "minute_volume": { 30 | "allOf": [ 31 | { 32 | "$ref": "#/definitions/unit_value" 33 | }, 34 | { 35 | "properties": { 36 | "unit": { 37 | "enum": [ 38 | "mL/min", 39 | "L/min" 40 | ] 41 | } 42 | } 43 | } 44 | ] 45 | }, 46 | "effective_time_frame": { 47 | "$ref": "#/definitions/time_frame" 48 | }, 49 | "descriptive_statistic": { 50 | "$ref": "#/definitions/descriptive_statistic" 51 | }, 52 | "temporal_relationship_to_physical_activity": { 53 | "$ref": "#/definitions/temporal_relationship_to_physical_activity" 54 | }, 55 | "minute_volume_type": { 56 | "type": "string", 57 | "enum": [ 58 | "inspiratory", 59 | "expiratory", 60 | "total" 61 | ] 62 | } 63 | }, 64 | 65 | "required": ["minute_volume"] 66 | } -------------------------------------------------------------------------------- /authorization-server/src/main/java/org/openmhealth/dsu/configuration/SecurityConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Open mHealth 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.openmhealth.dsu.configuration; 18 | 19 | import org.springframework.beans.factory.annotation.Autowired; 20 | import org.springframework.context.annotation.Bean; 21 | import org.springframework.context.annotation.Configuration; 22 | import org.springframework.security.authentication.AuthenticationManager; 23 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 24 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 25 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 26 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 27 | import org.springframework.security.core.userdetails.UserDetailsService; 28 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 29 | 30 | 31 | /** 32 | * A Spring Security configuration that provides an authentication manager for user accounts and disables 33 | * Spring Boot's security configuration. 34 | * 35 | * @author Emerson Farrugia 36 | */ 37 | @Configuration 38 | @EnableWebSecurity 39 | public class SecurityConfiguration extends WebSecurityConfigurerAdapter { 40 | 41 | @Autowired 42 | private UserDetailsService userDetailsService; 43 | 44 | @Override 45 | public void configure(AuthenticationManagerBuilder auth) throws Exception { 46 | 47 | auth.userDetailsService(userDetailsService) 48 | .passwordEncoder(new BCryptPasswordEncoder()); 49 | } 50 | 51 | @Bean(name = "authenticationManager") 52 | @Override 53 | public AuthenticationManager authenticationManagerBean() throws Exception { 54 | 55 | return super.authenticationManagerBean(); 56 | } 57 | 58 | @Override 59 | protected void configure(HttpSecurity http) throws Exception { 60 | http.csrf().disable(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/blood-glucose-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | 4 | "description": "This schema represents a person's blood glucose level, either a single blood glucose measurement, or the result of aggregating several measurements made over time (see Numeric descriptor schema for a list of aggregate measures)", 5 | "type": "object", 6 | 7 | "references": [ 8 | { 9 | "description": "The SNOMED code represents Blood glucose level (finding)", 10 | "url": "http://purl.bioontology.org/ontology/SNOMEDCT/365812005" 11 | } 12 | ], 13 | 14 | "definitions": { 15 | "unit_value": { 16 | "$ref": "unit-value-1.x.json" 17 | }, 18 | "blood_specimen_type": { 19 | "$ref": "blood-specimen-type-1.x.json" 20 | }, 21 | "time_frame": { 22 | "$ref": "time-frame-1.x.json" 23 | }, 24 | "temporal_relationship_to_meal": { 25 | "$ref": "temporal-relationship-to-meal-1.x.json" 26 | }, 27 | "temporal_relationship_to_sleep": { 28 | "$ref": "temporal-relationship-to-sleep-1.x.json" 29 | }, 30 | "descriptive_statistic": { 31 | "$ref": "descriptive-statistic-1.x.json" 32 | } 33 | }, 34 | 35 | "properties": { 36 | "blood_glucose": { 37 | "allOf": [ 38 | { 39 | "$ref": "#/definitions/unit_value" 40 | }, 41 | { 42 | "properties": { 43 | "unit": { 44 | "enum": [ 45 | "mg/dL", 46 | "mmol/L" 47 | ] 48 | } 49 | } 50 | } 51 | ] 52 | }, 53 | "blood_specimen_type": { 54 | "$ref": "#/definitions/blood_specimen_type" 55 | }, 56 | "effective_time_frame": { 57 | "$ref": "#/definitions/time_frame" 58 | }, 59 | "temporal_relationship_to_meal": { 60 | "$ref": "#/definitions/temporal_relationship_to_meal" 61 | }, 62 | 63 | "temporal_relationship_to_sleep": { 64 | "$ref": "#/definitions/temporal_relationship_to_sleep" 65 | }, 66 | "descriptive_statistic": { 67 | "$ref": "#/definitions/descriptive_statistic" 68 | }, 69 | "user_notes": { 70 | "type": "string" 71 | } 72 | }, 73 | 74 | "required": ["blood_glucose"] 75 | } -------------------------------------------------------------------------------- /resource-server/src/main/resources/schema/omh/medication-dose-unit-1.0.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "string", 4 | "description": "The list of most commonly used units of measure for a medication dose. Suggestions for additions are accepted.", 5 | "references": [ 6 | { 7 | "description": "Units are drawn in part from FDA units of measure.", 8 | "url": "http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm168397.htm" 9 | }, 10 | { 11 | "description": "Units are drawn in part from FDA pharmaceutical dosage form.", 12 | "url": "http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162038.htm" 13 | } 14 | ], 15 | "enum": [ 16 | "%", 17 | "AU", 18 | "AU/mL", 19 | "bar", 20 | "BAU", 21 | "BAU/mL", 22 | "bead", 23 | "BU", 24 | "capsule", 25 | "CCID_50", 26 | "cellular sheet", 27 | "Ci", 28 | "cloth", 29 | "cm^2", 30 | "D'ag'U", 31 | "disc", 32 | "dL", 33 | "douche", 34 | "drop", 35 | "FFU", 36 | "g", 37 | "globule", 38 | "granule", 39 | "gum", 40 | "hp_C", 41 | "hp_M", 42 | "hp_Q", 43 | "hp_X", 44 | "IU", 45 | "IU/L", 46 | "IU/mL", 47 | "kp_C", 48 | "L", 49 | "Lf", 50 | "LfU/mL", 51 | "lozenge", 52 | "mCi", 53 | "mCi/mL", 54 | "mEq", 55 | "mg", 56 | "mg/actuat", 57 | "mg/hr", 58 | "mg/mg", 59 | "mg/mL", 60 | "mL", 61 | "mmol", 62 | "mol", 63 | "mU", 64 | "ng", 65 | "nmol", 66 | "organisms", 67 | "pastille", 68 | "patch", 69 | "pellet", 70 | "PFU", 71 | "pill", 72 | "PNU", 73 | "PNU/mL", 74 | "pouch", 75 | "puff", 76 | "ring", 77 | "salve", 78 | "stick", 79 | "strip", 80 | "suppository", 81 | "swab", 82 | "tablet", 83 | "tampon", 84 | "tape", 85 | "tbsp", 86 | "TCID_50", 87 | "tsp", 88 | "U", 89 | "uCi", 90 | "ug", 91 | "ug/mL", 92 | "uL", 93 | "umol", 94 | "unt", 95 | "unt/mL", 96 | "USP'U", 97 | "vial", 98 | "wafer", 99 | "X" 100 | ] 101 | } 102 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | --------------------------------------------------------------------------------