Пример #1
0
def build_data(src_dir='',
               site_dir='_site',
               schema_file='_prose.yml',
               languages=None,
               translations=None,
               config='open_sdg_config.yml'):
    """The build_data function is deprecated. Use open_sdg_build instead."""

    return open_sdg_build(src_dir=src_dir,
                          site_dir=site_dir,
                          schema_file=schema_file,
                          languages=languages,
                          translations=translations,
                          config=config)
Пример #2
0
from sdg.open_sdg import open_sdg_build
from alterations import alter_meta

open_sdg_build(config='config_data.yml', alter_meta=alter_meta)
import os
from sdg.open_sdg import open_sdg_build

folder = os.path.dirname(os.path.realpath(__file__))
config = os.path.join(folder, 'open_sdg_sdmx_output.yml')

open_sdg_build(config=config)
from sdg.open_sdg import open_sdg_build
from alter_meta import alter_meta
from alter_data import alter_data
from indicator_callback import indicator_callback

open_sdg_build(config='config_data.yml',
               alter_meta=alter_meta,
               alter_data=alter_data,
               indicator_callback=indicator_callback)
Пример #5
0
from sdg.open_sdg import open_sdg_build

open_sdg_build(config='config_data.yml')
import os
from sdg.open_sdg import open_sdg_build
from sdg.open_sdg import open_sdg_check

# Assumes that this 'open_sdg_config' file exists in the same folder as this one.
# For an example of the possible options, see docs/examples/open_sdg_config.yml.
folder = os.path.dirname(os.path.realpath(__file__))
config = os.path.join(folder, 'open_sdg_config.yml')


# Perhaps we need to alter the data in some way.
def alter_data(df):
    df['my_column'] = 'foo'


# Perhaps we need to alter the metadata in some way.
def alter_meta(meta):
    meta['my_field'] = 'bar'


# Validate the indicators.
validation_successful = open_sdg_check(config=config,
                                       alter_data=alter_data,
                                       alter_meta=alter_meta)

# If everything was valid, perform the build.
if validation_successful:
    open_sdg_build(config=config, alter_data=alter_data, alter_meta=alter_meta)
else:
    raise Exception('There were validation errors. See output above.')