Skip to content

Commit

Permalink
Merge pull request #574 from hkad98/PSDK-172
Browse files Browse the repository at this point in the history
Rename 'insight' to 'visualization'

Reviewed-by: Jan Kadlec
             https://github.com/hkad98
  • Loading branch information
gdgate authored Mar 4, 2024
2 parents 4fa7ab6 + 22b2297 commit 29b6cb6
Show file tree
Hide file tree
Showing 70 changed files with 593 additions and 334 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ remove-cassettes:

.PHONY: new-docs
new-docs:
git submodule update --init --recursive --depth 1; \
cd docs; \
npm install; \
hugo server
6 changes: 6 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ services:
HEADER_HOST: localhost
command: ["python3", "upload_demo_layout.py"]

docs:
build:
context: .
dockerfile: docs/Dockerfile
ports:
- "1313:1313"

volumes:
gooddata-cn-ce-data:
14 changes: 14 additions & 0 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:20.11.1-bookworm-slim

RUN npm install -g [email protected]

COPY docs docs

RUN apt-get update && \
apt-get install -y git make golang-go curl

WORKDIR docs
RUN npm install

# accessible on http://localhost:1313/docs/
ENTRYPOINT ["hugo", "server", "--bind", "0.0.0.0"]
15 changes: 9 additions & 6 deletions docs/content/en/docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,28 @@ Integrate GoodData analytics into your continuous delivery practices by, for exa

```python
# Reads visualizations from workspace
insights = sdk.insights.get_insights("123")
visualizations = sdk.visualizations.get_visualizations("123")

# Iterate through visualizations and check if they are valid
for insight in insights:
for visualization in visualizations:
try:
sdk.tables.for_insight("123", insight)
sdk.visualizations.for_visualization("123", visualization)
except Exception:
print(f"Visualization {insight.title} is broken.")
print(f"Visualization {visualization.title} is broken.")

```

#### Create data pipelines

Export your data, levarage services like machine learning to transform your data and import the data back into GoodData to visualize the results and gain insights. In the Example below, we demonstrate GoodPandas, which can leverage machine learning practices.
Export your data,
levarage services like machine learning to transform your data
and import the data back into GoodData to visualize the results and gain visualizations.
In the Example below, we demonstrate GoodPandas, which can leverage machine learning practices.
```python
pandas = GoodPandas(os.getenv('HOST'), os.getenv('TOKEN'))
df = pandas.data_frames(workspace_id="123")

campaign_spend = df.for_insight("campaign_spend")
campaign_spend = df.for_visualization("campaign_spend")

# Now you have a dataframe with data from your visualization
# You can do linear regression, clustering, predictions, analysis, etc.
Expand Down
8 changes: 4 additions & 4 deletions docs/content/en/docs/execution/exports/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Create dashboard exports or automate your pipelines. Can be for [example](#examp

* [export_pdf](./export_pdf/)
* [export_tabular](./export_tabular/)
* [export_tabular_by_insight_id](./export_tabular_by_insight_id/)
* [export_tabular_by_visualization_id](./export_tabular_by_visualization_id/)


## Example
Expand Down Expand Up @@ -58,10 +58,10 @@ def send_mail(send_from, send_to, subject, text, files, server):


def export_tabular():
# Export a particular insight in the desired format (CSV / XLSX)
sdk.export.export_tabular_by_insight_id(
# Export a particular visualization in the desired format (CSV / XLSX)
sdk.export.export_tabular_by_visualization_id(
workspace_id = "demo",
insight_id = "revenue",
visualization_id = "revenue",
file_format = "CSV",
file_name = "revenue_export.csv"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
title: "export_tabular_by_insight_id"
linkTitle: "export_tabular_by_insight_id"
title: "export_tabular_by_visualization_id"
linkTitle: "export_tabular_by_visualization_id"
weight: 110
superheading: "export."
---

``export_tabular_by_insight_id(
``export_tabular_by_visualization_id(
workspace_id: str,
insight_id: str,
visualization_id: str,
file_format: str,
file_name: Optional[str] = None,
settings: Optional[ExportSettings] = None,
Expand All @@ -17,16 +17,16 @@ superheading: "export."
max_retry: float = 5.0,
)``

Exports the tabular data for an Insight by its ID.
Exports the tabular data for an visualization by its ID.



{{% parameters-block title="Parameters" %}}
{{< parameter p_name="workspace_id" p_type="string" >}}
The ID of the GoodData Workspace.
{{< /parameter >}}
{{< parameter p_name="insight_id" p_type="string" >}}
The ID of the GoodData Insight.
{{< parameter p_name="visualization_id" p_type="string" >}}
The ID of the GoodData visualization.
{{< /parameter >}}
{{< parameter p_name="file_format" p_type="string" >}}
The format of the file to be exported.
Expand Down Expand Up @@ -63,7 +63,7 @@ host = "https://www.example.com"
token = "<your_personal_access_token>"
sdk = GoodDataSdk.create(host, token)

sdk.export.export_tabular_by_insight_id(
workspace_id="demo", insight_id="campaign_spend", file_format="CSV")
sdk.export.export_tabular_by_visualization_id(
workspace_id="demo", visualization_id="campaign_spend", file_format="CSV")

```
4 changes: 2 additions & 2 deletions docs/content/en/docs/pandas-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ non_indexed_df = frames.not_indexed(
)
)

