-
Notifications
You must be signed in to change notification settings - Fork 60
feat!: support HealthPulse integration #398
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
Conversation
…ming expected from Audere
src/main/java/org/medicmobile/webapp/mobile/ChtExternalApp.java
Outdated
Show resolved
Hide resolved
| boolean keepFullResolution = bundle.getBoolean("sampleImage", false); | ||
| json.put(key, getImageFromStoragePath(imagePath.get(), keepFullResolution)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tweak allows us to save the returned image uncompressed when samepleImage is true. This is needed to be able to return the images marked for sampling to Audere (they cannot use compressed versions of the images when training the model).
Note that the difference between 100 quality (full resolution) and 75 quality (compressed) may seem minor, but in my unscientific measurements I was seeing the ultimate size of the png file for the full resolution image to be ~5x greater than the compressed image. For example, when testing with my phone with a 16MP camera, the compressed image size (of the png attachment uploaded to Couch) was 1.4MB, but the uncompressed image size (saved when sampleImage: true) was 5.8MB.
|
Hi Josh, a couple of comments.
But in the form the output has blanks, will we have the concerns being fed back to use the value to ask the CHW to retake the photo ? (the INTENTion is to prompt them at most two times to retake the photo if the result is not definitively positive or negative) |
🤔 @Benmuiruri I am not sure I understand the question here. 😓 What do you mean "the output has blanks"? The immediate answer is that, yes, we should be using the concerns (or now the |
|
@jkuester I was describing what I see in the
Generally, you did respond to my suggestion that we should use the concerns to prompt back to the user to retry. Will you be making changes to this draft PR to support that and also in response to the new HealthPulse app ? |
|
The idea of the workflow is to prompt user to retake the photo with However, I am not sure, does healthpulse give back the specific warning, or it is generic ? that will influence what we display whether it's a specific warning or a general warning and prompt to retake the photo. If the |
|
Okay, I just pushed an update here to remove the custom logic around I think we have 3 distinct error cases, each with different levels of severity: 1. Fatal ErrorIt is possible for the intent to just totally fail. This could happen if:
This is never expected to happen during normal production usage. There are no good recovery scenarios for this (since it is likely the user will not be able to fix the problem.) Also, there is not really any easy way to notify the user in the cht-android app that something went wrong. Instead the user just ends up back in the form page with no output data at all. 2. Global ConcernThis is when the intent succeeds, but the RDT classification completely fails (e.g. no RDT was found in the picture). The
In this case, we do not expect to get any 3. Detected RDT ConcernsThis is when the HealthPulse app was able to scan an RDT, but there were problems with the scan that might impact the recorded Non-blocking:
Blocking:
|
|
Hey @jkuester one of the requirements for the workflow is I attempted to track in the form how many attempts it has been. I came up with this to only show concerns under these conditions My idea was to get back the count for Thoughts? Is there another approach possible without tracking the |
|
@Benmuiruri I think hacking the However, the good news is that I think we can work around this with no code changes at all! 🤞 I did some testing with the latest version of the android_app_launcher.xlsx form and was able to demonstrate how we can use the With this approach, I think you could could base your re-try logic off of |
…lues (e.g. strings) as space-delimited strings.
| return; | ||
| } | ||
|
|
||
| if (isPrimitiveList(value)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Benmuiruri @KicaRonaldOkello I have added some logic here based on the issues we are seeing trying to deal with repeat in the android-app-outputs data. Repeats are a particularly weak area in Enketo forms and are prone to bugs.
However, when it comes to storing lists of values, repeats are not our only option. (IMHO they are actually not the best option at all.) In a form data model, it is much easier to represent a list of values as a "node-set" (aka a space-delimited string). This is how values from a select_multiple are stored already. One big advantage of a node-set (besides just not being a repeat with a single field) is that all the ODK select question operations can be used to interact with the node-set data.
So, with this change, globalConcerns and concerns values are no longer being serialized into the form model as repeats, but instead can just be accepted as normal text fields. These text fields will contain space-separated values. See my know example form for what this looks like in the xlsxform, but TLDR is that you no longer have to use repeats...
Let me know what you guys think of this or if you have any additional recommendations. 👍
src/main/java/org/medicmobile/webapp/mobile/ChtExternalAppHandler.java
Outdated
Show resolved
Hide resolved
|
Okay, for the sake of simplicity I created a new |
This branch/PR contains the changes necessary for integrating with the HealthPulse AI app.
sampleImageThe
sampleImagelogic allows for storing a full resolution image returned from an external app when the returnedsampleImageproperty is true. This is needed for HealthPulse to allow for properly recording images that may be useful in testing/validating the model. Normally images returned from external apps (e.g. the default camera app) are compressed before being sent to the CHT webapp to save on space/bandwidth. However, compressing these sample images would render them useless for testing/validating the AI model.###durationReturning thedurationvalue to the CHT form is a workaround to be able to validate/measure time spent in the external app without having to actually update the CHT instance. The proper fix for these changes should be made in cht-core to resolve medic/cht-core#10217.Primitive list serialization
This allows for serializing an array of primitive values as a space-delimited string value (instead of a JSON array). Sending the values as a string allows us to avoid using a
repeatin the form to unpack the array data into the form model. Repeats in Enketo are pretty sketchy, especially for complex workflows.This change is a great improvement over the existing functionality, but I don't think we can implement it in cht-android without it being a breaking change. Instead, I have just logged medic/cht-core#10508 to implement this in cht-core where it can be made passively.