nsrr 6.0.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e34599bcac4f2fea33a2528d51aa4144cd68dcc2dfafa406d3916f158c7be5f
4
- data.tar.gz: 5863f09d1c7e513af9c5443e8f53ee31119eb44fbd80abb0f1bdfd7bcb90d8ea
3
+ metadata.gz: b433dcda839233f397d05a81a4ce0c49adde566947eb34c96c29c543553528fa
4
+ data.tar.gz: a40cc44ea9962d07fe5f9a80a2811ccf19b94bd26419021b71c1363dac365c92
5
5
  SHA512:
6
- metadata.gz: 46522e99a17f25b030f0b51cce2eb12010f9f25f23fad7847891f3e5b46578d67d4ff4fbdc356e54259b198ca5fc2ddf12369700037b8a48e8642b28687122b5
7
- data.tar.gz: 729d9f04bfd27c5c3519a81c9891df279d41074f97b2310d062c628e834db87ba15f57889d9a6a4194c8a4523bc745b4897e28731f9451eb90ead00a92a3cafc
6
+ metadata.gz: 5f7612061deeb3b32302a93bf4635c885e180635069c79856c0fa4603b115ba5d890b1d0f45774a0bfe65b24b4da1ee219208674b02f3df73e32ab022d472fc4
7
+ data.tar.gz: 6c98712083ec799a08f4fc32b1f07a1f8760f3d5046da7f96575e579d6f8fa8e4b38964f0ea8d003e0619b074d85aa86de81065df1ac0554450868b388322eb8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 7.0.0 (April 18, 2021)
2
+
3
+ ### Enhancements
4
+ - **General Changes**
5
+ - Added `--file` option to specify a regular expression to match a file name,
6
+ (by @k0kubun)
7
+
1
8
  ## 6.0.0 (January 16, 2021)
2
9
 
3
10
  ### Enhancements
data/README.md CHANGED
@@ -7,7 +7,7 @@ The official ruby gem built to simplify file downloads and dataset integration t
7
7
 
8
8
  ## Prerequisites
9
9
 
10
- You must have **Ruby 2.4+ installed** on your system to use the NSRR gem.
10
+ You must have **Ruby 2.7+ installed** on your system to use the NSRR gem.
11
11
 
12
12
  - [Install Ruby on Windows](https://github.com/remomueller/documentation/blob/master/windows/130-ruby.md)
13
13
  - [Install Ruby on Mac](https://github.com/remomueller/documentation/blob/master/macos/130-install-rvm.md)
@@ -65,6 +65,26 @@ You can combine the file check flag with the folder depth flag as well.
65
65
  nsrr download shhs/datasets --shallow --fast
66
66
  ```
67
67
 
68
+ You can specify a regular expression to filter files that are downloaded.
69
+
70
+ ```console
71
+ nsrr download nchsdb/health_data --file="^PROCEDURE.*\.csv$"
72
+ ```
73
+
74
+ ```console
75
+ create nchsdb/health_data/
76
+ skipped DEMOGRAPHIC.csv
77
+ skipped DIAGNOSIS.csv
78
+ skipped ENCOUNTER.csv
79
+ skipped MEASUREMENT.csv
80
+ skipped MEDICATION.csv
81
+ downloaded PROCEDURE.csv
82
+ downloaded PROCEDURE_SURG_HX.csv
83
+ skipped SLEEP_ENC_ID.csv
84
+ skipped SLEEP_STUDY.csv
85
+ skipped Sleep_Study_Data_File_Format.pdf
86
+ ```
87
+
68
88
  ### Open the console and download entire datasets
69
89
 
70
90
  ```console
@@ -21,6 +21,7 @@ module Nsrr
21
21
  (@token, argv) = parse_parameter_with_value(argv, ["token"], "")
22
22
  (@file_comparison, argv) = parse_parameter(argv, ["fast", "fresh", "md5"], "md5")
23
23
  (@depth, argv) = parse_parameter(argv, ["shallow", "recursive"], "recursive")
24
+ (@file, argv) = parse_parameter_with_value(argv, ["file"], "")
24
25
  @dataset_slug = argv[1].to_s.split("/").first
25
26
  @full_path = (argv[1].to_s.split("/")[1..-1] || []).join("/")
26
27
  end
@@ -35,7 +36,7 @@ module Nsrr
35
36
  @token = Nsrr::Helpers::Authorization.get_token(@token) if @token.to_s == ""
36
37
  @dataset = Dataset.find(@dataset_slug, @token)
37
38
  if @dataset
38
- @dataset.download(@full_path, depth: @depth, method: @file_comparison)
39
+ @dataset.download(@full_path, depth: @depth, method: @file_comparison, file: Regexp.new(@file))
39
40
  else
40
41
  puts "\nThe dataset " + @dataset_slug.white + " was not found."
41
42
  datasets = all_datasets
@@ -80,7 +81,7 @@ module Nsrr
80
81
  result = default
81
82
  options.each do |option|
82
83
  argv.each do |arg|
83
- result = arg.gsub(/^--#{option}=/, "") if arg =~ /^--#{option}=\w/
84
+ result = arg.gsub(/^--#{option}=/, "") if arg =~ /^--#{option}=[^\s]/
84
85
  end
85
86
  end
86
87
  [result, argv]
@@ -69,6 +69,7 @@ module Nsrr
69
69
 
70
70
  begin
71
71
  puts " File Check: " + options[:method].to_s.white
72
+ puts " File Regex: " + options[:file].inspect.white
72
73
  puts " Depth: " + options[:depth].to_s.white
73
74
  puts ""
74
75
  if @download_token.nil?
@@ -100,6 +101,12 @@ module Nsrr
100
101
  create_folder_for_path(full_path)
101
102
 
102
103
  files(full_path).select(&:is_file).each do |file|
104
+ unless file.file_name.match?(options[:file])
105
+ puts " skipped".blue + " #{file.file_name}"
106
+ @files_skipped += 1
107
+ next
108
+ end
109
+
103
110
  current_folder = ::File.join(slug.to_s, file.folder.to_s)
104
111
  result = file.download(options[:method], current_folder, @download_token)
105
112
  case result
data/lib/nsrr/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Nsrr
4
4
  module VERSION #:nodoc:
5
- MAJOR = 6
5
+ MAJOR = 7
6
6
  MINOR = 0
7
7
  TINY = 0
8
8
  BUILD = nil # "pre", "beta1", "beta2", "rc", "rc2", nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nsrr
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Remo Mueller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-16 00:00:00.000000000 Z
11
+ date: 2021-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  - !ruby/object:Gem::Version
100
100
  version: 2.6.3
101
101
  requirements: []
102
- rubygems_version: 3.2.5
102
+ rubygems_version: 3.2.16
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: Download files easily from the NSRR website, https://sleepdata.org