koopjs / koop-provider-ckan

CKAN provider for Koop (experimental).
Other
4 stars 5 forks source link

Adding some kind of support to ICMS format and different delimiters #12

Closed hhkaos closed 9 years ago

hhkaos commented 9 years ago

I was trying to suscribe to this CKAN: datos.santander.es.

It seems to be managed by RagTime and that's why the resources instead of CSV returns ICMS // +info.

It's weird because when you use the standard API call you see this where no CSV appears, but when you go inside the portal you can find a CSV resource.

That's why I tried with this:

if (result.resources[i].format === 'CSV') {
  item_url = host + self.ckan_dump_path + '/' + result.resources[i].id
}else if(result.resources[i].format == 'ICMS'){
    // It's working but not sure how to improve it
    item_url = result.resources[i].url+".csv";
}

And it worked, but maybe I should find a better way to do this hehe.

At the same time I notice that no others delimiters are supported (just ',') and in Spain we usually use ';' instead; so I decided to give a try to detect-csv module and ... it did the work perfectly!, so I decided to include it.

I hope this can help somehow.

Best regards, Raul

ungoldman commented 9 years ago

Thanks @hhkaos, looks good!