Shimoku docs
  • 🚀QuickStart
    • Installation & Setup
    • Minimal APP example
    • Extended Example
    • Templates & tutorials
  • 🤖Artificial Intelligence
    • Classification
      • Train Classification
        • Train Classification Outputs
      • Predict Classification
        • Predict Classification Outputs
    • Generate Insights
      • Generate Insights Outputs
  • 🛠️Building Web App
    • Environment
      • Overview
      • Environment Variables
    • Management
      • Managing Universes
      • Managing Workspaces
      • Managing Boards
    • Menu
      • Changing the Menu Path
      • Updating the Menu Path
      • Deleting the Menu Path
    • Grid
      • Using the Grid
    • Theming
      • Colors Usage
    • Actions
    • Modals
    • IO
  • 💡Elements
    • Summary
    • Charts
      • Table
        • Buttons Column
        • Filters
        • Search bars
        • Colored labels
      • HTML
        • Raw HTML
        • Beautiful Titles
        • Background Indicators
        • Click to New Tab
        • Box With Button
        • Panel
      • Indicators
        • Indicator
        • Grouped Indicators
        • Vertical Indicators
        • Color by Value
        • Gauge Indicator
        • Indicators with Header
      • Scatter Charts
        • Scatter
        • Scatter with Effect
      • Line Charts
        • Line
        • Predictive Line
        • Segmented Line
        • Marked Line
        • Line With Confidence Area
        • Top Bottom Line Charts
        • Summary Line
      • Area Charts
        • Area
        • Stacked Area
        • Segmented Area
        • Top Bottom Area Charts
      • Bar Charts
        • Bar
        • Stacked Bar
        • Horizontal Bar
        • Stacked Horizontal Bar
        • Zero Centered Bar
      • Pie Charts
        • Pie
        • Doughnut
        • Rose
      • Gauge Charts
        • Shimoku Gauge
        • Speed Gauge
      • Input forms
        • Group chained Inputs
        • List input search
        • Conditional inputs
        • Audio input
        • Drag & Drop
      • Line and Bar
      • Waterfall
      • Annotated Chart
      • Heatmap
      • Radar
      • Sunburst
      • Tree
      • Treemap
      • Sankey Diagram
      • Funnel chart
      • iFrame
    • Composite Template Charts
      • Infographics text bubble
      • Chart and Modal Button
      • Chart and Indicators
    • Data Sets
      • Data Set Filters
    • Create your own charts
      • Free Echarts
      • Bento box
    • Features & Navigation
      • Tabs
      • History navigation & Breadcrumb
  • 🔍Advanced usage
    • CLI
    • Workflow Triggers
    • Code Generation
  • 🌍Cloud & Community
    • Shimoku Cloud
    • Shared links
    • Handling Workspaces & Users
      • User authentication
      • Inviting users
      • Creating users
      • Users with multi-workspace access
  • 🌐Releases
    • 2024
      • v.2.6
      • v.2.5
      • v.2.4
      • v.2.3
        • v.2.3.1
      • v.2.2
        • v.2.2.3
        • v.2.2.2
        • v.2.2.1
      • v.2.1
        • v.2.1.2
        • v.2.1.1
      • v.2.0
        • v.2.0.(1..4)
      • v.1.6
        • v.1.6.1
      • v.1.5
    • 2023
      • v.1.4
        • v.1.4.1
        • v.1.4.2
      • v.1.3
      • v.1.2
        • v.1.2.1
      • v.1.1
        • v.1.1.1
      • v.1.0
        • v.1.0.2
        • v.1.0.1
      • v.0.20
      • v.0.19
      • v.0.18
      • v.0.17
        • v.0.17.1
      • v.0.16
        • v.0.16.3
        • v.0.16.2
        • v.0.16.1
      • v.0.15
      • v.0.14
    • 2022
      • v.0.13
        • v.0.13.3
      • v.0.12
      • v.0.11
      • v.0.10
        • v.0.10.4
        • v.0.10.3
        • v.0.10.1
      • v.0.9
      • v.0.8
      • v.0.7
        • v.0.7.1
      • v.0.6
      • v.0.5
      • v.0.4
      • v.0.3
        • v0.3.2
        • v0.3.1
      • v.0.2
Powered by GitBook
On this page
  • Summary
  • Step 1 - Create an account
  • Step 2 - Start Client, Plotting and Menu Handling
  • Step 3 - Board
  • Step 4 - Productivity boost
  • Verbosity
  • Asynchronous execution
  • Overview PAW

Was this helpful?

  1. Cloud & Community

Shimoku Cloud

Persist your data with us

PreviousCode GenerationNextShared links

Last updated 1 year ago

Was this helpful?

Summary

Step 1 - Create an account

1
2

Review your inbox and confirm account

3
4

Click on "Return to Sign In section" and sign in with your credentials

Click your Profile button on the top right and go to "Settings". Inside "Information for developers" click on "Create" to generate your API Token and save this information, the "Universe ID" and the "Business ID" also known as Workspace ID.

Step 2 - Start Client, Plotting and Menu Handling

from os import getenv
from shimoku import Client

access_token = getenv('SHIMOKU_TOKEN')
universe_id: str = getenv('UNIVERSE_ID')
workspace_id: str = getenv('WORKSPACE_ID')

