> For the complete documentation index, see [llms.txt](https://philipp-sommerhalter.gitbook.io/eesr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://philipp-sommerhalter.gitbook.io/eesr/guide/api.md).

# API

### Interface

The *interface* module provides all the basic functionality of EESR.

#### read\_data()

Read the .json file containing the metrics and metadata.

```python
def read_data(data_path)
```

| Parameter                | Description                        |
| ------------------------ | ---------------------------------- |
| **data\_path**: *String* | Path to JSON file containing data. |

#### generate\_standard\_profile()

{% code overflow="wrap" %}

```python
def generate_standard_profile(data_path, profile_name, path="compact_report.html", generate_domain=False)
```

{% endcode %}

| Parameter                   | Description                                                  |
| --------------------------- | ------------------------------------------------------------ |
| **data\_path**: *String*    | Path to JSON file containing data.                           |
| **profile\_name:** *String* | Choice between "std\_prof", "sus\_prof", and "ee\_prof".     |
| **graph\_data**             | Data for graph generation.                                   |
| **path:** *String*          | Output path.                                                 |
| **generate\_domain:** bool  | Whether to include additional data from input file in report |

#### generate\_compact\_profile()

Same as above, except no **graph\_data.**

#### **to\_pdf() & to\_image()**

Export a HTML report as pdf or image.

```python
def to_image(report, out=None)

def to_pdf(report, out=None)
```

| Parameter            | Description                                                                        |
| -------------------- | ---------------------------------------------------------------------------------- |
| **report**: *String* | Path to HTML report.                                                               |
| **out:** *String*    | Output path. If left as default, output file will use path and name of input file. |

#### **opendc\_grid\_analysis()**

Perform grid analysis for an OpenDC simulation using EEWriter.

{% code overflow="wrap" %}

```python
def opendc_grid_analysis(dc_path, key_path, start, country, out, tz="Europe/Amsterdam", caching=True, green_ratio=None, PUE=1.59)
```

{% endcode %}

| Parameter                     | Description                                                                                                                                                                                                 |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **dc\_path:** *String*        | Path to input energy trace file.                                                                                                                                                                            |
| **key\_path:** *String*       | Path to .txt file containing ENTSO-E API key. Can be obtained by requesting from [ENSTO-E](https://transparency.entsoe.eu/content/static_content/download?path=/Static%20content/API-Token-Management.pdf). |
| **start:** *pandas.Timestamp* | The start time of the DC energy trace. Does not have to match the start time in the trace file.                                                                                                             |
| **country:** *String*         | Bidding zone (country) where the DC is located. Possible bidding zones can be found on the [ENTSO-E transparency website](https://transparency.entsoe.eu/dashboard/show).                                   |
| **out:** *String*             | Output path of analysis.                                                                                                                                                                                    |
| **tz:** *String*              | [TZ Database name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).                                                                                                                           |
| **caching:** *bool*           | Whether to enable caching for data fetching.                                                                                                                                                                |
| **green\_ratio:** *float*     | Percentage of green energy to assume when calculating energy by type. If left blank, naive model is used where proportionality on the grid is kept.                                                         |
| **PUE:** *float*              | The PUE value of the DC, used for preprocessing.                                                                                                                                                            |
