generated from FAIRChemistry/sdrdm-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8939459
commit 48482b8
Showing
81 changed files
with
1,930 additions
and
45 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
__URL__ = "" | ||
__COMMIT__ = "" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import sdRDM | ||
|
||
from typing import Optional | ||
from pydantic import Field | ||
from sdRDM.base.utils import forge_signature, IDGenerator | ||
|
||
|
||
@forge_signature | ||
class Author(sdRDM.DataModel): | ||
"""This is another object that represents the author of the dataset. Please note, that the options here contain all required fields but also custom ones. In this example, the ```Dataverse``` option specifies where each field should be mapped, when exported to a Dataverse format. Hence, these options allow you to link your dataset towards any other data model without writing code by yourself.""" | ||
|
||
id: Optional[str] = Field( | ||
description="Unique identifier of the given object.", | ||
default_factory=IDGenerator("authorINDEX"), | ||
xml="@id", | ||
) | ||
|
||
name: Optional[str] = Field( | ||
default=None, | ||
description="full name including given and family name.", | ||
) | ||
|
||
affiliation: Optional[str] = Field( | ||
default=None, | ||
description="organization the author is affiliated to.", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import sdRDM | ||
|
||
from typing import Optional | ||
from pydantic import Field | ||
from sdRDM.base.utils import forge_signature, IDGenerator | ||
from .data import Data | ||
|
||
|
||
@forge_signature | ||
class Calibration(sdRDM.DataModel): | ||
"""""" | ||
|
||
id: Optional[str] = Field( | ||
description="Unique identifier of the given object.", | ||
default_factory=IDGenerator("calibrationINDEX"), | ||
xml="@id", | ||
) | ||
|
||
peak_areas: Optional[Data] = Field( | ||
default=Data(), | ||
description="Recorded peak areas of the individual calibration solutions.", | ||
) | ||
|
||
concentrations: Optional[Data] = Field( | ||
default=Data(), | ||
description="concentrations of the individual calibration solutions.", | ||
) | ||
|
||
slope: Optional[Data] = Field( | ||
default=Data(), | ||
description="slopes of the (linear) calibration functions.", | ||
) | ||
|
||
intercept: Optional[Data] = Field( | ||
default=Data(), | ||
description="intercept of the (linear) calibration functions.", | ||
) | ||
|
||
coefficient_of_determination: Optional[Data] = Field( | ||
default=Data(), | ||
description="coefficients of the (linear) calibration functions.", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import sdRDM | ||
|
||
from typing import List, Optional | ||
from pydantic import Field | ||
from sdRDM.base.listplus import ListPlus | ||
from sdRDM.base.utils import forge_signature, IDGenerator | ||
from .reactantrole import ReactantRole | ||
from .stoichiometry import Stoichiometry | ||
|
||
|
||
@forge_signature | ||
class Chemical(sdRDM.DataModel): | ||
"""""" | ||
|
||
id: Optional[str] = Field( | ||
description="Unique identifier of the given object.", | ||
default_factory=IDGenerator("chemicalINDEX"), | ||
xml="@id", | ||
) | ||
|
||
name: List[str] = Field( | ||
description="IUPAC name of the compound.", | ||
default_factory=ListPlus, | ||
multiple=True, | ||
) | ||
|
||
formula: Optional[str] = Field( | ||
default=None, | ||
description="molecular formula of the compound.", | ||
) | ||
|
||
pureness: Optional[float] = Field( | ||
default=None, | ||
description="pureness of the compound in percent.", | ||
) | ||
|
||
supplier: Optional[str] = Field( | ||
default=None, | ||
description="name of the supplier of the compound.", | ||
) | ||
|
||
stoichiometry: Optional[Stoichiometry] = Field( | ||
default=Stoichiometry(), | ||
description=( | ||
"stoichiometric information like equivalents, mass, amount of substance," | ||
" volume" | ||
), | ||
) | ||
|
||
state_of_matter: Optional[str] = Field( | ||
default=None, | ||
description="s for solid, l for liquid and g for gaseous", | ||
) | ||
|
||
reactant_role: Optional[ReactantRole] = Field( | ||
default=None, | ||
description=( | ||
"Role that a reactand plays in a chemical reaction or in a process." | ||
), | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import sdRDM | ||
|
||
from typing import Optional, Union, List | ||
from pydantic import Field | ||
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 .quantity import Quantity | ||
|
||
|
||
@forge_signature | ||
class Data(sdRDM.DataModel): | ||
"""""" | ||
|
||
id: Optional[str] = Field( | ||
description="Unique identifier of the given object.", | ||
default_factory=IDGenerator("dataINDEX"), | ||
xml="@id", | ||
) | ||
|
||
quantity: Optional[Quantity] = Field( | ||
default=None, | ||
description="quantity of a value.", | ||
) | ||
|
||
values: List[Union[float, str, Datetime]] = Field( | ||
default_factory=ListPlus, | ||
multiple=True, | ||
description="values.", | ||
) | ||
|
||
unit: Optional[UnitBase] = Field( | ||
default=None, | ||
description="unit of the values.", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import sdRDM | ||
|
||
from typing import List, Optional | ||
from pydantic import Field | ||
from sdRDM.base.listplus import ListPlus | ||
from sdRDM.base.utils import forge_signature, IDGenerator | ||
from .experiment import Experiment | ||
from .plantsetup import PlantSetup | ||
from .generalinformation import GeneralInformation | ||
from .measurement import Measurement | ||
from .speciesdata import SpeciesData | ||
|
||
|
||
@forge_signature | ||
class Dataset(sdRDM.DataModel): | ||
"""""" | ||
|
||
id: Optional[str] = Field( | ||
description="Unique identifier of the given object.", | ||
default_factory=IDGenerator("datasetINDEX"), | ||
xml="@id", | ||
) | ||
|
||
general_information: Optional[GeneralInformation] = Field( | ||
default=GeneralInformation(), | ||
description="general data about the data model.", | ||
) | ||
|
||
experiments: List[Experiment] = Field( | ||
default_factory=ListPlus, | ||
multiple=True, | ||
description="information about the individual experiment.", | ||
) | ||
|
||
def add_to_experiments( | ||
self, | ||
plant_setup: Optional[PlantSetup] = None, | ||
measurements: List[Measurement] = ListPlus(), | ||
species_data: List[SpeciesData] = ListPlus(), | ||
id: Optional[str] = None, | ||
) -> None: | ||
""" | ||
This method adds an object of type 'Experiment' to attribute experiments | ||
Args: | ||
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 ListPlus() | ||
""" | ||
params = { | ||
"plant_setup": plant_setup, | ||
"measurements": measurements, | ||
"species_data": species_data, | ||
} | ||
if id is not None: | ||
params["id"] = id | ||
self.experiments.append(Experiment(**params)) | ||
return self.experiments[-1] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import sdRDM | ||
|
||
from typing import Optional | ||
from pydantic import Field | ||
from sdRDM.base.utils import forge_signature, IDGenerator | ||
|
||
|
||
@forge_signature | ||
class Device(sdRDM.DataModel): | ||
"""""" | ||
|
||
id: Optional[str] = Field( | ||
description="Unique identifier of the given object.", | ||
default_factory=IDGenerator("deviceINDEX"), | ||
xml="@id", | ||
) | ||
|
||
manufacturer: Optional[str] = Field( | ||
default=None, | ||
description="name of the manufacturer of the device.", | ||
) | ||
|
||
device_type: Optional[str] = Field( | ||
default=None, | ||
description="type given by the manufacturer of the device.", | ||
) | ||
|
||
series: Optional[str] = Field( | ||
default=None, | ||
description="the series of the device.", | ||
) | ||
|
||
on_off: Optional[bool] = Field( | ||
default=None, | ||
description="operational mode of the flow module. True is on and False is off.", | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
import sdRDM | ||
|
||
from typing import List, Optional | ||
from pydantic import Field | ||
from sdRDM.base.listplus import ListPlus | ||
from sdRDM.base.utils import forge_signature, IDGenerator | ||
from .chemicalformula import ChemicalFormula | ||
from .data import Data | ||
from .measurementtype import MeasurementType | ||
from .plantsetup import PlantSetup | ||
from .species import Species | ||
from .metadata import Metadata | ||
from .measurement import Measurement | ||
from .calibration import Calibration | ||
from .speciesdata import SpeciesData | ||
|
||
|
||
@forge_signature | ||
class Experiment(sdRDM.DataModel): | ||
"""""" | ||
|
||
id: Optional[str] = Field( | ||
description="Unique identifier of the given object.", | ||
default_factory=IDGenerator("experimentINDEX"), | ||
xml="@id", | ||
) | ||
|
||
plant_setup: Optional[PlantSetup] = Field( | ||
default=PlantSetup(), | ||
description="the individual plant setup that is used in this one experiment.", | ||
) | ||
|
||
measurements: List[Measurement] = Field( | ||
default_factory=ListPlus, | ||
multiple=True, | ||
description=( | ||
"different measurements that are made within the scope of one experiment." | ||
), | ||
) | ||
|
||
species_data: List[SpeciesData] = Field( | ||
default_factory=ListPlus, | ||
multiple=True, | ||
description="all provided and calculated data about a specific species.", | ||
) | ||
|
||
def add_to_measurements( | ||
self, | ||
measurement_type: Optional[MeasurementType] = None, | ||
metadata: List[Metadata] = ListPlus(), | ||
experimental_data: List[Data] = ListPlus(), | ||
id: Optional[str] = None, | ||
) -> None: | ||
""" | ||
This method adds an object of type 'Measurement' to attribute measurements | ||
Args: | ||
id (str): Unique identifier of the 'Measurement' object. Defaults to 'None'. | ||
measurement_type (): type of a measurement, e.g. potentiostatic or gas chromatography.. Defaults to None | ||
metadata (): metadata of a measurement.. Defaults to ListPlus() | ||
experimental_data (): experimental data of a measurement.. Defaults to ListPlus() | ||
""" | ||
params = { | ||
"measurement_type": measurement_type, | ||
"metadata": metadata, | ||
"experimental_data": experimental_data, | ||
} | ||
if id is not None: | ||
params["id"] = id | ||
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[float] = None, | ||
faraday_coefficient: Optional[float] = 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] |
Oops, something went wrong.