Пример #1
0
def generate_package():
    package_flow = Flow(
        add_metadata(
            name="unicode-emojis",
            title="UTS #51 Unicode Emoji",
            descriptor=(
                "List of emojis available from the Unicode Consortium. "
                "More information can be found in the Unicode® Technical Standard #51."
            ),
            sources=[
                {
                    "name": "unicode-emoji",
                    "path": "https://unicode.org/Public/emoji/latest/emoji-test.txt",
                    "title": "UTS #51 Unicode Emoji",
                },
            ],
            licenses=[
                {
                    "name": "ODC-PDDL-1.0",
                    "path": "http://opendatacommons.org/licenses/pddl/",
                    "title": "Open Data Commons Public Domain Dedication and License v1.0",
                }
            ],
            keywords=["unicode", "emojis", "emoji", "51", "standard", "uts"],
        ),
        load(load_source="data/emojis.csv", format="csv",),
        validate(),
        dump_to_path(),
    )
    package_flow.process()
Пример #2
0
def test_add_metadata():
    from dataflows import add_metadata
    f = Flow(
        data,
        add_metadata(author='Adam Kariv')
    )
    _, dp, _ = f.results()
    assert dp.descriptor['author'] == 'Adam Kariv'
Пример #3
0
def conference_csv():
    flow = Flow(
        # Load inputs
        load(
            od19_base + od19_feedback,
            name='feedback',
            format='csv',
        ),
        load(
            od19_base + od19_analysis,
            name='analysis',
            format='csv',
        ),
        # Process them
        set_type("Anzahl.*", type='integer', resources='analysis'),
        delete_fields([
            "Anzahl Auflistung",
            ".*\\(Formel\\)",
            ".*Duplikate",
        ],
                      resources='analysis'),
        not_empty_groupcol,
        # Save the results
        add_metadata(
            name='opendatach19',
            title='''Opendata.ch/2019 Forum''',
            licenses=[{
                "name":
                "ODC-PDDL-1.0",
                "path":
                "http://opendatacommons.org/licenses/pddl/",
                "title":
                "Open Data Commons Public Domain Dedication and License v1.0"
            }],
            maintainers=[{
                "name": "Oleg Lavrovsky",
                "web": "https://datalets.ch/"
            }],
            views=[{
                "name": "Groups",
                "resources": ["analysis"],
                "spec": {
                    "group": "Alle "
                    "Bedürfnisse"
                    "",
                    "series": ["Anzahl Auflistung (Zahl)"],
                    "type": "bar"
                },
                "specType": "simple",
                "title": "Topic counts"
            }]),
        printer(),
        validate(),
        dump_to_path('data/opendatach19'),
    )
    flow.process()
Пример #4
0
def AFRR_Data():
    unpivoting_fields = [{
        'name': 'aFRR_DownActivated',
        'keys': {
            'product': 'aFRR_DownActivated'
        }
    }, {
        'name': 'aFRR_UpActivated',
        'keys': {
            'product': 'aFRR_UpActivated'
        }
    }]
    extra_keys = [{'name': 'product', 'type': 'string'}]
    extra_value = {'name': 'amount', 'type': 'number'}
    flow = Flow(
        # Load inputs - using 'datastore_search_sql' API load last 10k rows:
        load(
            'https://api.energidataservice.dk/datastore_search_sql?sql=select%20*%20from%20afrrreservesdk1%20order%20by%20"HourUTC"%20desc%20limit%201000',
            format="json",
            property="result.records",
            name="fact_afrr"),
        # Remove extra fields:
        delete_fields(fields=['_id', '_full_text', 'HourDK']),
        # Save the results
        checkpoint('afrr'),
        # Normalize/unpivot:
        unpivot(unpivoting_fields, extra_keys, extra_value),
        add_computed_field([
            dict(target=dict(name='PriceArea', type='string'),
                 operation='constant',
                 with_='DK1'),
            dict(target=dict(name='PriceDKK', type='number'),
                 operation='constant',
                 with_='dummy'),
            dict(target=dict(name='PriceEUR', type='number'),
                 operation='constant',
                 with_='dummy')
        ]),
        add_price,
        delete_fields(fields=[
            'aFRR_DownPriceDKK', 'aFRR_DownPriceEUR', 'aFRR_UpPriceDKK',
            'aFRR_UpPriceEUR'
        ]),
        add_metadata(name='marketdata', title='Marketdata prototype'),
        update_resource(resources=None, mediatype='text/csv'),
        update_resource(
            resources='fact_afrr',
            title='Automatic Frequency Restoration Reserves',
            source=
            'https://www.energidataservice.dk/dataset/afrrreservesdk1/resource_extract/0694e216-6713-4f84-9b98-7bb5bc11d80c'
        ),
        printer(),
        dump_to_path('afrr_data'))
    flow.process()
