posted an update

Med Simplify – Clinical Text to FHIR Graph Generator

Med Simplify is a GenAI-powered Streamlit application designed to process unstructured clinical notes into FHIR-compliant resources, validate them, and visualize the structured data using knowledge graphs. This project is built with LangChain, OpenAI's LLMs, and Neo4j, and deployed on AWS EC2.


Features

  • Summarization (Summary_code.py):
    Uses ChatOpenAI from langchain_openai to convert raw unstructured medical notes into clean, structured clinical summaries.
    Prompting is done with HumanMessage to guide the LLM's responses.

  • FHIR Conversion (Summary_to_FHIR.py):
    Uses ChatOpenAI from langchain_openai to transform the summary into FHIR-compliant JSON. Prompting is done with HumanMessage to guide the LLM's responses.

  • Validation:

    • Summary Validation (Validating_summary.py):
      Uses OpenAIEmbeddings to convert generated and ground truth summaries to vectors. Cosine similarity is calculated via scipy.spatial.distance.cosine to estimate confidence.
    • FHIR Validation (Validating_FHIR.py):
      FHIR resource is converted back into textual form (fhir_to_text) and compared with original summary using the same cosine-based validation technique.
  • Graph Generation (insert_and_visualize_graph.py):

    • Inserts FHIR data into Neo4j using Cypher queries.
    • Uses NetworkX to fetch the graph and visualize it.
    • Pandas and Matplotlib are used to render the graph and structure the data.
  • Streamlit UI (app.py):

    • Combines all steps into an intuitive web interface.
    • Handles file upload, LLM processing, validation metrics, and graph visualization in one place.

Tech Stack

  • Language Model: ChatOpenAI (LangChain wrapper)
  • prompting: HumanMessage (Prompting)
  • Embedding: OpenAIEmbeddings (LangChain)
  • Vector Similarity: scipy.spatial.distance.cosine
  • Graph DB: Neo4j
  • Graph Tools: NetworkX, Matplotlib, Pandas
  • UI Framework: Streamlit
  • Deployment: AWS EC2 (Amazon Linux 2)

Deployment

The deployed app is hosted on AWS EC2.


Testing Instructions

  1. Give your openai_api_key and neo4j aura credentials.
  2. Write or upload an unstructured clinical note (.txt file).
  3. The app will:
    • Generate a clinical summary.
    • Convert the summary to a FHIR resource.
    • Validate both via cosine similarity.
    • Insert and display the resulting FHIR graph.

Repository Access

Private repository access has been granted to:

  • genaihackathon2025@impetus.com
  • testing@devpost.com

Log in or sign up for Devpost to join the conversation.