<commit_before>module PatientsHelper
  def result_to_markup(included)
    if included
      '<img src="/images/pass.png"/>'
    else
      ''
    end
  end
  
  def result_to_class(included)
    if included
      'class="p"'
    else
      ''
    end
  end
  
  def code_display(entry, tag_name='code', extra_content=nil)
    if entry.single_code_value?
      code = entry.codes.first[1].first
      code_system_oid = QME::Importer::CodeSystemHelper.oid_for_code_system(entry.codes.first[0])
      "<#{tag_name} code=\"#{code}\" codeSystem=\"#{code_system_oid}\" #{extra_content}><originalText>#{h entry.description}</originalText></#{tag_name}>"
    else
      all_codes = []
      entry.codes.each_pair {|key, values| values.each {|v| all_codes << {:set => key, :value => v}}}
      first_code = all_codes.first
      code_string = "<#{tag_name} code=\"#{first_code[:value]}\" codeSystem=\"#{QME::Importer::CodeSystemHelper.oid_for_code_system(first_code[:set])}\">\n"
      code_string += "<originalText>#{entry.description}</originalText>\n"
      all_codes[1..-1].each do |cv|
        code_string += "<translation code=\"#{cv[:value]}\" codeSystem=\"#{QME::Importer::CodeSystemHelper.oid_for_code_system(cv[:set])}\"/>\n"
      end
      code_string += "</#{tag_name}>"
      code_string
    end
  end
  
  def status_code_for(entry)
    case entry.status
    when 'active'
      '55561003'
    when 'inactive'
      '73425007'
    when 'resolved'
      '413322009'
    end
  end
  
  def patient_picture(patient)
    if patient.gender == 'M'
      if patient.over_18?
        '/images/dad.jpg'
      else
        '/images/boy.jpg'
      end
    else
      if patient.over_18?
        '/images/woman.jpg'
      else
        '/images/girl.jpg'<commit_msg>Dealing with the fact that sometimes status is a string, sometimes it is a symbol<commit_after>module PatientsHelper
  def result_to_markup(included)
    if included
      '<img src="/images/pass.png"/>'
    else
      ''
    end
  end
  
  def result_to_class(included)
    if included
      'class="p"'
    else
      ''
    end
  end
  
  def code_display(entry, tag_name='code', extra_content=nil)
    if entry.single_code_value?
      code = entry.codes.first[1].first
      code_system_oid = QME::Importer::CodeSystemHelper.oid_for_code_system(entry.codes.first[0])
      "<#{tag_name} code=\"#{code}\" codeSystem=\"#{code_system_oid}\" #{extra_content}><originalText>#{h entry.description}</originalText></#{tag_name}>"
    else
      all_codes = []
      entry.codes.each_pair {|key, values| values.each {|v| all_codes << {:set => key, :value => v}}}
      first_code = all_codes.first
      code_string = "<#{tag_name} code=\"#{first_code[:value]}\" codeSystem=\"#{QME::Importer::CodeSystemHelper.oid_for_code_system(first_code[:set])}\">\n"
      code_string += "<originalText>#{entry.description}</originalText>\n"
      all_codes[1..-1].each do |cv|
        code_string += "<translation code=\"#{cv[:value]}\" codeSystem=\"#{QME::Importer::CodeSystemHelper.oid_for_code_system(cv[:set])}\"/>\n"
      end
      code_string += "</#{tag_name}>"
      code_string
    end
  end
  
  def status_code_for(entry)
    case entry.status.to_s
    when 'active'
      '55561003'
    when 'inactive'
      '73425007'
    when 'resolved'
      '413322009'
    end
  end
  
  def patient_picture(patient)
    if patient.gender == 'M'
      if patient.over_18?
        '/images/dad.jpg'
      else
        '/images/boy.jpg'
      end
    else
      if patient.over_18?
        '/images/woman.jpg'
      else
        '/images/girl.jpg'
{'fraction_non_alphanumeric': 0.15483152325257588, 'fraction_numerical': 0.018379281537176273, 'mean_word_length': 2.921397379912664, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '5261240', 'n_tokens_mistral': 1257, 'n_tokens_neox': 1236, 'n_words': 211}