-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate the implementation for clinical records #104
Conversation
…rdsShareUsageDescription
Cursory read through looks like clean straight-forward code. +1 to merge this in. |
Well... I managed to get the plugin installed from
Plugin compiles and launches on my iPad, with HealthKit and HealthRecord entitlements activated. :) Going to give the new queries a try! |
Getting the following when trying to use this PR:
Filed a separate issue #106 regarding it. Am currently trying to debug. |
May want to update documentation with |
Hmmm.... continuing to work on this, and
Here's the code we're using:
|
Yeah, we've been able to use In case anybody is interest, this is the authorization scope code we had to use: window.plugins.healthkit.requestAuthorization(
{
readTypes: [
'HKClinicalTypeIdentifierAllergyRecord',
'HKClinicalTypeIdentifierConditionRecord',
'HKClinicalTypeIdentifierImmunizationRecord',
'HKClinicalTypeIdentifierLabResultRecord',
'HKClinicalTypeIdentifierMedicationRecord',
'HKClinicalTypeIdentifierProcedureRecord',
'HKClinicalTypeIdentifierVitalSignRecord',
'HKFHIRResourceTypeAllergyIntolerance',
'HKFHIRResourceTypeImmunization',
'HKFHIRResourceTypeMedicationDispense',
'HKFHIRResourceTypeMedicationOrder',
'HKFHIRResourceTypeMedicationStatement',
'HKFHIRResourceTypeObservation',
'HKFHIRResourceTypeProcedure'
],
writeTypes: [
'HKQuantityTypeIdentifierWeight'
]
},
function(){console.log('requestAuthorization.ok')},
function(){console.log('requestAuthorization.nok')}
); |
@awatson1978 I believe the reason The hash you will want to use is from the latest commit 2db3a359fd12f90ec9c0817d4b7b1bc9b8ea458b (this commit is included in the PR). It would look like this -
I think some things are being lost because this PR hasn't been merged yet and the readme here on this repo is not up to date with mine. The readme on my repo talks about the Thanks for testing this out and posting your findings. Let me know how it goes after you update the plugin to use that latest hash. |
@awatson1978 Also you will probably need this in your meteor
The cordova hook needs to run to add the |
Hmmm... okay, using the latest commit, and things have broken again.
|
@awatson1978 is the |
Okay.... I've traced all my code line-by-line after pulling in commit Here's the code I'm using: window.plugins.healthkit.requestAuthorization(
{
readTypes: [
'HKClinicalTypeIdentifierAllergyRecord'
],
writeTypes: []
},
function(msg){console.log('requestAuthorization.ok', msg)},
function(msg){console.log('requestAuthorization.nok', msg)}
);
console.log('-------------------------------------------')
console.log('queryClinicalSampleType')
window.plugins.healthkit.queryClinicalSampleType(
{
'startDate': new Date(new Date().getTime() - 365 * 24 * 60 * 60 * 1000) , // 365 days ago
'endDate': new Date(), // now
sampleType: 'HKClinicalTypeIdentifierAllergyRecord'
// fhirResourceType: 'HKFHIRResourceTypeAllergyIntolerance'
},
function(results){
console.log('HKFHIRResourceTypeAllergyIntolerance.ok', JSON.stringify(results))
results.forEach(function(record){
if(get(record, 'FHIRResource.data.resourceType') === "AllergyIntolerance"){
AllergyIntolerances._collection.insert(get(record, 'FHIRResource.data'));
}
})
},
function(msg){console.log('HKFHIRResourceTypeAllergyIntolerance.nok', msg)}
);
console.log('-------------------------------------------')
console.log('queryForClinicalRecordsWithFHIRResourceType')
window.plugins.healthkit.queryForClinicalRecordsWithFHIRResourceType(
{
fhirResourceType: 'HKFHIRResourceTypeAllergyIntolerance',
sampleType: 'HKClinicalTypeIdentifierAllergyRecord'
},
function(results){
console.log('HKFHIRResourceTypeAllergyIntolerance.ok', JSON.stringify(results))
results.forEach(function(record){
if(get(record, 'FHIRResource.data.resourceType') === "AllergyIntolerance"){
AllergyIntolerances._collection.insert(get(record, 'FHIRResource.data'));
}
})
},
function(msg){console.log('HKFHIRResourceTypeAllergyIntolerance.nok', msg)}
);
console.log('-------------------------------------------')
console.log('queryForClinicalRecordsFromSource')
window.plugins.healthkit.queryForClinicalRecordsFromSource(
{
fhirResourceType: 'HKFHIRResourceTypeAllergyIntolerance',
sampleType: 'HKClinicalTypeIdentifierAllergyRecord'
},
function(results){
console.log('HKFHIRResourceTypeAllergyIntolerance.ok', JSON.stringify(results))
results.forEach(function(record){
if(get(record, 'FHIRResource.data.resourceType') === "AllergyIntolerance"){
AllergyIntolerances._collection.insert(get(record, 'FHIRResource.data'));
}
})
},
function(msg){console.log('HKFHIRResourceTypeAllergyIntolerance.nok', msg)}
); You can see that Originally, I had put However... Also, with |
tl;dr - Commit |
@awatson1978 Does your Xcode project have I think whats happening is that those files aren't being added to your Xcode project because of the way meteor handles installing cordova plugins. There is an |
Ah, yeah, looks like the |
Okay, doing a quick bit of looking around, and here's a relevant thread from an MDG core developer on developing https://forums.meteor.com/t/cordova-how-to-apply-platform-hook-with-meteor/17692/10 Think we could maybe try refactoring the contents of https://github.com/meteor/cordova-plugin-meteor-webapp/blob/master/plugin.xml#L24-L31 |
I think it will be easiest to manually add the |
Hmmm.... Well, the good news is that adding those files in, and everything is working again! :) |
@awatson1978 I'm simply trying to help. I don't know why you would downvote a comment that is providing useful information in your situation. There is a problem with the hook that I created if the I'm not sure that this matters because I don't know if the hook is being ran when the cordova plugin is added by meteor. I'm going to try it with a meteor cordova project and see. Another alternative is to simply create a separate cordova plugin to access the clinical health data. I think that is a sound option at this point. Dealing with solving #103 was a mess and this functionality might be best as a separate plugin. |
Well, mostly I had the landlord at the door interrupting with plumping and electrical issues, and I just clicked an emoticon to summarize a half-dozen thoughts that I didn't have time to write out. Downvote was just a knee-jerk response to adding a manual step to the build pipeline, is all. Thank you for all the work. And I'll be happy to continue verifying/validating/debugging/documenting the solution until the PR gets merged in. Would like to see a solution that supports all the major build pipelines though. That being said, we may need to simply submit a follow-up PR to address the meteor build pipeline. |
Well... managed to get all the FHIR resources loaded into the app in both the Simulator and when the app is installed directly on the device via XCode; but the app crashes when trying to load the FHIR resources when the app has been installed via TestFlight. It's the same code as was run on the Phone from XCode, in that we didn't run the Meteor build pipeline or adjust the Cordova package in anyway. Initial thought is that we're losing the idk. Need to think on it.... |
@awatson1978 According to this comment at #100 (comment) it can be fixed by editing the |
@awatson1978 I updated the If you set the Example App.configurePlugin('com.telerik.plugins.healthkit', {
HEALTH_READ_PERMISSION: 'App needs read access',
HEALTH_WRITE_PERMISSION: 'App needs write access',
CLINICAL_READ_PERMISSION: 'App needs read access'
}); The hook will also add this to your cordova projects <config-file parent="NSHealthClinicalHealthRecordsShareUsageDescription" target="*-Info.plist">
<string>App needs read access</string>
</config-file> Let me know how that works, thanks. |
Hmmm… I haven’t been having quite so much luck using
App.appendToConfig(`<config-file parent="NSHealthClinicalHealthRecordsShareUsageDescription" target="*-Info.plist">
<string>App needs read access</string>
</config-file>`) That's been the only thing so far to get But I was able to get pull up and display HealthRecords after distributing via TestFlight. Needed to add the following <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>application-identifier</key>
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
<key>beta-reports-active</key>
<true/>
</dict>
</plist> The |
@awatson1978 are you using the latest commit hash when installing with meteor? It should be this -
|
Yes, and I made sure to clear out the caches and build folders, so not using a cached version by accident. Are you also using Meteor and have actually confirmed the |
@awatson1978 I have experience with meteor and this plugin install works on an old project and a new scratch project I made. Can you try -
I've also seen in some cases with meteor plugins where you have to delete the |
Yeah, deleting the But I'll give it another try this evening. Have to run out for the evening, but thank you for all the help! Getting the app into TestFlight was a milestone! (Now just need to clean everything up, debug memmory leaks, automate pipeline, etc. etc. Interesting idea to do a rebuild from a scratch project though.) |
We need this PR also - what's the current status? We could also lend some cycles if there's more work to be done. Thx. |
…e sees the HealthKit capability turned on
…SSION is provided
Automatically enable HealthKit and Health Records capabilities in Xcode
@laken - Status is that we're waiting for more confirmed implementations and that we're still seeking out bugs. If you'd like to lend some cycles, write up a report of your experiences installing this branch/PR. If it goes without any problems, then tell us, so that EddyVerbruggen knows that this PR doesn't break anything. If it does break something, help us reproduce the error so the bug can be fixed. |
@awatson1978 Great, I've passed this along to our dev team. I think @igoris has already contributed a patch. |
Any progress on this being accepted? I'll be needing to use this PR shortly, so happy to report back any findings. |
I'm happy to report that Apple just approved our app for release into the App Store. As part of the review, they asked 'How does this app use the Clinical HealthRecords API?' and I pointed them to this pull request (among other things). So, Apple has presumably reviewed this Cordova plugin PR, and approved at least one app with the |
Any movement on this @EddyVerbruggen? Community sponsored solution, no conflicts with base branch, two separate community members (both healthcare professionals) have reviewed and independently verified the solution works, and other community members asking for the merge to pulled in. We're running into hiccups referencing the plugin by commit hash as we close out and open new projects. Would love to see this in the master branch Anything else we can do to help get this PR accepted? |
Hi @awatson1978! Thanks for testing this, much appreciated. This PR might have slipped my attention because I was never tagged after the review, but to avoid this in the future I've added you and the awesome @rossmartin as collaborators to the repo. Please go ahead and merge this in. I can also add you as an owner to the npm package if you like. |
Big shoutout and THANK YOU to @rossmartin!!! |
This PR has a few things, most notably including -
queryClinicalSampleType
,queryForClinicalRecordsFromSource
, andqueryForClinicalRecordsWithFHIRResourceType
.source
were fixed.