Skip to content

Commit

Permalink
Updated metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
djgagne committed Aug 8, 2024
1 parent 24a5b78 commit d258f66
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions update_metrics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from ruamel.yaml import YAML
yaml = YAML()

metrics_file = 'data/metrics.yml'
publications_file = 'data/publications.yml'
realtimeproducts_file = 'data/realtimeproducts.yml'
collaboration_file = 'data/collaboration.yml'

with open(publications_file) as f:
publications_dict = yaml.load(f)
publications = len(publications_dict['items'])

with open(realtimeproducts_file) as f:
realtimeproducts_dict = yaml.load(f)
realtimeproducts = len(realtimeproducts_dict['items'])

with open(collaboration_file) as f:
collaboration_dict = yaml.load(f)
interns = len(collaboration_dict['items'])

with open(metrics_file, 'r+') as f:
metrics_dict = yaml.load(f)
metrics_dict['counter_item'][0]["number"] = publications
metrics_dict['counter_item'][1]["number"] = realtimeproducts
metrics_dict['counter_item'][2]["number"] = interns
with open(metrics_file, 'w') as f:
yaml.dump(metrics_dict, f)

0 comments on commit d258f66

Please sign in to comment.