# Frictionless Data Compatibility

## Compatibility

<div align="left"><figure><img src="https://2828358319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKsnHi3Rf8E7kunYTJB%2Fuploads%2FcKeRqCEvKFKslQPLdJvs%2Ffrictionless-full-logo-blackfont.svg?alt=media&#x26;token=828b1f61-68b1-427a-a140-9ef5ae4e70ef" alt="" width="375"><figcaption></figcaption></figure></div>

The Open Data Blend Dataset API is compatible with version 1 of the following [Frictionless Data](https://frictionlessdata.io/) specifications:

* [Data Package](https://specs.frictionlessdata.io/data-package/)
* [Data Resource](https://specs.frictionlessdata.io/data-resource/)
* [Table Schema](https://specs.frictionlessdata.io/table-schema/)

It also incorporates the following Frictionless Data patterns:

* [Data Package Catalogues](https://specs.frictionlessdata.io/patterns/#describing-data-package-catalogs-using-the-data-package-format)
* [Compression of Resources](https://specs.frictionlessdata.io/patterns/#compression-of-resources)

This means there is a growing ecosystem of data tools that you can use to work with Open Data Blend Datasets.

The [Frictionless Libraries](https://frictionlessdata.io/universe/) simplify integrations with the Open Data Blend Dataset API from many languages, including Python and R. More specifically, you can use the Data Package libraries to programmatically access our datasets and integrate them into your solutions.

An up-to-date list of the supported libraries can be found [here](https://frictionlessdata.io/universe/), along with documentation on how to use them. Each library varies slightly in its implementation, but the general concepts for working with a Data Package are the same.

## Python Library

The following examples demonstrate how you could use the [Python library](https://pypi.org/project/frictionless/) to interact with the Open Data Blend Dataset API. This is the [most mature](https://framework.frictionlessdata.io/) Frictionless library to date, and one that we recommend. The libraries for the other languages implement a similar method to load data packages and these are explained in each library's [documentation](https://framework.frictionlessdata.io/).

### Installing the Python Library

Install the `frictionless` module.

```python
pip install frictionless
```

{% hint style="warning" %}
Ensure that `frictionless 4.0` or later is installed. Prior versions are not stable releases.
{% endhint %}

Import the `Package` submodule from the `frictionless` module.

```python
from frictionless import Package
```

### Working with Open Data Blend Catalogue Metadata

Loading the Open Data Blend Catalogue metadata.

```python
catalogue = Package('https://packages.opendatablend.io/v1/open-data-blend-catalogue/datapackage.json')
```

Loading the catalogue metadata for an Open Data Blend Dataset.

```python
dataset = catalogue.resources[0]
```

{% hint style="info" %}
The `resources` property is an array of resources. In this context, 'resources' means 'datasets'. In the above example, we are referencing a dataset by its zero-based index position.&#x20;

Note: The metadata for a dataset in the catalogue is a subset of its full metadata.
{% endhint %}

Getting the name of the dataset.

```python
dataset_name = dataset.name
```

Getting the friendly name of the dataset.

```python
dataset_name = dataset.title
```

Getting the description of the dataset.

```python
dataset_description = dataset.description
```

Getting the endpoint of the dataset.

```python
dataset_path = dataset.path
```

### Working with Open Data Blend Dataset Metadata

Loading Open Data Blend Dataset metadata.

```python
dataset = Package('https://packages.opendatablend.io/v1/open-data-blend-anonymised-mot/datapackage.json')
```

Loading the metadata of a data file.

```python
data_file = dataset.resources[0]
```

{% hint style="info" %}
The `resources` property is an array of resources. In this context, 'resources' means 'data files'. In the above example, we are referencing a data file by its zero-based index position.
{% endhint %}

Getting the name of the data file.

```python
data_file_name = data_file.name
```

Getting the friendly name of the data file.

```python
data_file_title = data_file.title
```

Getting the description of the data file.

```python
data_file_description = data_file.description
```

Getting the table schema of the data file.

```python
data_file_schema = data_file.schema
```

Getting the download location of the data file.

```python
data_file_path = data_file.path
```
