Merge remote-tracking branch 'refs/remotes/origin/main'
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@clerk/nextjs": "^6.10.2",
|
"@clerk/nextjs": "^6.10.2",
|
||||||
|
"@faker-js/faker": "^9.4.0",
|
||||||
"@huggingface/inference": "^3.1.2",
|
"@huggingface/inference": "^3.1.2",
|
||||||
"@langchain/community": "^0.3.27",
|
"@langchain/community": "^0.3.27",
|
||||||
"@langchain/core": "^0.3.36",
|
"@langchain/core": "^0.3.36",
|
||||||
|
|||||||
66
src/app/(panels)/suite/doctor/dashboard/AgeChart.jsx
Normal file
66
src/app/(panels)/suite/doctor/dashboard/AgeChart.jsx
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
||||||
|
import { Bar, BarChart, ResponsiveContainer, XAxis, YAxis } from "recharts"
|
||||||
|
|
||||||
|
import { faker } from "@faker-js/faker"
|
||||||
|
|
||||||
|
|
||||||
|
export function AgeChart() {
|
||||||
|
|
||||||
|
const patients = generateFakePatients(100)
|
||||||
|
|
||||||
|
const ageGroups = {
|
||||||
|
"18-30": 0,
|
||||||
|
"31-50": 0,
|
||||||
|
"51-70": 0,
|
||||||
|
"71+": 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
patients.forEach((patient) => {
|
||||||
|
if (patient.age <= 30) ageGroups["18-30"]++
|
||||||
|
else if (patient.age <= 50) ageGroups["31-50"]++
|
||||||
|
else if (patient.age <= 70) ageGroups["51-70"]++
|
||||||
|
else ageGroups["71+"]++
|
||||||
|
})
|
||||||
|
|
||||||
|
const chartData = Object.entries(ageGroups).map(([range, count]) => ({ range, count }))
|
||||||
|
|
||||||
|
function generateFakePatients(count) {
|
||||||
|
return Array.from({ length: count }, () => ({
|
||||||
|
id: faker.string.uuid(),
|
||||||
|
name: faker.person.fullName(),
|
||||||
|
age: faker.number.int({ min: 18, max: 100 }),
|
||||||
|
gender: faker.helpers.arrayElement(["male", "female", "other"]),
|
||||||
|
bloodType: faker.helpers.arrayElement(["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"]),
|
||||||
|
lastCheckup: faker.date.recent({ days: 90 }),
|
||||||
|
symptoms: faker.helpers.arrayElements(
|
||||||
|
["Fever", "Cough", "Fatigue", "Shortness of breath", "Headache", "Nausea", "Dizziness", "Chest pain"],
|
||||||
|
{ min: 0, max: 3 },
|
||||||
|
),
|
||||||
|
vitalSigns: {
|
||||||
|
temperature: faker.number.float({ min: 36.1, max: 37.5, precision: 0.1 }),
|
||||||
|
heartRate: faker.number.int({ min: 60, max: 100 }),
|
||||||
|
bloodPressure: `${faker.number.int({ min: 90, max: 140 })}/${faker.number.int({ min: 60, max: 90 })}`,
|
||||||
|
respiratoryRate: faker.number.int({ min: 12, max: 20 }),
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card>
|
||||||
|
<CardHeader>
|
||||||
|
<CardTitle>Age Distribution</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<ResponsiveContainer width="100%" height={300}>
|
||||||
|
<BarChart data={chartData}>
|
||||||
|
<XAxis dataKey="range" />
|
||||||
|
<YAxis />
|
||||||
|
<Bar dataKey="count" fill="#8884d8" />
|
||||||
|
</BarChart>
|
||||||
|
</ResponsiveContainer>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { PatientTable } from "./PatientTable"
|
import { PatientTable } from "./PatientTable"
|
||||||
import { AppointmentList } from "./AppList"
|
import { AppointmentList } from "./AppList"
|
||||||
|
import { AgeChart } from "./AgeChart"
|
||||||
|
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
@@ -25,11 +26,11 @@ export default function Dashboard() {
|
|||||||
}
|
}
|
||||||
}, [user]);
|
}, [user]);
|
||||||
|
|
||||||
if (userData) {
|
// if (userData) {
|
||||||
if (userData.role != "caregiver") {
|
// if (userData.role != "caregiver") {
|
||||||
router.push("/suite/patient/dashboard");
|
// router.push("/suite/patient/dashboard");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
const patients = [
|
const patients = [
|
||||||
{ id: 1, name: "John Doe", age: 30, lastVisit: "2024-10-01" },
|
{ id: 1, name: "John Doe", age: 30, lastVisit: "2024-10-01" },
|
||||||
@@ -52,6 +53,7 @@ export default function Dashboard() {
|
|||||||
<div className="h-20 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
<div className="h-20 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
<PatientTable data={patients} />
|
<PatientTable data={patients} />
|
||||||
<AppointmentList appointments={appointments} />
|
<AppointmentList appointments={appointments} />
|
||||||
|
<AgeChart />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -12,11 +12,12 @@ import { CardContent } from "@/components/ui/card";
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { ChevronDown } from "lucide-react";
|
import { ChevronDown } from "lucide-react";
|
||||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
|
||||||
import PersonForm from "@/components/PersonForm";
|
import {PersonForm} from "./PatientForm";
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
|
|
||||||
|
|
||||||
export default function Dashboard() {
|
|
||||||
|
export default function PatientsDOC() {
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
@@ -27,12 +28,15 @@ export default function Dashboard() {
|
|||||||
if (user) {
|
if (user) {
|
||||||
axios.get(`/api/user?userId=${user.id}`).then(response => {
|
axios.get(`/api/user?userId=${user.id}`).then(response => {
|
||||||
setUserData(response.data);
|
setUserData(response.data);
|
||||||
|
if (response.data.role === 'caregiver') {
|
||||||
|
axios.get('/api/patients').then(res => setPatients(res.data));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [user]);
|
}, [user]);
|
||||||
|
|
||||||
if (userData) {
|
if (userData) {
|
||||||
if (userData.role != "caregiver") {
|
if (userData.role && userData.role != "caregiver") {
|
||||||
router.push("/suite/patient/dashboard");
|
router.push("/suite/patient/dashboard");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,7 +47,7 @@ export default function Dashboard() {
|
|||||||
<div className="h-20 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
<div className="h-20 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
<Card>
|
<Card>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
{userData.role === 'caregiver' && (
|
{userData && userData.role === 'caregiver' && (
|
||||||
<div>
|
<div>
|
||||||
<ul className="mb-4">
|
<ul className="mb-4">
|
||||||
{patients.map(patient => (
|
{patients.map(patient => (
|
||||||
@@ -22,6 +22,6 @@
|
|||||||
"@/*": ["./src/*"]
|
"@/*": ["./src/*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/app/api/connectDB.js", "src/lib/utils.js", "src/app/(web)/account/page.jsx", "src/app/(panels)/suite/patient/account/page.jsx", "src/app/(panels)/suite/patient/dashboard/MedicationTable.jsx", "src/app/(panels)/suite/patient/dashboard/page.jsx", "src/app/api/transcribe/route.js", "src/components/ui/calendar.jsx", "src/app/(web)/page.jsx", "src/app/(web)/transcribe/page.jsx", "src/app/(web)/login/page.jsx", "src/app/(panels)/suite/layout.jsx", "src/app/(panels)/suite/doctor/dashboard/page.jsx", "src/app/(panels)/suite/patient/chat/page.jsx", "src/app/(panels)/suite/doctor/dashboard/AppList.jsx", "src/app/(panels)/suite/doctor/patient/page.jsx"],
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/app/api/connectDB.js", "src/lib/utils.js", "src/app/(web)/account/page.jsx", "src/app/(panels)/suite/patient/account/page.jsx", "src/app/(panels)/suite/patient/dashboard/MedicationTable.jsx", "src/app/(panels)/suite/patient/dashboard/page.jsx", "src/app/api/transcribe/route.js", "src/components/ui/calendar.jsx", "src/app/(web)/page.jsx", "src/app/(web)/transcribe/page.jsx", "src/app/(web)/login/page.jsx", "src/app/(panels)/suite/layout.jsx", "src/app/(panels)/suite/doctor/dashboard/page.jsx", "src/app/(panels)/suite/patient/chat/page.jsx", "src/app/(panels)/suite/doctor/dashboard/AppList.jsx", "src/app/(panels)/suite/doctor/patients/page.jsx", "src/app/(panels)/suite/doctor/dashboard/AgeChart.jsx"],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user