Skip to main content

A utility to simplify mapping Factiva country codes

Project description

Factiva Country Code Mapping

This utility simplifies mapping between country names, DJII region codes, and ISO Alpha 2 country codes. There were two approaches explored in this implementation: the first was to create a list containing lists for each mapping of country name to DJII RC to ISO Alpha 2 code, and the second was to create three separate dictionaries with each of the various data type as keys. This was both a simple exercise to compare O(n) between searching the underlying data using lists vs dictionaries, as well as to actually transform data files being used with the Factiva search engine.

Installation

To install this library, run the following commands.

$ pip install -i factiva-country-code-mapping

Usage

The utility can be run by adding csv files to the 'process' folder; the input files should contain a newline ('\n') delimited list of country codes, DJII region codes, or ISO Alpha 2 country codes that are to be mapped to either of the other two data types. I've included some sample inputs and outputs in the 'process' folder - both inputs should be uploaded there and outputs will be displayed there. This utlity will output the other two data types by running the following command.

python -m country_code_mapping <input file> [method-options] [output-options]

<input file> - filename of input file located in the 'process/input' folder

[method-options] - method of parsing with the below values

        l = list approach (slower)
        d = dictionaries approach (faster)

[output-options] - preferred output format with the below values

        0 = standard country names
        1 = DJII region codes
        2 = ISO Alpha 2 country codes

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

factiva-country-code-mapping-1.0.2.tar.gz (13.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page