class Eco::API::UseCases::Default::People::Treat::Analyse class Cli < Eco::API::UseCases::Cli str = "Provides a set of tools to analyse a set of people (i.e. detect duplicates)" desc str callback do |_people, _session, options| options.deep_merge!(output: {file: "people_analysis.txt"}) unless options.dig(:output, :file) #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 str = "Generates a list of people with possible duplicates." add_option("-identify-duplicates", str) do |options| options.deep_merge!(usecase: {analyse_people: {identify_duplicates: true}}) end str = "Works with -identify-duplicates. Sets field to be used in the comparison." add_option("-use-field", str) do |options| expression = SCR.get_arg("-use-field", with_param: true) options.deep_merge!(usecase: {analyse_people: {use_field: expression}}) end str = "Works with -identify-duplicates. Adds an additional layer of comparison." add_option("-facet-field", str) do |options| expression = SCR.get_arg("-facet-field", with_param: true) options.deep_merge!(usecase: {analyse_people: {facet_field: expression}}) end str = "Works with -identify-duplicates. Skips the rearrangement stage." add_option("-only-screening", str) do |options| options.deep_merge!(usecase: {analyse_people: {only_screening: true}}) end str = "Works with -identify-duplicates. Re-adjust scores ignoring matching words." add_option("-ignore-matching-words", str) do |options| options.deep_merge!(usecase: {analyse_people: {ignore_matching_words: true}}) end str = "Works with -identify-duplicates. Re-adjust the comparing strings to do not have repeated words." add_option("-unique-words", str) 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 str = "Generates a json file with all the people involved in the final results of the analysis." add_option("-backup-people-results", str) 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 str = "Genarates a CSV file with all people of the final results." add_option("-to-csv", str) 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 end end