Skip to content

Commit

Permalink
Merge branch 'main' into feature/mx-1679_ingest_wikidata_primary_source
Browse files Browse the repository at this point in the history
  • Loading branch information
ZehraVictoria authored Feb 27, 2025
2 parents c365a55 + 952c1e8 commit 2d45085
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 66 deletions.
4 changes: 2 additions & 2 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"template": "https://github.com/robert-koch-institut/mex-template",
"commit": "5446dae8486bd2412e75f97790c6bd800fa26a34",
"commit": "8bdad06a5eca52607f046b75cb0cdd9d7ab4912e",
"checkout": null,
"context": {
"cookiecutter": {
"project_name": "backend",
"short_summary": "Backend server for the RKI metadata exchange.",
"long_summary": "The `mex-backend` package is a multi-purpose backend application with an HTTP-API. It provides endpoints to ingest data from ETL-pipelines, for a metadata editor application, and for publishing pipelines to extract standardized data for use in upstream frontend applications.",
"_template": "https://github.com/robert-koch-institut/mex-template",
"_commit": "5446dae8486bd2412e75f97790c6bd800fa26a34"
"_commit": "8bdad06a5eca52607f046b75cb0cdd9d7ab4912e"
}
},
"directory": null
Expand Down
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ dmypy.json
# SQLite databases
*.db

# Reflex
.states
assets/external/
.web

# Default exports
*.ndjson
data/
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ dmypy.json
# SQLite databases
*.db

# Reflex
.states
assets/external/
.web

# Default exports
*.ndjson
data/
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_language_version:
python: python3.11
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.1
rev: v0.9.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand All @@ -25,7 +25,7 @@ repos:
- id: fix-byte-order-marker
name: byte-order
- repo: https://github.com/pdm-project/pdm
rev: 2.22.2
rev: 2.22.3
hooks:
- id: pdm-lock-check
name: pdm
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Security

## [0.30.2] - 2025-02-27

### Changes
- preview and merged endpoint filter by multiple primary sources (was: one)

## [0.30.1] - 2025-02-17

### Added
Expand Down
4 changes: 2 additions & 2 deletions mex/backend/graph/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def fetch_merged_items( # noqa: PLR0913
query_string: str | None,
identifier: str | None,
entity_type: Sequence[str] | None,
had_primary_source: str | None,
had_primary_source: Sequence[str] | None,
skip: int,
limit: int,
) -> Result:
Expand Down Expand Up @@ -320,7 +320,7 @@ def fetch_merged_items( # noqa: PLR0913
query_string=query_string,
identifier=identifier,
labels=entity_type or list(MERGED_MODEL_CLASSES_BY_NAME),
referenced_identifier=had_primary_source,
referenced_identifiers=had_primary_source,
skip=skip,
limit=limit,
)
Expand Down
2 changes: 1 addition & 1 deletion mex/backend/graph/cypher/fetch_extracted_or_rule_items.cql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Globals:

Args:
filter_by_query_string: Whether the final query should accept a full text query string
filter_by_stable_target_id: Whether the final query should filter by stableTargetId
filter_by_stable_target_id: Whether the final query should filter by stableTargetIds

Returns:
total: Count of all items found by this query
Expand Down
2 changes: 1 addition & 1 deletion mex/backend/graph/cypher/fetch_merged_items.cql
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ CALL () {
AND merged_node.identifier = $identifier
<%- endif %>
<%- if filter_by_reference_to_merged_item %>
AND referenced_merged_node_to_filter_by.identifier = $referenced_identifier
AND referenced_merged_node_to_filter_by.identifier IN $referenced_identifiers
<%- endif %>
<%- endblock %>
RETURN COUNT(merged_node) AS total
Expand Down
6 changes: 3 additions & 3 deletions mex/backend/merged/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def search_merged_items_in_graph(
query_string: str | None = None,
identifier: str | None = None,
entity_type: list[str] | None = None,
had_primary_source: str | None = None,
had_primary_source: list[str] | None = None,
skip: int = 0,
limit: int = 100,
validate_cardinality: Literal[False] = False,
Expand All @@ -92,7 +92,7 @@ def search_merged_items_in_graph(
query_string: str | None = None,
identifier: str | None = None,
entity_type: list[str] | None = None,
had_primary_source: str | None = None,
had_primary_source: list[str] | None = None,
skip: int = 0,
limit: int = 100,
validate_cardinality: Literal[True] = True,
Expand All @@ -103,7 +103,7 @@ def search_merged_items_in_graph( # noqa: PLR0913
query_string: str | None = None,
identifier: str | None = None,
entity_type: list[str] | None = None,
had_primary_source: str | None = None,
had_primary_source: list[str] | None = None,
skip: int = 0,
limit: int = 100,
validate_cardinality: Literal[True, False] = True,
Expand Down
4 changes: 2 additions & 2 deletions mex/backend/merged/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def search_merged_items( # noqa: PLR0913
q: Annotated[str, Query(max_length=100)] = "",
identifier: Identifier | None = None,
entityType: Annotated[Sequence[MergedType], Query(max_length=len(MergedType))] = [],
hadPrimarySource: Identifier | None = None,
hadPrimarySource: Annotated[Sequence[Identifier] | None, Query()] = None,
skip: Annotated[int, Query(ge=0, le=10e10)] = 0,
limit: Annotated[int, Query(ge=1, le=100)] = 10,
) -> MergedItemSearch:
Expand All @@ -25,7 +25,7 @@ def search_merged_items( # noqa: PLR0913
q,
identifier,
[str(t.value) for t in entityType or MergedType],
hadPrimarySource,
[str(s) for s in hadPrimarySource] if hadPrimarySource else None,
skip,
limit,
validate_cardinality=True,
Expand Down
4 changes: 2 additions & 2 deletions mex/backend/preview/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def preview_items( # noqa: PLR0913
q: Annotated[str, Query(max_length=100)] = "",
identifier: Identifier | None = None,
entityType: Annotated[Sequence[MergedType], Query(max_length=len(MergedType))] = [],
hadPrimarySource: Identifier | None = None,
hadPrimarySource: Annotated[Sequence[Identifier] | None, Query()] = None,
skip: Annotated[int, Query(ge=0, le=10e10)] = 0,
limit: Annotated[int, Query(ge=1, le=100)] = 10,
) -> PreviewItemSearch:
Expand All @@ -52,7 +52,7 @@ def preview_items( # noqa: PLR0913
q,
identifier,
[str(t.value) for t in entityType or MergedType],
hadPrimarySource,
[str(s) for s in hadPrimarySource] if hadPrimarySource else None,
skip,
limit,
validate_cardinality=False,
Expand Down
96 changes: 54 additions & 42 deletions pdm.lock

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

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "mex-backend"
version = "0.30.1"
version = "0.30.2"
description = "Backend server for the RKI metadata exchange."
authors = [{ name = "MEx Team", email = "[email protected]" }]
readme = { file = "README.md", content-type = "text/markdown" }
Expand All @@ -13,7 +13,7 @@ dependencies = [
"fastapi>=0.115,<1",
"httpx>=0.27,<1",
"jinja2>=3,<4",
"mex-common @ git+https://github.com/robert-koch-institut/mex-common.git@0.51.1",
"mex-common @ git+https://github.com/robert-koch-institut/mex-common.git@0.52.2",
"neo4j>=5,<6",
"pydantic>=2,<3",
"starlette>=0.41,<1",
Expand Down
Loading

0 comments on commit 2d45085

Please sign in to comment.