-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Job setup and testing; new transforms (#33)
* make application configurable here, or from projects using it * handle special options for destinations * handle namespaced file registry keys * add FileRegistryEntry class to handle settings in one place and validate * use pry for console * implement dry-container as file registry and customize it to create/return FileRegistryEntry objects * separate Job from BaseJob; add TestingJob * add Deduplicate::Table and Extract::Fields transforms * add documentation and update tests to new format * add ExampleFormatter method to help create documentation
- Loading branch information
Showing
63 changed files
with
3,041 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,6 @@ | |
|
||
# rspec failure tracking | ||
.rspec_status | ||
.byebug_history | ||
|
||
**/.~lock* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
--no-private | ||
--markup markdown | ||
- | ||
LICENSE.txt | ||
LICENSE.txt | ||
doc/file_registry_entry.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# File Registry Entry | ||
|
||
## PATH_REQ | ||
|
||
Constant registering the known source/destination classes and whether each requires a file path for read/write. | ||
|
||
If you create or incorporate a new source/destination class, you will get a warning if you use it and do not register it here. | ||
|
||
## reghash | ||
|
||
A file registry entry is initialized with a Hash of data about the file. This Hash will be sent from your ETL application. | ||
|
||
The allowable Hash keys, expected Hash value formats, and expectations about them are described below. | ||
|
||
**`:path` [String] full or expandable relative path to the expected location of the file** | ||
|
||
* default: `nil` | ||
* required if either `:src_class` or `:dest_class` requires a path (in `PATH_REQ`) | ||
|
||
`:src_class` [Class] the Ruby class used to read in data | ||
|
||
* default: value of `Kiba::Extend.source` (`Kiba::Common::Sources::CSV` unless overridden by your ETL app) | ||
* required, but default supplied if not given | ||
|
||
`:src_opt` [Hash] file options used when reading in source | ||
|
||
* default: value of `Kiba::Extend.csvopts` | ||
* required, but default supplied if not given | ||
|
||
`:dest_class` [Class] the Ruby class used to write out the data | ||
|
||
* default: value of `Kiba::Extend.destination` (`Kiba::Extend::Destinations::CSV` unless overridden by your ETL app) | ||
* required, but default supplied if not given | ||
|
||
`:dest_opt` [Hash] file options used when writing data | ||
|
||
* default: value of `Kiba::Extend.csvopts` | ||
* required, but default supplied if not given | ||
|
||
`:dest_special_opts` [Hash] additional options for writing out the data | ||
|
||
* Not all destination classes support extra options. If you provide unsupported extra options, they will not be sent through to the destination class, and you will receive a warning in STDOUT. The current most common use is to define `initial_headers` (i.e. which columns should be first in file) to `Kiba::Extend::Destinations::CSV`. | ||
* optional | ||
|
||
```ruby | ||
reghash = { | ||
path: '/path/to/file.csv', | ||
dest_class: Kiba::Extend::Destinations::CSV, | ||
dest_special_opts: { initial_headers: %i[objectnumber briefdescription] } | ||
} | ||
``` | ||
|
||
**`:creator` [Method] Ruby method that generates this file** | ||
|
||
* Used to run ETL jobs to create necessary files, if said files do not exist | ||
* required unless file is supplied | ||
|
||
**`:supplied` [true, false] whether the file/data is supplied from outside the ETL** | ||
|
||
- default: false | ||
- Manually set to true for: | ||
- original data files from client | ||
- mappings/reconciliations to be merged into the ETL/migration | ||
- any other files created external to the ETL, which only need to be read from and never generated by the ETL process | ||
|
||
Both of the following are valid: | ||
|
||
```ruby | ||
reghash = { | ||
path: '/project/working/objects_prep.csv', | ||
creator: Project::ClientData::ObjectTable.method(:prep) | ||
} | ||
|
||
reghash = { | ||
path: '/project/clientData/objects.csv', | ||
supplied: true | ||
} | ||
``` | ||
|
||
Note the following pattern!: | ||
|
||
Class or Module constant name + `.method` + method name **as symbol** | ||
|
||
**`:lookup_on` [Symbol] column to use as keys in lookup table created from file data** | ||
|
||
* required if file is used as a lookup source | ||
* You can register the same file multiple times under different file keys with different `:lookup_on` values if you need to use the data for different lookup purposes | ||
|
||
`:desc` [String] description of what the file is/what it is used for. Used when post-processing reports results to STDOUT | ||
|
||
* optional | ||
|
||
`:tags` [Array<Symbol>] list of arbitrary tags useful for categorizing data/jobs in your ETL | ||
|
||
* optional | ||
* If set, you can filter to run only jobs tagged with a given tag | ||
* Tags I commonly use: | ||
* :report_problems - reports that indicate something unexpected or that I need to do more work | ||
* :report_fyi - informational reports | ||
* :cspace - final files ready to import | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'jobs/parser' | ||
|
||
Kiba::Extend::Jobs.extend(Kiba::Extend::Jobs::Parser) | ||
|
||
module Kiba | ||
module Extend | ||
module Jobs | ||
end | ||
end | ||
end |
Oops, something went wrong.