text
stringlengths
3
8.33k
repo
stringclasses
52 values
path
stringlengths
6
141
language
stringclasses
35 values
sha
stringlengths
64
64
chunk_index
int32
0
273
n_tokens
int32
1
896
| What facilities or regions show evidence of coordination vs. competition between different medical mission organizations? | Could Have | Medical Reasoning Agent \+ Genie Chat \+ **Unknown** | | 8.3 | Where are there gaps in the international development map where no organizations are currently working despite evident...
hacknation
assets/docs/Virtue Foundation Agent Questions - Hack Nation.md
Markdown
ef53a691e2483c967aef85e1ee4ac88cc703de9b4a961d1bd864f9fd5dec5946
3
896
images \+ social/other pages) vs single-source only? | Won't Have | Medical Reasoning Agent \+ Genie Chat \+ External Data | --- ## Summary by Query Type | Category | Count | | :---- | :---- | | Basic Queries & Lookups | 6 | | Geospatial Queries | 4 | | Validation & Verification | 5 | | Misrepresentation & Anomaly D...
hacknation
assets/docs/Virtue Foundation Agent Questions - Hack Nation.md
Markdown
2c7c5b5bb77eb3ef2b52b8ce50f77a871964c0d54f01a31994f3c0667252fd56
4
157
# Schema Documentation: All Columns and Definitions ## Organization Extraction - **ngos** (list\[str\]): NGO names present in the text. An NGO is any non-profit organization that delivers tangible, on-the-ground healthcare services in low- or lower-middle-income settings. - **facilities** (list\[str\]): Healthcare ...
hacknation
assets/docs/Virtue Foundation Scheme Documentation.md
Markdown
69d7191c28fd26d67f5c9c18f3164fd7e5cdfdd157d72c72a4ba0fba9f537c2f
0
896
`, `philanthropy-legacy`, `community`, `academic`, `government`. - **description** (str): A brief paragraph describing the facility's services and/or history. - **area** (int): Total floor area of the facility in square meters. - **numberDoctors** (int): Total number of medical doctors working at the facility. ...
hacknation
assets/docs/Virtue Foundation Scheme Documentation.md
Markdown
64c656d7f741b85d262c24cecbc216f483fe41f4d6b1df7d6eb21d6f897b0b2b
1
596
// Ghana Cities Coordinates Lookup Table (Lat/Lng) export const CITY_COORDS: Record<string, { lat: number; lng: number }> = { 'Accra': { lat: 5.6037, lng: -0.1870 }, 'Kumasi': { lat: 6.6885, lng: -1.6244 }, 'Tamale': { lat: 9.4075, lng: -0.8534 }, 'Takoradi': { lat: 4.8845, lng: -1.7554 }, 'Sunyani': { lat: ...
hacknation
lib/ghana.ts
TypeScript
3d278510cd9f65c498c8afb4ff19d05ea11ce830e366252aefb8b87826876b5c
0
896
': { lat: 5.6667, lng: -0.0500 }, 'Sakumono': { lat: 5.6333, lng: -0.0667 }, 'Taifa': { lat: 5.6667, lng: -0.2500 }, 'Awoshie': { lat: 5.5833, lng: -0.2833 }, 'Anyaa': { lat: 5.6000, lng: -0.2833 }, 'Santa Maria': { lat: 5.6167, lng: -0.2667 }, 'Ablekuma': { lat: 5.6167, lng: -0.3167 }, 'Bortianor': { lat...
hacknation
lib/ghana.ts
TypeScript
93d82b0c3ba85c229c64c5c8771640ba786d5d91a640f8a56d16da4cd428a0b6
1
714
import { db } from '../../db'; import { facilities } from '../../db/schema'; import { arrayContains, isNotNull, and } from 'drizzle-orm'; import { CITY_COORDS } from '../ghana'; // Haversine helper function getDistance(lat1: number, lon1: number, lat2: number, lon2: number): number { const R = 6371; // Radius of th...
hacknation
lib/logic/findMedicalDeserts.ts
TypeScript
f7e7516ada858cec2fc8c2d7d4e1aa348bc7906bf06e665c00392cf63901d9b4
0
766
import { db } from '../../db'; import { facilities } from '../../db/schema'; import { sql, asc, and, isNotNull, like, arrayContains } from 'drizzle-orm'; import { CITY_COORDS } from '../ghana'; export async function findNearbyLogic({ city, lat, lng, radiusKm = 50, specialty }: { city?: string; lat?: number; lng?: num...
hacknation
lib/logic/findNearby.ts
TypeScript
e698c0d568b12c6f352fb518fe23ba9476438c6cfe8530fa9629e2bb5926e630
0
604
export const SYSTEM_PROMPT = ` You are VFMatch AI — an intelligent healthcare analyst for the Virtue Foundation. You help healthcare planners, volunteer doctors, and NGO coordinators understand Ghana's healthcare landscape by analyzing facility data. ## Response Style — CRITICAL ALWAYS begin your response with a brie...
hacknation
lib/prompts/system.ts
TypeScript
dae957f14794eddd474d5f907a6bfaeb15ea46c50291673d743f79a0cf46602b
0
629
import { queryDatabase } from './queryDatabase'; import { searchFacilities } from './searchFacilities'; import { getFacility } from './getFacility'; import { findNearby } from './findNearby'; import { findMedicalDeserts } from './findMedicalDeserts'; import { detectAnomalies } from './detectAnomalies'; import { getSta...
hacknation
lib/tools/index.ts
TypeScript
7962fc6766e57c4bdf739aa9ef488eec638f59fe705766bae097bc50c9d06236
0
111
test
hacknation
lib/tools/test.txt
Text
f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
0
1
from typing import List, Literal, Optional from pydantic import BaseModel, Field ORGANIZATION_INFORMATION_SYSTEM_PROMPT = """ You extract facts ONLY about this organization: {organization}. Be conservative. If attribution is uncertain, exclude it. Rules (hard): - Include a fact only if its evidence explicitly names ...
hacknation
scripts/python_models/facility_and_ngo_fields.py
Python
cb4efd5c5a08c5bd2696b164663788d38567a66c6af1c470493c38991e1eb1fb
0
896
location strings if needed.", ) address_zipOrPostcode: Optional[str] = Field( None, description="ZIP or postal code of the organization" ) address_country: Optional[str] = Field( None, description="Full country name of the organization. Always extract if country or country code i...
hacknation
scripts/python_models/facility_and_ngo_fields.py
Python
363f6df0341b08dcd9b0a65c3f6c255fc40c463e2d1f3d268c01a2e825ec5b68
1
503
from typing import List, Optional from pydantic import BaseModel, Field FREE_FORM_SYSTEM_PROMPT = """ ROLE You are a specialized medical facility information extractor. Your task is to analyze website content and images to extract structured facts about healthcare facilities and organizations. TASK OVERVIEW Extract ...
hacknation
scripts/python_models/free_form.py
Python
8243a905b255c9888328f33dade8cbc91190a55a6c323a85589edf210022c24c
0
896
CT/X-ray), surgical/OR technologies, " "monitors, laboratory analyzers, and critical utilities (e.g., piped oxygen/oxygen plants, backup power). " "Include specific models when available. Do NOT list bed counts here; only list specific bed devices/models." ) ) capability: Optiona...
hacknation
scripts/python_models/free_form.py
Python
3bcdfb0bbb9faf6149198147379c6635ae27aa737eba76a7edb811f1fffa31e5
1
162
from typing import List, Optional from pydantic import BaseModel, Field from fdr.config.medical_specialties import MEDICAL_HIERATCHY, flatten_specialties_to_level LEVEL_OF_SPECIALTIES = 1 # 0th and 1st level of specialties MEDICAL_SPECIALTIES_SYSTEM_PROMPT = ( """You are a medical specialty classifier. Extract...
hacknation
scripts/python_models/medical_specialties.py
Python
89e59aa9cee5a20fe505765e32cdd99b4a57965552557a70aad6962459ffd36c
0
896
ED" → emergencyMedicine - "palliative/hospice" → hospiceAndPalliativeInternalMedicine - Generic "surgical/surgery" with no subspecialty → generalSurgery - "infectious/tropical" (diseases) → infectiousDiseases - If selecting generalSurgery, also consider anesthesia when anesthesia services are clearly indicated. **FACI...
hacknation
scripts/python_models/medical_specialties.py
Python
f4896b234589cd1ff2056a5f394bc43783e5f4f4e4b1bfe75ceec3573cc3748d
1
263
from typing import List, Optional from pydantic import BaseModel, Field ORGANIZATION_EXTRACTION_SYSTEM_PROMPT = """ You are a healthcare classification expert. Task: Extract medical facilities and NGOs present in the text, sorted into their appropriate categories. Definitions - ngos: An NGO is any non-profit organi...
hacknation
scripts/python_models/organization_extraction.py
Python
93eb1a5aade6070dc5b102201dabb984ef191b6936b6509cb70f78d9a8204421
0
896
Organizations mentioned only as research collaborators without healthcare service delivery - EXCLUDE government agencies or municipal corporations (e.g., "Municipal Corporation", "Health Department") """ class OrganizationExtractionOutput(BaseModel): ngos: Optional[List[str]] = Field( default_factory=list...
hacknation
scripts/python_models/organization_extraction.py
Python
65ce698339db84977aa324fa2b0569c93c5f885448c2b0f445f73770be5d2419
1
116
.vercel .env*.local
hacknation
www/.gitignore
Git Ignore
36cc3adb0b71465833febbf7a15c2df26c2e1f3868fc2ffb349f38a0fb8dde0b
0
7
{ "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", "extends": [ "ultracite/biome/core", "ultracite/biome/next", "ultracite/biome/react" ], "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": false, "defaultBranch": "main" }, "formatter": { "in...
hacknation
www/biome.jsonc
JSON
add516100a7f4c5606c20b682ee579fe330bb56aa44327b8bc0287232adfbd3e
0
426
{ "$schema": "https://ui.shadcn.com/schema.json", "style": "default", "rsc": true, "tsx": true, "tailwind": { "config": "", "css": "app/globals.css", "baseColor": "zinc", "cssVariables": true, "prefix": "" }, "aliases": { "components": "@/components", "utils": "@/lib/utils", ...
hacknation
www/components.json
JSON
5aacc543f96224b633890d5b5911b4de6006b61e464e5818597f5c904fba3c92
0
148
import { config } from "dotenv"; import { defineConfig } from "drizzle-kit"; config({ path: ".env.local", }); export default defineConfig({ schema: [ "./lib/db/schema.ts", "./lib/db/schema.facilities.ts", "./lib/db/schema.demographics.ts", ], out: "./lib/db/migrations", dialect: "postgresql", ...
hacknation
www/drizzle.config.ts
TypeScript
386324cbbc7c6a8a09ca923a0a6de76884bb21f6fdb9c700cf6874bb5c162666
0
133
import { registerOTel } from "@vercel/otel"; export function register() { registerOTel({ serviceName: "meridian" }); }
hacknation
www/instrumentation.ts
TypeScript
8d6ec8878fd8401826216dc1390fa0a5a3e0d549ac64e9521c8a5b3d4d28c5c4
0
30
/// <reference types="next" /> /// <reference types="next/image-types/global" /> import "./.next/dev/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
hacknation
www/next-env.d.ts
TypeScript
7ad303e40d4fddf44f156129e397511953a71481c5cfd86b1862649aaaf240cc
0
84
import withSerwistInit from "@serwist/next"; import type { NextConfig } from "next"; const withSerwist = withSerwistInit({ swSrc: "app/sw.ts", swDest: "public/sw.js", disable: process.env.NODE_ENV === "development", }); const nextConfig: NextConfig = { cacheComponents: true, // Required for Next.js 16+ (Tur...
hacknation
www/next.config.ts
TypeScript
28002de36f0e61c0cb8c7c68fb84451a33ac56c4a76bdad46532f23b184bbfa0
0
651
{ "name": "meridian", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev --turbo", "build": "next build", "start": "next start", "lint": "ultracite check", "format": "ultracite fix", "db:generate": "drizzle-kit generate", "db:migrate": "npx tsx lib/db/migrate.ts", ...
hacknation
www/package.json
JSON
72de7e00e47c367e19caf71a443735f1c81c367bff8016c16a2ac3d0b8109eeb
0
896
"@radix-ui/react-use-controllable-state": "^1.2.2", "@radix-ui/react-visually-hidden": "^1.1.0", "@serwist/next": "^9.5.5", "@vercel/analytics": "^1.3.1", "@vercel/blob": "^0.24.1", "@vercel/functions": "^2.0.0", "@vercel/otel": "^1.12.0", "@xyflow/react": "^12.10.0", "ai": "^6.0.37", ...
hacknation
www/package.json
JSON
73d22ea654ffd1f992d8b1e3f2235dcc93e8d30f1810352a684b266dfdbd2104
1
896
.5", "tailwind-merge": "^2.5.2", "tailwindcss-animate": "^1.0.7", "use-stick-to-bottom": "^1.1.1", "usehooks-ts": "^3.1.0", "web-push": "^3.6.7", "zod": "^3.25.76", "zustand": "^5.0.11" }, "devDependencies": { "@biomejs/biome": "2.3.11", "@playwright/test": "^1.50.1", "@tailw...
hacknation
www/package.json
JSON
44387e3cc8cc3e56333ac1b48cf944d6539264189a1074dcc0ae431e2956f8ca
2
369
import { type NextRequest, NextResponse } from "next/server"; import { getToken } from "next-auth/jwt"; import { guestRegex, isDevelopmentEnvironment } from "./lib/constants"; /* * next-auth v5 defaults to "authjs.session-token" but auth.ts overrides * the cookie name to "next-auth.session-token". We must tell getTo...
hacknation
www/proxy.ts
TypeScript
8e6fe50ecb5ce3c59620562835267a2702c194e0ef398d4b5dfe047344a405f3
0
592
<a href="https://chat.vercel.ai/"> <img alt="Next.js 14 and App Router-ready AI chatbot." src="app/(chat)/opengraph-image.png"> <h1 align="center">Chat SDK</h1> </a> <p align="center"> Chat SDK is a free, open-source template built with Next.js and the AI SDK that helps you quickly build powerful chatbot appli...
hacknation
www/README.md
Markdown
1da4073fe9421db52ff542f99bc3c7401ca150dbfad7009aa1ba61004e02a127
0
896
you use [Vercel Environment Variables](https://vercel.com/docs/projects/environment-variables) for this, but a `.env` file is all that is necessary. > Note: You should not commit your `.env` file or it will expose secrets that will allow others to control access to your various AI and authentication provider accounts....
hacknation
www/README.md
Markdown
01050b28b71aac32d286664c12d88f4aab6f7a88b30716c18395c4416ac095e0
1
168
"use server"; import type { PushSubscription } from "web-push"; import webpush from "web-push"; webpush.setVapidDetails( "mailto:hello@meridian.app", process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY!, process.env.VAPID_PRIVATE_KEY!, ); let subscription: PushSubscription | null = null; export async function subscribeU...
hacknation
www/app/actions.ts
TypeScript
7a807386844d7ff0eab39cd41b69ece9f80f62fe9cc9a3801e09867ce0e84393
0
297
secondary: oklch(0.269 0 0); --secondary-foreground: oklch(0.985 0 0); --marketing-secondary: oklch(54.65% 0.246 262.87); --muted: oklch(0.97 0 0); --muted-foreground: oklch(0.556 0 0); --accent: oklch(0.97 0 0); --accent-foreground: oklch(0.205 0 0); --destructive: oklch(0.58 0.22 27); --border: oklch(0.922 0 0); --in...
hacknation
www/app/globals.css
CSS
c31d0dd7cd9429576a12df1208490c6799d428cf792461c355a0566a2eabbfb8
1
746
import type { Metadata, Viewport } from "next"; import { Geist, Geist_Mono } from "next/font/google"; import { Toaster } from "sonner"; import { ThemeProvider } from "@/components/theme-provider"; import { SessionProvider } from "next-auth/react"; import "./globals.css"; const geist = Geist({ subsets: ["latin"], d...
hacknation
www/app/layout.tsx
TypeScript
2f819089ec97b7a3cbdd939e5fd35178541b727920c33f540a0f566b1b8b03af
0
679
import type { MetadataRoute } from "next"; export default function manifest(): MetadataRoute.Manifest { return { name: "Meridian", short_name: "Meridian", description: "Interactive healthcare facility mapping and AI analysis for Ghana", start_url: "/", display: "standalone", background_...
hacknation
www/app/manifest.ts
TypeScript
fc7a37248fc6bd66099b3057edac0e152a77e88a6405045ee73d34e50ca5b832
0
222
import { redirect } from "next/navigation"; export default function Home() { redirect("/chat"); }
hacknation
www/app/page.tsx
TypeScript
63dea357bc10ad76a839dbae9ad88b55ea3fc35a3d44157e2f77900cfabea4b2
0
27
/// <reference lib="webworker" /> import { defaultCache } from "@serwist/next/worker"; import type { PrecacheEntry, SerwistGlobalConfig } from "serwist"; import { Serwist } from "serwist"; // This declares the value of `injectionPoint` to TypeScript. // `injectionPoint` is the string that will be replaced by the // te...
hacknation
www/app/sw.ts
TypeScript
ee32a5812cb66cb4c0e1cc86e926f0b6037cf78d8afc94063b0da3405593d510
0
368
"use server"; import { headers } from "next/headers"; import { z } from "zod"; import { createUser, getUser } from "@/lib/db/queries"; import { rateLimit } from "@/lib/rate-limit"; import { signIn } from "./auth"; const authLimiter = rateLimit({ windowMs: 60_000, max: 5 }); const authFormSchema = z.object({ emai...
hacknation
www/app/(auth)/actions.ts
TypeScript
3b014007f74b704acde6eec073a27698eced9a93838b5121c8adc6b536bc1151
0
650
import type { NextAuthConfig } from "next-auth"; export const authConfig = { pages: { signIn: "/login", newUser: "/chat", }, session: { strategy: "jwt" as const, maxAge: 7 * 24 * 60 * 60, // 7 days }, providers: [ // added later in auth.ts since it requires bcrypt which is only compatible...
hacknation
www/app/(auth)/auth.config.ts
TypeScript
604a6287a090851908952ed656740168ab3dd59dca1bf8ce1498ca16c139f702
0
112
import { NextResponse } from "next/server"; import { encode, getToken } from "next-auth/jwt"; import { isDevelopmentEnvironment } from "@/lib/constants"; import { createGuestUser } from "@/lib/db/queries"; import { rateLimit } from "@/lib/rate-limit"; const guestLimiter = rateLimit({ windowMs: 60_000, max: 10 }); con...
hacknation
www/app/(auth)/api/auth/guest/route.ts
TypeScript
b90223a18b89c918757933e20df2fe57ac4c78a028d6c902200e9a36c053c331
0
775
"use client"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { useSession } from "next-auth/react"; import { useActionState, useEffect, useState } from "react"; import { AuthForm } from "@/components/auth-form"; import { MeridianLogo } from "@/components/icons"; import { SubmitButto...
hacknation
www/app/(auth)/login/page.tsx
TypeScript
cd2f4b326924f4302b72a72ab1b1ece0d3cd3eda156ad5e3058a005750f25e66
0
666
"use client"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { useSession } from "next-auth/react"; import { useActionState, useEffect, useState } from "react"; import { AuthForm } from "@/components/auth-form"; import { MeridianLogo } from "@/components/icons"; import { SubmitButton...
hacknation
www/app/(auth)/register/page.tsx
TypeScript
affd31dad0812c927f9221bd7ea0b2686de8a4c7a2ac7779fded67c2cc05b5dc
0
719
"use server"; import { generateText, type UIMessage } from "ai"; import { cookies } from "next/headers"; import { z } from "zod"; import type { VisibilityType } from "@/components/visibility-selector"; import { titlePrompt } from "@/lib/ai/prompts"; import { getTitleModel } from "@/lib/ai/providers"; import { delete...
hacknation
www/app/(chat)/actions.ts
TypeScript
f6d7c84c3444e10efa137b694a9b25e0b2b7af346bc85321a90b3ec1237f7b56
0
389
import { cookies } from "next/headers"; import Script from "next/script"; import { Suspense } from "react"; import { AppSidebar } from "@/components/app-sidebar"; import { DataStreamProvider } from "@/components/data-stream-provider"; import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar"; import { aut...
hacknation
www/app/(chat)/layout.tsx
TypeScript
ab77fa1bc274e337457fb4952c3a462112fd91570d8d3200fb3fd3769fdc6f4f
0
297
import { convertToModelMessages, createUIMessageStream, createUIMessageStreamResponse, generateId, } from "ai"; import { after } from "next/server"; import { createResumableStreamContext } from "resumable-stream"; import { auth, type UserType } from "@/app/(auth)/auth"; import { createOrchestratorAgent } from "...
hacknation
www/app/(chat)/api/chat/route.ts
TypeScript
1a1ee6ec0b4af1b7d11d56fca00b673d9083cd318ea98287ba32dde0c8e36636
0
896
user has uploaded the following documents. Use their content to inform your responses.\n\n${docSections.join("\n\n---\n\n")}`; } } } catch (docError) { console.error( "[ChatRoute] Failed to load chat documents:", docError instanceof Error ? docError.message : docError ); ...
hacknation
www/app/(chat)/api/chat/route.ts
TypeScript
cb253e913342936ec49ca0c80d47b525add0ee3e078fc375b467580133a3bc92
1
896
streamContext.createNewResumableStream( streamId, () => sseStream ); } } catch (_) { // ignore redis errors } }, }); } catch (error) { const vercelId = request.headers.get("x-vercel-id"); if (error instanceof ChatSDKError) ...
hacknation
www/app/(chat)/api/chat/route.ts
TypeScript
ef939216eba309bc3791255b6a0c926b43ca9f3f58ae07434de4b441d4d76000
2
446
import { z } from "zod"; const textPartSchema = z.object({ type: z.enum(["text"]), text: z.string().min(1).max(2000), }); const filePartSchema = z.object({ type: z.enum(["file"]), mediaType: z.enum(["image/jpeg", "image/png"]), name: z.string().min(1).max(100), url: z.string().url(), }); const partSchema...
hacknation
www/app/(chat)/api/chat/schema.ts
TypeScript
787baef6bad81ca1e64b54c18963fcda74e38aab4e0a9e4299888c1d0b031688
0
338
import { z } from "zod"; import { auth } from "@/app/(auth)/auth"; import type { ArtifactKind } from "@/components/artifact"; import { deleteDocumentsByIdAfterTimestamp, getDocumentsById, saveDocument, } from "@/lib/db/queries"; import { ChatSDKError } from "@/lib/errors"; import { rateLimit } from "@/lib/rate-li...
hacknation
www/app/(chat)/api/document/route.ts
TypeScript
a33e6d4e1a8f7b4624b9676ebc3af5ffbba7f4c3996990b8e2853b2f21a02ec0
0
896
; if (!session?.user) { return new ChatSDKError("unauthorized:document").toResponse(); } const documents = await getDocumentsById({ id }); const [document] = documents; if (document.userId !== session.user.id) { return new ChatSDKError("forbidden:document").toResponse(); } const documentsDele...
hacknation
www/app/(chat)/api/document/route.ts
TypeScript
995d93ef5c25129ee13cfc964d49b298a26aa360629571a2119956e69295254e
1
110
import { auth } from "@/app/(auth)/auth"; import { deleteChatDocument, getChatById, getChatDocumentById, getChatDocuments, } from "@/lib/db/queries"; import { ChatSDKError } from "@/lib/errors"; const UUID_RE = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/i; export async function GET(request: ...
hacknation
www/app/(chat)/api/documents/route.ts
TypeScript
955b5c7acecf53a74d6576272ff492bbd1de83ffbaba009ef84b77282143a15f
0
674
import { put } from "@vercel/blob"; import { NextResponse } from "next/server"; import { z } from "zod"; import { auth } from "@/app/(auth)/auth"; import { getChatById, saveChatDocument } from "@/lib/db/queries"; import { ChatSDKError } from "@/lib/errors"; import { rateLimit } from "@/lib/rate-limit"; const docUploa...
hacknation
www/app/(chat)/api/documents/upload/route.ts
TypeScript
87738be93b707fb92d83d8cc541176a25376f109f3660c941aedfcf6386a30a5
0
896
"application/pdf") { textContent = await extractTextFromPdf(fileBuffer); } else if (file.type === "text/plain" || file.type === "text/csv") { textContent = extractTextFromPlaintext(fileBuffer); } // Images (JPEG/PNG) don't have text extraction — they'll be // available via their ...
hacknation
www/app/(chat)/api/documents/upload/route.ts
TypeScript
6633cc3b202218164b3b08b72593cbedef47933ac668f6bbce24cc0e7f2f12c1
1
309
import { eq } from "drizzle-orm"; import { auth } from "@/app/(auth)/auth"; import { db } from "@/lib/db"; import { facilities } from "@/lib/db/schema.facilities"; import { computeAnomalyConfidence } from "@/lib/ai/tools/computeAnomalyConfidence"; import { ChatSDKError } from "@/lib/errors"; import { after } from "next...
hacknation
www/app/(chat)/api/facilities/[id]/route.ts
TypeScript
51f5ad71a9331ba40e736b78de970787003c6821cb0fa03e6a3f04cd854d10f2
0
550
import { put } from "@vercel/blob"; import { NextResponse } from "next/server"; import { z } from "zod"; import { auth } from "@/app/(auth)/auth"; import { rateLimit } from "@/lib/rate-limit"; const uploadLimiter = rateLimit({ windowMs: 60_000, max: 10 }); // Use Blob instead of File since File is not available in N...
hacknation
www/app/(chat)/api/files/upload/route.ts
TypeScript
6c4a19e07129b1642ee007057067df1943aef25df40e763afc8e043c5848ec99
0
640
import type { NextRequest } from "next/server"; import { z } from "zod"; import { auth } from "@/app/(auth)/auth"; import { deleteAllChatsByUserId, getChatsByUserId } from "@/lib/db/queries"; import { ChatSDKError } from "@/lib/errors"; const limitSchema = z.coerce.number().int().min(1).max(100).catch(10); const uuidS...
hacknation
www/app/(chat)/api/history/route.ts
TypeScript
14af25e7146d1edf91b6d76fda00fa253c00add7f27541be61cb62b2ad344f4c
0
391
import { z } from "zod"; import { auth } from "@/app/(auth)/auth"; import { getSuggestionsByDocumentId } from "@/lib/db/queries"; import { ChatSDKError } from "@/lib/errors"; const uuidSchema = z.string().uuid(); export async function GET(request: Request) { const { searchParams } = new URL(request.url); const do...
hacknation
www/app/(chat)/api/suggestions/route.ts
TypeScript
14e1ecff1703d95a89aeee96e83b5e049ab2402e5c6e1057d27becf84b869254
0
292
import { z } from "zod"; import { auth } from "@/app/(auth)/auth"; import { getChatById, getVotesByChatId, voteMessage } from "@/lib/db/queries"; import { ChatSDKError } from "@/lib/errors"; import { rateLimit } from "@/lib/rate-limit"; const voteLimiter = rateLimit({ windowMs: 60_000, max: 30 }); const voteSchema = ...
hacknation
www/app/(chat)/api/vote/route.ts
TypeScript
34ae0c4b9a024600d3db91f9c31e4f08a5935a1a9e397dfb16c4eef1327e7861
0
585
import { cookies } from "next/headers"; import { Suspense } from "react"; import { Chat } from "@/components/chat"; import { DataStreamHandler } from "@/components/data-stream-handler"; import { DEFAULT_CHAT_MODEL } from "@/lib/ai/models"; import { generateUUID } from "@/lib/utils"; export default function Page() { ...
hacknation
www/app/(chat)/chat/page.tsx
TypeScript
3fc70e3662db3866d51d7c6acf4567b7f7ccb3a6d0b7cdf1b80e50e05ac90dc3
0
229
import { cookies } from "next/headers"; import { notFound, redirect } from "next/navigation"; import { Suspense } from "react"; import { auth } from "@/app/(auth)/auth"; import { Chat } from "@/components/chat"; import { DataStreamHandler } from "@/components/data-stream-handler"; import { DEFAULT_CHAT_MODEL } from "@...
hacknation
www/app/(chat)/chat/[id]/page.tsx
TypeScript
96a97e981d4c2dd3ef50e5f47ec51ca9626cf361f89f070f1c7fc0f21607071b
0
489
"use client"; import { MeridianLogo } from "@/components/icons"; export default function OfflinePage() { return ( <div className="flex h-dvh w-screen flex-col items-center justify-center gap-6 bg-background px-4 text-center"> <MeridianLogo size={64} /> <div className="flex flex-col gap-2"> <...
hacknation
www/app/~offline/page.tsx
TypeScript
e8ae3dd76a39fd9ce76ae128cd1eb97f64f70c2f76527ca98325d37b50c43856
0
219
import { toast } from "sonner"; import { Artifact } from "@/components/create-artifact"; import { AccessibilityMapRenderer } from "@/components/artifacts/accessibility-map"; import { CopyIcon } from "@/components/icons"; export const accessibilityMapArtifact = new Artifact<"accessibility-map">({ kind: "accessibility...
hacknation
www/artifacts/accessibility-map/client.tsx
TypeScript
0725f98fe29193a6763d02a62e8bcbb7b23bc24aad8e68d6f8630ade35782f3e
0
392
import { streamObject } from "ai"; import { z } from "zod"; import { codePrompt, updateDocumentPrompt } from "@/lib/ai/prompts"; import { getArtifactModel } from "@/lib/ai/providers"; import { createDocumentHandler } from "@/lib/artifacts/server"; export const codeDocumentHandler = createDocumentHandler<"code">({ ki...
hacknation
www/artifacts/code/server.ts
TypeScript
bccfc1f46f249903b47df59518cc5913a86490ef66e378f56924b8b6c5753b0e
0
393
import { toast } from "sonner"; import { Artifact } from "@/components/create-artifact"; import { DataQualityMapRenderer } from "@/components/artifacts/data-quality-map"; import { CopyIcon } from "@/components/icons"; export const dataQualityMapArtifact = new Artifact<"data-quality-map">({ kind: "data-quality-map", ...
hacknation
www/artifacts/data-quality-map/client.tsx
TypeScript
2d648e46bc9d680e646eb63bbc8fb50d1a12d29223f3f7bef3fe41c052a7244a
0
397
import { toast } from "sonner"; import { Artifact } from "@/components/create-artifact"; import { FacilityMapRenderer } from "@/components/artifacts/facility-map"; import { CopyIcon } from "@/components/icons"; export const facilityMapArtifact = new Artifact<"facility-map">({ kind: "facility-map", description: "In...
hacknation
www/artifacts/facility-map/client.tsx
TypeScript
6cbfdd4ef1983b9e1f58f5e51949a55674decd10fb88b8870de2ee60bb3ce640
0
391
import { toast } from "sonner"; import { Artifact } from "@/components/create-artifact"; import { HeatmapRenderer } from "@/components/artifacts/heatmap"; import { CopyIcon } from "@/components/icons"; export const heatmapArtifact = new Artifact<"heatmap">({ kind: "heatmap", description: "Heatmap showing healthcar...
hacknation
www/artifacts/heatmap/client.tsx
TypeScript
fc787896fba4d313a9d0168883fa5e4f4c2193e2e1e7e64be2ff4f144470a599
0
384
import { toast } from "sonner"; import { Artifact } from "@/components/create-artifact"; import { MedicalDesertRenderer } from "@/components/artifacts/medical-desert"; import { CopyIcon } from "@/components/icons"; export const medicalDesertArtifact = new Artifact<"medical-desert">({ kind: "medical-desert", descri...
hacknation
www/artifacts/medical-desert/client.tsx
TypeScript
e30e8f2576ff92997f23754a667519b8d63929b92c1b4042488bfd466a70203c
0
394
import { toast } from "sonner"; import { Artifact } from "@/components/create-artifact"; import { MissionPlanRenderer } from "@/components/artifacts/mission-plan"; import { CopyIcon } from "@/components/icons"; export const missionPlanArtifact = new Artifact<"mission-plan">({ kind: "mission-plan", description: "Mi...
hacknation
www/artifacts/mission-plan/client.tsx
TypeScript
c0d4ad66e5a2afed526e120b1842f28c7bf7ee6ef012aa2a47c6ea2ee782f9ec
0
390
import { streamObject } from "ai"; import { z } from "zod"; import { sheetPrompt, updateDocumentPrompt } from "@/lib/ai/prompts"; import { getArtifactModel } from "@/lib/ai/providers"; import { createDocumentHandler } from "@/lib/artifacts/server"; export const sheetDocumentHandler = createDocumentHandler<"sheet">({ ...
hacknation
www/artifacts/sheet/server.ts
TypeScript
6c1c876194016ddccfd6dc4dd5854d4e1c4a3931431a3859e658d61a142be456
0
417
import { toast } from "sonner"; import { Artifact } from "@/components/create-artifact"; import { SpecialtyMapRenderer } from "@/components/artifacts/specialty-map"; import { CopyIcon } from "@/components/icons"; export const specialtyMapArtifact = new Artifact<"specialty-map">({ kind: "specialty-map", description...
hacknation
www/artifacts/specialty-map/client.tsx
TypeScript
cf384098fb2a0ec8476d5c57050c5865be09ef0ccfff692901b8dc3976e90fc3
0
394
import { toast } from "sonner"; import { Artifact } from "@/components/create-artifact"; import { StatsDashboardRenderer } from "@/components/artifacts/stats-dashboard"; import { CopyIcon } from "@/components/icons"; export const statsDashboardArtifact = new Artifact<"stats-dashboard">({ kind: "stats-dashboard", d...
hacknation
www/artifacts/stats-dashboard/client.tsx
TypeScript
0833ca0a7b4601f966c2306754ada645c69097acd4df6e1a96505a5d34501a58
0
390
description: "Add final polish", onClick: ({ sendMessage }) => { sendMessage({ role: "user", parts: [ { type: "text", text: "Please add final polish and check for grammar, add section titles for better structure, and ensure everything reads smoot...
hacknation
www/artifacts/text/client.tsx
TypeScript
6e32e831d75dd65e618e9d7d38990fafc217c76329bd11c3e0639d2d1937fc10
1
151
import { smoothStream, streamText } from "ai"; import { updateDocumentPrompt } from "@/lib/ai/prompts"; import { getArtifactModel } from "@/lib/ai/providers"; import { createDocumentHandler } from "@/lib/artifacts/server"; export const textDocumentHandler = createDocumentHandler<"text">({ kind: "text", onCreateDoc...
hacknation
www/artifacts/text/server.ts
TypeScript
deb1bdf2a10578762e87db774cb046cb7f0f850f24a31a66ef6d0a311f71d02f
0
389
"use client"; import Link from "next/link"; import { useRouter } from "next/navigation"; import type { User } from "next-auth"; import { useState } from "react"; import { toast } from "sonner"; import { useSWRConfig } from "swr"; import { unstable_serialize } from "swr/infinite"; import { MeridianLogo, PlusIcon, Trash...
hacknation
www/components/app-sidebar.tsx
TypeScript
324ca33bc18a935b92b928dcfcccecace9aa1430dc57522a4ed79ed7dccb1221
0
896
undone. This will permanently delete all your chats and remove them from our servers. </AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel>Cancel</AlertDialogCancel> <AlertDialogAction onClick={handleDeleteAll}> ...
hacknation
www/components/app-sidebar.tsx
TypeScript
d5f8d31bb0fbf5b106bcf563a016446074f500151a9fb63fbf6339449b132bf0
1
67
{ throw new Error("Artifact definition not found!"); } useEffect(() => { if (artifact.documentId !== "init" && artifactDefinition.initialize) { artifactDefinition.initialize({ documentId: artifact.documentId, setMetadata, }); } }, [artifact.documentId, artifactDefinition, ...
hacknation
www/components/artifact.tsx
TypeScript
4f5715436583a619475f72b933b2683e95de0e8634e488566cc9e48433b58620
2
896
"spring", stiffness: 800, damping: 30, }, }} initial={ isMobile ? { opacity: 1, x: artifact.boundingBox.left, y: artifact.boundingBox.top, h...
hacknation
www/components/artifact.tsx
TypeScript
ac57014c0b3fffaa3f1d65c81345aca01b8720891e680023537412d360d7008f
3
697
"use client"; import { FileTextIcon, XIcon } from "lucide-react"; import { useCallback } from "react"; import useSWR from "swr"; import { toast } from "sonner"; import type { ChatDocument } from "@/lib/db/schema"; import { fetcher } from "@/lib/utils"; function getDocIcon(contentType: string) { if (contentType === ...
hacknation
www/components/chat-documents.tsx
TypeScript
ab207c5c461ba40aa58198d3eb80653d65c1963a932bb611e09223672428cc33
0
588
"use client"; import { useChat } from "@ai-sdk/react"; import { DefaultChatTransport } from "ai"; import dynamic from "next/dynamic"; import { useRouter, useSearchParams } from "next/navigation"; import { useEffect, useRef, useState } from "react"; import useSWR, { useSWRConfig } from "swr"; import { unstable_serializ...
hacknation
www/components/chat.tsx
TypeScript
65978191c343f27d013a4ceef07ca78b0befbad1baf8f85766ae8450123aa597
0
896
addToolApprovalResponse, } = useChat<ChatMessage>({ id, messages: initialMessages, generateId: generateUUID, sendAutomaticallyWhen: ({ messages: currentMessages }) => { const lastMessage = currentMessages.at(-1); const shouldContinue = lastMessage?.parts?.some( (part) => ...
hacknation
www/components/chat.tsx
TypeScript
2b97947271c18eef8708080ab41d1e593687f7e5989a21aa8c24103fdb16c899
1
896
facility.lng]); setMapZoom(12); setMapVisible(true); } // searchFacilities: multiple facilities → show all on map if (toolName === "searchFacilities" && result.results?.length > 0) { const geoResults = result.results.filter( // eslint-disable-next-line @typescript-es...
hacknation
www/components/chat.tsx
TypeScript
097079047861c9e884e71977f86016c6a4169dbcb8c35ac980422b34f8c6f5b1
2
896
aria-label="Close map panel" className="absolute top-4 right-4 z-10 flex items-center justify-center size-8 rounded-lg bg-background/70 backdrop-blur-sm border border-border text-muted-foreground hover:text-foreground hover:bg-muted" onClick={() => { setMapVisible(false); ...
hacknation
www/components/chat.tsx
TypeScript
794493a5ac6372e471f7a4a90250e6c618720ac2746908b4d0de43dca279b912
3
523
import { marked } from "marked"; import OrderedMap from "orderedmap"; import { DOMParser, type MarkSpec, type Node as ProsemirrorNode, Schema, } from "prosemirror-model"; import { schema } from "prosemirror-schema-basic"; import { addListNodes } from "prosemirror-schema-list"; import { EditorState } from "prose...
hacknation
www/components/diffview.tsx
TypeScript
77c76cd5b63e0498f4dc28783161ec2f6cc1402e6d1384ab56e0688276012bf4
0
636
"use client"; import equal from "fast-deep-equal"; import { type MouseEvent, memo, useCallback, useEffect, useMemo, useRef, } from "react"; import useSWR from "swr"; import { useArtifact } from "@/hooks/use-artifact"; import type { Document } from "@/lib/db/schema"; import { cn, fetcher } from "@/lib/utils...
hacknation
www/components/document-preview.tsx
TypeScript
064c62ab9597e50cc8ce8ec7f0ddb0a80e98b14ec49159ebd53ba5a0c0361a30
0
896
pulse rounded-md bg-muted-foreground/20" /> </div> <div className="h-4 w-24 animate-pulse rounded-lg bg-muted-foreground/20" /> </div> <div> <FullscreenIcon /> </div> </div> {artifactKind === "image" ? ( <div className="overflow-y-scroll rounded-b-2xl border borde...
hacknation
www/components/document-preview.tsx
TypeScript
8fa353c08fb6b6a57c2758256e15a0c859dbe843ab32dfc57c4f62ba5a030f1c
1
896
div className="flex flex-col gap-0.5 sm:flex-row sm:items-center sm:gap-2"> <div className="-translate-y-1 font-medium sm:translate-y-0"> {title} </div> <span className="rounded-md bg-muted-foreground/10 px-1.5 py-0.5 text-muted-foreground text-xs"> {getArtifactLabel(kind)} ...
hacknation
www/components/document-preview.tsx
TypeScript
53b1e88837ffb69b9d753519c95df1a3e5a645abbaf0b22eacba46924d7d2261
2
574
import { memo } from "react"; import { toast } from "sonner"; import { useArtifact } from "@/hooks/use-artifact"; import { Button } from "@/components/ui/button"; import { Skeleton } from "@/components/ui/skeleton"; import type { ArtifactKind } from "./artifact"; import { FileIcon, MessageIcon, PencilEditIcon } from "....
hacknation
www/components/document.tsx
TypeScript
0e18cc43ea56a9e71b449e1adfc367067483b3d7dfe5e15435a75dc3b109e0c1
0
896
/> ) : null} </div> <span className="text-left text-sm"> {`${getActionText(type, "present")} ${ type === "create" && "title" in args && args.title ? `"${args.title}"` : type === "update" && "description" in args ? `"${args.description}"` ...
hacknation
www/components/document.tsx
TypeScript
215cb560341f4e8a94b48a56d1c49f652125912b7425eec45bf35f8973947530
1
155
/* eslint-disable @next/next/no-img-element */ "use client"; import { Icons } from "@/components/icons"; import { Reasoning, ReasoningContent, ReasoningResponse, } from "@/components/ui/reasoning"; import { AnimatePresence, motion, useInView } from "motion/react"; import { useEffect, useRef, useState } from "rea...
hacknation
www/components/first-bento-animation.tsx
TypeScript
0020a96ea1df02d655c7ac49452e0818d7a159abd90c099145c5a5ea23bcd725
0
896
: "easeOut", }} > <div className="flex gap-1"> {[0, 1, 2].map((index) => ( <motion.div key={index} className="w-2 h-2 bg-primary/50 rounded-full" animate=...
hacknation
www/components/first-bento-animation.tsx
TypeScript
8889f2cd1f9381ed579efc5fa8216e9334b5c6f3cd91a96e4ad44296dd6e263f
1
284
"use client"; import { AnimatePresence, motion, useInView, useMotionValue, useSpring, } from "motion/react"; import { useEffect, useRef, useState } from "react"; interface BoxConfig { title: string; className: string; } const boxConfigs: BoxConfig[] = [ { title: "Bento grid", className: "bg-s...
hacknation
www/components/fourth-bento-animation.tsx
TypeScript
dfd9bc48d23c7813977f436ca4fb0126198dc9eb93639a3a11689d49e0aecdb2
0
896
w-px h-5 bg-primary first:bg-transparent" ></div> ))} </div> <div className="w-1/2 h-full border-x border-border/70 border-dashed flex items-start justify-between"> {Array.from({ length: 5 }).map((_, index) => ( <div key={index} cla...
hacknation
www/components/fourth-bento-animation.tsx
TypeScript
dc02834288578cfdc829cf5c730de17500284bb435d6e4cdcb198cd24db3f90e
1
896
"use client"; import { motion } from "framer-motion"; import { Activity, AlertTriangle, BarChart3, Globe, Heart, MapPin, Search, Stethoscope, } from "lucide-react"; import type { ReactNode } from "react"; import { useChatActions } from "@/lib/chat-actions-context"; import { MeridianLogo } from "./icons...
hacknation
www/components/greeting.tsx
TypeScript
bf29b42e22053398b32381a0d5667d8d8d3b7b29c696b3f32059b8b05c035866
0
896
> Meridian is an AI assistant for advanced healthcare data analytics. Analyze facility-level attributes, orchestrate mission strategies, identify critical service gaps, and extract actionable intelligence. </motion.p> <motion.div animate={{ opacity: 1, y: 0 }} className="mt-6 flex f...
hacknation
www/components/greeting.tsx
TypeScript
b8291156bd32b5e5f066fe40013351e97abd896e6471fa99146eca4e0f8c0e63
1
241
9L16.0303 8.46967L16 8.43934V2.5V1H14.5H1.5H4.05312e-06V2.5V10.6893L-0.0606689 10.75L4.05312e-06 10.8107Z" fill="currentColor" fillRule="evenodd" /> </svg> ); }; export const FullscreenIcon = ({ size = 16 }: { size?: number }) => ( <svg height={size} strokeLinejoin="round" sty...
hacknation
www/components/icons.tsx
TypeScript
4d6103d45b00be55a21a4eec8583a83764d8f508c04bca2551c655e834c5ce19
16
896
viewBox="0 0 16 16" width={size} > <path clipRule="evenodd" d="M8.55846 0.5C9.13413 0.5 9.65902 0.829456 9.90929 1.34788L15.8073 13.5653C16.1279 14.2293 15.6441 15 14.9068 15H1.09316C0.355835 15 -0.127943 14.2293 0.192608 13.5653L6.09065 1.34787C6.34092 0.829454 6.86581 0.5 7.44148 0.5H8...
hacknation
www/components/icons.tsx
TypeScript
fcc95249178bf607ec37f0275fb997ebe21f5e0bf15ab96fe0aad48b5826d685
17
896
26.0938C26.4734 25.4085 26.0534 24.9885 25.3313 24.9885C24.4397 24.9885 23.8871 25.7327 23.8871 26.897C23.8871 28.0759 24.4545 28.7906 25.324 28.7906C26.105 28.7906 26.5176 28.3412 26.6355 27.5896L27.6376 27.6412C27.4313 28.8717 26.6429 29.6233 25.324 29.6233ZM29.6489 29.5054C29.6489 28.238 30.1205 27.5085 31.5573 26.7...
hacknation
www/components/icons.tsx
TypeScript
201409d32cfe20288fe35f5d9519c82c5ef73c9fd5ecdae09a945b7c8f20bfbe
18
896
.3708 27.3906 15.1055 27.3047 14.7567 27.2212C14.3097 27.118 13.9585 27.005 13.7031 26.8822C13.4476 26.7545 13.261 26.5973 13.1431 26.4106C13.0301 26.224 12.9736 25.9882 12.9736 25.7033C12.9736 25.3987 13.0473 25.131 13.1946 24.9001C13.3469 24.6643 13.5655 24.4826 13.8504 24.3548C14.1353 24.2222 14.4718 24.1559 14.8599...
hacknation
www/components/icons.tsx
TypeScript
6fcad5fde21d037faa77681376441c7c3ff52a5cc74a117fc8bd288315a32d7b
19
896
20.4062 17.6819C20.0624 17.4608 19.7947 17.144 19.6031 16.7313C19.4115 16.3187 19.3157 15.8349 19.3157 15.2798C19.3157 14.7247 19.4115 14.2408 19.6031 13.8282C19.7947 13.4106 20.0624 13.0913 20.4062 12.8703C20.755 12.6492 21.1578 12.5387 21.6147 12.5387C22.2091 12.5387 22.6831 12.6959 23.0368 13.0103C23.3905 13.3247 23...
hacknation
www/components/icons.tsx
TypeScript
c3b52b67fd5bf26c4277f654a1a837112e9f5266a23344ee2a9380b8c702b586
20
896