diff --git a/.github/workflows/automated-testing.yml b/.github/workflows/automated-testing.yml
index 75ecc48bd..1ad9fdaf3 100644
--- a/.github/workflows/automated-testing.yml
+++ b/.github/workflows/automated-testing.yml
@@ -12,6 +12,50 @@ jobs:
- name: make
run: |
make
+ - name: validate-profile
+ run: |
+ echo "java -jar build/robot.jar validate-profile --input build/oeo/$(cat VERSION)/oeo-full.owl --profile Full -vvv --output merged-validation.txt"
+ java -jar build/robot.jar validate-profile --input build/oeo/$(cat VERSION)/oeo-full.owl --profile Full -vvv --output merged-validation.txt
+ - name: verify
+ run: |
+ java -jar build/robot.jar verify --input build/oeo/$(cat VERSION)/oeo-full.owl --queries tests/verify/*
+ - uses: actions/upload-artifact@master
+ with:
+ name: build-artifacts
+ path: build/oeo
+ test:
+ runs-on: ubuntu-latest
+ needs: build
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-python@v4
+ with:
+ python-version: '3.7'
+ architecture: x64
+ - uses: actions/setup-java@v2
+ with:
+ distribution: 'adopt'
+ java-version: '11'
+ - uses: actions/download-artifact@master
+ with:
+ name: build-artifacts
+ path: build/oeo
+ - name: install python dependencies
+ run: pip install -r src/scripts/requirements.txt
+ - name: setup robot 1.9.0
+ run: |
+ wget https://github.com/ontodev/robot/releases/download/v1.9.0/robot.jar -O build/robot19.jar
+ - name: Build ETD xlsx
+ run: |
+ java -jar build/robot19.jar merge --input build/oeo/$(cat VERSION)/oeo-full.omn \
+ --include-annotations true \
+ export --header "ID|LABEL|definition" \
+ --prefix "OEO: http://openenergy-platform.org/ontology/oeo/OEO_" \
+ --sort "LABEL" \
+ --export $(pwd)/build/oeo/$(cat VERSION)/etd.xlsx
+ - name: Build ETD csv
+ run: |
+ python $(pwd)/src/scripts/etd/etd.py $(pwd)/build/oeo/$(cat VERSION)
- name: consistency
run: |
wget https://github.com/owlcs/releases/raw/master/HermiT/org.semanticweb.hermit-packaged-1.4.6.519-SNAPSHOT.jar -O build/hermit.jar
@@ -22,21 +66,39 @@ jobs:
fi
echo "Ontology is inconsistent: $OUT"
exit 1
- - name: validate-profile
- run: |
- echo "java -jar build/robot.jar validate-profile --input build/oeo/$(cat VERSION)/oeo-full.owl --profile Full -vvv --output merged-validation.txt"
- java -jar build/robot.jar validate-profile --input build/oeo/$(cat VERSION)/oeo-full.owl --profile Full -vvv --output merged-validation.txt
- - name: verify
- run: |
- java -jar build/robot.jar verify --input build/oeo/$(cat VERSION)/oeo-full.owl --queries tests/verify/*
- - name: competency
- run: |
- bash tests/competency_questions/run_questions.sh "java -jar build/hermit.jar" $(pwd)/build/oeo/$(cat VERSION)/oeo-full.owl true
- bash tests/competency_questions/run_questions.sh "java -jar build/hermit.jar" $(pwd)/build/oeo/$(cat VERSION)/oeo-full.owl false
- - name: Upload Artifacts
+ - name: Upload Ontology
+ if: always()
uses: actions/upload-artifact@v3
with:
name: build-files
path: |
build/**/*
- !build/**/*.jar
\ No newline at end of file
+ !build/**/*.jar
+ - name: competency
+ continue-on-error: true
+ run: |
+ pytest -s -v
+ # bash tests/competency_questions/run_questions.sh "java -jar build/hermit.jar" $(pwd)/build/oeo/$(cat VERSION)/oeo-full.owl true
+ # bash tests/competency_questions/run_questions.sh "java -jar build/hermit.jar" $(pwd)/build/oeo/$(cat VERSION)/oeo-full.owl false
+ - name: Upload Artifacts
+ if: always()
+ uses: actions/upload-artifact@v3
+ with:
+ name: test-report
+ path: build/report.json
+ - name: Get Coverage for badge
+ run : |
+ echo "COVERAGE=$(head build/report.json | grep -o '"coverage": "[^"]*"' | grep -o '[^"]*\%')" >> $GITHUB_ENV
+ REF=${{ github.ref }}
+ IFS='/' read -ra PATHS <<< "$REF"
+ BRANCH_NAME="${PATHS[1]}_${PATHS[2]}"
+ echo "BRANCH=$(echo ${BRANCH_NAME})" >> $GITHUB_ENV
+ - name: Coverage Badge
+ uses: schneegans/dynamic-badges-action@v1.0.0
+ with:
+ auth: ${{ secrets.GIST_SECRET }}
+ gistID: 6d00affa9fbc89c79684d62091d96551
+ filename: open_energy_ontology__${{ env.BRANCH }}.json
+ label: CQ Coverage
+ message: ${{ env.COVERAGE }}
+ color: green
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 567609b12..d120bfc65 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
build/
+*/__pycache__/*
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 68bd908df..bfe17e139 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,9 +26,12 @@ and the versioning aims to respect [Semantic Versioning](http://semver.org/spec/
- secondary energy production (#1619)
- hydro energy, solar energy, wind energy (#1620)
- gross domestic product (#1623)
-
+- reimplemented competency question tests in pytest (#1420)
+- added commands to filter competency questions from the command line (#1420)
+- added descriptive names to competency questions. and organized them in directories (#1420)
### Removed
+- old compteency question bash script (#1420)
## [1.15.0] - 2023-05-31
diff --git a/README.md b/README.md
index e35df8d0b..ef5725a04 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,7 @@
[![License: CC0-1.0](https://img.shields.io/badge/License-CC0%201.0-lightgrey.svg)](http://creativecommons.org/publicdomain/zero/1.0/)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/OpenEnergyPlatform/ontology)
+![Coverage Badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/areleu/6d00affa9fbc89c79684d62091d96551/raw/open_energy_ontology__heads_feature-1419-competency-question-coverage-report.json)
# Open Energy Family - Open Energy Ontology (OEO)
diff --git a/src/scripts/etd/etd.py b/src/scripts/etd/etd.py
index e2e766d2d..f3a90dfac 100644
--- a/src/scripts/etd/etd.py
+++ b/src/scripts/etd/etd.py
@@ -25,9 +25,7 @@
df = df.replace('\n', '
', regex=True)
df = df.sort_values("LABEL", key=lambda col: col.str.strip().str.lower())
# Create one table per letter:
-
- pathlib.Path(cwd + "/src/scripts/etd/glossary/").mkdir(parents=True, exist_ok=True)
-
+ pathlib.Path(target_path).joinpath("glossary").mkdir(parents=True, exist_ok=True)
# header = GLOSSARY_HEADER + " ".join([f"[{letter}]({BASE_LINK_WIKI}{letter})" for letter in string.ascii_uppercase]) + "\n"
# with open(cwd + "/src/scripts/etd/glossary/glossary.md", "w") as fil:
@@ -55,4 +53,4 @@
df_csv["ID"] = df_csv["ID"].str.replace("http://openenergy-platform.org/ontology/oeo/oeo-physical/", "")
df_csv["ID"] = df_csv["ID"].str.replace("http://openenergy-platform.org/ontology/oeo/oeo-model/", "")
df_csv["ID"] = df_csv["ID"].str.replace(":", "_")
- df_csv.to_csv(pathlib.Path(target_path).joinpath("glossary/glossary.csv").as_posix(), index=False)
\ No newline at end of file
+ df_csv.to_csv(pathlib.Path(target_path).joinpath("glossary/glossary.csv").as_posix(), index=False)
diff --git a/src/scripts/requirements.txt b/src/scripts/requirements.txt
index d2a0c938b..541c177d3 100644
--- a/src/scripts/requirements.txt
+++ b/src/scripts/requirements.txt
@@ -1,3 +1,5 @@
pandas
tabulate
-openpyxl
\ No newline at end of file
+openpyxl
+pytest
+pytest_harvest
\ No newline at end of file
diff --git a/tests/competency_questions/q1.omn b/tests/competency_questions/deprecated/001_biofuel_is_renewable_fuel.omn
similarity index 98%
rename from tests/competency_questions/q1.omn
rename to tests/competency_questions/deprecated/001_biofuel_is_renewable_fuel.omn
index 79d799367..224607e53 100644
--- a/tests/competency_questions/q1.omn
+++ b/tests/competency_questions/deprecated/001_biofuel_is_renewable_fuel.omn
@@ -3,11 +3,11 @@ Prefix: :
Ontology:
# Competency Question: Is biofuel renewable fuel?
-
+
Class: OEO_00000033
Class: OEO_00000072
Class: OEO_00000072
SubClassOf: OEO_00000033
-
+
# This competency question gets deprecated with this pull request: https://github.com/OpenEnergyPlatform/ontology/pull/1409
\ No newline at end of file
diff --git a/tests/competency_questions/q29.omn b/tests/competency_questions/deprecated/029_biofuel_is_classified_as_renewable_fuel.omn
similarity index 85%
rename from tests/competency_questions/q29.omn
rename to tests/competency_questions/deprecated/029_biofuel_is_classified_as_renewable_fuel.omn
index fe6cb326c..9b482e7ba 100644
--- a/tests/competency_questions/q29.omn
+++ b/tests/competency_questions/deprecated/029_biofuel_is_classified_as_renewable_fuel.omn
@@ -12,4 +12,4 @@ Class: OEO_00000033
Class: OEO_00000072
SubClassOf: OEO_00000033
-# This competency question gets deprecated with this pull request: https://github.com/OpenEnergyPlatform/ontology/pull/1409
\ No newline at end of file
+# This competency question gets deprecated with this pull request: https://github.com/OpenEnergyPlatform/ontology/pull/1409
diff --git a/tests/competency_questions/q43.omn b/tests/competency_questions/implementing/043_thermal_energy_bearers_carry_energy.omn
similarity index 88%
rename from tests/competency_questions/q43.omn
rename to tests/competency_questions/implementing/043_thermal_energy_bearers_carry_energy.omn
index dc24c6117..9f021915b 100644
--- a/tests/competency_questions/q43.omn
+++ b/tests/competency_questions/implementing/043_thermal_energy_bearers_carry_energy.omn
@@ -5,15 +5,14 @@ Prefix: obo:
Ontology:
-# Do all hot things carry energy?
+# Do all hot things carry energy?
Class: owl:Nothing
-ObjectProperty: obo:RO_0000053 #bearer_of
+ObjectProperty: obo:RO_0000053 #bearer_of
Class: OEO_00000207 #Thermal energy
ObjectProperty: obo:RO_0000091 #has_disposition
Class: OEO_00000151 #energy carrier disposition
EquivalentClasses: ((obo:RO_0000053 some OEO_00000207) and not (obo:RO_0000091 some OEO_00000151)), owl:Nothing
# All bearers of thermal energy have the disposition of being energy carriers
-
\ No newline at end of file
diff --git a/tests/competency_questions/q44.omn b/tests/competency_questions/implementing/044_renewable_energy_do_not_use_fossil_fuel.omn
similarity index 100%
rename from tests/competency_questions/q44.omn
rename to tests/competency_questions/implementing/044_renewable_energy_do_not_use_fossil_fuel.omn
diff --git a/tests/competency_questions/q48.omn b/tests/competency_questions/implementing/048_energy_from_pv_cell_is_renewable.omn
similarity index 100%
rename from tests/competency_questions/q48.omn
rename to tests/competency_questions/implementing/048_energy_from_pv_cell_is_renewable.omn
diff --git a/tests/competency_questions/q49.omn b/tests/competency_questions/implementing/049_natural_gas_not_anthropogenic.omn
similarity index 100%
rename from tests/competency_questions/q49.omn
rename to tests/competency_questions/implementing/049_natural_gas_not_anthropogenic.omn
diff --git a/tests/competency_questions/q50.omn b/tests/competency_questions/implementing/050_energy_from_coal_powerplant_not_renewable.omn
similarity index 100%
rename from tests/competency_questions/q50.omn
rename to tests/competency_questions/implementing/050_energy_from_coal_powerplant_not_renewable.omn
diff --git a/tests/competency_questions/q45.omn b/tests/competency_questions/model/soundness/045_scenario_realizes_at_most_one_model_calculation_.omn
similarity index 100%
rename from tests/competency_questions/q45.omn
rename to tests/competency_questions/model/soundness/045_scenario_realizes_at_most_one_model_calculation_.omn
diff --git a/tests/competency_questions/q2.omn b/tests/competency_questions/physical/completeness/002_carbon_monoxide_is_air_pollutant.omn
similarity index 100%
rename from tests/competency_questions/q2.omn
rename to tests/competency_questions/physical/completeness/002_carbon_monoxide_is_air_pollutant.omn
diff --git a/tests/competency_questions/q3.omn b/tests/competency_questions/physical/completeness/003_nitrous_oxide_is_greenhouse_gas.omn
similarity index 100%
rename from tests/competency_questions/q3.omn
rename to tests/competency_questions/physical/completeness/003_nitrous_oxide_is_greenhouse_gas.omn
diff --git a/tests/competency_questions/q4.omn b/tests/competency_questions/physical/completeness/004_equivalences_to_flourinated_greenhouse_gases.omn
similarity index 95%
rename from tests/competency_questions/q4.omn
rename to tests/competency_questions/physical/completeness/004_equivalences_to_flourinated_greenhouse_gases.omn
index 63d708f9a..b44195eda 100644
--- a/tests/competency_questions/q4.omn
+++ b/tests/competency_questions/physical/completeness/004_equivalences_to_flourinated_greenhouse_gases.omn
@@ -9,7 +9,7 @@ Ontology:
Ontology:
-#Is a gas fired power unit a fuelled power unit?
+#Is a gas fired power unit a fueled power unit?
Class: OEO_00000017
Class: OEO_00000175
diff --git a/tests/competency_questions/q13.omn b/tests/competency_questions/physical/completeness/013_hydrogen_power_unit_is_fueled_power_unit.omn
similarity index 100%
rename from tests/competency_questions/q13.omn
rename to tests/competency_questions/physical/completeness/013_hydrogen_power_unit_is_fueled_power_unit.omn
diff --git a/tests/competency_questions/q14.omn b/tests/competency_questions/physical/completeness/014_nuclear_power_unit_is_fueled_power_unit.omn
similarity index 100%
rename from tests/competency_questions/q14.omn
rename to tests/competency_questions/physical/completeness/014_nuclear_power_unit_is_fueled_power_unit.omn
diff --git a/tests/competency_questions/q15.omn b/tests/competency_questions/physical/completeness/015_oil_power_unit_is_fueled_power_unit.omn
similarity index 100%
rename from tests/competency_questions/q15.omn
rename to tests/competency_questions/physical/completeness/015_oil_power_unit_is_fueled_power_unit.omn
diff --git a/tests/competency_questions/q16.omn b/tests/competency_questions/physical/completeness/016_waste_power_unit_is_fueled_power_unit.omn
similarity index 100%
rename from tests/competency_questions/q16.omn
rename to tests/competency_questions/physical/completeness/016_waste_power_unit_is_fueled_power_unit.omn
diff --git a/tests/competency_questions/q17.omn b/tests/competency_questions/physical/completeness/017_biofuel_power_plant_is_fueled_power_plant.omn
similarity index 100%
rename from tests/competency_questions/q17.omn
rename to tests/competency_questions/physical/completeness/017_biofuel_power_plant_is_fueled_power_plant.omn
diff --git a/tests/competency_questions/q18.omn b/tests/competency_questions/physical/completeness/018_coal_power_plant_is_fueled_power_plant.omn
similarity index 100%
rename from tests/competency_questions/q18.omn
rename to tests/competency_questions/physical/completeness/018_coal_power_plant_is_fueled_power_plant.omn
diff --git a/tests/competency_questions/q19.omn b/tests/competency_questions/physical/completeness/019_gas_power_plant_is_fueled_power_plant.omn
similarity index 100%
rename from tests/competency_questions/q19.omn
rename to tests/competency_questions/physical/completeness/019_gas_power_plant_is_fueled_power_plant.omn
diff --git a/tests/competency_questions/q20.omn b/tests/competency_questions/physical/completeness/020_hydrogen_power_plant_is_fueled_power_plant.omn
similarity index 100%
rename from tests/competency_questions/q20.omn
rename to tests/competency_questions/physical/completeness/020_hydrogen_power_plant_is_fueled_power_plant.omn
diff --git a/tests/competency_questions/q21.omn b/tests/competency_questions/physical/completeness/021_oil_power_plant_is_fueled_power_plant.omn
similarity index 100%
rename from tests/competency_questions/q21.omn
rename to tests/competency_questions/physical/completeness/021_oil_power_plant_is_fueled_power_plant.omn
diff --git a/tests/competency_questions/q22.omn b/tests/competency_questions/physical/completeness/022_waste_power_plant_is_fueled_power_plant.omn
similarity index 100%
rename from tests/competency_questions/q22.omn
rename to tests/competency_questions/physical/completeness/022_waste_power_plant_is_fueled_power_plant.omn
diff --git a/tests/competency_questions/q23.omn b/tests/competency_questions/physical/completeness/023_amonia_is_air_pollutant.omn
similarity index 100%
rename from tests/competency_questions/q23.omn
rename to tests/competency_questions/physical/completeness/023_amonia_is_air_pollutant.omn
diff --git a/tests/competency_questions/q24.omn b/tests/competency_questions/physical/completeness/024_biodisel_is_liquid_biofuel.omn
similarity index 100%
rename from tests/competency_questions/q24.omn
rename to tests/competency_questions/physical/completeness/024_biodisel_is_liquid_biofuel.omn
diff --git a/tests/competency_questions/q25.omn b/tests/competency_questions/physical/completeness/025_biogasoline_is_liquid_biofuel.omn
similarity index 100%
rename from tests/competency_questions/q25.omn
rename to tests/competency_questions/physical/completeness/025_biogasoline_is_liquid_biofuel.omn
diff --git a/tests/competency_questions/q26.omn b/tests/competency_questions/physical/completeness/026_carbon_dioxide_is_greenhouse_gas.omn
similarity index 100%
rename from tests/competency_questions/q26.omn
rename to tests/competency_questions/physical/completeness/026_carbon_dioxide_is_greenhouse_gas.omn
diff --git a/tests/competency_questions/q27.omn b/tests/competency_questions/physical/completeness/027_charcoal_is_solid_biofuel.omn
similarity index 100%
rename from tests/competency_questions/q27.omn
rename to tests/competency_questions/physical/completeness/027_charcoal_is_solid_biofuel.omn
diff --git a/tests/competency_questions/q28.omn b/tests/competency_questions/physical/completeness/028_coal_is_solid_biofuel.omn
similarity index 100%
rename from tests/competency_questions/q28.omn
rename to tests/competency_questions/physical/completeness/028_coal_is_solid_biofuel.omn
diff --git a/tests/competency_questions/q30.omn b/tests/competency_questions/physical/completeness/030_synthetic_fuel_is_combustion_fuel.omn
similarity index 100%
rename from tests/competency_questions/q30.omn
rename to tests/competency_questions/physical/completeness/030_synthetic_fuel_is_combustion_fuel.omn
diff --git a/tests/competency_questions/q31.omn b/tests/competency_questions/physical/completeness/031_renewable_fuel_is_combustion_fuel.omn
similarity index 100%
rename from tests/competency_questions/q31.omn
rename to tests/competency_questions/physical/completeness/031_renewable_fuel_is_combustion_fuel.omn
diff --git a/tests/competency_questions/q32.omn b/tests/competency_questions/physical/completeness/032_waste_fuel_is_combustion_fuel.omn
similarity index 100%
rename from tests/competency_questions/q32.omn
rename to tests/competency_questions/physical/completeness/032_waste_fuel_is_combustion_fuel.omn
diff --git a/tests/competency_questions/q33.omn b/tests/competency_questions/physical/completeness/033_renewable_municipal_waste_is_biofuel.omn
similarity index 100%
rename from tests/competency_questions/q33.omn
rename to tests/competency_questions/physical/completeness/033_renewable_municipal_waste_is_biofuel.omn
diff --git a/tests/competency_questions/q34.omn b/tests/competency_questions/physical/completeness/034_hydrogen_is_combusion_fuel.omn
similarity index 100%
rename from tests/competency_questions/q34.omn
rename to tests/competency_questions/physical/completeness/034_hydrogen_is_combusion_fuel.omn
diff --git a/tests/competency_questions/q35.omn b/tests/competency_questions/physical/completeness/035_methane_is_greenhouse_gas.omn
similarity index 100%
rename from tests/competency_questions/q35.omn
rename to tests/competency_questions/physical/completeness/035_methane_is_greenhouse_gas.omn
diff --git a/tests/competency_questions/q36.omn b/tests/competency_questions/physical/completeness/036_methane_is_combusion_fuel.omn
similarity index 100%
rename from tests/competency_questions/q36.omn
rename to tests/competency_questions/physical/completeness/036_methane_is_combusion_fuel.omn
diff --git a/tests/competency_questions/q37.omn b/tests/competency_questions/physical/completeness/037_natural_gas_is_fossil_combusion_fuel.omn
similarity index 100%
rename from tests/competency_questions/q37.omn
rename to tests/competency_questions/physical/completeness/037_natural_gas_is_fossil_combusion_fuel.omn
diff --git a/tests/competency_questions/q38.omn b/tests/competency_questions/physical/completeness/038_nitrogen_oxide_is_air_pollutant.omn
similarity index 100%
rename from tests/competency_questions/q38.omn
rename to tests/competency_questions/physical/completeness/038_nitrogen_oxide_is_air_pollutant.omn
diff --git a/tests/competency_questions/q39.omn b/tests/competency_questions/physical/completeness/039_particulate_matter_is_air_pollutant.omn
similarity index 100%
rename from tests/competency_questions/q39.omn
rename to tests/competency_questions/physical/completeness/039_particulate_matter_is_air_pollutant.omn
diff --git a/tests/competency_questions/q40.omn b/tests/competency_questions/physical/completeness/040_peat_is_solid_fossil_fuel.omn
similarity index 100%
rename from tests/competency_questions/q40.omn
rename to tests/competency_questions/physical/completeness/040_peat_is_solid_fossil_fuel.omn
diff --git a/tests/competency_questions/q41.omn b/tests/competency_questions/physical/completeness/041_sulphur_dioxide_is_air_pollutant.omn
similarity index 100%
rename from tests/competency_questions/q41.omn
rename to tests/competency_questions/physical/completeness/041_sulphur_dioxide_is_air_pollutant.omn
diff --git a/tests/competency_questions/q47.omn b/tests/competency_questions/physical/completeness/047_portion_of_hydrogen_is_energy_carrier.omn
similarity index 79%
rename from tests/competency_questions/q47.omn
rename to tests/competency_questions/physical/completeness/047_portion_of_hydrogen_is_energy_carrier.omn
index 63174dcd6..1ed407962 100644
--- a/tests/competency_questions/q47.omn
+++ b/tests/competency_questions/physical/completeness/047_portion_of_hydrogen_is_energy_carrier.omn
@@ -8,7 +8,7 @@ Ontology: 0 and implementing:
+ raise RuntimeError(failure)
+ if implementing:
+ assert query_result, f"{name} failed"
+
+
+def test_synthesis(fixture_store, existing_terms_and_definitons):
+ """This test should run at the end. Produces the final report.
+
+ Args:
+ fixture_store (fixture): These are all the availible fixtures.
+ existing_terms_and_definitons (fixture): Fixture with existing terms and definitions.
+ """
+ initial_terms = {t : {"covered": False, "by": []} for t in existing_terms_and_definitons if "OEO_" in t}
+ report = {"coverage": "0%", "questions": {}, "terms": initial_terms}
+ for v in fixture_store["results_bag"].values():
+ report["questions"].update(v["questions"])
+ for term in v["terms"].keys():
+ if term in report["terms"]:
+ report["terms"][term] ["covered"] = True
+ report["terms"][term]["by"].extend(v["terms"][term]["by"])
+ report["terms"][term]["by"] = list(set(report["terms"][term]["by"]))
+ report["terms"][term]["by"] = list(set(report["terms"][term]["by"]))
+ else:
+ report["terms"][term] = {
+ "covered": True,
+ "by": list(set(report["terms"][term]["by"])),
+ }
+
+ coverage = sum([1 for c in report.get("terms", {}).values() if c["covered"]]) / len(
+ [term for term in existing_terms_and_definitons if "OEO_" in term]
+ )
+ report["coverage"] = "{:.0%}".format(coverage)
+ with open(Path(CWD).joinpath("build/report.json"), "w") as f:
+ json.dump(report, f, indent=4)