Skip to content

Commit

Permalink
Include total node count and edge counts in total_stats.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
caufieldjh committed Oct 1, 2024
1 parent e894d4a commit de72d00
Showing 1 changed file with 11 additions and 0 deletions.
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 de72d00

Please sign in to comment.