-
Notifications
You must be signed in to change notification settings - Fork 0
Wire Therapy Compass into the app as a routed mode + universal search #825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
abc35c5
Wire Therapy Compass into the app as a routed mode + universal search
claude 9a10dd4
Merge remote-tracking branch 'origin/main' into claude/therapy-pages-…
claude 1c53c73
Merge remote-tracking branch 'origin/main' into claude/therapy-pages-…
claude afcd1e9
Merge remote-tracking branch 'origin/main' into claude/therapy-pages-…
claude a336768
Address CodeRabbit review: brief/sheet availability, query reset, sit…
claude 026a582
Merge remote-tracking branch 'origin/main' into claude/therapy-pages-…
claude f8e5a90
Merge branch 'main' into claude/therapy-pages-navigation-tmapa5
BigSimmo 1aaf2a2
Initial plan: resolve merge conflicts with origin/main
Copilot ed2f761
Merge branch 'main' into claude/therapy-pages-navigation-tmapa5
Copilot 8cb9ee9
Merge branch 'main' into claude/therapy-pages-navigation-tmapa5
BigSimmo df59095
Guard Therapy Compass artifact routes and fix picker selection on sub…
claude 8c82e45
Merge branch 'main' into claude/therapy-pages-navigation-tmapa5
BigSimmo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // Generates src/data/therapies-index.json — a trimmed, server-importable projection | ||
| // of public/therapy-compass-data/therapies.json (~2.5 MB). The full dataset is fetched | ||
| // client-side by the interactive Therapy Compass screens; the server only needs a small | ||
| // rankable/metadata projection for routing (generateStaticParams / notFound / metadata) | ||
| // and the universal-search "therapies" domain. Re-run after editing the source dataset, | ||
| // then run Prettier (which owns the committed file's exact formatting): | ||
| // | ||
| // node scripts/build-therapies-index.mjs && npm run format | ||
| // | ||
| import { readFileSync, writeFileSync } from "node:fs"; | ||
| import { dirname, join } from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
|
|
||
| const root = join(dirname(fileURLToPath(import.meta.url)), ".."); | ||
| const source = join(root, "public", "therapy-compass-data", "therapies.json"); | ||
| const target = join(root, "src", "data", "therapies-index.json"); | ||
|
|
||
| const therapies = JSON.parse(readFileSync(source, "utf8")); | ||
|
|
||
| const projected = therapies | ||
| .map((t) => ({ | ||
| slug: t.slug, | ||
| name: t.name, | ||
| category: t.category ?? null, | ||
| modality: t.modality ?? null, | ||
| clinicalSummary: t.clinicalSummary ?? null, | ||
| bestUsedFor: t.bestUsedFor ?? null, | ||
| targetSymptoms: t.targetSymptoms ?? null, | ||
| indications: t.indications ?? null, | ||
| reviewStatus: t.reviewStatus ?? "needs_review", | ||
| patientSheetAvailable: Boolean(t.patientSheetAvailable), | ||
| briefInterventionAvailable: Boolean(t.briefInterventionAvailable), | ||
| tags: Array.isArray(t.tags) ? t.tags : [], | ||
| aliases: Array.isArray(t.aliases) ? t.aliases : [], | ||
| })) | ||
| .sort((a, b) => a.name.localeCompare(b.name)); | ||
|
|
||
| writeFileSync(target, `${JSON.stringify(projected, null, 2)}\n`); | ||
| console.log(`Wrote ${projected.length} therapy records to ${target}`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import type { Metadata } from "next"; | ||
| import { notFound } from "next/navigation"; | ||
|
|
||
| import { BriefScreen } from "@/components/therapy-compass/screens/brief-screen"; | ||
| import { findTherapyRecord, therapyBriefSlugs } from "@/lib/therapies"; | ||
|
|
||
| export function generateStaticParams() { | ||
| // Only records that actually ship a brief-intervention version get a route. | ||
| return therapyBriefSlugs().map((slug) => ({ slug })); | ||
| } | ||
|
|
||
| export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> { | ||
| const { slug } = await params; | ||
| const record = findTherapyRecord(slug); | ||
| return { | ||
| title: | ||
| record && record.briefInterventionAvailable | ||
| ? `${record.name} · Brief intervention - Therapy Compass` | ||
| : "Therapy not found - Therapy Compass", | ||
| }; | ||
| } | ||
|
|
||
| export default async function TherapyCompassBriefRoute({ params }: { params: Promise<{ slug: string }> }) { | ||
| const { slug } = await params; | ||
| const record = findTherapyRecord(slug); | ||
| // 404 unknown records and records without a brief-intervention version, rather | ||
| // than rendering an unsupported workflow. | ||
| if (!record || !record.briefInterventionAvailable) notFound(); | ||
| return <BriefScreen />; | ||
|
BigSimmo marked this conversation as resolved.
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.