Skip to content
Snippets Groups Projects
Commit bd3547dc authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

up

parent 8dc79b76
No related branches found
No related tags found
2 merge requests!39Release 0.4.0,!6Resulttable
Pipeline #9138 failed
......@@ -34,7 +34,7 @@ from caosadvancedtools.crawler import FileCrawler
from caosadvancedtools.guard import INSERT, UPDATE
from caosadvancedtools.scifolder import (AnalysisCFood, ExperimentCFood,
PublicationCFood, SimulationCFood,
SoftwareCFood)
SoftwareCFood, ResultTableCFood)
try:
from sss_helper import get_argument_parser, print_success
......@@ -89,7 +89,7 @@ if __name__ == "__main__":
interactive=False, hideKnown=False,
cfood_types=[ExperimentCFood, AnalysisCFood, SoftwareCFood,
PublicationCFood, SimulationCFood,
])
ResultTableCFood])
if args.authorize_run:
for run_id in args.authorize_run:
......
......@@ -18,6 +18,14 @@ SoftwareVersion:
binaries:
sourceCode:
Software:
DepthTest:
obligatory_properties:
temperature:
datatype: DOUBLE
description: 'temp'
depth:
datatype: DOUBLE
description: 'temp'
Person:
obligatory_properties:
firstName:
......
......@@ -57,6 +57,17 @@ class CrawlerTest(unittest.TestCase):
datfile.description)
assert os.path.basename(datfile.path) == "datafile.dat"
# There should be two DepthTest Properties
depthtests = exp.get_property("DepthTest")
assert len(depthtests) == 1
assert len(depthtests.value) == 2
depthtest = db.Record(id=depthtests.value[0])
depthtest.retrieve()
assert "DepthTest" in [p.name for p in project.get_parents()]
assert 234.4 == depthtest.get_property("temperature").value[0]
assert "°C" == depthtest.get_property("temperature").unit
assert 3.0 == depthtest.get_property("depth").value[0]
# Should have a responsible person
self.assertIsNotNone(exp.get_property("responsible"))
person = db.Record(id=exp.get_property("responsible").value[0])
......
......@@ -3,3 +3,4 @@ from .experiment_cfood import ExperimentCFood
from .publication_cfood import PublicationCFood
from .simulation_cfood import SimulationCFood
from .software_cfood import SoftwareCFood
from .result_table_cfood import ResultTableCFood
......@@ -17,6 +17,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import caosdb as db
import re
import pandas as pd
from caosadvancedtools.cfood import (AbstractFileCFood, assure_has_description,
assure_has_parent, assure_has_property,
......@@ -63,7 +64,7 @@ class ResultTableCFood(AbstractFileCFood):
rec.add_parent(self.match.group("recordtype"))
for col in self.table.columns[:2]:
match = ResultTableCFood.match(col)
match = re.match(ResultTableCFood.property_name_re, col)
if match.group("unit"):
rec.add_property(match.group("pname"), row.loc[col], unit=match.group("unit"))
......@@ -77,6 +78,7 @@ class ResultTableCFood(AbstractFileCFood):
def update_identifiables(self):
for ii, (idx, row) in enumerate(self.table.iterrows()):
for col in row.index:
assure_property_is(self.recs[ii], col, row.loc[col], to_be_updated=self.to_be_updated)
match = re.match(ResultTableCFood.property_name_re, col)
assure_property_is(self.recs[ii], match.group("pname"), row.loc[col], to_be_updated=self.to_be_updated)
assure_property_is(self.experiment, self.match.group("recordtype"),
self.recs, to_be_updated=self.to_be_updated)
demperature [°C] ,depth [m]
temperature [°C] ,depth
234.4,3.0
344.6,5.1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment