@fuego-systems/core 0.1.11 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +63 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +66 -2
- package/dist/constants.js.map +1 -1
- package/dist/plan-definition-group.d.ts +17 -3
- package/dist/plan-definition-group.d.ts.map +1 -1
- package/dist/plan-definition-group.js +38 -13
- package/dist/plan-definition-group.js.map +1 -1
- package/dist/search/normalizer.d.ts.map +1 -1
- package/dist/search/normalizer.js +5 -1
- package/dist/search/normalizer.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizer.js","sourceRoot":"","sources":["../../src/search/normalizer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;
|
|
1
|
+
{"version":3,"file":"normalizer.js","sourceRoot":"","sources":["../../src/search/normalizer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAwDH,8BAuBC;AA7ED,yEAAyE;AACzE,MAAM,aAAa,GAAuB;IACxC,CAAC,SAAS,EAAE,sBAAsB,CAAC;IACnC,CAAC,UAAU,EAAE,sBAAsB,CAAC;IACpC,CAAC,UAAU,EAAE,sBAAsB,CAAC;IACpC,CAAC,SAAS,EAAE,aAAa,CAAC;IAC1B,CAAC,UAAU,EAAE,YAAY,CAAC;IAC1B,CAAC,SAAS,EAAE,YAAY,CAAC;IACzB,CAAC,UAAU,EAAE,WAAW,CAAC;IACzB,CAAC,SAAS,EAAE,WAAW,CAAC;IACxB,CAAC,UAAU,EAAE,SAAS,CAAC;IACvB,CAAC,UAAU,EAAE,WAAW,CAAC;IACzB,CAAC,UAAU,EAAE,SAAS,CAAC;IACvB,CAAC,UAAU,EAAE,SAAS,CAAC;IACvB,CAAC,UAAU,EAAE,UAAU,CAAC;IACxB,CAAC,UAAU,EAAE,UAAU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,+BAA+B;IAC/B,KAAK,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,aAAa,EAAE,CAAC;QACjD,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IAC7C,CAAC;IAED,2DAA2D;IAC3D,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,CAAA;IAE5C,uCAAuC;IACvC,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC","sourcesContent":["/**\n * Text normaliser for the HealthcareService search index.\n *\n * Produces a lower-cased, accent-stripped, abbreviation-expanded string\n * suitable for trigram similarity matching via pg_trgm.\n *\n * The normalisation here must mirror what the Postgres migration achieves with\n * `unaccent()` for query-time comparisons. By pre-normalising at index time we\n * avoid calling `unaccent()` on every row during search, which would prevent\n * the GIN index from being used.\n */\n\n/** Expanded abbreviations map (Spanish medical/radiological context). */\nconst ABBREVIATIONS: [RegExp, string][] = [\n [/\\brm\\b/g, 'resonancia magnetica'],\n [/\\brmn\\b/g, 'resonancia magnetica'],\n [/\\brnm\\b/g, 'resonancia magnetica'],\n [/\\brx\\b/g, 'radiografia'],\n [/\\btac\\b/g, 'tomografia'],\n [/\\btc\\b/g, 'tomografia'],\n [/\\beco\\b/g, 'ecografia'],\n [/\\bus\\b/g, 'ecografia'],\n [/\\bder\\b/g, 'derecha'],\n [/\\bizq\\b/g, 'izquierda'],\n [/\\bint\\b/g, 'interno'],\n [/\\bext\\b/g, 'externo'],\n [/\\bsup\\b/g, 'superior'],\n [/\\binf\\b/g, 'inferior'],\n [/\\bant\\b/g, 'anterior'],\n [/\\bpost\\b/g, 'posterior'],\n [/\\bmed\\b/g, 'medico'],\n [/\\bped\\b/g, 'pediatrico'],\n [/\\bgine\\b/g, 'ginecologia'],\n [/\\boftal\\b/g, 'oftalmologia'],\n [/\\btraumat\\b/g, 'traumatologia'],\n [/\\bneurol\\b/g, 'neurologia'],\n [/\\bcardio\\b/g, 'cardiologia'],\n [/\\bderma\\b/g, 'dermatologia'],\n [/\\boncol\\b/g, 'oncologia'],\n [/\\burgen\\b/g, 'urgencias'],\n [/\\bcir\\b/g, 'cirugia'],\n [/\\bfisio\\b/g, 'fisioterapia'],\n [/\\bpsico\\b/g, 'psicologia'],\n [/\\bodont\\b/g, 'odontologia'],\n [/\\bnutri\\b/g, 'nutricion'],\n [/\\blab\\b/g, 'laboratorio'],\n [/\\bpat\\b/g, 'patologia'],\n [/\\brad\\b/g, 'radiologia'],\n [/\\btv\\b/g, 'transvaginal'],\n [/\\becodoppler\\b/g, 'doppler'],\n [/\\becodopler\\b/g, 'doppler'],\n [/\\becodopple\\b/g, 'doppler']\n]\n\n/**\n * Normalise a text string for storage or query comparison.\n *\n * Steps:\n * 1. NFD decompose + strip combining diacritical marks (accent removal)\n * 2. Lower-case\n * 3. Expand known medical abbreviations\n * 4. Remove non-alphanumeric characters (keep spaces)\n * 5. Collapse whitespace and trim\n * @param text - Input text to normalize.\n * @returns Normalized text suitable for trigram index lookup.\n */\nexport function normalize (text: string | null | undefined): string {\n if (!text) {\n return ''\n }\n\n // Step 1: Remove diacritics (accent stripping via NFD decomposition)\n let result = text\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '')\n\n // Step 2: Lower-case\n result = result.toLowerCase()\n\n // Step 3: Expand abbreviations\n for (const [pattern, expansion] of ABBREVIATIONS) {\n result = result.replace(pattern, expansion)\n }\n\n // Step 4: Remove non-alphanumeric characters (keep spaces)\n result = result.replace(/[^a-z0-9\\s]/g, ' ')\n\n // Step 5: Collapse whitespace and trim\n return result.replace(/\\s+/g, ' ').trim()\n}\n"]}
|