Exemplo n.º 1
0
    def __json_filings(cls, filings):
        filings_json_list = []

        for filing in filings:
            d = {
                'completionDate':
                format_date(filing._completion_date),  # pylint: disable=protected-access
                'filingDate':
                format_date(filing._filing_date),  # pylint: disable=protected-access
                'filingId':
                filing.id,
                'filingType':
                format_non_date(filing._filing_type),  # pylint: disable=protected-access
                'effectiveDate':
                format_date(filing.effective_date),
                'paymentToken':
                format_non_date(filing._payment_token),  # pylint: disable=protected-access
                'paymentCompletionDate':
                format_date(filing._payment_completion_date),  # pylint: disable=protected-access
                'colinEventIds':
                [x.colin_event_id for x in filing.colin_event_ids],
                'status':
                format_non_date(filing._status),  # pylint: disable=protected-access
                'paperOnly':
                format_boolean(filing.paper_only),
                # Don't want to use format_json here because we're
                # running jsonify later and it will get all escaped
                'filingJson':
                format_non_date(filing._filing_json)  # pylint: disable=protected-access
            }
            filings_json_list.append(d)

        return filings_json_list
Exemplo n.º 2
0
    def __json_directors(self, directors):
        directors_json_list = []

        for director in directors:
            d = {
                'firstName':
                format_non_date(director.party.first_name),
                'middleInitial':
                format_non_date(director.party.middle_initial),
                'lastName':
                format_non_date(director.party.last_name),
                'title':
                format_non_date(director.party.title),
                'appointmentDate':
                format_date(director.appointment_date),
                'cessationDate':
                format_date(director.cessation_date),
                'deliveryAddress':
                self.__format_address(director.party.delivery_address),
                'mailingAddress':
                self.__format_address(director.party.mailing_address)
            }
            directors_json_list.append(d)

        return directors_json_list
Exemplo n.º 3
0
    def __write_filing_to_excel(self, business_identifier, filing):
        self.__filing_sheet.write(self.__filing_sheet_row_index, 0,
                                  format_non_date(business_identifier))

        self.__filing_sheet.write(self.__filing_sheet_row_index, 1,
                                  format_json(filing._filing_json))  # pylint: disable=protected-access
        self.__filing_sheet.write(self.__filing_sheet_row_index, 2,
                                  format_date(filing._completion_date))  # pylint: disable=protected-access
        self.__filing_sheet.write(self.__filing_sheet_row_index, 3,
                                  format_date(filing._filing_date))  # pylint: disable=protected-access
        self.__filing_sheet.write(self.__filing_sheet_row_index, 4,
                                  format_non_date(filing._filing_type))  # pylint: disable=protected-access
        self.__filing_sheet.write(self.__filing_sheet_row_index, 5,
                                  format_date(filing.effective_date))
        self.__filing_sheet.write(self.__filing_sheet_row_index, 6,
                                  format_non_date(filing._payment_token))  # pylint: disable=protected-access

        self.__filing_sheet.write(self.__filing_sheet_row_index, 7,
                                  format_date(filing._payment_completion_date))  # pylint: disable=protected-access
        self.__filing_sheet.write(
            self.__filing_sheet_row_index, 8,
            format_json([x.colin_event_id for x in filing.colin_event_ids]))
        self.__filing_sheet.write(self.__filing_sheet_row_index, 9,
                                  format_non_date(filing.status))
        self.__filing_sheet.write(self.__filing_sheet_row_index, 10,
                                  format_boolean(filing.paper_only))

        self.__filing_sheet_row_index += 1
Exemplo n.º 4
0
    def __write_director_to_excel(self, business_identifier, director):
        self.__director_sheet.write(self.__director_sheet_row_index, 0,
                                    format_non_date(business_identifier))
        self.__director_sheet.write(self.__director_sheet_row_index, 1,
                                    format_non_date(director.first_name))
        self.__director_sheet.write(self.__director_sheet_row_index, 2,
                                    format_non_date(director.middle_initial))
        self.__director_sheet.write(self.__director_sheet_row_index, 3,
                                    format_non_date(director.last_name))
        self.__director_sheet.write(self.__director_sheet_row_index, 4,
                                    format_non_date(director.title))
        self.__director_sheet.write(self.__director_sheet_row_index, 5,
                                    format_date(director.appointment_date))
        self.__director_sheet.write(self.__director_sheet_row_index, 6,
                                    format_date(director.cessation_date))

        delivery_address = director.delivery_address
        if delivery_address:
            self.__write_director_address_to_excel(
                business_identifier, director, delivery_address,
                self.__director_sheet_row_index)

        mailing_address = director.mailing_address
        if mailing_address:
            self.__write_director_address_to_excel(
                business_identifier, director, mailing_address,
                self.__director_sheet_row_index)

        self.__director_sheet_row_index += 1
