Parkinsons Disease Research Data

A software that takes data from patients when using the motion capture suit.

During my time in helping Professor Kunal Mankodiya on finding ways to collect data from MOCAP(motion capture suit), we decided to work on Python, whereas the GUI(graphical user interface) will be built and functionalities as well. I began to work alongside graduate students to complete this task. I began my work in researching on how to implement a GUI with clickable buttons that has the function of collecting data, choosing what parts of the MOCAP to be turned on, and save data to an excel file.

Snippet of Python Code


print("=============================")
print("Broadcaster calls")
print("=============================")
device_list = ts_api.getComPorts()

all_list = []
sensor_list = []
chosen_sensor_list = []

l_shoulder = r_shoulder = l_upper_arm = l_lower_arm = l_hand = r_upper_arm = head= False
hips = chest = r_lower_arm = r_hand = l_upper_leg = l_lower_leg = l_foot = True
r_upper_leg = r_lower_leg = r_foot = True

sensorID_string_to_sensorName = {
"'"+str("")+"'": l_shoulder,
"'"+str("")+"'": r_shoulder,
"'"+str("")+"'": l_upper_arm,
"'"+str("")+"'": l_lower_arm,
"'"+str("")+"'": l_hand,
"'"+str("")+"'": r_upper_arm,
"'"+str("")+"'": head,
"'"+str("")+"'": hips,
"'"+str("")+"'": chest,
"'"+str("")+"'": r_lower_arm,
"'"+str("")+"'": r_hand,
"'"+str("")+"'": l_upper_leg,
"'"+str("")+"'": l_lower_leg,
"'"+str("")+"'": l_foot,
"'"+str("")+"'": r_upper_leg,
"'"+str("")+"'": r_lower_leg,
"'"+str("")+"'": r_foot
}
for device_port in device_list:
com_port, friendly_name, device_type = device_port
device = None
if device_type == "USB":
	device = ts_api.TSUSBSensor(com_port=com_port)
elif device_type == "DNG":
	device = ts_api.TSDongle(com_port=com_port)
elif device_type == "WL":
	device = ts_api.TSWLSensor(com_port=com_port)
elif device_type == "EM":
	device = ts_api.TSEMSensor(com_port=com_port)
elif device_type == "DL":
	device = ts_api.TSDLSensor(com_port=com_port)
elif device_type == "BT":
	device = ts_api.TSBTSensor(com_port=com_port)

if device is not None:
	all_list.append(device)
	if device_type != "DNG":
		sensor_list.append(device)
	else:
		for i in range(6): # Only checking the first six logical indexes
			sens = device[i]
			if sens is not None:
				sensor_list.append(sens)
				if sensorID_string_to_sensorName.get("'"+str(sens)+"'") is True:
					chosen_sensor_list.append(sens)

									
							

Also when we enable the registers to collect data from. we then start streaming and record the run process. Below here is the coding process on how the stream was enabled as well as having multiple processes enabled.


ts_api.global_broadcaster.setStreamingTiming(   interval=10000,
						duration=4294967295,
						delay=200000,
						delay_offset=0,
						filter=chosen_sensor_list)
ts_api.global_broadcaster.setStreamingSlots(
						slot0='getSerialNumber',
						slot1='getRawAccelerometerData',
						slot2='getBatteryPercentRemaining',
						filter=chosen_sensor_list)
ts_api.global_broadcaster.startStreaming(filter=chosen_sensor_list)
ts_api.global_broadcaster.startRecordingData(filter=chosen_sensor_list)
##start_time = time.clock()
##while time.clock() - start_time < 5:
##    with open('workfile.txt', 'w+') as f:
##        f.write(str(ts_api.global_broadcaster.writeRead('_getStreamingBatch')))
##    f.close()
time.sleep(10)
ts_api.global_broadcaster.stopRecordingData(filter=sensor_list)
ts_api.global_broadcaster.stopStreaming(filter=sensor_list)
for sensor in sensor_list:
print('Sensor({0}) stream_data len={1}'.format( sensor.serial_number_hex,
									len(sensor.stream_data)))

## Now close the ports.
for device in all_list:
device.close()	
							

Spending a lot of time in making the process smooth as I can, I manage to make the process complete and ready for testing when using the MOCAP device. Throughout multiple tests on running the program, there was data recording but was a little difficult to determine which register of the MOCAP device was activated. But the results were great and managed to save them to a text file and transferred through excel. The results are shown below.

The time spent researching ways to collect data has helped greatly in determining the different values of patients who have been affected by Parkinson's Disease. With this software that has been built, the future of treating patients will become much easier for doctors and seeing how patients are affected by it.