Class: Renalware::Patients::MDMMenu

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/patients/mdm_menu.rb

Overview

Queries for and stores in a class variable the list of MDM ‘scopes’ to use when building the MDM menu. An example of a scope is “transplant” or “low_clearance”. If you make changes to the system_view_metadata table to add/edit/remove a scope, you will need to restart the app for changes to to reflect in the menu. It is done this way as a changes are rare and we want to avoid running this query too many times. I think it will run once per procethread

Class Method Summary collapse

Class Method Details

.itemsObject



14
15
16
17
18
19
# File 'app/models/renalware/patients/mdm_menu.rb', line 14

def self.items
  return cached_items if cached_items

  self.cached_items = array_of_distinct_scopes_for_all_mdm_list_views
  cached_items
end

.remove_invalid_scope_names_that_could_break_menu_rendering(scopes) ⇒ Object

Only accept MDM scopes names that are simple lower case underscored strings eg “my_view_name”.



33
34
35
# File 'app/models/renalware/patients/mdm_menu.rb', line 33

def self.remove_invalid_scope_names_that_could_break_menu_rendering(scopes)
  scopes.select { |scope| scope.match?(/^[a-z0-9_]*$/) }
end