Class: RubyMaat::Analysis::Communication
- Inherits:
-
BaseAnalysis
- Object
- BaseAnalysis
- RubyMaat::Analysis::Communication
- Defined in:
- lib/ruby_maat/analysis/communication.rb
Overview
Communication analysis - identifies developer collaboration patterns Based on Conway’s Law: organizations design systems that mirror their communication structure
Instance Method Summary collapse
Instance Method Details
#analyze(dataset, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ruby_maat/analysis/communication.rb', line 8 def analyze(dataset, = {}) min_revs = [:min_revs] || 5 min_shared_revs = [:min_shared_revs] || 5 # Group entities by author to find their work domains = {} dataset.to_df.each_row do |row| = row[:author] entity = row[:entity] [] ||= Set.new [] << entity end # Find pairs of authors who work on shared entities results = [] = .keys.combination(2) .each do |, | shared_entities = [] & [] next if shared_entities.size < min_shared_revs = [].size = [].size # Communication strength based on shared work avg_entities = average(, ) next if avg_entities < min_revs communication_strength = percentage(shared_entities.size, avg_entities) results << { author: , peer: , shared: shared_entities.size, average: avg_entities.ceil, strength: communication_strength } end # Sort by communication strength descending results.sort_by! { |r| -r[:strength] } to_csv_data(results, i[ peer shared average strength]) end |