Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • dzptm/user-interface
1 result
Show changes
Commits on Source (22)
Showing
with 561 additions and 57 deletions
......@@ -233,6 +233,8 @@ Definition des Objekts „service“:
| number | String (Int) | Menge der Leistung | „1“, „2“, „3“, … |
| localisation | String (Enum) | Lokalisation der Leistung | „B“ / „L“ / „R“ / „NB“ / „NR“ / „empty” |
Definition des Objekts „raw_service“:
| Name | Typ | Beschreibung | Optionen / Beispiel |
......@@ -262,12 +264,6 @@ per POST an die im Input übergebene *targeturl* geschickt:
</tr>
</thead>
<tbody>
<tr class="odd">
<td>modality</td>
<td>String</td>
<td>die ermittelte Modalität</td>
<td>„konv. Röntgen“</td>
</tr>
<tr class="even">
<td>anamnesis</td>
<td>String</td>
......@@ -363,6 +359,7 @@ Definition des Objekts „service“:
| description | String | Leistungsbezeichnung | „Röntgen Schulter in zwei Ebenen“ |
| number | String (Int) | Menge der Leistung | „1“, „2“, „3“, … |
| localisation | String (Enum) | Lokalisation der Leistung | „B“ / „L“ / „R“ / „NB“ / „NR“ / „empty” |
| modality | String | Die ermittelte Modalität | „konv. Röntgen“ |
Ist der HTTP Request an die targeturl einschließlich JSON gültig und vollständig, wird dieser mit einem HTTP Status 200 beantwortet. Im SAP wird gleichzeitig ein strukturiertes Anordnungsdokument angelegt und mit den übergebenen Daten befüllt. Jeder gültige HTTP Request legt ein neues Anordnungsdokument an.
......
import { NgModule } from '@angular/core';
import { ErrorHandler, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { HttpClientModule } from '@angular/common/http';
......@@ -7,11 +7,13 @@ import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { ErrorLoggerService } from './services/error-logger.service';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, IonicModule.forRoot({mode: 'ios'}), AppRoutingModule, HttpClientModule],
providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
{provide: ErrorHandler, useClass: ErrorLoggerService},],
bootstrap: [AppComponent],
})
export class AppModule {}
......@@ -70,7 +70,14 @@ export class TypeaheadComponent implements OnInit {
const { checked, value } = ev.detail;
if (checked) {
this.workingSelectedValues = [...this.workingSelectedValues, value];
if (value == "Keine" || value == "Unbekannt") {
this.workingSelectedValues = [value];
this.confirmChanges();
}else {
// Disable Keine or Unbekannt if something else is selected
this.workingSelectedValues = this.workingSelectedValues.filter((item) => item !== "Keine" && item !== "Unbekannt");
this.workingSelectedValues = [...this.workingSelectedValues, value];
}
} else {
this.workingSelectedValues = this.workingSelectedValues.filter((item) => item !== value);
}
......
import { OrderStructuredPage } from "../pages/order-structured/order-structured.page";
import { StudySimpleDictResultPage } from "../pages/study-simple-dict-result/study-simple-dict-result.page";
import { Order } from "./Order";
import { StudySimpleDictResultPage } from "../pages/study-simple-dict-result/study-simple-dict-result.page";
import { Recommendation } from "./Recommendation";
/**
* This class represents the logdata.
......@@ -34,23 +35,26 @@ export class LogData {
nldNotice: number;
// Correctness
correctServices: number = 0;
wrongServices: string[] = [];
// Recommendation
recommendations: string[][] = [];
constructor(unitid: string, institution: string, timeStart: number) {
this.unitid = unitid;
this.institution = institution;
this.tsStart = timeStart;
}
public finalize(extraction: Order, order: Order) {
public finalize(extraction: Order, order: Order, recs: Recommendation[]) {
// Dont log anything if IELERA didnt work
if (extraction == undefined || order == undefined) return;
// Set metrics
this.metricIE = new LogMetric(extraction, true);
this.metricOrder = new LogMetric(order, false);
this.recommendations = recs.map(r => r.services.map(s => s.code));
// Calculate Levenshtein distance
this.nldAnamnesis = this.calculateLevenshteinDistance(extraction.anamnesis, order.anamnesis);
......@@ -115,7 +119,6 @@ export class LogData {
* @class LogMetric
*/
export class LogMetric {
modality: string;
serviceCount: number;
countAnamnesis: number;
countQuestion: number;
......@@ -127,8 +130,11 @@ export class LogMetric {
riskPacemaker: string;
riskImplants: string;
// Full order
order: OrderExport;
constructor(order: Order, ie: boolean) {
this.modality = order.modality;
this.order = new OrderExport(order);
this.serviceCount = order .services.length;
this.countAnamnesis = order.anamnesis.length;
this.countQuestion = order.question.length;
......
......@@ -95,25 +95,23 @@ export class Order {
* @class OrderExport
*/
export class OrderExport {
modality = '';
anamnesis = '';
question = '';
notice = '';
pregnancy = '';
pregnancy_week = '';
implantate = '';
pacemaker = '';
allergy = '';
allergy_type_iodine = '';
allergy_type_other = '';
preferred_date = '';
anamnesis: string = '';
question: string = '';
notice: string = '';
pregnancy: string = '';
pregnancy_week: string = '';
implantate: string = '';
pacemaker: string = '';
allergy: string = '';
allergy_type_iodine: string = '';
allergy_type_other: string = '';
preferred_date: string = '';
services: ServiceExport[];
//priority: string;
infections: string[] = [];
doctext = '';
constructor(order: Order) {
this.modality = order.modality;
this.anamnesis = order.anamnesis;
this.question = order.question;
this.notice = order.notice;
......@@ -129,16 +127,16 @@ export class OrderExport {
this.allergy_type_other = order.allergy_type_other;
this.services = order.services?.map(service => new ServiceExport(service)) ?? [];
//this.priority = order.priority;
let convertDate = Order.convertDate(order.preferred_date);
if (convertDate[1]) //success
this.preferred_date = order.preferred_date;
//let convertDate = Order.convertDate(order.preferred_date);
/*if (convertDate[1]) //success
this.preferred_date = convertDate[0];
else
this.notice += "\nTerminwunsch: "+convertDate[0];
this.notice += "\nTerminwunsch: "+convertDate[0];*/
this.infections = order.infections;
this.doctext = order.spokenText;
}
}
/**
......
import { ServiceListReaderService } from "../services/service-list-reader.service";
/**
* A service as used in the application.
*
......@@ -106,11 +108,13 @@ export class ServiceExport {
description: string = '';
number: string = '';
localisation: string = '';
modality: string = '';
constructor(service: Service) {
this.code = service.code;
this.description = service.description;
this.number = service.number;
this.localisation = service.localisation;
this.modality = ServiceListReaderService.instance.getModality(service).description;
}
}
\ No newline at end of file
......@@ -70,6 +70,19 @@
</ion-segment>
</ion-item-->
<ion-item
[button]="true"
[detail]="false"
id="select-infections"
lines="none"
>
<ion-label>
Erreger
<b style="color: red" [hidden]="this.orderFilled.infections">*</b>
</ion-label>
<div slot="end" id="selected-infections">
{{ selectedInfectionsText }}
</div>
<ion-item
[button]="true"
[detail]="false"
......@@ -102,6 +115,23 @@
</ng-template>
</ion-modal>
<ion-modal
trigger="select-infections"
#modal
[canDismiss]="canDismissInfectionsModal"
>
<ng-template>
<app-typeahead
class="ion-page"
title="Erreger"
[items]="infectionsItems"
[selectedItems]="selectedInfections"
(selectionChange)="infectionsSelectionChanged($event)"
(selectionCancel)="modal.dismiss()"
></app-typeahead>
</ng-template>
</ion-modal>
<ion-item [hidden]="!showPregnancy" lines="none">
<ion-label >Schwanger <b style="color: red" [hidden]="this.orderFilled.pregnancy">*</b></ion-label>
<ion-segment [(ngModel)]="order.pregnancy" id="pregnant">
......@@ -122,7 +152,7 @@
<br>
<div class="pregWeek">
<p (click)="changePregWeek(-1)">-</p>
<ion-input text-center type="number" inputmode="numeric" max="42" min="1" class="pregField" [(ngModel)]="order.pregnacy_week"></ion-input>
<ion-input text-center type="number" inputmode="numeric" max="42" min="1" class="pregField" id="pregField" [(ngModel)]="order.pregnacy_week"></ion-input>
<p (click)="changePregWeek(1)">+</p>
</div>
......@@ -202,6 +232,42 @@
</ion-segment>
</ion-item>
<details hidden="true">
<summary>
<h5>Debug</h5>
</summary>
<table>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Parameter</td>
<td>{{params}}</td>
</tr>
<tr>
<td>userid</td>
<td>{{userid}}</td>
</tr>
<tr>
<td>unitid</td>
<td>{{logData.unitid}}</td>
</tr>
<tr>
<td>Institution</td>
<td>{{logData.institution}}</td>
</tr>
<tr>
<td>Patient</td>
<td>{{patient.sex}}, {{patient.age}}</td>
</tr>
<tr>
<td>targeturl</td>
<td>{{targeturl}}</td>
</tr>
</table>
</details>
</div>
<div id="NUSAI_Spacer"></div>
......
......@@ -117,4 +117,9 @@ ion-segment-button{
.infectionList {
max-width: 70% !important;
}
table, th, td {
border: 1px solid black;
padding: 1em;
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ import { Patient } from 'src/app/models/Patient';
import { Infection } from 'src/app/models/Infection';
import { timeout } from 'rxjs/operators';
import { Recommendation, SimilarRequest } from 'src/app/models/Recommendation';
import { LogData } from 'src/app/models/Logdata';
import { LogData, LogMetric } from 'src/app/models/Logdata';
import { IonModal } from '@ionic/angular';
import { Item } from 'src/app/components/typeahead/types';
......@@ -159,6 +159,18 @@ export class OrderStructuredPage implements OnInit {
prepareNUSATimer: any;
userid: string;
params: string;
/**
* An instance of this page.
*
* @static
* @type {OrderStructuredPage}
* @memberof OrderStructuredPage
*/
static instance: OrderStructuredPage;
/**
* Creates an instance of OrderStructuredPage.
*
......@@ -203,6 +215,8 @@ export class OrderStructuredPage implements OnInit {
this.order = this.router.getCurrentNavigation().extras.state.order;
this.targeturl = this.router.getCurrentNavigation().extras.state.targeturl;
this.logData = this.router.getCurrentNavigation().extras.state.logData;
this.userid = this.router.getCurrentNavigation().extras.state.userid;
this.params = this.router.getCurrentNavigation().extras.state.params;
this.analyzeSpeech(this.order.spokenText);
}
......@@ -459,7 +473,7 @@ export class OrderStructuredPage implements OnInit {
// Log some things for data analysis
if (this.logData != null) {
this.logData.tsCorrection = new Date().getTime();
this.logData.finalize(this.extraction, this.order);
this.logData.finalize(this.extraction, this.order, this.recommendations);
this.orderSplitterService.log(this.logData).subscribe();
}
......@@ -479,7 +493,7 @@ export class OrderStructuredPage implements OnInit {
// Send the data back to ukw.mobile!
this.orderSplitterService
.sendOrder(this.targeturl, this.order)
.sendOrder(this.targeturl, this.params, this.order)
.subscribe(
() => {
// Back to ukw.mobile!
......@@ -721,4 +735,27 @@ export class OrderStructuredPage implements OnInit {
return `${data.length} ausgewählt`;
}
}
async canDismissInfectionsModal(data?: any, role?: string) {
return role !== 'gesture' && role !== 'backdrop';
}
infectionsSelectionChanged(infections: string[]) {
console.log(infections);
this.selectedInfections = infections;
this.selectedInfectionsText = this.formatData(this.selectedInfections);
this.modal.dismiss();
this.order.infections = infections;
}
private formatData(data: string[]) {
if (!data.length) { return 'Auswählen...'; }
if (data.length === 1) {
const infection = this.infectionsItems.find((f) => f.value === data[0]);
return infection.text;
}
return `${data.length} ausgewählt`;
}
}
\ No newline at end of file
......@@ -66,6 +66,42 @@
</ion-card>
</details>
<details hidden="true">
<summary>
<h5>Debug</h5>
</summary>
<table>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Parameter</td>
<td>{{params}}</td>
</tr>
<tr>
<td>userid</td>
<td>{{userid}}</td>
</tr>
<tr>
<td>unitid</td>
<td>{{logData.unitid}}</td>
</tr>
<tr>
<td>Institution</td>
<td>{{logData.institution}}</td>
</tr>
<tr>
<td>Patient</td>
<td>{{patient.sex}}, {{patient.age}}</td>
</tr>
<tr>
<td>targeturl</td>
<td>{{targeturl}}</td>
</tr>
</table>
</details>
</div>
</div>
......
......@@ -45,4 +45,9 @@
details summary > * {
display: inline;
}
table, th, td {
border: 1px solid black;
padding: 1em;
}
\ No newline at end of file
......@@ -53,6 +53,11 @@ export class OrderZlmPage implements OnInit {
*/
logData: LogData;
/**
* The params string for debug purposes.
*/
params: String;
/**
* The path to the server URLs.
*
......@@ -118,6 +123,7 @@ export class OrderZlmPage implements OnInit {
async getData() {
this.route.queryParams.subscribe(
(data) => {
this.params = window.location.href;
this.patient = new Patient(data.sex, data.age);
this.userid = data.userid;
this.logData = new LogData(data.unitid, data.institution, new Date().getTime());
......@@ -188,6 +194,8 @@ export class OrderZlmPage implements OnInit {
order: this.order,
targeturl: this.targeturl,
logData: this.logData,
userid: this.userid,
params: this.params
}
};
......
import { TestBed } from '@angular/core/testing';
import { ErrorLoggerService } from './error-logger.service';
describe('ErrorLoggerService', () => {
let service: ErrorLoggerService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ErrorLoggerService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import {ErrorHandler, Injectable} from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class ErrorLoggerService extends ErrorHandler {
/**
* The path to the server URLs.
*
* @memberof OrderSplitterService
*/
path = "/assets/data/serverdata.json";
/**
* The URL of the server.
*
* @memberof OrderSplitterService
*/
SERVER_ADDRESS = "";
constructor(private http: HttpClient) {
super();
this.fetchURL();
}
/**
* Fetches the server URLs from the hard drive.
*
* @memberof OrderSplitterService
*/
async fetchURL() {
await fetch(this.path).then(res=>res.json()).then(json=>{
this.SERVER_ADDRESS = json.server;
});
}
handleError(error: any) {
// Log data
const headers = {
'Content-Type': 'application/json; charset=UTF-8'
}
return this.http.post(this.SERVER_ADDRESS+"/logError", JSON.stringify(error), {headers:headers})
}
}
......@@ -71,7 +71,7 @@ export class OrderSplitterService {
* @return {*} {Observable<Response>}
* @memberof OrderSplitterService
*/
sendOrder(targeturl: string, order: Order) {
sendOrder(targeturl: string, params: string, order: Order) {
// Convert order to OrderExport to remove unnecessary data
let orderExport = new OrderExport(order);
......@@ -79,7 +79,7 @@ export class OrderSplitterService {
const headers = {
'Content-Type': 'application/json; charset=UTF-8'
}
return this.http.post(this.SERVER_ADDRESS+"/order-study", {"targeturl": targeturl, "data": JSON.stringify(orderExport)}, {headers:headers})
return this.http.post(this.SERVER_ADDRESS+"/order-study", {"targeturl": targeturl, "params": params, "data": JSON.stringify(orderExport)}, {headers:headers})
}
log(logData: LogData) {
......
......@@ -18,20 +18,7 @@
var url = window.location.href;
setInterval(function() {
if (url != "" && url != window.location.href) {
// Reinit Nuance when we switch to the second page
if(window.location.href.includes("structured") || (window.location.href.includes("zlm") && url.includes("structured"))) {
console.log("URL changed, reinit Nuance")
NUSA_embedSpeechBar(null);
NUSA_reinitializeVuiForm();
NUSA_embedSpeechBar(document.getElementById("speechBarContainer2"));
}
}
url = window.location.href;
}, 1000);
// So that we dont need to use ajax to load the script
function loadScript(url, callback)
......@@ -55,7 +42,7 @@
function NUSA_configure()
{
NUSA_userId = new URLSearchParams(window.location.search).get('userid');
NUSA_applicationName = 'ukw.modile';
NUSA_applicationName = 'ukw.mobile';
NUSA_service = 'https://nuance.ukw.de';
NUSA_language = 'de-DE';
NUSA_topic = window.parent.NUSA_topicGeneralMedicine;
......@@ -63,19 +50,300 @@
document.cookie = 'NUSA_Guids=479a9915-cbde-4093-9031-8c5868bef14c/911ceb62-7ffe-42b7-8a6d-37b24abad447';
NUSA_embedSpeechBar(document.getElementById("speechBarContainer"));
console.log("Configuring Nuance...");
initNUSA();
}
function loadNUSA() {
if (!isIonicDone()) {
console.log("Waiting for Ionic to be ready");
setTimeout(function() {
loadNUSA();
}, 500);
setTimeout(function() {
}else{
loadScript("https://nuance.ukw.de/hosted/scripts/Nuance.SpeechAnywhere.js", function()
{
//NUSA_configure();
console.log("Loading nuance...");
setInterval(function() {
if (url != "" && url != window.location.href && isIonicDone()) {
// Reinit Nuance when we switch to the second page
if(window.location.href.includes("structured") || (window.location.href.includes("zlm") && url.includes("structured"))) {
console.log("URL changed, reinit Nuance")
NUSA_embedSpeechBar(null);
NUSA_embedSpeechBar(document.getElementById("speechBarContainer2"));
NUSA_reinitializeVuiForm();
initNUSA();
NUSA_reinitializeVuiForm();
}
}
url = window.location.href;
}, 1000);
});
}, 300);
}
};
function isStructured() {
return window.location.href.includes("structured");
}
function initNUSA() {
var cmdSetId = NUSA_createCommandSet("Anordnung ZLM AnA", "Verfügbare Sprachkommandos");
// Ja/Nein/Unklar
NUSA_createCommandPlaceholder("yesNoOption", "ja/nein/unklar");
var yesNoValues = new Array();
var yesNoSpokenForms = new Array();
yesNoValues.push("ja");
yesNoSpokenForms.push("ja");
yesNoValues.push("nein");
yesNoSpokenForms.push("nein");
yesNoValues.push("unklar");
yesNoSpokenForms.push("unklar");
yesNoValues.push("ja");
yesNoSpokenForms.push("Ja");
yesNoValues.push("nein");
yesNoSpokenForms.push("Nein");
yesNoValues.push("unklar");
yesNoSpokenForms.push("Unklar");
NUSA_setCommandPlaceholderValues("yesNoOption", yesNoValues, yesNoSpokenForms);
// Datum
NUSA_createCommandPlaceholder("datePhrase", "heute/morgen/übermorgen/in einer Woche/in zwei Wochen");
var phraseValues = new Array();
var phraseSpokenForms = new Array();
phraseValues.push("heute");
phraseSpokenForms.push("heute");
phraseValues.push("morgen");
phraseSpokenForms.push("morgen");
phraseValues.push("übermorgen");
phraseSpokenForms.push("übermorgen");
phraseValues.push("in einer Woche");
phraseSpokenForms.push("in einer Woche");
phraseValues.push("in zwei Wochen");
phraseSpokenForms.push("in zwei Wochen");
phraseValues.push("in drei Wochen");
phraseSpokenForms.push("in drei Wochen");
NUSA_setCommandPlaceholderValues("datePhrase", phraseValues, phraseSpokenForms);
// Schwangerschaftsmonat
NUSA_createCommandPlaceholder("pregnancyMonth", "1-9");
var pregnancyMonthValues = new Array();
var pregnancyMonthSpokenForms = new Array();
pregnancyMonthValues.push(1);
pregnancyMonthSpokenForms.push("ersten");
pregnancyMonthValues.push(2);
pregnancyMonthSpokenForms.push("zweiten");
pregnancyMonthValues.push(3);
pregnancyMonthSpokenForms.push("dritten");
pregnancyMonthValues.push(4);
pregnancyMonthSpokenForms.push("vierten");
pregnancyMonthValues.push(5);
pregnancyMonthSpokenForms.push("fünften");
pregnancyMonthValues.push(6);
pregnancyMonthSpokenForms.push("sechsten");
pregnancyMonthValues.push(7);
pregnancyMonthSpokenForms.push("siebten");
pregnancyMonthValues.push(8);
pregnancyMonthSpokenForms.push("achten");
pregnancyMonthValues.push(9);
pregnancyMonthSpokenForms.push("neunten");
for (let i = 1; i < 10; i++) {
pregnancyMonthValues.push(i);
pregnancyMonthSpokenForms.push(i+".");
}
NUSA_setCommandPlaceholderValues("pregnancyMonth", pregnancyMonthValues, pregnancyMonthSpokenForms);
// Schwangerschaftswoche
NUSA_createCommandPlaceholder("pregnancyWeek", "1-42");
var pregnancyWeekValues = new Array();
var pregnancyWeekSpokenForms = new Array();
pregnancyWeekValues.push(1);
pregnancyWeekSpokenForms.push("erste");
pregnancyWeekValues.push(2);
pregnancyWeekSpokenForms.push("zweite");
for (let i = 1; i < 43; i++) {
pregnancyWeekValues.push(i);
pregnancyWeekSpokenForms.push(i+".");
pregnancyWeekValues.push(i);
pregnancyWeekSpokenForms.push(i+"");
}
NUSA_setCommandPlaceholderValues("pregnancyWeek", pregnancyWeekValues, pregnancyWeekSpokenForms);
// Schwangerschaft
NUSA_createCommand(cmdSetId, "pregnancy", "schwanger <yesNoOption>", "schwanger <yesNoOption>");
if (isStructured()) {
console.log("Creating structured commands");
NUSA_createCommand(cmdSetId, "pregnancyYesWeek", "<pregnancyWeek> Schwangerschaftswoche", "<pregnancyWeek> Schwangerschaftswoche");
NUSA_createCommand(cmdSetId, "pregnancyYesMonth", "im <pregnancyMonth> Monat schwanger", "im <pregnancyMonth> Monat schwanger");
NUSA_createCommand(cmdSetId, "pregnancyYesMonth", "schwanger im <pregnancyMonth Monat", "schwanger im <pregnancyMonth> Monat");
NUSA_createCommand(cmdSetId, "pregnancyYesWeek", "Schwangerschaftswoche <pregnancyWeek>", "Schwangerschaftswoche <pregnancyWeek>");
NUSA_createCommand(cmdSetId, "pregnancyNo", "nicht schwanger", "nicht schwanger");
}
// Allergie
NUSA_createCommand(cmdSetId, "allergie", "Allergie <yesNoOption>", "Allergie <yesNoOption>");
NUSA_createCommand(cmdSetId, "allergie", "Kontrastmittelallergie <yesNoOption>", "Kontrastmittelallergie <yesNoOption>");
if (isStructured()) {
NUSA_createCommand(cmdSetId, "allergieYes", "Allergie vorhanden", "Allergie vorhanden");
NUSA_createCommand(cmdSetId, "allergieYes", "Kontrastmittelallergie vorhanden", "Kontrastmittelallergie vorhanden");
NUSA_createCommand(cmdSetId, "allergieNo", "keine Allergien ", "keine Allergien ");
NUSA_createCommand(cmdSetId, "allergieNo", "keine Kontrastmittelallergie", "keine Kontrastmittelallergie");
}
// Implantate
NUSA_createCommand(cmdSetId, "implants", "Implantate <yesNoOption>", "Implantate <yesNoOption>");
if (isStructured()) {
NUSA_createCommand(cmdSetId, "implantsYes", "Implantate vorhanden", "Implantate vorhanden");
NUSA_createCommand(cmdSetId, "implantsNo", "keine Implantate", "keine Implantate");
NUSA_createCommand(cmdSetId, "implantsNo", "keine Metallimplantate", "keine Metallimplantate");
}
// Schrittmacher
NUSA_createCommand(cmdSetId, "pacemaker", "Schrittmacher <yesNoOption>", "Schrittmacher <yesNoOption>");
if (isStructured()) {
NUSA_createCommand(cmdSetId, "pacemakerNo", "kein Schrittmacher", "kein Schrittmacher");
NUSA_createCommand(cmdSetId, "pacemakerYes", "Schrittmacher vorhanden", "Schrittmacher vorhanden");
}
// Verbesserung schlecht Erkannter Worte
NUSA_createCommand(cmdSetId, "newLine", "9 Zeile", "Neue Zeile");
NUSA_createCommand(cmdSetId, "question", "Frage Zeichen", "Fragezeichen");
// Termin
NUSA_createCommand(cmdSetId, "termin", "Termin und", "Termin und -> Terminwunsch");
NUSA_createCommand(cmdSetId, "termin", "Termin Wunsch", "Termin Wunsch -> Terminwunsch");
NUSA_createCommand(cmdSetId, "terminDate", "Termin und <standard:date>", "Terminwunsch");
NUSA_createCommand(cmdSetId, "terminDate", "Termin Wunsch <standard:date>", "Terminwunsch");
NUSA_createCommand(cmdSetId, "terminDate", "Terminwunsch <standard:date>", "Terminwunsch");
NUSA_createCommand(cmdSetId, "terminPhrase", "Termin und <datePhrase>", "Terminwunsch");
NUSA_createCommand(cmdSetId, "terminPhrase", "Termin Wunsch <datePhrase>", "Terminwunsch");
NUSA_createCommand(cmdSetId, "terminPhrase", "Terminwunsch <datePhrase>", "Terminwunsch");
}
function NUSA_onCommandRecognized(cmdId, spokenText, content, placeholderIds, placeholderValues) {
console.log("Command recognized: "+cmdId+", IDs: "+placeholderIds+", Values: "+placeholderValues);
switch(cmdId) {
case "newLine": document.activeElement.value += "\n"; break;
case "question": document.activeElement.value += "?"; break;
case "termin": document.activeElement.value += "Terminwunsch"; break;
case "terminPhrase":
case "terminDate":
if (!isStructured()) {
document.activeElement.value += "Terminwunsch";
if (placeholderIds[0] == "standard_date" || placeholderIds[0] == "datePhrase") {
document.activeElement.value += " "+placeholderValues[0];
}
}else{
document.getElementById("preferred_date").value = placeholderValues[0];
}
break;
case "pregnancy":
if (!isStructured()) {
document.activeElement.value += "schwanger";
if (placeholderIds[0] == "yesNoOption") {
document.activeElement.value += " "+placeholderValues[0];
}
}else{
if (placeholderIds[0] == "yesNoOption") {
document.getElementById("pregnant").value = placeholderValues[0];
}
}
break;
case "pregnancyNo":
console.log("Value: "+document.getElementById("pregnant").value);
document.getElementById("pregnant").value = "nein";
break;
case "pregnancyYesWeek":
document.getElementById("pregnant").value = "ja";
document.getElementById("pregField").value = placeholderValues[0];
break;
case "pregnancyYesMonth":
document.getElementById("pregnant").value = "ja";
document.getElementById("pregField").value = Math.round(placeholderValues[0]*4.66 - 2.33); // Mitte des Schwangerschaftsmonats
break;
case "allergie":
if (!isStructured()) {
document.activeElement.value += "Kontrastmittelallergie";
if (placeholderIds[0] == "yesNoOption") {
document.activeElement.value += " "+placeholderValues[0];
}
}else{
if (placeholderIds[0] == "yesNoOption") {
document.getElementById("allergy").value = placeholderValues[0];
}
}
break;
case "allergieNo":
document.getElementById("allergy").value = "nein";
break;
case "allergieYes":
document.getElementById("allergy").value = "ja";
break;
case "implants":
if (!isStructured()) {
document.activeElement.value += "Implantate";
if (placeholderIds[0] == "yesNoOption") {
document.activeElement.value += " "+placeholderValues[0];
}
}else{
if (placeholderIds[0] == "yesNoOption") {
document.getElementById("metal").value = placeholderValues[0];
}
}
break;
case "implantsNo":
document.getElementById("metal").value = "nein";
break;
case "implantsYes":
document.getElementById("metal").value = "ja";
break;
case "pacemaker":
if (!isStructured()) {
document.activeElement.value += "Schrittmacher";
if (placeholderIds[0] == "yesNoOption") {
document.activeElement.value += " "+placeholderValues[0];
}
}else{
if (placeholderIds[0] == "yesNoOption") {
document.getElementById("pacemaker").value = placeholderValues[0];
}
}
break;
case "pacemakerNo":
document.getElementById("pacemaker").value = "nein";
break;
case "pacemakerYes":
document.getElementById("pacemaker").value = "ja";
break;
default: break;
}
}
function isIonicDone() {
return document.getElementById("speechBarContainer") != null;
}
navigator.mediaDevices.getUserMedia({ audio: true })
</script>
......
No preview for this file type