示例#1
0
    def report(self):
        if self.get_sued() is None:
            sued = "may have "
        elif self.get_sued() is True:
            sued = "have "
        else:
            sued = "have not "
        agrees = index.join_list(
            [claim['paragraph'] for claim in self.get_agreed()])
        withholds = index.join_list(
            [claim['paragraph'] for claim in self.get_withheld()])
        denies = index.join_list(
            [claim['paragraph'] for claim in self.get_denied()])
        p_agree = "You agree with the claims in paragraphs {}. ".format(agrees)
        p_withhold = "You cannot respond to claims in paragraphs {}. ".format(
            withholds)
        p_deny = "You deny the allegations in paragraphs {}. ".format(denies)

        summary = "In summary, you {sued}been sued. ".format(sued=sued)
        if agrees:
            summary += p_agree
        if denies:
            summary += p_deny
        if withholds:
            summary += p_withhold
        return summary.strip()
    def build_body(self):
        # 1. accusations agreed with.
        # 2. accusations refuted.
        # 3. accusations unanswered.
        # 4+. consecutive numbered paragraphs detailing the relevant facts to be used.
        #
        if self.admissions:
            paragraph = 'paragraphs' if len(
                self.admissions) > 1 else 'paragraph'
            numbers = index.join_list(
                [str(claim['paragraph']) for claim in self.admissions])
            p_agree = "The defendant admits the allegations contained in {} {} of the statement of claim."\
                .format(paragraph, numbers)
        else:
            p_agree = "The defendant admits none of the allegations in the statement of claim."

        if self.denials:
            paragraph = 'paragraphs' if len(self.denials) > 1 else 'paragraph'
            numbers = index.join_list(
                [str(claim['paragraph']) for claim in self.denials])
            p_deny = "The defendant denies the allegations contained in {} {} of the statement of claim."\
                .format(paragraph, numbers)
        else:
            p_deny = "The defendant denies none of the allegations in the statement of claim."

        if self.unanswered:
            paragraph = 'paragraphs' if len(
                self.unanswered) > 1 else 'paragraph'
            numbers = index.join_list(
                [str(claim['paragraph']) for claim in self.unanswered])
            p_withheld = 'The defendant has no knowledge in respect of the allegations contained in {} {} of' \
                         ' the statement of claim.'\
                .format(paragraph, numbers)
        else:
            p_withheld = 'There are no paragraphs in the statement of claim that the defendant cannot answer.'

        lines = [
            self.numbered_paragraph(1, p_agree),
            self.numbered_paragraph(2, p_deny),
            self.numbered_paragraph(3, p_withheld),
        ]
        for i, fact in enumerate(self.facts):
            p = self.numbered_paragraph(i + 4, fact)
            lines.append(p)

        return '\n'.join(lines)
