Skip to content

Commit

Permalink
feat: Adding ISO code to NDC SDG downloaded zip file
Browse files Browse the repository at this point in the history
  • Loading branch information
martintomas committed Aug 14, 2023
1 parent 7492205 commit 02b45bd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 25 deletions.
20 changes: 0 additions & 20 deletions app/services/api/v1/data/column_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@ def column_manifest
{columns: sortable_columns.map { |cp| cp[:alias] }}
end

def csv_column_aliases
csv_columns.map do |column_properties|
column_properties[:alias]
end
end

def csv_column_display_names
csv_columns.map do |column_properties|
column_properties[:display] || column_properties[:alias]&.humanize
end
end

private

def visible_columns
Expand Down Expand Up @@ -74,14 +62,6 @@ def group_columns
column_properties[:column]
end
end

## CSV specific

def csv_columns
select_columns_map.select do |column_properties|
column_properties[:csv].nil? || column_properties[:csv] == true
end
end
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/services/api/v1/data/ndc_sdg/csv_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module NdcSdg
class CsvContent
def initialize(filter)
@query = filter.call
@headers = filter.csv_column_display_names
@aliases = filter.csv_column_aliases
@headers = filter.column_display_names
@aliases = filter.column_aliases
end

def call
Expand Down
6 changes: 3 additions & 3 deletions app/services/api/v1/data/ndc_sdg/filter_columns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def select_columns_map
{
column: 'locations.iso_code3',
alias: 'iso_code3',
visible: false
display: 'ISO'
},
{
column: 'locations.wri_standard_name',
Expand Down Expand Up @@ -57,12 +57,12 @@ def select_columns_map
{
column: 'ndcs.document_type',
alias: 'document_type',
csv: false
visible: false
},
{
column: 'ndcs.language',
alias: 'document_language',
csv: false
visible: false
}
]
end
Expand Down

0 comments on commit 02b45bd

Please sign in to comment.