Esempio n. 1
0
 def setUp(self):
     self.ds =  [dat.DatasetStructure(p) for p in Path(project_path).children]
Esempio n. 2
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.datasetdata = dat.DatasetStructure(self.path)
Esempio n. 3
0
    def pipeline(self):
        if hasattr(self, '_pipeline'):
            return self._pipeline

        datasetdata = self.datasetdata
        dsc = datasetdata.cache.dataset
        if dsc is None:
            raise exc.NotInDatasetError

        dataset = dat.DatasetStructure(dsc)  # FIXME should be able to go back

        class ProtocolHelper(ProtocolData):  # FIXME so ... bad ...
            @property
            def protocol_uris(self,
                              outer_self=self
                              ):  # FIXME this needs to be pipelined
                try:
                    yield from adops.get(outer_self.data,
                                         ['meta', 'protocol_url_or_doi'])
                except exc.NoSourcePathError:
                    pass

        ph = ProtocolHelper()

        # FIXME except for the adds, everything here should be a pipeline
        class Lifters:  # do this to prevent accidental data leaks
            # context
            id = dsc.id  # in case we are somewhere else
            folder_name = dsc.name
            uri_api = dsc.uri_api
            uri_human = dsc.uri_human
            # dataset metadata
            #submission = property(lambda s: (_ for _ in dataset.submission))
            #dataset_description = property(lambda s: (_ for _ in dataset.dataset_description))
            #subjects = property(lambda s: (_ for _ in dataset.subjects))

            # protocols
            protocol = ph.protocol
            #protcur = self.protcur

            # aux
            organ = self.organ
            member = self.member
            modality = self.organs_sheet.modality(id)
            award_manual = self.organs_sheet.award_manual(id)

            #sheets
            organ_term = self.organs_sheet.organ_term(id)

        class RuntimeContext:
            """ utility for logging etc. """
            id = dsc.id  # TODO can we eliminate the need for lifters this way?
            uri_api = dsc.uri_api  # FIXME black blackfynn ids their own thing
            uri_human = dsc.uri_human  # so uri_api and uri_human can be computed from them ...
            path = self.path

        helpers = {}
        helper_key = object()
        lifters = Lifters()
        #sources = dataset.data
        # helper key was bad because it means that pipelines have to
        # know the structure of their helper pipelines and maintain them
        # across changes, better to use the lifters as other pipelines that
        # can start from a single piece of data and return a formatted result
        # and track their own provenance, the concept of a helper that holds
        # all the prior existing data is not a bad one, it just just that it
        # is better to create objects that can take the information already
        # in the data for the current pipeline and return an expanded verion
        self._pipeline = pipes.PipelineEnd(dataset, lifters, RuntimeContext())
        return self._pipeline