Skip to content

Commit

Permalink
#335 test: remove mock server events
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolkenfarmer committed Oct 14, 2024
1 parent 3372e1f commit 3df8bec
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 788 deletions.
180 changes: 2 additions & 178 deletions testing/backend-stress/src/sockets/SocketPatient.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {commonMockEvents} from "./commonMockEvents.js"
import { WebSocket } from 'ws'; // Use require for WebSocket


export class SocketPatient {
Expand Down Expand Up @@ -191,180 +191,4 @@ export class SocketPatient {
'messageType': 'action-check-stop',
}));
}
}


const serverMockEvents = [
{
id: 'state',
data: '{"messageType":"state","state":{"phaseNumber":"1","airway":"künstlicher Atemweg",' +
'"breathing":"Atemfreq: 15 /min; SpO2: 99 %; Beatmung; normales AG hörbar",' +
'"circulation":"Herzfreq: 72 /min; peripher tastbar; RR: 120.063",' +
'"consciousness":"narkotisiert","pupils":"mittelweit","psyche":"","skin":"trocken, rosig"}}'
},
{
id: 'available-actions',
data: '{"messageType":"available-actions","availableActions":[' +
'{"actionName":"Blutdruck messen","actionCategory":"TR"},{"actionName":"Blutprobe untersuchen","actionCategory":"LA"},' +
'{"actionName":"Beatmungsmaske anlegen","actionCategory":"TR"},' +
'{"actionName":"Infusion anlegen","actionCategory":"TR"},' +
'{"actionName":"Güdeltubus anlegen","actionCategory":"TR"},' +
'{"actionName":"Blut abnehmen","actionCategory":"TR"},' +
'{"actionName":"Medikament verabreichen","actionCategory":"TR"},' +
'{"actionName":"Ruheposition einnehmen","actionCategory":"TR"},{"actionName":"Röntgen","actionCategory":"LA"},' +
'{"actionName":"Wundversorgung","actionCategory":"TR"},{"actionName":"Stabile Seitenlage","actionCategory":"TR"},' +
'{"actionName":"Schienung anlegen","actionCategory":"TR"},{"actionName":"Vitalwerte messen","actionCategory":"EX"}' +
']}'
},
{id: 'delete', data: '{"messageType":"delete"}'},
{
id: 'action-confirmation',
data: '{"messageType":"action-confirmation","actionName":"Stabile Seitenlage","actionId":"123"}'
},
{
id: 'action-declination',
data: '{"messageType":"action-declination","actionName":"Stabile Seitenlage","actionDeclinationReason":"Es fehlen die nötigen Ressourcen."}'
},
{
id: 'resource-assignments',
data: '{"messageType":"resource-assignments","resourceAssignments":[' +
'{"areaId":1,' +
'"personnel":[' +
'{"personnelId":1,"patientId":"145345"},' +
'{"personnelId":10,"patientId":null}' +
'],' +
'"material":[' +
'{"materialId":1,"patientId":"145345"},' +
'{"materialId":2,"patientId":"256443"}' +
']' +
'},' +
'{"areaId":2,' +
'"personnel":[' +
'{"personnelId":3,"patientId":"123456"},' +
'{"personnelId":8,"patientId":"123456"},' +
'{"personnelId":9,"patientId":null},' +
'{"personnelId":11,"patientId":null},' +
'{"personnelId":2,"patientId":null},' +
'{"personnelId":7,"patientId":null},' +
'{"personnelId":12,"patientId":"105626"},' +
'{"personnelId":13,"patientId":"963733"},' +
'{"personnelId":14,"patientId":"754262"},' +
'{"personnelId":15,"patientId":"754262"}' +
'],' +
'"material":[' +
'{"materialId":3,"patientId":"123456"},' +
'{"materialId":4,"patientId":"123456"},' +
'{"materialId":7,"patientId":null},' +
'{"materialId":8,"patientId":null},' +
'{"materialId":9,"patientId":"126541"},' +
'{"materialId":10,"patientId":null},' +
'{"materialId":11,"patientId":null},' +
'{"materialId":12,"patientId":null},' +
'{"materialId":13,"patientId":null},' +
'{"materialId":14,"patientId":null},' +
'{"materialId":15,"patientId":null},' +
'{"materialId":16,"patientId":null},' +
'{"materialId":17,"patientId":null},' +
'{"materialId":18,"patientId":null},' +
'{"materialId":19,"patientId":null},' +
'{"materialId":20,"patientId":null},' +
'{"materialId":21,"patientId":null},' +
'{"materialId":22,"patientId":null}' +
']' +
'},' +
'{"areaId":3,' +
'"personnel":[' +
'{"personnelId":5,"patientId":"126143"},' +
'{"personnelId":6,"patientId":"462455"}' +
'],' +
'"material":[' +
'{"materialId":5,"patientId":"126143"},' +
'{"materialId":6,"patientId":"462455"},' +
'{"materialId":5,"patientId":null},' +
'{"materialId":6,"patientId":null}' +
']' +
'}]}'
},
{
id: 'action-list',
data: '{"messageType":"action-list","actions":[' +
'{"actionId":1,"orderId":4,"actionName":"Stabile Seitenlage","actionStatus":"FI","timeUntilCompletion":null,"actionResult":null},' +
'{"actionId":2,"orderId":6,"actionName":"Blutdruck messen","actionStatus":"IP","timeUntilCompletion":220,"actionResult":null},' +
'{"actionId":2,"orderId":7,"actionName":"Vollelektrolyt","actionStatus":"IE","timeUntilCompletion":200,"actionResult":null},' +
'{"actionId":2,"orderId":8,"actionName":"IV-Zugang","actionStatus":"EX","timeUntilCompletion":null,"actionResult":null},' +
'{"actionId":4,"orderId":2,"actionName":"Adrenalin","actionStatus":"OH","timeUntilCompletion":40,"actionResult":' +
'null},' +
'{"actionId":3,"orderId":5,"actionName":"Blutprobe untersuchen","actionStatus":"FI","timeUntilCompletion":null,"actionResult":' +
'"Der Patient hat eine Blutgruppe von 0+."},' +
'{"actionId":5,"orderId":3,"actionName":"Infusion anlegen","actionStatus":"PL","timeUntilCompletion":110,"actionResult":null}' +
']}'
},
{
id: 'visible-injuries',
data: '{"messageType":"visible-injuries","injuries":[' +
'{ "injuryId": 1, "injuryType": "fracture", "position": "left collarbone" },' +
'{ "injuryId": 1, "injuryType": "blood", "position": "left collarbone" },' +
'{ "injuryId": 2, "injuryType": "fracture", "position": "left upper arm" },' +
'{ "injuryId": 3, "injuryType": "fracture", "position": "left thorax" },' +
'{ "injuryId": 3, "injuryType": "blood", "position": "left thorax" }' +
']}'
},
{
id: 'action-check',
data: `{
"messageType": "action-check",
"actionCheck": {
"actionName": "Beatmungsmaske anlegen",
"applicationDuration": 40,
"effectDuration": null,
"personnel": [
{
"name": "Ärzte",
"available": 1,
"assigned": 2,
"needed": 2
}
],
"material": [
{
"name": "Beatmungsmaske",
"available": 0,
"assigned": 0,
"needed": 1
}
],
"labDevices": [
{
"name": "EKG",
"available": 4,
"needed": 1
}
],
"requiredActions": {
"singleActions": [
"Stabile Seitenlage"
],
"actionGroups": [
{
"groupName": "Tubus anlegen",
"actions": [
"Güdeltubus anlegen",
"Endotrachealtubus anlegen"
]
},
{
"groupName": "",
"actions": [
"Blutdruck messen",
"Infusion anlegen",
"Zugang legen"
]
}
]
}
}
}`
},
...commonMockEvents
]

}
61 changes: 1 addition & 60 deletions testing/backend-stress/src/sockets/SocketTrainer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { WebSocket } from 'ws'; // Use require for WebSocket
import { commonMockEvents } from './commonMockEvents.js'; // Use require for commonMockEvents