# create data frame based on the contents of the insight. if the insight contains labels and
# create data frame based on the contents of the visualization. if the visualization contains labels and
# measures, the data frame will contain index or hierarchical index.
insight_df = frames.for_insight('insight_id')
df = frames.for_visualization('visualization_id')

# create data frame based on the content of the items dict. if the dict contains both labels
# and measures, the frame will contain index or hierarchical index.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Within a multitenant workspace hierarchy, the analytical model of a parent works
### Entity methods

* [get_full_catalog](./get_full_catalog/)
* [get_insights](./get_insights/)
* [get_visualizations](./get_visualizations/)
* [get_metrics_catalog](./get_metrics_catalog/)
* [get_facts_catalog](./get_facts_catalog/)
* [get_attributes_catalog](./get_attributes_catalog/)
Expand All @@ -32,7 +32,7 @@ Within a multitenant workspace hierarchy, the analytical model of a parent works

### Table methods

* [for_insight](./for_insight/)
* [for_visualization](./for_visualization/)
* [for_items](./for_items/)

## Example
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
---
title: "for_insight"
linkTitle: "for_insight"
title: "for_visualization"
linkTitle: "for_visualization"
weight: 10
superheading: "tables."
---



``for_insight(workspace_id: str, insight: Insight)``
``for_visualization(workspace_id: str, visualization: Visualization)``

Gets data as an ExecutionTable from the given visualization.
Get data as an ExecutionTable from the given visualization.

{{% parameters-block title="Parameters" %}}
{{% parameters-block title="Parameters" %}}
{{< parameter p_name="workspace_id" p_type="string" >}}
Workspace identification string e.g. "demo"
{{< /parameter >}}
{{< parameter p_name="insight" p_type="Insight" >}}
Insight object, representing a visualization.
{{< parameter p_name="visualization" p_type="Visualization" >}}
Visualization object, representing a visualization.
{{< /parameter >}}
{{% /parameters-block %}}

Expand All @@ -30,9 +30,9 @@ Visualization data wrapper object.

```python
# Get visualization
campaign_spend_insight = sdk.insights.get_insight(workspace_id="123", insight_id="campaign_spend")
campaign_spend = sdk.visualizations.get_visualization(workspace_id="123", visualization_id="campaign_spend")
# Get the visualization as Execution Table
sdk.tables.for_insight(workspace_id="123", insight=campaign_spend_insight)
sdk.tables.for_visualization(workspace_id="123", visualization=campaign_spend)

# ExecutionTable(
# response=Execution(
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: "get_visualization"
linkTitle: "get_visualization"
weight: 15
superheading: "visualizations."
---



``get_visualization(workspace_id: str, visualization_id: str)``

Get a single visualization from a workspace.


{{% parameters-block title="Parameters" %}}
{{< parameter p_name="workspace_id" p_type="string" >}}
Workspace identification string e.g. "demo"
{{< /parameter >}}
{{< parameter p_name="visualization_id" p_type="string" >}}
Visualization identifier string e.g. "bikes"
{{< /parameter >}}
{{% /parameters-block %}}

{{% parameters-block title="Returns"%}}
{{< parameter p_type="Visualization" >}}
A single Visualization object contains side loaded metadata about the entities it references
{{< /parameter >}}
{{% /parameters-block %}}

## Example

```python
# Get all visualizations
visualizations = sdk.visualizations.get_visualizations(workspace_id="123")
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "get_visualizations"
linkTitle: "get_visualizations"
weight: 15
superheading: "visualizations."
---

``get_visualizations(workspace_id: str)``

Get a list of visualization objects.

{{% parameters-block title="Parameters" %}}
{{< parameter p_name="workspace_id" p_type="string" >}}
Workspace identification string e.g. "demo"
{{< /parameter >}}
{{% /parameters-block %}}

{{% parameters-block title="Returns"%}}
{{< parameter p_type="list[Visualization]" >}}
All available visualizations, each visualization will contain side loaded metadata about the entities it references
{{< /parameter >}}
{{% /parameters-block %}}

## Example

```python
# Get all visualizations
visualizations = sdk.visualizations.get_visualizations(workspace_id="123")
```
4 changes: 2 additions & 2 deletions gooddata-dbt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ The plugin provides the following use cases:
- Reads content of `gooddata_layout` folder and deploys analytics model to GoodData
- store_analytics
- Reads analytics model from GoodData instance and stores it to disk to `gooddata_layout` folder
- test_insights
- Lists all insights(reports) from GoodData instance, and executes each report to validate it
- test_visualizations
- Lists all visualizations execution from GoodData instance, and executes each report to validate it
- dbt_cloud
- Runs dbt cloud job through their API. Alternative to running dbt-core locally.
- If running in CI pipeline, it can also notify about performance degradations in a form of GitHub/Gitlab comment.
Expand Down
6 changes: 3 additions & 3 deletions gooddata-dbt/gooddata_dbt/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ def parse_arguments(description: str) -> argparse.Namespace:
set_gooddata_upper_case_args(store_analytics)
store_analytics.set_defaults(method="store_analytics")

test_insights = subparsers.add_parser("test_insights")
set_environment_id_arg(test_insights)
test_insights.set_defaults(method="test_insights")
test_visualizations = subparsers.add_parser("test_visualizations")
set_environment_id_arg(test_visualizations)
test_visualizations.set_defaults(method="test_visualizations")

return parser.parse_args()
Loading

0 comments on commit 29b6cb6

Please sign in to comment.