Open MaxDiz opened 3 years ago
@isaacholeman please add any additional context specific to the project (or correct anything I misunderstood)
Looks great @MaxDiz. I added that it's also a requirement to be able to scan barcodes to get patient ID. Thanks!
Also investigate supporting QR codes.
Relevant CHT Forum conversation
Update:
i-tech-malawi
project is also interested in scanning a barcode to save the patient's ID, this barcode is generated by the EMR system. They also see very valuable being able to scan a barcode to search for a patient. From this we can highlight two requirements:
1 - Registration of a new patient and getting the patient's ID: Currently achievable by using the Android App Launcher where a form can be configured to open an android app that can scan barcodes, the information in the barcode will be saved in this form.
2- Searching for a patient in contact tab by scanning the barcode: This one needs implementation in CHT-Core to open an android app to scan the barcode and search the patient.
CC: @garethbowen @craig-landry for prioritisation. @mmureithi @katanu @antonykhaemba please add any relevant information. Useful links: feature request doc, forum post
@michaelkohn @lorerod @n-orlowski FYI
Nb. This will be delivered in 4 different PRs:
This work uses the native Barcode Detector API from the browser by using a hidden input type file
to natively open the camera in Android devices. This avoids custom code in the CHT Android and allows more accessibility since the feature can be used in CHT Android, PWA, and Android browsers.
It works the following way:
More considerations:
can_use_barcode_scanner
permission Telemetry:
search_by_barcode:open
-> When a user clicks on the barcode scanner iconsearch_by_barcode:not_supported
-> When the feature isn't supported because the device is a desktop or the Barcode Detector API isn't available in the browser. search_by_barcode:scan
-> When the user has taken the picture.search_by_barcode:trigger_search
-> When Barcode Detector gets the code from the image and triggers the search.search_by_barcode:barcode_no_detected
-> When Barcode Detector couldn't detect the code from the image.search_by_barcode:failure
-> Any system failure when the Barcode Detector tries to get the code from the image.Snackbar messages:
Failed to read the barcode. Retry
Videos
Read the previous comments for more details.
Knowns
file
, Android handles the click event and opens the options to take a picture or pick from the gallery, which Android might take some milliseconds in old phones with low specs. Troubleshooting
can_use_barcode_scanner
permission to the users. Google Play services
- this app is usually available on all Android phones; here is the Play Store link. Google Play services
Google Play services
- this app is usually available on all Android phones; here is the Play Store link. Google Play services
How it works technically
As mentioned in the previous comment, this approach uses a hidden input type, file
to make Android open the camera and take the picture. This picture is uploaded into the app, and then we use the new native API called Barcode Detector API [experimental feature - it has full support in Chrome and Webview for Android, but it's not supported by Firefox for Android].
When the browser uses this API, it utilises the OS tooling to be able to interpret barcodes from image elements. There are many types of barcode, and the support for these type of barcodes are built into the OS (MacOS, ChromeOS, and Android OS).
The browsers are using Android's ML Kit (previously known as GMS Vision) to read and interpret barcodes, this is usually available in the phone with the Google Play services
app (see release notes). This is one reason why it's recommended that users keep their Android OS (and services) and Chrome Browser updated. Worth mentioning for completeness that when it comes to MacOS, the browsers are using CIQRCodeFeature.
@latin-panda Thanks for the update! Did you have a look at this barcode-detector library? It looks well supported (12k weekly downloads, recent updates, etc) and works as a polyfill for the experimental API you're using so it may be easy to drop in. I haven't tested it or checked bundle size, etc but it might be worth a look.
This is one reason why it's recommended that users keep their Android OS (and services) and Chrome Browser updated.
We know that this doesn't usually happen (despite our recommendations). In fact, last time I was in Kenya, safaricom txted me and recommended disabling app auto-updates to save data. Is there an easy way to figure out what is available in the MLKit that's available in Google Play services that shipped with Android 5 (minimum supported android version)?
Thanks @garethbowen the barcode-detector polyfill looks nice, and I like that it follows the same specification as the native API. To make it work for offline users, my guess is that we need to make their C++ library available on the client side using the service worker. This is based on Zxing work, which is quite famous, and many have forked his work to make it available on different platforms. I'm going to give it a try as a polyfill when the native API isn't supported. I think this isn't blocking the Feature Release and can go in parallel.
These are other libraries I looked at before:
Maintenance Mode Only:
Abandoned:
Is there an easy way to figure out what is available in the MLKit that's available in Google Play services that shipped with Android 5 (minimum supported android version)?
@garethbowen The release notes are published online since these are toolings that Android developers need:
I haven't analyzed the release notes in detail, but a quick search on those pages shows mentions of the Barcode feature in Mobile Vision package of Google Play services
v9.2 (June 2016)
Removing from milestone as it wasn't completed on that iteration
Is your feature request related to a problem? Please describe. As a nurse/CHW, I do home visits to follow-up with patients who are in treatment for disease management, but did not show for clinic appointments. Patients are often taking multiple medications (or using other health products), which are hard to keep track of. Having an accurate list of these products is critical to creating and managing up-to-date health record for patients. The process for collecting this information is currently manual, making it difficult to capture it in a timely and accurate way.
Describe the solution you'd like As a nurse, I would like the ability to scan barcodes for patient IDs or barcodes on medications (or other health products) to quickly and accurately acquire patient health information.
Describe alternatives you've considered
Additional context bar code scanner is supported by XLSForm and ODK Collect
Worth noting that ZXing is in maintenance mode, and ODK Collect had to build in the scanner as opposed to an intent since 1.7. There is more investigation needed to know if this is a relatively simple task (handle the XLSForm type and make/handle a new intent) or a big lift.