Skip to content

Commit

Permalink
formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hfhoffman1144 committed Jan 22, 2024
1 parent 68ddf4a commit 9a66f8c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from chains.hospital_cypher_chain import hospital_cypher_chain
from tools.wait_times import (
get_current_wait_times,
find_most_available_hospital
find_most_available_hospital,
)

HOSPITAL_AGENT_MODEL = os.getenv("HOSPITAL_AGENT_MODEL")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
password=os.getenv("NEO4J_PASSWORD"),
index_name="reviews",
node_label="Review",
text_node_properties=["physician_name",
"patient_name",
"text",
"hospital_name"],
text_node_properties=[
"physician_name",
"patient_name",
"text",
"hospital_name",
],
embedding_node_property="embedding",
)

Expand All @@ -36,7 +38,8 @@

review_system_prompt = SystemMessagePromptTemplate(
prompt=PromptTemplate(
input_variables=["context"], template=review_template)
input_variables=["context"], template=review_template
)
)

review_human_prompt = HumanMessagePromptTemplate(
Expand Down
28 changes: 19 additions & 9 deletions langchain-rag-app/chatbot_frontend/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import streamlit as st

CHATBOT_URL = os.getenv(
"CHATBOT_URL", "http://localhost:8000/hospital-rag-agent")
"CHATBOT_URL", "http://localhost:8000/hospital-rag-agent"
)

with st.sidebar:
st.header("About")
Expand All @@ -21,7 +22,8 @@
st.header("Example Questions")
st.markdown("- Which hospitals are in the hospital system?")
st.markdown(
"""- What is the current wait time at wallace-hamilton hospital?""")
"""- What is the current wait time at wallace-hamilton hospital?"""
)
st.markdown(
"""- At which hospitals are patients complaining about billing and
insurance issues?"""
Expand All @@ -32,23 +34,28 @@
Castaneda-Hardy?"""
)
st.markdown(
"- What was the total billing amount charged to each payer for 2023?")
"- What was the total billing amount charged to each payer for 2023?"
)
st.markdown("- What is the average billing amount for medicaid visits?")
st.markdown(
"- Which physician has the lowest average visit duration in days?")
"- Which physician has the lowest average visit duration in days?"
)
st.markdown("- How much was billed for patient 789's stay?")
st.markdown(
"""- Which state had the largest percent increase in medicaid visits
from 2022 to 2023?"""
)
st.markdown(
"- What is the average billing amount per day for Aetna patients?")
"- What is the average billing amount per day for Aetna patients?"
)
st.markdown(
"""- What was the percent change in average billing amount by state
from 2022 to 2023?"""
)
st.markdown("""- How many reviews have been written from
patients in Florida?""")
st.markdown(
"""- How many reviews have been written from
patients in Florida?"""
)
st.markdown(
"""- For visits that are not missing chief complaints,
what percentage have reviews?"""
Expand Down Expand Up @@ -106,6 +113,9 @@
st.status("How was this generated", state="complete").info(explanation)

st.session_state.messages.append(
{"role": "assistant", "output": output_text,
"explanation": explanation}
{
"role": "assistant",
"output": output_text,
"explanation": explanation,
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ def load_hospital_graph_from_csv() -> None:

LOGGER.info("Setting uniqueness constraints on nodes")
with driver.session(database="neo4j") as session:
query = (
"""CREATE CONSTRAINT IF NOT EXISTS FOR (h:Hospital)
query = """CREATE CONSTRAINT IF NOT EXISTS FOR (h:Hospital)
REQUIRE h.id IS UNIQUE;"""
)
_ = session.run(query, {})

with driver.session(database="neo4j") as session:
Expand All @@ -50,17 +48,13 @@ def load_hospital_graph_from_csv() -> None:
_ = session.run(query, {})

with driver.session(database="neo4j") as session:
query = (
"""CREATE CONSTRAINT IF NOT EXISTS FOR (p:Physician)
query = """CREATE CONSTRAINT IF NOT EXISTS FOR (p:Physician)
REQUIRE p.id IS UNIQUE;"""
)
_ = session.run(query, {})

with driver.session(database="neo4j") as session:
query = (
"""CREATE CONSTRAINT IF NOT EXISTS FOR (p:Patient)
query = """CREATE CONSTRAINT IF NOT EXISTS FOR (p:Patient)
REQUIRE p.id IS UNIQUE;"""
)
_ = session.run(query, {})

with driver.session(database="neo4j") as session:
Expand Down
7 changes: 4 additions & 3 deletions langchain-rag-app/langchain_intro/chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
"""

review_system_prompt = SystemMessagePromptTemplate(
prompt=PromptTemplate(input_variables=["context"],
template=review_template_str)
prompt=PromptTemplate(
input_variables=["context"], template=review_template_str
)
)

review_human_prompt = HumanMessagePromptTemplate(
Expand All @@ -47,7 +48,7 @@

reviews_vector_db = Chroma(
persist_directory=REVIEWS_CHROMA_PATH,
embedding_function=OpenAIEmbeddings()
embedding_function=OpenAIEmbeddings(),
)

reviews_retriver = reviews_vector_db.as_retriever(k=10)
Expand Down

0 comments on commit 9a66f8c

Please sign in to comment.