Skip to content

Commit

Permalink
add fits-unfiltered
Browse files Browse the repository at this point in the history
  • Loading branch information
terrywbrady committed Jan 5, 2024
1 parent b391d2e commit 613f202
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
2 changes: 2 additions & 0 deletions coll-health-obj-analysis/config/os_queries.ssm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ outputs:
class: FitsOutput
fits-filtered:
class: FitsFilteredOutput
fits-unfiltered:
class: FitsUnfilteredOutput

queries:
default:
Expand Down
11 changes: 10 additions & 1 deletion coll-health-obj-analysis/fits_outputter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def format_fits_output
xml = Nokogiri::XML(File.read(fits_output)).remove_namespaces!
xml.xpath('/fits/identification').each do |doc|
stat = doc.xpath('@status').text
stat = 'NA' if stat.empty?
stat = 'TOOLS_AGREE' if stat.empty?
c = doc.xpath('count(identity)')
count = c > 1 ? "(#{c.to_i} identities)" : ''
write "\t\tStatus: #{stat} #{count}"
Expand Down Expand Up @@ -146,3 +146,12 @@ def record_stat(stat)
@interesting = true unless stat == 'UNKNOWN'
end
end

# Invoke FITS, output unfiltered FITS XML
class FitsUnfilteredOutput < FitsOutput
def format_fits_output
return unless File.exist?(fits_output)

puts File.read(fits_output)
end
end
9 changes: 5 additions & 4 deletions coll-health-obj-analysis/object_health_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ def make_options(argv)
end.parse(argv)

# the default extractor does not pull file details... change the formatter if needed
if options[:fmt] == :default &&
(options[:output] == :files || options[:output] == :fits || options[:output] == :'fits-filtered')
options[:fmt] =
:files
if options[:fmt] == :default
case options[:output]
when :files, :fits, :'fits-filtered', :'fits-unfiltered'
options[:fmt] = :files
end
end
options
end
Expand Down
3 changes: 1 addition & 2 deletions coll-health-obj-analysis/sample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ _Uses YAML v1.14.0 extension_

## Conversion program to turn YAML into JSON
```rb
File.open('config/obj_schema.json', 'w') do |f|
f.write(
File.open('config/obj_schema.json', 'w') do |f| f.write(
JSON.pretty_generate(
YAML.safe_load(
File.read('config/obj_schema.yml'),
Expand Down

0 comments on commit 613f202

Please sign in to comment.