Add python-phonenumbers Library to Turbot

27 views
Skip to first unread message

Anthony Santos

unread,
Dec 31, 2014, 1:55:08 AM12/31/14
to opencorporat...@googlegroups.com
Hey Turbot devs,

First-time posting here. I'm in the process of writing my first simple bot for an OpenCorporates mission, and thought it would be nice to have a phone number parser for validating my primary data. (BTW please let me know if I'm doing too much by attempting to validate primary data. The spec makes it sound like primary data should be very close to the row element's text, but in this case each row element is actually quite structured.) 

Luckily, Google wrote libphonenumber to solve the problem for every country - allowing you to parse and validate phone numbers across all countries. This lets you translate a phone number dialed in the UK into one dialed in the US, for instance. In addition, you can validate via 2 separate methods: isPossibleNumber (simple rules, efficient) and isValidNumber (complex rules, correct). The python-phonenumbers port is based on the same rules defined in libphonenumber. There's also a Ruby port, global_phone.

Thanks,

Anthony Santos

peter...@opencorporates.com

unread,
Jan 2, 2015, 5:06:00 PM1/2/15
to opencorporat...@googlegroups.com

Hi Anthony,

Glad to hear that you've claimed your first mission and are writing a bot for it.

Thanks for getting in touch about the python library, it looks great and we'll consider it when we next look at the development environments & will let you know of the outcome.

Regarding primary data, you are right in saying that it should be as close to the source as possible - we should try to represent the data as it appears so that whatever we do we will still have a copy of the original data.

What is then really great is to use a transformer to output data in a standardised format (at the moment using the Simple licence schema), as well as outputting the primary data. One can then be more flexible with how the data is handled.

In case you haven't come across this yet and are interested, here's some links about writing transformers:

Supported data types: http://turbot.opencorporates.com/docs/supported_data_types

Transformer examples: http://turbot.opencorporates.com/docs/examples#structured-bots

We have also recently completed the schema for the Rich licence, as yet undocumented, which could be used if anyone fancies more of a challenge.

Cheers,

Peter

Reply all
Reply to author
Forward
0 new messages