Skip to content

Commit

Permalink
API to filter and transform individual records before forwarding on t…
Browse files Browse the repository at this point in the history
…o Senzing. (#22)
  • Loading branch information
jamesiarmes committed Apr 10, 2024
1 parent 9157a89 commit f1d797f
Show file tree
Hide file tree
Showing 36 changed files with 773 additions and 330 deletions.
8 changes: 8 additions & 0 deletions .github/config/rubocop_linter_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ versions:
# Resource: https://rubocop.readthedocs.io/en/stable/configuration/
rubocop_config_path: '.rubocop.yml'

# Whether or not to use --force-exclusion when building the rubocop command. Use this if you are only linting modified
# files and typically excluded files have been changed. For example, if you exclude db/schema.rb in your rubocop.yml
# but a change gets made, then with the check_scope config set to 'modified' rubocop will lint db/schema.rb. If you set
# this to true, rubocop will ignore it.
# Valid options: true || false
# Default: false
rubocop_force_exclusion: true

# The scope of code that RuboCop should lint. Use this if you only want to lint changed files. If this is not set
# or not equal to 'modified', RuboCop is run against the entire codebase. Note that this will not work on the master branch.
# Valid options: 'modified'
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: git fetch origin main --depth=1
- name: RuboCop Linter
uses: andrewmcodes/rubocop-linter-action@v3.3.0
env:
Expand All @@ -22,7 +23,7 @@ jobs:
COVERAGE: 1

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -41,20 +42,20 @@ jobs:
IMAGE_NAME: ${{ github.repository }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
push: true
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 1
- run: git fetch origin main --depth=1
- name: RuboCop Linter
uses: andrewmcodes/rubocop-linter-action@v3.3.0
env:
Expand All @@ -22,7 +25,7 @@ jobs:
COVERAGE: 1

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -41,20 +44,20 @@ jobs:
IMAGE_NAME: ${{ github.repository }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
push: true
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.vscode

# Ignore custom configs but allow changes to the sample.
.env
config/*
!config/config.sample.yml

Expand Down
19 changes: 19 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,26 @@ AllCops:
Naming/MemoizedInstanceVariableName:
Enabled: false

# Count multi-line hashes and arrays in examples as one line.
RSpec/ExampleLength:
CountAsOne:
- array
- hash

# Favor more explicit contexts over limited nesting.
RSpec/NestedGroups:
AllowedGroups:
- context

# Allow stubbing methods from the system under test, which is useful for testing
# simple helper methods.
# https://thoughtbot.com/blog/don-t-stub-the-system-under-test
RSpec/SubjectStub:
Enabled: false

RSpec/MultipleMemoizedHelpers:
AllowSubject: true

# Rack::MockResponse does not implement has_http_status?.
RSpec/Rails/HaveHttpStatus:
Enabled: false
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ end

group :test do
gem 'factory_bot', '~> 6.2'
gem 'rack-test', '~> 2.1'
gem 'rspec', '~> 3.12'
gem 'rspec-github', '~> 2.4'
gem 'simplecov', '~> 0.22'
Expand Down
95 changes: 62 additions & 33 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,63 +4,88 @@ PATH
cmr-entity-resolution (0.1.0)
faraday (~> 2.7)
file_exists (~> 0.2)
ibm_db (~> 5.4)
grape (~> 2.0)
iteraptor (~> 0.10)
mongo (~> 2.18)
rack (~> 3.0)
rackup (~> 2.1)
sequel (~> 5.68)
thor (~> 1.2)
yajl-ruby (~> 1.4)

GEM
remote: https://rubygems.org/
specs:
activemodel (7.0.7.2)
activesupport (= 7.0.7.2)
activerecord (7.0.7.2)
activemodel (= 7.0.7.2)
activesupport (= 7.0.7.2)
activesupport (7.0.7.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
bigdecimal (3.1.7)
bson (4.15.0)
builder (3.2.4)
concurrent-ruby (1.2.2)
diff-lcs (1.5.0)
docile (1.4.0)
down (5.4.1)
addressable (~> 2.8)
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
zeitwerk (~> 2.6)
dry-inflector (1.0.0)
dry-logic (1.5.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-types (1.7.2)
bigdecimal (~> 3.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0)
dry-inflector (~> 1.0)
dry-logic (~> 1.4)
zeitwerk (~> 2.6)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
faraday (2.7.6)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
file_exists (0.2.0)
grape (2.0.0)
activesupport (>= 5)
builder
dry-types (>= 1.1)
mustermann-grape (~> 1.0.0)
rack (>= 1.3.0)
rack-accept
i18n (1.14.1)
concurrent-ruby (~> 1.0)
ibm_db (5.4.1)
activerecord (< 7.1)
down
zip
iteraptor (0.10.0)
json (2.6.3)
json (2.7.1)
language_server-protocol (3.17.0.3)
minitest (5.19.0)
mongo (2.18.2)
bson (>= 4.14.1, < 5.0.0)
parallel (1.23.0)
parser (3.2.2.3)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
mustermann-grape (1.0.2)
mustermann (>= 1.0.0)
parallel (1.24.0)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
public_suffix (5.0.1)
racc (1.7.0)
racc (1.7.3)
rack (3.0.10)
rack-accept (0.4.5)
rack (>= 0.4)
rack-test (2.1.0)
rack (>= 1.3)
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.8.0)
rexml (3.2.5)
regexp_parser (2.9.0)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
Expand All @@ -76,26 +101,27 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (1.52.0)
rubocop (1.62.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.0.0)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.18.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-factory_bot (2.23.1)
rubocop (~> 1.33)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.22.0)
rubocop (~> 1.33)
rubocop-rspec (2.27.1)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
Expand All @@ -110,18 +136,21 @@ GEM
thor (1.2.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)
unicode-display_width (2.5.0)
webrick (1.8.1)
yajl-ruby (1.4.3)
zip (2.0.2)
zeitwerk (2.6.13)

PLATFORMS
arm64-darwin-23
x86_64-darwin-20
x86_64-darwin-22
x86_64-linux

DEPENDENCIES
cmr-entity-resolution!
factory_bot (~> 6.2)
rack-test (~> 2.1)
rake (~> 13.0)
rspec (~> 3.12)
rspec-github (~> 2.4)
Expand Down
5 changes: 4 additions & 1 deletion cmr-entity-resolution.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ Gem::Specification.new do |s|

# Add runtime dependencies.
s.add_runtime_dependency 'faraday', '~> 2.7'
s.add_runtime_dependency 'ibm_db', '~> 5.4'
s.add_runtime_dependency 'grape', '~> 2.0'
# s.add_runtime_dependency 'ibm_db', '~> 5.4'
s.add_runtime_dependency 'iteraptor', '~> 0.10'
s.add_runtime_dependency 'mongo', '~> 2.18'
s.add_runtime_dependency 'rack', '~> 3.0'
s.add_runtime_dependency 'rackup', '~> 2.1'
s.add_runtime_dependency 'sequel', '~> 5.68'
s.add_runtime_dependency 'thor', '~> 1.2'
s.add_runtime_dependency 'yajl-ruby', '~> 1.4'
Expand Down
7 changes: 7 additions & 0 deletions config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

require_relative 'lib/api/api'

use Rack::RewindableInput::Middleware

run API::API
3 changes: 2 additions & 1 deletion config/config.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ filters:
inverse: false

sources:
- type: CSV
import:
type: CSV
path: /home/senzing/import.csv
field_map:
party_id: RECORD_ID
Expand Down
Loading

0 comments on commit f1d797f

Please sign in to comment.