150. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 2/21/2018 6:58:14 AM Central 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.

150.1 Files compared

# Location File Last Modified
1 CUI-CPP-v2.4.0-source-archive.zip\db seeds.rb Thu Dec 21 03:33:17 2017 UTC
2 CUI-CPP-v2.4.0-source-archive.zip\db seeds.rb Tue Feb 13 13:55:08 2018 UTC

150.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 20 1436
Changed 19 42
Inserted 0 0
Removed 0 0

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

150.4 Active regular expressions

No regular expressions were active.

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