icp-firmographic-filter 1.0.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 +7 -0
- data/LICENSE +22 -0
- data/README.md +48 -0
- data/bin/icp-firmographic-filter +29 -0
- data/lib/icp_firmographic_filter.rb +81 -0
- metadata +66 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: d0164b101dd03618b8e36c67c20edff6e883b08bdfbca06f123295364efdbe3f
|
|
4
|
+
data.tar.gz: 9b6e2a9e3e537528dd2ad8bcf205b89ee5fc76dbe190af39e45f4dcec1dd74f1
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 91cafde55b16e3a7472b1e67c3c67a62703eec9c391b39f882eebc5ab77b02e15872c820e4e717965586d6b566ae5aa3505c6b564e26dc056d733458cfca1b98
|
|
7
|
+
data.tar.gz: 427502427e5bd2e5e90e07628e6c68833a66fb926eaff33353e69ae54643d4c93dd6176b507ca65527290e276f7e5894d32f159391e61b1c50b19707ce736aa7
|
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OneGTMLab
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
data/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# icp-firmographic-filter
|
|
2
|
+
|
|
3
|
+
A small Ruby command-line tool and library that checks a list of companies against the firmographic rules of your ideal customer profile and says why
|
|
4
|
+
each company fails. Write the rules as a headcount range, allowed countries, allowed industries and a minimum revenue; every company comes back PASS or
|
|
5
|
+
FAIL with each broken rule named. A missing value counts as a failure ("employees missing"), so gaps in your data show up instead of passing silently.
|
|
6
|
+
Offline, deterministic. Background: [firmographics](https://www.onegtmlab.dev/glossary/firmographics).
|
|
7
|
+
Built by [OneGTMLab](https://www.onegtmlab.dev/glossary/firmographics) (GTM engineering for B2B teams).
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
gem install icp-firmographic-filter
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Use
|
|
16
|
+
|
|
17
|
+
`companies.csv` needs a `name` column plus the columns your rules use: `employees`, `country`, `industry`, `revenue`.
|
|
18
|
+
|
|
19
|
+
```csv
|
|
20
|
+
name,employees,country,industry,revenue
|
|
21
|
+
Acme,120,US,Software,5000000
|
|
22
|
+
Beta,12,US,Software,900000
|
|
23
|
+
Cobalt,300,DE,Fintech,"20,000,000"
|
|
24
|
+
Delta,,US,Retail,100
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
icp-firmographic-filter companies.csv --employees 50-500 --countries US,CA --industries "Software,Fintech" --revenue-min 1000000
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Acme PASS
|
|
33
|
+
Beta FAIL employees 12 below 50; revenue 900000 below 1000000
|
|
34
|
+
Cobalt FAIL country DE not allowed
|
|
35
|
+
Delta FAIL employees missing; industry Retail not allowed; revenue 100 below 1000000
|
|
36
|
+
1 of 4 pass
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Ranges: `50-500`, `50-` (50 or more) and `-500` (up to 500). Countries and industries are matched exactly, ignoring case, against the values in your CSV.
|
|
40
|
+
A rule you leave out is not checked. A bad option or a missing file stops with `error: ...` and exit code 1; no arguments prints usage and exits 2.
|
|
41
|
+
|
|
42
|
+
## Test
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
ruby test/run.rb
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
MIT licence.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative '../lib/icp_firmographic_filter'
|
|
5
|
+
|
|
6
|
+
args = ARGV.dup
|
|
7
|
+
if args.empty? || args.include?('-h') || args.include?('--help')
|
|
8
|
+
warn "usage: icp-firmographic-filter companies.csv [--employees 50-500] [--countries US,CA] [--industries 'Software,Fintech'] [--revenue-min 1000000]\n" \
|
|
9
|
+
"CSV columns: name plus the columns your rules use (employees, country, industry, revenue). More: https://www.onegtmlab.dev/glossary/firmographics"
|
|
10
|
+
exit 2
|
|
11
|
+
end
|
|
12
|
+
file = args.shift
|
|
13
|
+
rules = IcpFirmographicFilter::Rules.new
|
|
14
|
+
begin
|
|
15
|
+
until args.empty?
|
|
16
|
+
flag = args.shift
|
|
17
|
+
val = args.shift or abort "#{flag} needs a value"
|
|
18
|
+
case flag
|
|
19
|
+
when '--employees' then rules.employees = IcpFirmographicFilter.parse_range(val)
|
|
20
|
+
when '--countries' then rules.countries = IcpFirmographicFilter.parse_list(val)
|
|
21
|
+
when '--industries' then rules.industries = IcpFirmographicFilter.parse_list(val)
|
|
22
|
+
when '--revenue-min' then rules.revenue_min = Float(val)
|
|
23
|
+
else abort "unknown option #{flag}"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
print IcpFirmographicFilter.render(IcpFirmographicFilter.from_csv(File.read(file), rules))
|
|
27
|
+
rescue ArgumentError, Errno::ENOENT => e
|
|
28
|
+
abort "error: #{e.message}"
|
|
29
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'csv'
|
|
4
|
+
|
|
5
|
+
# Checks companies against firmographic rules you write down: headcount range, countries, industries, minimum revenue.
|
|
6
|
+
# Offline and deterministic; every failed row says which rule failed and why.
|
|
7
|
+
module IcpFirmographicFilter
|
|
8
|
+
Rules = Struct.new(:employees, :countries, :industries, :revenue_min, keyword_init: true)
|
|
9
|
+
Result = Struct.new(:name, :pass, :reasons, keyword_init: true)
|
|
10
|
+
|
|
11
|
+
module_function
|
|
12
|
+
|
|
13
|
+
# "50-500", "50-" (50 or more), "-500" (up to 500)
|
|
14
|
+
def parse_range(text)
|
|
15
|
+
lo, hi = text.to_s.split('-', 2).map(&:strip)
|
|
16
|
+
raise ArgumentError, "bad range #{text.inspect}, use 50-500, 50- or -500" if hi.nil? && !text.to_s.include?('-')
|
|
17
|
+
|
|
18
|
+
[lo.to_s.empty? ? nil : Integer(lo), hi.to_s.empty? ? nil : Integer(hi)]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def parse_list(text)
|
|
22
|
+
text.to_s.split(',').map { |x| x.strip.downcase }.reject(&:empty?)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def number(value)
|
|
26
|
+
s = value.to_s.strip.delete(',_ ')
|
|
27
|
+
return nil if s.empty?
|
|
28
|
+
|
|
29
|
+
Float(s)
|
|
30
|
+
rescue ArgumentError
|
|
31
|
+
nil
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def check(row, rules)
|
|
35
|
+
reasons = []
|
|
36
|
+
if rules.employees
|
|
37
|
+
lo, hi = rules.employees
|
|
38
|
+
n = number(row['employees'])
|
|
39
|
+
if n.nil? then reasons << 'employees missing'
|
|
40
|
+
elsif lo && n < lo then reasons << "employees #{n.to_i} below #{lo}"
|
|
41
|
+
elsif hi && n > hi then reasons << "employees #{n.to_i} above #{hi}"
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
if rules.countries
|
|
45
|
+
c = row['country'].to_s.strip.downcase
|
|
46
|
+
if c.empty? then reasons << 'country missing'
|
|
47
|
+
elsif !rules.countries.include?(c) then reasons << "country #{row['country'].to_s.strip} not allowed"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
if rules.industries
|
|
51
|
+
i = row['industry'].to_s.strip.downcase
|
|
52
|
+
if i.empty? then reasons << 'industry missing'
|
|
53
|
+
elsif !rules.industries.include?(i) then reasons << "industry #{row['industry'].to_s.strip} not allowed"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
if rules.revenue_min
|
|
57
|
+
r = number(row['revenue'])
|
|
58
|
+
if r.nil? then reasons << 'revenue missing'
|
|
59
|
+
elsif r < rules.revenue_min then reasons << "revenue #{r.to_i} below #{rules.revenue_min.to_i}"
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
Result.new(name: row['name'].to_s, pass: reasons.empty?, reasons: reasons)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def from_csv(text, rules)
|
|
66
|
+
table = CSV.parse(text, headers: true, header_converters: ->(h) { h.to_s.strip.downcase })
|
|
67
|
+
raise ArgumentError, 'the CSV needs a name column' unless table.headers.include?('name')
|
|
68
|
+
|
|
69
|
+
table.map { |row| check(row.to_h, rules) }
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def render(results)
|
|
73
|
+
out = +''
|
|
74
|
+
results.each do |r|
|
|
75
|
+
out << format("%-18s %s\n", r.name, r.pass ? 'PASS' : "FAIL #{r.reasons.join('; ')}")
|
|
76
|
+
end
|
|
77
|
+
passed = results.count(&:pass)
|
|
78
|
+
out << "#{passed} of #{results.size} pass\n"
|
|
79
|
+
out
|
|
80
|
+
end
|
|
81
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: icp-firmographic-filter
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- OneGTMLab
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: csv
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
-
|
|
17
|
+
- ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: "0"
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
-
|
|
25
|
+
- ">="
|
|
26
|
+
- !ruby/object:Gem::Version
|
|
27
|
+
version: "0"
|
|
28
|
+
description: "Ruby CLI and library: write your ideal customer profile as headcount range, countries, industries and minimum revenue, run a companies CSV through it, and get PASS or FAIL with the reason for every failed row. Offline."
|
|
29
|
+
email:
|
|
30
|
+
- account@onegtmlab.dev
|
|
31
|
+
executables:
|
|
32
|
+
- icp-firmographic-filter
|
|
33
|
+
extensions: []
|
|
34
|
+
extra_rdoc_files: []
|
|
35
|
+
files:
|
|
36
|
+
- LICENSE
|
|
37
|
+
- README.md
|
|
38
|
+
- bin/icp-firmographic-filter
|
|
39
|
+
- lib/icp_firmographic_filter.rb
|
|
40
|
+
homepage: "https://www.onegtmlab.dev/glossary/firmographics"
|
|
41
|
+
licenses:
|
|
42
|
+
- MIT
|
|
43
|
+
metadata:
|
|
44
|
+
homepage_uri: "https://www.onegtmlab.dev/glossary/firmographics"
|
|
45
|
+
source_code_uri: "https://github.com/jaizendra-netizen/icp-firmographic-filter"
|
|
46
|
+
documentation_uri: "https://www.onegtmlab.dev/glossary/firmographics"
|
|
47
|
+
rdoc_options: []
|
|
48
|
+
require_paths:
|
|
49
|
+
- lib
|
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
-
|
|
53
|
+
- ">="
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
version: "2.7"
|
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
-
|
|
59
|
+
- ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: "0"
|
|
62
|
+
requirements: []
|
|
63
|
+
rubygems_version: 4.1.0
|
|
64
|
+
specification_version: 4
|
|
65
|
+
summary: Check companies against firmographic rules and see why each one fails
|
|
66
|
+
test_files: []
|