108. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/14/2017 1:27:59 PM Eastern Standard 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.

108.1 Files compared

# Location File Last Modified
1 CUI-CPP-v2.3.2-source.zip\db seeds.rb Mon Nov 20 23:19:07 2017 UTC
2 CUI-CPP-v2.3.2-source.zip\db seeds.rb Tue Dec 12 20:37:57 2017 UTC

108.2 Comparison summary

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

108.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

108.4 Active regular expressions

No regular expressions were active.

108.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       common _fields: {  deleted_a t: nil },
  38       column _mappings:  ['sequenc e','title' ],
  39       use_co py_from: f alse
  40     )
  41   end
  42  
  43   unless see d_from_sql (Visn, res et_only: f alse)
  44     load_sta tic_text_t able_from_ csv(
  45       klass:              Visn,
  46       column _mappings:  ['sequenc e','delete d_at','reg ion','name '],
  47       use_co py_from: f alse
  48     )
  49   end
  50  
  51   unless see d_from_sql (Site, res et_only: t rue)
  52     load_sta tic_text_t able_from_ csv(
  53       klass:              Site,
  54       column _mappings:   ['name', 'address', 'city','st ate','zip_ code','sit e_station_ number'],
  55       common _fields:     {country : 'USA'},
  56       use_co py_from:     false
  57     )
  58   end
  59  
  60   unless see d_from_sql (Diagnosis Code, rese t_only: tr ue)
  61     load_sta tic_text_t able_from_ csv(
  62       klass:   Diagnosi sCode,
  63       column _mappings:  ['version _code','de scription' ],
  64       use_co py_from:     false
  65     )
  66   end
  67  
  68   unless see d_from_sql ( Clinic,  reset_only : true)
  69     load_sta tic_text_t able_from_ csv(
  70       klass:              Clinic,
  71       column _mappings:   ['site_i d','clinic _id','name '],
  72       use_co py_from:     false
  73     )
  74   end
  75  
  76  
  77   ### Load i ssue categ ories for  DOM-127 Re quest for  Support ## #
  78   %w[
  79     Performa nce
  80     Security
  81     Function al
  82     Access
  83     Forgot_P assword
  84     Other
  85   ].each do  |category|
  86     SupportR equestCate gory.find_ or_create_ by(name: c ategory.gs ub('_', '  ').titleca se)
  87   end
  88  
  89   org1 = Sup portReques tOrganizat ion.create (short_nam e: "C&P",  long_name: "Compensat ion and Pe nsion")
  90  
  91   org2 = Sup portReques tOrganizat ion.create (short_nam e: "CPP",  long_name: "Community  Provider  Portal")
  92  
  93   ########## ########## ########## ########## ########## ########## #
  94  
  95  
  96   ########## ########## ########## ########## ########## #######
  97   ## define  the Referr alStatus
  98  
  99   print "Loa ding stati c text for  ReferralS tatus ...  "
  100  
  101   [
  102     {
  103       status :                "new ",
  104       update _descripti on:   "",
  105       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
  106       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
  107     },
  108     {
  109       status :                "pre p",
  110       update _descripti on:   "The  Referral  is being p repared fo r the Comm unity Prov ider.",
  111       referr al_queue:        "vha _cc",
  112       filter able_by_ro les:  "vha _cc"
  113     },
  114     {
  115       status :                "ass igned",
  116       update _descripti on:   "The  Referral  contains a ll medical  informati on needed  for the fi rst visit  and has be en assigne d to a Com munity Pro vider. <b> Note:</b>  The Commun tiy Provid er will re ceive a sy stem-gener ated notif ication em ail as soo n as the < b>Submit</ b> button  below is c licked.",
  117       referr al_queue:        "vha _cc, non_v ha",
  118       filter able_by_ro les:  "vha _cc, non_v ha"
  119     },
  120     {
  121       status :                "acc epted",
  122       update _descripti on:   "The  Community  Provider  has succes sfully ret urned medi cal record s for the  first appo intment. A dditional  appointmen ts and med ical docum ents are e xpected.",
  123       referr al_queue:        "non _vha",
  124       filter able_by_ro les:  "vha _cc, non_v ha"
  125     },
  126     {
  127       status :                "rev iew_pendin g",
  128       update _descripti on:   "The  Referral  has been s ent to the  VA for ap proval.",
  129       referr al_queue:        "vha _cc, non_v ha",
  130       filter able_by_ro les:  "vha _cc, non_v ha"
  131     },
  132     {
  133       status :                "inf ormation_n eeded",
  134       update _descripti on:   "The  Referral  has been r eviewed an d returned  to the Co mmunity Pr ovider wit h a reques t for addi tional inf ormation." ,
  135       referr al_queue:        "vha _cc, non_v ha",
  136       filter able_by_ro les:  "vha _cc, non_v ha"
  137     },
  138     {
  139       status :                "com plete",
  140       update _descripti on:   "The  Referral  is complet e and all  medical do cument hav e been rec eived.",
  141       referr al_queue:        "",
  142       filter able_by_ro les:  "vha _cc, non_v ha"
  143     }
  144   ].each do  |entry|
  145     Referral Status.fin d_or_creat e_by(
  146       name:                   entr y[:status] .gsub('_',  ' ').titl ecase,
  147       code:                   entr y[:status] .upcase,
  148       update _descripti on:   entr y[:update_ descriptio n],
  149       referr al_queue:        entr y[:referra l_queue].d owncase,
  150       filter able_by_ro les:  entr y[:filtera ble_by_rol es].downca se
  151     )
  152   end
  153  
  154   puts "done "
  155  
  156   ########## ########## ########## ########## ########## #######
  157   ## define  the test E xamination State
  158  
  159   print "Loa ding stati c text for  Examinati onState .. . "
  160  
  161   # FIXME: s pelling er ror: Cance led not Ca ncelled
  162   %w[
  163     Pending
  164     Ready_to _be_Schedu led
  165     Schedule d
  166     In_Progr ess
  167     Complete d
  168     Reviewed
  169     Submitte d
  170     Rejected
  171     Pending_ Cancellati on
  172     Canceled
  173     Reschedu le
  174   ].each do  |status|
  175     Examinat ionState.f ind_or_cre ate_by(nam e: status. gsub('_',  ' ').title case, code : status.u pcase)
  176   end
  177  
  178   puts "done "
  179  
  180  
  181   ########## ########## ########## ########## ########## #######
  182   ## define  the test E xamRequest State
  183  
  184   print "Loa ding stati c text for  ExamReque stState .. . "
  185  
  186   # FIXME: s pelling er ror Cancel ed not Can celled
  187   %w[
  188     New
  189     In_Progr ess
  190     Pending_ Reported
  191     Pending_ Cancellati on
  192     Canceled
  193     Canceled _by_MAS
  194     Canceled _by_RO
  195     Complete d
  196     Complete d_Printed_ by_RO
  197     Released _to_RO_Not _Printed
  198     Rerouted _New
  199     Rerouted _Accepted
  200     Rerouted _Rejected
  201   ].each do  |status|
  202     ExamRequ estState.f ind_or_cre ate_by(nam e: status. gsub('_',  ' ').title case, code : status.u pcase)
  203   end
  204  
  205   puts "done "
  206  
  207  
  208   ########## ########## ########## ########## ########## #######
  209   ## define  the test C larificati onType
  210  
  211   print "Loa ding stati c text for  Clarifica tionType . .. "
  212  
  213   %w[
  214     Request
  215     Response
  216   ].each do  |status|
  217     Clarific ationType. find_or_cr eate_by(na me: status .gsub('_',  ' ').titl ecase, cod e: status. upcase)
  218   end
  219  
  220   puts "done "
  221  
  222  
  223   ########## ########## ########## ########## ########## #######
  224   ## Loading  the data  from db/ec m_seeds.rb  via
  225   ## rake ev al_con_man :seed
  226   ##
  227   ## The fol lowing mod els are im pacted:
  228   ##      Di agnosisMod ifier
  229   ##      Di agnosis
  230   ##      Dm Assignment
  231   ##      Sy mptom
  232   ##      Mi norSystem
  233   ##      Ma jorSystem
  234   ##      Ev aluationTe mplate
  235  
  236  
  237   print "Inv oking rake  task eval _con_man:s eed ... "
  238   unless Eva luationTem plate.exis ts? 
  239     Rake::Ta sk["eval_c on_man:see d"].invoke
  240  
  241     puts "do ne"
  242  
  243     print "I nvoking ra ke task ev al_con_man :load_html  ..."
  244  
  245     Rake::Ta sk["eval_c on_man:loa d_html"].i nvoke
  246  
  247     puts "do ne"
  248   end
  249  
  250   ########## ########## ########## ########## ########## #######
  251   ## Loading  the data  from db/vb ms_r_fg_in it.rb via
  252   ## rake vb ms_r_fg:in it
  253   ##
  254   ## The fol lowing mod els are im pacted:
  255   ##      Vb msRFactGro up
  256  
  257   print "Inv oking rake  task vbms _r_fg:init  ... "
  258  
  259   Rake::Task ["vbms_r_f g:init"].i nvoke
  260  
  261   puts "done "
  262  
  263     ######## ########## ########## ########## ########## ########## ########## ########## #
  264     #### Sit es - The b elow 5 sit es were pr ovided ear lier in th e project
  265     #### The se sites h ave to be  created ou tside the  'developme nt' test d ata sectio n
  266     #### as  they are v alid sites
  267     #### (Th ese sites  cannot be  moved to t he sites c sv file as  they are  being used
  268     #### (Se e below fo r details  on these s ites usage )
  269     ######## ########## ########## ########## ########## ########## ########## ########## #
  270  
  271     print "C reating th e 7 additi onal sites  ... "
  272  
  273     site1 =  Site.find_ or_create_ by(
  274                  name:  "Chicago M edical Cen ter",
  275                  addres s: "1111 S ilver Aven ue",
  276                  city:  "Chicago",
  277                  state:  "IL",
  278                  zip_co de: "60611 ",
  279                  countr y: "USA")
  280  
  281     site2 =  Site.find_ or_create_ by(
  282                  name:  "Dallas VA  Clinic",
  283                  addres s: "2222 R ush Avenue ",
  284                  city:  "Dallas",
  285                  state:  "TX",
  286                  zip_co de: "75418 ",
  287                  countr y: "USA")
  288  
  289     site3 =  Site.find_ or_create_ by(
  290                  name:  "QTC",
  291                  site_s tation_num ber: "QTC  VBA Vendor ",
  292                  addres s: "21700  Copley Dr. , Ste 200" ,
  293                  city:  "Diamond B ar",
  294                  state:  "CA",
  295                  zip_co de: "91765 -2219",
  296                  countr y: "USA")
  297  
  298     site4 =  Site.find_ or_create_ by(
  299                  name:  "VES",
  300                  site_s tation_num ber: "VES  VBA Vendor ",
  301                  addres s: "2707 N orth Loop  W., Suite  1000",
  302                  city:  "Houston",
  303                  state:  "TX",
  304                  zip_co de: "77008 ",
  305                  countr y: "USA")
  306  
  307     site5 =  Site.find_ or_create_ by(
  308                  name:  "VetFed",
  309                  site_s tation_num ber: "VetF ed VBA Ven dor",
  310                  addres s: "21700  Copley Dr. , Ste 200" ,
  311                  city:  "Diamond B ar",
  312                  state:  "CA",
  313                  zip_co de: "91765 -2219",
  314                  countr y: "USA")
  315  
  316     site6 =  Site.find_ or_create_ by(
  317                  name:  "Atlanta V A Medical  Center",
  318                  site_s tation_num ber: "508" ,
  319                  addres s: "1670 C lairmont R oad",
  320                  city:  "Decatur",
  321                  state:  "GA",
  322                  zip_co de: "30033 ",
  323                  countr y: "USA")
  324  
  325     site7 =  Site.find_ or_create_ by(
  326                  name:  "CSRA ITC" ,
  327                  site_s tation_num ber: "777" ,
  328                  addres s: "6300 T exas Ave." ,
  329                  city:  "Bossier C ity",
  330                  state:  "LA",
  331                  zip_co de: "71111 ",
  332                  countr y: "USA")
  333  
  334     puts "do ne"
  335   ########## ########## ########## ########## ########## #######
  336   ## make up  some test  data for  developmen t
  337  
  338   if Rails.e nv.develop ment?  &&   DBRESET
  339  
  340     puts "\n Loading de velopment  test data. "
  341  
  342  
  343     ######## ########## ########## ########## ########## #########
  344     ## defin e test fac ilities an d provider s
  345  
  346     unless s eed_from_s ql( Facili ty, Provid er, reset_ only: true  )
  347       puts " \n... Faci lities tab le."
  348  
  349       50.tim es do |fac ility_numb er|
  350         faci lity_recor d = Seeder ::Facility Seed.new(f acility_nu mber)
  351       end
  352  
  353       puts " \n... Prov ider table  from NPI  Registry w ith zip co des ..."
  354  
  355       zipcod es = %w[20 002 23233  71111 7350 1]
  356  
  357       zipcod es.each do  |postal_c ode|
  358         prin tf "%s ",  postal_cod e
  359         NpiR egistry.fi lter('post al_code' = > postal_c ode)
  360       end
  361       puts " done"
  362     end
  363  
  364  
  365  
  366     ######## ########## ########## ########## ########## #########
  367     ## defin e test use rs
  368  
  369     puts ".. . User tab le."
  370  
  371     medical_ assistant  = User.cre ate(
  372                  email:  "team@adh octeam.us" ,
  373                  passwo rd: "Sms!1 23456789",
  374                  first_ name: "Med ical",
  375                  last_n ame: "Assi stant",
  376                  author ization_st ate: 'auth orized',
  377                  roles:  ['medical _assistant ']) unless  User.exis ts?(email:  "team@adh octeam.us" )
  378  
  379     supervis or = User. create(
  380                  email:  "supervis or@adhocte am.us",
  381                  passwo rd: "Sms!1 23456789",
  382                  first_ name: "Sup er",
  383                  last_n ame: "Viso r",
  384                  author ization_st ate: 'auth orized',
  385                  roles:  ['supervi sor']) unl ess User.e xists?(ema il: "super visor@adho cteam.us")
  386  
  387     examiner  = User.cr eate(
  388                  email:  "examiner @adhocteam .us",
  389                  passwo rd: "Sms!1 23456789",
  390                  first_ name: "Exa m",
  391                  last_n ame: "Iner ",
  392                  author ization_st ate: 'auth orized',
  393                  roles:  ["examine r"]) unles s User.exi sts?(email : "")
  394  
  395     app_admi n = User.c reate(
  396                  email:  "samantha @smith.com ",
  397                  passwo rd: "Sms!1 23456789",
  398                  author ization_st ate: "auth orized",
  399                  first_ name: "Sam antha",
  400                  last_n ame: "Smit h",
  401                  # FIXM E: at the  end of CPP  sprint 15  these two  lines wer e removed
  402                  #         from th e integrat ion branch .  So if t hey are tr uly not ne eded,
  403                  #         come ba ck here an d delete t his dead c ode in a f uture spri nt.
  404                  # auth orization_ state: 'au thorized',
  405                  roles:  ["app_adm in"]) unle ss User.ex ists?(emai l: "samant ha@smith.c om")
  406  
  407     site_use r1 = User. create(
  408                  email:  "mike@wal lace.com",
  409                  passwo rd: "Sms!1 23456789",
  410                  author ization_st ate: "auth orized",
  411                  first_ name: "Mik e",
  412                  last_n ame: "Wall ace") unle ss User.ex ists?(emai l: "mike@w allace.com ")
  413  
  414     site_use r2 = User. create(
  415                  email:  "eric@wil son.com",
  416                  passwo rd: "Sms!1 23456789",
  417                  author ization_st ate: "auth orized",
  418                  first_ name: "Eri c",
  419                  last_n ame: "Wils on") unles s User.exi sts?(email : "eric@wi lson.com")
  420  
  421     all_role s_QTC_user  = User.cr eate(
  422                  email:  "all@qtc. com",
  423                  passwo rd: "Sms!1 23456789",
  424                  author ization_st ate: "auth orized",
  425                  first_ name: "All ",
  426                  last_n ame: "Qtc" ) unless U ser.exists ?(email: " all@qtc.co m")
  427  
  428     admin_QT C_user = U ser.create (
  429                  email:  "admin@qt c.com",
  430                  passwo rd: "Sms!1 23456789",
  431                  author ization_st ate: "auth orized",
  432                  first_ name: "Adm in",
  433                  last_n ame: "Qtc" ) unless U ser.exists ?(email: " admin@qtc. com")
  434  
  435     triage_Q TC_user =  User.creat e(
  436                  email:  "triage@q tc.com",
  437                  passwo rd: "Sms!1 23456789",
  438                  author ization_st ate: "auth orized",
  439                  first_ name: "Tri age",
  440                  last_n ame: "Qtc" ) unless U ser.exists ?(email: " triage@qtc .com")
  441  
  442     scheduli ng_QTC_use r = User.c reate(
  443                  email:  "scheduli ng@qtc.com ",
  444                  passwo rd: "Sms!1 23456789",
  445                  author ization_st ate: "auth orized",
  446                  first_ name: "Sch eduling",
  447                  last_n ame: "Qtc" ) unless U ser.exists ?(email: " scheduling @qtc.com")
  448  
  449     clinicia n_QTC_user  = User.cr eate(
  450                  email:  "clinicia n@qtc.com" ,
  451                  passwo rd: "Sms!1 23456789",
  452                  author ization_st ate: "auth orized",
  453                  first_ name: "Cli nician",
  454                  last_n ame: "Qtc" ) unless U ser.exists ?(email: " clinician@ qtc.com")
  455  
  456     sclinici an_QTC_use r = User.c reate(
  457                  email:  "super_cl inician@qt c.com",
  458                  passwo rd: "Sms!1 23456789",
  459                  author ization_st ate: "auth orized",
  460                  first_ name: "Sup er",
  461                  last_n ame: "Qtc" ) unless U ser.exists ?(email: " super_clin ician@qtc. com")
  462  
  463     qa_QTC_u ser = User .create(
  464                  email:  "qa@qtc.c om",
  465                  passwo rd: "Sms!1 23456789",
  466                  author ization_st ate: "auth orized",
  467                  first_ name: "Qa" ,
  468                  last_n ame: "Qtc" ) unless U ser.exists ?(email: " qa@qtc.com ")
  469  
  470     # CPP-sp ecific tes t users
  471  
  472     cheryl_h oward_npis  = %w(
  473       104330 3563
  474       108308 9809
  475       122518 2579
  476       122534 0383
  477       129512 4063
  478       129586 2415
  479       136649 9295
  480       159819 9259
  481       165969 6045
  482       171034 2811
  483     )
  484  
  485     vha_cc =  User.crea te(
  486                  email:  "vha_cc@e xample.com ",
  487                  passwo rd: "Sms!1 23456789",
  488                  first_ name: "VHA  CC",
  489                  last_n ame: "Test User",
  490                  author ization_st ate: 'auth orized',
  491                  roles:  ["vha_cc" ]) unless  User.exist s?(email:  "vha_cc@ex ample.com" )
  492  
  493     non_vha  = User.cre ate(
  494                  email:  "non_vha@ example.co m",
  495                  passwo rd: "Sms!1 23456789",
  496                  first_ name: "Non  VHA",
  497                  last_n ame: "Test User",
  498                  author ization_st ate: 'auth orized',
  499                  npi: c heryl_howa rd_npis.po p,
  500                  roles:  ["non_vha "]) unless  User.exis ts?(email:  "non_vha@ example.co m")
  501  
  502     vha_cc2  = User.cre ate(
  503                  email:  "vhacc.cp ptestuser@ gmail.com" ,
  504                  passwo rd: "Sms!1 23456789",
  505                  first_ name: "VHA  CC2",
  506                  last_n ame: "Test User",
  507                  author ization_st ate: 'auth orized',
  508                  roles:  ["app_adm in","vha_c c"]) unles s User.exi sts?(email : "vhacc.c pptestuser @gmail.com ")
  509  
  510     non_vha2  = User.cr eate(
  511                  email:  "nonvha.c pptestuser @gmail.com ",
  512                  passwo rd: "Sms!1 23456789",
  513                  first_ name: "Non  VHA2",
  514                  last_n ame: "Test User",
  515                  author ization_st ate: 'auth orized',
  516                  npi: c heryl_howa rd_npis.po p(2),
  517                  roles:  ["non_vha "]) unless  User.exis ts?(email:  "nonvha.c pptestuser @gmail.com ")
  518  
  519     vha_cc3  = User.cre ate(
  520                  email:  " PII                   ",
  521                  passwo rd: "Sms!1 23456789",
  522                  first_ name: "Amy ",
  523                  last_n ame: "Rose nthal",
  524                  author ization_st ate: 'auth orized',
  525                    roles: ["v ha_cc"]) u nless User .exists?(e mail: " PII                    ")
  526  
  527     non_vha3  = User.cr eate(
  528                  email:  "arosenth al@meetver acity.com" ,
  529                  passwo rd: "Sms!1 23456789",
  530                  first_ name: "Amy ",
  531                  last_n ame: "Rose nthal",
  532                  author ization_st ate: 'auth orized',
  533                  npi: c heryl_howa rd_npis.po p(2),
  534                  roles:  ["non_vha "]) unless  User.exis ts?(email:  "arosenth al@meetver acity.com" )
  535  
  536     non_vha4  = User.cr eate(
  537                  email:  "tmcmurdo @meetverac ity.com",
  538                  passwo rd: "Sms!1 23456789",
  539                  first_ name: "The resa",
  540                  last_n ame: "McMu rdo",
  541                  author ization_st ate: 'auth orized',
  542                  npi: c heryl_howa rd_npis.po p(2),
  543                  roles:  ["non_vha "]) unless  User.exis ts?(email:  "tmcmurdo @meetverac ity.com")
  544  
  545     non_vha5  = User.cr eate(
  546                  email:  "jrobinso n@meetvera city.com",
  547                  passwo rd: "Sms!1 23456789",
  548                  first_ name: "Jef f",
  549                  last_n ame: "Robi nson",
  550                  author ization_st ate: 'auth orized',
  551                  npi: c heryl_howa rd_npis.po p(2),
  552                  roles:  ["non_vha "]) unless  User.exis ts?(email:  "jrobinso n@meetvera city.com")
  553  
  554  
  555     # Adding  customer  test accou nts for CP P
  556     customer _test_acco unts = %w[
  557        PII                         
  558        PII                      
  559        PII                
  560     ].each d o |email|
  561       name =  email.spl it('@').fi rst.split( '.')
  562       User.c reate(
  563                  email:                  emai l,
  564                  passwo rd:              "Sms !123456789 ",
  565                  first_ name:            name .first,
  566                  last_n ame:             name .last,
  567                  author ization_st ate:  'aut horized',
  568                  roles:                  ["vh a_cc"]) un less User. exists?(em ail: email )
  569  
  570     end
  571  
  572  
  573     # add em pty UserPr eference o bject to e ach user,  with time  zone
  574     # corres ponding to  index
  575     US_TIME_ ZONES = Ac tiveSuppor t::TimeZon e.us_zones .map &:nam e
  576     User.all .each_with _index do  |user, ind ex|
  577       time_z one_string      = US_ TIME_ZONES [index % U S_TIME_ZON ES.count]
  578       user.u ser_prefer ence = Use rPreferenc e.new(time _zone: tim e_zone_str ing)
  579       if use r.is_vha_c c?
  580         user .user_pref erence.vis ta_duz        = 'mLb+ ZHYXCWt7R9 WvfFhWHBwd OKeT5ZsuZJ OmjLIU8ko= '
  581         user .user_pref erence.vis ta_user_na me = 'WASH ,PAUL E'
  582         user .user_pref erence.vis ta_site_id    = '516'
  583         user .user_pref erence.sav e(validati on: false)
  584       end
  585       user.s ave(valida tion: fals e)
  586     end
  587  
  588     ######## ########## ########## ########## ########## #########
  589     ## Updat ing test u ser's site  and roles
  590  
  591     puts ".. . Adding s ite and si te roles t o CUI-user s."
  592  
  593     app_admi n.present?  ? (app_ad min.add_si te(site3);  app_admin .get_site_ roles(site 3).update( admin: tru e, triage:  true, sch eduling: t rue, clini cian: true , super_cl inician: t rue, qa: t rue)) : fa lse
  594     app_admi n.present?  ? (app_ad min.add_si te(site6);  app_admin .get_site_ roles(site 6).update( admin: tru e, triage:  true, sch eduling: t rue, clini cian: true , super_cl inician: t rue, qa: t rue)) : fa lse
  595     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
  596     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
  597     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
  598     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
  599     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
  600     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
  601     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
  602     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
  603     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
  604  
  605  
  606     ######## ########## ########## ########## ########## #########
  607     ## Addin g the Eval uation spe cs
  608  
  609     puts ".. . Evaluati onSpec tab le."
  610  
  611     ######## ########## ########## ########## ########## #########
  612     ## Seed  the Evalua tion Specs
  613  
  614     seed_spe cs_log = F ile.open(L OG_DIR+'se ed_specs.l og','w')
  615  
  616     print ". .. Executi ng Evaluat ionSpec.sy nc_specs . .. "
  617     Evaluati onSpec.syn c_specs(ni l, "app/ex ams/*.yml" , seed_spe cs_log)
  618     puts "do ne"
  619  
  620     seed_spe cs_log.clo se
  621  
  622     ######## ########## ########## ########## ########## ##########
  623     ## Send  exam reque sts to CUI
  624  
  625     puts ".. . Seeding  exam reque sts in CUI "
  626  
  627     seed_fro m_sql( Cla im, ExamRe quest, Con tention, C ontentionD etail, Con tentionsDb qInformati on, Conten tionObject , RequestO bject, res et_only: t rue )
  628  
  629     puts "Do ne"
  630  
  631  
  632     ######## ########## ########## ########## ########## #########
  633     ## defin e test Vet eran, cons ultation,  referral
  634     ## TODO:  add test  data for t he sub-ref erral tabl es
  635  
  636     puts "\n ... Vetera n, Consult ation, Ref erral tabl es."
  637  
  638     RANDOMIZ ED_VETERAN _COUNT = 1 0
  639  
  640     # PP-496 : adding m ore test v eterans na med after  famous U.S . Generals  who died  in WWII
  641     US_GENER ALS = [
  642       {last_ name: 'And ersen', fi rst_name:  'James', m iddle_name : 'Roy', g ender: 'M' , date_of_ birth: '1/ 1/1904'},
  643       {last_ name: 'And erson', fi rst_name:  'Alexander ', middle_ name: 'Edw ard', gend er: 'M', d ate_of_bir th: '1/1/1 889'},
  644       {last_ name: 'And rews', fir st_name: ' Frank', mi ddle_name:  'Maxwell' , gender:  'M', date_ of_birth:  '1/1/1884' },
  645       {last_ name: 'Bar th Jr.', f irst_name:  'Charles' , middle_n ame: 'Henr y', gender : 'M', dat e_of_birth : '1/1/190 3'},
  646       {last_ name: 'Ber man', firs t_name: 'M orris', mi ddle_name:  '', gende r: 'M', da te_of_birt h: '1/1/18 91'},
  647       {last_ name: 'Bou dinot', fi rst_name:  'Truman',  middle_nam e: 'Everet t', gender : 'M', dat e_of_birth : '1/1/189 5'},
  648       {last_ name: 'Bra nn', first _name: 'Do nald', mid dle_name:  'Weldon',  gender: 'M ', date_of _birth: '1 /1/1895'},
  649       {last_ name: 'Bra un Jr.', f irst_name:  'Gustav',  middle_na me: 'Josep h', gender : 'M', dat e_of_birth : '1/1/189 5'},
  650       {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'},
  651       {last_ name: 'Car rington',  first_name : 'Gordon' , middle_n ame: 'de L auney', ge nder: 'M',  date_of_b irth: '1/1 /1894'},
  652       {last_ name: 'Cas tle', firs t_name: 'F rederick',  middle_na me: 'Walke r', gender : 'M', dat e_of_birth : '1/1/190 8'},
  653       {last_ name: 'Cha mberlin',  first_name : 'Harry',  middle_na me: 'Dwigh t', gender : 'M', dat e_of_birth : '1/1/188 7'},
  654       {last_ name: 'Cra ig', first _name: 'Ma lin', midd le_name: ' ', gender:  'M', date _of_birth:  '1/1/1875 '},
  655       {last_ name: 'Dal ton II', f irst_name:  'James',  middle_nam e: 'Leo',  gender: 'M ', date_of _birth: '1 /1/1910'},
  656       {last_ name: 'Dar by', first _name: 'Wi lliam', mi ddle_name:  'Orlando' , gender:  'M', date_ of_birth:  '1/1/1911' },
  657       {last_ name: 'Dar gue', firs t_name: 'H erbert', m iddle_name : 'Arthur' , gender:  'M', date_ of_birth:  '1/1/1886' },
  658       {last_ name: 'Dav is', first _name: 'Dw ight', mid dle_name:  'Filley',  gender: 'M ', date_of _birth: '1 /1/1879'},
  659       {last_ name: 'Dav ison', fir st_name: ' Donald', m iddle_name : 'Angus',  gender: ' M', date_o f_birth: ' 1/1/1892'} ,
  660       {last_ name: 'De  Jesus', fi rst_name:  'Simeon',  middle_nam e: '', gen der: 'M',  date_of_bi rth: '1/1/ 1894'},
  661       {last_ name: 'Dun can', firs t_name: 'A sa', middl e_name: 'N orth', gen der: 'M',  date_of_bi rth: '1/1/ 1892'},
  662       {last_ name: 'Eas ley', firs t_name: 'C laudius',  middle_nam e: 'Miller ', gender:  'M', date _of_birth:  '1/1/1891 '},
  663       {last_ name: 'Eat on', first _name: 'Wi lliam', mi ddle_name:  'Herbert' , gender:  'M', date_ of_birth:  '1/1/1906' },
  664       {last_ name: 'Eme ry', first _name: 'Am brose', mi ddle_name:  'Robert',  gender: ' M', date_o f_birth: ' 1/1/1883'} ,
  665       {last_ name: 'For rest', fir st_name: ' Nathan', m iddle_name : 'Bedford ', gender:  'M', date _of_birth:  '1/1/1905 '},
  666       {last_ name: 'For t', first_ name: 'Guy ', middle_ name: 'Osb orne', gen der: 'M',  date_of_bi rth: '1/1/ 1879'},
  667       {last_ name: 'Gar dner', fir st_name: ' John', mid dle_name:  'Henry', g ender: 'M' , date_of_ birth: '1/ 1/1893'},
  668       {last_ name: 'Gar lington',  first_name : 'Creswel l', middle _name: '',  gender: ' M', date_o f_birth: ' 1/1/1887'} ,
  669       {last_ name: 'Geo rge', firs t_name: 'H arold', mi ddle_name:  'Huston',  gender: ' M', date_o f_birth: ' 1/1/1892'} ,
  670       {last_ name: 'Gib bons', fir st_name: ' Lloyd', mi ddle_name:  'Henry',  gender: 'M ', date_of _birth: '1 /1/1895'},
  671       {last_ name: 'God frey', fir st_name: ' Stuart', m iddle_name : 'Chapin' , gender:  'M', date_ of_birth:  '1/1/1886' },
  672       {last_ name: 'Goo drich', fi rst_name:  'Donald',  middle_nam e: 'Reuben ', gender:  'M', date _of_birth:  '1/1/1894 '},
  673       {last_ name: 'Gra ves', firs t_name: 'D avis', mid dle_name:  'Dunbar',  gender: 'M ', date_of _birth: '1 /1/1903'},
  674       {last_ name: 'Har mon Jr.',  first_name : 'Millard ', middle_ name: 'Fil lmore', ge nder: 'M',  date_of_b irth: '1/1 /1888'},
  675       {last_ name: 'Har ms', first _name: 'He nry', midd le_name: ' William',  gender: 'M ', date_of _birth: '1 /1/1887'},
  676       {last_ name: 'Hol land', fir st_name: ' Thomas', m iddle_name : 'Leroy',  gender: ' M', date_o f_birth: ' 1/1/1879'} ,
  677       {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'},
  678       {last_ name: 'Jac kson', fir st_name: ' Stonewall' , middle_n ame: '', g ender: 'M' , date_of_ birth: '1/ 1/1891'},
  679       {last_ name: 'Joh nson', fir st_name: ' Herbert',  middle_nam e: 'Thomas ', gender:  'M', date _of_birth:  '1/1/1872 '},
  680       {last_ name: 'Kee rans Jr.',  first_nam e: 'Charle s', middle _name: 'Le slie', gen der: 'M',  date_of_bi rth: '1/1/ 1899'},
  681       {last_ name: 'Lac kland', fi rst_name:  'Frank', m iddle_name : 'Dorwin' , gender:  'M', date_ of_birth:  '1/1/1884' },
  682       {last_ name: 'Lay man', firs t_name: 'W alter', mi ddle_name:  'Gilbert' , gender:  'M', date_ of_birth:  '1/1/1888' },
  683       {last_ name: 'Lim ', first_n ame: 'Vice nte', midd le_name: ' ', gender:  'M', date _of_birth:  '1/1/1889 '},
  684       {last_ name: 'Lou tzenheiser ', first_n ame: 'Joe' , middle_n ame: 'L.',  gender: ' M', date_o f_birth: ' 1/1/1899'} ,
  685       {last_ name: 'Lym an', first _name: 'Al bert', mid dle_name:  'Kuali Bri ckwood', g ender: 'M' , date_of_ birth: '1/ 1/1885'},
  686       {last_ name: 'Lyo n', first_ name: 'Alf red', midd le_name: ' Jefferson' , gender:  'M', date_ of_birth:  '1/1/1892' },
  687       {last_ name: 'Mah in', first _name: 'Fr ank', midd le_name: ' Cadle', ge nder: 'M',  date_of_b irth: '1/1 /1887'},
  688       {last_ name: 'May nard', fir st_name: ' John', mid dle_name:  'Blackwell ', gender:  'M', date _of_birth:  '1/1/1887 '},
  689       {last_ name: 'McB ride', fir st_name: ' Allan', mi ddle_name:  'Clay', g ender: 'M' , date_of_ birth: '1/ 1/1885'},
  690       {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'},
  691       {last_ name: 'McD aniel', fi rst_name:  'Arthur',  middle_nam e: 'Bee',  gender: 'M ', date_of _birth: '1 /1/1895'},
  692       {last_ name: 'McN air', firs t_name: 'L esley', mi ddle_name:  'James',  gender: 'M ', date_of _birth: '1 /1/1883'},
  693       {last_ name: 'Nai den', firs t_name: 'E arl', midd le_name: ' Larue', ge nder: 'M',  date_of_b irth: '1/1 /1894'},
  694       {last_ name: 'Net herwood',  first_name : 'Douglas ', middle_ name: 'Bla ckshaw', g ender: 'M' , date_of_ birth: '1/ 1/1885'},
  695       {last_ name: 'New garden', f irst_name:  'Paul', m iddle_name : 'Wooleve r', gender : 'M', dat e_of_birth : '1/1/189 2'},
  696       {last_ name: 'Old s', first_ name: 'Rob ert', midd le_name: ' ', gender:  'M', date _of_birth:  '1/1/1896 '},
  697       {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'},
  698       {last_ name: 'Pat rick', fir st_name: ' Edwin', mi ddle_name:  'Davies',  gender: ' M', date_o f_birth: ' 1/1/1894'} ,
  699       {last_ name: 'Pat ton Jr.',  first_name : 'George' , middle_n ame: 'Smit h', gender : 'M', dat e_of_birth : '1/1/188 5'},
  700       {last_ name: 'Pen ington', f irst_name:  'Carlos',  middle_na me: 'Alden ', gender:  'M', date _of_birth:  '1/1/1878 '},
  701       {last_ name: 'Pow ell', firs t_name: 'W illiam', m iddle_name : 'Dan', g ender: 'M' , date_of_ birth: '1/ 1/1893'},
  702       {last_ name: 'Pra tt', first _name: 'Do n', middle _name: 'Fo rrester',  gender: 'M ', date_of _birth: '1 /1/1892'},
  703       {last_ name: 'Ram ey', first _name: 'Ho ward', mid dle_name:  'Knox', ge nder: 'M',  date_of_b irth: '1/1 /1896'},
  704       {last_ name: 'Rod erick', fi rst_name:  'Thomas',  middle_nam e: 'Edison ', gender:  'M', date _of_birth:  '1/1/1892 '},
  705       {last_ name: 'Roo sevelt Jr. ', first_n ame: 'Theo dore', mid dle_name:  '', gender : 'M', dat e_of_birth : '1/1/188 7'},
  706       {last_ name: 'Ros e', first_ name: 'Mau rice', mid dle_name:  '', gender : 'M', dat e_of_birth : '1/1/189 9'},
  707       {last_ name: 'Rus sell', fir st_name: ' Clinton',  middle_nam e: 'Warden ', gender:  'M', date _of_birth:  '1/1/1891 '},
  708       {last_ name: 'San tos', firs t_name: 'P aulino', m iddle_name : 'Torres' , gender:  'M', date_ of_birth:  '1/1/1890' },
  709       {last_ name: 'Sea rby', firs t_name: 'E dmund', mi ddle_name:  'Wilson',  gender: ' M', date_o f_birth: ' 1/1/1896'} ,
  710       {last_ name: 'Seg undo Y Ven tura', fir st_name: ' Fidel', ge nder: 'M',  date_of_b irth: '1/1 /1894'},
  711       {last_ name: 'Tay lor', firs t_name: 'V ictor', mi ddle_name:  'Vaughan' , gender:  'M', date_ of_birth:  '1/1/1893' },
  712       {last_ name: 'Tay lor', firs t_name: 'W illis', mi ddle_name:  'Ratcliff e', gender : 'M', dat e_of_birth : '1/1/189 7'},
  713       {last_ name: 'Tin ker', firs t_name: 'C larence',  middle_nam e: 'Leonar d', gender : 'M', dat e_of_birth : '1/1/188 7'},
  714       {last_ name: 'Wal ker', firs t_name: 'K enneth', m iddle_name : 'Newton' , gender:  'M', date_ of_birth:  '1/1/1898' },
  715       {last_ name: 'Wal ker', firs t_name: 'N elson', mi ddle_name:  'Macy', g ender: 'M' , date_of_ birth: '1/ 1/1891'},
  716       {last_ name: 'Was h', first_ name: 'Car lyle', mid dle_name:  'Hilton',  gender: 'M ', date_of _birth: '1 /1/1889'},
  717       {last_ name: 'Wat son', firs t_name: 'E dwin', mid dle_name:  'Martin',  gender: 'M ', date_of _birth: '1 /1/1883'},
  718       {last_ name: 'Wea ver', firs t_name: 'W alter', mi ddle_name:  'Reed', g ender: 'M' , date_of_ birth: '1/ 1/1885'},
  719       {last_ name: 'Wee d', first_ name: 'Fra nk', middl e_name: 'W atkins', g ender: 'M' , date_of_ birth: '1/ 1/1881'},
  720       {last_ name: 'Wha rton', fir st_name: ' James', mi ddle_name:  'Edward',  gender: ' M', date_o f_birth: ' 1/1/1894'} ,
  721       {last_ name: 'Wil son', firs t_name: 'R ussell', m iddle_name : 'Alger',  gender: ' M', date_o f_birth: ' 1/1/1905'} ,
  722       {last_ name: 'Win g', first_ name: 'Leo nard', mid dle_name:  'Fish', ge nder: 'M',  date_of_b irth: '1/1 /1893'}
  723     ]
  724  
  725     TOTAL_VE TERAN_COUN T = (RANDO MIZED_VETE RAN_COUNT  + US_GENER ALS.count)
  726  
  727     RANDOMIZ ED_VETERAN _COUNT.tim es do |vet eran_numbe r|
  728  
  729       puts " Fake Veter an #{veter an_number+ 1} of #{RA NDOMIZED_V ETERAN_COU NT}."
  730  
  731       vetera n_record   = Seeder:: VeteranSee d.new(vete ran_number ).veteran
  732       vetera n_id       = veteran_ record.id
  733  
  734       5.time s do |cons ultation_n umber|
  735         cons ultation_r ecord = Se eder::Cons ultationSe ed.new(vet eran_recor d, consult ation_numb er).consul tation
  736         cons ultation_i d     = co nsultation _record.id
  737  
  738         20.t imes do |r eferral_nu mber|
  739           re ferral_see d_record   = Seeder:: ReferralSe ed.new(vet eran_id, c onsultatio n_id, refe rral_numbe r)
  740           re ferral_id             = referral _seed_reco rd.referra l.id
  741  
  742           2. times do | referral_n ote_number |
  743              Seeder::Re ferralNote Seed.new(v eteran_id,  consultat ion_id, re ferral_id,  referral_ note_numbe r)
  744           en d
  745  
  746           2. times do | referral_a ppointment _number|
  747              Seeder::Re ferralAppo intmentSee d.new(vete ran_id, co nsultation _id, refer ral_id, re ferral_app ointment_n umber)
  748           en d
  749  
  750           2. times do | referral_a pproval_nu mber|
  751              Seeder::Re ferralAppr ovalSeed.n ew(veteran _id, consu ltation_id , referral _id, refer ral_approv al_number)
  752           en d
  753  
  754           2. times do | referral_d ocument_nu mber|
  755              Seeder::Re ferralDocu mentSeed.n ew(veteran _id, consu ltation_id , referral _id, refer ral_docume nt_number)
  756           en d
  757  
  758         end  # 20.times  do |refer ral_number |
  759       end #  5.times do  |consulta tion_numbe r|
  760     end # RA NDOMIZED_V ETERAN_COU NT.times d o |veteran _number|
  761  
  762  
  763     print "A dding Worl d War II h eroes with  fake SSNs  ... "
  764     US_GENER ALS.each_w ith_index  do |us_gen eral_data,  usg_index |
  765       vet_nu mber = RAN DOMIZED_VE TERAN_COUN T + usg_in dex + 1
  766       Seeder ::VeteranS eed.new((v et_number) , us_gener al_data)
  767     end
  768  
  769     puts "Do ne."
  770  
  771   end # if R ails.env = = "develop ment"