135. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 8/4/2017 2:45:04 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

135.1 Files compared

# Location File Last Modified
1 CUI-Release-v2.2.0-source.zip\CUI-Release-v2.2.0-source\db seeds.rb Thu Jun 15 19:04:28 2017 UTC
2 CUI-Release-v2.2.0-source.zip\CUI-Release-v2.2.0-source\db seeds.rb Fri Aug 4 14:52:07 2017 UTC

135.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 1498
Changed 2 4
Inserted 0 0
Removed 0 0

135.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

135.4 Active regular expressions

No regular expressions were active.

135.5 Comparison detail

  1   # db/seeds .rb
  2   # This fil e is execu ted during  `rake db: reset` and  `db:setup ` and `db: seed` task s
  3  
  4   # If this  file is ex ecuted whe n the RAIL S_ENV is d evelopment  it will
  5   # only see d the stat ic text fi les unless  the DBRES ET environ ment varia ble is tru e
  6   # WHen DBR ESET is tr ue and RAI LS_ENV is  developmen t, the dat abase will  have
  7   # been res et to a bl ank condit ion prior  to this fi le being e xecuted an d the
  8   # this fil e will pop ulate the  entire dev elopment d ataset.
  9  
  10   require 's eeder.rb'
  11  
  12   require 'c sv_seeder. rb'
  13   include Cs vSeeder
  14  
  15   require 's ql_seeder. rb'
  16   include Sq lSeeder
  17  
  18  
  19   ########## ########## ########## ########## ########## #######
  20   ## seed st atic text  tables fro m csv file s located  in db/csv
  21  
  22   puts "\nLo ading stat ic text ta bles."
  23  
  24   [
  25     CareCate gory,
  26     Consulta tionOrder,
  27     Consulta tionStatus ,
  28     Consulta tionType,
  29     MedicalS pecialty,
  30     OtherHea lthInsuran ce,
  31     Referral DocumentTy pe,
  32     Referral Reason,
  33     Referral Type,
  34  
  35   ].each do  |model_cla ss_name|
  36     load_sta tic_text_t able_from_ csv(klass:  model_cla ss_name)
  37   end
  38  
  39   load_stati c_text_tab le_from_cs v(
  40     klass:   Visn,
  41     column_m appings: [ 'id','sequ ence','reg ion','name ']
  42   )
  43  
  44   load_stati c_text_tab le_from_cs v(
  45     klass:           Si te,
  46     column_m appings:   ['name','a ddress','c ity','stat e','zip_co de'],
  47     common_f ields:  {c ountry: 'U SA'},
  48     use_copy _from:  fa lse
  49   )
  50  
  51  
  52   unless see d_from_sql (Diagnosis Code, rese t_only: tr ue)
  53     load_sta tic_text_t able_from_ csv(
  54       klass:   Diagnosi sCode,
  55       column _mappings:  ['id','ve rsion_code ','descrip tion']
  56     )
  57   end
  58  
  59  
  60   ### Load i ssue categ ories for  DOM-127 Re quest for  Support ## #
  61   %w[
  62     Performa nce
  63     Security
  64     Function al
  65     Access
  66     Forgot_P assword
  67     Other
  68   ].each do  |category|
  69     SupportR equestCate gory.find_ or_create_ by(name: c ategory.gs ub('_', '  ').titleca se)
  70   end
  71  
  72   org1 = Sup portReques tOrganizat ion.create (short_nam e: "C&P",  long_name: "Compensat ion and Pe nsion")
  73  
  74   org2 = Sup portReques tOrganizat ion.create (short_nam e: "CPP",  long_name: "Community  Provider  Portal")
  75  
  76   ########## ########## ########## ########## ########## ########## #
  77  
  78  
  79   ########## ########## ########## ########## ########## #######
  80   ## define  the Referr alStatus
  81  
  82   print "Loa ding stati c text for  ReferralS tatus ...  "
  83  
  84   [
  85     {
  86       status :                "pen ding",
  87       referr al_queue:        "vha _cc",   #  Only users  who have  one of the se roles w ill have t his status  in the re ferral_que ue
  88       filter able_by_ro les:  "vha _cc"    #  Only users  who have  one of the se roles w ill have t his status  in the de tail filte r pane
  89     },
  90     {
  91       status :                "act ive",
  92       referr al_queue:        "vha _cc",
  93       filter able_by_ro les:  "vha _cc"
  94     },
  95     {
  96       status :                "sch eduled",
  97       referr al_queue:        "vha _cc, non_v ha",
  98       filter able_by_ro les:  "vha _cc, non_v ha"
  99     },
  100     {
  101       status :                "rev iew_pendin g",
  102       referr al_queue:        "vha _cc, non_v ha",
  103       filter able_by_ro les:  "vha _cc, non_v ha"
  104     },
  105     {
  106       status :                "req uest_infor mation",
  107       referr al_queue:        "vha _cc, non_v ha",
  108       filter able_by_ro les:  "vha _cc, non_v ha"
  109     },
  110     {
  111       status :                "com plete",
  112       referr al_queue:        "non _vha",
  113       filter able_by_ro les:  "vha _cc, non_v ha"
  114     },
  115     {
  116       status :                "com plete_no_v isits",
  117       referr al_queue:        "",
  118       filter able_by_ro les:  "vha _cc, non_v ha"
  119     }
  120   ].each do  |entry|
  121     Referral Status.fin d_or_creat e_by(
  122       name:                   entr y[:status] .gsub('_',  ' ').titl ecase,
  123       code:                   entr y[:status] .upcase,
  124       referr al_queue:        entr y[:referra l_queue].d owncase,
  125       filter able_by_ro les:  entr y[:filtera ble_by_rol es].downca se
  126     )
  127   end
  128  
  129   puts "done "
  130  
  131   ########## ########## ########## ########## ########## #######
  132   ## define  the test E xamination State
  133  
  134   print "Loa ding stati c text for  Examinati onState .. . "
  135  
  136   # FIXME: s pelling er ror: Cance led not Ca ncelled
  137   %w[
  138     Pending
  139     Ready_to _be_Schedu led
  140     Schedule d
  141     In_Progr ess
  142     Complete d
  143     Reviewed
  144     Submitte d
  145     Rejected
  146     Pending_ Cancellati on
  147     Cancelle d
  148     Reschedu le
  149   ].each do  |status|
  150     Examinat ionState.f ind_or_cre ate_by(nam e: status. gsub('_',  ' ').title case, code : status.u pcase)
  151   end
  152  
  153   puts "done "
  154  
  155  
  156   ########## ########## ########## ########## ########## #######
  157   ## define  the test E xamRequest State
  158  
  159   print "Loa ding stati c text for  ExamReque stState .. . "
  160  
  161   # FIXME: s pelling er ror Cancel ed not Can celled
  162   %w[
  163     In_Progr ess
  164     Pending
  165     Cancelle d
  166     Complete d
  167   ].each do  |status|
  168     ExamRequ estState.f ind_or_cre ate_by(nam e: status. gsub('_',  ' ').title case, code : status.u pcase)
  169   end
  170  
  171   puts "done "
  172  
  173  
  174   ########## ########## ########## ########## ########## #######
  175   ## define  the test C larificati onType
  176  
  177   print "Loa ding stati c text for  Clarifica tionType . .. "
  178  
  179   %w[
  180     Request
  181     Response
  182   ].each do  |status|
  183     Clarific ationType. find_or_cr eate_by(na me: status .gsub('_',  ' ').titl ecase, cod e: status. upcase)
  184   end
  185  
  186   puts "done "
  187  
  188  
  189   ########## ########## ########## ########## ########## #######
  190   ## Loading  the data  from db/ec m_seeds.rb  via
  191   ## rake ev al_con_man :seed
  192   ##
  193   ## The fol lowing mod els are im pacted:
  194   ##      Di agnosisMod ifier
  195   ##      Di agnosis
  196   ##      Dm Assignment
  197   ##      Sy mptom
  198   ##      Mi norSystem
  199   ##      Ma jorSystem
  200   ##      Ev aluationTe mplate
  201  
  202   print "Inv oking rake  task eval _con_man:s eed ... "
  203  
  204   Rake::Task ["eval_con _man:seed" ].invoke
  205  
  206   puts "done "
  207  
  208   print "Inv oking rake  task eval _con_man:l oad_html . .."
  209  
  210   Rake::Task ["eval_con _man:load_ html"].inv oke
  211  
  212   puts "done "
  213  
  214   ########## ########## ########## ########## ########## #######
  215   ## Loading  the data  from db/vb ms_r_fg_in it.rb via
  216   ## rake vb ms_r_fg:in it
  217   ##
  218   ## The fol lowing mod els are im pacted:
  219   ##      Vb msRFactGro up
  220  
  221   print "Inv oking rake  task vbms _r_fg:init  ... "
  222  
  223   Rake::Task ["vbms_r_f g:init"].i nvoke
  224  
  225   puts "done "
  226  
  227  
  228   ########## ########## ########## ########## ########## #######
  229   ## make up  some test  data for  developmen t
  230  
  231   if Rails.e nv.develop ment?  &&   DBRESET
  232  
  233     puts "\n Loading de velopment  test data. "
  234  
  235  
  236     ######## ########## ########## ########## ########## #########
  237     ## defin e test fac ilities an d provider s
  238  
  239     unless s eed_from_s ql( Facili ty, Provid er, reset_ only: true  )
  240       puts " \n... Faci lities tab le."
  241  
  242       50.tim es do |fac ility_numb er|
  243         faci lity_recor d = Seeder ::Facility Seed.new(f acility_nu mber)
  244       end
  245  
  246       puts " \n... Prov ider table  from NPI  Registry w ith zip co des ..."
  247  
  248       zipcod es = %w[20 002 23233  71111 7350 1]
  249  
  250       zipcod es.each do  |postal_c ode|
  251         prin tf "%s ",  postal_cod e
  252         NpiR egistry.fi lter('post al_code' = > postal_c ode)
  253       end
  254       puts " done"
  255     end
  256  
  257  
  258  
  259     ######## ########## ########## ########## ########## #########
  260     ## defin e test use rs
  261  
  262     puts ".. . User tab le."
  263  
  264     medical_ assistant  = User.cre ate(
  265                  email:  "team@adh octeam.us" ,
  266                  passwo rd: "Sms!1 2345",
  267                  first_ name: "Med ical",
  268                  last_n ame: "Assi stant",
  269                  author ization_st ate: 'auth orized',
  270                  roles:  ['medical _assistant ']) unless  User.exis ts?(email:  "team@adh octeam.us" )
  271  
  272     supervis or = User. create(
  273                  email:  "supervis or@adhocte am.us",
  274                  passwo rd: "Sms!1 2345",
  275                  first_ name: "Sup er",
  276                  last_n ame: "Viso r",
  277                  author ization_st ate: 'auth orized',
  278                  roles:  ['supervi sor']) unl ess User.e xists?(ema il: "super visor@adho cteam.us")
  279  
  280     examiner  = User.cr eate(
  281                  email:  "examiner @adhocteam .us",
  282                  passwo rd: "Sms!1 2345",
  283                  first_ name: "Exa m",
  284                  last_n ame: "Iner ",
  285                  author ization_st ate: 'auth orized',
  286                  roles:  ["examine r"]) unles s User.exi sts?(email : "")
  287  
  288     app_admi n = User.c reate(
  289                  email:  "samantha @smith.com ",
  290                  passwo rd: "Sms!1 2345",
  291                  author ization_st ate: "auth orized",
  292                  first_ name: "Sam antha",
  293                  last_n ame: "Smit h",
  294                  # FIXM E: at the  end of CPP  sprint 15  these two  lines wer e removed
  295                  #         from th e integrat ion branch .  So if t hey are tr uly not ne eded,
  296                  #         come ba ck here an d delete t his dead c ode in a f uture spri nt.
  297                  # auth orization_ state: 'au thorized',
  298                  roles:  ["app_adm in"]) unle ss User.ex ists?(emai l: "samant ha@smith.c om")
  299  
  300     site_use r1 = User. create(
  301                  email:  "mike@wal lace.com",
  302                  passwo rd: "Sms!1 2345",
  303                  author ization_st ate: "auth orized",
  304                  first_ name: "Mik e",
  305                  last_n ame: "Wall ace") unle ss User.ex ists?(emai l: "mike@w allace.com ")
  306  
  307     site_use r2 = User. create(
  308                  email:  "eric@wil son.com",
  309                  passwo rd: "Sms!1 2345",
  310                  author ization_st ate: "auth orized",
  311                  first_ name: "Eri c",
  312                  last_n ame: "Wils on") unles s User.exi sts?(email : "eric@wi lson.com")
  313  
  314     all_role s_QTC_user  = User.cr eate(
  315                  email:  "all@qtc. com",
  316                  passwo rd: "Sms!1 2345",
  317                  author ization_st ate: "auth orized",
  318                  first_ name: "All ",
  319                  last_n ame: "Qtc" ) unless U ser.exists ?(email: " all@qtc.co m")
  320  
  321     admin_QT C_user = U ser.create (
  322                  email:  "admin@qt c.com",
  323                  passwo rd: "Sms!1 2345",
  324                  author ization_st ate: "auth orized",
  325                  first_ name: "Adm in",
  326                  last_n ame: "Qtc" ) unless U ser.exists ?(email: " admin@qtc. com")
  327  
  328     triage_Q TC_user =  User.creat e(
  329                  email:  "triage@q tc.com",
  330                  passwo rd: "Sms!1 2345",
  331                  author ization_st ate: "auth orized",
  332                  first_ name: "Tri age",
  333                  last_n ame: "Qtc" ) unless U ser.exists ?(email: " triage@qtc .com")
  334  
  335     scheduli ng_QTC_use r = User.c reate(
  336                  email:  "scheduli ng@qtc.com ",
  337                  passwo rd: "Sms!1 2345",
  338                  author ization_st ate: "auth orized",
  339                  first_ name: "Sch eduling",
  340                  last_n ame: "Qtc" ) unless U ser.exists ?(email: " scheduling @qtc.com")
  341  
  342     clinicia n_QTC_user  = User.cr eate(
  343                  email:  "clinicia n@qtc.com" ,
  344                  passwo rd: "Sms!1 2345",
  345                  author ization_st ate: "auth orized",
  346                  first_ name: "Cli nician",
  347                  last_n ame: "Qtc" ) unless U ser.exists ?(email: " clinician@ qtc.com")
  348  
  349     sclinici an_QTC_use r = User.c reate(
  350                  email:  "super_cl inician@qt c.com",
  351                  passwo rd: "Sms!1 2345",
  352                  author ization_st ate: "auth orized",
  353                  first_ name: "Sup er",
  354                  last_n ame: "Qtc" ) unless U ser.exists ?(email: " super_clin ician@qtc. com")
  355  
  356     qa_QTC_u ser = User .create(
  357                  email:  "qa@qtc.c om",
  358                  passwo rd: "Sms!1 2345",
  359                  author ization_st ate: "auth orized",
  360                  first_ name: "Qa" ,
  361                  last_n ame: "Qtc" ) unless U ser.exists ?(email: " qa@qtc.com ")
  362  
  363     # CPP-sp ecific tes t users
  364  
  365     cheryl_h oward_npis  = %w(
  366       104330 3563
  367       108308 9809
  368       122518 2579
  369       122534 0383
  370       129512 4063
  371       129586 2415
  372       136649 9295
  373       159819 9259
  374       165969 6045
  375       171034 2811
  376     )
  377  
  378     vha_cc =  User.crea te(
  379                  email:  "vha_cc@e xample.com ",
  380                  passwo rd: "Sms!1 2345",
  381                  first_ name: "VHA  CC",
  382                  last_n ame: "Test User",
  383                  author ization_st ate: 'auth orized',
  384                  roles:  ["vha_cc" ]) unless  User.exist s?(email:  "vha_cc@ex ample.com" )
  385  
  386     non_vha  = User.cre ate(
  387                  email:  "non_vha@ example.co m",
  388                  passwo rd: "Sms!1 2345",
  389                  first_ name: "Non  VHA",
  390                  last_n ame: "Test User",
  391                  author ization_st ate: 'auth orized',
  392                  npi: c heryl_howa rd_npis.po p,
  393                  roles:  ["non_vha "]) unless  User.exis ts?(email:  "non_vha@ example.co m")
  394  
  395     vha_cc2  = User.cre ate(
  396                  email:  "vhacc.cp ptestuser@ gmail.com" ,
  397                  passwo rd: "Sms!1 2345",
  398                  first_ name: "VHA  CC2",
  399                  last_n ame: "Test User",
  400                  author ization_st ate: 'auth orized',
  401                  roles:  ["app_adm in","vha_c c"]) unles s User.exi sts?(email : "vhacc.c pptestuser @gmail.com ")
  402  
  403     non_vha2  = User.cr eate(
  404                  email:  "nonvha.c pptestuser @gmail.com ",
  405                  passwo rd: "Sms!1 2345",
  406                  first_ name: "Non  VHA2",
  407                  last_n ame: "Test User",
  408                  author ization_st ate: 'auth orized',
  409                  npi: c heryl_howa rd_npis.po p(2),
  410                  roles:  ["non_vha "]) unless  User.exis ts?(email:  "nonvha.c pptestuser @gmail.com ")
  411  
  412     vha_cc3  = User.cre ate(
  413                  email:  " PII                   ",
  414                  passwo rd: "Sms!1 2345",
  415                  first_ name: "Amy ",
  416                  last_n ame: "Rose nthal",
  417                  author ization_st ate: 'auth orized',
  418                    roles: ["v ha_cc"]) u nless User .exists?(e mail: " PII                    ")
  419  
  420     non_vha3  = User.cr eate(
  421                  email:  "arosenth al@meetver acity.com" ,
  422                  passwo rd: "Sms!1 2345",
  423                  first_ name: "Amy ",
  424                  last_n ame: "Rose nthal",
  425                  author ization_st ate: 'auth orized',
  426                  npi: c heryl_howa rd_npis.po p(2),
  427                  roles:  ["non_vha "]) unless  User.exis ts?(email:  "arosenth al@meetver acity.com" )
  428  
  429     non_vha4  = User.cr eate(
  430                  email:  "tmcmurdo @meetverac ity.com",
  431                  passwo rd: "Sms!1 2345",
  432                  first_ name: "The resa",
  433                  last_n ame: "McMu rdo",
  434                  author ization_st ate: 'auth orized',
  435                  npi: c heryl_howa rd_npis.po p(2),
  436                  roles:  ["non_vha "]) unless  User.exis ts?(email:  "tmcmurdo @meetverac ity.com")
  437  
  438     non_vha5  = User.cr eate(
  439                  email:  "jrobinso n@meetvera city.com",
  440                  passwo rd: "Sms!1 2345",
  441                  first_ name: "Jef f",
  442                  last_n ame: "Robi nson",
  443                  author ization_st ate: 'auth orized',
  444                  npi: c heryl_howa rd_npis.po p(2),
  445                  roles:  ["non_vha "]) unless  User.exis ts?(email:  "jrobinso n@meetvera city.com")
  446  
  447     # add em pty UserPr eference o bject to e ach user,  with time  zone
  448     # corres ponding to  index
  449     US_TIME_ ZONES = Ac tiveSuppor t::TimeZon e.us_zones .map &:nam e
  450     User.all .each_with _index do  |user, ind ex|
  451       time_z one_string      = US_ TIME_ZONES [index % U S_TIME_ZON ES.count]
  452       user.u ser_prefer ence = Use rPreferenc e.new(time _zone: tim e_zone_str ing)
  453       user.s ave(valida tion: fals e)
  454     end
  455  
  456  
  457     ######## ########## ########## ########## ########## #########
  458     ## defin e the test  claims
  459  
  460     puts ".. . Claim ta ble."
  461  
  462     claim =  Claim.find _or_create _by(
  463                  first_ name: "Joe ",
  464                  last_n ame: "Vete ran",
  465                  patien t_ssn: "01 2345678",
  466                  file_n umber: "01 2345678",
  467                  date_o f_birth: D ate.new(19 00),
  468                  facili ty_name: " Bananas Ho spital",
  469                  facili ty_number:  12)
  470  
  471  
  472     ######## ########## ########## ########## ########## #########
  473     ## defin e the test  contentio ns
  474  
  475     puts ".. . Contenti on table."
  476  
  477     contenti on = Conte ntion.find _or_create _by(
  478                  claim_ id: claim. id,
  479                  name:  "leg pain" )
  480  
  481  
  482     ######## ########## ########## ########## ########## #########
  483     ## defin e the test  sites
  484     ## TODO:  What is t he relatio nship, if  any, betwe en Site, F acility, P rovider cl asses?
  485  
  486     puts ".. . Site tab le."
  487  
  488     site1 =  Site.find_ or_create_ by(
  489                  name:  "Chicago M edical Cen ter",
  490                  addres s: "1111 S ilver Aven ue",
  491                  city:  "Chicago",
  492                  state:  "Illinois ",
  493                  countr y: "USA")
  494  
  495     site2 =  Site.find_ or_create_ by(
  496                  name:  "Dallas VA  Clinic",
  497                  addres s: "2222 R ush Avenue ",
  498                  city:  "Dallas",
  499                  state:  "Texas",
  500                  countr y: "USA")
  501  
  502     site3 =  Site.find_ or_create_ by(
  503                  name:  "QTC",
  504                  facili ty_id: "QT C VBA Vend or",
  505                  addres s: "21700  Copley Dr. , Ste 200" ,
  506                  city:  "Diamond B ar",
  507                  state:  "CA",
  508                  zip_co de: "91765 -2219",
  509                  countr y: "USA")
  510  
  511     site4 =  Site.find_ or_create_ by(
  512                  name:  "VES",
  513                  facili ty_id: "VE S VBA Vend or",
  514                  addres s: "2707 N orth Loop  W., Suite  1000",
  515                  city:  "Houston",
  516                  state:  "TX",
  517                  zip_co de: "77008 ",
  518                  countr y: "USA")
  519  
  520     site5 =  Site.find_ or_create_ by(
  521                  name:  "VetFed",
  522                  facili ty_id: "Ve tFed VBA V endor",
  523                  addres s: "21700  Copley Dr. , Ste 200" ,
  524                  city:  "Diamond B ar",
  525                  state:  "CA",
  526                  zip_co de: "91765 -2219",
  527                  countr y: "USA")
  528  
  529     site6 =  Site.find_ or_create_ by(
  530                  name:  "Atlanta V A Medical  Center",
  531                  facili ty_id: "50 8",
  532                  addres s: "1670 C lairmont R oad",
  533                  city:  "Decatur",
  534                  state:  "GA",
  535                  zip_co de: "30033 ",
  536                  countr y: "USA")
  537  
  538     site7 =  Site.find_ or_create_ by(
  539                  name:  "CSRA ITC" ,
  540                  facili ty_id: "77 7",
  541                  addres s: "6300 T exas Ave." ,
  542                  city:  "Bossier C ity",
  543                  state:  "LA",
  544                  zip_co de: "71111 ",
  545                  countr y: "USA")
  546  
  547  
  548     ######## ########## ########## ########## ########## #########
  549     ## Updat ing test u ser's site  and roles
  550  
  551     puts ".. . Adding s ite and si te roles t o CUI-user s."
  552  
  553     app_admi n.present?  ? (app_ad min.add_si te(site3);  app_admin .get_site_ roles(site 3).update( admin: tru e)) : fals e
  554     site_use r1.present ? ? (site_ user1.add_ site(site3 ); site_us er1.get_si te_roles(s ite3).upda te(admin:  true, tria ge: true,  scheduling : true, cl inician: t rue, super _clinician : true, qa : true)) :  false
  555     site_use r2.present ? ? (site_ user2.add_ site(site3 ); site_us er2.get_si te_roles(s ite3).upda te(admin:  true, tria ge: true,  scheduling : true, cl inician: t rue, super _clinician : true, qa : true)) :  false
  556     all_role s_QTC_user .present?  ? (all_rol es_QTC_use r.add_site (site3); a ll_roles_Q TC_user.ge t_site_rol es(site3). update(adm in: true,  triage: tr ue, schedu ling: true , clinicia n: true, s uper_clini cian: true , qa: true )) : false
  557     admin_QT C_user.pre sent? ? (a dmin_QTC_u ser.add_si te(site3);  admin_QTC _user.get_ site_roles (site3).up date(admin : true)) :  false
  558     triage_Q TC_user.pr esent? ? ( triage_QTC _user.add_ site(site3 ); triage_ QTC_user.g et_site_ro les(site3) .update(tr iage: true )) : false
  559     scheduli ng_QTC_use r.present?  ? (schedu ling_QTC_u ser.add_si te(site3);  schedulin g_QTC_user .get_site_ roles(site 3).update( scheduling : true)) :  false
  560     clinicia n_QTC_user .present?  ? (clinici an_QTC_use r.add_site (site3); c linician_Q TC_user.ge t_site_rol es(site3). update(cli nician: tr ue)) : fal se
  561     sclinici an_QTC_use r.present?  ? (sclini cian_QTC_u ser.add_si te(site3);  sclinicia n_QTC_user .get_site_ roles(site 3).update( super_clin ician: tru e)) : fals e
  562     qa_QTC_u ser.presen t? ? (qa_Q TC_user.ad d_site(sit e3); qa_QT C_user.get _site_role s(site3).u pdate(qa:  true)) : f alse
  563  
  564  
  565     ######## ########## ########## ########## ########## #########
  566     ## Addin g the Eval uation spe cs
  567  
  568     puts ".. . Evaluati onSpec tab le."
  569  
  570     Examinat ionState.f ind_or_cre ate_by(:na me => "Pen ding", :co de => "PEN DING")
  571     Examinat ionState.f ind_or_cre ate_by(:na me => "Rea dy to be S cheduled",  :code =>  "READY_TO_ BE_SCHEDUL ED")
  572     Examinat ionState.f ind_or_cre ate_by(:na me => "Sch eduled", : code => "S CHEDULED")
  573     Examinat ionState.f ind_or_cre ate_by(:na me => "In  Progress",  :code =>  "IN_PROGRE SS")
  574     Examinat ionState.f ind_or_cre ate_by(:na me => "Com pleted", : code => "C OMPLETED")
  575     Examinat ionState.f ind_or_cre ate_by(:na me => "Rev iewed", :c ode => "RE VIEWED")
  576     Examinat ionState.f ind_or_cre ate_by(:na me => "Sub mitted", : code => "S UBMITTED")
  577     Examinat ionState.f ind_or_cre ate_by(:na me => "Rej ected", :c ode => "RE JECTED")
  578     Examinat ionState.f ind_or_cre ate_by(:na me => "Pen ding Cance llation",  :code => " PENDING_CA NCELLATION ")
  579     Examinat ionState.f ind_or_cre ate_by(:na me => "Can celled", : code => "C ANCELLED")
  580     Examinat ionState.f ind_or_cre ate_by(:na me => "Res chedule",  :code => " RESCHEDULE ")
  581  
  582     ExamRequ estState.f ind_or_cre ate_by(:na me => "New ", :code = > "NEW")
  583     ExamRequ estState.f ind_or_cre ate_by(:na me => "In  Progress",  :code =>  "IN_PROGRE SS")
  584     ExamRequ estState.f ind_or_cre ate_by(:na me => "Pen ding, Repo rted", :co de => "PEN DING_REPOR TED")
  585     ExamRequ estState.f ind_or_cre ate_by(:na me => "Pen ding Cance llation",  :code => " PENDING_CA NCELLATION ")
  586     ExamRequ estState.f ind_or_cre ate_by(:na me => "Can celled", : code => "C ANCELLED")
  587     ExamRequ estState.f ind_or_cre ate_by(:na me => "Can celed by M AS", :code  => "CANCE LED_BY_MAS ")
  588     ExamRequ estState.f ind_or_cre ate_by(:na me => "Can celed by R O", :code  => "CANCEL ED_BY_RO")
  589     ExamRequ estState.f ind_or_cre ate_by(:na me => "Com pleted", : code => "C OMPLETED")
  590     ExamRequ estState.f ind_or_cre ate_by(:na me => "Com pleted, Pr inted by R O", :code  => "COMPLE TED_PRINTE D_BY_RO")
  591     ExamRequ estState.f ind_or_cre ate_by(:na me => "Rel eased to R O, Not Pri nted", :co de => "REL EASED_TO_R O_NOT_PRIN TED")
  592     ExamRequ estState.f ind_or_cre ate_by(:na me => "Re- routed, Ne w", :code  => "REROUT ED_NEW")
  593     ExamRequ estState.f ind_or_cre ate_by(:na me => "Re- routed, ac cepted", : code => "R EROUTED_AC CEPTED")
  594     ExamRequ estState.f ind_or_cre ate_by(:na me => "Re- routed, re jected", : code => "R EROUTED_RE JECTED")
  595  
  596     Clarific ationType. find_or_cr eate_by(:n ame => "Re quest", :c ode => "RE QUEST")
  597     Clarific ationType. find_or_cr eate_by(:n ame => "Re sponse", : code => "R ESPONSE")
  598  
  599  
  600  
  601     ######## ########## ########## ########## ########## #########
  602     ## Seed  the Evalua tion Specs
  603  
  604     seed_spe cs_log = F ile.open(L OG_DIR+'se ed_specs.l og','w')
  605  
  606     print ". .. Executi ng Evaluat ionSpec.sy nc_specs . .. "
  607     Evaluati onSpec.syn c_specs(ni l, "app/ex ams/*.yml" , seed_spe cs_log)
  608     puts "do ne"
  609  
  610     seed_spe cs_log.clo se
  611  
  612  
  613     ######## ########## ########## ########## ########## #########
  614     ## defin e test Vet eran, cons ultation,  referral
  615     ## TODO:  add test  data for t he sub-ref erral tabl es
  616  
  617     puts "\n ... Vetera n, Consult ation, Ref erral tabl es."
  618  
  619     RANDOMIZ ED_VETERAN _COUNT = 1 0
  620  
  621     # PP-496 : adding m ore test v eterans na med after  famous U.S . Generals  who died  in WWII
  622     US_GENER ALS = [
  623       {last_ name: 'And ersen', fi rst_name:  'James', m iddle_name : 'Roy', g ender: 'M' , date_of_ birth: '1/ 1/1904'},
  624       {last_ name: 'And erson', fi rst_name:  'Alexander ', middle_ name: 'Edw ard', gend er: 'M', d ate_of_bir th: '1/1/1 889'},
  625       {last_ name: 'And rews', fir st_name: ' Frank', mi ddle_name:  'Maxwell' , gender:  'M', date_ of_birth:  '1/1/1884' },
  626       {last_ name: 'Bar th Jr.', f irst_name:  'Charles' , middle_n ame: 'Henr y', gender : 'M', dat e_of_birth : '1/1/190 3'},
  627       {last_ name: 'Ber man', firs t_name: 'M orris', mi ddle_name:  '', gende r: 'M', da te_of_birt h: '1/1/18 91'},
  628       {last_ name: 'Bou dinot', fi rst_name:  'Truman',  middle_nam e: 'Everet t', gender : 'M', dat e_of_birth : '1/1/189 5'},
  629       {last_ name: 'Bra nn', first _name: 'Do nald', mid dle_name:  'Weldon',  gender: 'M ', date_of _birth: '1 /1/1895'},
  630       {last_ name: 'Bra un Jr.', f irst_name:  'Gustav',  middle_na me: 'Josep h', gender : 'M', dat e_of_birth : '1/1/189 5'},
  631       {last_ name: 'Buc kner Jr.',  first_nam e: 'Simon' , middle_n ame: 'Boli var', gend er: 'M', d ate_of_bir th: '1/1/1 886'},
  632       {last_ name: 'Car rington',  first_name : 'Gordon' , middle_n ame: 'de L auney', ge nder: 'M',  date_of_b irth: '1/1 /1894'},
  633       {last_ name: 'Cas tle', firs t_name: 'F rederick',  middle_na me: 'Walke r', gender : 'M', dat e_of_birth : '1/1/190 8'},
  634       {last_ name: 'Cha mberlin',  first_name : 'Harry',  middle_na me: 'Dwigh t', gender : 'M', dat e_of_birth : '1/1/188 7'},
  635       {last_ name: 'Cra ig', first _name: 'Ma lin', midd le_name: ' ', gender:  'M', date _of_birth:  '1/1/1875 '},
  636       {last_ name: 'Dal ton II', f irst_name:  'James',  middle_nam e: 'Leo',  gender: 'M ', date_of _birth: '1 /1/1910'},
  637       {last_ name: 'Dar by', first _name: 'Wi lliam', mi ddle_name:  'Orlando' , gender:  'M', date_ of_birth:  '1/1/1911' },
  638       {last_ name: 'Dar gue', firs t_name: 'H erbert', m iddle_name : 'Arthur' , gender:  'M', date_ of_birth:  '1/1/1886' },
  639       {last_ name: 'Dav is', first _name: 'Dw ight', mid dle_name:  'Filley',  gender: 'M ', date_of _birth: '1 /1/1879'},
  640       {last_ name: 'Dav ison', fir st_name: ' Donald', m iddle_name : 'Angus',  gender: ' M', date_o f_birth: ' 1/1/1892'} ,
  641       {last_ name: 'De  Jesus', fi rst_name:  'Simeon',  middle_nam e: '', gen der: 'M',  date_of_bi rth: '1/1/ 1894'},
  642       {last_ name: 'Dun can', firs t_name: 'A sa', middl e_name: 'N orth', gen der: 'M',  date_of_bi rth: '1/1/ 1892'},
  643       {last_ name: 'Eas ley', firs t_name: 'C laudius',  middle_nam e: 'Miller ', gender:  'M', date _of_birth:  '1/1/1891 '},
  644       {last_ name: 'Eat on', first _name: 'Wi lliam', mi ddle_name:  'Herbert' , gender:  'M', date_ of_birth:  '1/1/1906' },
  645       {last_ name: 'Eme ry', first _name: 'Am brose', mi ddle_name:  'Robert',  gender: ' M', date_o f_birth: ' 1/1/1883'} ,
  646       {last_ name: 'For rest', fir st_name: ' Nathan', m iddle_name : 'Bedford ', gender:  'M', date _of_birth:  '1/1/1905 '},
  647       {last_ name: 'For t', first_ name: 'Guy ', middle_ name: 'Osb orne', gen der: 'M',  date_of_bi rth: '1/1/ 1879'},
  648       {last_ name: 'Gar dner', fir st_name: ' John', mid dle_name:  'Henry', g ender: 'M' , date_of_ birth: '1/ 1/1893'},
  649       {last_ name: 'Gar lington',  first_name : 'Creswel l', middle _name: '',  gender: ' M', date_o f_birth: ' 1/1/1887'} ,
  650       {last_ name: 'Geo rge', firs t_name: 'H arold', mi ddle_name:  'Huston',  gender: ' M', date_o f_birth: ' 1/1/1892'} ,
  651       {last_ name: 'Gib bons', fir st_name: ' Lloyd', mi ddle_name:  'Henry',  gender: 'M ', date_of _birth: '1 /1/1895'},
  652       {last_ name: 'God frey', fir st_name: ' Stuart', m iddle_name : 'Chapin' , gender:  'M', date_ of_birth:  '1/1/1886' },
  653       {last_ name: 'Goo drich', fi rst_name:  'Donald',  middle_nam e: 'Reuben ', gender:  'M', date _of_birth:  '1/1/1894 '},
  654       {last_ name: 'Gra ves', firs t_name: 'D avis', mid dle_name:  'Dunbar',  gender: 'M ', date_of _birth: '1 /1/1903'},
  655       {last_ name: 'Har mon Jr.',  first_name : 'Millard ', middle_ name: 'Fil lmore', ge nder: 'M',  date_of_b irth: '1/1 /1888'},
  656       {last_ name: 'Har ms', first _name: 'He nry', midd le_name: ' William',  gender: 'M ', date_of _birth: '1 /1/1887'},
  657       {last_ name: 'Hol land', fir st_name: ' Thomas', m iddle_name : 'Leroy',  gender: ' M', date_o f_birth: ' 1/1/1879'} ,
  658       {last_ name: 'Hyd e', first_ name: 'Jam es', middl e_name: 'F rancis Cla rk', gende r: 'M', da te_of_birt h: '1/1/18 94'},
  659       {last_ name: 'Jac kson', fir st_name: ' Stonewall' , middle_n ame: '', g ender: 'M' , date_of_ birth: '1/ 1/1891'},
  660       {last_ name: 'Joh nson', fir st_name: ' Herbert',  middle_nam e: 'Thomas ', gender:  'M', date _of_birth:  '1/1/1872 '},
  661       {last_ name: 'Kee rans Jr.',  first_nam e: 'Charle s', middle _name: 'Le slie', gen der: 'M',  date_of_bi rth: '1/1/ 1899'},
  662       {last_ name: 'Lac kland', fi rst_name:  'Frank', m iddle_name : 'Dorwin' , gender:  'M', date_ of_birth:  '1/1/1884' },
  663       {last_ name: 'Lay man', firs t_name: 'W alter', mi ddle_name:  'Gilbert' , gender:  'M', date_ of_birth:  '1/1/1888' },
  664       {last_ name: 'Lim ', first_n ame: 'Vice nte', midd le_name: ' ', gender:  'M', date _of_birth:  '1/1/1889 '},
  665       {last_ name: 'Lou tzenheiser ', first_n ame: 'Joe' , middle_n ame: 'L.',  gender: ' M', date_o f_birth: ' 1/1/1899'} ,
  666       {last_ name: 'Lym an', first _name: 'Al bert', mid dle_name:  'Kuali Bri ckwood', g ender: 'M' , date_of_ birth: '1/ 1/1885'},
  667       {last_ name: 'Lyo n', first_ name: 'Alf red', midd le_name: ' Jefferson' , gender:  'M', date_ of_birth:  '1/1/1892' },
  668       {last_ name: 'Mah in', first _name: 'Fr ank', midd le_name: ' Cadle', ge nder: 'M',  date_of_b irth: '1/1 /1887'},
  669       {last_ name: 'May nard', fir st_name: ' John', mid dle_name:  'Blackwell ', gender:  'M', date _of_birth:  '1/1/1887 '},
  670       {last_ name: 'McB ride', fir st_name: ' Allan', mi ddle_name:  'Clay', g ender: 'M' , date_of_ birth: '1/ 1/1885'},
  671       {last_ name: 'McC ornack', f irst_name:  'Condon',  middle_na me: 'Carlt on', gende r: 'M', da te_of_birt h: '1/1/18 80'},
  672       {last_ name: 'McD aniel', fi rst_name:  'Arthur',  middle_nam e: 'Bee',  gender: 'M ', date_of _birth: '1 /1/1895'},
  673       {last_ name: 'McN air', firs t_name: 'L esley', mi ddle_name:  'James',  gender: 'M ', date_of _birth: '1 /1/1883'},
  674       {last_ name: 'Nai den', firs t_name: 'E arl', midd le_name: ' Larue', ge nder: 'M',  date_of_b irth: '1/1 /1894'},
  675       {last_ name: 'Net herwood',  first_name : 'Douglas ', middle_ name: 'Bla ckshaw', g ender: 'M' , date_of_ birth: '1/ 1/1885'},
  676       {last_ name: 'New garden', f irst_name:  'Paul', m iddle_name : 'Wooleve r', gender : 'M', dat e_of_birth : '1/1/189 2'},
  677       {last_ name: 'Old s', first_ name: 'Rob ert', midd le_name: ' ', gender:  'M', date _of_birth:  '1/1/1896 '},
  678       {last_ name: 'Pat ch', first _name: 'Al exander',  middle_nam e: 'McCarr ell', gend er: 'M', d ate_of_bir th: '1/1/1 889'},
  679       {last_ name: 'Pat rick', fir st_name: ' Edwin', mi ddle_name:  'Davies',  gender: ' M', date_o f_birth: ' 1/1/1894'} ,
  680       {last_ name: 'Pat ton Jr.',  first_name : 'George' , middle_n ame: 'Smit h', gender : 'M', dat e_of_birth : '1/1/188 5'},
  681       {last_ name: 'Pen ington', f irst_name:  'Carlos',  middle_na me: 'Alden ', gender:  'M', date _of_birth:  '1/1/1878 '},
  682       {last_ name: 'Pow ell', firs t_name: 'W illiam', m iddle_name : 'Dan', g ender: 'M' , date_of_ birth: '1/ 1/1893'},
  683       {last_ name: 'Pra tt', first _name: 'Do n', middle _name: 'Fo rrester',  gender: 'M ', date_of _birth: '1 /1/1892'},
  684       {last_ name: 'Ram ey', first _name: 'Ho ward', mid dle_name:  'Knox', ge nder: 'M',  date_of_b irth: '1/1 /1896'},
  685       {last_ name: 'Rod erick', fi rst_name:  'Thomas',  middle_nam e: 'Edison ', gender:  'M', date _of_birth:  '1/1/1892 '},
  686       {last_ name: 'Roo sevelt Jr. ', first_n ame: 'Theo dore', mid dle_name:  '', gender : 'M', dat e_of_birth : '1/1/188 7'},
  687       {last_ name: 'Ros e', first_ name: 'Mau rice', mid dle_name:  '', gender : 'M', dat e_of_birth : '1/1/189 9'},
  688       {last_ name: 'Rus sell', fir st_name: ' Clinton',  middle_nam e: 'Warden ', gender:  'M', date _of_birth:  '1/1/1891 '},
  689       {last_ name: 'San tos', firs t_name: 'P aulino', m iddle_name : 'Torres' , gender:  'M', date_ of_birth:  '1/1/1890' },
  690       {last_ name: 'Sea rby', firs t_name: 'E dmund', mi ddle_name:  'Wilson',  gender: ' M', date_o f_birth: ' 1/1/1896'} ,
  691       {last_ name: 'Seg undo Y Ven tura', fir st_name: ' Fidel', ge nder: 'M',  date_of_b irth: '1/1 /1894'},
  692       {last_ name: 'Tay lor', firs t_name: 'V ictor', mi ddle_name:  'Vaughan' , gender:  'M', date_ of_birth:  '1/1/1893' },
  693       {last_ name: 'Tay lor', firs t_name: 'W illis', mi ddle_name:  'Ratcliff e', gender : 'M', dat e_of_birth : '1/1/189 7'},
  694       {last_ name: 'Tin ker', firs t_name: 'C larence',  middle_nam e: 'Leonar d', gender : 'M', dat e_of_birth : '1/1/188 7'},
  695       {last_ name: 'Wal ker', firs t_name: 'K enneth', m iddle_name : 'Newton' , gender:  'M', date_ of_birth:  '1/1/1898' },
  696       {last_ name: 'Wal ker', firs t_name: 'N elson', mi ddle_name:  'Macy', g ender: 'M' , date_of_ birth: '1/ 1/1891'},
  697       {last_ name: 'Was h', first_ name: 'Car lyle', mid dle_name:  'Hilton',  gender: 'M ', date_of _birth: '1 /1/1889'},
  698       {last_ name: 'Wat son', firs t_name: 'E dwin', mid dle_name:  'Martin',  gender: 'M ', date_of _birth: '1 /1/1883'},
  699       {last_ name: 'Wea ver', firs t_name: 'W alter', mi ddle_name:  'Reed', g ender: 'M' , date_of_ birth: '1/ 1/1885'},
  700       {last_ name: 'Wee d', first_ name: 'Fra nk', middl e_name: 'W atkins', g ender: 'M' , date_of_ birth: '1/ 1/1881'},
  701       {last_ name: 'Wha rton', fir st_name: ' James', mi ddle_name:  'Edward',  gender: ' M', date_o f_birth: ' 1/1/1894'} ,
  702       {last_ name: 'Wil son', firs t_name: 'R ussell', m iddle_name : 'Alger',  gender: ' M', date_o f_birth: ' 1/1/1905'} ,
  703       {last_ name: 'Win g', first_ name: 'Leo nard', mid dle_name:  'Fish', ge nder: 'M',  date_of_b irth: '1/1 /1893'}
  704     ]
  705  
  706     TOTAL_VE TERAN_COUN T = (RANDO MIZED_VETE RAN_COUNT  + US_GENER ALS.count)
  707  
  708     RANDOMIZ ED_VETERAN _COUNT.tim es do |vet eran_numbe r|
  709  
  710       puts " Fake Veter an #{veter an_number+ 1} of #{RA NDOMIZED_V ETERAN_COU NT}."
  711  
  712       vetera n_record   = Seeder:: VeteranSee d.new(vete ran_number ).veteran
  713       vetera n_id       = veteran_ record.id
  714  
  715       5.time s do |cons ultation_n umber|
  716         cons ultation_r ecord = Se eder::Cons ultationSe ed.new(vet eran_recor d.id, cons ultation_n umber).con sultation
  717         cons ultation_i d     = co nsultation _record.id
  718  
  719         20.t imes do |r eferral_nu mber|
  720           re ferral_see d_record   = Seeder:: ReferralSe ed.new(vet eran_id, c onsultatio n_id, refe rral_numbe r)
  721           re ferral_id             = referral _seed_reco rd.referra l.id
  722  
  723           2. times do | referral_n ote_number |
  724              Seeder::Re ferralNote Seed.new(v eteran_id,  consultat ion_id, re ferral_id,  referral_ note_numbe r)
  725           en d
  726  
  727           2. times do | referral_a ppointment _number|
  728              Seeder::Re ferralAppo intmentSee d.new(vete ran_id, co nsultation _id, refer ral_id, re ferral_app ointment_n umber)
  729           en d
  730  
  731           2. times do | referral_a pproval_nu mber|
  732              Seeder::Re ferralAppr ovalSeed.n ew(veteran _id, consu ltation_id , referral _id, refer ral_approv al_number)
  733           en d
  734  
  735           2. times do | referral_d ocument_nu mber|
  736              Seeder::Re ferralDocu mentSeed.n ew(veteran _id, consu ltation_id , referral _id, refer ral_docume nt_number)
  737           en d
  738  
  739         end  # 20.times  do |refer ral_number |
  740       end #  5.times do  |consulta tion_numbe r|
  741     end # RA NDOMIZED_V ETERAN_COU NT.times d o |veteran _number|
  742  
  743  
  744     print "A dding Worl d War II h eroes with  fake SSNs  ... "
  745     US_GENER ALS.each_w ith_index  do |us_gen eral_data,  usg_index |
  746       vet_nu mber = RAN DOMIZED_VE TERAN_COUN T + usg_in dex + 1
  747       Seeder ::VeteranS eed.new((v et_number) , us_gener al_data)
  748     end
  749     puts "Do ne."
  750  
  751   end # if R ails.env = = "develop ment"