Пример #5
0
def flow(parameters, datapackage, resources, source_stats):
    def download_messages(package: PackageWrapper):
        if 'allowed-senders' in package.pkg.resource_names:
            package.pkg.remove_resource('allowed-senders')
        package.pkg.add_resource({
            'dpp:streaming': True,
            'name': 'messages',
            'path': 'messages.csv',
            'schema': {
                'fields': [{
                    'name': 'id',
                    'type': 'string'
                }, {
                    'name': 'snippet',
                    'type': 'string'
                }, {
                    'name': 'from',
                    'type': 'string'
                }, {
                    'name': 'to',
                    'type': 'string'
                }, {
                    'name': 'date',
                    'type': 'string'
                }, {
                    'name': 'subject',
                    'type': 'string'
                }, {
                    'name': 'part_ids',
                    'type': 'array'
                }, {
                    'name': 'organization_id',
                    'type': 'string'
                }]
            }
        })
        yield package.pkg
        allowed_senders = []
        for resource in package:
            if resource.res.name == 'allowed-senders':
                allowed_senders = list(get_allowed_senders(resource))
            else:
                yield resource

        yield get_messages(source_stats, allowed_senders)

    load_args = parameters.get("load_args")
    if not load_args:
        load_args = [(datapackage, resources)]
    return Flow(add_metadata(name='_'), load(*load_args), download_messages)
Пример #6
0
def flow(parameters, datapackage, resources, stats):
    meta = get_league_meta(parameters)
    processors = get_processors(meta)
    processors.append(set_type('Date', type='date', format='%d/%m/%y')),
    processors = [
        add_metadata(name=parameters['dataset-name'],
                     title=parameters['dataset-title'],
                     licenses=licenses,
                     sources=sources,
                     related=related_datasets,
                     readme=readme %
                     parameters['dataset-title'].replace(' (football)', ''))
    ] + processors
    return Flow(*processors)
Пример #7
0
def update_dataset():
    flow = Flow(
        # Load inputs
        load(f'{BASE_URL}{CONFIRMED}'),
        load(f'{BASE_URL}{RECOVERED}'),
        load(f'{BASE_URL}{DEATH}'),
        checkpoint('load_data'),
        # Process them (if necessary)
        # Save the results
        add_metadata(name='csse_covid_19_time_series', title='''csse_covid_19_time_series'''),
        printer(),
        dump_to_path(),
    )
    flow.process()
Пример #8
0
def flow(*args):
    return Flow(
        # Load inputs
        load(
            "https://www.data.gouv.fr/fr/datasets/r/41b9bd2a-b5b6-4271-8878-e45a8902ef00",
            name='donnees-etab',
            format='csv',
        ),
        # necessary for dpp integration
        # https://github.com/frictionlessdata/datapackage-pipelines/issues/150#issuecomment-432152302
        update_resource('donnees-etab', **{'dpp:streaming': True}),
        # Save the results
        add_metadata(name='donnees_test', title='''donnees-test'''),
    )
