Module: AnalysisSrStageMixin
- Included in:
- AnalysisSystematicReview
- Defined in:
- lib/analysis_sr_stage_mixin.rb
Overview
Provides methods for analysis of a stage on a systematic review Used by AnalysisSystematicReview
Instance Method Summary collapse
- #cd_accepted_id(stage) ⇒ Object
- #cd_from_pattern(stage, patron) ⇒ Object
- #cd_id_assigned_by_user(stage, user_id) ⇒ Object
- #cd_rejected_id(stage) ⇒ Object
- #cd_resolved_id(stage) ⇒ Object
- #cd_screened_id(stage) ⇒ Object
- #cd_without_abstract(stage) ⇒ Object
- #cd_without_allocations(stage) ⇒ Object
-
#count_by_pattern(list) ⇒ Object
Count how many DC belongs to each pattern.
-
#decisions_by_cd(stage) ⇒ Object
Se analiza cada cd y se cuenta cuantas decisions para cada type.
-
#decisions_pattern(stage) ⇒ Object
Define cuantos CD están en cada patrón.
- #get_asrs(stage) ⇒ Object
- #incoming_citations(stage, cd_id) ⇒ Object
- #outgoing_citations(stage, cd_id) ⇒ Object
-
#resolution_by_cd(stage) ⇒ Object
A hash, with key=cd_id and value= resolution.
-
#resolution_commentary_by_cd(stage) ⇒ Object
A hash, with key=cd_id and value= resolution commentary.
- #resolution_pattern(stage) ⇒ Object
-
#resolutions_f_pattern_decision(stage) ⇒ Object
provides a hash, with keys containing the users decisions and values with the pattern for resolutions.
- #stage_complete?(stage) ⇒ Boolean
-
#user_decisions(stage) ⇒ Object
Who are the judges and how many decisions they take.
Instance Method Details
#cd_accepted_id(stage) ⇒ Object
107 108 109 |
# File 'lib/analysis_sr_stage_mixin.rb', line 107 def cd_accepted_id(stage) get_asrs(stage).cd_accepted_id end |
#cd_from_pattern(stage, patron) ⇒ Object
85 86 87 88 89 90 91 92 |
# File 'lib/analysis_sr_stage_mixin.rb', line 85 def cd_from_pattern(stage, patron) decisions_by_cd(stage).find_all {|v| v[1] == patron }.map {|v| v[0]} end |
#cd_id_assigned_by_user(stage, user_id) ⇒ Object
127 128 129 |
# File 'lib/analysis_sr_stage_mixin.rb', line 127 def cd_id_assigned_by_user(stage, user_id) get_asrs(stage).cd_id_assigned_by_user(user_id) end |
#cd_rejected_id(stage) ⇒ Object
103 104 105 |
# File 'lib/analysis_sr_stage_mixin.rb', line 103 def cd_rejected_id(stage) get_asrs(stage).cd_rejected_id end |
#cd_resolved_id(stage) ⇒ Object
115 116 117 |
# File 'lib/analysis_sr_stage_mixin.rb', line 115 def cd_resolved_id(stage) get_asrs(stage).cd_resolved_id end |
#cd_screened_id(stage) ⇒ Object
111 112 113 |
# File 'lib/analysis_sr_stage_mixin.rb', line 111 def cd_screened_id(stage) get_asrs(stage).cd_screened_id end |
#cd_without_abstract(stage) ⇒ Object
135 136 137 |
# File 'lib/analysis_sr_stage_mixin.rb', line 135 def cd_without_abstract(stage) get_asrs(stage).cd_without_abstract end |
#cd_without_allocations(stage) ⇒ Object
131 132 133 |
# File 'lib/analysis_sr_stage_mixin.rb', line 131 def cd_without_allocations(stage) get_asrs(stage).cd_without_allocations end |
#count_by_pattern(list) ⇒ Object
Count how many DC belongs to each pattern
49 50 51 52 53 54 55 |
# File 'lib/analysis_sr_stage_mixin.rb', line 49 def count_by_pattern(list) list.inject({}) {|ac, v| ac[v[1]] ||= 0 ac[v[1]] += 1 ac } end |
#decisions_by_cd(stage) ⇒ Object
Se analiza cada cd y se cuenta cuantas decisions para cada type
60 61 62 63 64 |
# File 'lib/analysis_sr_stage_mixin.rb', line 60 def decisions_by_cd(stage) @decisions_by_cd_h ||= {} @decisions_by_cd_h[stage] ||= get_asrs(stage).decisions_by_cd end |
#decisions_pattern(stage) ⇒ Object
Define cuantos CD están en cada patrón
67 68 69 |
# File 'lib/analysis_sr_stage_mixin.rb', line 67 def decisions_pattern(stage) count_by_pattern(decisions_by_cd(stage)) end |
#get_asrs(stage) ⇒ Object
34 35 36 |
# File 'lib/analysis_sr_stage_mixin.rb', line 34 def get_asrs(stage) Analysis_SR_Stage.new(@rs, stage) end |
#incoming_citations(stage, cd_id) ⇒ Object
123 124 125 |
# File 'lib/analysis_sr_stage_mixin.rb', line 123 def incoming_citations(stage, cd_id) get_asrs(stage).incoming_citations cd_id end |
#outgoing_citations(stage, cd_id) ⇒ Object
119 120 121 |
# File 'lib/analysis_sr_stage_mixin.rb', line 119 def outgoing_citations(stage, cd_id) get_asrs(stage).outcoming_citations cd_id end |
#resolution_by_cd(stage) ⇒ Object
A hash, with key=cd_id and value= resolution
38 39 40 41 |
# File 'lib/analysis_sr_stage_mixin.rb', line 38 def resolution_by_cd(stage) @resolution_by_cd_h ||= {} @resolution_by_cd_h[stage] ||= get_asrs(stage).resolutions_by_cd end |
#resolution_commentary_by_cd(stage) ⇒ Object
A hash, with key=cd_id and value= resolution commentary
43 44 45 46 |
# File 'lib/analysis_sr_stage_mixin.rb', line 43 def resolution_commentary_by_cd(stage) @resolution_commentary_by_cd_h ||= {} @resolution_commentary_by_cd_h[stage] ||= get_asrs(stage).resolutions_commentary_by_cd end |
#resolution_pattern(stage) ⇒ Object
56 57 58 |
# File 'lib/analysis_sr_stage_mixin.rb', line 56 def resolution_pattern(stage) count_by_pattern(resolution_by_cd(stage)) end |
#resolutions_f_pattern_decision(stage) ⇒ Object
provides a hash, with keys containing the users decisions and values with the pattern for resolutions
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/analysis_sr_stage_mixin.rb', line 73 def resolutions_f_pattern_decision(stage) cds = @rs.cd_id_by_stage(stage) rpc = resolution_by_cd(stage) dpc = decisions_by_cd(stage) cds.inject({}) {|ac, cd_id| patron = dpc[cd_id] ac[patron] ||= {"yes" => 0, "no" => 0, Resolution::NO_RESOLUTION => 0} ac[patron][rpc[cd_id]] += 1 ac } end |
#stage_complete?(stage) ⇒ Boolean
139 140 141 |
# File 'lib/analysis_sr_stage_mixin.rb', line 139 def stage_complete?(stage) get_asrs(stage).stage_complete? end |
#user_decisions(stage) ⇒ Object
Who are the judges and how many decisions they take
95 96 97 98 99 100 |
# File 'lib/analysis_sr_stage_mixin.rb', line 95 def user_decisions(stage) @rs.group_users.inject({}) {|ac, usuario| ac[usuario.id] = {usuario: usuario, adu: AnalysisUserDecision.new(@rs.id, usuario.id, stage)} ac } end |