Giter VIP home page Giter VIP logo

rag_on_fhir's Introduction

RAG on FHIR

Work on using Retrieval-Augmented Generation (RAG) to combine Fast Healthcare Interoperable Resources (FHIR) with Generative AI.

See the Jupyter Notebooks in the subdirectories for more. You will probably want to start with RAG_on_FHIR_with_KG/FHIR_GRAPHS.ipynb.

You can also check out my YouTube playlist.

rag_on_fhir's People

Contributors

samschifman avatar

Stargazers

 avatar Dan Capri avatar  avatar Ivan Pereira avatar Morten N.O. Nørgaard Henriksen avatar Tomasz Adamusiak avatar Abigail Watson avatar Adrian avatar Abe Flansburg avatar  avatar Shivshankar Umashankar avatar  avatar Henry avatar  avatar Mabrouk Aljane avatar Jack Jiang avatar BrianPC avatar Nick Kuchimanchi avatar Davide R. Wiest avatar Dylan Beadle avatar Dan Caron avatar dr. Konya Sandor avatar Ishan Marikar avatar Aaron - Yunxing Lu avatar  avatar Adam Thompson avatar Meredith Hurston avatar Benjamin Senst avatar  avatar Siddharth Tewari avatar Thomas Corcoran avatar Erdem avatar Prikshit avatar Bharat Sharma avatar normanj avatar Angel Bartolli avatar  avatar Dimitrios Kapetanios avatar Peter WD avatar  avatar Zachary Wimpee avatar Johannes Baumgartl avatar Kaustubh Shete avatar  avatar Kirsten Langendorf avatar Fanghua(Joshua) Yu avatar Bander Alsulami avatar  avatar  avatar Muhammad Hassan Ali avatar Yuan JIN avatar  avatar Ethan Hill avatar  avatar Sifat Shahriar Khan avatar Haguet Victor avatar Qile Wang avatar Andrew Allen Bruce avatar Sean Ma avatar  avatar Vikram Parimi avatar Xer avatar Martina Cavallucci avatar Jai Singh avatar Mikel Egaña Aranguren avatar Theodore M avatar Roberto Sanchez avatar -- avatar Riccardo Mazza avatar Kishor Kukreja avatar Ahmed Ibrahim avatar

Watchers

Adam Thompson avatar Nina Jeliazkova avatar  avatar  avatar  avatar -- avatar Kaustubh Shete avatar  avatar

rag_on_fhir's Issues

may you please share exactly file you used in your code

great code and videos , thank you very much
https://www.youtube.com/@Schifman_health/videos
https://github.com/samschifman

only for

https://github.com/samschifman/RAG_on_FHIR/blob/main/RAG_on_FHIR_with_KG/FHIR_GRAPHS.ipynb
you use file
Alfonso758_Bins636_e80d4c62-149a-a6a6-4b39-9d4aa3e07ba7.json
per code
All the questions here us the FHIR Bundle: Alfonso758_Bins636_e80d4c62-149a-a6a6-4b39-9d4aa3e07ba7.json

but in provided link to data file

synthea_sample_data_fhir_latest.zip

there is no such a file
Alfonso758_Bins636_e80d4c62-149a-a6a6-4b39-9d4aa3e07ba7.json

for letter are there are only
Andrea7_Jenkins714_f5ee3187-56d4-b080-e831-abfaef1ca9e3.json
Ayanna800_Yuriko393_Treutel973_dc3ec108-c89d-e870-7fde-3519930f90dd.json
image

may you please share exactly file you used in your code

Unable to create Index fhir_text Index

Thank you for the example and Youtube video. I was able to populate the Neo4j database but I was not able to create the 'fhir_text' index. Any idea what could be the issue? Does Neo4j need to be an enterprise database?

Neo4jVector.from_existing_graph(
HuggingFaceBgeEmbeddings(model_name="BAAI/bge-small-en-v1.5"),
url=NEO4J_URI,
username=USERNAME,
password=PASSWORD,
index_name='fhir_text',
node_label="resource",
text_node_properties=['text'],
embedding_node_property='embedding',
)

error for k is 1

I get error for k = 1

for FHIR_GRAPHS.ipynb
for
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(temperature=0, model_name="gpt-4-0125-preview")

image

'NoneType' object has no attribute 'f_code'

