Skip to content

Commit

Permalink
fix schema test; temporarily set mex-model dependency to dev branch
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinscholl committed Feb 22, 2024
1 parent 15dcf0c commit 228cf1b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 25 deletions.
4 changes: 2 additions & 2 deletions mex/common/models/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class BaseDistribution(BaseModel):
dataCurator: list[PersonID] = []
dataManager: list[PersonID] = []
downloadURL: Link | None = None
issued: YearMonth | YearMonthDay | YearMonthDayTime
issued: YearMonthDayTime | YearMonthDay | YearMonth
license: (
Annotated[License, Field(examples=["https://mex.rki.de/item/license-1"])] | None
) = None
Expand All @@ -48,7 +48,7 @@ class BaseDistribution(BaseModel):
]
| None
) = None
modified: YearMonth | YearMonthDay | YearMonthDayTime | None = None
modified: YearMonthDayTime | YearMonthDay | YearMonth | None = None
otherContributor: list[PersonID] = []
projectLeader: list[PersonID] = []
projectManager: list[PersonID] = []
Expand Down
8 changes: 4 additions & 4 deletions mex/common/models/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class BaseResource(BaseModel):
]
contributingUnit: list[OrganizationalUnitID] = []
contributor: list[PersonID] = []
created: Union[YearMonth, YearMonthDay, YearMonthDayTime, None] = None
created: Union[YearMonthDayTime, YearMonthDay, YearMonth, None] = None
creator: list[PersonID] = []
description: list[Text] = []
distribution: list[DistributionID] = []
Expand Down Expand Up @@ -88,7 +88,7 @@ class BaseResource(BaseModel):
] = []
method: list[Text] = []
methodDescription: list[Text] = []
modified: Union[YearMonth, YearMonthDay, YearMonthDayTime, None] = None
modified: Union[YearMonthDayTime, YearMonthDay, YearMonth, None] = None
publication: list[Link] = []
publisher: list[OrganizationID] = []
qualityInformation: list[Text] = []
Expand All @@ -113,9 +113,9 @@ class BaseResource(BaseModel):
]
] = []
temporal: Union[
YearMonth,
YearMonthDay,
YearMonthDayTime,
YearMonthDay,
YearMonth,
Annotated[
str,
Field(
Expand Down
12 changes: 6 additions & 6 deletions poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ requests = "^2.31.0"
[tool.poetry.group.dev.dependencies]
black = "^24.1.1"
ipdb = "^0.13.13"
mex-model = { git = "https://github.com/robert-koch-institut/mex-model.git", rev = "2.2.0" }
mex-model = { git = "https://github.com/robert-koch-institut/mex-model.git", branch = "feature/mx-1569-date-validation" } # TODO update to new version
mypy = "^1.8.0"
pandas-stubs = "^2.1.4"
pytest = "^8.0.0"
Expand Down
12 changes: 0 additions & 12 deletions tests/models/test_model_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from mex.common.models import EXTRACTED_MODEL_CLASSES_BY_NAME
from mex.common.transform import dromedary_to_kebab
from mex.common.types.identifier import MEX_ID_PATTERN
from mex.common.types.temporal_entity import TIMESTAMP_REGEX

SPECIFIED_SCHEMA_PATH = files("mex.model").joinpath("entities")

Expand Down Expand Up @@ -119,17 +118,6 @@ def prepare_field(field: str, obj: list[Any] | dict[str, Any]) -> None:
use_scheme = obj.pop("useScheme", "") # only in spec (needed to select vocabulary)
vocabulary = use_scheme.removeprefix("https://mex.rki.de/item/") # vocabulary name

# ignore differences between dates and datetimes
# (we only have `Timestamp` as a date-time implementation, but no type for `date`,
# but we might/should add that in the future)
if (
obj.get("format") in ("date", "date-time")
or obj.get("pattern") == TIMESTAMP_REGEX
):
obj.pop("examples", None)
obj.pop("pattern", None)
obj["format"] = "date-time"

# align reference paths
# (the paths to referenced vocabularies and types differ between the models
# and the specification, so we need to make sure they match before comparing)
Expand Down

0 comments on commit 228cf1b

Please sign in to comment.