Пример #9
0
def WERKVERZEICHNIS_csv():
    flow = Flow(
        # Load inputs
        # load('input/WERKVERZEICHNIS_ohne W.xlsx', format='xlsx', ),
        load(
            'input/WERKVERZEICHNIS.csv',
            format='csv',
        ),
        # Process them (if necessary)
        # ...
        # Save the results
        add_metadata(name='Werkverzeichnis-JStraumann',
                     title='''Werkverzeichnis Jürg Straumann'''),
        # printer(),
        dump_to_path('data'),
    )
    flow.process()
Пример #10
0
def flow(parameters, datapackage, resources, stats):
    stats['foo_values'] = 0

    def add_foo_field(package: PackageWrapper):
        package.pkg.descriptor['resources'][0]['schema']['fields'] += [
            {'name': parameters['attr'], 'type': 'string'}]
        yield package.pkg
        yield from package

    def add_foo_value(row):
        row[parameters['attr']] = 'foo'
        stats['foo_values'] += 1

    return Flow(add_metadata(name='_'),
                hello_dataflows,
                load((datapackage, resources)),
                add_foo_field,
                add_foo_value)
Пример #11
0
def Elspot_Prices_Data():
    # field_metadata = get_metadata('c86859d2-942e-4029-aec1-32d56f1a2e5d')
    flow = Flow(
        # Load inputs - using 'datastore_search_sql' API load last 10k rows:
        load(
            'https://api.energidataservice.dk/datastore_search_sql?sql=select%20*%20from%20elspotprices%20order%20by%20"HourUTC"%20desc%20limit%20100',
            format="json",
            property="result.records",
            name="fact_elspot_prices"),
        # Remove extra fields:
        delete_fields(fields=['_id', '_full_text', 'HourDK']),
        # Save the results
        checkpoint('load_data'),
        # Add product:
        add_computed_field([
            dict(target=dict(name='product', type='string'),
                 operation='constant',
                 with_='Elspot'),
            dict(target=dict(name='amount', type='number'),
                 operation='constant',
                 with_=1),
            dict(target=dict(name='PriceDKK', type='number'),
                 operation='constant',
                 with_=-1),
            dict(target=dict(name='PriceEUR', type='number'),
                 operation='constant',
                 with_=-1)
        ]),
        add_price,
        delete_fields(fields=['SpotPriceDKK', 'SpotPriceEUR']),
        add_metadata(name='marketdata', title='Marketdata prototype'),
        update_resource(resources=None, mediatype='text/csv'),
        update_resource(
            resources='fact_elspot_prices',
            title='Elspot Prices Data',
            source=
            'https://www.energidataservice.dk/dataset/elspotprices/resource_extract/c86859d2-942e-4029-aec1-32d56f1a2e5d'
        ),
        printer(),
        dump_to_path('elspot_prices_data'),
        # dump_to_sql(tables={'elspot': {'resource-name': 'Elspot_Prices_Data', 'mode': 'append'}}, engine='postgresql://*****:*****@localhost/cubes')
    )
    flow.process()
Пример #12
0
def flow(*args):
    return Flow(
        # Load inputs
        *[
            load(f"https://www.data.gouv.fr/fr/datasets/r/{resource['id']}",
                 name=resource['name'],
                 format='csv',
                 override_schema=get_schema(resource['name']))
            for resource in RESOURCES
        ],
        # necessary for dpp integration
        # https://github.com/frictionlessdata/datapackage-pipelines/issues/150#issuecomment-432152302
        *[
            update_resource(resource['name'], **{'dpp:streaming': True})
            for resource in RESOURCES
        ],
        # Save the results
        add_metadata(name='donnees_hospitalieres_covid19',
                     title='''donnees-hospitalieres-covid19'''),
    )
