You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+42-5Lines changed: 42 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,14 +16,18 @@ This quick start guide is geared towards participants in our closed beta program
16
16
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:
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:
Additionally, some dependency artifacts are served by Jitpack, so you will also need to add the following maven repository:
28
+
29
+
`maven { url "https://jitpack.io" }`
30
+
27
31
### Manifest Placeholders
28
32
29
33
The interapplication data sharing functionality of CommonHealth leverages native Android communication components. The CommonHealth Client SDK defines the following activities, services, and receivers in its `manifest.xml` file, which will be merged into the application's manifest during the build process:
@@ -137,7 +141,7 @@ If this method returns false, you may need to instruct the user to install and o
137
141
138
142
Client applications should follow the principle of least privilege and only request access to resources deemed truly necessary. The production version of CommonHealth requires that applications are registered and their scope of access does not exceed their registered values. During the development process, the developer version of CommonHealth does not perform this check.
139
143
140
-
Client applications must define a `ScopeRequest`, which encapsulates a set of `Scope` objects. Each `Scope` object contains a data type (`DataType`) and an access type (`Scope.Access`). `ScopeRequest` contains a `Builder` class to help with implementation.
144
+
Client applications must define a `ScopeRequest`, which encapsulates a set of `Scope` objects. Each `Scope` object **must** contain a data type (`DataType`) an access type (`Scope.Access`). If you would like to limit the scope of access to a defined set of codes, you may also provide a list of `ScopedCodeAllowListEntry` objects. `ScopeRequest` contains a `Builder` class to help with implementation.
141
145
142
146
The following sample creates a `ScopeRequest` object requesting read access to all currently available clinical data types:
143
147
@@ -161,6 +165,24 @@ val scopeRequest: ScopeRequest by lazy {
161
165
}
162
166
```
163
167
168
+
The following sample creates a `ScopeRequest` object requesting read access to lab results coded with LOINC codes `2339-0` and `49765-1`:
169
+
170
+
```
171
+
val scopeRequestByCodes: ScopeRequest = ScopeRequest.Builder()
The `CommonHealthStore` class provides the `checkAuthorizationStatus` method that determines the current authorization status and returns an enum that you can use to determine whether authorization is needed for the specified scope request. The method signature is:
@@ -173,13 +195,14 @@ suspend fun checkAuthorizationStatus(
173
195
): CommonHealthAuthorizationStatus
174
196
```
175
197
176
-
The `CommonHealthAuthorizationStatus` enum defines 5 values:
198
+
The `CommonHealthAuthorizationStatus` enum defines the following values:
177
199
178
200
-`shouldRequest`
179
201
-`unnecessary`
180
202
-`cannotAuthorize`
181
203
-`exceedsMaximumAllowedScope`
182
204
-`connectionExpired`
205
+
-`inactive`
183
206
184
207
The `shouldRequest` value means that the application needs to request authorization in order to query resources specified in the scope request.
185
208
@@ -191,6 +214,8 @@ The `exceedsMaximumAllowedScope` value means that in production environments, th
191
214
192
215
The `connectionExpired` value means that connection lifetime (90 days) has expired. You may request authorization again. The user may also renew the connection from within CommonHealth.
193
216
217
+
The `inactive` value indicates that the CommonHealth team has deactivated your application across all users. Please contact CommonHealth support for more information.
218
+
194
219
### Authorize
195
220
196
221
Authorization is performed by launching the `AuthorizationManagementActivity`. To do so, create an intent using the `AuthorizationManagementActivity` static method `createStartForResultIntent`, passing in an authorization request. You then start the activity using the `startActivityForResult` like you typically would for any activity. Note that you will also need to implement the `onActivityResult` method of the calling Activity or Fragment to get the status when `AuthorizationManagementActivity` finishes. `CommonHealthAuthorizationActivityResponse.fromActivityResult` can be used to convert the response into a more developer friendly object.
@@ -265,7 +290,8 @@ suspend fun readSampleQuery(
265
290
connectionAlias: String,
266
291
dataTypes: Set<DataType>,
267
292
before: Date? = null,
268
-
after: Date? = null
293
+
after: Date? = null,
294
+
fetchedAfter: Date? = null
269
295
): List<DataQueryResult>
270
296
```
271
297
@@ -282,6 +308,17 @@ See `ResourceListFragment` for an example implementation of the data query build
282
308
283
309
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 info [at] commonhealth.org for more information.
284
310
311
+
## Upgrading from v0.4.0 to v0.4.4
312
+
`v0.4.4` introduced a small number of changes to the API:
313
+
314
+
- Scope requests can now be limited to a specific set of codes within a data type.
315
+
- The `inactive` value was added to the `CommonHealthAuthorizationStatus` enum.
316
+
- The optional `fetchedAfter` parameter was added to the `readSampleQuery` interface method. This parameter can be used to limit responses to resources added or updated after a certain date.
317
+
318
+
Additionally, the following maven repo is now required:
319
+
320
+
maven { url "https://jitpack.io" }
321
+
285
322
## Upgrading from v0.3.0 to v0.4.0
286
323
No functional changes to the API were introduced in `v0.4.0`.
0 commit comments