Skip to content

Commit

Permalink
Updated to point to maven central artifacts (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkizer9 authored Jul 6, 2021
1 parent 9435334 commit 6f0280b
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 27 deletions.
15 changes: 15 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 33 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@

The CommonHealth Client SDK provides an interface that allows applications to access health data stored in CommonHealth.

The CommonHealth Client SDK is in closed beta. If you would like to participate in our beta program, please reach out to developers [at] commonhealth.org.
The CommonHealth Client SDK is in open beta.

While we consider the SDK to be relatively stable, this is pre-release software, so the interfaces are subject to change based on evolving requirements and developer feedback. We're currently investigating ways to make it easier to remove configuration dependencies, so if you find anything particularly burdensome or confusing, please let us know by either emailing us or opening a Github issue.

## Audience
This quick start guide is geared towards participants in our closed beta program. This guide assumes that you have the CommonHealth developer edition installed on your device and you have gone through the enrollment process in the application.
This quick start guide is geared towards participants in our closed beta program. This guide assumes that you have CommonHealth Developer Edition installed on your device and you have gone through the enrollment process in the application.

## CommonHealth Developer Edition

CommonHealth Developer Edition is a specialized version of CommonHealth specifically for developers working with the CommonHealth Client SDK. CommonHealth Developer Edition integrates with the [SMART® Health IT Sandbox](https://launch.smarthealthit.org) to provide access to sample patient data. CommonHealth Developer Edition also relaxes some security features which allows the application to be installed and run on an Android emulator (in addition to a physical Android device).

### Installing the CommonHealth Developer Edition

CommonHealth Developer Edition is currently made available via an open testing track in the Google Play Store. You can join and install the app via [this link](https://play.google.com/store/apps/details?id=org.thecommonsproject.android.phr.developer) on your Android device or [this link](https://play.google.com/apps/testing/org.thecommonsproject.android.phr.developer) on the web.

### Running the CommonHealth Developer Edition

Once CommonHealth Developer Edition is installed, you will need to add a sample patient account in order to populate the app with sample data. After selecting the SMART IT Sandbox from the list of avaialble data sources, you will redirected to the SMART IT Sandbox and be presented with an authentication screen. Enter the sample patient's `ID` (e.g., `099e7de7-c952-40e2-9b4e-0face78c9d80`, `smart-1288992`) in the `User Id` field. The `Password` field is not checked and can be anything. A full list of sample patients can be found [here](https://patient-browser.smarthealthit.org/index.html?config=r2).

## Configuration Requirements

Expand All @@ -16,13 +28,13 @@ This quick start guide is geared towards participants in our closed beta program
The CommonHealth Client SDK consists of two modules: commonhealthclient and common. Commonhealthclient contains the bulk of functionality for the SDK, while common types shared between the CommonHealth application and the CommonHealth Client SDK. You'll need to add the following to your application's list of dependencies:

```
implementation "org.thecommonsproject.commonhealth:common:0.4.8"
implementation "org.thecommonsproject.commonhealth:commonhealthclient:0.4.8"
implementation "org.thecommonsproject:commonhealth-common:1.1.2"
implementation "org.thecommonsproject:commonhealth-client:1.1.2"
```

The artifacts currently reside in our organization's bintray repo, but at some point these will be migrated to jcenter. In the mean time, you'll need to add the following maven repository to your list of repositories, typically defined in the project's `gradle.build` file:
The release artifacts are made avalable via the Maven Central repository, so you will need to have the following in your list of dependency repositories:

`maven { url "https://dl.bintray.com/thecommonsproject/CommonHealth" }`
`mavenCentral()`

Additionally, some dependency artifacts are served by Jitpack, so you will also need to add the following maven repository:

Expand Down Expand Up @@ -121,10 +133,12 @@ To help with security, the `common` module provides `SecureNamespacedKeyValueSto
The `SampleApplication` class contains the following code to create a `SecureNamespacedKeyValueStore`:

```
val database = database ?: createDataBase(context)
val cryptoProvider = DefaultCryptoProvider(DefaultAndroidKeystoreClientWrapper())
val database = database ?: createDataBase(context, cryptoProvider)
val namespacedKeyValueStore = SecureNamespacedKeyValueStore(
KeyValueLocalDataStore(database.keyValueEntryDao()),
"secure_namespaced_key_value_store"
"secure_namespaced_key_value_store",
cryptoProvider
)
```

Expand Down Expand Up @@ -327,7 +341,17 @@ Upon receiving the NEW_DATA_AVAILABLE notification, you can invoke a method on t

## Registering with CommonHealth

Registering with CommonHealth is not required to begin testing integrations with CommonHealth. However, if you have a client application that you would like to use in production environments, you'll need to register the application with CommonHealth. This is similar to registering an OAuth client, where you would specify information such as required scope, authorization redirect URI, etc. Please reach out to developers [at] commonhealth.org for more information.
Registering with CommonHealth is not required to begin testing integrations with CommonHealth Developer Edition. However, if you have a client application that you would like to use in staging or production environments, you'll need to register the application with CommonHealth. This is similar to registering an OAuth client, where you would specify information such as required scope, authorization redirect URI, etc. Please reach out to developers [at] commonhealth.org for more information.

## Upgrading from v0.4.8 to v1.1.2
`v1.1.2` introduced a small number of changes:

- The constructor for `SecureNamespacedKeyValueStore` now requires a `CryptoProvider` object.
- The artifacts names have changed:
- `org.thecommonsproject.commonhealth:common` is now `org.thecommonsproject:commonhealth-common`
- `org.thecommonsproject.commonhealth:commonhealthclient` is now `org.thecommonsproject:commonhealth-client`
- The artifacts are now hosted in Maven Central.


## Upgrading from v0.4.4 to v0.4.8
`v0.4.8` introduced a number of large changes and enhancements to the API:
Expand Down
12 changes: 9 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ android {
}
}

configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Expand All @@ -54,14 +58,16 @@ dependencies {
implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
implementation "androidx.navigation:navigation-ui-ktx:$navigationVersion"

implementation"org.thecommonsproject.commonhealth:common:$commonHealthVersion"
implementation"org.thecommonsproject.commonhealth:commonhealthclient:$commonHealthVersion"
implementation "org.thecommonsproject:commonhealth-common:$commonHealthVersion"
implementation "org.thecommonsproject:commonhealth-client:$commonHealthVersion"
// FOR SNAPSHOT VERSIONS
// implementation(group: "org.thecommonsproject", name: "commonhealth-common", version: commonHealthVersion, changing: true)
// implementation(group: "org.thecommonsproject", name: "commonhealth-client", version: commonHealthVersion, changing: true)

//Room
kapt "androidx.room:room-compiler:$roomVersion"
implementation "androidx.room:room-runtime:$roomVersion"
implementation "androidx.room:room-ktx:$roomVersion"
// implementation "androidx.room:room-rxjava2:$roomVersion"

//for pretty printing json resources
implementation "com.google.code.gson:gson:$gsonVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import androidx.room.Room
import net.sqlcipher.database.SupportFactory
import org.thecommonsproject.android.common.keyvaluestore.SecureNamespacedKeyValueStore
import org.thecommonsproject.android.common.keyvaluestore.room.KeyValueLocalDataStore
import org.thecommonsproject.android.common.util.CryptoProvider
import org.thecommonsproject.android.common.util.DatabasePassphraseManager
import org.thecommonsproject.android.common.util.DefaultAndroidKeystoreClientWrapper
import org.thecommonsproject.android.common.util.DefaultCryptoProvider
import org.thecommonsproject.android.commonhealthclient.*
import org.thecommonsproject.android.commonhealthclient.notification.CommonHealthNotification
import timber.log.Timber
Expand All @@ -15,19 +18,20 @@ class SampleApplication: Application() {

private var database: SampleApplicationDatabase? = null

private fun getDatabasePassphrase(context: Context) : ByteArray {
private fun getDatabasePassphrase(context: Context, cryptoProvider: CryptoProvider) : ByteArray {
val passphraseFilePath = context.filesDir.absolutePath.plus("/encryptedDatabasePassphrase")
val passphraseManager = DatabasePassphraseManager(
passphraseFilePath,
64,
"passphrase_file"
"passphrase_file",
cryptoProvider
)

return passphraseManager.getPassphrase()
}

private fun createDataBase(context: Context): SampleApplicationDatabase {
val passphrase = getDatabasePassphrase(context)
private fun createDataBase(context: Context, cryptoProvider: CryptoProvider): SampleApplicationDatabase {
val passphrase = getDatabasePassphrase(context, cryptoProvider)
val supportFactory = SupportFactory(passphrase)
val result = Room.databaseBuilder(
context.applicationContext,
Expand All @@ -42,6 +46,7 @@ class SampleApplication: Application() {

private fun initializeCommonHealthStore(application: Application) {

val cryptoProvider = DefaultCryptoProvider(DefaultAndroidKeystoreClientWrapper())
val context = application.applicationContext
val notificationPreferences = NotificationPreferences(
subscribedNotificationTypes = setOf(
Expand Down Expand Up @@ -78,10 +83,11 @@ class SampleApplication: Application() {
notificationPreferences = notificationPreferences
)

val database = database ?: createDataBase(context)
val database = database ?: createDataBase(context, cryptoProvider)
val namespacedKeyValueStore = SecureNamespacedKeyValueStore(
KeyValueLocalDataStore(database.keyValueEntryDao()),
"secure_namespaced_key_value_store"
"secure_namespaced_key_value_store",
cryptoProvider
)

//if initialization fails, halt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import android.view.View
import android.view.ViewGroup
import android.widget.*
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.observe
import androidx.lifecycle.viewModelScope
import androidx.navigation.fragment.findNavController
import androidx.navigation.navOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import android.widget.ImageView
import android.widget.ProgressBar
import android.widget.TextView
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.observe
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import androidx.navigation.navOptions
Expand Down
18 changes: 12 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
buildscript {

ext {
kotlin_version = '1.3.72'
kotlin_version = '1.4.32'
navigationVersion = "2.1.0-alpha02"
}

repositories {
google()
jcenter()
maven { url "https://jcenter.bintray.com" }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:4.2.1'
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -23,9 +23,11 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://jcenter.bintray.com" }
maven { url 'https://jitpack.io' }
maven { url "https://dl.bintray.com/thecommonsproject/CommonHealth" }
// CH Snapshot repo
// maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots' }
}
}

Expand All @@ -41,7 +43,7 @@ ext {
targetSdkVersion = 29
compileSdkVersion = 29

commonHealthVersion = '0.4.8'
commonHealthVersion = '1.1.2'

appCompatVersion = '1.1.0'
androidXVersion = '1.1.0'
Expand All @@ -59,3 +61,7 @@ ext {
timberVersion = '4.7.1'
sqlcipherVersion = '4.3.0'
}

configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

0 comments on commit 6f0280b

Please sign in to comment.