From 9f2d7d46f0ce70dbe9ae27e3a30ec32a82bfb758 Mon Sep 17 00:00:00 2001 From: Harris Tzovanakis Date: Mon, 13 Nov 2023 15:29:47 +0100 Subject: [PATCH] annual-reports: fix subjects --- annual-reports/src/api.py | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/annual-reports/src/api.py b/annual-reports/src/api.py index 1d6cf68..ef37159 100644 --- a/annual-reports/src/api.py +++ b/annual-reports/src/api.py @@ -23,6 +23,38 @@ def _backoff_handler(details): ) +ONLY_CERN_SUBJECTS = [ + "Particle Physics - Experiment", + "Particle Physics - Phenomenology", + "Particle Physics - Theory", + "Particle Physics - Lattice", + "Nuclear Physics - Experiment", + "Nuclear Physics - Theory", + "General Relativity and Cosmology", + "General Theoretical Physics", + "Detectors and Experimental Techniques", + "Accelerators and Storage Rings", + "Health Physics and Radiation Effects", + "Computing and Computers", + "Mathematical Physics and Mathematics", + "Astrophysics and Astronomy", + "Nonlinear Systems", + "Condensed Matter", + "Other Fields of Physics", + "Chemical Physics and Chemistry", + "Engineering", + "Information Transfer and Management", + "Physics in General", + "Commerce, Economics, Social Science", + "Biography, Geography, History", + "Other Subjects", + "Science in General", + "Quantum Technology", + "Education and Outreach", + "Popular Science", +] + + class AnnualReportsAPI: def __init__( self, @@ -122,7 +154,7 @@ def get_subjects_by_year(self, year): subjects = {} for subject in yearly_report.findall("line"): name = subject.find("result").text - if "TOTAL" in name: + if "TOTAL" in name or name not in ONLY_CERN_SUBJECTS: continue subjects[name] = subject.find("nb").text return subjects