Groovy Script for check Box selection and deselection - jenkins

I have two parameters for selection one is Production and the second is Staging similarly I have set the selection accordingly, if a user selects a product then its relevant option will appear along with the sub-option. Now if I de-select one of the options then its subsequent Sub-option should also get de-selected.
Below is the Groovy code which I wrote in Jenkins pipeline using active choice with reactive Parameter.
return[
"Production:selected",
"Staging"
]
Test_Event_Selection(This check box selection will be altered using the above-mentioned check Box selection)
if(Environment.equals("Production")){
return[
"ACCT DAP - PROD:selected",
"ACCT MCB - PROD:selected",
"ACCY Price Guide - PROD:selected",
"AW CPS - PROD:selected",
"Dealer Daily Dealer Portal Menu Service - PROD:selected",
"MKTG ONEVOICE - PROD:selected",
"NV Inc Dashboard - PROD:selected",
"NV Inventory Locator - PROD:selected",
"NV Invoice Lookup - PROD:selected",
"NV MTD Sales & YOY - PROD:selected",
"NV VIN Sight - PROD:selected",
"NV VIN Sight-SET - PROD:selected",
"NV WebPricing Admin - PROD:selected",
"P&S CTM Portal - PROD:selected",
"P&S Master Inq - PROD:selected",
"P&S Order & Ship - PROD:selected",
"P&S Order & Ship Inq - PROD:selected",
"P&S Parts Claim - PROD:selected",
"SET Staff Admin Assoc - PROD:selected",
"SETWIRE - PROD:selected",
"TCUV Vehicle Report - PROD:selected",
"TMNA CPS - PROD:selected",
"TMNA Staff Admin Dir - PROD:selected",
"TMNA TIS - PROD:selected"
]
}
if(Environment.equals('Staging')){
return[
"ACCT DAP - STG:selected",
"ACCT MCB - STG:selected",
"ACCY Price Guide - STG:selected",
"AW CPS - STG:selected",
"Dealer Daily Dealer Portal Menu Service - STG:selected",
"MKTG ONEVOICE- STG:selected",
"NV Inc Dashboard - STG:selected",
"NV Inventory Locator - STG:selected",
"NV Invoice Lookup - STG:selected",
"NV MTD Sales & YOY - STG:selected",
"NV VIN Sight - STG:selected",
"NV VIN Sight -SET - STG:selected",
"NV WebPricing Admin - STG:selected",
"P&S CTM Portal - STG:selected",
"P&S Master Inq - STG:selected",
"P&S Order & Ship - STG:selected",
"P&S Order & Ship Inq - STG:selected",
"P&S Parts Claim - STG:selected",
"SET Staff Admin Assoc - STG:selected",
"SETWIRE - STG:selected",
"TCUV Vehicle Report - STG:selected",
"TMNA CPS - STG:selected",
"TMNA Staff Admin Dir- STG:selected",
"TMNA TIS - STG:selected"
]
}
If I deselect any one of the check boxes substitute check box resembling the check box in Test Event must also deselect
if(Environment.equals("Production")){
return[
"ACCTDAP:selected",
"ACCTMCB:selected",
"ACCYPriceGuide:selected",
"AWCPS:selected",
"DealerDailyDealerPortalMenuService:selected",
"MKTGONEVOICE:selected",
"NVIncDashboard:selected",
"NVInventoryLocator:selected",
"NVInvoiceLookup:selected",
"NVMTDSales&YOY:selected",
"NVVINSight:selected",
"NVNVSightSET:selected",
"NVWebPricingAdmin:selected",
"P&SCTMPortal:selected",
"P&SMasterInq:selected",
"P&SOrder&Ship:selected",
"P&SOrder&ShippInq:selected",
"P&SPartsClaim:selected",
"SETStaffAdminAssoc:selected",
"SETWIRE:selected",
"TCUVVehicleReport:selected",
"TMNACPS:selected",
"TMNAStaffAdminDir:selected",
"TMNATIS:selected"
]
}
if(Environment.equals("Staging")){
return[
"ACCTDAP:selected",
"ACCTMCB:selected",
"ACCYPriceGuide:selected",
"AWCPS:selected",
"DealerDailyDealerPortalMenuService:selected",
"MKTGONEVOICE:selected",
"NVIncDashboard:selected",
"NVInventoryLocator:selected",
"NVInvoiceLookup:selected",
"NVMTDSales&YOY:selected",
"NVVINSight:selected",
"NVNVSightSET:selected",
"NVWebPricingAdmin:selected",
"P&SCTMPortal:selected",
"P&SMasterInq:selected",
"P&SOrder&Ship:selected",
"P&SOrder&ShippInq:selected",
"P&SPartsClaim:selected",
"SETStaffAdminAssoc:selected",
"SETWIRE:selected",
"TCUVVehicleReport:selected",
"TMNACPS:selected",
"TMNAStaffAdminDir:selected",
"TMNATIS:selected"
]
}
But somehow its not giving the desired result Being new to the groovy script I am not sure I wrote the correct code

