Sha256: f94eeafeb9a224b473fffb703e5bf316f6b536c72232986369541f0eac060100

Contents?: true

Size: 1.14 KB

Versions: 20

Compression:

Stored size: 1.14 KB

Contents

require_dependency "renalware/reporting"

module Renalware
  module Reporting
    class FetchAuditJson
      class << self
        def call(view_name)
          convert_rows_from_audit_view_into_datatables_compatible_json(view_name)
        end

        def convert_rows_from_audit_view_into_datatables_compatible_json(view_name)
          conn = ActiveRecord::Base.connection
          result = conn.execute("select audit_view_as_json(#{conn.quote(view_name)});")
          result.values[0][0]
        end
      end

      # A WIP to translate audit column names into human friendly ones.
      # May need to establish guidelines for instance apply text case in the view itself so
      # eg pct_HGB = % HGB without having to know to upcase certain bits of the name but
      # capitalise others etc.
      # def self.humanize_column_name(column)
      #   column
      #     .gsub("pct_", "% ")
      #     .gsub("count_", "No.")
      #     .gsub("avg_", "Avg ")
      #     .gsub("max", "Max ")
      #     .gsub("gt_eq_", "≥ ")
      #     .gsub("lt_eq_", "≤ ")
      #     .gsub("gt_", "> ")
      #     .gsub("lt_", "< ")
      # end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
renalware-core-2.0.8 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.7 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.5 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.4 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.3 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.2 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.1 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.0 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.0.pre.rc13 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.0.pre.rc11 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.0.pre.rc10 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.0.pre.rc9 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.0.pre.rc8 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.0.pre.rc7 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.0.pre.rc6 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.0.pre.rc5 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.0.pre.rc4 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.0.pre.rc3 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.0.pre.rc1 app/models/renalware/reporting/fetch_audit_json.rb
renalware-core-2.0.0.pre.beta12 app/models/renalware/reporting/fetch_audit_json.rb