Skip to content

Commit

Permalink
Refactor message subfields to remove nesting (#557)
Browse files Browse the repository at this point in the history
* Update .gitignore

* Refactor Vessel message to remove nesting in subfields

* Revert nesting to only include TypeEnum

* De-nest IlluminationType

* De-nest ElectrochemistryType

* De-nest FlowType; rename TubingMaterialType to TubingType

* De-nest StirringMethod

* De-nest PressureControl

* De-nest TemperatureControl

* Set consistent type/details field names

* Re-nest TemperatureControl and PressureControl

* setup

* first pass

* migrate workups

* updates

* fix tests

* updates

* update notebooks

* pytype

* drop empty columns

Co-authored-by: Steven Kearnes <[email protected]>
  • Loading branch information
michaelmaser and skearnes authored Feb 24, 2021
1 parent 94e107f commit babc1b6
Show file tree
Hide file tree
Showing 12 changed files with 3,379 additions and 1,871 deletions.
36 changes: 14 additions & 22 deletions examples/10_Perera_Science_Suzuki/example_Perera.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
"# Reactions performed in 1556 well plate\n",
"reaction.setup.vessel.CopyFrom(\n",
" reaction_pb2.Vessel(\n",
" type=dict(type='TUBE'), \n",
" type='TUBE', \n",
" material=dict(type='CUSTOM', details='Hastelloy'),\n",
" volume=unit_resolver.resolve('710 uL'),\n",
" )\n",
Expand Down Expand Up @@ -380,8 +380,8 @@
"# can define the flow conditions. Note that no reaction inputs have a defined\n",
"# continuous flow rate.\n",
"f_conds = reaction.conditions.flow\n",
"f_conds.flow_type.type = f_conds.flow_type.CUSTOM\n",
"f_conds.flow_type.details = 'Droplet reactor'\n",
"f_conds.type = f_conds.CUSTOM\n",
"f_conds.details = 'Droplet reactor'\n",
"f_conds.pump_type = 'Agilent G1311 quarternary pump'\n",
"f_conds.tubing.CopyFrom(reaction_pb2.FlowConditions.Tubing(\n",
" diameter=unit_resolver.resolve('0.5 millimeter'),\n",
Expand Down Expand Up @@ -751,9 +751,7 @@
"}\n",
"setup {\n",
" vessel {\n",
" type {\n",
" type: TUBE\n",
" }\n",
" type: TUBE\n",
" material {\n",
" type: CUSTOM\n",
" details: \"Hastelloy\"\n",
Expand Down Expand Up @@ -787,10 +785,8 @@
" }\n",
" }\n",
" flow {\n",
" flow_type {\n",
" type: CUSTOM\n",
" details: \"Droplet reactor\"\n",
" }\n",
" type: CUSTOM\n",
" details: \"Droplet reactor\"\n",
" pump_type: \"Agilent G1311 quarternary pump\"\n",
" tubing {\n",
" type: CUSTOM\n",
Expand Down Expand Up @@ -859,7 +855,7 @@
" publication_url: \"https://science.sciencemag.org/content/359/6374/429\"\n",
" record_created {\n",
" time {\n",
" value: \"11/30/2020, 13:46:17\"\n",
" value: \"02/24/2021, 11:28:29\"\n",
" }\n",
" person {\n",
" name: \"Connor W. Coley\"\n",
Expand Down Expand Up @@ -1238,7 +1234,7 @@
"if not os.path.isfile('aap9112_Data_File_S1.xlsx'):\n",
" !wget https://github.com/Open-Reaction-Database/ord-schema/raw/main/examples/10_Perera_Science_Suzuki/aap9112_Data_File_S1.xlsx\n",
"\n",
"data = pd.read_excel('aap9112_Data_File_S1.xlsx')\n",
"data = pd.read_excel('aap9112_Data_File_S1.xlsx', usecols=range(16))\n",
"data"
]
},
Expand All @@ -1259,7 +1255,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"5760it [00:37, 155.27it/s]\n"
"5760it [00:32, 175.14it/s]\n"
]
}
],
Expand Down Expand Up @@ -1680,9 +1676,7 @@
"}\n",
"setup {\n",
" vessel {\n",
" type {\n",
" type: TUBE\n",
" }\n",
" type: TUBE\n",
" material {\n",
" type: CUSTOM\n",
" details: \"Hastelloy\"\n",
Expand Down Expand Up @@ -1716,10 +1710,8 @@
" }\n",
" }\n",
" flow {\n",
" flow_type {\n",
" type: CUSTOM\n",
" details: \"Droplet reactor\"\n",
" }\n",
" type: CUSTOM\n",
" details: \"Droplet reactor\"\n",
" pump_type: \"Agilent G1311 quarternary pump\"\n",
" tubing {\n",
" type: CUSTOM\n",
Expand Down Expand Up @@ -1791,7 +1783,7 @@
" publication_url: \"https://science.sciencemag.org/content/359/6374/429\"\n",
" record_created {\n",
" time {\n",
" value: \"11/30/2020, 13:46:17\"\n",
" value: \"02/24/2021, 11:28:29\"\n",
" }\n",
" person {\n",
" name: \"Connor W. Coley\"\n",
Expand Down Expand Up @@ -1860,7 +1852,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.7.7"
}
},
"nbformat": 4,
Expand Down
3,317 changes: 1,672 additions & 1,645 deletions examples/1_Santanilla_Nanomole_HTE/example_Santanilla.ipynb

