Class: UatActions::GenerateStudy

Inherits:
UatActions show all
Defined in:
app/uat_actions/uat_actions/generate_study.rb

Overview

Will construct a study

Constant Summary

Constants inherited from UatActions

CATEGORY_LIST

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from UatActions

all, category, find, form_field, form_fields, #form_fields, grouped_and_sorted_uat_actions, id, inherited, permitted, #report, #save, to_partial_path, uat_actions

Class Method Details

.defaultObject



11
12
13
# File 'app/uat_actions/uat_actions/generate_study.rb', line 11

def self.default
  new(study_name: UatActions::StaticRecords.study.name)
end

Instance Method Details

#create_studyObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/uat_actions/uat_actions/generate_study.rb', line 22

def create_study
  Study.create_with(
    state: 'active',
    study_metadata_attributes: {
      data_access_group: 'dag',
      study_type: UatActions::StaticRecords.study_type,
      faculty_sponsor: UatActions::StaticRecords.faculty_sponsor,
      data_release_study_type: UatActions::StaticRecords.data_release_study_type,
      study_description: 'A study generated for UAT',
      contaminated_human_dna: 'No',
      contains_human_dna: 'No',
      commercially_available: 'No',
      program: UatActions::StaticRecords.program
    }
  ).find_or_create_by!(name: study_name)
end

#performObject



15
16
17
18
19
20
# File 'app/uat_actions/uat_actions/generate_study.rb', line 15

def perform
  study = create_study
  print_report(study)

  true
end