Commit a3d76351 authored by Dóra Kocsis's avatar Dóra Kocsis

add unit test and modify template to include example with filtered series, closes #3

parent 14413931
......@@ -23,9 +23,14 @@ df_cart = fetch_series_by_api_link("
df_multi_freq = fetch_series('series_ids', ["BEA/NIUnderlyingDetail-U001BC/S315-A",...
% fetch one series and apply interpolation filter %NOT IMPLEMENTED
% fetch one series and apply interpolation filter
filters_ = '[{"code": "interpolate", "parameters": {"frequency": "monthly", "method": "spline"}}]';
df_filter = fetch_series('series_ids', "AMECO/ZUTN/EA19.",...
'dbnomics_filters', '[{"code": "interpolate", "parameters": {"frequency": "monthly", "method": "spline"}}]');
'dbnomics_filters', filters_);
% fetch multiple series and apply interpolation filter
df_filters = fetch_series('series_ids', ["AMECO/ZUTN/EA19.", "AMECO/ZUTN/DNK."],...
'dbnomics_filters', filters_);
\ No newline at end of file
......@@ -11,6 +11,7 @@ r = [r; run_this_test('test_fetch_series_of_dataset')];
r = [r; run_this_test('test_fetch_series_by_api_link')];
r = [r; run_this_test('test_fetch_series_with_na_values')];
r = [r; run_this_test('test_fetch_series_with_max_nb_series')];
r = [r; run_this_test('test_fetch_series_with_filter_on_one_series')];
function test_fetch_series_with_filter_on_one_series()
filters_ = '[{"code": "interpolate", "parameters": {"frequency": "monthly", "method": "spline"}}]';
df = fetch_series('provider_code', "AMECO", 'dataset_code', "ZUTN", 'series_code', "DEU.", 'dbnomics_filters', filters_);
idx = find(strcmp('provider_code',df(1,:)));
provider_codes = unique(df(2:end,idx));
assert(provider_codes{1} == "AMECO");
idx = find(strcmp('dataset_code',df(1,:)));
dataset_codes = unique(df(2:end,idx));
assert(length(dataset_codes) == 1);
assert(dataset_codes{1} == "ZUTN");
idx = find(strcmp('series_code',df(1,:)));
series_codes = unique(df(2:end,idx));
assert(series_codes{1} == "DEU.");
idx_freq = find(strcmp('x_frequency',df(1,:)));
frequencies = unique(df(2:end, idx_freq));
assert(any(strcmp(frequencies, "monthly")));
assert(any(contains(series_codes, "_filtered")));
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment