Shimoku docs
Search…
Working with components
A suite has a set of paths (URL or web pages), each path having none to many reports (in REACT jargon called components). Managing reports with Shimoku’s SDK goes as follows:
The shimoku.report object has the following methods:
  • create_report(business_id: str, app_id: str, report_id: str) to create a new report in a suite
  • update_report(report_id str, report_data: Dict) to update the data of a report
  • update_report_chart_type(report_id: str, report_type: str, chart_metadata: Dict) to change the type of chart (from barchart to linechart, for instance)
  • update_report_external_id(report_id: str, nex_external_id: str) external_id is used to match a report_id from Shimoku with an ETL id of your ETLs
  • delete_report(report_id: str) to delete permanently a report and all its data
  • get_report(report_id: str) to retrieve report data
  • get_report_data(report_id: str) to retrieve all report data as an Iterable
  • get_reports_in_same_app(report_id: str) to retrieve all report_id that belong to the same Suite that the target report.
  • get_reports_in_same_path(report_id: str) to retrieve all report_id that belong to the same Path that the target report.
  • get_app_id_by_report(report_id: str) to retrieve the Suite a report belongs to
  • get_path_id_by_report(report_id: str) to retrieve the Path a report belongs to

1. get report

report_data: Dict[str, Any] = shimoku.report.get_report(report_id)
That returns a dictionary such as:
report_data = {
'id': 'f74gh9', # report uuid
'owner': '38c7f', # user uuid
'appId': 'f74gh9', # suite uuid
'external_id': '1234', # your ETL id to match it to report['id']
'external_version': '1.dev1', # your ETL version (git tag for instance)
'path': 'Predictions', # page name
'order': '', # ???
'grid': '1, 1', # where the report is in the grid
'dataFields': , # Only if it is a Table
'smartFilter': , # Only if it is a Table
'description': 'This is a description',
'createdAt': '2021-01-01',
'updatedAt '2021-09-24',
}

2. get_report_data

Retrieves the data that belong to a report, for instance, you can do
data: List[Dict] = shimoku.report.get_report_data(report_id)
That returns a list:
data = [
{
'title': 'Customers in HICH churn risk',
'description': 'Number of customers in HIGH churn risk',
'value': '2',
'color': 'caution',
},
{
'title': 'HIGH churn revenue risk (€)',
'description': 'Revenue in HIGH churn risk',
'value': '68.05€',
'color': 'cation',
},
{
'title': 'Customers in moderate churn risk',
'description': 'Number of customers moderate churn risk',
'value': '3',
'color': 'warning',
},
{
'title': 'Moderate churn revenue risk (€)',
'description': 'Revenue in moderate churn risk',
'value': '107.06€',
'color': 'warning',
},
]
See it here:
Copy link
On this page
1. get report
2. get_report_data