ffiec_as_dataframe 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52e887a2eb7df79ab83f9cffaadd742041d9d722f2bf9289432e5d3d7fcd85b6
4
- data.tar.gz: 44e49c73a60273571619f8247678e968c5cbb6e203755f7a915649523a86ede4
3
+ metadata.gz: 166c61f10b3dd136615121591d23b96dbf13018c3231aa8e3e87e7d37984b05e
4
+ data.tar.gz: 3c5db2d595a417678eb174f27449bee4c2783d82afe29f6d44f6653be54246bc
5
5
  SHA512:
6
- metadata.gz: 6962c34c8b5292e6ce454f6f5baf3c6700b0a17b55cbf870b5be372869bfd9fb0695fdc83e5b197268051b4d8690faeb424a53ea4cf81d503a65dd4fb15c5bfa
7
- data.tar.gz: baacf07659f4f89a3fcb47bd14f742942640fbd71ff1be7a341113490d826db4a97d27f86d61a4891efe1556d289883d45a1e99ceb18a49c1dfad5fa14287f92
6
+ metadata.gz: 3f2066986c69665b8d0e20fbdb994cd2f63e32363122fede1649f28650fefc30578734925d991347254791087799a7500cb6f7fdbc897a21cffd3345c3e3fece
7
+ data.tar.gz: 6ca9385940216424d0d0d232d0100a9c5ad4b6d3309b6907d916eafffa09ef48cd960a156b83d1abc8f2b1e885c93433059c3481f94446672c2ddd19b5f5b8c8
data/.gitignore CHANGED
@@ -7,3 +7,5 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  .DS_Store
10
+ Gemfile.lock
11
+ /vendor/
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2026-11-24
4
+
5
+ - Move ActiveSupport from the end-of-life 6.1 line to 8.1
6
+ - Require current rubyzip 3.7, selenium-webdriver 4.54, and minitest 6
7
+ - Load mocks from the minitest-mock gem after minitest 6 removed them
8
+ - Depend on the csv gem now that Ruby is removing it from the default set
9
+ - Parse FFIEC dropdown dates as month/day/year when the requested quarter is missing
10
+
11
+ ## [0.2.0] - 2026-08-28
12
+
13
+ - Required Ruby version >= 3.3
14
+ - Updated polars-df to 0.27.1
15
+
3
16
  ## [0.1.0] - 2024-08-25
4
17
 
5
18
  - Initial release
data/Gemfile CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
+ ruby '3.3.0'
6
+
5
7
  # Specify your gem's dependencies in ffiec_as_dataframe.gemspec
6
8
  gemspec
7
9
 
data/Gemfile.lock ADDED
@@ -0,0 +1,84 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ffiec_as_dataframe (0.3.0)
5
+ activesupport (~> 8.1)
6
+ csv (~> 3.3)
7
+ polars-df (= 0.27.1)
8
+ rubyzip (~> 3.7)
9
+ selenium-webdriver (~> 4.54)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ activesupport (8.1.4.1)
15
+ base64
16
+ bigdecimal
17
+ concurrent-ruby (~> 1.0, >= 1.3.1)
18
+ connection_pool (>= 2.2.5)
19
+ drb
20
+ i18n (>= 1.6, < 2)
21
+ json
22
+ logger (>= 1.4.2)
23
+ minitest (>= 5.1)
24
+ securerandom (>= 0.3)
25
+ tzinfo (~> 2.0, >= 2.0.5)
26
+ uri (>= 0.13.1)
27
+ base64 (0.3.0)
28
+ bigdecimal (4.1.3)
29
+ concurrent-ruby (1.3.8)
30
+ connection_pool (3.0.3)
31
+ csv (3.3.7)
32
+ drb (2.2.3)
33
+ i18n (1.15.2)
34
+ concurrent-ruby (~> 1.0)
35
+ json (3.2.0)
36
+ logger (1.7.0)
37
+ minitest (6.1.0)
38
+ drb (~> 2.0)
39
+ prism (>= 1.5, < 3)
40
+ minitest-mock (5.27.0)
41
+ polars-df (0.27.1-aarch64-linux)
42
+ polars-df (0.27.1-aarch64-linux-musl)
43
+ polars-df (0.27.1-arm64-darwin)
44
+ polars-df (0.27.1-x86_64-darwin)
45
+ polars-df (0.27.1-x86_64-linux)
46
+ polars-df (0.27.1-x86_64-linux-musl)
47
+ prism (2.1.0-aarch64-linux-gnu)
48
+ prism (2.1.0-aarch64-linux-musl)
49
+ prism (2.1.0-arm64-darwin)
50
+ prism (2.1.0-x86_64-darwin)
51
+ prism (2.1.0-x86_64-linux-gnu)
52
+ prism (2.1.0-x86_64-linux-musl)
53
+ rake (13.4.2)
54
+ rubyzip (3.7.0)
55
+ securerandom (0.4.1)
56
+ selenium-webdriver (4.54.0)
57
+ base64 (~> 0.2)
58
+ logger (~> 1.4)
59
+ rubyzip (>= 1.2.2, < 4.0)
60
+ websocket (~> 1.0)
61
+ tzinfo (2.0.6)
62
+ concurrent-ruby (~> 1.0)
63
+ uri (1.1.2)
64
+ websocket (1.2.11)
65
+
66
+ PLATFORMS
67
+ aarch64-linux
68
+ aarch64-linux-musl
69
+ arm64-darwin
70
+ x86_64-darwin
71
+ x86_64-linux
72
+ x86_64-linux-musl
73
+
74
+ DEPENDENCIES
75
+ ffiec_as_dataframe!
76
+ minitest (~> 6.1)
77
+ minitest-mock (~> 5.27)
78
+ rake (~> 13.0)
79
+
80
+ RUBY VERSION
81
+ ruby 3.3.0p0
82
+
83
+ BUNDLED WITH
84
+ 2.5.3
data/README.md CHANGED
@@ -1,9 +1,14 @@
1
- # FdicAsDataframe
1
+ # FfiecAsDataframe
2
2
 
