ci_mapping/run_pipeline.py
def collect_fields_of_study_level(self):
        """Collect Fields' of Study metadata."""
        # Connect to postgresql
        s = self._create_session()

        # Keep the FoS IDs that haven't been collected yet
        fields_of_study_ids = [
            id_[0]
            for id_ in s.query(FieldOfStudy.id).filter(
                ~exists().where(FieldOfStudy.id == FosMetadata.id)
            )
        ]
        logger.info(f"Fields of study left: {len(fields_of_study_ids)}")

        # Collect FoS metadata
        fos = query_fields_of_study(self.subscription_key, ids=fields_of_study_ids)

        # Parse api response
        for response in fos:
            s.add(FosMetadata(id=response["id"], level=response["level"]))
            s.commit()

        self.next(self.fos_groups)
Collect Fields' of Study metadata.
Collect Fields' of Study metadata.
Collect Fields ' of Study metadata .
def collect_fields_of_study_level(self):
        s = self._create_session()
        fields_of_study_ids = [
            id_[0]
            for id_ in s.query(FieldOfStudy.id).filter(
                ~exists().where(FieldOfStudy.id == FosMetadata.id)
            )
        ]
        logger.info(f"Fields of study left: {len(fields_of_study_ids)}")
        fos = query_fields_of_study(self.subscription_key, ids=fields_of_study_ids)
        for response in fos:
            s.add(FosMetadata(id=response["id"], level=response["level"]))
            s.commit()
        self.next(self.fos_groups)
def collect_fields_of_study_level ( self ) : s = self . _create_session ( ) fields_of_study_ids = [ id_ [ 0 ] for id_ in s . query ( FieldOfStudy . id ) . filter ( ~ exists ( ) . where ( FieldOfStudy . id == FosMetadata . id ) ) ] logger . info ( f"Fields of study left: {len(fields_of_study_ids)}" ) fos = query_fields_of_study ( self . subscription_key , ids = fields_of_study_ids ) for response in fos : s . add ( FosMetadata ( id = response [ "id" ] , level = response [ "level" ] ) ) s . commit ( ) self . next ( self . fos_groups )
Collect Fields' of Study metadata.
Collect Fields ' of Study metadata .
"""Collect Fields' of Study metadata.""" # Connect to postgresql # Keep the FoS IDs that haven't been collected yet # Collect FoS metadata # Parse api response
self