Article
· Nov 26, 2023 2m read

InterLang: Enhancing Conversational Social Prescriptions with LangChain Chatbot Agents and FHIR Resource Integration

Motivation

The motivation behind the InterLang project is rooted in the innovative integration of LangChain chatbot agents with the Fast Healthcare Interoperability Resources (FHIR) framework to revolutionize conversational social prescriptions in healthcare. This project aims to leverage the rich and standardized data available through FHIR, an emerging standard in healthcare data exchange, to inform and empower these advanced chatbot agents.

FHIR provides a robust structure for health data, encompassing clinical, administrative, and financial information. By tapping into this wealth of data, LangChain chatbot agents can access a comprehensive view of a patient's health goals, treatments, and progress. This allows the agents to engage in more meaningful and context-aware conversations with patients, offering personalized advice and support.

A key aspect of this project is the focus on health goals, which are essential for effective patient care. Goals in healthcare range from achieving specific health outcomes, like reducing HgbA1c levels in diabetes, to broader objectives like enhancing patient satisfaction or managing healthcare costs. By integrating FHIR resources, LangChain agents can access these goal data and use them to guide conversations, provide reminders, and suggest interventions.

For instance, in managing a chronic condition like diabetes, a chatbot can remind patients of their medication schedule, suggest nutritional advice, or motivate increased physical activity, all aligned with the patient's specific health goals. In a hospital setting, these agents can assist in procedural goals, such as ensuring timely wound care or patient repositioning, to prevent complications.

Implementation

  • InterSystems FHIR: Manages and standardizes healthcare data exchange.
  • LangChain Agents and Tools: Drive the chatbot's conversational intelligence.
  • GPT-4 Models: Provide advanced natural language processing capabilities.
  • Docker: Ensures consistent, containerized deployment environments.
  • SpringBoot: Facilitates the creation of scalable, enterprise-level back-end services.
  • Streamlit: Enables rapid development of user-friendly web interfaces.

See our project on Github for a simple way to deploy a Streamlit application wth connection to InterSystems FHIR. This has previously been requested.

Video Demo

Demo

Authors

  • Zacchaeus Chok
  • Varun Swaminathan
  • Gabriel Yang
Discussion (5)2
Log in or sign up to continue

Hi Chok,

Your video is available on InterSystems Developers YouTube:

⏯️InterLang - LangChain Agents with InterSystems FHIR Tool

https://www.youtube.com/embed/AwoC94uccu0?si=gqKM7Sp1AlI3okip
[This is an embedded link, but you cannot view embedded content directly on the site because you have declined the cookies necessary to access it. To view embedded content, you would need to accept all cookies in your Cookies Settings]

Hey Zacchaeus & team! Congratulations on this great implementation. I'm sure quite a lot of applications can be built on top of this.

I have a question. If my understanding is right, I believe you are using FHIR APIs to take any action. Curious about how the right API is chosen based on the user command. I ask because a few months back we worked on FHIR: AI and OpenAPI chain project where the massive size of the OpenAPI documentation of FHIR led to slow response times. Your project seems faster in comparison. I'd be interested to learn more about how was the performance optimized. 

Hi Ikram, appreciate the compliment on our project!

In our design, we focused on specific APIs within the FHIR framework to tailor health recommendations, which meant we didn't utilize the entire FHIR API suite. Ideally, we would have integrated the full range of FHIR APIs, but currently, Java LangChain lacks a pre-built OpenAPISpec tool. Developing this functionality could be an excellent opportunity for an open-source contribution to the LangChain4J project. 

Check out our follow-up article and do give a vote for our project!