3
- Up to date remote economic data access for ruby, using Polars dataframes.
3
+ Up-to-date call report data access for Ruby, using Polars dataframes.
4
4
 
5
5
  This package will fetch call report data (from US banks) from the Federal Financial Institutions Examination Council (FFIEC), and return the results as a Polars Dataframe.
6
6
 
7
+ ## Requirements
8
+
9
+ - Ruby >= 3.3
10
+ - polars-df 0.27.1
11
+
7
12
  ## Installation
8
13
 
9
14
  Add this line to your application's Gemfile:
@@ -24,12 +29,12 @@ Or install it yourself as:
24
29
 
25
30
  With no arguments provided in the initialization call, the gem will fetch the most recent call report data, and return it as a Polars dataframe. Note that most of the column names correspond to 8 character abbreviations that are documented at https://www.federalreserve.gov/apps/mdrm/data-dictionary . As requirements have changed over time, the number of columns will change with each release of the call report data.
26
31
 
27
- ```{ruby}
28
- 3.1.2 :003 > x = FfiecAsDataframe::CallReport.new.fetch
32
+ ```ruby
33
+ 3.3.x :003 > x = FfiecAsDataframe::CallReport.new.fetch
29
34
  =>
30
35
  shape: (4_594, 3_817)
31
36
  ...
32
- 3.1.2 :004 > x
37
+ 3.3.x :004 > x
33
38
  =>
34
39
  shape: (4_594, 3_817)
35
40
  ┌─────────┬─────────────────────────┬────────────────────┬───────────────────┬───┬──────────┬──────────┬──────────┬──────────┐
@@ -53,16 +58,16 @@ shape: (4_594, 3_817)
53
58
 
54
59
  A specific vintage of call report data can be fetched by specifying the "dt" argument in the initialization call.
55
60
 
56
- ```{ruby}
57
- 3.1.2 :005 > x = FfiecAsDataframe::CallReport.new(dt= '2022-12-31'.to_date).fetch
61
+ ```ruby
62
+ 3.3.x :005 > x = FfiecAsDataframe::CallReport.new(dt= '2022-12-31'.to_date).fetch
58
63
  =>
59
64
  shape: (4_756, 3_992)
60
65
  ...
61
- 3.1.2 :006 > x = FfiecAsDataframe::CallReport.new(dt= '2023-12-31'.to_date).fetch
66
+ 3.3.x :006 > x = FfiecAsDataframe::CallReport.new(dt= '2023-12-31'.to_date).fetch
62
67
  =>
63
68
  shape: (4_641, 3_923)
64
69
  ...
65
- 3.1.2 :007 > x
70
+ 3.3.x :007 > x
66
71
  =>
67
72
  shape: (4_641, 3_923)
68
73
  ┌─────────┬─────────────────────────┬────────────────────┬───────────────────┬───┬──────────┬──────────┬──────────┬──────────┐
@@ -86,12 +91,12 @@ shape: (4_641, 3_923)
86
91
 
87
92
  Additionally, a single table (which may be contained in one or more parts) may be fetched using the "tbl" argument to the "new" call. Note that, as in the following example, the "tbl" argument must contain the entire table mnemonic; here we fetched only the "RC" table, despite there being many other tables that also have a mnemonic that starts with "RC".