class EventCallbacks {
constructor() {
Expand Down Expand Up @@ -209,62 +208,4 @@ export class SocketTrainer {
'speed': speed
}));
}
}

const serverMockEvents = [
{
id: "available-material",
data: '{"messageType":"available-materials","availableMaterials":[' +
'{"materialName":"Beatmungsgerät","materialType":"DE"},' +
'{"materialName":"Blutdruckmessgerät","materialType":"DE"},' +
'{"materialName":"Defibrillator","materialType":"DE"},' +
'{"materialName":"Endoskop","materialType":"DE"},' +
'{"materialName":"Herz-Lungen-Maschine","materialType":"DE"},' +
'{"materialName":"Blut 0 negativ","materialType":"BL"},' +
'{"materialName":"Blut 0 positiv","materialType":"BL"},' +
'{"materialName":"Blut A negativ","materialType":"BL"},' +
'{"materialName":"Blut A positiv","materialType":"BL"},' +
'{"materialName":"Blut B negativ","materialType":"BL"},' +
'{"materialName":"Blut B positiv","materialType":"BL"},' +
'{"materialName":"Blut AB negativ","materialType":"BL"},' +
'{"materialName":"Blut AB positiv","materialType":"BL"}' +
']}'
},
{
id: 'log-update-1',
data: '{"messageType":"log-update","logEntries":[' +
'{"logId":"0","logMessage":"Patient wurde ins Krankenhaus eingeliefert. ' +
'Der Patient befindet sich in einem kritischen Zustand und benötigt sofortige Aufmerksamkeit.",' +
'"logTime":' + Date.UTC(2024, 2, 20, 14, 32, 20, 0) +
',"areaId":2,"patientId":"123456","personnelIds":[]},' +
'{"logId":"1","logMessage":"Behandlung des Patienten begonnen. ' +
'Dem Patienten werden die notwendigen Medikamente verabreicht und er steht unter ständiger Überwachung.",' +
'"logTime":' + Date.UTC(2024, 2, 20, 14, 31, 46, 0) +
',"areaId":1,"patientId":"123456","personnelIds":[11, 12]},' +
'{"logId":"2","logMessage":"Patient nach der Erstbehandlung stabilisiert. ' +
'Der Patient reagiert nun gut auf die Behandlung und wird beobachtet.",' +
'"logTime":' + Date.UTC(2024, 2, 20, 14, 33, 8, 0) +
',"areaId":2,"patientId":"754262","personnelIds":[13]}]}'
},
{
id: 'log-update-2',
data: '{"messageType":"log-update","logEntries":[' +
'{"logId":"4","logMessage":"Patient zur Zentralen Notaufnahme transportiert. ' +
'Der Patient wird für weitere Tests und Behandlungen verlegt.",' +
'"logTime":' + Date.UTC(2024, 2, 20, 14, 31, 10, 0) +
',"areaId":1,"patientId":"623422","personnelIds":[14]},' +
'{"logId":"5","logMessage":"Behandlung aufgrund unvorhergesehener Komplikationen abgebrochen. ' +
'Der Patient wird auf einen alternativen Behandlungsplan vorbereitet.",' +
'"logTime":' + Date.UTC(2024, 2, 20, 14, 33, 8, 0) +
',"areaId":2,"patientId":"123456","personnelIds":[]},' +
'{"logId":"6","logMessage":"Blut für den Patienten angefordert. ' +
'Der Patient benötigt eine Bluttransfusion, um seinen Zustand zu stabilisieren.",' +
'"logTime":' + Date.UTC(2024, 2, 20, 14, 32, 8, 0) +
',"areaId":1,"patientId":"623422","personnelIds":[15, 11]}]}'
},
{
id: 'set-speed',
data: '{"messageType":"set-speed","speed":2.5}'
},
...commonMockEvents
];
}
Loading

0 comments on commit 3df8bec

Please sign in to comment.