Skip to content

Commit e8a04d8

Browse files
committed
Merge branch 'listOfMed' into 382-postgresql-crash-workaround
2 parents f036d6d + fa4e6ee commit e8a04d8

File tree

16 files changed

+260
-64
lines changed

16 files changed

+260
-64
lines changed

docker-compose.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ services:
2525
environment:
2626
PGADMIN_DEFAULT_EMAIL: balancer-noreply@codeforphilly.org
2727
PGADMIN_DEFAULT_PASSWORD: balancer
28-
# PGADMIN_LISTEN_PORT = 80
29-
# volumes:
30-
# - ./pgadmin-data:/var/lib/pgadmin
31-
# # PGADMIN_LISTEN_PORT = 80
3228
ports:
3329
- "5050:80"
3430
networks:
@@ -60,7 +56,6 @@ services:
6056
- "3000:3000"
6157
environment:
6258
- CHOKIDAR_USEPOLLING=true
63-
# - VITE_API_BASE_URL=https://balancertestsite.com/
6459
volumes:
6560
- "./frontend:/usr/src/app:delegated"
6661
- "/usr/src/app/node_modules/"

frontend/src/api/apiClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const handleRuleExtraction = async (guid: string) => {
6767
}
6868
};
6969

70-
const fetchRiskDataWithSources = async (medication: string, source: "include" | "diagnosis" = "include") => {
70+
const fetchRiskDataWithSources = async (medication: string, source: "include" | "diagnosis" | "diagnosis_depressed" = "include") => {
7171
try {
7272
const response = await api.post(`/v1/api/riskWithSources`, {
7373
drug: medication,

frontend/src/components/Header/Header.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,22 @@ const Header: React.FC<LoginFormProps> = ({ isAuthenticated, isSuperuser }) => {
100100

101101
return (
102102
<header className="z-50 fixed w-full items-center no-print">
103-
<div className="hidden w-full items-center justify-center border-b border-gray-300 bg-blue-100 p-1 text-center text-sm font-light text-gray-500 lg:flex">
103+
<div className="w-full items-center justify-center border-b border-gray-300 bg-blue-100 p-1 text-center text-sm font-light text-gray-500 lg:flex">
104104
<p className="">
105-
This app is currently in its beta testing phase. The information and
106-
tools provided herein are intended for general informational purposes
107-
only and should NOT be construed as medical advice, diagnosis, or
108-
treatment.{" "}
105+
Welcome to Balancer’s first release! Found a bug or have feedback? Let us know {" "}
106+
<Link
107+
to="/feedback"
108+
className="text-black hover:border-blue-600 hover:text-blue-600 hover:no-underline"
109+
>
110+
here {" "}
111+
</Link>
112+
or email {" "}
113+
<a href="mailto:balancerteam@codeforphilly.org" className="underline hover:border-blue-600 hover:text-blue-600 hover:no-underline">
114+
balancerteam@codeforphilly.org
115+
</a>
116+
.
109117
</p>
110118
</div>
111-
<div className="flex items-center justify-center border-b border-gray-300 bg-blue-100 p-1 text-center text-sm font-light text-gray-500 lg:hidden ">
112-
App is in beta; Do not use info as medical advice.
113-
</div>
114119
<div
115120
className={
116121
" hidden h-20 w-full items-center justify-between border-b border-gray-300 bg-white px-96 md:px-20 lg:flex lg:px-10 xl:px-28"

frontend/src/pages/Help/DataSources.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const data: DataProps = {
1414
"publicly available peer-reviewed medical research, as well as " +
1515
"through extensive interviews with physicians and medical professionals " +
1616
"who treat patients with bipolar disorder." +
17-
" You may use this table to view all of our data sources."
17+
" You may use this table to view all of our data sources." +
18+
" To help us build our database, send your recommended publicly-available sources to "
1819
],
1920
};
2021

@@ -32,6 +33,9 @@ function HowTo() {
3233
<div className="flex flex-col px-2 py-2">
3334
<p className="font-satoshi text-sm text-gray-700">
3435
{data.paragraph[0]}
36+
<a href="mailto:balancerteam@codeforphilly.org" className="underline hover:border-blue-600 hover:text-blue-600 hover:no-underline">
37+
balancerteam@codeforphilly.org
38+
</a>.
3539
</p>
3640
</div>
3741
<div className="flex flex-col px-2 py-2 font-satoshi text-sm text-gray-700">

frontend/src/pages/PatientManager/NewPatientForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ const NewPatientForm = ({
365365
htmlFor="current-state"
366366
className="block text-sm font-semibold leading-6 text-gray-900"
367367
>
368-
Current state
368+
Current or Most recent state
369369
</label>
370370
</div>
371371
<div className="mr-6 md:mr-0 md:w-[500px] md:pl-16">

frontend/src/pages/PatientManager/PatientHistory.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const PatientHistory = ({
8686
</div>
8787
<div className="flex">
8888
<dt className="mr-2 sm:mr-4 text-sm font-extrabold leading-6 text-gray-900">
89-
Current State:
89+
Current or Most recent state
9090
</dt>
9191
<dd className="text-sm leading-6 text-gray-700">
9292
{item.Diagnosis}

frontend/src/pages/PatientManager/PatientSummary.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,16 @@ const PatientSummary = ({
304304
setLoading(true);
305305

306306
try {
307-
const data = await fetchRiskDataWithSources(medication, source);
307+
// Map source based on patient's diagnosis
308+
let apiSource: "include" | "diagnosis" | "diagnosis_depressed" = source;
309+
if (source === "diagnosis" && patientInfo.Diagnosis === "Depressed") {
310+
apiSource = "diagnosis_depressed";
311+
}
312+
313+
const data = await fetchRiskDataWithSources(medication, apiSource);
314+
console.log("Risk data received for", medication, "with source", apiSource, ":", data);
315+
console.log("Sources array:", data.sources);
316+
console.log("Sources length:", data.sources?.length);
308317
setRiskData(data as RiskData);
309318
} catch (error) {
310319
console.error("Error fetching risk data: ", error);
@@ -331,7 +340,13 @@ const PatientSummary = ({
331340
setLoading(true);
332341

333342
try {
334-
const data = await fetchRiskDataWithSources(medication, source);
343+
// Map source based on patient's diagnosis
344+
let apiSource: "include" | "diagnosis" | "diagnosis_depressed" = source;
345+
if (source === "diagnosis" && patientInfo.Diagnosis === "Depressed") {
346+
apiSource = "diagnosis_depressed";
347+
}
348+
349+
const data = await fetchRiskDataWithSources(medication, apiSource);
335350
setRiskData(data as RiskData);
336351
} catch (error) {
337352
console.error("Error fetching risk data: ", error);
@@ -605,7 +620,7 @@ const PatientSummary = ({
605620
<div className="flex-row justify-between py-6 border-b border-gray-900/10 md:flex">
606621
<div className="flex w-full md:p-0">
607622
<dt className="w-1/2 text-sm font-medium leading-6 text-gray-900">
608-
Current State:
623+
Current or Most recent state
609624
</dt>
610625
<dd className="text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0">
611626
{patientInfo.Diagnosis}

frontend/src/pages/PatientManager/PatientTypes.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,5 @@ export interface NewPatientInfo {
5353
export enum Diagnosis {
5454
Manic = "Manic",
5555
Depressed = "Depressed",
56-
Hypomanic = "Hypomanic",
57-
Euthymic = "Euthymic",
56+
Hypomanic = "Hypomanic"
5857
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 4.2.3 on 2025-10-25 16:37
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('api', '0013_medrule_medications'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='medrule',
15+
name='rule_type',
16+
field=models.CharField(choices=[('INCLUDE', 'Include'), ('EXCLUDE', 'Exclude')], max_length=500),
17+
),
18+
]

server/api/models/model_medRule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class MedRule(models.Model):
88
('INCLUDE', 'Include'),
99
('EXCLUDE', 'Exclude'),
1010
]
11-
rule_type = models.CharField(max_length=7, choices=RULE_TYPE_CHOICES)
11+
rule_type = models.CharField(max_length=500, choices=RULE_TYPE_CHOICES)
1212
history_type = models.CharField(max_length=255)
1313
reason = models.TextField(blank=True, null=True)
1414
label = models.CharField(max_length=255, blank=True, null=True)

0 commit comments

Comments
 (0)