<commit_before>#!/usr/bin/env python3

from reporter.reports import Report, Schedule
from reporter import get_contact_link, RECIPIENT_IT_DQ


class CivicrmPracticeDuplicateName(Report):
    def __init__(self):
        super().__init__(
            introduction=("The following GP Practices do not have "
                          "a duplicate code in CiviCRM"),
            recipients=[RECIPIENT_IT_DQ],
            sql='''
                SELECT
                    con.id,
                    con.organization_name
                FROM (
                    SELECT
                        organization_name
                    FROM STG_CiviCRM.dbo.civicrm_contact con
                    WHERE con.contact_type = 'Organization'
                        AND con.contact_sub_type LIKE '%GP_Surgery%'
                        AND con.is_deleted = 0
                    GROUP BY con.organization_name
                    HAVING COUNT(*) > 1
                ) x
                JOIN STG_CiviCRM.dbo.civicrm_contact con
                    ON con.organization_name = x.organization_name
                    AND con.is_deleted = 0
                ;
                ''',
                schedule=Schedule.daily
        )

    def get_report_line(self, row):
        return '- {}\r\n'.format(
            get_contact_link(
                row['organization_name'], row['id']))
<commit_msg>Was picking up employees as well<commit_after>#!/usr/bin/env python3

from reporter.reports import Report, Schedule
from reporter import get_contact_link, RECIPIENT_IT_DQ


class CivicrmPracticeDuplicateName(Report):
    def __init__(self):
        super().__init__(
            introduction=("The following GP Practices have "
                          "a duplicate name in CiviCRM"),
            recipients=[RECIPIENT_IT_DQ],
            sql='''
                SELECT
                    con.id,
                    con.organization_name
                FROM (
                    SELECT
                        organization_name
                    FROM STG_CiviCRM.dbo.civicrm_contact con
                    WHERE con.contact_type = 'Organization'
                        AND con.contact_sub_type LIKE '%GP_Surgery%'
                        AND con.is_deleted = 0
                    GROUP BY con.organization_name
                    HAVING COUNT(*) > 1
                ) x
                JOIN STG_CiviCRM.dbo.civicrm_contact con
                    ON con.organization_name = x.organization_name
                    AND con.contact_sub_type LIKE '%GP_Surgery%'
                    AND con.is_deleted = 0
                ;
                ''',
                schedule=Schedule.daily
        )

    def get_report_line(self, row):
        return '- {}\r\n'.format(
            get_contact_link(
                row['organization_name'], row['id']))

{'fraction_non_alphanumeric': 0.07035003431708992, 'fraction_numerical': 0.002745367192862045, 'mean_word_length': 1.2320061255742727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4738567', 'n_tokens_mistral': 844, 'n_tokens_neox': 708, 'n_words': 157}