s = Client(
    access_token=access_token,
    universe_id=universe_id,
)
s.set_workspace(uuid=workspace_id)

s.set_board('Custom Board')

s.set_menu_path('catalog', 'bar-example')

language_expressiveness = [
    {'Language': 'C', 'Statements ratio': 1.0, 'Lines ratio': 1.0},
    {'Language': 'C++', 'Statements ratio': 2.5, 'Lines ratio': 1.0},
    {'Language': 'Fortran', 'Statements ratio': 2.0, 'Lines ratio': 0.8},
    {'Language': 'Java', 'Statements ratio': 2.5, 'Lines ratio': 1.5},
    {'Language': 'Perl', 'Statements ratio': 6.0, 'Lines ratio': 6.0},
    {'Language': 'Smalltalk', 'Statements ratio': 6.0, 'Lines ratio': 6.25},
    {'Language': 'Python', 'Statements ratio': 6.0, 'Lines ratio': 6.5},
]

s.plt.bar(
    order=0, title='Language expressiveness',
    data=language_expressiveness, x='Language',
    y=['Statements ratio', 'Lines ratio'],
)

Once you execute this piece of code you can see the following plot in your shimoku.io page:

Step 3 - Board

As it can be seen in the previous image the first element in the menu is called 'Custom Board', this element is a board. The boards are necessary for the contents of a menu path to be seen, if a menu path is not included in a board it will not appear in the page. For this reason the SDK always attaches the menu paths to a board when creating content, ideally the user should define which name to use for the board, but when it is not specified it will use the name 'Default Name'.

The method to specify the board's name that the SDK should use is:

                             s.set_board(name: str)

This will ensure that all the menu paths used after that point are included in name.

Multiple boards Issue

There is a possible issue that can arise from executing code multiple times with different board names, as it can be seen in the result two boards have been created with the same menu path attached.

In case this wasn't the expected result, it can be solved very easily using the CLI command:

> shimoku cloud delete board --force

This will ask for a specific board and delete it, but first it will delete all of it's links to it's menu paths, so it will always be able to delete an existing board without having to touch the menu paths. In this case the execution of the command would be as follows:

> shimoku cloud delete board --force
> board: Default Board
> dateTime | INFO | Starting execution: force_delete_board
> dateTime | INFO | Retrieved board Custom Board with id ...
> dateTime | INFO | Retrieved board Custom Board with id ...
> dateTime | INFO | Finished execution: force_delete_board, elapsed time: 7129.70 ms

Then there will only exist the 'Custom Board' linking to the 'catalog' menu path.

For more detailed information see Menu

Step 4 - Productivity boost

Verbosity

There is now the option to monitor the SDK flow of execution, with three levels of verbosity. This will help to know where the error occurred, so it will make bug-fixing a lot easier, It also outputs how much time the function call has taken to quickly profile code. To enable it you just have to set the parameter verbosity from the client to INFO or DEBUG.

s = Shimoku.Client(
    access_token=access_token,
    universe_id=universe_id,
    verbosity='INFO',
)

The INFO keyword will be the most useful for visualizing the execution while DEBUG is made so it outputs as much information as possible.

You can also set it to WARNING but this is the default behavior and will have no effect, it will output only warnings and errors.

The logging level of the Shimoku SDK can be configured dynamically during execution by calling the s.configure_logging function with the desired verbosity level (either 'DEBUG', 'INFO', or 'WARNING') and an optional channel to write the log output to. This allows for fine-grained control over the logging behavior and output, making it easier to debug and profile the SDK's execution.

Asynchronous execution

When the SDK is set to execute asynchronously it does not stop for each request to finish before making a new one, speeding up a lot the execution (mostly in the plotting layer). To enable it, simply set the async_execution parameter to True when creating the client object:

s = Shimoku.Client(
    access_token=access_token,
    universe_id=universe_id,
    verbosity='INFO',
    async_execution=True,
)

By default, execution is set to sequential. You can toggle between sequential and asynchronous execution using the following functions:

s.activate_async_execution()
s.activate_sequential_execution()

When asynchronous execution is enabled, tasks are added to a task pool and executed once a strictly sequential task is reached. A function has been added to allow users to trigger the execution of tasks, which is s.run().

Be sure to call s.run() at the end of your code to ensure all tasks are executed before the program terminates.

from os import getenv
from shimoku import Client

access_token = getenv('SHIMOKU_TOKEN')
universe_id: str = getenv('UNIVERSE_ID')
workspace_id: str = getenv('WORKSPACE_ID')

s = Client(
    access_token=access_token,
    universe_id=universe_id,
    verbosity='INFO',
    async_execution=True,
)
s.set_workspace(workspace_id)

s.set_board('Custom Dashboard')

s.set_menu_path('catalog', 'bar-example')

language_expressiveness = pd.read_html(
    'https://en.wikipedia.org/wiki/Comparison_of_programming_languages')[2]

s.plt.bar(
    order=0, title='Language expressiveness',
    data=language_expressiveness, x='Language',
    y=['Statements ratio[48]', 'Lines ratio[49]'],
)

s.run()

Overview PAW

With an unlimited number of users

More on creating new users on Creating users.

Go to to create an account

Go ahead and copy paste to see

🌍
🪄
shimoku.io
Language expressiveness ratio in comparison to C
Two boards with the same menu path
Sign in
Dashboard
Theme custom
Invitation users view