<commit_before>module Renalware
  log '--------------------Adding Rabbit Pathology Requests (OBR)--------------------'
  rabbit = Patient.find_by(family_name: 'RABBIT', given_name: 'Roger')
  pathology_rabbit = Pathology.cast_patient(rabbit)

  logcount=0
  CSV.foreach(File.join(demo_path, 'rabbit_pathology_obr.csv'), headers: true) do |row|
    #id,"order_no","requestor_name","requested_at",patient_id,"created_at","description"
    logcount += 1
    request_description = Pathology::RequestDescription.find_by!(code: row['description'])
    request = pathology_rabbit.observation_requests.create!(
      description: request_description,
      requestor_order_number: row['order_no'],
      requested_at: row['requested_at'],
      requestor_name: row['requestor_name']
    )
  end

  log "#{logcount} Path Requests seeded"
end<commit_msg>Adding Rabbit Pathology Observations (OBX) CSV script<commit_after>module Renalware
  rabbit = Patient.find_by(family_name: 'RABBIT', given_name: 'Roger')
  pathology_rabbit = Pathology.cast_patient(rabbit)

  log '--------------------Adding Rabbit Pathology Requests (OBR)--------------------'

  logcount=0
  CSV.foreach(File.join(demo_path, 'rabbit_pathology_obr.csv'), headers: true) do |row|
    #id,"order_no","requestor_name","requested_at",patient_id,"created_at","description"
    logcount += 1
    request_description = Pathology::RequestDescription.find_by!(code: row['description'])
    request = pathology_rabbit.observation_requests.create!(
      id: row['id'],
      description: request_description,
      requestor_order_number: row['order_no'],
      requested_at: row['requested_at'],
      requestor_name: row['requestor_name']
    )
  end

  log "#{logcount} Path Requests seeded"

  log '--------------------Adding Rabbit Pathology Observations (OBX)--------------------'

  logcount=0
  CSV.foreach(File.join(demo_path, 'rabbit_pathology_obx.csv'), headers: true) do |row|
  #id,"result","comment","observed_at","created_at","description",request_id
    logcount += 1
    observation_description = Pathology::ObservationDescription.find_by!(code: row['description'])
    request = Pathology::ObservationRequest.find(row['request_id'])
    request.observations.create!(
      description: observation_description,
      result: row['result'],
      observed_at: request.requested_at - 12.hours
    )
  end

  log "#{logcount} Path Observations seeded"

end
{'fraction_non_alphanumeric': 0.16756087494841107, 'fraction_numerical': 0.0033016921172100704, 'mean_word_length': 4.092436974789916, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7375113', 'n_tokens_mistral': 756, 'n_tokens_neox': 712, 'n_words': 132}