Пример #1
0
    def parse_items(self):
        """For every item in the directory, send it to Celery for processing"""
        docket_paths, file_count = get_docket_list()

        completed = 0
        for docket_path in docket_paths:
            if completed < self.options['start_item'] - 1:
                # Skip ahead if start_lines is provided.
                completed += 1
                continue
            else:
                logger.info("Parsing docket: %s" % docket_path)

                pacer_doc = PacerXMLParser(docket_path)

                docket = pacer_doc.save(self.debug)
                if docket is not None:
                    pacer_doc.make_documents(docket, self.debug)

                completed += 1

                max_items = self.options['max_items']
                if completed >= max_items and max_items != -1:
                    print "\n\nCompleted %s items. Aborting early." % max_items
                    break
Пример #2
0
    def parse_items(self):
        """For every item in the directory, send it to Celery for processing"""
        docket_paths, file_count = get_docket_list()

        completed = 0
        for docket_path in docket_paths:
            if completed < self.options['start_item'] - 1:
                # Skip ahead if start_lines is provided.
                completed += 1
                continue
            else:
                logger.info("Parsing docket: %s" % docket_path)

                pacer_doc = PacerXMLParser(docket_path)

                docket = pacer_doc.save(self.debug)
                if docket is not None:
                    pacer_doc.make_documents(docket, self.debug)

                completed += 1

                max_items = self.options['max_items']
                if completed >= max_items and max_items != -1:
                    print "\n\nCompleted %s items. Aborting early." % max_items
                    break
Пример #3
0
    def parse_items(self):
        """For every item in the directory, send it to Celery for processing"""
        docket_paths = get_docket_list()

        completed = 0
        for docket_path in docket_paths:
            if completed < self.options['start_item'] - 1:
                # Skip ahead if start_lines is provided.
                completed += 1
                continue
            else:
                logger.info("%s: Parsing docket: %s" %
                            (completed, docket_path))

                pacer_doc = PacerXMLParser(docket_path)
                required_fields = ['case_name', 'date_filed']
                for field in required_fields:
                    if not getattr(pacer_doc, field):
                        logger.error("Missing required field: %s" % field)
                        continue

                docket = lookup_and_save(pacer_doc, self.debug)
                if docket is not None:
                    pacer_doc.make_documents(docket, self.debug)
                    pacer_doc.make_parties(docket, self.debug)

                completed += 1

                max_items = self.options['max_items']
                if completed >= max_items != -1:
                    logger.info("\n\nCompleted %s items. Aborting early." %
                                max_items)
                    break
Пример #4
0
    def parse_items(self):
        """For every item in the directory, send it to Celery for processing"""
        docket_paths = get_docket_list()

        completed = 0
        for docket_path in docket_paths:
            if completed < self.options['start_item'] - 1:
                # Skip ahead if start_lines is provided.
                completed += 1
                continue
            else:
                logger.info("%s: Parsing docket: %s" % (completed, docket_path))

                pacer_doc = PacerXMLParser(docket_path)
                required_fields = ['case_name', 'date_filed']
                for field in required_fields:
                    if not getattr(pacer_doc, field):
                        logger.error("Missing required field: %s" % field)
                        continue

                docket = lookup_and_save(pacer_doc, self.debug)
                if docket is not None:
                    pacer_doc.make_documents(docket, self.debug)
                    pacer_doc.make_parties(docket, self.debug)

                completed += 1

                max_items = self.options['max_items']
                if completed >= max_items != -1:
                    print("\n\nCompleted %s items. Aborting early." % max_items)
                    break
Пример #5
0
def parse_recap_docket(self, filename, debug=False):
    """Parse a docket path, creating items or updating existing ones."""
    docket_path = os.path.join(settings.MEDIA_ROOT, 'recap', filename)
    recap_pks = []
    try:
        pacer_doc = PacerXMLParser(docket_path)
    except IOError:
        logger.warning("Unable to find the docket at: %s" % docket_path)
    else:
        required_fields = ['case_name', 'date_filed']
        for field in required_fields:
            if not getattr(pacer_doc, field):
                logger.error("Missing required field: %s" % field)
                return recap_pks
        docket = lookup_and_save(pacer_doc, debug=debug)
        if docket is not None:
            try:
                recap_pks = pacer_doc.make_documents(docket, debug=debug)
            except (IntegrityError,
                    DocketEntry.MultipleObjectsReturned) as exc:
                raise self.retry(exc=exc, countdown=20 * 60)
            else:
                pacer_doc.make_parties(docket, debug=debug)

    return recap_pks
Пример #6
0
def parse_recap_docket(self, filename, debug=False):
    """Parse a docket path, creating items or updating existing ones."""
    docket_path = os.path.join(settings.MEDIA_ROOT, 'recap', filename)
    recap_pks = []
    try:
        pacer_doc = PacerXMLParser(docket_path)
    except IOError:
        logger.warning("Unable to find the docket at: %s" % docket_path)
    else:
        docket = pacer_doc.save(debug=debug)
        if docket is not None:
            try:
                recap_pks = pacer_doc.make_documents(docket, debug=debug)
            except (IntegrityError,
                    DocketEntry.MultipleObjectsReturned) as exc:
                raise self.retry(exc=exc, countdown=20 * 60)

    return recap_pks
Пример #7
0
def parse_recap_docket(self, filename, debug=False):
    """Parse a docket path, creating items or updating existing ones."""
    docket_path = os.path.join(settings.MEDIA_ROOT, 'recap', filename)
    recap_pks = []
    try:
        pacer_doc = PacerXMLParser(docket_path)
    except IOError:
        logger.warning("Unable to find the docket at: %s" % docket_path)
    else:
        required_fields = ['case_name', 'date_filed']
        for field in required_fields:
            if not getattr(pacer_doc, field):
                logger.error("Missing required field: %s" % field)
                return recap_pks
        docket = lookup_and_save(pacer_doc, debug=debug)
        if docket is not None:
            try:
                recap_pks = pacer_doc.make_documents(docket, debug=debug)
            except (IntegrityError, DocketEntry.MultipleObjectsReturned) as exc:
                raise self.retry(exc=exc, countdown=20 * 60)
            else:
                pacer_doc.make_parties(docket, debug=debug)

    return recap_pks