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 Mar 6, 2024
1 parent c41a0c1 commit ba18651
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 173 deletions.
2 changes: 1 addition & 1 deletion FAIRFlowChemistry/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

__URL__ = "https://github.com/FAIRChemistry/FAIRFlowChemistry"
__COMMIT__ = "ff495cb3c7e3baec101ecf174569b19e722565cc"
__COMMIT__ = "c41a0c1e08586e8cb4deff5d7a6e8b76d1e12ca7"
1 change: 0 additions & 1 deletion FAIRFlowChemistry/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from .measurementtype import MeasurementType

__doc__ = ""

__all__ = [
"Dataset",
"Experiment",
Expand Down
15 changes: 5 additions & 10 deletions FAIRFlowChemistry/core/calibration.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import sdRDM
import numpy as np

import numpy as np
from typing import List, Optional
from uuid import uuid4
from pydantic import PrivateAttr
from uuid import uuid4
from pydantic_xml import attr, element, wrapped
from sdRDM.base.listplus import ListPlus
from sdRDM.base.utils import forge_signature


from .data import Data


@forge_signature
class Calibration(
sdRDM.DataModel,
nsmap={
"": "https://github.com/FAIRChemistry/FAIRFlowChemistry@ff495cb3c7e3baec101ecf174569b19e722565cc#Calibration"
"": "https://github.com/FAIRChemistry/FAIRFlowChemistry@c41a0c1e08586e8cb4deff5d7a6e8b76d1e12ca7#Calibration"
},
):
""""""
Expand Down Expand Up @@ -48,9 +46,7 @@ class Calibration(
description="regression coefficients in order of increasing degree.",
default_factory=ListPlus,
tag="float",
json_schema_extra=dict(
multiple=True,
),
json_schema_extra=dict(multiple=True),
),
)

Expand All @@ -60,12 +56,11 @@ class Calibration(
tag="degree",
json_schema_extra=dict(),
)

_repo: Optional[str] = PrivateAttr(
default="https://github.com/FAIRChemistry/FAIRFlowChemistry"
)
_commit: Optional[str] = PrivateAttr(
default="ff495cb3c7e3baec101ecf174569b19e722565cc"
default="c41a0c1e08586e8cb4deff5d7a6e8b76d1e12ca7"
)

def calibrate(self):
Expand Down
23 changes: 6 additions & 17 deletions FAIRFlowChemistry/core/component.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import sdRDM

from typing import List, Optional
from uuid import uuid4
from pydantic import PrivateAttr
from uuid import uuid4
from pydantic_xml import attr, element, wrapped
from sdRDM.base.listplus import ListPlus
from sdRDM.base.utils import forge_signature


from .genericattibute import GenericAttibute
from .componenttype import ComponentType
from .genericattibute import GenericAttibute


@forge_signature
class Component(
sdRDM.DataModel,
nsmap={
"": "https://github.com/FAIRChemistry/FAIRFlowChemistry@ff495cb3c7e3baec101ecf174569b19e722565cc#Component"
"": "https://github.com/FAIRChemistry/FAIRFlowChemistry@c41a0c1e08586e8cb4deff5d7a6e8b76d1e12ca7#Component"
},
):
""""""
Expand Down Expand Up @@ -72,9 +70,7 @@ class Component(
description="a generic attribute as defined by DEXPI.",
default_factory=ListPlus,
tag="GenericAttibute",
json_schema_extra=dict(
multiple=True,
),
json_schema_extra=dict(multiple=True),
),
)

Expand All @@ -87,17 +83,14 @@ class Component(
),
default_factory=ListPlus,
tag="string",
json_schema_extra=dict(
multiple=True,
),
json_schema_extra=dict(multiple=True),
),
)

_repo: Optional[str] = PrivateAttr(
default="https://github.com/FAIRChemistry/FAIRFlowChemistry"
)
_commit: Optional[str] = PrivateAttr(
default="ff495cb3c7e3baec101ecf174569b19e722565cc"
default="c41a0c1e08586e8cb4deff5d7a6e8b76d1e12ca7"
)