示例#3
0
    def get_next_step(self):
        """
        possible next steps include:
            Get plead for claim X
            Process Truth...ResponsibleCommunication defence for claim X
        :return: None or dict with keys:
            claim_id: \d
            allegation: ""
            next_step: ""
            defence: ""  # optional
            data: {}  # optional
        """

        # plead all claims first.
        for claim_id, claim in enumerate(self.data['claims']):
            # Every claim needs to be pleaded one way or another.
            if claim['plead'] is None:
                next_step = {
                    'claim_id': claim_id,
                    'allegation': claim['allegation'],
                    'next_step': 'plead',
                }
                return next_step
            # Only claims that are denied have followup questions
            if claim['plead'] != 'deny':
                continue

        # Inquire about each possible defence.
        denied_paragraphs_list = [
            str(claim['paragraph']) for claim in self.get_denied()
        ]
        if len(denied_paragraphs_list) == 0:
            next_step = {
                'next_step': "exit-deny",
            }
            return next_step

        denied_paragraphs = index.join_list(denied_paragraphs_list)
        prev_d_model = None
        prev_quote = " "
        d_model = None
        for defence in Defence.DEFENCES:
            defences = self.get_defences()
            d_model = defences.get(defence, None)

            if prev_d_model and prev_d_model.applicable is True:
                prev_quote = "Great, I've attached the {} defence to your statement.".format(
                    prev_d_model.name)
            elif prev_d_model:
                prev_quote = "I've left out the {} defence.".format(
                    prev_d_model.name)

            # This defence hasn't been brought up yet.
            if d_model is None:
                next_step = {
                    'paragraphs': denied_paragraphs,
                    'next_step': defence,
                    'defence': defence,
                    'data': {
                        'preface': prev_quote
                    }
                }
                return next_step

            # What to do if d isn't a BaseDefence instance?
            # if not isinstance(d, BaseDefence):
            #    del claim[defence]
            assert isinstance(d_model, BaseDefence)

            # If this defence is fully explored, move on.
            def_ns = d_model.next_step()
            if def_ns is None:
                prev_d_model = d_model
                continue

            data = def_ns.get('data', {})
            data['preface'] = prev_quote

            next_step = {
                'paragraphs': denied_paragraphs,
                'next_step': def_ns['next_step'],
                'defence': defence,
                'data': data,
            }
            return next_step
        if d_model and d_model.applicable is True:
            prev_quote = "Great, I've attached the {} defence to your statement.".format(
                prev_d_model.name)
        elif d_model:
            prev_quote = "I've left out the {} defence.".format(
                prev_d_model.name)

        # done iterating over claims and defences, now for general questions
        if 'is_defamatory' not in self.data:
            next_step = {
                'next_step': 'check-defamatory',
                'data': {
                    'preface': prev_quote
                }
            }
            return next_step
        elif 'is_damaging' not in self.data:
            next_step = {'next_step': 'check-damaging'}
            return next_step
        elif 'apology' not in self.data:
            next_step = {'next_step': 'check-apology'}
            return next_step

        # can antislapp legislation apply?
        if self.get_sued() is True and self.get_antislapp() is None:
            next_step = {
                'next_step': 'check-antislapp',
            }
            return next_step

        elif self.data['courtName'] is None:
            next_step = {'next_step': 'check-court'}
            return next_step
示例#4
0
    def build_part1(self):
        p_num = count(1)
        # Division 1
        paragraph = 'paragraph' if len(
            self.claims_admitted) == 1 else 'paragraphs'
        if self.claims_admitted:
            numbers = index.join_list(
                [str(claim['paragraph']) for claim in self.claims_admitted])
        else:
            numbers = "NIL"
        p_agree = "The facts alleged in {} {} of Part 1 of the notice of civil claim are admitted."\
            .format(paragraph, numbers)

        paragraph = 'paragraph' if len(
            self.claims_denied) == 1 else 'paragraphs'
        if self.claims_denied:
            numbers = index.join_list(
                [str(claim['paragraph']) for claim in self.claims_denied])
        else:
            numbers = 'NIL'
        p_deny = "The facts alleged in {} {} of Part 1 of the notice of civil claim are denied."\
            .format(paragraph, numbers)

        paragraph = 'paragraph' if len(
            self.claims_unanswered) == 1 else 'paragraphs'
        if self.claims_unanswered:
            numbers = index.join_list(
                [str(claim['paragraph']) for claim in self.claims_unanswered])
        else:
            numbers = 'NIL'
        p_withheld = 'The facts alleged in {} {} of Part 1 of the notice of civil claim are outside the knowledge of the defendant {}'\
            .format(paragraph, numbers, self.defendant)

        lines = [
            self.writer.bold(
                "Part 1: RESPONSE TO NOTICE OF CIVIL CLAIM FACTS\n"),
            self.writer.bold("Division 1 -- Defendant's Response to Facts\n"),
            self.numbered_paragraph(next(p_num), p_agree),
            self.numbered_paragraph(next(p_num), p_deny),
            self.numbered_paragraph(next(p_num), p_withheld),
            self.writer.bold("Division 2 -- Defendant's Version of Facts\n"),
        ]

        in_the_alternative = False
        alternative = "Further, and in the alternative, "
        paragraph = 'paragraphs' if len(
            self.claims_denied) > 1 else 'paragraph'
        numbers = index.join_list(
            [str(claim['paragraph']) for claim in self.claims_denied])
        not_alternative = "Regarding allegations in {para} {numbers}, ".format(
            para=paragraph, numbers=numbers)

        if self.was_defamatory is False:
            lines.append(
                self.numbered_paragraph(
                    next(p_num), not_alternative +
                    "if the defendant {} made any statements about the plaintiff, those statements were not capable of being defamatory of the plaintiff, and were not in fact defamatory of the plaintiff, as alleged or at all."
                    .format(self.defendant)))
            in_the_alternative = True

        for p_def in self.defence_paragraphs:
            if in_the_alternative:
                lines.append(
                    self.numbered_paragraph(next(p_num), alternative + p_def))
            else:
                lines.append(
                    self.numbered_paragraph(next(p_num),
                                            not_alternative + p_def))
            in_the_alternative = True

        if self.was_damaging is False:
            if in_the_alternative:
                lines.append(
                    self.numbered_paragraph(
                        next(p_num), alternative +
                        "the defendant {} expressly denies that the plaintiff has suffered injury, loss, or damage as alleged or at all."
                        .format(self.defendant)))

        if self.apology_given is True or len(self.additional_facts) > 0:
            lines.append(self.writer.bold("Division 3 -- Additional Facts\n"))
        if self.apology_given is True:
            if self.was_damaging is False:
                deny = "which is not admitted but expressly denied, "
            else:
                deny = ""
            lines.append(
                self.numbered_paragraph(
                    next(p_num), alternative +
                    "if the plaintiff has suffered injury, loss, or damage as alleged or at all, {}the defendant {} made a full and fair apology on {} by way of {}."
                    .format(deny, self.defendant, self.apology_date,
                            self.apology_method)))
        if len(self.additional_facts) > 0:
            for p_fact in self.additional_facts:
                lines.append(
                    self.numbered_paragraph(next(p_num), "Further, " + p_fact))

        return '\n'.join(lines)
