Skip to content

Commit

Permalink
Add provenance and URL
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosfelt committed Jun 12, 2023
1 parent 2e7c3a4 commit 69606a1
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 37 deletions.
Binary file removed data/baumgartner_cn/ord/baumgartner_cn_case_1.pb
Binary file not shown.
Binary file removed data/baumgartner_cn/ord/baumgartner_cn_case_2.pb
Binary file not shown.
Binary file removed data/baumgartner_cn/ord/baumgartner_cn_case_3.pb
Binary file not shown.
Binary file removed data/baumgartner_cn/ord/baumgartner_cn_case_4.pb
Binary file not shown.
Binary file removed data/baumgartner_suzuki/baumgartner_suzuki.pb
Binary file not shown.
41 changes: 17 additions & 24 deletions multitask/etl/etl_baumgartner_cn.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"""

import datetime
from ord_schema.proto.reaction_pb2 import *
from ord_schema.proto.dataset_pb2 import *
from ord_schema import validations
Expand Down Expand Up @@ -126,6 +127,9 @@ def inner_loop(row: pd.Series, stock_df: pd.DataFrame) -> Reaction:
# Specify reaction outcome
specify_outcome(reaction, row)

# Add provenance
add_provenance(reaction)

return reaction


Expand Down Expand Up @@ -604,6 +608,7 @@ def add_standard(measurement: ProductMeasurement, row: pd.Series):
def define_measurement(measurement: ProductMeasurement, row: pd.Series):
measurement.analysis_key = "LCMS"
measurement.type = ProductMeasurement.YIELD
measurement.uses_internal_standard = True
rxn_yield = row["Reaction Yield"]

try:
Expand All @@ -613,27 +618,10 @@ def define_measurement(measurement: ProductMeasurement, row: pd.Series):
rxn_yield = rxn_yield / 100
except:
pass
# try:
# rxn_yield = rxn_yield.replace("≥", "")
# except:
# pass
# try:
# rxn_yield = rxn_yield.replace("%", "")
# except:
# pass
# try:
# rxn_yield = float(rxn_yield)
# except:
# pass

if rxn_yield < 200:
measurement.percentage.value = rxn_yield * 100

# measurement.retention_time.value = row[
# "2-Fluoro-3,3'-bipyridine Retention time in min"
# ]
# measurement.retention_time.units = Time.MINUTE


# nucleophile ID must be given. Since electrophile stays constant, the product
# can be inferred from the nucleophile alone
def specify_outcome_details(nuc_id: str):
Expand Down Expand Up @@ -680,12 +668,17 @@ def add_provenance(reaction: Reaction):
provenance = reaction.provenance
provenance.doi = "10.1021/acs.oprd.9b00236"
provenance.publication_url = "http://doi.org/10.1021/acs.oprd.9b00236"
creator = provenance.record_created.person
creator.username = "dswigh"
creator.name = "Daniel Wigh"
creator.orcid = "0000-0002-0494-643X"
creator.organization = "University of Cambridge"
creator.email = "[email protected]"
event = RecordEvent(
time={"value": str(datetime.datetime.now())},
person={
"username": "dswigh",
"name": "Daniel Wigh",
"orcid": "0000-0002-0494-643X",
"organization": "University of Cambridge",
"email": "[email protected]"
},
)
provenance.record_created.CopyFrom(event)


if __name__ == "__main__":
Expand Down
23 changes: 17 additions & 6 deletions multitask/etl/etl_baumgartner_suzuki.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""

import datetime
from ord_schema.proto.reaction_pb2 import *
from ord_schema.proto.dataset_pb2 import *
from ord_schema.message_helpers import find_submessages
Expand Down Expand Up @@ -81,6 +82,9 @@ def inner_loop(row: pd.Series) -> Reaction:
# Specify reaction outcome
specify_outcome(reaction, row)

# Add provenance
add_provenance(reaction)

return reaction


Expand Down Expand Up @@ -424,6 +428,7 @@ def define_measurement(measurement: ProductMeasurement, row: pd.Series):
"2-Fluoro-3,3'-bipyridine Retention time in min"
]
measurement.retention_time.units = Time.MINUTE
measurement.uses_internal_standard = True


def specify_outcome(reaction: Reaction, row: pd.Series):
Expand Down Expand Up @@ -461,12 +466,18 @@ def add_provenance(reaction: Reaction):
provenance = reaction.provenance
provenance.doi = "10.1039/c8re00032h"
provenance.publication_url = "http://doi.org/10.1039/c8re00032h"
creator = provenance.record_created.person
creator.username = "marcosfelt"
creator.name = "Kobi Felton"
creator.orcid = "0000-0002-3616-4766"
creator.organization = "University of Cambridge"
creator.email = "[email protected]"
event = RecordEvent(
time={"value": str(datetime.datetime.now())},
person={
"username": "marcosfelt",
"name": "Kobi Felton",
"orcid": "0000-0002-3616-4766",
"organization": "University of Cambridge",
"email": "[email protected]"

},
)
provenance.record_created.CopyFrom(event)


if __name__ == "__main__":
Expand Down
25 changes: 18 additions & 7 deletions multitask/etl/etl_reizman_suzuki.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""

import datetime
from multitask.utils import *
from ord_schema.proto.reaction_pb2 import *
from ord_schema.proto.dataset_pb2 import *
Expand Down Expand Up @@ -80,6 +81,9 @@ def inner_loop(row: pd.Series, case) -> Reaction:
# Specify reaction outcome
specify_outcome(case, reaction, row)

# Add provenance
add_provenance(reaction)

return reaction


Expand Down Expand Up @@ -380,6 +384,7 @@ def define_measurement(measurement: ProductMeasurement, row: pd.Series):
measurement.analysis_key = "LCMS"
measurement.type = ProductMeasurement.YIELD
measurement.percentage.value = row["yld"]
measurement.uses_internal_standard = True


products_by_case = {
Expand Down Expand Up @@ -431,14 +436,20 @@ def specify_outcome(case, reaction: Reaction, row: pd.Series):

def add_provenance(reaction: Reaction):
provenance = reaction.provenance
provenance.doi = "110.1039/C6RE00153J"
provenance.doi = "10.1039/C6RE00153J"
provenance.publication_url = "http://doi.org/10.1039/C6RE00153J"
creator = provenance.record_created.person
creator.username = "marcosfelt"
creator.name = "Kobi Felton"
creator.orcid = "0000-0002-3616-4766"
creator.organization = "University of Cambridge"
creator.email = "[email protected]"
event = RecordEvent(
time={"value": str(datetime.datetime.now())},
person={
"username": "marcosfelt",
"name": "Kobi Felton",
"orcid": "0000-0002-3616-4766",
"organization": "University of Cambridge",
"email": "[email protected]"

},
)
provenance.record_created.CopyFrom(event)


if __name__ == "__main__":
Expand Down

0 comments on commit 69606a1

Please sign in to comment.