Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quickfix for global stats with model v2 #73

Merged
merged 2 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pyproject_generation/pyproject_custom.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "metldata"
version = "2.0.0"
version = "2.0.1"
description = "metldata - A framework for handling metadata based on ETL, CQRS, and event sourcing."
dependencies = [
"hexkit[akafka,mongodb] >=3, <4",
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ We recommend using the provided Docker container.

A pre-build version is available at [docker hub](https://hub.docker.com/repository/docker/ghga/metldata):
```bash
docker pull ghga/metldata:2.0.0
docker pull ghga/metldata:2.0.1
```

Or you can build the container yourself from the [`./Dockerfile`](./Dockerfile):
```bash
# Execute in the repo's root dir:
docker build -t ghga/metldata:2.0.0 .
docker build -t ghga/metldata:2.0.1 .
```

For production-ready deployment, we recommend using Kubernetes, however,
for simple use cases, you could execute the service using docker
on a single server:
```bash
# The entrypoint is preconfigured:
docker run -p 8080:8080 ghga/metldata:2.0.0 --help
docker run -p 8080:8080 ghga/metldata:2.0.1 --help
```

If you prefer not to use containers, you may install the service from source:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ classifiers = [
"Intended Audience :: Developers",
]
name = "metldata"
version = "2.0.0"
version = "2.0.1"
description = "metldata - A framework for handling metadata based on ETL, CQRS, and event sourcing."
dependencies = [
"hexkit[akafka,mongodb] >=3, <4",
Expand Down
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