示例#5
0
    def report(self):
        report = self.defence.report()

        # if any paragraphs are missing from the pleadings, mention them here
        missing_paragraphs = self.get_missing_numbers(
            [claim['paragraph'] for claim in self.defence.get_claims()])
        if missing_paragraphs:
            report += "\n\nSome paragraph numbers ({}) of allegations made seem to be missing. It is important that " \
                      "all allegation paragraphs are accounted for in paragraphs 1, 2, or 3 of Part 1 Division 1 in " \
                      "your defence below.".format(index.join_list(missing_paragraphs))

        # If antislapp legislation applies, mention that!
        if self.defence.get_antislapp() is True:
            report += "\n\nSince you're being sued in Ontario, and it's about a matter of public interest, you can " \
                      "request the court dismiss the proceeding in accordance with the Protection of Public " \
                      "Participation Act (PPPA). This would be ideal, and a legal professional will be able to " \
                      "help you."

        # fill out the statement of defence
        form = FormS2600(self.cid)
        if self.defence.get_defendant() is not None:
            form.defendant = self.defence.get_defendant()
        if self.defence.get_plaintiff() is not None:
            form.plaintiff = self.defence.get_plaintiff()
        if self.defence.get_court_name() is not None:
            form.court_name = self.defence.get_court_name()
        form.claims_unanswered = self.defence.get_withheld()
        form.claims_denied = self.defence.get_denied()
        form.claims_admitted = self.defence.get_agreed()
        if 'apology' in self.defence.data and self.defence.data['apology'][
                'applicable'] is True:
            form.apology_given = True
            form.apology_date = self.defence.data['apology']['date']
            form.apology_method = self.defence.data['apology']['method']
        else:
            form.apology_given = False
        form.was_damaging = self.defence.data.get('is_damaging', None)
        form.was_defamatory = self.defence.data.get('is_defamatory', None)

        defences = self.defence.get_defences()
        defence_paragraphs = []
        fact_paragraphs = []
        for defence in Defence.DEFENCES:
            if defence in defences and defences[defence].applicable is True:
                defence_paragraphs.append(defences[defence].report())
                fact_paragraphs.extend(defences[defence].facts)
        form.set_defences(defence_paragraphs)
        form.set_additional_facts(fact_paragraphs)

        form.write()
        report = report + "\n\nDownload your Statement of Defence " \
                          "[{}{}](here).".format(self.domain, form.get_link())

        # steps
        steps = SuitSteps(self.cid)
        steps.populate(self.defence)
        steps.write()
        report = report + "\n\nDownload your Defence Guide " \
                          "[{}{}](here).".format(self.domain, steps.get_link())

        # advice for next steps
        offer_advice = False
        if offer_advice:
            lawyer_name = "XYZ incorporated"
            lawyer_site = "https://example.com"
            report += "\n\nThe above documents are as far as I can take you. For additional support, I would recommend connecting with a legal representative from [{site}]({name}). Good luck to you!".format(
                name=lawyer_name, site=lawyer_site)

        self.response['speech'] = report
        self.response['displayText'] = report