<commit_before>module API
  class ReportsController < ApplicationController
    before_action :set_default_format

    def self.report_attributes
      [
        :study,
        :study_date,
        :anamnesis,
        :diagnosis,
        :findings,
        :evaluation,
        :procedure,
        :clinic,
        :username,
        :patient_number,
        :patient_first_name,
        :patient_last_name,
        :patient_date_of_birth,
        :recipient_last_name,
        :recipient_first_name,
        :recipient_title,
        :recipient_suffix,
        :recipient_salutation,
        :recipient_address,
        :recipient_zip,
        :recipient_city,
        :recipient_fax_number
      ]
    end

    skip_before_action :verify_authenticity_token, only: [:create]
    wrap_parameters :report, include: self.report_attributes

    def create
      api_report = Report.new(report_params)<commit_msg>Add hack to capture valid study date via study.<commit_after>module API
  class ReportsController < ApplicationController
    before_action :set_default_format

    def self.report_attributes
      [
        :study,
        :study_date,
        :anamnesis,
        :diagnosis,
        :findings,
        :evaluation,
        :procedure,
        :clinic,
        :username,
        :patient_number,
        :patient_first_name,
        :patient_last_name,
        :patient_date_of_birth,
        :recipient_last_name,
        :recipient_first_name,
        :recipient_title,
        :recipient_suffix,
        :recipient_salutation,
        :recipient_address,
        :recipient_zip,
        :recipient_city,
        :recipient_fax_number
      ]
    end

    skip_before_action :verify_authenticity_token, only: [:create]
    wrap_parameters :report, include: self.report_attributes

    def create
      api_report = Report.new(report_params)

      # TODO: Remove this hack!
      if api_report.study_date.blank?
        api_report.study_date = api_report.study.split(':').first.to_date
      end

{'fraction_non_alphanumeric': 0.0736318407960199, 'fraction_numerical': 0.0, 'mean_word_length': 2.340531561461794, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2637329', 'n_tokens_mistral': 646, 'n_tokens_neox': 594, 'n_words': 104}