<div dir="ltr">I really like where this is going, some general feedback about the module before and then my comments about the question you posed:<div><br></div><div>1) I would like to make this an optional app, the kind of dependencies it pulls in (sqlalchemy) should be optional and not mandatory.</div><div>2) That said, I do think we should keep it under the GeoNode github org umbrella if possible and make the installation painless via packages (sudo apt-get install geonode-csv)</div><div>3) I see a lot of try/except blocks without specific exceptions [1]. This wrapping can make the code harder to debug if something goes wrong, because it will trap all errors and reduce the stacktraces to simple messages.</div><div><br></div><div>About JoinTargetFormatType:</div><div><br></div><div>I imagine the best place to do this is at the database (postgis level), having the output be a view that is hooked up to the Django ORM for ease of querying or can be directly enabled in GeoServer. If you go the Python way, I assume you would like to store things back to the database after the cleanup process and that back and forth seems like something we should avoid.</div><div><br></div><div>Happy birthday,</div><div>Ariel</div><div><br></div><div>[1] <a href="https://github.com/jj0hns0n/geonode/blob/table-join/geonode/contrib/datatables/utils.py#L257">https://github.com/jj0hns0n/geonode/blob/table-join/geonode/contrib/datatables/utils.py#L257</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 23, 2015 at 4:33 PM, Jeffrey Johnson <span dir="ltr"><<a href="mailto:ortelius@gmail.com" target="_blank">ortelius@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Gents,<br>
<br>
As mentioned in a previous post and in GNIP #1915, I've been working<br>
on adding a new 'datatables' contrib module for GeoNode that allows<br>
for uploading of CSV or other delimited files and loading these into<br>
PostgreSQL and joining a existing geometry to them. You can see the<br>
implementation here<br>
<a href="https://github.com/jj0hns0n/geonode/compare/table-join?expand=1" target="_blank">https://github.com/jj0hns0n/geonode/compare/table-join?expand=1</a> ...<br>
Everything is mostly working and functional at an API level. You can<br>
see the test setup we are using in tabular-api/code/tabular_test.py<br>
(this will get converted into a more complete integration test suite).<br>
<br>
The largest issue we have run into in our testing is field type<br>
mismatches. The simplest case is an int field in either the table or<br>
the layer and a string field in the other. There are also issues with<br>
the field being specified with leading zeroes or other characters in<br>
one of the 2 join components and not in the other. The folks at<br>
harvard have found other instances where they need to actually join<br>
the contents of 2 fields together before joining.<br>
<br>
Some tickets in my own fork for background/reference.<br>
<br>
<a href="https://github.com/jj0hns0n/geonode/issues/34" target="_blank">https://github.com/jj0hns0n/geonode/issues/34</a><br>
<a href="https://github.com/jj0hns0n/geonode/issues/30" target="_blank">https://github.com/jj0hns0n/geonode/issues/30</a><br>
<a href="https://github.com/jj0hns0n/geonode/issues/40" target="_blank">https://github.com/jj0hns0n/geonode/issues/40</a><br>
<a href="https://github.com/jj0hns0n/geonode/issues/50" target="_blank">https://github.com/jj0hns0n/geonode/issues/50</a><br>
<a href="https://github.com/jj0hns0n/geonode/issues/49" target="_blank">https://github.com/jj0hns0n/geonode/issues/49</a> (the ticket Im dealing<br>
with _right now_)<br>
<br>
Raman (@raprasad) and I have discussed several options for dealing<br>
with this kind of problem and we decided to add a class<br>
JoinTargetFormatType that could store information necessary to do<br>
these kinds of conversions. You can see that class here<br>
<a href="https://github.com/jj0hns0n/geonode/blob/table-join/geonode/contrib/datatables/models.py#L51" target="_blank">https://github.com/jj0hns0n/geonode/blob/table-join/geonode/contrib/datatables/models.py#L51</a><br>
which is used in the JoinTarget class here<br>
<a href="https://github.com/jj0hns0n/geonode/blob/table-join/geonode/contrib/datatables/models.py#L71" target="_blank">https://github.com/jj0hns0n/geonode/blob/table-join/geonode/contrib/datatables/models.py#L71</a><br>
... The basic idea is that you could have a set of pre-defined<br>
transformation functions or include some regex or a python function to<br>
do the conversion. None of this is hooked up yet, but thats the basic<br>
idea.<br>
<br>
So, we wanted to consult with all of you to see if anyone had any<br>
ideas about how best to hook this kind of thing up ... or perhaps some<br>
words of caution about how NOT to do this.<br>
<br>
Happy to discuss further if anyone has any questions or is unclear on<br>
what we are trying to do.<br>
<br>
Thanks in advance,<br>
<br>
Jeff<br>
<br>
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:geonode-dev%2Bunsubscribe@boundlessgeo.com">geonode-dev+unsubscribe@boundlessgeo.com</a>.<br>
</blockquote></div><br></div>