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_with_no_decisions(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
113 114 115 |
# File 'lib/analysis_sr_stage_mixin.rb', line 113 def cd_accepted_id(stage) get_asrs(stage).cd_accepted_id end |
#cd_from_pattern(stage, patron) ⇒ Object
91 92 93 94 95 96 97 98 |
# File 'lib/analysis_sr_stage_mixin.rb', line 91 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
133 134 135 |
# File 'lib/analysis_sr_stage_mixin.rb', line 133 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
109 110 111 |
# File 'lib/analysis_sr_stage_mixin.rb', line 109 def cd_rejected_id(stage) get_asrs(stage).cd_rejected_id end |
#cd_resolved_id(stage) ⇒ Object
121 122 123 |
# File 'lib/analysis_sr_stage_mixin.rb', line 121 def cd_resolved_id(stage) get_asrs(stage).cd_resolved_id end |
#cd_screened_id(stage) ⇒ Object
117 118 119 |
# File 'lib/analysis_sr_stage_mixin.rb', line 117 def cd_screened_id(stage) get_asrs(stage).cd_screened_id end |
#cd_with_no_decisions(stage) ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/analysis_sr_stage_mixin.rb', line 64 def cd_with_no_decisions(stage) dbc=decisions_by_cd(stage) result=dbc.find_all { |key, vars| Decision::N_EST.keys.inject(0) {|ac,v| ac+vars[v]}==0 }.map {|v|v[0]} result end |
#cd_without_abstract(stage) ⇒ Object
141 142 143 |
# File 'lib/analysis_sr_stage_mixin.rb', line 141 def cd_without_abstract(stage) get_asrs(stage).cd_without_abstract end |
#cd_without_allocations(stage) ⇒ Object
137 138 139 |
# File 'lib/analysis_sr_stage_mixin.rb', line 137 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 |
# 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
73 74 75 |
# File 'lib/analysis_sr_stage_mixin.rb', line 73 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
129 130 131 |
# File 'lib/analysis_sr_stage_mixin.rb', line 129 def incoming_citations(stage, cd_id) get_asrs(stage).incoming_citations cd_id end |
#outgoing_citations(stage, cd_id) ⇒ Object
125 126 127 |
# File 'lib/analysis_sr_stage_mixin.rb', line 125 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
79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/analysis_sr_stage_mixin.rb', line 79 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
145 146 147 |
# File 'lib/analysis_sr_stage_mixin.rb', line 145 def stage_complete?(stage) get_asrs(stage).stage_complete? end |
#user_decisions(stage) ⇒ Object
Who are the judges and how many decisions they take
101 102 103 104 105 106 |
# File 'lib/analysis_sr_stage_mixin.rb', line 101 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 |