<commit_before>require 'logger'
require 'meda'

module Meda

  class ValidationService

    def valid_request?(client_id_cookie, request_params)
      if !client_id_cookie.blank? && !request_params[:dataset].blank?
        Meda.logger.info("called with client_id: #{client_id_cookie} and dataset: #{request_params[:dataset]}")
        return true
      else
        Meda.logger.error("called with invalid client_id: #{client_id_cookie} or dataset #{request_params[:dataset]}")
        return false
      end
    end

    def valid_hit_request?(client_id_cookie, request_params)
      if valid_request?(client_id_cookie, request_params)
        if !request_params[:path].blank?
          Meda.logger.info("call with path: #{request_params[:path]}")
          return true
        else
          Meda.logger.error("called with invalid path: #{request_params[:path]}")
          return false
        end
      end
      Meda.logger.error("valid_request? returned false")
      return false
    end

    def valid_profile_request?(client_id_cookie, request_params)
      if !request_params[:profile_id].blank?
        Meda.logger.info("called with profile_id: #{request_params[:profile_id]}")<commit_msg>updated validation methods to log at the debug level<commit_after>require 'logger'
require 'meda'

module Meda

  class ValidationService

    def valid_request?(client_id_cookie, request_params)
      if !client_id_cookie.blank? && !request_params[:dataset].blank?
        Meda.logger.debug("called with client_id: #{client_id_cookie} and dataset: #{request_params[:dataset]}")
        return true
      else
        Meda.logger.error("called with invalid client_id: #{client_id_cookie} or dataset #{request_params[:dataset]}")
        return false
      end
    end

    def valid_hit_request?(client_id_cookie, request_params)
      if valid_request?(client_id_cookie, request_params)
        if !request_params[:path].blank?
          Meda.logger.debug("call with path: #{request_params[:path]}")
          return true
        else
          Meda.logger.error("called with invalid path: #{request_params[:path]}")
          return false
        end
      end
      Meda.logger.error("valid_request? returned false")
      return false
    end

    def valid_profile_request?(client_id_cookie, request_params)
      if !request_params[:profile_id].blank?
        Meda.logger.debug("called with profile_id: #{request_params[:profile_id]}")
{'fraction_non_alphanumeric': 0.10245901639344263, 'fraction_numerical': 0.0, 'mean_word_length': 3.446265938069217, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2396649', 'n_tokens_mistral': 697, 'n_tokens_neox': 694, 'n_words': 157}