Skip to content

Commit

Permalink
Merge pull request #123 from loinc/metrics
Browse files Browse the repository at this point in the history
Metrics & Reporting
  • Loading branch information
joeflack4 authored Jan 22, 2025
2 parents d4423d7 + 0265990 commit 5c0f362
Show file tree
Hide file tree
Showing 6 changed files with 209 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ See: `comploinc_config.yaml`

If following the setup exactly, this configuration will not need to be modified.

## Statistics
[Statistics page](documentation/stats.md)

## Developer docs
<details><summary>Details</summary>

Expand Down
64 changes: 64 additions & 0 deletions documentation/stats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Metrics https://comploinc

**IRI:** https://comploinc-axioms

**Version IRI:** no.iri

### Entities and axioms

| Metric | Value |
| ------ | ----- |
| Annotation properties | 13 |
| Axioms | 2274506 |
| Logical axioms | 1072609 |
| Classes | 241520 |
| Object properties | 56 |
| Data properties | 0 |
| Individuals | 0 |


### Expressivity

| Metric | Value |
| ------ | ----- |
| Expressivity | ALEH |
| OWL2 | True |
| OWL2 DL | True |
| OWL2 EL | True |
| OWL2 QL | False |
| OWL2 RL | False |

#### Axiom types

| Metric | Value |
| ------ | ----- |
| AnnotationAssertion | 960310 |
| EquivalentClasses | 217226 |
| SubObjectPropertyOf | 55 |
| Declaration | 241587 |
| SubClassOf | 855328 |


#### Entity namespaces: axiom counts by namespace

| Metric | Value |
| ------ | ----- |
| prefix_unknown | 59 |
| owl | 1 |
| rdf | 1 |
| LOINC_PART_GRP_CMP | 2462 |
| LOINC_PART_GRP_SYS | 1697 |
| rdfs | 1 |
| LOINC_PART | 116360 |
| LOINC_PART_GRP_CMP_SYS | 18116 |
| LOINC_TERM | 102893 |


#### Class expressions used

| Metric | Value |
| ------ | ----- |
| Class | 3558892 |
| ObjectSomeValuesFrom | 1475564 |
| ObjectIntersectionOf | 206980 |

40 changes: 40 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# todo: catalog-v001.xml needs to be moved from owl-files into output before merged. and perhaps more from there?
.PHONY=stats

# All ------------------------------------------------------------------------------------------------------------------
all: stats

# Analysis -------------------------------------------------------------------------------------------------------------
input/analysis/:
mkdir -p $@

output/analysis/:
mkdir -p $@

output/tmp/:
mkdir -p $@

# Merging & reasoning --------------------------------------------------------------------------------------------------
output/build-default/merged-and-reasoned/comploinc-merged-reasoned.owl: output/build-default/merged-and-reasoned/comploinc-merged-unreasoned.owl
robot reason --input $< --output $@

BUILD_DEFAULT_PATHS := $(wildcard output/build-default/*.owl)
output/build-default/merged-and-reasoned/comploinc-merged-unreasoned.owl: $(BUILD_DEFAULT_PATHS)
robot merge $(patsubst %, --input %, $(BUILD_DEFAULT_PATHS)) --output $@

# Stats ----------------------------------------------------------------------------------------------------------------
stats: documentation/stats.md

SOURCE_METRICS_TEMPLATE=src/comp_loinc/analysis/stats.md.j2
PREFIXES_METRICS=--prefix 'LOINC_PART: https://loinc.org/LP' \
--prefix 'LOINC_TERM: https://loinc.org/' \
--prefix 'LOINC_PART_GRP_CMP: http://comploinc//group/component/LP' \
--prefix 'LOINC_PART_GRP_SYS: http://comploinc//group/system/LP' \
--prefix 'LOINC_PART_GRP_CMP_SYS: http://comploinc//group/component-system/LP' \

output/tmp/stats.json: output/build-default/merged-and-reasoned/comploinc-merged-reasoned.owl | output/tmp/
robot measure $(PREFIXES_METRICS) -i $< --format json --metrics extended --output $@
.PRECIOUS: output/tmp/stats.json

documentation/stats.md: output/tmp/stats.json
jinjanate "$(SOURCE_METRICS_TEMPLATE)" $< > $@
51 changes: 50 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ packages = [
comploinc = 'comp_loinc.cli:comploinc_cli'

[tool.poetry.dependencies]
jinjanator = "*"
python = "^3.11"
linkml = "^1.5.0"
linkml-owl = "^0.2.7"
Expand Down
51 changes: 51 additions & 0 deletions src/comp_loinc/analysis/stats.md.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{% set id = 'https://comploinc' -%}
# Metrics {{ id }}

**IRI:** {{ metrics.ontology_iri|default(id) }}

**Version IRI:** {{ metrics.ontology_version_iri|default(id) }}

### Entities and axioms

| Metric | Value |
| ------ | ----- |
| Annotation properties | {{ metrics.annotation_property_count|default("NA") }} |
| Axioms | {{ metrics.axiom_count|default("NA") }} |
| Logical axioms | {{ metrics.logical_axiom_count|default("NA") }} |
| Classes | {{ metrics.class_count|default("NA") }} |
| Object properties | {{ metrics.obj_property_count|default("NA") }} |
| Data properties | {{ metrics.dataproperty_count|default("NA") }} |
| Individuals | {{ metrics.individual_count|default("NA") }} |


### Expressivity

| Metric | Value |
| ------ | ----- |
| Expressivity | {{ metrics.expressivity|default("NA") }} |
| OWL2 | {{ metrics.owl2|default("NA") }} |
| OWL2 DL | {{ metrics.owl2_dl|default("NA") }} |
| OWL2 EL | {{ metrics.owl2_el|default("NA") }} |
| OWL2 QL | {{ metrics.owl2_ql|default("NA") }} |
| OWL2 RL | {{ metrics.owl2_rl|default("NA") }} |

#### Axiom types

| Metric | Value |
| ------ | ----- |
{% for key, value in metrics.axiom_type_count_incl.items() %}| {{ key }} | {{ value }} |
{% endfor %}

#### Entity namespaces: axiom counts by namespace

| Metric | Value |
| ------ | ----- |
{% for key, value in metrics.namespace_entity_count.items() %}| {{ key }} | {{ value }} |
{% endfor %}

#### Class expressions used

| Metric | Value |
| ------ | ----- |
{% for key, value in metrics.class_expression_count.items() %}| {{ key }} | {{ value }} |
{% endfor %}

0 comments on commit 5c0f362

Please sign in to comment.