refactor: rename swift → cortex in code and documentation
Complete rename of "swift" terminology to "cortex" across the codebase: Code Changes: - Rename directories: lib/swift → lib/cortex, components/swift → components/cortex - Rename API routes: /api/swift/* → /api/cortex/* - Rename page routes: /epd/swift → /epd/cortex - Rename store: swift-store.ts → cortex-store.ts Type Renames: - SwiftIntent → CortexIntent - SwiftStore → CortexStore - useSwiftStore → useCortexStore - SwiftContext → CortexContext - useSwiftVoice → useCortexVoice Documentation Updates (docs/intent/): - Safety Net → Nudge (Layer 3 rename) - SafetySuggestion → NudgeSuggestion - evaluateSafetyNet → evaluateNudge - SWIFT_* feature flags → CORTEX_* - All path references updated to match new structure Files affected: 47 files, ~700 lines changed 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
102
lib/cortex/verify-entity-extraction.ts
Normal file
102
lib/cortex/verify-entity-extraction.ts
Normal file
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* Manual verification script for entity extraction with date/time parser
|
||||
* Run with: pnpm tsx lib/cortex/verify-entity-extraction.ts
|
||||
*/
|
||||
|
||||
import { extractEntities } from './entity-extractor';
|
||||
import { format } from 'date-fns';
|
||||
import { nl } from 'date-fns/locale';
|
||||
|
||||
console.log('🧪 Testing Entity Extraction with Date/Time Parser\n');
|
||||
|
||||
// Test cases for each agenda intent
|
||||
const testCases = [
|
||||
{
|
||||
intent: 'agenda_query' as const,
|
||||
inputs: [
|
||||
'afspraken vandaag',
|
||||
'agenda morgen',
|
||||
'wat is volgende afspraak',
|
||||
'afspraken deze week',
|
||||
],
|
||||
},
|
||||
{
|
||||
intent: 'create_appointment' as const,
|
||||
inputs: [
|
||||
'maak afspraak jan morgen 14:00',
|
||||
'plan intake marie vrijdag 10:00',
|
||||
'afspraak met piet twee uur',
|
||||
'maak behandeling lisa dinsdag half drie',
|
||||
],
|
||||
},
|
||||
{
|
||||
intent: 'cancel_appointment' as const,
|
||||
inputs: [
|
||||
'annuleer afspraak jan',
|
||||
'cancel de 14:00 afspraak',
|
||||
'annuleer jan morgen',
|
||||
],
|
||||
},
|
||||
{
|
||||
intent: 'reschedule_appointment' as const,
|
||||
inputs: [
|
||||
'verzet 14:00 naar 15:00',
|
||||
'verzet jan naar dinsdag',
|
||||
'verplaats de afspraak naar morgen 10:00',
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
testCases.forEach(({ intent, inputs }) => {
|
||||
console.log(`\n📋 Testing ${intent}:\n`);
|
||||
|
||||
inputs.forEach((input) => {
|
||||
const entities = extractEntities(input, intent);
|
||||
console.log(` Input: "${input}"`);
|
||||
|
||||
// Display extracted entities
|
||||
if (entities.patientName) {
|
||||
console.log(` 👤 Patient: ${entities.patientName}`);
|
||||
}
|
||||
|
||||
if (entities.dateRange) {
|
||||
const { start, end, label } = entities.dateRange;
|
||||
console.log(
|
||||
` 📅 Date Range: ${format(start, 'dd MMM', { locale: nl })} - ${format(end, 'dd MMM', { locale: nl })} (${label})`
|
||||
);
|
||||
}
|
||||
|
||||
if (entities.datetime) {
|
||||
const { date, time } = entities.datetime;
|
||||
const dateStr = format(date, 'dd MMMM yyyy', { locale: nl });
|
||||
console.log(` 🕐 Datetime: ${dateStr} om ${time || '(tijd niet gespecificeerd)'}`);
|
||||
}
|
||||
|
||||
if (entities.appointmentType) {
|
||||
console.log(` 📝 Type: ${entities.appointmentType}`);
|
||||
}
|
||||
|
||||
if (entities.location) {
|
||||
console.log(` 📍 Location: ${entities.location}`);
|
||||
}
|
||||
|
||||
if (entities.identifier) {
|
||||
const { type, patientName, time, date } = entities.identifier;
|
||||
let identifierStr = ` 🔍 Identifier: type=${type}`;
|
||||
if (patientName) identifierStr += `, patient=${patientName}`;
|
||||
if (time) identifierStr += `, time=${time}`;
|
||||
if (date) identifierStr += `, date=${format(date, 'dd MMM', { locale: nl })}`;
|
||||
console.log(identifierStr);
|
||||
}
|
||||
|
||||
if (entities.newDatetime) {
|
||||
const { date, time } = entities.newDatetime;
|
||||
const dateStr = format(date, 'dd MMMM yyyy', { locale: nl });
|
||||
console.log(` 🔄 New Datetime: ${dateStr} om ${time || '(tijd niet gespecificeerd)'}`);
|
||||
}
|
||||
|
||||
console.log('');
|
||||
});
|
||||
});
|
||||
|
||||
console.log('✅ Verification complete!');
|
||||
Reference in New Issue
Block a user