From 0b350d5fc4412990766b44e16d445674eb770890 Mon Sep 17 00:00:00 2001 From: roll Date: Fri, 19 Apr 2024 11:14:33 +0100 Subject: [PATCH] Support `description` mapping for CKAN --- dplib/plugins/ckan/models/resource.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dplib/plugins/ckan/models/resource.py b/dplib/plugins/ckan/models/resource.py index 5cad672..f67573d 100644 --- a/dplib/plugins/ckan/models/resource.py +++ b/dplib/plugins/ckan/models/resource.py @@ -29,8 +29,13 @@ def to_dp(self) -> Resource: Returns: Data Resource """ + # Path/Name resource = Resource(path=self.name, name=slugify_name(self.name)) + # Description + if self.description: + resource.description = self.description + # Format if self.format: resource.format = self.format.lower() @@ -65,6 +70,10 @@ def from_dp(cls, resource: Resource) -> Optional[CkanResource]: # Path ckan = CkanResource(name=resource.path) + # Description + if resource.description: + ckan.description = resource.description + # Format if resource.format: ckan.format = resource.format.upper()