<commit_before>module DemoData

  class DocumentGenerator


    EXAMPLE_DOC_TYPES = {
      'repo_order_1.pdf'                      => 1,
      'repo_order_2.pdf'                      => 1,
      'repo_order_3.pdf'                      => 1,
      'LAC_1.pdf'                             => 2,
      'commital_bundle.pdf'                   => 3,
      'indictment.pdf'                        => 4,
      'judicial_appointment_order.pdf'        => 5,
      'invoices.pdf'                          => 6,
      'hardship.pdf'                          => 7,
      'previous_fee_advancements.pdf'         => 8,
      'other_supporting_evidence.pdf'         => 9,
      'justification_for_late_submission.pdf' => 10
    }

    def initialize(claim)
      @claim         = claim
      @checklist_ids = []
    end

    def generate!
      rand(1..6).times { add_document_to_claim }
      @claim.update_attribute(:evidence_checklist_ids, @checklist_ids)
    end

    private

    def add_document_to_claim
      doc_index = 1
      while @checklist_ids.include?(doc_index) do
        doc_index = rand(EXAMPLE_DOC_TYPES.size)
      end
      pdf_name = EXAMPLE_DOC_TYPES.keys[doc_index]
      @checklist_ids << EXAMPLE_DOC_TYPES[pdf_name]
      filename = "#{Rails.root}/spec/fixtures/files/#{pdf_name}"
      file = File.open(filename)
      Document.create(
        claim: @claim,
        document: file,
        document_content_type: 'application/pdf',
        advocate: @claim.advocate)
    end
  end
end

<commit_msg>fix demo data doc type change impact<commit_after>module DemoData

  class DocumentGenerator


    EXAMPLE_DOC_TYPES = {
      'repo_order_1.pdf'                      => 1,
      'repo_order_2.pdf'                      => 1,
      'repo_order_3.pdf'                      => 1,
      'LAC_1.pdf'                             => 2,
      'commital_bundle.pdf'                   => 3,
      'indictment.pdf'                        => 4,
      'judicial_appointment_order.pdf'        => 5,
      'invoices.pdf'                          => 6,
      'hardship.pdf'                          => 7,
      'previous_fee_advancements.pdf'         => 8,
      'justification_for_late_submission.pdf' => 9
    }

    def initialize(claim)
      @claim         = claim
      @checklist_ids = []
    end

    def generate!
      rand(1..6).times { add_document_to_claim }
      @claim.update_attribute(:evidence_checklist_ids, @checklist_ids)
    end

    private

    def add_document_to_claim
      doc_index = 1
      while @checklist_ids.include?(doc_index) do
        doc_index = rand(EXAMPLE_DOC_TYPES.size)
      end
      pdf_name = EXAMPLE_DOC_TYPES.keys[doc_index]
      @checklist_ids << EXAMPLE_DOC_TYPES[pdf_name]
      filename = "#{Rails.root}/spec/fixtures/files/#{pdf_name}"
      file = File.open(filename)
      Document.create(
        claim: @claim,
        document: file,
        document_content_type: 'application/pdf',
        advocate: @claim.advocate)
    end
  end
end


{'fraction_non_alphanumeric': 0.10013351134846461, 'fraction_numerical': 0.012683578104138851, 'mean_word_length': 1.645189761694616, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 26, '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': '3934395', 'n_tokens_mistral': 996, 'n_tokens_neox': 935, 'n_words': 150}