Skip to content

Commit

Permalink
Merge pull request #100 from ncbo/96-include-combined-node-and-edge-c…
Browse files Browse the repository at this point in the history
…ounts-on-landing-page

Add combined node and edge counts to dashboard
  • Loading branch information
caufieldjh authored Oct 1, 2024
2 parents e894d4a + 846754d commit 00bf8a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ plugins:

# Ontology status table goes under here.
totalcount: 1050
totalnodecount: 10509205
totaledgecount: 20055264
ontologies:
- edgecount: 555
id: REGN_BRO
Expand Down
2 changes: 2 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ <h3>Learn more about KG-Bioportal</h3>
<h3>KG-Bioportal Overview</h3>
<p>The collection includes graph files for {{ site.totalcount }} ontologies. </p>

<p>In all, this includes {{site.totalnodecount }} ontology classes as nodes and {{site.totaledgecount}} relations between classes as edges.</p>

{% include fig1.html %}
{% include fig2.html %}
<br>
Expand Down
11 changes: 11 additions & 0 deletions src/kg_bioportal/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,23 @@ def transform_all(self, compress: bool) -> None:
# Write total stats to a yaml
logging.info("Writing total stats to total_stats.yaml.")
# Get the count of successful transforms
# Plus total node and edge counts
success_count = 0
for onto in onto_log:
if onto_log[onto]["status"]:
success_count += 1
with open(os.path.join(self.output_dir, "total_stats.yaml"), "w") as f:
f.write("totalcount: " + str(success_count) + "\n")
f.write(
"totalnodecount: "
+ str(sum([onto_log[onto]["nodecount"] for onto in onto_log]))
+ "\n"
)
f.write(
"totaledgecount: "
+ str(sum([onto_log[onto]["edgecount"] for onto in onto_log]))
+ "\n"
)

# Dump onto_log to a yaml
# Rearrange it a bit first
Expand Down

0 comments on commit 00bf8a6

Please sign in to comment.