Class: BlueButtonParser

Inherits:
Object
  • Object
show all
Defined in:
lib/blue_button_parser.rb

Constant Summary collapse

ALWAYS_SKIP_LINES =
["^[-]+$", "^[-]+[ ]+$", "^[ ]+[-]+", "^[=]+$", "^(- ){5,}", "END OF MY HEALTHEVET"]
DEFAULT_CONFIG =
{
  "MY HEALTHEVET PERSONAL INFORMATION REPORT" => {
    :same_line_keys => ["Name", "Date of Birth"],
  },
  "DOWNLOAD REQUEST SUMMARY" => {},
  "MY HEALTHEVET ACCOUNT SUMMARY" => {
    :collection => {"Facilities" => {:table_columns => ["VA Treating Facility", " Type"]}}
  },
  "DEMOGRAPHICS" => {
    :collection => {"EMERGENCY CONTACTS" => {:item_starts_with => "Contact First Name"}},      
    :same_line_keys => [["Gender", "Blood Type", "Organ Donor"], ["Work Phone Number", "Extension"]],
  },    
  "HEALTH CARE PROVIDERS" => {
    :collection => {"Providers" => {:item_starts_with => "Provider Name"}},
    :same_line_keys => ["Phone Number", "Ext"],
  },
  "TREATMENT FACILITIES" => {
    :collection => {"Facilities" => {:item_starts_with => "Facility Name"}},
    :same_line_keys => [["Facility Type", "VA Home Facility"], ["Phone Number", "Ext"]],      
  },
  "HEALTH INSURANCE" => {
    :collection => {"Companies" => {:item_starts_with => "Health Insurance Company"}},
    :same_line_keys => [["ID Number", "Group Number"], ["Start Date", "Stop Date"]],
  },
  "VA WELLNESS REMINDERS" => {
    :collection => {"Reminders" => {:table_columns => ["Wellness Reminder", "Due Date", "Last Completed", "Location"]}}
  },
  "VA APPOINTMENTS" => {
    :collection => {"Appointments" => {:item_starts_with => "Date/Time"}},
    :skip_lines => ["^FUTURE APPOINTMENTS:", "^PAST APPOINTMENTS:"]
  },
  "VA MEDICATION HISTORY" => {
    :collection => {"Medications" => {:item_starts_with => "Medication"}},
  },
  "MEDICATIONS AND SUPPLEMENTS" => {
    :collection => {"Medications" => {:item_starts_with => "Category"}},
    :same_line_keys => [["Start Date", "Stop Date"], ["Pharmacy Name", "Pharmacy Phone"]],
  },
  "VA ALLERGIES" => {
    :collection => {"Allergies" => {:item_starts_with => "Allergy Name"}},
  },
  "ALLERGIES/ADVERSE REACTIONS" => {
    :collection => {"Allergies" => {:item_starts_with => "Allergy Name"}},
  },
  "MEDICAL EVENTS" => {
    :collection => {"Event" => {:item_starts_with => "Medical Event"}},      
  },
  "IMMUNIZATIONS" => {
    :collection => {"Immunizations" => {:item_starts_with => "Immunization"}},
  },
  "VA LABORATORY RESULTS" => {
    :collection => {"Labs" => {:item_starts_with => "Lab Test"}},
  },
  "LABS AND TESTS" => {
    :collection => {"Labs" => {:item_starts_with => "Test Name"}},
  },
  "VITALS AND READINGS" => {
    :collection => {"Reading" => {:item_starts_with => "Measurement Type"}},      
  },
  "FAMILY HEALTH HISTORY" => {
    :collection => {"Relation" => {:item_starts_with => "Relationship"}},            
  },
  "MILITARY HEALTH HISTORY" => {
    :same_line_keys => [["Service Branch", "Rank"],["Location of Service", "Onboard Ship"]]
  },    
  "DOD MILITARY SERVICE INFORMATION" => {
    :collection => {
      "Regular Active Service" => {:table_starts_with => "-- Regular Active Service", :table_columns => ["Service", "Begin Date", "End Date", "Character of Service", "Rank"] },
      "Reserve/Guard Association Periods" => {:table_starts_with => "-- Reserve/Guard Association Periods", :table_columns => ["Service", "Begin Date", "End Date", "Character of Service", "Rank"] },
      "DoD MOS/Occupation Codes" => {:table_starts_with => "-- Note: Both Service and DoD Generic codes", :table_columns => ["Service", "Begin Date", "Enl/Off", "Type", "Svc Occ Code", "DoD Occ Code"]}
    },
    :skip_lines => ["^Translations of Codes Used in this Section"]
  }
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bb_data_text, config = DEFAULT_CONFIG, newline = "\n") ⇒ BlueButtonParser

Returns a new instance of BlueButtonParser.



82
83
84
85
86
# File 'lib/blue_button_parser.rb', line 82

def initialize(bb_data_text, config=DEFAULT_CONFIG, newline="\n")
  @text = bb_data_text
  @config= config
  @data = parse_text(@text, newline)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/blue_button_parser.rb', line 3

def config
  @config
end

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/blue_button_parser.rb', line 3

def data
  @data
end

#textObject (readonly)

Returns the value of attribute text.



3
4
5
# File 'lib/blue_button_parser.rb', line 3

def text
  @text
end