Related

Hold apa_table position in Rmarkdown/papaja

I do have another Rmarkdown/papaja package question from my side and would be very happy if anyone was willing to help :)
As many people on the internet I have trouble controlling the position of my tables.
I have the
floatsintext: yes
option included in the YAML header.
I know that there are LATEX options such as fig.pos = "!H" for which I have to load the float package
header-includes:
- usepackage\{float}
However, doing this I get the following error message:
! LaTeX Error: Unknown float option `H'.
Which tells me the float package was not able to load I guess?
(I do hav MacTex installed and also the newest R version).
What also is absolutely confusing to me is that tables (generated with app_table()) appear in the (approximately) right position when I leave the default spacing, but only appear at the end of my work when I add
header-includes:
- \usepackage{setspace}
- \AtBeginEnvironment{tabular}{\singlespacing}
- \AtBeginEnvironment{lltable}{\singlespacing}
- \AtBeginEnvironment{tablenotes}{\singlespacing}
to the YAML header in order to control the spacing of my tables.
I would really appreciate any help!
Thanks in advance!
Edit:
I don't know if this serves the purpose, but if I create the following options, my table appears at the end (and not where it should be)
title : "TITLE"
shorttitle : "short title"
author:
- name : "me"
affiliation : "1"
corresponding : yes # Define only one corresponding author
address : "x"
email : "y"
role: # Contributorship roles (e.g., CRediT, https://casrai.org/credit/)
- Conceptualization
- Writing - Original Draft Preparation
- Writing - Review & Editing
# - name : "Ernst-August Doelle"
# affiliation : "1,2"
# role:
# - Writing - Review & Editing
affiliation:
- id : "1"
institution : ""
# - id : "2"
# institution : "Konstanz Business School"
authornote: |
Enter author note here.
abstract: |
keywords : "keywords"
wordcount : "X"
bibliography :
floatsintext : yes
figurelist : no
tablelist : no
footnotelist : no
linenumbers : no
mask : no
draft : no
csl: "apa.csl"
documentclass : "apa7"
classoption : "man"
output : papaja::apa6_pdf
toc: true
header-includes:
- \usepackage{float}
- \usepackage{setspace}
- \AtBeginEnvironment{tabular}{\singlespacing}
- \AtBeginEnvironment{lltable}{\singlespacing}
- \AtBeginEnvironment{tablenotes}{\singlespacing}
---
{r setup, include = FALSE}
library("papaja")
library("apa")
library("tidyverse")
library("apaTables")
r_refs("r-references.bib")
{r analysis-preferences}
# Seed for random number generation
set.seed(42)
knitr::opts_chunk$set(cache.extra = knitr::rand_seed)
{r}
cor_table <- apa.cor.table(iris)
Text BLABLABLABLA
{r tab, results = "asis", fig.pos = "!h"}
apa_table(cor_table$table.body,
caption = "Means, standard deviations, and correlations with confidence intervals for study variables.",
note = "Note. M and SD are used to represent mean and standard deviation, respectively.Values in square brackets indicate the 95% confidence interval.The confidence interval is a plausible range of population correlations that could have caused the sample correlation (Cumming, 2014). * indicates p < .05. ** indicates p < .01.", font_size = "footnotesize", row.names = F,
placement = "p")
# Methods
We report how we determined our sample size, all data exclusions (if any), all manipulations, and all measures in the study. <!-- 21-word solution (Simmons, Nelson & Simonsohn, 2012; retrieved from http://ssrn.com/abstract=2160588) -->
## Participants
## Material
## Procedure
## Data analysis
We used `r cite_r("r-references.bib")` for all our analyses.
# Results
# Discussion
\newpage
# References
\begingroup
\setlength{\parindent}{-0.5in}
\setlength{\leftskip}{0.5in}
<div id="refs" custom-style="Bibliography"></div>
\endgroup
For PDF output, there is a recommended way to customize the placement of tables created via apa_table(). (You do not have to load the float package via header includes.)
First, set the YAML header option floatsintext: yes.
Second, when creating your table with apa_table(), use the function's placement argument:
```{r tab}
apa_table(cor_table$table.body,
caption = "Means, standard deviations, and correlations with confidence intervals for study variables.",
note = "Note. M and SD are used to represent mean and standard deviation, respectively.Values in square brackets indicate the 95% confidence interval.The confidence interval is a plausible range of population correlations that could have caused the sample correlation (Cumming, 2014). * indicates p < .05. ** indicates p < .01.", font_size = "footnotesize", row.names = F,
placement = "H")

