Ejemplo n.º 1
0
    def update(
        self,
        data,
        disable_external_push=False,
        disable_relations_update=False,
        *args,
        **kwargs,
    ):
        with db.session.begin_nested():
            LiteratureRecord.update_authors_signature_blocks_and_uuids(data)
            LiteratureRecord.update_refs_to_conferences(data)
            data = self.add_files(data)
            super().update(data, *args, **kwargs)

            if not disable_relations_update:
                self.update_record_relationships()

        if disable_external_push:
            LOGGER.info(
                "Record EXTERNAL PUSH disabled",
                recid=self.get("control_number"),
                uuid=str(self.id),
            )
        else:
            push_to_orcid(self)
            push_to_hal(self)
        self.push_authors_phonetic_blocks_to_redis()
Ejemplo n.º 2
0
    def update(self,
               data,
               disable_orcid_push=False,
               disable_citation_update=False,
               **kwargs):
        with db.session.begin_nested():
            LiteratureRecord.update_authors_signature_blocks_and_uuids(data)
            super().update(data)
            if disable_citation_update:
                LOGGER.info(
                    "Record citation update disabled",
                    recid=self.get("control_number"),
                    uuid=str(self.id),
                )
            else:
                self.update_refs_in_citation_table()

            if disable_orcid_push:
                LOGGER.info(
                    "Record ORCID PUSH disabled",
                    recid=self.get("control_number"),
                    uuid=str(self.id),
                )
            else:
                push_to_orcid(self)
            self.push_authors_phonetic_blocks_to_redis()
Ejemplo n.º 3
0
    def update(
        self,
        data,
        disable_external_push=False,
        disable_relations_update=False,
        disable_disambiguation=False,
        *args,
        **kwargs,
    ):
        with db.session.begin_nested():
            LiteratureRecord.update_authors_signature_blocks_and_uuids(data)
            LiteratureRecord.update_refs_to_conferences(data)
            data = self.add_files(data)
            super().update(data, *args, **kwargs)

            if not disable_relations_update:
                self.update_record_relationships()

        if disable_external_push:
            LOGGER.info(
                "Record EXTERNAL PUSH disabled",
                recid=self.get("control_number"),
                uuid=str(self.id),
            )
        else:
            push_to_orcid(self)
            push_to_hal(self)
        if (not disable_disambiguation and
                current_app.config["FEATURE_FLAG_ENABLE_AUTHOR_DISAMBIGUATION"]
            ):
            disambiguate_authors.delay(str(self.id))
        self.push_authors_phonetic_blocks_to_redis()
Ejemplo n.º 4
0
def run_orcid_push(uuids):
    for uuid in uuids:
        try:
            record = InspireRecord.get_record(uuid)
            if isinstance(record, LiteratureRecord):
                push_to_orcid(record)
        except Exception:
            LOGGER.exception("Cannot push to orcid", uuid=str(uuid))
    return uuids
Ejemplo n.º 5
0
 def create(cls,
            data,
            disable_orcid_push=False,
            disable_citation_update=False,
            **kwargs):
     with db.session.begin_nested():
         LiteratureRecord.update_authors_signature_blocks_and_uuids(data)
         record = super().create(data, **kwargs)
         if disable_citation_update:
             LOGGER.info("Record citation update disabled",
                         recid=record["control_number"])
         else:
             record.update_refs_in_citation_table()
         if disable_orcid_push:
             LOGGER.info("Record ORCID PUSH disabled",
                         recid=record["control_number"])
         else:
             push_to_orcid(record)
         record.push_authors_phonetic_blocks_to_redis()
         return record
Ejemplo n.º 6
0
def push_records(recids):
    """Manually trigger the push of the given records."""
    for recid in recids:
        push_to_orcid(LiteratureRecord.get_record_by_pid_value(recid))
    secho(f"Scheduled ORCID push of {len(recids)} records.")