88
93
 
89
- ```{ruby}
90
- 3.1.2 :009 > x = FfiecAsDataframe::CallReport.new(dt= '2022-12-31'.to_date, tbl = 'RC').fetch
94
+ ```ruby
95
+ 3.3.x :009 > x = FfiecAsDataframe::CallReport.new(dt= '2022-12-31'.to_date, tbl = 'RC').fetch
91
96
  =>
92
97
  shape: (4_757, 80)
93
98
  ...
94
- 3.1.2 :010 > x
99
+ 3.3.x :010 > x
95
100
  =>
96
101
  shape: (4_757, 80)
97
102
  ┌─────────┬──────────────────────────┬─────────────────────┬────────────────────┬───┬──────────────────┬─────────────────┬─────────────────────────────────┬──────────────────┐
@@ -116,6 +121,15 @@ shape: (4_757, 80)
116
121
 
117
122
  Note that this package uses Selenium in order to run javascript on the FFIEC site before downloading the entire call report. If you have issues running Selenium (which will invoke the generation of a "headless" Chrome session), you may want to include an "options" parameter in the creation of the CallReport object and include "options={headless: false}".
118
123
 
124
+ ## Testing
125
+
126
+ This gem uses minitest for testing. Run tests with:
127
+
128
+ ```bash
129
+ bundle exec rake test
130
+ ```
131
+
132
+ Tests mock Selenium/Chrome interactions to avoid external dependencies. No GitHub Actions or CI workflows are configured.
119
133
 
120
134
  ## Development
121
135
 
@@ -125,7 +139,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
125
139
 
126
140
  ## Contributing
127
141
 
128
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ffiec_as_dataframe. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/ffiec_as_dataframe/blob/main/CODE_OF_CONDUCT.md).
142
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bmck/ffiec_as_dataframe. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/bmck/ffiec_as_dataframe/blob/main/CODE_OF_CONDUCT.md).
129
143
 
130
144
  ## License
131
145
 
@@ -133,4 +147,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
133
147
 
134
148
  ## Code of Conduct
135
149
 
136
- Everyone interacting in the FdicAsDataframe project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/ffiec_as_dataframe/blob/main/CODE_OF_CONDUCT.md).
150
+ Everyone interacting in the FfiecAsDataframe project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/bmck/ffiec_as_dataframe/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -1,4 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/gem_tasks"
4
- task default: %i[]
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ task default: :test
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = "Call report data from FFIEC"
13
13
  spec.homepage = "https://github.com/bmck/ffiec_as_dataframe"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.3")
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = "https://github.com/bmck/ffiec_as_dataframe"
@@ -28,8 +28,13 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
 
30
30
  # Uncomment to register a new dependency of your gem
31
- spec.add_dependency 'polars-df'
32
- spec.add_dependency 'rubyzip'
33
- spec.add_dependency 'activesupport', '~> 6', '<7.0.8'
34
- spec.add_dependency 'selenium-webdriver'
31
+ spec.add_dependency 'csv', '~> 3.3'
32
+ spec.add_dependency 'polars-df', '0.27.1'
33
+ spec.add_dependency 'rubyzip', '~> 3.7'
34
+ spec.add_dependency 'activesupport', '~> 8.1'
35
+ spec.add_dependency 'selenium-webdriver', '~> 4.54'
36
+
37
+ spec.add_development_dependency 'minitest', '~> 6.1'
38
+ spec.add_development_dependency 'minitest-mock', '~> 5.27'
39
+ spec.add_development_dependency 'rake', '~> 13.0'
35
40
  end
@@ -1,9 +1,11 @@
1
+ require 'set'
1
2
  require 'polars-df'
2
3
  require 'csv'
3
4
  require 'zip'
4
5
  require 'tempfile'
5
6
  require 'selenium-webdriver'
6
7
  require 'active_support/core_ext/date/calculations'
8
+ require 'active_support/core_ext/object/blank'
7
9
  require 'active_support/core_ext/string/conversions'
8
10
 
9
11
  module FfiecAsDataframe
@@ -18,9 +20,7 @@ module FfiecAsDataframe
18
20
  end
19
21
 
20
22
  def fetch
21
- prefix = 'All_Reports_'
22
23
  dte = dt.end_of_quarter
23
- # dir = prefix + date.year.to_s + format('%02d', date.month.to_s) + date.mday.to_s
24
24
  df = nil
25
25
 
26
26
  Dir.mktmpdir(nil, Dir.tmpdir) do |d|
