@Chetan_Gupta welcome! Thank you for sharing your workflow!
I think when you say “JS extension script” you might be talking about extension-libs. Currently, extension-libs are a powerful tool for doing synchronous processing on input data. However, they may not be appropriate for many types of AI workloads which may need to be more interactive or asynchronous.
One good option for more complex workflows might be to leverage the Android app launcher functionality. Basically you implement the core of your AI workflow as an Android app (installed on the device alongside the cht-android app). Then, in your CHT form you can configure the form to launch your target Android app (providing desired input data from the form) via a normal Android intent. The user continues the workflow in the other app and when that completes, the user can be automatically re-directed back into the CHT form (along with response data from the external app).
Audere has recently used this approach for integrating with the CHT to use the HealthPulseAI to evaluate photos of RDT tests. I would definitely encourage you to join us in the CHT Roundup Call this Thursday (March 12th)! It is going to feature a presentation about the deployment of this functionality in Kenya and Uganda.
Another angle that may be worth considering is that we are currently developing a UI Extension framework for the CHT that will allow custom web components to be rendered within the CHT application. The first iteration is not going to integrate directly with CHT forms, but it would allow for an interactive custom page within the app that might provide the power and flexibility needed for your workflow. Unfortunately, development for this feature is currently just beginning… ![]()