Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (abr-testing): Lengthen ABR Protocols, Add Protocol Versioning, Add Liquid Waste Probing and Recording #17137

Merged
merged 28 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b0ad059
Added parameter to deactivate modules at the end of protocols
AnthonyNASC20 Dec 10, 2024
a6c2191
helpers functions added: clean up plates, comment liquid waste height…
rclarke0 Dec 11, 2024
b243767
update to reading instrument commands, recording of liquid heights
rclarke0 Dec 11, 2024
e211e7c
changes to record liquid waste height
rclarke0 Dec 11, 2024
6dedefe
DVT1AB3 PROTOCOL
rclarke0 Dec 12, 2024
4e01627
Merge branch 'module_deactivate' into abr-lengthen-protocols
AnthonyNASC20 Dec 12, 2024
6111620
DVT1ABR1 PROTOCOL
rclarke0 Dec 12, 2024
fbb46ce
DVT1ABR2 PROTOCOL
rclarke0 Dec 12, 2024
b281e7b
DVT1ABR3 LIQUID SET UP
rclarke0 Dec 12, 2024
2e1895b
DVT1ABR4 PROTOCOL
rclarke0 Dec 12, 2024
684eb1f
abr7 and abr11 lengthened protocols and setups
AnthonyNASC20 Dec 12, 2024
d7102bf
DVT2ABR5 PROTOCOL
rclarke0 Dec 12, 2024
99f220f
PVT1ABR8 PROTOCOL
rclarke0 Dec 12, 2024
690645c
PVT1ABR9 PROTOCOL
rclarke0 Dec 12, 2024
1e4f2aa
Merge branch 'abr-lengthen-protocols' of https://github.com/Opentrons…
rclarke0 Dec 12, 2024
f175fba
deactivate modules in PVT1ABR7 & PVT1ABR11 protocols
rclarke0 Dec 12, 2024
eef6d63
PVT1ABR10 PROTOCOL
rclarke0 Dec 12, 2024
75f1903
protocol syntax fixes
rclarke0 Dec 12, 2024
60f668b
add protocol version number
rclarke0 Dec 13, 2024
5f7934d
fix to commandtype
rclarke0 Dec 16, 2024
10e8971
abr1 liquid set up fix
rclarke0 Dec 17, 2024
5422265
deck riser test script:
rclarke0 Dec 17, 2024
d014070
abr-6 finalized protocol
AnthonyNASC20 Dec 17, 2024
577946e
Merge branch 'abr-lengthen-protocols' of https://github.com/Opentrons…
rclarke0 Dec 18, 2024
896abce
ABR10/ABR6 fixes
rclarke0 Dec 18, 2024
8d12f20
Reduced batch delete request to 1500 at a time, and added additonal e…
AnthonyNASC20 Dec 18, 2024
fbbba2f
Reduced batch delete request to 1500 at a time, and added additonal e…
AnthonyNASC20 Dec 18, 2024
3880825
Reduced batch delete request to 1500 at a time, and added additonal e…
AnthonyNASC20 Dec 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 8 additions & 23 deletions abr-testing/abr_testing/data_collection/abr_google_drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,13 @@ def create_data_dictionary(
runs_to_save: Union[Set[str], str],
storage_directory: str,
issue_url: str,
plate: str,
accuracy: Any,
hellma_plate_standards: List[Dict[str, Any]],
) -> Tuple[List[List[Any]], List[str], List[List[Any]], List[str], List[List[Any]]]:
) -> Tuple[List[List[Any]], List[str], List[List[Any]], List[str]]:
"""Pull data from run files and format into a dictionary."""
runs_and_robots: List[Any] = []
runs_and_lpc: List[Dict[str, Any]] = []
headers: List[str] = []
headers_lpc: List[str] = []
list_of_heights: List[List[Any]] = [[], [], [], [], [], [], [], []]
hellma_plate_orientation = False # default hellma plate is not rotated.
for filename in os.listdir(storage_directory):
file_path = os.path.join(storage_directory, filename)
Expand Down Expand Up @@ -103,12 +100,15 @@ def create_data_dictionary(
run_time_min = run_time.total_seconds() / 60
except ValueError:
pass # Handle datetime parsing errors if necessary
# Get protocol version #
version_number = read_robot_logs.get_protocol_version_number(file_results)

if run_time_min > 0:
run_row = {
"Robot": robot,
"Run_ID": run_id,
"Protocol_Name": protocol_name,
"Protocol Version": version_number,
"Software Version": software_version,
"Date": start_date,
"Start_Time": start_time_str,
Expand All @@ -130,13 +130,10 @@ def create_data_dictionary(
plate_reader_dict = read_robot_logs.plate_reader_commands(
file_results, hellma_plate_standards, hellma_plate_orientation
)
list_of_heights = read_robot_logs.liquid_height_commands(
file_results, list_of_heights
)
notes = {"Note1": "", "Jira Link": issue_url}
liquid_height = read_robot_logs.get_liquid_waste_height(file_results)
plate_measure = {
"Plate Measured": plate,
"End Volume Accuracy (%)": accuracy,
"Liquid Waste Height (mm)": liquid_height,
"Average Temp (oC)": "",
"Average RH(%)": "",
}
Expand Down Expand Up @@ -173,7 +170,6 @@ def create_data_dictionary(
headers,
transposed_runs_and_lpc,
headers_lpc,
list_of_heights,
)


Expand Down Expand Up @@ -211,26 +207,15 @@ def run(
headers,
transposed_runs_and_lpc,
headers_lpc,
list_of_heights,
) = create_data_dictionary(
missing_runs_from_gs,
storage_directory,
"",
"",
"",
hellma_plate_standards=file_values,
file_values,
)
start_row = google_sheet.get_index_row() + 1
google_sheet.batch_update_cells(transposed_runs_and_robots, "A", start_row, "0")
# Record Liquid Heights Found
google_sheet_ldf = google_sheets_tool.google_sheet(
credentials_path, google_sheet_name, 2
)
google_sheet_ldf.get_row(1)
start_row_lhd = google_sheet_ldf.get_index_row() + 1
google_sheet_ldf.batch_update_cells(
list_of_heights, "A", start_row_lhd, "2075262446"
)

# Add LPC to google sheet
google_sheet_lpc = google_sheets_tool.google_sheet(credentials_path, "ABR-LPC", 0)
start_row_lpc = google_sheet_lpc.get_index_row() + 1
Expand Down
14 changes: 1 addition & 13 deletions abr-testing/abr_testing/data_collection/abr_robot_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,28 +614,16 @@ def get_run_error_info_from_robot(
headers,
runs_and_lpc,
headers_lpc,
list_of_heights,
) = abr_google_drive.create_data_dictionary(
run_id,
error_folder_path,
issue_url,
"",
"",
hellma_plate_standards=file_values,
file_values,
)

start_row = google_sheet.get_index_row() + 1
google_sheet.batch_update_cells(runs_and_robots, "A", start_row, "0")
print("Wrote run to ABR-run-data")
# Record Liquid Heights Found
google_sheet_ldf = google_sheets_tool.google_sheet(
credentials_path, google_sheet_name, 4
)
start_row_lhd = google_sheet_ldf.get_index_row() + 1
google_sheet_ldf.batch_update_cells(
list_of_heights, "A", start_row_lhd, "1795535088"
)
print("wrote liquid heights found.")
# Add LPC to google sheet
google_sheet_lpc = google_sheets_tool.google_sheet(
credentials_path, "ABR-LPC", 0
Expand Down
70 changes: 57 additions & 13 deletions abr-testing/abr_testing/data_collection/read_robot_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def match_pipette_to_action(
left_pipette_add = 0
for command in commandTypes:
command_type = command_dict["commandType"]
command_pipette = command_dict.get("pipetteId", "")
command_params = command_dict.get("params", "")
command_pipette = command_params.get("pipetteId", "")
if command_type == command and command_pipette == right_pipette:
right_pipette_add = 1
elif command_type == command and command_pipette == left_pipette:
Expand Down Expand Up @@ -213,13 +214,45 @@ def instrument_commands(
return pipette_dict


def get_comment_result_by_string(file_results: Dict[str, Any], key_phrase: str) -> str:
"""Get comment string based off ky phrase."""
AnthonyNASC20 marked this conversation as resolved.
Show resolved Hide resolved
commandData = file_results.get("commands", "")
result_str = command_str = ""
for command in commandData:
commandType = command["commandType"]
if commandType == "comment":
command_str = command["params"].get("message", "")
try:
result_str = command_str.split(key_phrase)[1]
except IndexError:
continue
return result_str


def get_protocol_version_number(file_results: Dict[str, Any]) -> str:
"""Get protocol version number."""
return get_comment_result_by_string(file_results, "Protocol Version: ")


def get_liquid_waste_height(file_results: Dict[str, Any]) -> float:
"""Find liquid waste height."""
result_str = get_comment_result_by_string(
file_results, "Liquid Waste Total Height: "
)
height = float(result_str)
return height


def liquid_height_commands(
file_results: Dict[str, Any], all_heights_list: List[List[Any]]
) -> List[List[Any]]:
"""Record found liquid heights during a protocol."""
commandData = file_results.get("commands", "")
robot = file_results.get("robot_name", "")
run_id = file_results.get("run_id", "")
list_of_heights = []
print(robot)
liquid_waste_height = 0.0
for command in commandData:
commandType = command["commandType"]
if commandType == "comment":
Expand All @@ -236,16 +269,24 @@ def liquid_height_commands(
well_location = str(entry.split(", ")[1].split(" ")[0])
slot_location = str(entry.split("slot ")[1].split(")")[0])
labware_name = str(entry.split("of ")[1].split(" on")[0])
all_heights_list[0].append(robot)
all_heights_list[1].append(run_id)
all_heights_list[2].append(comment_time)
all_heights_list[3].append(labware_type)
all_heights_list[4].append(labware_name)
all_heights_list[5].append(slot_location)
all_heights_list[6].append(well_location)
all_heights_list[7].append(height)
if labware_name == "Liquid Waste":
liquid_waste_height += height
one_entry = {
"Timestamp": comment_time,
"Labware Name": labware_name,
"Labware Type": labware_type,
"Slot Location": slot_location,
"Well Location": well_location,
"All Heights (mm)": height,
}
list_of_heights.append(one_entry)
except (IndexError, ValueError):
continue
if len(list_of_heights) > 0:
all_heights_list[0].append(robot)
all_heights_list[1].append(run_id)
all_heights_list[2].append(list_of_heights)
all_heights_list[3].append(liquid_waste_height)
return all_heights_list


Expand Down Expand Up @@ -281,10 +322,13 @@ def plate_reader_commands(
read = "yes"
elif read == "yes" and commandType == "comment":
result = command["params"].get("message", "")
if "result:" in result:
plate_name = result.split("result:")[0]
formatted_result = result.split("result: ")[1]
print(formatted_result)
if "result:" in result or "Result:" in result:
try:
plate_name = result.split("result:")[0]
formatted_result = result.split("result: ")[1]
except IndexError:
plate_name = result.split("Result:")[0]
formatted_result = result.split("Result: ")[1]
result_dict = eval(formatted_result)
result_dict_keys = list(result_dict.keys())
if len(result_dict_keys) > 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,11 @@
header,
runs_and_lpc,
lpc_headers,
list_of_heights,
) = abr_google_drive.create_data_dictionary(
run_ids_in_storage,
run_log_file_path,
"",
"",
"",
hellma_plate_standards=file_values,
file_values,
)
print("list_of_heights not recorded.")
transposed_list = list(zip(*runs_and_robots))
Expand Down
Loading