I am running notebook locally using JetBrain Intelij IDEA and tested with the simplest JSON.
Abe604_Frami345_b8dd1798-beef-094d-1be4-f90ee0e6b7d5.json

When reaching line flat_entry = flatten_fhir(entry['resource']) I am always getting Jupyter issue with following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[1], line 94
     91     os.mkdir(flat_file_path)
     93 for file in glob.glob(in_file_glob):
---> 94     flatten_bundle(file)

Cell In[1], line 85, in flatten_bundle(bundle_file_name)
     83 flat_patient = flatten_fhir(patient)
     84 for i, entry in enumerate(bundle['entry']):
---> 85     flat_entry = flatten_fhir(entry['resource'])

Cell In[1], line 40, in flatten_fhir(nested_json)
     37         attrib_name = name[:-1]
     38         out[attrib_name] = handle_special_attributes(attrib_name, json_to_flatten)
---> 40 flatten(nested_json)
     41 return out

Cell In[1], line 32, in flatten_fhir.<locals>.flatten(json_to_flatten, name)
     30 if type(json_to_flatten) is dict:
     31     for sub_attribute in json_to_flatten:
---> 32         flatten(json_to_flatten[sub_attribute], name + split_camel(sub_attribute) + ' ')
     33 elif type(json_to_flatten) is list:
     34     for i, sub_json in enumerate(json_to_flatten):

Cell In[1], line 35, in flatten_fhir.<locals>.flatten(json_to_flatten, name)
     33 elif type(json_to_flatten) is list:
     34     for i, sub_json in enumerate(json_to_flatten):
---> 35         flatten(sub_json, name + str(i) + ' ')
     36 else:
     37     attrib_name = name[:-1]

Cell In[1], line 31, in flatten_fhir.<locals>.flatten(json_to_flatten, name)
     29 def flatten(json_to_flatten, name=''):
     30     if type(json_to_flatten) is dict:
---> 31         for sub_attribute in json_to_flatten:
     32             flatten(json_to_flatten[sub_attribute], name + split_camel(sub_attribute) + ' ')
     33     elif type(json_to_flatten) is list:

Cell In[1], line 31, in flatten_fhir.<locals>.flatten(json_to_flatten, name)
     29 def flatten(json_to_flatten, name=''):
     30     if type(json_to_flatten) is dict:
---> 31         for sub_attribute in json_to_flatten:
     32             flatten(json_to_flatten[sub_attribute], name + split_camel(sub_attribute) + ' ')
     33     elif type(json_to_flatten) is list:

File _pydevd_bundle/pydevd_cython_darwin_39_64.pyx:1179, in _pydevd_bundle.pydevd_cython_darwin_39_64.SafeCallWrapper.__call__()

File _pydevd_bundle/pydevd_cython_darwin_39_64.pyx:620, in _pydevd_bundle.pydevd_cython_darwin_39_64.PyDBFrame.trace_dispatch()

File _pydevd_bundle/pydevd_cython_darwin_39_64.pyx:756, in _pydevd_bundle.pydevd_cython_darwin_39_64.PyDBFrame.trace_dispatch()

File ~/Library/Application Support/JetBrains/IntelliJIdea2022.3/plugins/python/helpers-pro/jupyter_debug/pydev_jupyter_plugin.py:92, in can_not_skip(plugin, pydb, pydb_frame, frame, info)
     90 def can_not_skip(plugin, pydb, pydb_frame, frame, info):
     91     step_cmd = info.pydev_step_cmd
---> 92     if step_cmd == 108 and _is_equals(frame, _get_stop_frame(info)):
     93         return True
     94     if pydb.jupyter_breakpoints:

File ~/Library/Application Support/JetBrains/IntelliJIdea2022.3/plugins/python/helpers-pro/jupyter_debug/pydev_jupyter_plugin.py:126, in _is_equals(frame, other_frame)
    122 def _is_equals(frame, other_frame):
    123     # We can't compare frames directly, because Jupyter compiles ast nodes
    124     # in cell separately. At the same time, the frame filename is unique and stays
    125     # the same within a cell.
--> 126     return frame.f_code.co_filename == other_frame.f_code.co_filename \
    127            and ((frame.f_code.co_name.startswith('<cell line:')
    128                  and other_frame.f_code.co_name.startswith('<cell line:'))
    129                 or frame.f_code.co_name == other_frame.f_code.co_name)

AttributeError: 'NoneType' object has no attribute 'f_code'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.