# Subgrounds Workshop

#### See a top to bottom exploration of Subgrounds in our 3 part workshop in collaboration with MetricsDAO. In this workshop we show you how to use a Python library to query and build on The Graph.

* [**Part 1**](#part1)
* [**Part 2**](#part-2)
* [**Part 3**](#part-3)

## **Part 1:**

**This session is focused on Subgrounds' core features and serve as a guide on how to start and complete data analytics using Subgrounds.**

Participants can expect the following topics to be covered:

* **Intro:** Motivations for Subgrounds and some GraphQL basics
* **FieldPaths:** What are they and how do we combine them to create subgrounds requests?
* **`subgrounds.query` method:** the simplest way to get data
* **`subgrounds.query_df` method:** get data in a flattened representation, returned in a pandas DataFrame
* **`subgrounds.query_timeseries` method:** query and return regularized timeseries data
  * **Note:** this is planned for the `v0.1.0` release and is not yet publicly available.
* Creating and using `SyntheticFields`&#x20;
* Querying non-Subgraph APIs with Subgrounds

{% embed url="<https://www.youtube.com/watch?t=1s&v=osQft2dRm6A>" %}

#### Part 1 Resources:

{% tabs %}
{% tab title="Workshop Slides" %}
{% file src="/files/qX6jSwIKrdFZP1vjUEdS" %}
{% endtab %}

{% tab title="Workshop.ipynb" %}
{% file src="/files/BSvlzL3FUSP0wMfICtzh" %}
{% endtab %}
{% endtabs %}

## Part 2

**This session introduces building full featured analytics dashboards using Subgrounds built-in data visualization library called Dash. During this part, we will take a "live build" approach and create a simple klimaDAO analytics dashboard in this session. The dashboard will explore KlimaDAOs treasury and general protocol metrics.**

**Topics:**

* Introduction to dash and data visualizations with dash
* **The Code:** Preparing Subgrounds for your data exploration
* **The Data:** Interfacing Subgrounds with Dash
* **App Layout section:** Building and assembling your dashboard components and layout
* **Callback:** Connecting visualizations to Subgrounds queries
* Running your app locally
* Deploying your app to Heroku intro

{% embed url="<https://www.youtube.com/watch?v=zU2JGADVl_s>" %}

**Resources:**

{% tabs %}
{% tab title="Workshop Slides" %}
{% file src="/files/ioT56e49ivWSVXCtuKd1" %}
{% endtab %}

{% tab title="Github" %}
{% embed url="<https://github.com/Tachikoma000/Subgrounds_visualization_with_dash>" %}
Repo for Subgrounds visualizations with Dash
{% endembed %}
{% endtab %}

{% tab title="Dash Documentation" %}
{% embed url="<https://dash.plotly.com/introduction>" %}
{% endtab %}

{% tab title="Dash Components" %}
{% embed url="<https://dash-bootstrap-components.opensource.faculty.ai/docs/quickstart/>" %}
Quickstart for Dash Bootstrap components
{% endembed %}
{% endtab %}
{% endtabs %}

## Part 3

**The final session is a continuation of part two, except that rather than deploying locally to your machine, we will guide you on deploying to the cloud (Heroku), generating your unique URL, and sharing your dashboard as an app.**

Topics

* Introduction to Heroku&#x20;
* Setting up Heroku account&#x20;
* Installing Heroku CLI&#x20;
* Creating App project folder on your IDE&#x20;
* Installing necessary App project libraries&#x20;
* Create necessary files for Heroku server&#x20;
* Deploy App to Heroku

{% embed url="<https://www.youtube.com/watch?v=ye9JrDubRtI>" %}

**Resources:**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://playgrounds-analytics.gitbook.io/playgrounds-docs/subgrounds/tutorials/subgrounds-workshop.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
