Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

Commit

Permalink
Fix for coverage string
Browse files Browse the repository at this point in the history
- Certain modules may expect the spatial field to be a list, so
  added a spatial_transform to oai-to-dpla
  • Loading branch information
Miguel Alatorre committed Mar 13, 2013
1 parent e9ded28 commit 68fa190
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/akamod/oai-to-dpla.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,18 @@ def is_shown_at_transform(d):
}
}

def spatial_transform(d):
spatial = d["coverage"]
if spatial and not isinstance(spatial, list):
spatial = [spatial]

return {"spatial": spatial} if spatial else {}

# Structure mapping the original property to a function returning a single
# item dict representing the new property and its value
CHO_TRANSFORMER = {
"contributor" : lambda d: {"contributor": d.get("contributor",None)},
"coverage" : lambda d: {"spatial": d.get("coverage",None)},
"coverage" : spatial_transform,
"creator" : lambda d: {"creator": d.get("creator",None)},
"description" : lambda d: {"description": d.get("description",None)},
"date" : lambda d: {"date": d.get("date",None)},
Expand Down

0 comments on commit 68fa190

Please sign in to comment.