Пример #13
0
 {% if 'delete_fields' in processing %}
 delete_fields(['field_name']),  # Pass a list of field names to delete from the data
 {% endif %}
 {% if 'set_type' in processing %}
 set_type('field_name', type='number', constraints=dict(minimum=3)),  # There are quite a few options you can use here
                                                                      # Take a look at https://frictionlessdata.io/specs/table-schema/
 # Or you can simply use validate() here instead                                                                             
 {% endif %}
 {% if 'unpivot' in processing %}
 unpivot(unpivot_fields, extra_keys, extra_value),  # See documentation on the meaning of each of these parameters
 {% endif %}
 {% if 'custom' in processing %}
 my_custom_processing,
 {% endif %}
 # Save the results
 add_metadata(name='{{slug}}', title='''{{title}}'''),
 {% if output in ('print', 'print_n_pkg')  %}
 printer(),
 {% endif %}
 {% if output == 'list' %}
 {% endif %}
 {% if output in ('dp_csv', 'print_n_pkg') %}
 dump_to_path('{{slug}}'),
 {% endif %}
 {% if output == 'dp_csv_zip' %}
 dump_to_zip('{{slug}}.zip'),
 {% endif %}
 {% if output == 'dp_json' %}
 dump_to_path('{{slug}}', force_format=True, format='json'),
 {% endif %}
 {% if output == 'dp_json_zip' %}
Пример #14
0