def add_to_generic_attributes(
Expand All @@ -122,7 +115,6 @@ def add_to_generic_attributes(
units (): bla.. Defaults to None
units_uri (): bla. Defaults to None
"""

params = {
"name": name,
"attribute_uri": attribute_uri,
Expand All @@ -131,10 +123,7 @@ def add_to_generic_attributes(
"units": units,
"units_uri": units_uri,
}

if id is not None:
params["id"] = id

self.generic_attributes.append(GenericAttibute(**params))

return self.generic_attributes[-1]
1 change: 0 additions & 1 deletion FAIRFlowChemistry/core/componenttype.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@


class ComponentType(Enum):

EQUIPMENT = "Equipment"
PIPINGCOMPONENT = "Piping component"
13 changes: 4 additions & 9 deletions FAIRFlowChemistry/core/data.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
import sdRDM

from typing import Optional, Union, List
from uuid import uuid4
from pydantic import PrivateAttr
from uuid import uuid4
from pydantic_xml import attr, element, wrapped
from sdRDM.base.listplus import ListPlus
from sdRDM.base.utils import forge_signature

from sdRDM.base.datatypes import Unit
from datetime import datetime as Datetime

from .quantity import Quantity


@forge_signature
class Data(
sdRDM.DataModel,
nsmap={
"": "https://github.com/FAIRChemistry/FAIRFlowChemistry@ff495cb3c7e3baec101ecf174569b19e722565cc#Data"
"": "https://github.com/FAIRChemistry/FAIRFlowChemistry@c41a0c1e08586e8cb4deff5d7a6e8b76d1e12ca7#Data"
},
):
""""""
Expand All @@ -42,9 +40,7 @@ class Data(
description="values.",
default_factory=ListPlus,
tag="float",
json_schema_extra=dict(
multiple=True,
),
json_schema_extra=dict(multiple=True),
),
)

Expand All @@ -54,10 +50,9 @@ class Data(
tag="unit",
json_schema_extra=dict(),
)

_repo: Optional[str] = PrivateAttr(
default="https://github.com/FAIRChemistry/FAIRFlowChemistry"
)
_commit: Optional[str] = PrivateAttr(
default="ff495cb3c7e3baec101ecf174569b19e722565cc"
default="c41a0c1e08586e8cb4deff5d7a6e8b76d1e12ca7"
)
48 changes: 12 additions & 36 deletions FAIRFlowChemistry/core/dataset.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import sdRDM

from typing import List, Optional
from uuid import uuid4
from pydantic import PrivateAttr
from uuid import uuid4
from pydantic_xml import attr, element, wrapped
from sdRDM.base.listplus import ListPlus
from sdRDM.base.utils import forge_signature


from .experiment import Experiment
from .measurement import Measurement
from .plantsetup import PlantSetup
from .experiment import Experiment
from .speciesdata import SpeciesData
from .plantsetup import PlantSetup


@forge_signature
class GeneralInformation(
sdRDM.DataModel,
nsmap={
"": "https://github.com/FAIRChemistry/FAIRFlowChemistry@ff495cb3c7e3baec101ecf174569b19e722565cc#GeneralInformation"
"": "https://github.com/FAIRChemistry/FAIRFlowChemistry@c41a0c1e08586e8cb4deff5d7a6e8b76d1e12ca7#GeneralInformation"
},
):
"""Small type for attribute 'general_information'"""
Expand All @@ -29,44 +27,29 @@ class GeneralInformation(
default_factory=lambda: str(uuid4()),
xml="@id",
)

title: Optional[str] = element(
default=None,
tag="title",
json_schema_extra=dict(),
)

title: Optional[str] = element(default=None, tag="title", json_schema_extra=dict())
project: Optional[str] = element(
default=None,
tag="project",
json_schema_extra=dict(),
default=None, tag="project", json_schema_extra=dict()
)

description: Optional[str] = element(
default=None,
tag="description",
json_schema_extra=dict(),
default=None, tag="description", json_schema_extra=dict()
)

purpose: Optional[str] = element(
default=None,
tag="purpose",
json_schema_extra=dict(),
default=None, tag="purpose", json_schema_extra=dict()
)

_repo: Optional[str] = PrivateAttr(
default="https://github.com/FAIRChemistry/FAIRFlowChemistry"
)
_commit: Optional[str] = PrivateAttr(
default="ff495cb3c7e3baec101ecf174569b19e722565cc"
default="c41a0c1e08586e8cb4deff5d7a6e8b76d1e12ca7"
)


@forge_signature
class Dataset(
sdRDM.DataModel,
nsmap={
"": "https://github.com/FAIRChemistry/FAIRFlowChemistry@ff495cb3c7e3baec101ecf174569b19e722565cc#Dataset"
"": "https://github.com/FAIRChemistry/FAIRFlowChemistry@c41a0c1e08586e8cb4deff5d7a6e8b76d1e12ca7#Dataset"
},
):
""""""
Expand Down Expand Up @@ -94,17 +77,14 @@ class Dataset(
description="information about the individual experiment.",
default_factory=ListPlus,
tag="Experiment",
json_schema_extra=dict(
multiple=True,
),
json_schema_extra=dict(multiple=True),
),
)

_repo: Optional[str] = PrivateAttr(
default="https://github.com/FAIRChemistry/FAIRFlowChemistry"
)
_commit: Optional[str] = PrivateAttr(
default="ff495cb3c7e3baec101ecf174569b19e722565cc"
default="c41a0c1e08586e8cb4deff5d7a6e8b76d1e12ca7"
)

def add_to_experiments(
Expand All @@ -123,16 +103,12 @@ def add_to_experiments(
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]
1 change: 0 additions & 1 deletion FAIRFlowChemistry/core/datatype.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class DataType(Enum):

STRING = "string"
FLOAT = "float"
DATE = "date"
Expand Down
Loading

0 comments on commit ba18651

Please sign in to comment.