95 lines
2.6 KiB
TypeScript
95 lines
2.6 KiB
TypeScript
/**
|
|
* Genera backend/scripts/fixtures/glossary-migration.json desde los datos del frontend.
|
|
* TICKET-012: Migrar glosarios del frontend al backend.
|
|
*
|
|
* Ejecutar desde la raíz del repo: npx tsx backend/scripts/generate-glossary-fixture.ts
|
|
*/
|
|
|
|
import { writeFileSync, mkdirSync } from 'fs';
|
|
import { join, dirname } from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
|
interface TermRow {
|
|
term: string;
|
|
abbreviation?: string;
|
|
category: 'pharmaceutical' | 'anatomical';
|
|
definition: string;
|
|
context?: string;
|
|
source?: string;
|
|
}
|
|
|
|
async function main() {
|
|
const terms: TermRow[] = [];
|
|
|
|
const { pharmaceuticalTerminology } = await import('../../src/data/pharmaceutical-terminology.js');
|
|
const { anatomicalTerminology } = await import('../../src/data/anatomical-terminology.js');
|
|
|
|
for (const item of [
|
|
...pharmaceuticalTerminology.units,
|
|
...pharmaceuticalTerminology.routes,
|
|
...pharmaceuticalTerminology.concepts,
|
|
]) {
|
|
terms.push({
|
|
term: item.fullTerm,
|
|
abbreviation: item.abbreviation || undefined,
|
|
category: 'pharmaceutical',
|
|
definition: item.explanation,
|
|
context: item.danger || item.category,
|
|
source: 'Manual TES Digital - Bloque 6',
|
|
});
|
|
}
|
|
|
|
for (const item of anatomicalTerminology.directionalTerms) {
|
|
terms.push({
|
|
term: item.term,
|
|
category: 'anatomical',
|
|
definition: item.definition,
|
|
context: item.example || item.category,
|
|
source: 'Manual TES Digital - Bloque 2',
|
|
});
|
|
}
|
|
|
|
for (const item of anatomicalTerminology.positions) {
|
|
terms.push({
|
|
term: item.name,
|
|
category: 'anatomical',
|
|
definition: item.description,
|
|
context: item.indication,
|
|
source: 'Manual TES Digital - Bloque 2',
|
|
});
|
|
}
|
|
|
|
for (const item of anatomicalTerminology.landmarks) {
|
|
terms.push({
|
|
term: item.name,
|
|
category: 'anatomical',
|
|
definition: `${item.location} - ${item.purpose}`,
|
|
context: item.region,
|
|
source: 'Manual TES Digital - Bloque 2',
|
|
});
|
|
}
|
|
|
|
for (const item of anatomicalTerminology.applicationSteps) {
|
|
terms.push({
|
|
term: item.title,
|
|
category: 'anatomical',
|
|
definition: item.instruction,
|
|
context: 'aplicacion',
|
|
source: 'Manual TES Digital - Bloque 2',
|
|
});
|
|
}
|
|
|
|
const fixturesDir = join(__dirname, 'fixtures');
|
|
mkdirSync(fixturesDir, { recursive: true });
|
|
const outPath = join(fixturesDir, 'glossary-migration.json');
|
|
writeFileSync(outPath, JSON.stringify({ terms }, null, 2), 'utf-8');
|
|
console.log(`✅ Generados ${terms.length} términos en ${outPath}`);
|
|
}
|
|
|
|
main().catch((err) => {
|
|
console.error(err);
|
|
process.exit(1);
|
|
});
|