How to add just one single link between two different breeds in Netlogo

I'd love some help creating links in Netlogo.
Essentially I want to add just one single link between two different breeds in Netlogo, with a defined length 'particle-length'. This link needs to be joined to the other breed that is next to it.
At the moment this code creates a volume exclusive set of turtles, with 3 breeds. One is randomly scattered, and the other two are inside a box. I think the initial arrangement of the two different breeds inside the box needs fixing as well so every purple is next to every green.
Ultimately I want 50 greens(Big) and 50 purples(Small) that are connected with one link (green to purple) with link length of particle-length 1.
Note water-number, Big-number and small-number are defined on a slider with value 50.
Netlogo Code:
breed [Bigs Big]
breed [Smalls Small]
breed [ waters water ]
to setup
clear-all
set particle-length 1.0
set-default-shape turtles "square"
;;To set up the bigs and smalls inside a central box
ask patches with [ abs (min-pxcor - pxcor) > 22
and abs (min-pxcor - pxcor) < 23 + floor (sqrt ( Big-number + Small-number ))
and abs (max-pycor - pycor) > 22
and abs (max-pycor - pycor) < 23 + floor (sqrt (Big-number + Small-number))]
[sprout-Bigs 1 [ set color green ] ]
;;Now make half of the Bigs into Smalls
ask n-of Big-number Bigs [ set breed Smalls]
ask Smalls [set color violet]
;;randomly makes volume exclusive Waters where there are no Bigs or Smalls
ask n-of water-number patches with [ not any? turtles-here]
[sprout-waters 1 [ set color blue ]]
ask Bigs with [any? Smalls-on neighbors4] [create-link-with one-of Smalls-on neighbors4]
reset-ticks
end
The code that is throwing the error is
ask n-of ( Big-number / 2 ) Bigs [create-link-with one-of Smalls-on neighbors4]
The simple reason is that for at least one of the bigs being asked there are no small on neighbors4`
Changing it to
ask n-of ( Big-number / 2 ) Bigs
[
If any? Smalls-on neighbors4
[create-link-with one-of Smalls-on neighbors4]
]
Will prevent the error but might not be the behavior you want. Alternatively
ask n-of ( Big-number / 2 ) Bigs with[any? Small-on neighbors4][create-link-with one-of Smalls-on neighbors4]

Search subdocuments in ElasticSearch with Searchkick

Suppose I have a series of embedded or child documents that I'd like to search on, but return their parents as my results, like Buildings and Units:
Building A
- Unit 1F
- Unit 1R
- Unit 2F: 1200 sq ft
- Unit 2R: 2300 sq ft
Building B
- Unit 202: 500 sq ft
- Unit 203: 650 sq ft
Now suppose I want to return all buildings that have units >= 1000 sq ft. How would I do that?
Store the unit sizes as an Array:
class Building
def search_data
{
# ... other fields
unit_sq_ft: units.map(&:sq_ft)
}
end
end
and search with:
Building.search "pool", where: {unit_sq_ft: {gte: 1000}}

Aggregating by Patient ID, how do i summarise the total number of each xray type for each patient?

I have data set up like this;
Patient id...xray type... weight
1.......................1.......................560
1.......................2.......................2400
1.......................2.......................1629
2.......................5.......................716
2.......................1.......................936
2.......................5.......................1271
3.......................2.......................1823
3.......................2.......................2100
This data shows that Patient 1 has had one chest xray(1) and two abdominal xrays (2) etc etc
I was wondering whether its possible to somehow summarise how many of each type of xray each patient has into a different variable column/s?
The output that I'm trying to achieve is something like this:
Weight range - - - - Average Chest X-ray (type 1) - - - - - Average Abdominal X-ray (type 2)
< 750 - - - - - - - - - - - - 11 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 15 - - - - - - -
I was thinking that perhaps a middle table like :
weight range - - - chest x-ray num - - - chest x-ray count
might help, but I'm not really sure.
Thankyou!
Your Data could be restructured. Since that is a rather complex approach you may have to put thome thaught into that.
In the end, you could something like
Patient Chest Adbdomen....Missing
1 1 2...........
There are many things you could do here, but one simple approach would be this.
First, bin the weight variable into, say, quartiles. Use Transform > Visual Binning for this. It has has a number of ways to create the bins.
Second, use Analyze > Compare Means > Means and select whatever statistical summaries you want.
With your bin variable, you could also use Split Files (Data > Split File) and then run Frequencies or other summary procedures that will be calculated separately for each split.

Ruby Rails Hash Issue

So I have been struggling with an issue for a while now and seem to be getting nowhere...
The problem exists while I am looping through a hash, around the 3rd level deep.
So my code looks a little like:
request[:items][:location_item].each do |locaton_item|
pp location_item[:name]
location_item[:items][:sub_area_option_item].each do |sub_area_option_item|
pp sub_area_option_item[:name]
sub_area_option_item[:items][:option_item].each do |option_item|
option_item[:name] <- THIS IS WHERE MY CODE BREAKS
end
end
end
The reason this is failing is because this particular part of the loop has 2 different variants, one where there is an infinite amount of "option_items" and one where there is only one "option_item". Instead of sending me back the single "option_item" it is looping through this "option_item" and not finding this particular field. Any ideas as how to force it when only one object is found to still return it as an array?
UPDATE(05/092012)
TypeError - Symbol as array index
This error does not appear if I remove the single "option_item" from the hash or even by filtering it with a conditional statement.
As another update that was an example before, here is the code:
request[:items][:house_option_item][:items][:location_option_item].each do |location_option_item|
pp location_option_item.try(:[], :location).try(:[], :name)
# pp location_option_item[:location][:name]
location_option_item[:items][:sub_area_option_item].each do |sub_area_option_item|
pp "--" + sub_area_option_item[:sub_area][:name] + "--" + sub_area_option_item[:sub_area][:id]
count = 0
# pp sub_area_option_item[:items].length
# pp "+++++++++++++++++"
# if sub_area_option_item[:sub_area][:name] != "Conservatory"
[sub_area_option_item[:items][:option_item]].each do |option_item_key_info|
pp "----"
pp option_item_key_info[:usage_name]
end
# end
end
end
Example data(abbreviated):
{:"#xmlns:i"=>"http://www.w3.org/2001/XMLSchema-instance",
:"#xmlns:a"=>"http://schemas.datacontract.org/2004/07/RXTypes",
:items=>
{:house_option_item=>
{:design=>
{:house_style=>nil,
:sales_name=>nil,
:sq_ft=>"0",
:"#xmlns:b"=>"http://schemas.datacontract.org/2004/07/",
:arch_ref=>"D3H102.1",
:marketing_name=>"Warwick",
:num_beds=>"0"},
:items=>
{:location_option_item=>
[{:location=>{:sort_order=>"0", :name=>"Eat", :id=>"1"},
:items=>
{:sub_area_option_item=>
[{:sub_area=>
{:location_id=>"7",
:sort_order=>"0",
:name=>"Conservatory",
:id=>"31"},
:items=>
{:option_item=>
{:lead_days=>"0",
:collection_code=>"NEWHE01",
:usage_name=>"Conservatory",
:max_qty=>"1",
:is_a_bundle=>false,
:only_order_bundle=>false,
:sub_area=>"Conservatory",
:key_info=>
{:specification=>
"PVC-U 'Edwardian' style Conservatory in white with high performance toughened glass double glazed windows and 600mm (approx) dwarf base wall internally and externally. Conservatory to include fan and light, electric heater, double power point and ceramc floor tiling selected from tile choice . Size of Conservatory to be as follows: 3.2 x 3.1 metre (Availabil
ity will be subject to ground levels/conditions)",
:description=>"Conservatory",
:image_url=>"/2012/8/10/334_web.jpg",
:item_id=>"3",
:thumbnail_url=>"/2012/8/10/334_thumb.jpg"},
:build_stage_id=>"0",
:location=>"Building",
:option_flag=>"67",
:bundle_items=>nil,
:price=>"8950",
:choice_items=>nil,
:spec_level=>"85"}}},
{:sub_area=>
{:location_id=>"7",
:sort_order=>"0",
:name=>"Doors",
:id=>"32"},
:items=>
{:option_item=>
[{:lead_days=>"0",
:collection_code=>"NEWHE01",
:usage_name=>"Front Door",
:max_qty=>"0",
:is_a_bundle=>false,
:only_order_bundle=>false,
:sub_area=>"Doors",
:key_info=>
{:specification=>
"GRP pre-finished door with patterned glass manufactured by IG. Style of door to be all as indicated on house plan, finished in solid colour externally & white finish internally. Frame to be UPVC. Please refer to the External Finishing schedule to confirm the external finish selected for each property. The paint finish to be one of the New Heritage Colours - Camouflage beige
- BS381 389, Dk camouflage desert sand - BS381 420, Wine Red - RAL 3005, Braemar - BS4800 - 14C35, Deep Brunswick Green - BS381 227 and White. Door complete with lever handle furniture, multi point lock system, sleeved letterplate, viewer and door chain in black japanned finish externally & chrome lever handle furniture internally.",
:description=>"GRP Front door",
:image_url=>nil,
:item_id=>"4",
:thumbnail_url=>nil},
:build_stage_id=>"0",
:location=>"Building",
:option_flag=>"88",
:bundle_items=>nil,
:price=>"0",
:choice_items=>
{:option_item_key_info=>
[{:specification=>nil,
:description=>"NG42 Diamond",
:image_url=>"/2012/8/21/485_web.jpg",
:item_id=>"211",
:thumbnail_url=>"/2012/8/21/485_thumb.jpg"},
{:specification=>nil,
:description=>"NG21 Square",
:image_url=>"/2012/8/21/486_web.jpg",
:item_id=>"212",
:thumbnail_url=>"/2012/8/21/486_thumb.jpg"},
{:specification=>nil,
:description=>"NG51 Square",
:image_url=>"/2012/8/21/487_web.jpg",
:item_id=>"213",
:thumbnail_url=>"/2012/8/21/487_thumb.jpg"},
{:specification=>nil,
:description=>"NG42 Rectangle",
:image_url=>"/2012/8/21/488_web.jpg",
:item_id=>"214",
:thumbnail_url=>"/2012/8/21/488_thumb.jpg"}]},
:spec_level=>"83"},
{:lead_days=>"0",
:collection_code=>"NEWHE01",
:usage_name=>"Front Door",
:max_qty=>"0",
:is_a_bundle=>false,
:only_order_bundle=>false,
:sub_area=>"Doors",
:key_info=>
{:specification=>
"GRP pre-finished door with patterned glass manufactured by IG. Style of door to be all as indicated on house plan, finished in solid colour externally & white finish internally. Frame to be UPVC. Please refer to the External Finishing schedule to confirm the external finish selected for each property. The paint finish to be one of the New Heritage Colours - Camouflage beige
- BS381 389, Dk camouflage desert sand - BS381 420, Wine Red - RAL 3005, Braemar - BS4800 - 14C35, Deep Brunswick Green - BS381 227 and White. Door complete with lever handle furniture, multi point lock system, sleeved letterplate, viewer and door chain in black japanned finish externally & chrome lever handle furniture internally.",
:description=>"GRP Front door",
:image_url=>nil,
:item_id=>"4",
:thumbnail_url=>nil},
:build_stage_id=>"0",
:location=>"Building",
:option_flag=>"88",
:bundle_items=>nil,
:price=>"0",
:choice_items=>
{:option_item_key_info=>
[{:specification=>nil,
:description=>"NG42 Diamond",
:image_url=>"/2012/8/21/485_web.jpg",
:item_id=>"211",
:thumbnail_url=>"/2012/8/21/485_thumb.jpg"},
{:specification=>nil,
:description=>"NG21 Square",
:image_url=>"/2012/8/21/486_web.jpg",
:item_id=>"212",
:thumbnail_url=>"/2012/8/21/486_thumb.jpg"},
{:specification=>nil,
:description=>"NG51 Square",
:image_url=>"/2012/8/21/487_web.jpg",
:item_id=>"213",
:thumbnail_url=>"/2012/8/21/487_thumb.jpg"},
{:specification=>nil,
:description=>"NG42 Rectangle",
:image_url=>"/2012/8/21/488_web.jpg",
:item_id=>"214",
:thumbnail_url=>"/2012/8/21/488_thumb.jpg"}]},
:spec_level=>"83"},
{:lead_days=>"0",
:collection_code=>"NEWHE01",
:usage_name=>"Front Door",
:max_qty=>"0",
:is_a_bundle=>false,
:only_order_bundle=>false,
:sub_area=>"Doors",
:key_info=>
{:specification=>
"GRP pre-finished door with patterned glass manufactured by IG. Style of door to be all as indicated on house plan, finished in solid colour externally & white finish internally. Frame to be UPVC. Please refer to the External Finishing schedule to confirm the external finish selected for each property. The paint finish to be one of the New Heritage Colours - Camouflage beige
- BS381 389, Dk camouflage desert sand - BS381 420, Wine Red - RAL 3005, Braemar - BS4800 - 14C35, Deep Brunswick Green - BS381 227 and White. Door complete with lever handle furniture, multi point lock system, sleeved letterplate, viewer and door chain in black japanned finish externally & chrome lever handle furniture internally.",
:description=>"GRP Front door",
:image_url=>nil,
:item_id=>"4",
:thumbnail_url=>nil},
:build_stage_id=>"0",
:location=>"Building",
:option_flag=>"88",
:bundle_items=>nil,
:price=>"0",
:choice_items=>
{:option_item_key_info=>
[{:specification=>nil,
:description=>"NG42 Diamond",
:image_url=>"/2012/8/21/485_web.jpg",
:item_id=>"211",
:thumbnail_url=>"/2012/8/21/485_thumb.jpg"},
{:specification=>nil,
:description=>"NG21 Square",
:image_url=>"/2012/8/21/486_web.jpg",
:item_id=>"212",
:thumbnail_url=>"/2012/8/21/486_thumb.jpg"},
{:specification=>nil,
:description=>"NG51 Square",
:image_url=>"/2012/8/21/487_web.jpg",
:item_id=>"213",
:thumbnail_url=>"/2012/8/21/487_thumb.jpg"},
{:specification=>nil,
:description=>"NG42 Rectangle",
:image_url=>"/2012/8/21/488_web.jpg",
:item_id=>"214",
:thumbnail_url=>"/2012/8/21/488_thumb.jpg"}]},
:spec_level=>"83"},
Krista's example will work if there is only one option_item, but not if there's more. I'd add flatten and adjust it to:
[sub_area_option_item[:items][:option_item]].flatten.each do |option_item|
option_item[:name]
end
the [] around it makes sure it's an array. the flatten makes sure that if it already was an array, that you remove the extra layer of [] eg:
['a'].flatten
=> ["a"]
[['a','b','c',]].flatten
=> ["a", "b", "c"]
As far as I can tell, the second part of your loop should be the problem - given your source code and the sample data
01: request[:items][:house_option_item][:items][:location_option_item].each do |location_option_item|
02: location_option_item[:items][:sub_area_option_item].each do |sub_area_option_item|
03: count = 0
04: # if sub_area_option_item[:sub_area][:name] != "Conservatory"
05: [sub_area_option_item[:items][:option_item]].each do |option_item_key_info|
06: pp option_item_key_info[:usage_name]
07: end
08: # end
09: end
10: end
Note that line 01 would end up accessing location_option_item which in your sample above is:
:location_option_item=>
[{:location=>{:sort_order=>"0", :name=>"Eat", :id=>"1"},
:items=>
{:sub_area_option_item=>
[{:sub_area=>
{:location_id=>"7",
:sort_order=>"0",
:name=>"Conservatory",
:id=>"31"},
:items=>
{:option_item=>
{:lead_days=>"0",
:collection_code=>"NEWHE01",
........ etc .......
Notice that location_option_item is the key, which has for value an array.
Thus, my guess is that this line is the problem (02): location_option_item[:items]
Since location_option_item is an array, you cannot access the :items symbol from it.
If you wanted to get items it would be something more like:
location_option_item[1][:items]

Resources