From ec6567e40d7a9aa12c0dd5c4e55a2840e649abed Mon Sep 17 00:00:00 2001 From: sdRDM Bot Date: Mon, 18 Sep 2023 17:30:14 +0000 Subject: [PATCH] API update --- datamodel_b07_tc/__init__.py | 2 +- datamodel_b07_tc/core/author.py | 2 +- datamodel_b07_tc/core/calibration.py | 2 +- datamodel_b07_tc/core/chemical.py | 4 +- datamodel_b07_tc/core/data.py | 4 +- datamodel_b07_tc/core/dataset.py | 10 ++-- datamodel_b07_tc/core/device.py | 2 +- datamodel_b07_tc/core/experiment.py | 51 +++++++++++++++++-- datamodel_b07_tc/core/generalinformation.py | 2 +- datamodel_b07_tc/core/input.py | 4 +- datamodel_b07_tc/core/insulation.py | 2 +- datamodel_b07_tc/core/massflowmeter.py | 4 +- datamodel_b07_tc/core/measurement.py | 8 +-- datamodel_b07_tc/core/metadata.py | 4 +- datamodel_b07_tc/core/output.py | 4 +- datamodel_b07_tc/core/parameter.py | 2 +- datamodel_b07_tc/core/plantsetup.py | 8 +-- datamodel_b07_tc/core/potentiostat.py | 4 +- datamodel_b07_tc/core/pump.py | 4 +- datamodel_b07_tc/core/speciesdata.py | 6 +-- datamodel_b07_tc/core/stoichiometry.py | 2 +- datamodel_b07_tc/core/thermocouple.py | 2 +- datamodel_b07_tc/core/tubing.py | 4 +- .../schemes/datamodel_b07_tc_schema.md | 2 +- 24 files changed, 91 insertions(+), 48 deletions(-) diff --git a/datamodel_b07_tc/__init__.py b/datamodel_b07_tc/__init__.py index 6ae5b39..0f22ae3 100644 --- a/datamodel_b07_tc/__init__.py +++ b/datamodel_b07_tc/__init__.py @@ -1,3 +1,3 @@ __URL__ = "https://github.com/FAIRChemistry/datamodel_b07_tc.git" -__COMMIT__ = "e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" +__COMMIT__ = "0120803a8da7ad13c94e37b6f74dea33a9915fb8" diff --git a/datamodel_b07_tc/core/author.py b/datamodel_b07_tc/core/author.py index 712efb9..c4c794f 100644 --- a/datamodel_b07_tc/core/author.py +++ b/datamodel_b07_tc/core/author.py @@ -29,5 +29,5 @@ class Author(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) diff --git a/datamodel_b07_tc/core/calibration.py b/datamodel_b07_tc/core/calibration.py index 59dcb00..53dbda3 100644 --- a/datamodel_b07_tc/core/calibration.py +++ b/datamodel_b07_tc/core/calibration.py @@ -47,5 +47,5 @@ class Calibration(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) diff --git a/datamodel_b07_tc/core/chemical.py b/datamodel_b07_tc/core/chemical.py index c599ff3..ccb1958 100644 --- a/datamodel_b07_tc/core/chemical.py +++ b/datamodel_b07_tc/core/chemical.py @@ -6,8 +6,8 @@ from sdRDM.base.utils import forge_signature, IDGenerator -from .stoichiometry import Stoichiometry from .reactantrole import ReactantRole +from .stoichiometry import Stoichiometry @forge_signature @@ -65,5 +65,5 @@ class Chemical(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) diff --git a/datamodel_b07_tc/core/data.py b/datamodel_b07_tc/core/data.py index 6c127f9..4106044 100644 --- a/datamodel_b07_tc/core/data.py +++ b/datamodel_b07_tc/core/data.py @@ -5,8 +5,8 @@ from sdRDM.base.listplus import ListPlus from sdRDM.base.utils import forge_signature, IDGenerator -from astropy.units import UnitBase from datetime import datetime as Datetime +from astropy.units import UnitBase from .quantity import Quantity @@ -41,5 +41,5 @@ class Data(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) diff --git a/datamodel_b07_tc/core/dataset.py b/datamodel_b07_tc/core/dataset.py index c5e08ed..12ca605 100644 --- a/datamodel_b07_tc/core/dataset.py +++ b/datamodel_b07_tc/core/dataset.py @@ -6,10 +6,10 @@ from sdRDM.base.utils import forge_signature, IDGenerator -from .speciesdata import SpeciesData -from .generalinformation import GeneralInformation from .measurement import Measurement from .experiment import Experiment +from .generalinformation import GeneralInformation +from .speciesdata import SpeciesData from .plantsetup import PlantSetup @@ -38,14 +38,14 @@ class Dataset(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) def add_to_experiments( self, plant_setup: Optional[PlantSetup] = None, measurements: List[Measurement] = ListPlus(), - species_data: Optional[SpeciesData] = None, + species_data: List[SpeciesData] = ListPlus(), id: Optional[str] = None, ) -> None: """ @@ -55,7 +55,7 @@ def add_to_experiments( id (str): Unique identifier of the 'Experiment' object. Defaults to 'None'. plant_setup (): the individual plant setup that is used in this one experiment.. Defaults to None measurements (): different measurements that are made within the scope of one experiment.. Defaults to ListPlus() - species_data (): all provided and calculated data about a specific species.. Defaults to None + species_data (): all provided and calculated data about a specific species.. Defaults to ListPlus() """ params = { diff --git a/datamodel_b07_tc/core/device.py b/datamodel_b07_tc/core/device.py index f844ee2..7412936 100644 --- a/datamodel_b07_tc/core/device.py +++ b/datamodel_b07_tc/core/device.py @@ -39,5 +39,5 @@ class Device(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) diff --git a/datamodel_b07_tc/core/experiment.py b/datamodel_b07_tc/core/experiment.py index 256c673..595891b 100644 --- a/datamodel_b07_tc/core/experiment.py +++ b/datamodel_b07_tc/core/experiment.py @@ -6,12 +6,15 @@ from sdRDM.base.utils import forge_signature, IDGenerator -from .speciesdata import SpeciesData from .metadata import Metadata from .measurement import Measurement +from .species import Species from .measurementtype import MeasurementType +from .speciesdata import SpeciesData from .data import Data from .plantsetup import PlantSetup +from .calibration import Calibration +from .chemicalformula import ChemicalFormula @forge_signature @@ -37,8 +40,9 @@ class Experiment(sdRDM.DataModel): ), ) - species_data: Optional[SpeciesData] = Field( - default=SpeciesData(), + species_data: List[SpeciesData] = Field( + default_factory=ListPlus, + multiple=True, description="all provided and calculated data about a specific species.", ) @@ -46,7 +50,7 @@ class Experiment(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) def add_to_measurements( @@ -78,3 +82,42 @@ def add_to_measurements( self.measurements.append(Measurement(**params)) return self.measurements[-1] + + def add_to_species_data( + self, + species: Optional[Species] = None, + chemical_formula: Optional[ChemicalFormula] = None, + calibration: Optional[Calibration] = None, + correction_factor: Optional[Data] = None, + faraday_coefficient: Optional[Data] = None, + faraday_efficiency: Optional[Data] = None, + id: Optional[str] = None, + ) -> None: + """ + This method adds an object of type 'SpeciesData' to attribute species_data + + Args: + id (str): Unique identifier of the 'SpeciesData' object. Defaults to 'None'. + species (): name of the species.. Defaults to None + chemical_formula (): chemical formula of the species.. Defaults to None + calibration (): calibration measurement.. Defaults to None + correction_factor (): correction factors of the individual species.. Defaults to None + faraday_coefficient (): Faraday coefficients of the individual species.. Defaults to None + faraday_efficiency (): Faraday efficiencies of the individual species.. Defaults to None + """ + + params = { + "species": species, + "chemical_formula": chemical_formula, + "calibration": calibration, + "correction_factor": correction_factor, + "faraday_coefficient": faraday_coefficient, + "faraday_efficiency": faraday_efficiency, + } + + if id is not None: + params["id"] = id + + self.species_data.append(SpeciesData(**params)) + + return self.species_data[-1] diff --git a/datamodel_b07_tc/core/generalinformation.py b/datamodel_b07_tc/core/generalinformation.py index 5503af0..c20060d 100644 --- a/datamodel_b07_tc/core/generalinformation.py +++ b/datamodel_b07_tc/core/generalinformation.py @@ -39,7 +39,7 @@ class GeneralInformation(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) def add_to_authors( diff --git a/datamodel_b07_tc/core/input.py b/datamodel_b07_tc/core/input.py index 317b66c..1aa01bf 100644 --- a/datamodel_b07_tc/core/input.py +++ b/datamodel_b07_tc/core/input.py @@ -7,8 +7,8 @@ from .stoichiometry import Stoichiometry -from .chemical import Chemical from .reactantrole import ReactantRole +from .chemical import Chemical @forge_signature @@ -31,7 +31,7 @@ class Input(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) def add_to_component( diff --git a/datamodel_b07_tc/core/insulation.py b/datamodel_b07_tc/core/insulation.py index 2e25bd9..21d143f 100644 --- a/datamodel_b07_tc/core/insulation.py +++ b/datamodel_b07_tc/core/insulation.py @@ -32,5 +32,5 @@ class Insulation(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) diff --git a/datamodel_b07_tc/core/massflowmeter.py b/datamodel_b07_tc/core/massflowmeter.py index 4e74fdf..532af3e 100644 --- a/datamodel_b07_tc/core/massflowmeter.py +++ b/datamodel_b07_tc/core/massflowmeter.py @@ -4,8 +4,8 @@ from sdRDM.base.utils import forge_signature, IDGenerator -from .device import Device from .parameter import Parameter +from .device import Device @forge_signature @@ -32,5 +32,5 @@ class MassFlowMeter(Device): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) diff --git a/datamodel_b07_tc/core/measurement.py b/datamodel_b07_tc/core/measurement.py index 961681e..695a365 100644 --- a/datamodel_b07_tc/core/measurement.py +++ b/datamodel_b07_tc/core/measurement.py @@ -5,14 +5,14 @@ from sdRDM.base.listplus import ListPlus from sdRDM.base.utils import forge_signature, IDGenerator -from astropy.units import UnitBase from datetime import datetime as Datetime +from astropy.units import UnitBase -from .quantity import Quantity from .metadata import Metadata +from .quantity import Quantity +from .measurementtype import MeasurementType from .data import Data from .datatype import DataType -from .measurementtype import MeasurementType @forge_signature @@ -46,7 +46,7 @@ class Measurement(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) def add_to_metadata( diff --git a/datamodel_b07_tc/core/metadata.py b/datamodel_b07_tc/core/metadata.py index 7c3a63c..1230343 100644 --- a/datamodel_b07_tc/core/metadata.py +++ b/datamodel_b07_tc/core/metadata.py @@ -4,8 +4,8 @@ from pydantic import Field, PrivateAttr from sdRDM.base.utils import forge_signature, IDGenerator -from astropy.units import UnitBase from datetime import datetime as Datetime +from astropy.units import UnitBase from .datatype import DataType @@ -59,5 +59,5 @@ class Metadata(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) diff --git a/datamodel_b07_tc/core/output.py b/datamodel_b07_tc/core/output.py index 0c37cd4..bb743c6 100644 --- a/datamodel_b07_tc/core/output.py +++ b/datamodel_b07_tc/core/output.py @@ -7,8 +7,8 @@ from .stoichiometry import Stoichiometry -from .chemical import Chemical from .reactantrole import ReactantRole +from .chemical import Chemical @forge_signature @@ -31,7 +31,7 @@ class Output(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) def add_to_component( diff --git a/datamodel_b07_tc/core/parameter.py b/datamodel_b07_tc/core/parameter.py index 8d60609..984fa09 100644 --- a/datamodel_b07_tc/core/parameter.py +++ b/datamodel_b07_tc/core/parameter.py @@ -31,5 +31,5 @@ class Parameter(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) diff --git a/datamodel_b07_tc/core/plantsetup.py b/datamodel_b07_tc/core/plantsetup.py index ac3e387..98d12ef 100644 --- a/datamodel_b07_tc/core/plantsetup.py +++ b/datamodel_b07_tc/core/plantsetup.py @@ -6,12 +6,12 @@ from sdRDM.base.utils import forge_signature, IDGenerator +from .device import Device +from .output import Output from .tubing import Tubing from .input import Input -from .insulation import Insulation -from .output import Output -from .device import Device from .chemical import Chemical +from .insulation import Insulation from .material import Material @@ -53,7 +53,7 @@ class PlantSetup(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) def add_to_devices( diff --git a/datamodel_b07_tc/core/potentiostat.py b/datamodel_b07_tc/core/potentiostat.py index 43bf9d8..6b18782 100644 --- a/datamodel_b07_tc/core/potentiostat.py +++ b/datamodel_b07_tc/core/potentiostat.py @@ -5,8 +5,8 @@ from .metadata import Metadata -from .measurement import Measurement from .device import Device +from .measurement import Measurement @forge_signature @@ -33,5 +33,5 @@ class Potentiostat(Device): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) diff --git a/datamodel_b07_tc/core/pump.py b/datamodel_b07_tc/core/pump.py index 048a0d3..f65c002 100644 --- a/datamodel_b07_tc/core/pump.py +++ b/datamodel_b07_tc/core/pump.py @@ -4,8 +4,8 @@ from sdRDM.base.utils import forge_signature, IDGenerator -from .device import Device from .pumptype import PumpType +from .device import Device @forge_signature @@ -27,5 +27,5 @@ class Pump(Device): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) diff --git a/datamodel_b07_tc/core/speciesdata.py b/datamodel_b07_tc/core/speciesdata.py index 73f65a1..d0c3fb8 100644 --- a/datamodel_b07_tc/core/speciesdata.py +++ b/datamodel_b07_tc/core/speciesdata.py @@ -5,10 +5,10 @@ from sdRDM.base.utils import forge_signature, IDGenerator -from .calibration import Calibration -from .chemicalformula import ChemicalFormula from .data import Data from .species import Species +from .calibration import Calibration +from .chemicalformula import ChemicalFormula @forge_signature @@ -55,5 +55,5 @@ class SpeciesData(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) diff --git a/datamodel_b07_tc/core/stoichiometry.py b/datamodel_b07_tc/core/stoichiometry.py index 04ccaec..0094cd7 100644 --- a/datamodel_b07_tc/core/stoichiometry.py +++ b/datamodel_b07_tc/core/stoichiometry.py @@ -59,5 +59,5 @@ class Stoichiometry(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) diff --git a/datamodel_b07_tc/core/thermocouple.py b/datamodel_b07_tc/core/thermocouple.py index 7a07404..a08f78d 100644 --- a/datamodel_b07_tc/core/thermocouple.py +++ b/datamodel_b07_tc/core/thermocouple.py @@ -27,5 +27,5 @@ class Thermocouple(Device): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) diff --git a/datamodel_b07_tc/core/tubing.py b/datamodel_b07_tc/core/tubing.py index 5b1caf6..1bd2158 100644 --- a/datamodel_b07_tc/core/tubing.py +++ b/datamodel_b07_tc/core/tubing.py @@ -5,8 +5,8 @@ from sdRDM.base.utils import forge_signature, IDGenerator -from .material import Material from .insulation import Insulation +from .material import Material @forge_signature @@ -48,5 +48,5 @@ class Tubing(sdRDM.DataModel): default="https://github.com/FAIRChemistry/datamodel_b07_tc.git" ) __commit__: Optional[str] = PrivateAttr( - default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba" + default="0120803a8da7ad13c94e37b6f74dea33a9915fb8" ) diff --git a/datamodel_b07_tc/schemes/datamodel_b07_tc_schema.md b/datamodel_b07_tc/schemes/datamodel_b07_tc_schema.md index 0d138f0..c899f20 100644 --- a/datamodel_b07_tc/schemes/datamodel_b07_tc_schema.md +++ b/datamodel_b07_tc/schemes/datamodel_b07_tc_schema.md @@ -56,7 +56,7 @@ classDiagram class Experiment { +PlantSetup plant_setup +Measurement[0..*] measurements - +SpeciesData species_data + +SpeciesData[0..*] species_data } class PlantSetup {