<commit_before>require 'builder'

module Cypress
  class PatientZipper
  
    def self.zip(file, patients, format)
      Zip::ZipOutputStream.open(file.path) do |z|
        patients.each_with_index do |patient, i|
          z.put_next_entry("#{i}_#{patient.first}_#{patient.last}.xml")
          xml = Builder::XmlMarkup.new(:indent => 2)
          xml.instruct!
          if format==:c32
            z << patient.to_c32(xml)
          else
            z << patient.to_ccr(xml)<commit_msg>Switching the patient zipper over to the new CCR/C32 generation interface<commit_after>require 'builder'

module Cypress
  class PatientZipper
  
    def self.zip(file, patients, format)
      Zip::ZipOutputStream.open(file.path) do |z|
        patients.each_with_index do |patient, i|
          z.put_next_entry("#{i}_#{patient.first}_#{patient.last}.xml")
          if format==:c32
            z << HealthDataStandards::Export::C32.export(patient)
          else
            z << HealthDataStandards::Export::CCR.export(patient)
{'fraction_non_alphanumeric': 0.12168792934249265, 'fraction_numerical': 0.010794896957801767, 'mean_word_length': 2.8059701492537314, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '620602', 'n_tokens_mistral': 326, 'n_tokens_neox': 315, 'n_words': 63}