Skip to content
Snippets Groups Projects
Commit f578e283 authored by Toumji Abdallah's avatar Toumji Abdallah
Browse files

Implemented column placement verification for tsv form

parent 789dfe8a
No related branches found
No related tags found
No related merge requests found
......@@ -63,6 +63,16 @@ class Form:
if self.form[1][column]['requirement level'] == 'required':
if column not in self.table.model.df.columns:
self.validation_label.config(image=self.invalid_icon)
mb.showinfo('Missing column',
'The column ' + column + ' is missing.\n'
'Please add it to the table.')
return False
if 'emplacement' in self.form[1][column] and column in self.table.model.df.columns:
if self.table.model.df.columns.get_loc(column) + 1 != self.form[1][column]['emplacement']:
self.validation_label.config(image=self.invalid_icon)
mb.showinfo('Invalid emplacement',
'The column ' + column + ' is not at the right emplacement.\n'
'The column should be at the emplacement ' + str(self.form[1][column]['emplacement']))
return False
if column in self.table.model.df.columns and 'valid condition' in self.form[1][column]:
for i, cell in enumerate(self.table.model.df[column]):
......@@ -83,7 +93,6 @@ class Form:
# Check if all rows where the first cell is not empty have all cells filled.
for i in range(len(self.table.model.df)):
if not is_null_df. iloc[i][0]:
if is_null_df.iloc[i].any():
self.validation_label.config(image=self.invalid_icon)
mb.showinfo('Invalid condition',
......
......@@ -131,7 +131,7 @@
"age" : {
"requirement level": "recommended",
"description": "Age of the participant at time of testing",
"valid condition": "len(str(value)) > 0 ; float(value) > 0 ; float(value) < 120"
"valid condition": "len(str(value)) > 0 ; float(value) > 0 ; float(value) < 120",
},
"handedness" : {
"requirement level": "recommended",
......
......@@ -363,22 +363,26 @@
"name": {
"requirement level": "required",
"description": "Name of the electrode contact point. Values in name MUST be unique. This column must appear first in the file.",
"valid condition": "len(str(value)) > 0"
"valid condition": "len(str(value)) > 0",
"emplacement": 1
},
"x": {
"requirement level": "required",
"description": "Recorded position along the x-axis. This column must appear second in the file.",
"valid condition": "float(value)>=0"
"valid condition": "float(value)>=0",
"emplacement": 2
},
"y": {
"requirement level": "required",
"description": "Recorded position along the y-axis. This column must appear third in the file.",
"valid condition": "float(value)>=0"
"valid condition": "float(value)>=0",
"emplacement": 3
},
"z": {
"requirement level": "required",
"description": "Recorded position along the z-axis. This column must appear fourth in the file.",
"valid condition": "value == 'n/a' or float(value)>=0"
"valid condition": "value == 'n/a' or float(value)>=0",
"emplacement": 4
},
"type": {
"requirement level": "recommended",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment