diff --git a/oc4ids_datastore_api/models.py b/oc4ids_datastore_api/models.py index 6362a25..555cde1 100644 --- a/oc4ids_datastore_api/models.py +++ b/oc4ids_datastore_api/models.py @@ -9,6 +9,7 @@ class DatasetSQLModel(SQLModel, table=True): dataset_id: str = Field(primary_key=True) source_url: str publisher_name: str + publisher_country: str | None license_url: str | None license_title: str | None license_title_short: str | None diff --git a/oc4ids_datastore_api/schemas.py b/oc4ids_datastore_api/schemas.py index f3c6193..298fdc7 100644 --- a/oc4ids_datastore_api/schemas.py +++ b/oc4ids_datastore_api/schemas.py @@ -5,6 +5,7 @@ class Publisher(BaseModel): name: str + country: str | None class License(BaseModel): diff --git a/oc4ids_datastore_api/services.py b/oc4ids_datastore_api/services.py index 48f5b1a..07a8114 100644 --- a/oc4ids_datastore_api/services.py +++ b/oc4ids_datastore_api/services.py @@ -15,7 +15,9 @@ def _transform_dataset(dataset: DatasetSQLModel) -> Dataset: return Dataset( loaded_at=dataset.updated_at, source_url=dataset.source_url, - publisher=Publisher(name=dataset.publisher_name), + publisher=Publisher( + name=dataset.publisher_name, country=dataset.publisher_country + ), license=License( url=dataset.license_url, title=dataset.license_title, diff --git a/pyproject.toml b/pyproject.toml index fca949c..a7234e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi" [project] name = "oc4ids-datastore-api" description = "OC4IDS Datastore API" -version = "0.2.0" +version = "0.3.0" readme = "README.md" dependencies = [ "fastapi[standard]", diff --git a/tests/test_services.py b/tests/test_services.py index 3be18ea..0bbd7da 100644 --- a/tests/test_services.py +++ b/tests/test_services.py @@ -16,6 +16,7 @@ def test_get_all_datasets(mocker: MockerFixture) -> None: dataset_id="test_dataset", source_url="https://test-dataset.json", publisher_name="test_publisher", + publisher_country="ab", license_url="https://license.com", license_title="License", license_title_short="L", @@ -31,7 +32,7 @@ def test_get_all_datasets(mocker: MockerFixture) -> None: expected_dataset = Dataset( loaded_at=now, source_url="https://test-dataset.json", - publisher=Publisher(name="test_publisher"), + publisher=Publisher(name="test_publisher", country="ab"), license=License(title="License", title_short="L", url="https://license.com"), downloads=[ Download(format="json", url="https://downloads/test_dataset.json"), @@ -66,7 +67,7 @@ def test_get_all_datasets_missing_download_formats(mocker: MockerFixture) -> Non expected_dataset = Dataset( loaded_at=now, source_url="https://test-dataset.json", - publisher=Publisher(name="test_publisher"), + publisher=Publisher(name="test_publisher", country=None), license=License(title="License", title_short="L", url="https://license.com"), downloads=[ Download(format="json", url="https://downloads/test_dataset.json"),