bond_uk = Flow(
    add_metadata(
        name="bond-yields-uk-10y",
        title="10y UK Government Bond Yields (long-term interest rate)",
        sources=[{
            "name": "Bank of England",
            "path":
            "http://www.bankofengland.co.uk/boeapps/iadb/index.asp?Travel=NIxIRx&levels=1&XNotes=Y&C=DUS&G0Xtop.x=51&G0Xtop.y=7&XNotes2=Y&Nodes=X41514X41515X41516X41517X55047X76909X4051X4052X4128X33880X4053X4058&SectionRequired=I&HideNums=-1&ExtraInfo=true#BM",
            "title": "Bank of England"
        }],
        licenses=[{
            "id": "odc-pddl",
            "path": "http://opendatacommons.org/licenses/pddl/",
            "name": "public_domain_dedication_and_license"
        }],
        views=[{
            "name": "graph",
            "title":
            "Average yield from British Government Securities, 10 year Nominal Par Yield",
            "specType": "simple",
            "spec": {
                "type": "line",
                "group": "Date",
                "series": ["Rate"]
            }
        }],
        readme=readme()),
    load(
        load_source=
        'http://www.bankofengland.co.uk/boeapps/iadb/fromshowcolumns.asp?csv.x=yes&SeriesCodes=IUQAMNPY&UsingCodes=Y&CSVF=TN&Datefrom=01/Jan/1963',
Пример #15
0
 add_metadata(
     name="oil-prices",
     title= "Brent and WTI Spot Prices",
     descriptor="A variety of temporal granularities for Europe Brent and WTI (West Texas Intermediate) Spot Prices.",
     sources=[
         {
             "name": "Daily Europe Brent Spot Price",
             "path": "https://www.eia.gov/dnav/pet/hist_xls/RBRTEd.xls",
             "title": "Daily Europe Brent Spot Price"
         },
         {
             "name": "Daily Cushing, OK WTI Spot Price",
             "path": "http://www.eia.gov/dnav/pet/hist_xls/RWTCd.xls",
             "title": "Daily Cushing, OK WTI Spot Price"
         },
         {
             "name": "OPEC: Monthly Oil Market Report",
             "path": "https://www.opec.org/opec_web/static_files_project/media/downloads/publications/MOMR%20Appendix%20Tables%20(April%202020).xlsx",
             "title": "OPEC: Monthly Oil Market Report"
         },
     ],
     licenses=[
         {
             "name": "ODC-PDDL-1.0",
             "path": "http://opendatacommons.org/licenses/pddl/",
             "title": "Open Data Commons Public Domain Dedication and License v1.0"
         }
     ],
     keywords=["Oil","Brent","WTI","Oil Prices","eia","oil eia"],
     views=[
         {
             "name": "graph",
             "title": "Europe Brent Spot Price FOB (Dollars per Barrel)",
             "resourceName": "brent-day",
             "specType": "simple",
             "spec": {
             "type": "line",
                 "group": "Date",
                 "series": ["Brent Spot Price"]
             }
         }
     ]
 ),
Пример #16
0
    yield package.pkg
    res_iter = iter(package)
    for res in res_iter:
        yield res.it
    yield from package


oil_prices = Flow(
    add_metadata(
        name="Opec_data",
        title="A source of Opec Data",
        descriptor=
        "A variety of temporal granularities for Europe Brent and WTI (West Texas Intermediate) Spot Prices.",
        sources=[
            {
                "name": "OPEC: Monthly Oil Market Report",
                "path":
                "https://www.opec.org/opec_web/static_files_project/media/downloads/publications/MOMR%20Appendix%20Tables%20(April%202020).xlsx",
                "title": "OPEC: Monthly Oil Market Report"
            },
        ]),
    load(
        load_source=
        'https://www.opec.org/opec_web/static_files_project/media/downloads/publications/MOMR%20Appendix%20Tables%20(April%202020).xlsx',
        format='xls',
        sheet=2,
        skip_rows=[1, 2, 3, 4, 5],
        headers=[
            ' ', 'Country', '2016', '2017', '2018', '1Q19', '2Q19', '3Q19',
            '4Q19', '2019', '1Q20', '2Q20', '3Q20', '4Q20', '2020'
Пример #17
0
        'name': 'serie-a',
        'path': 'italym.php',
        'key': 'I1',
        'links': [],
        'dataset-name': 'italian-serie-a',
        'dataset-title': 'Italian Serie A (football)'
    }, {
        'name': 'ligue-1',
        'path': 'francem.php',
        'key': 'F1',
        'links': [],
        'dataset-name': 'french-ligue-1',
        'dataset-title': 'French Ligue 1 (football)'
    }]
    for league in leagues:
        meta = get_league_meta(league)
        processors = get_processors(meta)
        processors.append(set_type('Date', type='date', format='%d/%m/%y')),
        processors.append(dump_to_path(out_path='datasets/' + league['name']))
        processors.append(printer())
        processors = [
            add_metadata(name=league['dataset-name'],
                         title=league['dataset-title'],
                         licenses=licenses,
                         sources=sources,
                         related=related_datasets,
                         readme=readme %
                         league['dataset-title'].replace(' (football)', ''))
        ] + processors
        Flow(*processors).process()
Пример #18
0
bond_us = Flow(
    add_metadata(
        name="bond-yields-us-10y",
        title="10 year US Government Bond Yields (long-term interest rate)",
        version="0.2.0",
        sources=[
            {
              "name": "Federal Reserve (Release H.15)",
              "path": "http://www.federalreserve.gov/releases/h15/data.htm",
              "title": "Federal Reserve (Release H.15)"
            }
        ],
        licenses=[
            {
              "id": "odc-pddl",
              "path": "http://opendatacommons.org/licenses/pddl/",
              "title": "Open Data Commons Public Domain Dedication and License v1.0",
              'name': "open_data_commons_public_domain_dedication_and_license_v1.0"
            }
        ],
        views=[
            {
              "name": "graph",
              "title": "10 year US Government Bond Yields (Monthly granuarlity)",
              "specType": "simple",
              "spec": {"type": "line","group": "Date","series": ["Rate"]}
            }
        ],
        readme=readme()
    ),
    load(
Пример #19
0
 add_metadata(
     name="population-growth-estimates-and-projections",
     title= "Population Growth",
     descriptor="Total Population - Both Sexes. De facto population in a country, area or region",
     views=[
         {
             "name": "population-growth-estimates",
             "resources": [
                 {
                     "name": "population-estimates",
                     "transform": [{"expression": "data['Region'] === 'WORLD'","type": "filter"}]
                 }
             ],
             "spec": {"group": "year","series": ["population"],"type": "line"},
             "specType": "simple",
             "title": "Population Growth - World Estimates"
         },
         {
             "name": "population-growth-projections",
             "resources": [
                 {
                     "name": "population-no-change",
                     "transform": [{"expression": "data['Region'] === 'WORLD'", "type": "filter"}]
                 }
             ],
             "spec": {"group": "year","series": ["population"],"type": "line"},
             "specType": "simple",
             "title": "Population Growth - World Projections (No change)"
         },
         {
             "name": "population-growth-projections-low",
             "resources": [
                 {
                     "name": "population-low-fertility",
                     "transform": [{"expression": "data['Region'] === 'WORLD'","type": "filter"}]
                 }
             ],
             "spec": {"group": "year","series": ["population"],"type": "line"},
             "specType": "simple",
             "title": "Population Growth - World Projections (Low Fertility)"
         },
         {
             "name": "population-growth-projections-medium",
             "resources": [
                 {
                     "name": "population-medium-fertility",
                     "transform": [{"expression": "data['Region'] === 'WORLD'","type": "filter"}]
                 }
             ],
             "spec": {"group": "year","series": ["population"],"type": "line"},
             "specType": "simple",
             "title": "Population Growth - World Projections (Medium Fertility)"
         },
         {
             "name": "population-growth-projections-high",
             "resources": [
                 {
                     "name": "population-high-fertility",
                     "transform": [
                         {"expression": "data['Region'] === 'WORLD'","type": "filter"}]
                 }
             ],
             "spec": {"group": "year","series": ["population"],"type": "line"},
             "specType": "simple",
             "title": "Population Growth - World Projections (High Fertility)"
         }
     ],
     readme=readme()
 ),
Пример #20
0
 add_metadata(
     name="gold-prices",
     title="Gold Prices",
     homepage='http://www.bundesbank.de',
     licenses=[
         {
             "id": "odc-pddl",
             "name": "public_domain_dedication_and_license",
             "version": "1.0",
             "url": "http://opendatacommons.org/licenses/pddl/1.0/"
         }
     ],
     sources=[
         {
           "name": "bundesbank-gold-prices",
           "path": "'http://www.bundesbank.de/cae/servlet/StatisticDownload?tsId=BBEX3.M.XAU.USD.EA.AC.C06&its_csvFormat=en&its_fileFormat=csv&mode=its'",
           "title": "Bundesbank gold prices"
         }
     ],
     views=[
         {
             "name": "graph",
             "title": "Gold Prices (Monthly in USD)",
             "specType": "simple",
             "spec": {
                 "type": "lines-and-points",
                 "group": "Date",
                 "series": [
                     "Price"
                 ]
             }
         }
     ],
     related=[
         {
             "title": "Oil prices",
             "path": "/core/oil-prices",
             "publisher": "core",
             "formats": ["CSV", "JSON"]
         },
         {
             "title": "Natural gas",
             "path": "/core/natural-gas",
             "publisher": "core",
             "formats": ["CSV", "JSON"]
         }
     ],
     version="0.2.0"
 ),
Пример #21
0
finance_vix = Flow(
    add_metadata(
        name="finance-vix",
        title= "VIX - CBOE Volatility Index",
        homepage= 'http://www.cboe.com/micro/VIX/',
        sources=[
            {
              "name": "CBOE VIX Page",
              "path": "http://www.cboe.com/micro/vix/historical.aspx",
              "title": "CBOE VIX Page"
            }
        ],
        licenses=[
            {
              "id": "odc-pddl",
              "path": "http://opendatacommons.org/licenses/pddl/",
              "title": "Open Data Commons Public Domain Dedication and License v1.0",
              'name': "open_data_commons_public_domain_dedication_and_license_v1.0"
            }
        ],
        version="0.2.0",
        views=[
            {
              "name": "graph",
              "title": "VIX - CBOE Volatility Index",
              "specType": "simple",
              "spec": {"type": "line","group": "Date","series": ["VIX Close"]}
            }
        ],
        readme=readme()
    ),
    load(
        return open(fpath).read()


dialing_info_cldr = Flow(
    load('http://ourairports.com/data/airports.csv', name='airport-codes'),
    add_metadata(
        name="airport-codes",
        title="Airport Codes",
        homepage="http://www.ourairports.com/",
        version="0.2.0",
        licenses=[{
            "id":
            "odc-pddl",
            "path":
            "http://opendatacommons.org/licenses/pddl/",
            "title":
            "Open Data Commons Public Domain Dedication and License v1.0",
            'name':
            "open_data_commons_public_domain_dedication_and_license_v1.0"
        }],
        sources=[{
            "name": "Our Airports",
            "path": "http://ourairports.com/data/",
            "title": "Our Airports"
        }],
        readme=readme()),
    add_computed_field([{
        "operation": "format",
        "target": "coordinates",
        "with": "{latitude_deg}, {longitude_deg}"
    }]),
Пример #23
0
 add_metadata(
     name="us-euro-foreign-exchange-rate",
     title="USA / EUR Foreign Exchange Rate since 1999",
     homepage='https://fred.stlouisfed.org',
     sources=[
         {
             "name": "federal-reserve-bank-st-louis",
             "title": "Federal Reserve Bank of St. Louis",
             "path": "https://fred.stlouisfed.org/categories/158"
         }
     ],
     licenses=[
         {
             "id": "odc-pddl",
             "name": "public_domain_dedication_and_license",
             "version": "1.0",
             "url": "http://opendatacommons.org/licenses/pddl/1.0/"
         }
     ],
     views=[
         {
             "name": "us-to-uk-foreign-exchange-rate",
             "title": "USA / GBP Foreign Exchange Rate since 1971",
             "resources": [
                 {
                     "name": "daily",
                     "transform": [
                         {
                             "type": "filter",
                             "expression": "data['Country'] === 'United Kingdom'"
                         }
                     ]
                 }
             ],
             "specType": "simple",
             "spec": {
                 "type": "line",
                 "group": "Date",
                 "series": [
                     "Exchange Rate"
                 ]
             }
         },
         {
             "name": "us-euro-foreign-exchange-rate",
             "title": "USA / EUR Foreign Exchange Rate since 1999",
             "resources": [
                 {
                     "name": "daily",
                     "transform": [
                         {
                             "type": "filter",
                             "expression": "data['Country'] === 'Euro'"
                         }
                     ]
                 }
             ],
             "specType": "simple",
             "spec": {
                 "type": "line",
                 "group": "Date",
                 "series": [
                     "Exchange Rate"
                 ]
             }
         }
     ],
     version="0.2.0",
     readme=readme()
 ),
 add_metadata(
     name="household-income-us-historical",
     title=
     "Income Limits for Each Fifth and Top 5 Percent of All Households:  1967 to 2016",
     description=
     "Households as of March of the following year. Income in current and 2016 CPI-U-RS adjusted dollars.",
     sources=[{
         "path": "https://www2.census.gov",
         "title": "United States Census Bureau"
     }],
     licenses=[{
         "id":
         "odc-pddl",
         "path":
         "http://opendatacommons.org/licenses/pddl/",
         "title":
         "Open Data Commons Public Domain Dedication and License v1.0",
         'name':
         "open_data_commons_public_domain_dedication_and_license_v1.0"
     }],
     version="0.3.0",
     views=[{
         "name":
         "comparison-of-upper-limit-of-each-fifth-and-lower-limit-of-top-5-percent",
         "title":
         "Comparison of upper limit of each fifth and lower limit of top 5 percent (2016 dollars)",
         "resources": ["household-income-us-historical"],
         "specType": "simple",
         "spec": {
             "type": "line",
             "group": "Year",
             "series":
             ["Lowest", "Second", "Third", "Fourth", "Top 5 percent"]
         }
     }, {
         "name":
         "lowest-fifth-vs-top-5-percent",
         "title":
         "Ratio of lower limit of top 5 percent to upper limit of lowest fifth (2016 dollars)",
         "resources": [{
             "name":
             "household-income-us-historical",
             "transform": [{
                 "type":
                 "formula",
                 "expressions": ["data['Top 5 percent']/data['Lowest']"],
                 "asFields": ["Ratio"]
             }]
         }],
         "specType":
         "simple",
         "spec": {
             "type": "line",
             "group": "Year",
             "series": ["Ratio"]
         }
     }],
     readme=readme()),
Пример #25
0
 add_metadata(
     name="oil-prices",
     title="Brent and WTI Spot Prices",
     descriptor=
     "A variety of temporal granularities for Europe Brent and WTI (West Texas Intermediate) Spot Prices.",
     sources=[{
         "name": "Daily Europe Brent Spot Price",
         "path": "https://www.eia.gov/dnav/pet/hist_xls/RBRTEd.xls",
         "title": "Daily Europe Brent Spot Price"
     }, {
         "name": "Weekly Europe Brent Spot Price",
         "path": "https://www.eia.gov/dnav/pet/hist_xls/RBRTEw.xls",
         "title": "Weekly Europe Brent Spot Price"
     }, {
         "name": "Monthly Europe Brent Spot Price",
         "path": "https://www.eia.gov/dnav/pet/hist_xls/RBRTEm.xls",
         "title": "Monthly Europe Brent Spot Price"
     }, {
         "name": "Annual Europe Brent Spot Price",
         "path": "https://www.eia.gov/dnav/pet/hist_xls/RBRTEa.xls",
         "title": "Annual Europe Brent Spot Price"
     }, {
         "name": "Daily Cushing, OK WTI Spot Price",
         "path": "http://www.eia.gov/dnav/pet/hist_xls/RWTCd.xls",
         "title": "Daily Cushing, OK WTI Spot Price"
     }, {
         "name": "Weekly Cushing, OK WTI Spot Price",
         "path": "http://www.eia.gov/dnav/pet/hist_xls/RWTCw.xls",
         "title": "Weekly Cushing, OK WTI Spot Price"
     }, {
         "name": "Monthly Cushing, OK WTI Spot Price",
         "path": "http://www.eia.gov/dnav/pet/hist_xls/RWTCm.xls",
         "title": "Monthly Cushing, OK WTI Spot Price"
     }, {
         "name": "Annual Cushing, OK WTI Spot Price",
         "path": "http://www.eia.gov/dnav/pet/hist_xls/RWTCa.xls",
         "title": "Annual Cushing, OK WTI Spot Price"
     }],
     licenses=[{
         "name":
         "ODC-PDDL-1.0",
         "path":
         "http://opendatacommons.org/licenses/pddl/",
         "title":
         "Open Data Commons Public Domain Dedication and License v1.0"
     }],
     keywords=["Oil", "Brent", "WTI", "Oil Prices", "eia", "oil eia"],
     views=[{
         "name": "graph",
         "title": "Europe Brent Spot Price FOB (Dollars per Barrel)",
         "resourceName": "brent-day",
         "specType": "simple",
         "spec": {
             "type": "line",
             "group": "Date",
             "series": ["Brent Spot Price"]
         }
     }]),
Пример #26
0
bond_uk = Flow(
    add_metadata(
        name="bond-yields-uk-10y",
        title= "10y UK Government Bond Yields (long-term interest rate)",
        sources=[
            {
              "name": "Bank of England",
              "path": "http://www.bankofengland.co.uk/boeapps/iadb/index.asp?Travel=NIxIRx&levels=1&XNotes=Y&C=DUS&G0Xtop.x=51&G0Xtop.y=7&XNotes2=Y&Nodes=X41514X41515X41516X41517X55047X76909X4051X4052X4128X33880X4053X4058&SectionRequired=I&HideNums=-1&ExtraInfo=true#BM",
              "title": "Bank of England"
            }
        ],
        licenses=[
            {
              "id": "odc-pddl",
              "path": "http://opendatacommons.org/licenses/pddl/",
              "name": "public_domain_dedication_and_license"
            }
        ],
        views=[
            {
              "name": "graph",
              "title": "Average yield from British Government Securities, 10 year Nominal Par Yield",
              "specType": "simple",
              "spec": {"type": "line","group": "Date","series": ["Rate"]}
            }
        ],
        readme=readme()
    ),
    load(
        load_source='http://www.bankofengland.co.uk/boeapps/iadb/fromshowcolumns.asp?csv.x=yes&SeriesCodes=IUQAMNPY&UsingCodes=Y&CSVF=TN&Datefrom=01/Jan/1963',