Large diffs are not rendered by default.

26 changes: 9 additions & 17 deletions examples/2_Nielsen_Deoxyfluorination_Screen/example_nielsen.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
"# Reactions performed in 1 mL sealed glass vial\n",
"reaction.setup.vessel.CopyFrom(\n",
" reaction_pb2.Vessel(\n",
" type=dict(type='VIAL'), \n",
" type='VIAL', \n",
" material=dict(type='GLASS'),\n",
" volume=unit_resolver.resolve('1 mL')\n",
" )\n",
Expand Down Expand Up @@ -319,7 +319,7 @@
"source": [
"# Vials contained stir bars at 600 rpm\n",
"s_conds = reaction.conditions.stirring\n",
"s_conds.method.type = s_conds.StirringMethod.STIR_BAR\n",
"s_conds.type = s_conds.STIR_BAR\n",
"s_conds.rate.type = s_conds.StirringRate.HIGH # qualitative\n",
"s_conds.rate.rpm = 600"
]
Expand Down Expand Up @@ -582,9 +582,7 @@
"}\n",
"setup {\n",
" vessel {\n",
" type {\n",
" type: VIAL\n",
" }\n",
" type: VIAL\n",
" material {\n",
" type: GLASS\n",
" }\n",
Expand Down Expand Up @@ -613,9 +611,7 @@
" }\n",
" }\n",
" stirring {\n",
" method {\n",
" type: STIR_BAR\n",
" }\n",
" type: STIR_BAR\n",
" rate {\n",
" type: HIGH\n",
" rpm: 600\n",
Expand Down Expand Up @@ -702,7 +698,7 @@
" publication_url: \"https://pubs.acs.org/doi/10.1021/jacs.8b01523\"\n",
" record_created {\n",
" time {\n",
" value: \"11/30/2020, 13:53:11\"\n",
" value: \"02/23/2021, 17:45:01\"\n",
" }\n",
" person {\n",
" name: \"Connor W. Coley\"\n",
Expand Down Expand Up @@ -1087,9 +1083,7 @@
"}\n",
"setup {\n",
" vessel {\n",
" type {\n",
" type: VIAL\n",
" }\n",
" type: VIAL\n",
" material {\n",
" type: GLASS\n",
" }\n",
Expand Down Expand Up @@ -1118,9 +1112,7 @@
" }\n",
" }\n",
" stirring {\n",
" method {\n",
" type: STIR_BAR\n",
" }\n",
" type: STIR_BAR\n",
" rate {\n",
" type: HIGH\n",
" rpm: 600\n",
Expand Down Expand Up @@ -1207,7 +1199,7 @@
" publication_url: \"https://pubs.acs.org/doi/10.1021/jacs.8b01523\"\n",
" record_created {\n",
" time {\n",
" value: \"11/30/2020, 13:53:11\"\n",
" value: \"02/23/2021, 17:45:01\"\n",
" }\n",
" person {\n",
" name: \"Connor W. Coley\"\n",
Expand Down Expand Up @@ -1595,7 +1587,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.7.7"
}
},
"nbformat": 4,
Expand Down
51 changes: 21 additions & 30 deletions examples/3_Liu_Copper_OrgSyn/example_liu.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,8 @@
"}\n",
"setup {\n",
" vessel {\n",
" type {\n",
" type: ROUND_BOTTOM_FLASK\n",
" details: \"single-necked\"\n",
" }\n",
" type: ROUND_BOTTOM_FLASK\n",
" details: \"single-necked\"\n",
" material {\n",
" type: GLASS\n",
" }\n",
Expand Down Expand Up @@ -313,9 +311,7 @@
" }\n",
" }\n",
" stirring {\n",
" method {\n",
" type: STIR_BAR\n",
" }\n",
" type: STIR_BAR\n",
" }\n",
" conditions_are_dynamic: true\n",
" details: \"reaction started in ice bath before addition of\\npivaloyl chloride, then allowed to warm to 23 C, then stirred for \\'\\nan additional 6 hours at RT (23 degC)\"\n",
Expand Down Expand Up @@ -637,7 +633,7 @@
" publication_url: \"http://www.orgsyn.org/demo.aspx?prep=v95p0080\"\n",
" record_created {\n",
" time {\n",
" value: \"12/02/2020, 10:26:46\"\n",
" value: \"02/23/2021, 17:46:53\"\n",
" }\n",
" person {\n",
" name: \"Connor W. Coley\"\n",
Expand All @@ -657,7 +653,8 @@
"# 500-mL single-necked flask\n",
"reaction.setup.vessel.CopyFrom(\n",
" reaction_pb2.Vessel(\n",
" type=dict(type='ROUND_BOTTOM_FLASK', details='single-necked'), \n",
" type='ROUND_BOTTOM_FLASK', \n",
" details='single-necked', \n",
" material=dict(type='GLASS'),\n",
" volume=unit_resolver.resolve('500 mL'),\n",
" )\n",
Expand Down Expand Up @@ -748,7 +745,7 @@
"\n",
"# 4 cm Teflon-coated magnetic stir bar, speed unknown\n",
"s_conds = reaction.conditions.stirring \n",
"s_conds.method.type = s_conds.StirringMethod.STIR_BAR \n",
"s_conds.type = s_conds.STIR_BAR \n",
"\n",
"# Temperature schedule is rather complicated; this assumes that the reaction\n",
"# takes place in the 6 hours at room temperautre after warming up...but we should\n",
Expand Down Expand Up @@ -1154,10 +1151,8 @@
"}\n",
"setup {\n",
" vessel {\n",
" type {\n",
" type: ROUND_BOTTOM_FLASK\n",
" details: \"two-necked\"\n",
" }\n",
" type: ROUND_BOTTOM_FLASK\n",
" details: \"two-necked\"\n",
" material {\n",
" type: GLASS\n",
" }\n",
Expand Down Expand Up @@ -1208,9 +1203,7 @@
" }\n",
" }\n",
" stirring {\n",
" method {\n",
" type: STIR_BAR\n",
" }\n",
" type: STIR_BAR\n",
" }\n",
" conditions_are_dynamic: true\n",
" details: \"After dropwise addition of dimethoxy(methyl)-\\nsilane into reaction mixture in water bath, the vessel was removed and allowed\\nto stir for an additional 12 hours\"\n",
Expand Down Expand Up @@ -1401,7 +1394,7 @@
" publication_url: \"http://www.orgsyn.org/demo.aspx?prep=v95p0080\"\n",
" record_created {\n",
" time {\n",
" value: \"12/02/2020, 10:26:46\"\n",
" value: \"02/23/2021, 17:46:53\"\n",
" }\n",
" person {\n",
" name: \"Connor W. Coley\"\n",
Expand All @@ -1420,7 +1413,8 @@
"\n",
"reaction.setup.vessel.CopyFrom(\n",
" reaction_pb2.Vessel(\n",
" type=dict(type='ROUND_BOTTOM_FLASK', details='two-necked'),\n",
" type='ROUND_BOTTOM_FLASK', \n",
" details='two-necked',\n",
" material=dict(type='GLASS'),\n",
" volume=unit_resolver.resolve('250 mL'),\n",
" )\n",
Expand Down Expand Up @@ -1552,7 +1546,7 @@
"\n",
"# 1 cm Teflon-coated magnetic stir bar, speed unknown\n",
"s_conds = reaction.conditions.stirring \n",
"s_conds.method.type = s_conds.StirringMethod.STIR_BAR \n",
"s_conds.type = s_conds.STIR_BAR \n",
"\n",
"# Temperature is RT the whole time, but uses a water bath for first 10 min\n",
"t_conds = reaction.conditions.temperature\n",
Expand Down Expand Up @@ -1891,10 +1885,8 @@
"}\n",
"setup {\n",
" vessel {\n",
" type {\n",
" type: ROUND_BOTTOM_FLASK\n",
" details: \"two-necked\"\n",
" }\n",
" type: ROUND_BOTTOM_FLASK\n",
" details: \"two-necked\"\n",
" material {\n",
" type: GLASS\n",
" }\n",
Expand Down Expand Up @@ -1944,9 +1936,7 @@
" }\n",
" }\n",
" stirring {\n",
" method {\n",
" type: STIR_BAR\n",
" }\n",
" type: STIR_BAR\n",
" }\n",
" conditions_are_dynamic: true\n",
" details: \"After dropwise addition of dimethoxy(methyl)-\\nsilane into reaction mixture in water bath, the vessel was removed and allowed\\nto stir for an additional 12 hours\"\n",
Expand Down Expand Up @@ -2137,7 +2127,7 @@
" publication_url: \"http://www.orgsyn.org/demo.aspx?prep=v95p0080\"\n",
" record_created {\n",
" time {\n",
" value: \"12/02/2020, 10:26:46\"\n",
" value: \"02/23/2021, 17:46:53\"\n",
" }\n",
" person {\n",
" name: \"Connor W. Coley\"\n",
Expand All @@ -2156,7 +2146,8 @@
"\n",
"reaction.setup.vessel.CopyFrom(\n",
" reaction_pb2.Vessel(\n",
" type=dict(type='ROUND_BOTTOM_FLASK', details='two-necked'),\n",
" type='ROUND_BOTTOM_FLASK', \n",
" details='two-necked',\n",
" material=dict(type='GLASS'),\n",
" volume=unit_resolver.resolve('250 mL'),\n",
" )\n",
Expand Down Expand Up @@ -2288,7 +2279,7 @@
"\n",
"# 1 cm Teflon-coated magnetic stir bar, speed unknown\n",
"s_conds = reaction.conditions.stirring \n",
"s_conds.method.type = s_conds.StirringMethod.STIR_BAR \n",
"s_conds.type = s_conds.STIR_BAR \n",
"\n",
"# Temperature held at 40 C using oil bath\n",
"t_conds = reaction.conditions.temperature\n",
Expand Down
Loading

0 comments on commit babc1b6

Please sign in to comment.