Skip to content

Refactor performance indicator data files

Vasilii Iakliushin requested to merge 6966_refactor_perfomance_indicators into master

Why is this change being made?

Contributes to #6966 (closed) Closes #8358 (closed)

We want to split data/performance_indicators.yml into multiple files.

Solution

Create a collection of YML files in data/performance_indicators directory. (ex. data/performance_indicators/chief_of_staff_team.yml).

Each new file contains only entries for the matching org structure. (ex. org: Chief of Staff Team -> chief_of_staff_team.yml).

I've modified the code in helpers to keep the same behavior as before.

How-to sync performance_indicators with master

We have daily updates to performance_indicators.yml file. I'm posting here a script to help to resolve conflicts with master branch.

require 'yaml'

performance_indicators_data = YAML.load_file('data/performance_indicators.yml')
uniq_orgs =  performance_indicators_data.map { |pi| pi['org'] }.uniq

uniq_orgs.each do |org| 
  data = performance_indicators_data.select { |pi| pi['org'] == org }.to_yaml.gsub("---\n", '')
  File.write("data/performance_indicators/#{org.gsub(/ /, '_').downcase}.yml", data)
end
Edited by Vasilii Iakliushin

Merge request reports