resolved conflicts

This commit is contained in:
2025-03-31 03:46:05 +03:00
6454 changed files with 1520539 additions and 9 deletions
@@ -0,0 +1,50 @@
import socket
import hl7
import requests
import json
from datetime import datetime
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect the socket to the port where the server is listening
server_address = ('192.168.192.245', 5100)
sock.connect(server_address)
bytes_to_decode = b''
while True:
data = sock.recv(1024)
if data and data != b'\x02':
bytes_to_decode += data
if data.decode('utf-8')[-2] == '\x1c':
# this is the end of the line hence we can begin decoding
try:
hl7_data = hl7.parse(bytes_to_decode.decode().strip())
results_parameter_list = []
for row in hl7_data[10:56]:
test_code = row[3][0][1][0]
test_result = row[5][0]
if type(row[8][0]) == hl7.containers.Repetition:
test_flag = row[8][0][0]
else:
test_flag = row[8][0]
results_parameter_list.append([test_code, test_result, test_flag])
return_str = "\x0bMSH|^~\\&|||||" + hl7_data[0][7][0] + "||ACK^R01|" + hl7_data[0][10][0]
return_str += "|P|2.3.1||||||UNICODE\rMSA|AA|" + hl7_data[0][10][0] + "|okay|||0|\r\x1c\r"
sock.sendall(bytes(return_str, 'utf-8'))
requests.post('http://192.168.192.105/lab_machines/receive_results_mindray', data={
'test_id': hl7_data[3][3][0],
'parameters': json.dumps(results_parameter_list),
'time': hl7_data[0][7][0]
})
except Exception as e:
pass
bytes_to_decode = b''
@@ -0,0 +1,25 @@
from subprocess import check_output, Popen, PIPE, STDOUT
import os
file_path = "/var/www/streamline/public/uploads/lab_machine_scripts/divine_mercy/main.py"
try:
# get the pid of the last process running with python3
pid_list = check_output(["pidof", "python3"]).split()
# iterate over the list of related pids
for pid in pid_list:
decoded_pid = pid.decode("utf-8")
file_path_from_pid = check_output(["ps", "-o", "cmd", decoded_pid]).split()[2].decode("utf-8")
if file_path_from_pid == file_path:
# kill the process with this path
delete_pid = check_output(["kill", "-9", decoded_pid])
break
# start a new process
os.system("nohup python3 " + file_path + " >/dev/null 2>&1 & ")
print(1)
except Exception as e:
print(e)
@@ -0,0 +1,49 @@
import socket
import hl7
import requests
import json
from datetime import datetime
# get the hostname
host = "10.23.14.97"
port = 5050
server_socket = socket.socket() # get instance
server_socket.bind((host, port)) # bind host address and port together
# configure how many client the server can listen simultaneously
server_socket.listen(2)
conn, address = server_socket.accept() # accept new connection
bytes_to_decode = b''
with conn:
while True:
data = conn.recv(1024)
if data and data != b'\x02':
bytes_to_decode += data
if data.decode('utf-8')[-2] == '\x1c':
# this is the end of the line hence we can begin decoding
try:
results_parameter_list = []
hl7_data = hl7.parse(bytes_to_decode.decode().strip())
sample_id = hl7_data[3][3]
for row in hl7_data[10:38]:
test_code = row[3][0][1][0]
test_result = row[5][0]
test_flag = row[8][0][0]
results_parameter_list.append([test_code, test_result, test_flag])
requests.post('http://127.0.0.1:8000/lab_machines/receive_results_mindray', {
'test_id': hl7_data[1][5][0],
'parameters': json.dumps(results_parameter_list),
'time': hl7_data[0][6][0]
})
except Exception as e:
print(e)
bytes_to_decode = b''
@@ -0,0 +1,25 @@
from subprocess import check_output, Popen, PIPE, STDOUT
import os
file_path = "/var/www/streamline/public/uploads/lab_machine_scripts/kisiizi/dymind/main.py"
try:
# get the pid of the last process running with python3
pid_list = check_output(["pidof", "python3"]).split()
# iterate over the list of related pids
for pid in pid_list:
decoded_pid = pid.decode("utf-8")
file_path_from_pid = check_output(["ps", "-o", "cmd", decoded_pid]).split()[2].decode("utf-8")
if file_path_from_pid == file_path:
# kill the process with this path
delete_pid = check_output(["kill", "-9", decoded_pid])
break
# start a new process
os.system("nohup python3 " + file_path + " >/dev/null 2>&1 & ")
print(1)
except Exception as e:
print(e)
@@ -0,0 +1,52 @@
import socket
import hl7
import requests
import json
from datetime import datetime
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect the socket to the port where the server is listening
server_address = ('192.168.0.91', 5100)
print('connecting to %s port %s' % server_address)
sock.connect(server_address)
bytes_to_decode = b''
while True:
data = sock.recv(1024)
if data and data != b'\x02':
bytes_to_decode += data
if data.decode('utf-8')[-2] == '\x1c':
# this is the end of the line hence we can begin decoding
try:
hl7_data = hl7.parse(bytes_to_decode.decode("utf-8"))
results_parameter_list = []
for row in hl7_data[9:32]:
test_code = row[3][0][1][0]
test_result = row[5][0]
if type(row[8][0]) == hl7.containers.Repetition:
test_flag = row[8][0][0]
else:
test_flag = row[8][0]
results_parameter_list.append([test_code, test_result, test_flag])
return_str = "\x0bMSH|^~\\&|||||" + hl7_data[0][7][0] + "||ACK^R01|" + hl7_data[0][10][0]
return_str += "|P|2.3.1||||||UNICODE\rMSA|AA|" + hl7_data[0][10][0] + "|okay|||0|\r\x1c\r"
sock.sendall(bytes(return_str, 'utf-8'))
requests.post('http://192.168.0.55/lab_machines/receive_results_mindray', data={
'test_id': hl7_data[3][3][0],
'parameters': json.dumps(results_parameter_list),
'time': hl7_data[0][7][0]
})
except Exception as e:
pass
bytes_to_decode = b''
@@ -0,0 +1,25 @@
from subprocess import check_output, Popen, PIPE, STDOUT
import os
file_path = "/var/www/streamline/public/uploads/lab_machine_scripts/sebbi/bc_5000/main.py"
try:
# get the pid of the last process running with python3
pid_list = check_output(["pidof", "python3"]).split()
# iterate over the list of related pids
for pid in pid_list:
decoded_pid = pid.decode("utf-8")
file_path_from_pid = check_output(["ps", "-o", "cmd", decoded_pid]).split()[2].decode("utf-8")
if file_path_from_pid == file_path:
# kill the process with this path
delete_pid = check_output(["kill", "-9", decoded_pid])
break
# start a new process
os.system("nohup python3 " + file_path + " > terminal_output 2>&1 </dev/null & ")
print(1)
except Exception as e:
print(e)
@@ -0,0 +1,61 @@
import socket
import hl7
import requests
import json
from datetime import datetime
# get the hostname
host = "192.168.0.55"
port = 5342
server_socket = socket.socket() # get instance
server_socket.bind((host, port)) # bind host address and port together
# configure how many client the server can listen simultaneously
server_socket.listen(2)
conn, address = server_socket.accept() # accept new connection
bytes_to_decode = b''
with conn:
while True:
data = conn.recv(1024)
if data and data != b'\x02':
bytes_to_decode += data
if data.decode('utf-8')[-2] == '\x1c':
# this is the end of the line hence we can begin decoding
try:
hl7_data = hl7.parse(bytes_to_decode.decode().strip())
results_parameter_list = []
test_mode = str(hl7_data[6][5])
if test_mode == 'CBC+DIFF':
last_index = 40
elif test_mode == 'CBC+DIFF+CRP':
last_index = 41
else:
bytes_to_decode = b''
continue
for row in hl7_data[9:last_index]:
test_code = row[3][0][1][0]
test_result = row[5][0]
if type(row[8][0]) == hl7.containers.Repetition:
test_flag = row[8][0][0]
else:
test_flag = row[8][0]
results_parameter_list.append([test_code, test_result, test_flag])
requests.post('http://192.168.0.55/lab_machines/receive_results_mindray', {
'test_id': hl7_data[3][3][0],
'parameters': json.dumps(results_parameter_list),
'time': hl7_data[0][7][0]
})
except Exception as e:
pass
bytes_to_decode = b''
@@ -0,0 +1,25 @@
from subprocess import check_output, Popen, PIPE, STDOUT
import os
file_path = "/var/www/streamline/public/uploads/lab_machine_scripts/sebbi/bc_5390/main.py"
try:
# get the pid of the last process running with python3
pid_list = check_output(["pidof", "python3"]).split()
# iterate over the list of related pids
for pid in pid_list:
decoded_pid = pid.decode("utf-8")
file_path_from_pid = check_output(["ps", "-o", "cmd", decoded_pid]).split()[2].decode("utf-8")
if file_path_from_pid == file_path:
# kill the process with this path
delete_pid = check_output(["kill", "-9", decoded_pid])
break
# start a new process
os.system("nohup python3 " + file_path + " > terminal_output 2>&1 </dev/null & ")
print(1)
except Exception as e:
print(e)
@@ -0,0 +1,50 @@
import socket
import hl7
import requests
import json
from datetime import datetime
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect the socket to the port where the server is listening
server_address = ('192.168.0.78', 5100)
sock.connect(server_address)
bytes_to_decode = b''
while True:
data = sock.recv(1024)
if data and data != b'\x02':
bytes_to_decode += data
if data.decode('utf-8')[-2] == '\x1c':
# this is the end of the line hence we can begin decoding
try:
hl7_data = hl7.parse(bytes_to_decode.decode().strip())
results_parameter_list = []
for row in hl7_data[8:32]:
test_code = row[3][0][1][0]
test_result = row[5][0]
if type(row[8][0]) == hl7.containers.Repetition:
test_flag = row[8][0][0]
else:
test_flag = row[8][0]
results_parameter_list.append([test_code, test_result, test_flag])
return_str = "\x0bMSH|^~\\&|||||" + hl7_data[0][7][0] + "||ACK^R01|" + hl7_data[0][10][0]
return_str += "|P|2.3.1||||||UNICODE\rMSA|AA|" + hl7_data[0][10][0] + "|okay|||0|\r\x1c\r"
sock.sendall(bytes(return_str, 'utf-8'))
requests.post('http://192.168.0.250/lab_machines/receive_results_mindray', data={
'test_id': hl7_data[3][3][0],
'parameters': json.dumps(results_parameter_list),
'time': hl7_data[0][7][0]
})
except Exception as e:
pass
bytes_to_decode = b''
@@ -0,0 +1,25 @@
from subprocess import check_output, Popen, PIPE, STDOUT
import os
file_path = "/var/www/html/streamline/public/uploads/lab_machine_scripts/soft_power/main.py"
try:
# get the pid of the last process running with python3
pid_list = check_output(["pidof", "python3"]).split()
# iterate over the list of related pids
for pid in pid_list:
decoded_pid = pid.decode("utf-8")
file_path_from_pid = check_output(["ps", "-o", "cmd", decoded_pid]).split()[2].decode("utf-8")
if file_path_from_pid == file_path:
# kill the process with this path
delete_pid = check_output(["kill", "-9", decoded_pid])
break
# start a new process
os.system("nohup python3 " + file_path + " >/dev/null 2>&1 & ")
print(1)
except Exception as e:
print(e)
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB