Skip to content
Snippets Groups Projects
Commit 2493cfe2 authored by Stefano Borini's avatar Stefano Borini
Browse files

Introduced result object and readapted interface for it.

parent a72b036c
No related branches found
No related tags found
1 merge request!12Data source result
......@@ -35,6 +35,7 @@ class CoreMCODriver(Plugin):
def application_started(self):
workflow = self.application.workflow
if self.application.evaluate:
ds_results = []
for requested_ds in workflow.data_sources:
ds_bundle = self._find_data_source_bundle_by_name(
requested_ds.name)
......@@ -42,7 +43,7 @@ class CoreMCODriver(Plugin):
ds_model = ds_bundle.create_model(requested_ds.model_data)
data_source = ds_bundle.create_data_source(
self.application, ds_model)
print(data_source.run())
ds_results.append(data_source.run())
else:
raise Exception("Requested data source {} but don't know "
"to find it.".format(requested_ds.name))
......
import csv
import numpy
from force_bdss.data_sources.base_data_source import BaseDataSource
from force_bdss.data_sources.data_source_result import DataSourceResult
class CSVExtractorDataSource(BaseDataSource):
......@@ -11,9 +13,11 @@ class CSVExtractorDataSource(BaseDataSource):
continue
if rowindex == self.model.row:
return {
self.model.cuba_type: row[self.model.column]
}
return DataSourceResult(
originator=self,
value_types = [self.model.cuba_type],
values=numpy.array(row[self.model.column]).reshape(1,1)
)
return None
return None
from traits.api import HasTraits, Array, List, String, Instance
from traits.api import HasTraits, Array, ArrayOrNone, List, String, Instance
from .base_data_source import BaseDataSource
......@@ -12,9 +12,8 @@ class DataSourceResult(HasTraits):
quality is the level of accuracy of the (e.g.c omputational) method, as
the importance and reliability of that value. It should be an enumeration
value such as HIGH, MEDIUM, POOR"""
originator = Instance(BaseDataSource)
value_types = List(String)
results = Array(shape=(None, None))
accuracy = Array(shape=(None, None))
quality = Array(shape=(None, None))
values = Array(shape=(None, None))
accuracy = ArrayOrNone(shape=(None, None))
quality = ArrayOrNone(shape=(None, None))
......@@ -2,3 +2,4 @@ envisage==4.6.0
click==6.7
six==1.10.0
stevedore==1.24.0
numpy=1.12.0
......@@ -21,6 +21,7 @@ setup(
"envisage >= 4.6.0",
"click >= 6.7",
"stevedore >= 1.24.0",
"six >= 1.10.0"
"six >= 1.10.0",
"numpy >= 1.12.0",
]
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment