Parsing content from deps?

Hello,

I’m interested in adding https://github.com/musalbas/mcc-mnc-table data into my project.

I’m not sure about how should I get the json file content to parse it and use it.

So,

1/ Is that a good idea to include it as a deps app in any way, or should I simply copy over the json file to my project ?
2/ If including it as a deps, how to correctly access the file ?

Thanks

That is a python project, it has no business being in your dependencies. I see two options here.

  1. Write a module that will will download that file periodically and maybe put it in ets, or some other way to query the data. This can be a separate project that you can upload to hex.

  2. Download that file manually and throw it in your priv directory. Then you can access the data however you want. You may still want to consider putting it in ets or something to prevent having to read and parse a file every time you need it.

1 Like

If you do go the route of parsing downloading and parsing the file at compile time you could look at https://github.com/seomoz/publicsuffix-elixir as inspiration. It effectively generates code from this list: https://publicsuffix.org/

So different dataset but similar concept

1 Like

Thanks, I won’t have it as a deps, I will look into this project for inspiration.