Skip to content

Commit 332a134

Browse files
committed
Merge branch 'listOfMed' into 325-prompt-library
2 parents e041428 + e6a9a3f commit 332a134

39 files changed

+3696
-2284
lines changed

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,29 @@ Tools used for development:
3636

3737
### Running Balancer for development
3838

39-
Running Balancer:
40-
- Start Docker Desktop and run `docker compose up --build`
41-
- The email and password are set in `server/api/management/commands/createsu.py`
42-
- Download a sample of papers to upload from [https://balancertestsite.com](https://balancertestsite.com/)
39+
Start the Postgres, Django REST, and React services by starting Docker Desktop and running `docker compose up --build`
4340

44-
Running pgAdmin:
41+
#### Postgres
42+
- Download a sample of papers to upload from [https://balancertestsite.com](https://balancertestsite.com/)
4543
- The email and password of `pgAdmin` are specified in `balancer-main/docker-compose.yml`
46-
- The first time you use `pgAdmin` after building the Docker containers you will need to register the server.
47-
The `Host name/address`, `Username` and `Password` are specified in `balancer-main/docker-compose.yml`
44+
- The first time you use `pgAdmin` after building the Docker containers you will need to register the server.
45+
- The `Host name/address` is the Postgres server service name in the Docker Compose file
46+
- The `Username` and `Password` are the Postgres server environment variables in the Docker Compose file
47+
- You can use the below code snippet to query the database from a Jupyter notebook:
48+
49+
```
50+
from sqlalchemy import create_engine
51+
import pandas as pd
52+
53+
engine = create_engine("postgresql+psycopg2://balancer:balancer@localhost:5433/balancer_dev")
54+
55+
query = "SELECT * FROM api_embeddings;"
56+
57+
df = pd.read_sql(query, engine)
58+
```
59+
60+
#### Django REST
61+
- The email and password are set in `server/api/management/commands/createsu.py`
4862

4963
## Local Kubernetes Deployment
5064

frontend/src/App.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ This is the wording logo in the nav bar
130130
@apply bg-gradient-to-r from-blue-600 via-blue-700 to-blue-600 bg-clip-text text-transparent;
131131
}
132132

133+
/* Using logo-like styles outside of the header */
134+
.body_logo {
135+
@apply bg-gradient-to-r from-blue-500 via-blue-700 to-blue-300 bg-clip-text font-quicksand font-bold text-transparent
136+
}
137+
133138
/* Tailwind Styles */
134139

135140
/*
@@ -170,7 +175,7 @@ The heading directly under the nav bar.
170175
}
171176

172177
.desc1 {
173-
@apply mx-auto mt-5 hidden max-w-[75%] text-center font-satoshi text-lg text-gray-400 sm:text-xl md:block;
178+
@apply mx-auto mt-5 text-center font-satoshi text-lg text-gray-800 sm:text-xl md:block;
174179
font-size: 100%;
175180
letter-spacing: 0.03em;
176181
}

frontend/src/api/apiClient.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ const handleRuleExtraction = async (guid: string) => {
6767
}
6868
};
6969

70+
const fetchRiskDataWithSources = async (medication: string, source: "include" | "diagnosis" = "include") => {
71+
try {
72+
const response = await api.post(`/v1/api/riskWithSources`, {
73+
drug: medication,
74+
source: source,
75+
});
76+
return response.data;
77+
} catch (error) {
78+
console.error("Error fetching risk data: ", error);
79+
throw error;
80+
}
81+
};
7082

7183
interface StreamCallbacks {
7284
onContent?: (content: string) => void;
@@ -165,7 +177,6 @@ const handleSendDrugSummaryStream = async (
165177
}
166178
};
167179

168-
169180
// Legacy function for backward compatibility
170181
const handleSendDrugSummaryStreamLegacy = async (
171182
message: string,
@@ -256,6 +267,19 @@ const updateConversationTitle = async (
256267
}
257268
};
258269

270+
// Assistant API functions
271+
const sendAssistantMessage = async (message: string, previousResponseId?: string) => {
272+
try {
273+
const response = await api.post(`/v1/api/assistant`, {
274+
message,
275+
previous_response_id: previousResponseId,
276+
});
277+
return response.data;
278+
} catch (error) {
279+
console.error("Error(s) during sendAssistantMessage: ", error);
280+
throw error;
281+
}
282+
};
259283

260284
export {
261285
handleSubmitFeedback,
@@ -268,5 +292,7 @@ export {
268292
deleteConversation,
269293
updateConversationTitle,
270294
handleSendDrugSummaryStream,
271-
handleSendDrugSummaryStreamLegacy
295+
handleSendDrugSummaryStreamLegacy,
296+
fetchRiskDataWithSources,
297+
sendAssistantMessage
272298
};

frontend/src/components/ChipsInput/ChipsInput.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ const ChipsInput: React.FC<ChipsInputProps> = ({
5959

6060
const handleSuggestionClick = (selected: string) => {
6161
onChange([...value, selected]);
62-
setInputFocused(false); // Close dropdown after selection
6362
setInputValue("");
6463
};
6564

@@ -131,7 +130,10 @@ const ChipsInput: React.FC<ChipsInputProps> = ({
131130
{filteredSuggestions.map((item, idx) => (
132131
<li
133132
key={idx}
134-
onClick={() => handleSuggestionClick(item)}
133+
onMouseDown={(e) => {
134+
e.preventDefault();
135+
handleSuggestionClick(item)
136+
}}
135137
className="px-3 py-2 cursor-pointer hover:bg-gray-100 text-sm"
136138
>
137139
{item}

frontend/src/components/Footer/Footer.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ function Footer() {
2828

2929
return (
3030
// <div className="xl:px-50 mx-auto hidden h-20 items-center justify-between border-t border-gray-300 bg-white px-4 sm:px-6 md:px-8 lg:flex lg:px-8 2xl:px-56">
31-
<div className=" mt-20 flex w-full border-t border-gray-300 ">
31+
<div className="mt-20 flex w-full border-t border-gray-300 ">
3232
{/* <div className="footer-content footer-content mr-5 mt-5 rounded-md border-l border-r border-t border-gray-300 "> */}{" "}
3333
{/* Added mt-5 and mr-5 */}
3434
<footer className=" font_body mt-10 w-full ">
35-
<div className="m-auto grid max-w-[900px] grid-cols-2 flex-wrap items-center justify-between gap-5 px-5 py-3 md:grid-cols-5 md:py-12">
35+
<div className="m-auto grid max-w-[900px] sm:justify-center md:grid-cols-6 md:py-12 lg:grid-cols-6 flex-wrap items-center md:justify-between gap-4 px-5 py-3">
3636
<Link
3737
to="/"
3838
className=" flex justify-center text-black hover:border-blue-600 hover:text-blue-600 hover:no-underline"
@@ -61,6 +61,12 @@ function Footer() {
6161
>
6262
Leave feedback
6363
</Link>
64+
<a href="https://www.flipcause.com/secure/cause_pdetails/MjMyMTIw"
65+
target="_blank"
66+
className="flex justify-center text-black hover:border-blue-600 hover:text-blue-600 hover:no-underline"
67+
>
68+
Donate
69+
</a>
6470
<Link
6571
to="/help"
6672
className="flex justify-center text-black hover:border-blue-600 hover:text-blue-600 hover:no-underline"
@@ -101,8 +107,14 @@ function Footer() {
101107
</button>
102108
</div>
103109
</div>
104-
<div className="flex justify-center rounded px-4 py-2 ">
105-
© 2025 Balancer. All rights reserved. V1 2-04-2025
110+
<div className="flex justify-center rounded px-4 py-2 ">
111+
<p>© 2025 Balancer. All rights reserved. V1 2-04-2025</p>
112+
</div>
113+
<div className="flex justify-center rounded px-4 py-2 ">
114+
<p className="text-gray-600 text-sm font-light italic">
115+
Balancer is an educational resource designed to support{" "}
116+
—never replace— the judgment of licensed U.S. clinicians. Final prescribing decisions must always be made by the treating clinician.
117+
</p>
106118
</div>
107119
</footer>
108120
</div>

0 commit comments

Comments
 (0)