lib/eco/cli/config/default/usecases.rb in eco-helpers-2.0.19 vs lib/eco/cli/config/default/usecases.rb in eco-helpers-2.0.21
- old
+ new
@@ -24,15 +24,40 @@
file = SCR.get_file("-to", required: true, should_exist: false)
options.deep_merge!(output: {file: file})
end
desc = "Provides a set of tools to analyse a set of people (i.e. detect duplicates)"
- cases.add("-analyse-people", :export, desc, case_name: "-analyse-people") do |people, session, options|
+ cases.add("-analyse-people", :export, desc, case_name: "analyse-people") do |people, session, options|
options.deep_merge!(output: {file: "people_analysis.txt"}) unless options.dig(:output, :file)
- end.add_option("-to", "Specify the output file") do |options|
+ #unless options.dig(:usecase, :analyse_people, :use_field)
+ # options.deep_merge!(usecase: {analyse_people: {use_field: :name}})
+ #end
+ end.add_option("-to", "Specify the output file.") do |options|
file = SCR.get_file("-to", required: true, should_exist: false)
options.deep_merge!(output: {file: file})
+ end.add_option("-identify-duplicates", "Generates a list of people with possible duplicates.") do |options|
+ options.deep_merge!(usecase: {analyse_people: {identify_duplicates: true}})
+ end.add_option("-use-field", "Works with -identify-duplicates. Sets field to be used in the comparison.") do |options|
+ expression = SCR.get_arg("-use-field", with_param: true)
+ options.deep_merge!(usecase: {analyse_people: {use_field: expression}})
+ end.add_option("-facet-field", "Works with -identify-duplicates. Adds an additional layer of comparison.") do |options|
+ expression = SCR.get_arg("-facet-field", with_param: true)
+ options.deep_merge!(usecase: {analyse_people: {facet_field: expression}})
+ end.add_option("-only-screening", "Works with -identify-duplicates. Skips the rearrangement stage.") do |options|
+ options.deep_merge!(usecase: {analyse_people: {only_screening: true}})
+ end.add_option("-ignore-matching-words", "Works with -identify-duplicates. Re-adjust scores ignoring matching words.") do |options|
+ options.deep_merge!(usecase: {analyse_people: {ignore_matching_words: true}})
+ end.add_option("-unique-words", "Works with -identify-duplicates. Re-adjust the comparing strings to do not have repeated words.") do |options|
+ options.deep_merge!(usecase: {analyse_people: {unique_words: true}})
+ end.add_option("-identify-unnamed", "Identifies all people with no names.") do |options|
+ options.deep_merge!(usecase: {analyse_people: {identify_unnamed: true}})
+ end.add_option("-backup-people-results", "Generates a json file with all the people involved in the final results of the analysis.") do |options|
+ file = SCR.get_file("-backup-people-results", required: true, should_exist: false)
+ options.deep_merge!(usecase: {analyse_people: {backup_people: File.expand_path(file)}})
+ end.add_option("-to-csv", "Genarates a CSV file with all people of the final results.") do |options|
+ file = SCR.get_file("-to-csv", required: true, should_exist: false) || "Results.csv"
+ options.deep_merge!(usecase: {analyse_people: {csv_file: File.expand_path(file)}})
end
desc = "It exports to a CSV the (filtered) people"
cases.add("-people-to-csv", :export, desc) do |people, session, options|
file = SCR.get_file("-people-to-csv", required: true, should_exist: false)
@@ -59,9 +84,13 @@
options.deep_merge!(other: {file: {name: file, format: :csv}})
end.add_option("-column", "Specify the input column header with the codes") do |options|
col_codes = SCR.get_arg("-column", with_param: true)
options.deep_merge!(other: {file: {codes_column: col_codes}})
end
+
+ desc = "Cleans from filter_tags those tags that are not present in the tagtree (as per tagtree.json file)."
+ desc += " It will preserve standard register tags of most common registers (i.e. EVENT, RISK)."
+ cases.add("-clean-unknown-tags", :transform, desc, case_name: "clean-unknown-tags")
desc = "Removes the landing page or sets it to -page-id"
cases.add("-reset-landing-page", :transform, desc, case_name: "reset-landing-page")
.add_option("-page-id", "Target landing page to set to the users") do |options|
SCR.get_arg("-page-id", with_param: true).tap do |new_id|