Skip to content

Commit

Permalink
Support schema v2 in global stats
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Jul 26, 2024
1 parent 9ed3150 commit aedebcc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/metldata/load/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,20 @@
STATS_COLLECTION_NAME = "stats"


# the following should be made configurable


def get_stat_slot(resource_class: str) -> str | None:
"""Get the name of the slot that shall be used as grouping key."""
if resource_class.endswith("File"):
return "format"
if resource_class.endswith("Protocol"):
if resource_class.endswith("Protocol"): # v1
return "type"
if resource_class.endswith("Individual"):
return "sex"
return None
return {
"Individual": "sex",
"Sample": "type",
"ExperimentMethod": "instrument_model", # v2
}.get(resource_class)


async def create_stats_using_aggregator(
Expand Down

0 comments on commit aedebcc

Please sign in to comment.