kolada

0.2.0 • Public • Published

Kolada API client

Kolada API client provides access to standardized key performance indicators (KPI) concerning Swedish municipalities and organizational units.

🔗 For a detailed API description, please see github.com/Hypergene/kolada.

Getting started

npm install --save kolada

There are two main parts to the API metadata and actual data (see full API documentation).

Initialize

const Kolada = require('kolada');
const kolada = new Kolada();

All methods uses fetch under the hood

kolada.meta.kpi()
  .then(res => res.json())
  .then(json => console.log(json))

If passed "impossible" arguments an exception will be raised (with detailed error messages)

kolada.data.municipalities({ municipality: '1860' })
// Error: when passing municipality or ou you need to pass kpi or year too.

ℹ️ The arguments: municipality, ou, kpi and year can either be strings or an array of strings.

Meta data

KPI(s)

kolada.meta.kpi() // all
kolada.meta.kpi({ id: ['N00945'] })
 
kolada.meta.kpiGroups() // all
// title search string (automatically uri-encoded)
kolada.meta.kpiGroups({ title: 'kostnad' })

Municipalities

kolada.meta.municipalities()
kolada.meta.municipalities({ id: ['1860'] })
kolada.meta.municipalityGroups()

Organizational Unit (OU)

kolada.meta.ou({ municipality: ['1860'] })

Data

Municipalities

kolada.data.municipalities({ kpi: 'N00945', year: 2008 })
kolada.data.municipalities({ municipality: '1860', year: [2008, 2009] })
kolada.data.municipalities({ municipality: '1860', year: 2009, fromDate: '2015-02-28' })

Organizational Unit (OU)

kolada.data.ou({ kpi: ['N15033'], year: [2007, 2008] });
kolada.data.ou({ ou: 'V15E144001301', kpi: 'N00945', year: 2009 });

See more examples in kitchen-sink.js.

🔗 For detailed API documentation, see github.com/Hypergene/kolada.

Development

git clone https://github.com/buren/kolada
cd kolada

Install dependencies

npm install

Run kitchen sink (a.k.a the quasi test suite)

npm run kitchen-sink

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/buren/kolada.

License

The gem is available as open source under the terms of the MIT License.

Package Sidebar

Install

npm i kolada

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

11.9 kB

Total Files

11

Last publish

Collaborators

  • buren