@@ -33,13 +33,17 @@ module FfiecAsDataframe
33
33
  sleep(0.2)
34
34
  driver.find_elements(css: 'select#ListBox1 option').detect{|o| o.text == 'Call Reports -- Single Period'}.click()
35
35
 
36
- dte_found = false
37
36
  dte = dte.strftime("%m/%d/%Y").to_s
38
37
 
39
38
  if (opt = driver.find_elements(css: 'select#DatesDropDownList option').detect{ |o| o.text == dte }).present?
40
39
  opt.click()
41
40
  else
42
- dtes = driver.find_elements(css: 'select#DatesDropDownList option').map{|o| o.text.to_date }
41
+ dtes = driver.find_elements(css: 'select#DatesDropDownList option').filter_map do |option|
42
+ text = option.text.to_s
43
+ next if text.blank?
44
+
45
+ Date.strptime(text, "%m/%d/%Y")
46
+ end
43
47
  dte = dtes.max.strftime("%m/%d/%Y").to_s
44
48
  driver.find_elements(css: 'select#DatesDropDownList option').detect{|o| o.text == dte }.click()
45
49
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FfiecAsDataframe
4
- VERSION = "0.1.0"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -3,7 +3,6 @@
3
3
  require_relative "ffiec_as_dataframe/version"
4
4
  require_relative "ffiec_as_dataframe/call_report"
5
5
 
6
- module FFiecAsDataframe
6
+ module FfiecAsDataframe
7
7
  class Error < StandardError; end
8
- # Your code goes here...
9
8
  end
metadata CHANGED
@@ -1,77 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffiec_as_dataframe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bill McKinnon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-26 00:00:00.000000000 Z
11
+ date: 2026-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: csv
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.3'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: polars-df
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - ">="
31
+ - - '='
18
32
  - !ruby/object:Gem::Version
19
- version: '0'
33
+ version: 0.27.1
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
- - - ">="
38
+ - - '='
25
39
  - !ruby/object:Gem::Version
26
- version: '0'
40
+ version: 0.27.1
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rubyzip
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - ">="
45
+ - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '0'
47
+ version: '3.7'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - ">="
52
+ - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '0'
54
+ version: '3.7'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: activesupport
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '6'
48
- - - "<"
49
- - !ruby/object:Gem::Version
50
- version: 7.0.8
61
+ version: '8.1'
51
62
  type: :runtime
52
63
  prerelease: false
53
64
  version_requirements: !ruby/object:Gem::Requirement
54
65
  requirements:
55
66
  - - "~>"
56
67
  - !ruby/object:Gem::Version
57
- version: '6'
58
- - - "<"
59
- - !ruby/object:Gem::Version
60
- version: 7.0.8
68
+ version: '8.1'
61
69
  - !ruby/object:Gem::Dependency
62
70
  name: selenium-webdriver
63
71
  requirement: !ruby/object:Gem::Requirement
64
72
  requirements:
65
- - - ">="
73
+ - - "~>"
66
74
  - !ruby/object:Gem::Version
67
- version: '0'
75
+ version: '4.54'
68
76
  type: :runtime
69
77
  prerelease: false
70
78
  version_requirements: !ruby/object:Gem::Requirement
71
79
  requirements:
72
- - - ">="
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '4.54'
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '6.1'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '6.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest-mock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '5.27'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '5.27'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '13.0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
73
123
  - !ruby/object:Gem::Version
74
- version: '0'
124
+ version: '13.0'
75
125
  description: Call report data from FFIEC
76
126
  email:
77
127
  - bill.mckinnon@bmck.org
@@ -80,10 +130,12 @@ extensions: []
80
130
  extra_rdoc_files: []
81
131
  files:
82
132
  - ".gitignore"
133
+ - ".ruby-version"
83
134
  - ".travis.yml"
84
135
  - CHANGELOG.md
85
136
  - CODE_OF_CONDUCT.md
86
137
  - Gemfile
138
+ - Gemfile.lock
87
139
  - LICENSE.txt
88
140
  - README.md
89
141
  - Rakefile
@@ -108,14 +160,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
160
  requirements:
109
161
  - - ">="
110
162
  - !ruby/object:Gem::Version
111
- version: 2.3.0
163
+ version: '3.3'
112
164
  required_rubygems_version: !ruby/object:Gem::Requirement
113
165
  requirements:
114
166
  - - ">="
115
167
  - !ruby/object:Gem::Version
116
168
  version: '0'
117
169
  requirements: []
118
- rubygems_version: 3.3.7
170
+ rubygems_version: 3.5.3
119
171
  signing_key:
120
172
  specification_version: 4
121
173
  summary: Call report data from FFIEC