opensrp / fhircore

FHIR Core / OpenSRP 2 is a Kotlin application for delivering offline-capable, mobile-first healthcare project implementations from local community to national and international scale using FHIR and WHO Smart Guidelines on Android.
https://smartregister.org
Apache License 2.0
50 stars 39 forks source link

Add search by QR code option to register search field #3351

Open pld opened 3 days ago

pld commented 3 days ago

Describe the feature request.

  1. Add a binary option for search-by-barcode to the register config
    1. it is not required, and default is False
  2. When search-by-barcode is True
    1. Must also specify
      1. ~barcode-search-path to define how the data read from QR is converted into a search query [TBD details of this, follow same approach as search field]~
      2. [optional] profile-launch to define the profile to open if a single result is returned
    2. Show a QR code icon on the right side of the search field in the register
    3. On-click launch the QR code reader
      1. Execute the same code as was used for the barcode reader widget
    4. After reading a QR code
      1. Follow the code-path as if the string read from the QR code had been entered in the search field
      2. If profile-launch is defined and there is 1 result, open the result using the profile defined in profile-launch
      3. If there are 0 or >=2 results
        1. show the results in the register
        2. place the value read from the QR code as the text in the search query field
  3. Update register docs to add a description of this option

Additional context

Screenshot 2024-06-25 at 12 23 03 PM

Acceptance criteria

Area path

  1. Modify the register config to enable the QR code reader
  2. Open the register
  3. Read QR codes using the button in the register search bar

Implementation plan (For Engineers)

pld commented 3 days ago

nb: this is not blocked by https://github.com/opensrp/fhircore/issues/3350, but it makes sense to do that first so we have experience integrating QR codes