Reaction

class chemotion_api.elements.reaction.Reaction(*args, **kwargs)

A chemotion Reaction object. It extends the chemotion_api.elements.abstract_element.AbstractElement

Usage:

>>> from chemotion_api import Instance
>>> from chemotion_api.collection import Collection
>>> import logging
>>> try:
>>>     instance = Instance('http(d)://xxx.xxx.xxx').test_connection().login('<USER>', "<PASSWORD>")
>>> except ConnectionError as e:
>>>     logging.error(f"A connection to Chemotion ({instance.host_url}) cannot be established")
>>> # Get the reaction with ID 1
>>> rea = instance.get_reaction(1)
>>> # Set the real amount to 3.7 g
>>> col_solv: Collection = instance.get_root_collection().get_or_create_collection('Solv')
>>> # Create a new solvent CDCl3
>>> solv = col_solv.new_solvent('CDCl3')
>>> # Add CDCl3 as solvent to the reaction
>>> rea.properties['solvents'].append_no_split(solv)
>>> # Add a split of sample with ID 1 as starting material
>>> rea.properties['starting_materials'].append(instance.get_sample(1))
>>> # Add a new time/temperature step to the temperature timeline
>>> rea.properties['temperature'].add_time_point(2,3,0,100)
>>> rea.save()
load_image() Response

Loads the reaction structure as svg image

Returns:

Response with the svg as content

property properties: dict

The properties property contains all data which can be altered through the chemotion api from the main tab of the reaction.

Key starting_materials:

{chemotion_api.elements.reaction.MaterialList}

Key reactants:

{chemotion_api.elements.reaction.MaterialList}

Key products:

{chemotion_api.elements.reaction.MaterialList}

Key solvents:

{chemotion_api.elements.reaction.MaterialList}

Key purification_solvents:

{chemotion_api.elements.reaction.MaterialList}

Key temperature:

{chemotion_api.elements.reaction.Temperature}

Key timestamp_start:

{datetime.datetime}

Key timestamp_stop:

{datetime.datetime}

Key name:

{str}

Key description:

{str|dict} A Guill.js text (https://quilljs.com/docs/delta)

Key observation:

{str|dict} A Guill.js text (https://quilljs.com/docs/delta)

Key purification:

{list[str]} values must be in [‘Flash-Chromatography’, ‘TLC’, ‘HPLC’, ‘Extraction’, ‘Distillation’, ‘Dialysis’, ‘Filtration’, ‘Sublimation’, ‘Crystallisation’, ‘Recrystallisation’, ‘Precipitation’]

Key status:

{str} value must be in [‘’, ‘Planned’, ‘Running’, ‘Done’, ‘Analyses Pending’, ‘Successful’, ‘Not Successful’]

Key vessel_size:

{dict} has a unit {str} (‘l’ or ‘ml’) and an amount {float}

Readonly properties:

Key short_label:

{str, readonly}

Key tlc_solvents:

{str, readonly}

Key tlc_description:

{str, readonly}

Key reaction_svg_file:

{str, readonly}

Key role:

{str, readonly}

Key rf_value:

{str, readonly}

Key rxno:

{str, readonly}

Key literatures:

{str, readonly}

Key variations:

{str, readonly} Can be used with the reaction class property variations

Returns:

Element properties

properties_schema() dict

Returns the JSON.org schema of the cleaned properties.

Returns:

JSON.org schema

class chemotion_api.elements.reaction.MaterialList(*args)

A list which accepts only chemotion_api.elements.sample.Sample’s. If you add a sample using th standard list-methods a splited sample will be created. Then the created sample will be added to the list. If the element has no ID, it will be saved.

In order to avoid the splitting and the pre saving use the ‘append_no_split’ methode.

append_no_split(element: Sample)

Add a Sample without splitting it :param element: Sample to be added

class chemotion_api.elements.reaction.Temperature(**kwargs)

This object contains the temperature-time profile, the temperature unit and a user text. Each entry contains a time as ‘hh:mm:ss’ and a temperature as integer.

Key data:

{list} the temperature-time profile

Key userText:

{str}

Key valueUnit:

{str}

add_time_point(hour: int, minute: int, second: int, temperature: float)

Adds an entry to the Temperature timeline

Parameters:
  • hour – since the reaction has started

  • minute – since the reaction has started

  • second – since the reaction has started

  • temperature – degrees