Skip to content

Commit

Permalink
hotfix/fix bibliographic resource (#315)
Browse files Browse the repository at this point in the history
### Changes

- upgrade mex-model dependency to version 3.1

### Fixed

- fix typo in `repositoryURL` of bibliographic resources
- make identifier and stableTargetId of ExtractedBibliographicResource
computed fields
  • Loading branch information
cutoffthetop authored Oct 28, 2024
1 parent 21e3842 commit b2eebbf
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changes

- upgrade mex-model dependency to version 3.1

### Deprecated

### Removed

### Fixed

- fix typo in `repositoryURL` of bibliographic resources
- make identifier and stableTargetId of ExtractedBibliographicResource computed fields

### Security

## [0.39.0] - 2024-10-28
Expand Down
22 changes: 16 additions & 6 deletions mex/common/models/bibliographic_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Annotated, ClassVar, Literal

from pydantic import Field
from pydantic import Field, computed_field

from mex.common.models.base.extracted_data import ExtractedData
from mex.common.models.base.merged_item import MergedItem
Expand Down Expand Up @@ -158,7 +158,7 @@ class _OptionalValues(_Stem):
) = None
publicationPlace: PublicationPlaceStr | None = None
publicationYear: Year | None = None
respositoryURL: Link | None = None
repositoryURL: Link | None = None
section: SectionStr | None = None
volume: VolumeOrIssueStr | None = None
volumeOfSeries: VolumeOrIssueStr | None = None
Expand All @@ -184,7 +184,7 @@ class _VariadicValues(_Stem):
] = []
publicationPlace: list[PublicationPlaceStr] = []
publicationYear: list[Year] = []
respositoryURL: list[Link] = []
repositoryURL: list[Link] = []
section: list[SectionStr] = []
volume: list[VolumeOrIssueStr] = []
volumeOfSeries: list[VolumeOrIssueStr] = []
Expand All @@ -202,8 +202,18 @@ class ExtractedBibliographicResource(BaseBibliographicResource, ExtractedData):
entityType: Annotated[
Literal["ExtractedBibliographicResource"], Field(alias="$type", frozen=True)
] = "ExtractedBibliographicResource"
identifier: Annotated[ExtractedBibliographicResourceIdentifier, Field(frozen=True)]
stableTargetId: MergedBibliographicResourceIdentifier

@computed_field # type: ignore[prop-decorator]
@property
def identifier(self) -> ExtractedBibliographicResourceIdentifier:
"""Return the computed identifier for this extracted data item."""
return self._get_identifier(ExtractedBibliographicResourceIdentifier)

@computed_field # type: ignore[prop-decorator]
@property
def stableTargetId(self) -> MergedBibliographicResourceIdentifier: # noqa: N802
"""Return the computed stableTargetId for this extracted data item."""
return self._get_stable_target_id(MergedBibliographicResourceIdentifier)


class MergedBibliographicResource(BaseBibliographicResource, MergedItem):
Expand Down Expand Up @@ -264,7 +274,7 @@ class PreventiveBibliographicResource(_Stem, PreventiveRule):
publicationPlace: list[MergedPrimarySourceIdentifier] = []
publicationYear: list[MergedPrimarySourceIdentifier] = []
publisher: list[MergedPrimarySourceIdentifier] = []
respositoryURL: list[MergedPrimarySourceIdentifier] = []
repositoryURL: list[MergedPrimarySourceIdentifier] = []
section: list[MergedPrimarySourceIdentifier] = []
subtitle: list[MergedPrimarySourceIdentifier] = []
title: list[MergedPrimarySourceIdentifier] = []
Expand Down
8 changes: 4 additions & 4 deletions pdm.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 @@ -12,7 +12,7 @@ dependencies = [
"click>=8.1.7,<9",
"langdetect>=1.0.9,<2",
"ldap3>=2.9.1,<3",
"mex-model @ git+https://github.com/robert-koch-institut/mex-model.git@3.0.0",
"mex-model @ git+https://github.com/robert-koch-institut/mex-model.git@3.1.0",
"numpy>=2.1.2,<3",
"pandas>=2.2.3,<3",
"pyarrow>=17.0.0,<18",
Expand Down

0 comments on commit b2eebbf

Please sign in to comment.