slcsp 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +13 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +108 -0
- data/README.md +56 -0
- data/Rakefile +12 -0
- data/comments.md +20 -0
- data/data/plans.csv +22241 -0
- data/data/slcsp.csv +52 -0
- data/data/zips.csv +51542 -0
- data/exe/slcsp +6 -0
- data/lib/slcsp/cli.rb +65 -0
- data/lib/slcsp/config.rb +31 -0
- data/lib/slcsp/index.rb +25 -0
- data/lib/slcsp/plan_parser.rb +28 -0
- data/lib/slcsp/slcsp_matcher.rb +41 -0
- data/lib/slcsp/slcsp_parser.rb +29 -0
- data/lib/slcsp/version.rb +5 -0
- data/lib/slcsp/zip_parser.rb +26 -0
- data/lib/slcsp.rb +11 -0
- data/sig/slcsp.rbs +4 -0
- data/slcsp.gemspec +37 -0
- metadata +126 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 54a9297dd49c608c030c86e0c5fad1533f71206e72ae5da0bcd06f72704e51b4
|
4
|
+
data.tar.gz: 8f1663495f75425223f51384234e04581451f7e867d769c28cb92609dc7951b6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 14019111a299e5006a21b9282d5971e863a14670083c1254192a5f2c7d7d06956cd1bf95920c4afddc29ddb87702605307d93e53f45694fc243b6e3ddd89e761
|
7
|
+
data.tar.gz: 04ca56cef529b6a8567ad9a199809bb0de4154223e8525e4a5c8fd9e3a7c41e7d8bc6e2aa595cd6ddaaa359c851c671c7cee271bedc6591aa6b3eb30c7c47dcf
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
slcsp (0.1.0)
|
5
|
+
thor
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
aruba (2.1.0)
|
11
|
+
bundler (>= 1.17, < 3.0)
|
12
|
+
childprocess (>= 2.0, < 5.0)
|
13
|
+
contracts (>= 0.16.0, < 0.18.0)
|
14
|
+
cucumber (>= 4.0, < 9.0)
|
15
|
+
rspec-expectations (~> 3.4)
|
16
|
+
thor (~> 1.0)
|
17
|
+
ast (2.4.2)
|
18
|
+
builder (3.2.4)
|
19
|
+
childprocess (4.1.0)
|
20
|
+
coderay (1.1.3)
|
21
|
+
contracts (0.17)
|
22
|
+
cucumber (8.0.0)
|
23
|
+
builder (~> 3.2, >= 3.2.4)
|
24
|
+
cucumber-ci-environment (~> 9.0, >= 9.0.4)
|
25
|
+
cucumber-core (~> 11.0, >= 11.0.0)
|
26
|
+
cucumber-cucumber-expressions (~> 15.1, >= 15.1.1)
|
27
|
+
cucumber-gherkin (~> 23.0, >= 23.0.1)
|
28
|
+
cucumber-html-formatter (~> 19.1, >= 19.1.0)
|
29
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
30
|
+
diff-lcs (~> 1.5, >= 1.5.0)
|
31
|
+
mime-types (~> 3.4, >= 3.4.1)
|
32
|
+
multi_test (~> 1.1, >= 1.1.0)
|
33
|
+
sys-uname (~> 1.2, >= 1.2.2)
|
34
|
+
cucumber-ci-environment (9.1.0)
|
35
|
+
cucumber-core (11.0.0)
|
36
|
+
cucumber-gherkin (~> 23.0, >= 23.0.1)
|
37
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
38
|
+
cucumber-tag-expressions (~> 4.1, >= 4.1.0)
|
39
|
+
cucumber-cucumber-expressions (15.2.0)
|
40
|
+
cucumber-gherkin (23.0.1)
|
41
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
42
|
+
cucumber-html-formatter (19.2.0)
|
43
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
44
|
+
cucumber-messages (18.0.0)
|
45
|
+
cucumber-tag-expressions (4.1.0)
|
46
|
+
diff-lcs (1.5.0)
|
47
|
+
ffi (1.15.5)
|
48
|
+
json (2.6.3)
|
49
|
+
method_source (1.0.0)
|
50
|
+
mime-types (3.4.1)
|
51
|
+
mime-types-data (~> 3.2015)
|
52
|
+
mime-types-data (3.2022.0105)
|
53
|
+
multi_test (1.1.0)
|
54
|
+
parallel (1.22.1)
|
55
|
+
parser (3.2.0.0)
|
56
|
+
ast (~> 2.4.1)
|
57
|
+
pry (0.14.2)
|
58
|
+
coderay (~> 1.1)
|
59
|
+
method_source (~> 1.0)
|
60
|
+
rainbow (3.1.1)
|
61
|
+
rake (13.0.6)
|
62
|
+
regexp_parser (2.6.2)
|
63
|
+
rexml (3.2.5)
|
64
|
+
rspec (3.12.0)
|
65
|
+
rspec-core (~> 3.12.0)
|
66
|
+
rspec-expectations (~> 3.12.0)
|
67
|
+
rspec-mocks (~> 3.12.0)
|
68
|
+
rspec-core (3.12.1)
|
69
|
+
rspec-support (~> 3.12.0)
|
70
|
+
rspec-expectations (3.12.2)
|
71
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
72
|
+
rspec-support (~> 3.12.0)
|
73
|
+
rspec-mocks (3.12.3)
|
74
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
75
|
+
rspec-support (~> 3.12.0)
|
76
|
+
rspec-support (3.12.0)
|
77
|
+
rubocop (1.44.1)
|
78
|
+
json (~> 2.3)
|
79
|
+
parallel (~> 1.10)
|
80
|
+
parser (>= 3.2.0.0)
|
81
|
+
rainbow (>= 2.2.2, < 4.0)
|
82
|
+
regexp_parser (>= 1.8, < 3.0)
|
83
|
+
rexml (>= 3.2.5, < 4.0)
|
84
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
85
|
+
ruby-progressbar (~> 1.7)
|
86
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
87
|
+
rubocop-ast (1.24.1)
|
88
|
+
parser (>= 3.1.1.0)
|
89
|
+
ruby-progressbar (1.11.0)
|
90
|
+
sys-uname (1.2.2)
|
91
|
+
ffi (~> 1.1)
|
92
|
+
thor (1.2.1)
|
93
|
+
unicode-display_width (2.4.2)
|
94
|
+
|
95
|
+
PLATFORMS
|
96
|
+
arm64-darwin-21
|
97
|
+
|
98
|
+
DEPENDENCIES
|
99
|
+
aruba
|
100
|
+
cucumber
|
101
|
+
pry (~> 0.14)
|
102
|
+
rake (~> 13.0)
|
103
|
+
rspec (~> 3.0)
|
104
|
+
rubocop (~> 1.21)
|
105
|
+
slcsp!
|
106
|
+
|
107
|
+
BUNDLED WITH
|
108
|
+
2.3.7
|
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# SLCSP
|
2
|
+
|
3
|
+
## Calculate the second lowest cost silver plan
|
4
|
+
|
5
|
+
## Problem
|
6
|
+
|
7
|
+
You've been asked to determine the second lowest cost silver plan (SLCSP) for
|
8
|
+
a group of ZIP codes.
|
9
|
+
|
10
|
+
## Task
|
11
|
+
|
12
|
+
You've been given a CSV file, `slcsp.csv`, which contains the ZIP codes in the
|
13
|
+
first column. Fill in the second column with the rate (see below) of the
|
14
|
+
corresponding SLCSP and emit the answer on `stdout` using the same CSV format as
|
15
|
+
the input. Write your code in your best programming language.
|
16
|
+
|
17
|
+
### Expected output
|
18
|
+
|
19
|
+
The order of the rows in your answer as emitted on stdout must stay the same as how they
|
20
|
+
appeared in the original `slcsp.csv`. The first row should be the column headers: `zipcode,rate`
|
21
|
+
The remaining lines should output unquoted values with two digits after the decimal
|
22
|
+
place of the rates, for example: `64148,245.20`.
|
23
|
+
|
24
|
+
It may not be possible to determine a SLCSP for every ZIP code given; for example, if there is only one silver plan available, there is no _second_ lowest cost plan. Check for cases where a definitive answer cannot be found and leave those cells blank in the output (no quotes or zeroes or other text). For example, `40813,`.
|
25
|
+
|
26
|
+
## Additional information
|
27
|
+
|
28
|
+
The SLCSP is the so-called "benchmark" health plan in a particular area. It's
|
29
|
+
used to compute the tax credit that qualifying individuals and families receive
|
30
|
+
on the marketplace. It's the second lowest rate for a silver plan in the rate area.
|
31
|
+
|
32
|
+
For example, if a rate area had silver plans with rates of `[197.3, 197.3, 201.1, 305.4, 306.7, 411.24]`, the SLCSP for that rate area would be `201.1`,
|
33
|
+
since it's the second lowest rate in that rate area.
|
34
|
+
|
35
|
+
A plan has a "metal level", which can be either Bronze, Silver, Gold, Platinum,
|
36
|
+
or Catastrophic. The metal level is indicative of the level of coverage the plan
|
37
|
+
provides.
|
38
|
+
|
39
|
+
A plan has a "rate", which is the amount that a consumer pays as a monthly
|
40
|
+
premium, in dollars.
|
41
|
+
|
42
|
+
A plan has a "rate area", which is a geographic region in a state that
|
43
|
+
determines the plan's rate. A rate area is a tuple of a state and a number, for
|
44
|
+
example, NY 1, IL 14.
|
45
|
+
|
46
|
+
There are two additional CSV files in this directory besides `slcsp.csv`:
|
47
|
+
|
48
|
+
- `plans.csv` — all the health plans in the U.S. on the marketplace
|
49
|
+
- `zips.csv` — a mapping of ZIP code to county/counties & rate area(s)
|
50
|
+
|
51
|
+
A ZIP code can potentially be in more than one county. If the county can not be
|
52
|
+
determined definitively by the ZIP code, it may still be possible to determine
|
53
|
+
the rate area for that ZIP code. A ZIP code can also be in more than one rate area. In that case, the answer is ambiguous
|
54
|
+
and should be left blank.
|
55
|
+
|
56
|
+
We'll want to compile your code from source and run it from a Unix-like command line, so please include the complete instructions for doing so in a COMMENTS file.
|
data/Rakefile
ADDED
data/comments.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Slcsp
|
2
|
+
|
3
|
+
Welcome AdHoc professional. This is a repository with the source code of slcsp gem.
|
4
|
+
There are two ways to see the desired output:
|
5
|
+
|
6
|
+
## Installation from rubygems.org
|
7
|
+
|
8
|
+
Provided, you have bundler installed
|
9
|
+
|
10
|
+
$ gem install slcsp
|
11
|
+
|
12
|
+
OR Use binary as is
|
13
|
+
|
14
|
+
1. cd into gem's directory
|
15
|
+
2. run command
|
16
|
+
|
17
|
+
$ exe/slcsp match
|
18
|
+
|
19
|
+
The gem comes with default configurations. Ability to pass different config options will be added
|
20
|
+
in future versions.
|