openstate/open-cultuur-data — pull request #23 by bennokr (2014-06-01 19:32:46+00:00)
Title: Centraal Museum Utrecht Modecollectie

![logo](https://cloud.githubusercontent.com/assets/994319/3142462/ff798ffe-e9bf-11e3-93f8-0b80a7336b90.png)

The [Centraal Museum Modecollectie](http://www.opencultuurdata.nl/wiki/centraal-museum/) consists of fashion items in the Centraal Museum Utrecht. The data is in a [static XML file on dropbox](http://bit.ly/CM18062012), which I mirrored as [a gist](https://gist.githubusercontent.com/bennokr/8cdc528fde1d2a3358d5/raw/308f84452611a77671081e9c7df1bc8139ec3bbd/cmu.xml) (8MB) to be able to HTTP request it. This should probably be mirrored instead on OCD servers, as described in issue #12?

### Notebook
In order to explore the data, @Gijs-Koot and I used [this iPython notebook](http://nbviewer.ipython.org/github/bennokr/open-cultuur-data/blob/ed4721d16ae4fe2829a54a7cbf9e87204a6613f8/parse_centraal_museum_notebook.ipynb) for easy debugging and visualising. Have a look to see what the dataset's like. It makes things a lot easier!

### Date granularity parsing
In addition to the static XML extractor and the items, this pull request contains a general way of dealing with messy date strings. The function `ocd_backend.utils.misc.parse_date` parses a date string using a collection of regexen, which look for question marks and stuff like that and reconstruct a granular date. The function `ocd_backend.utils.misc.parse_date_span` takes two messy date strings, representing an estimated start and end date, and reconstructs a granular date based on the first and the difference between them. For example, in the CMU regexen, the dates `196?` and `None` are transformed into `1960-01-01T00:00:00` with granularity `3`. Input on this approach is very welcome!