コード例 #1
0
    def save(self):
        """Save uploaded Tennessee Workers Comp/Appeal to db.

        :return: Cluster
        """

        sha1_hash = sha1(force_bytes(self.cleaned_data.get("pdf_upload")))
        court = Court.objects.get(pk=self.cleaned_data.get("court_str"))

        docket, opinion, cluster, citations = make_objects(
            self.cleaned_data.get("item"),
            court,
            sha1_hash,
            self.cleaned_data.get("pdf_upload"),
        )

        save_everything(
            items={
                "docket": docket,
                "opinion": opinion,
                "cluster": cluster,
                "citations": citations,
            },
            index=False,
        )

        extract_doc_content.delay(
            opinion.pk, ocr_available=True, citation_jitter=True
        )

        logging.info(
            "Successfully added Tennessee object cluster: %s", cluster.id
        )

        return cluster
コード例 #2
0
ファイル: import_tn.py プロジェクト: raindrum/courtlistener
            op = ops[0]
            logging.warn("Document already in database. See: %s at %s" %
                         (op.get_absolute_url(), op.cluster.case_name))

        docket, opinion, cluster, citations = make_objects(
            make_item(case),
            courts[case["court"]],
            sha1_hash,
            pdf_data,
        )

        save_everything(
            items={
                "docket": docket,
                "opinion": opinion,
                "cluster": cluster,
                "citations": citations,
            },
            index=False,
        )

        extract_doc_content.delay(
            opinion.pk,
            do_ocr=True,
            citation_jitter=True,
        )
        logging.info("Successfully added Tennessee object cluster: %s",
                     cluster.id)


class Command(VerboseCommand):