Exemplo n.º 5
0
    def __json_filings(self, filings):
        filings_json_list = []

        for filing in filings:
            d = {
                'completionDate':
                format_date(filing._completion_date),
                'filingDate':
                format_date(filing._filing_date),
                'filingType':
                format_non_date(filing._filing_type),
                'effectiveDate':
                format_date(filing.effective_date),
                'paymentToken':
                format_non_date(filing._payment_token),
                'paymentCompletionDate':
                format_date(filing._payment_completion_date),
                'colinEventId':
                format_non_date(filing.colin_event_id),
                'status':
                format_non_date(filing._status),
                'paperOnly':
                format_boolean(filing.paper_only),
                # Don't want to use format_json here because we're
                # running jsonify later and it will get all escaped
                'filingJson':
                format_non_date(filing._filing_json)
            }
            filings_json_list.append(d)

        return filings_json_list
Exemplo n.º 6
0
    def __json_business(self, business):

        offices = business.offices.all()
        registered_office = self.__create_office_addresses(offices, OfficeType.REGISTERED)
        records_office = self.__create_office_addresses(offices, OfficeType.RECORDS)

        d = {
            'identifier': format_non_date(business.identifier),
            'legalName': format_non_date(business.legal_name),
            'legalType': format_non_date(business.legal_type),
            'foundingDate': format_date(business.founding_date),
            'dissolutionDate': format_date(business.dissolution_date),
            'lastAnnualReport': format_date(business.last_ar_date),
            'lastAnnualGeneralMeetingDate': format_date(business.last_agm_date),
            'fiscalYearEndDate': format_date(business.fiscal_year_end_date),
            'taxId': format_non_date(business.tax_id),
            'lastLedgerId': format_non_date(business.last_ledger_id),
            'lastRemoteLedgerId': format_non_date(business.last_remote_ledger_id),
            'lastLedgerTimestamp': format_date(business.last_ledger_timestamp),
            'submitterUserId': format_non_date(business.submitter_userid),
            'lastModified': format_date(business.last_modified),
            'directors': self.__json_directors(business.directors),
            'registeredOffice': registered_office,
            OfficeType.REGISTERED: format_non_date(registered_office),
            OfficeType.RECORDS: format_non_date(records_office),
            'filings': self.__json_filings(business.filings)
        }

        return d
Exemplo n.º 7
0
    def __write_business_to_excel(self, business):

        self.__business_sheet.write(self.__business_sheet_row_index, 0,
                                    format_non_date(business.identifier))
        self.__business_sheet.write(self.__business_sheet_row_index, 1,
                                    format_non_date(business.legal_name))
        self.__business_sheet.write(self.__business_sheet_row_index, 2,
                                    format_non_date(business.legal_type))
        self.__business_sheet.write(self.__business_sheet_row_index, 3,
                                    format_date(business.founding_date))
        self.__business_sheet.write(self.__business_sheet_row_index, 4,
                                    format_date(business.dissolution_date))
        self.__business_sheet.write(self.__business_sheet_row_index, 5,
                                    format_date(business.last_ar_date))
        self.__business_sheet.write(self.__business_sheet_row_index, 6,
                                    format_date(business.last_agm_date))
        self.__business_sheet.write(self.__business_sheet_row_index, 7,
                                    format_date(business.fiscal_year_end_date))
        self.__business_sheet.write(self.__business_sheet_row_index, 8,
                                    format_non_date(business.tax_id))
        self.__business_sheet.write(self.__business_sheet_row_index, 9,
                                    format_non_date(business.last_ledger_id))
        self.__business_sheet.write(
            self.__business_sheet_row_index, 10,
            format_non_date(business.last_remote_ledger_id))
        self.__business_sheet.write(
            self.__business_sheet_row_index, 11,
            format_date(business.last_ledger_timestamp))
        self.__business_sheet.write(self.__business_sheet_row_index, 12,
                                    format_date(business.last_modified))

        self.__business_sheet_row_index += 1

        directors = business.directors.all()
        for director in directors:
            self.__write_director_to_excel(business.identifier, director)

        offices = business.offices.all()
        for office in offices:
            office_addresses = office.addresses.all()
            for office_address in office_addresses:
                self.__write_business_address_to_excel(business.identifier,
                                                       office.office_type,
                                                       office_address)

        filings = business.filings.all()
        for filing in filings:
            self.__write_filing_to_excel(business.identifier, filing)