Skip to content

Commit

Permalink
API update
Browse files Browse the repository at this point in the history
  • Loading branch information
sdRDM Bot authored and sdRDM Bot committed Sep 18, 2023
1 parent 0120803 commit ec6567e
Show file tree
Hide file tree
Showing 24 changed files with 91 additions and 48 deletions.
2 changes: 1 addition & 1 deletion datamodel_b07_tc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

__URL__ = "https://github.com/FAIRChemistry/datamodel_b07_tc.git"
__COMMIT__ = "e5e1710ac1f9b36c9f229d0f0d69a96a081365ba"
__COMMIT__ = "0120803a8da7ad13c94e37b6f74dea33a9915fb8"
2 changes: 1 addition & 1 deletion datamodel_b07_tc/core/author.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
2 changes: 1 addition & 1 deletion datamodel_b07_tc/core/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
4 changes: 2 additions & 2 deletions datamodel_b07_tc/core/chemical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
)
4 changes: 2 additions & 2 deletions datamodel_b07_tc/core/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
)
10 changes: 5 additions & 5 deletions datamodel_b07_tc/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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:
"""
Expand All @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion datamodel_b07_tc/core/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
51 changes: 47 additions & 4 deletions datamodel_b07_tc/core/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -37,16 +40,17 @@ 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.",
)

__repo__: Optional[str] = PrivateAttr(
default="https://github.com/FAIRChemistry/datamodel_b07_tc.git"
)
__commit__: Optional[str] = PrivateAttr(
default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba"
default="0120803a8da7ad13c94e37b6f74dea33a9915fb8"
)

def add_to_measurements(
Expand Down Expand Up @@ -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]
2 changes: 1 addition & 1 deletion datamodel_b07_tc/core/generalinformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions datamodel_b07_tc/core/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@


from .stoichiometry import Stoichiometry
from .chemical import Chemical
from .reactantrole import ReactantRole
from .chemical import Chemical


@forge_signature
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion datamodel_b07_tc/core/insulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
4 changes: 2 additions & 2 deletions datamodel_b07_tc/core/massflowmeter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,5 +32,5 @@ class MassFlowMeter(Device):
default="https://github.com/FAIRChemistry/datamodel_b07_tc.git"
)
__commit__: Optional[str] = PrivateAttr(
default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba"
default="0120803a8da7ad13c94e37b6f74dea33a9915fb8"
)
8 changes: 4 additions & 4 deletions datamodel_b07_tc/core/measurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions datamodel_b07_tc/core/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
)
4 changes: 2 additions & 2 deletions datamodel_b07_tc/core/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@


from .stoichiometry import Stoichiometry
from .chemical import Chemical
from .reactantrole import ReactantRole
from .chemical import Chemical


@forge_signature
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion datamodel_b07_tc/core/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
8 changes: 4 additions & 4 deletions datamodel_b07_tc/core/plantsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions datamodel_b07_tc/core/potentiostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@


from .metadata import Metadata
from .measurement import Measurement
from .device import Device
from .measurement import Measurement


@forge_signature
Expand All @@ -33,5 +33,5 @@ class Potentiostat(Device):
default="https://github.com/FAIRChemistry/datamodel_b07_tc.git"
)
__commit__: Optional[str] = PrivateAttr(
default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba"
default="0120803a8da7ad13c94e37b6f74dea33a9915fb8"
)
4 changes: 2 additions & 2 deletions datamodel_b07_tc/core/pump.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,5 +27,5 @@ class Pump(Device):
default="https://github.com/FAIRChemistry/datamodel_b07_tc.git"
)
__commit__: Optional[str] = PrivateAttr(
default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba"
default="0120803a8da7ad13c94e37b6f74dea33a9915fb8"
)
6 changes: 3 additions & 3 deletions datamodel_b07_tc/core/speciesdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
)
2 changes: 1 addition & 1 deletion datamodel_b07_tc/core/stoichiometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
2 changes: 1 addition & 1 deletion datamodel_b07_tc/core/thermocouple.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ class Thermocouple(Device):
default="https://github.com/FAIRChemistry/datamodel_b07_tc.git"
)
__commit__: Optional[str] = PrivateAttr(
default="e5e1710ac1f9b36c9f229d0f0d69a96a081365ba"
default="0120803a8da7ad13c94e37b6f74dea33a9915fb8"
)
Loading

0 comments on commit ec6567e

Please sign in to comment.