From 84fcd6d306b2ca1b2b96b2ec22d54246fce83fd1 Mon Sep 17 00:00:00 2001 From: isc-lperezra Date: Sat, 21 Dec 2024 15:39:16 +0100 Subject: [PATCH] Minor updates --- encoder-ui/src/app/analysis/analysis.component.ts | 6 ++---- encoder-ui/src/app/analyzer/analyzer.component.ts | 6 +++--- src/ENCODER/BP/AnalyzeTextProcess.cls | 3 +-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/encoder-ui/src/app/analysis/analysis.component.ts b/encoder-ui/src/app/analysis/analysis.component.ts index 9298a04..274ad3e 100644 --- a/encoder-ui/src/app/analysis/analysis.component.ts +++ b/encoder-ui/src/app/analysis/analysis.component.ts @@ -113,13 +113,11 @@ export class AnalysisComponent implements OnInit{ } markDiagnosis(text: string) { - var regex = /[.,;:¿?!¡\(\)-]/g; + var regEx = new RegExp(text.trim(), "ig"); this.unmarkDiagnosis(); var textHTML = this.textToMark; - var phrase = ""; - var indexInit = 0; - textHTML = textHTML.replace(text, ""+text+""); + textHTML = textHTML.replace(regEx, ""+text+""); this.textUpdated = textHTML; } diff --git a/encoder-ui/src/app/analyzer/analyzer.component.ts b/encoder-ui/src/app/analyzer/analyzer.component.ts index ba53af6..ebac7a0 100644 --- a/encoder-ui/src/app/analyzer/analyzer.component.ts +++ b/encoder-ui/src/app/analyzer/analyzer.component.ts @@ -53,7 +53,7 @@ export class AnalyzerComponent { var textHTML = this.textToAnalyze?.value; var textOriginal = textHTML; var textToProcess = this.textToAnalyze?.value.split(".").filter(Boolean); - var piecedTextToProcess: any[] = [textOriginal]; + var piecedTextToProcess: any[] = textToProcess; var forReading = 100/(piecedTextToProcess.length); this.totalReceived = 0; @@ -117,11 +117,11 @@ export class AnalyzerComponent { } markDiagnosis(text: String) { - var regex = /[.,;:¿?!¡\(\)-]/g; + var regEx = new RegExp(text.trim(), "ig"); this.unmarkDiagnosis(); var textHTML = this.textToAnalyze?.value; - textHTML = textHTML.replace(text, ""+text+""); + textHTML = textHTML.replace(regEx, ""+text+""); this.textUpdated = textHTML; } diff --git a/src/ENCODER/BP/AnalyzeTextProcess.cls b/src/ENCODER/BP/AnalyzeTextProcess.cls index cb735ab..6c4ad7f 100644 --- a/src/ENCODER/BP/AnalyzeTextProcess.cls +++ b/src/ENCODER/BP/AnalyzeTextProcess.cls @@ -14,14 +14,13 @@ Method AnalyzeText(text As %String, analysisId As %String, language As %String) { import sentence_transformers import iris - import spacy import requests try: url = "http://ollama:11434/api/generate" data = { "model": "llama3.2", - "prompt": "Extrae en formato CSV el texto literal de los diagnósticos encontrados en el paciente del siguiente texto sin mostrar diagnósticos que no se observen ni para los que no hay hallazgos patológicos, devuelve únicamente el CSV, evita fórmulas de cortesía: "+text, + "prompt": "Extrae en formato CSV los diagnósticos encontrados en el paciente del siguiente texto sin mostrar diagnósticos que no se observen ni para los que no hay hallazgos patológicos, evita fórmulas de cortesía: "+text, "stream": False } response = requests.post(url, json=data)