v.0.9

On 2022.08.17

This version has been deprecated. If used with the current API version it can produce unexpected behaviour or errors.

The package shimoku-api-python is no longer maintained

To get the new version 🎨🖌️

pip install --upgrade shimoku-api-python
pip install --upgrade shimoku-components-catalog

This version is a big leap forward adding critical new features to keep giving tools to Python developers to interact with a Data Platform ready to create Data & AI Apps

Fixes

  • Fixed responsiveness of tables

  • Responsiveness of components when the devices are turned solved

Improvements

  • Now s.plt.set_apps_orders() and s.plt.set_sub_path_orders() can get the URL to sort and order paths and subpaths.

Examples:

s.plt.set_apps_orders(apps_order={'test': 1, 'caetsu': 2})
s.plt.set_sub_path_orders(
    paths_order={
        'test/funnel-test': 1,
        'test/tree-test': 2,
    }
)

New

  • Free eCharts a cornerstone feature. The catalog of Shimoku has now all the power of personalization of eCharts! The proposed usage is:

  1. Play in the eCharts console to tune it until you got precissely what you want. Add the data you want to the eCharts console to check out that everything works as you want.

  2. Copy the eCharts console code and paste it into your Python code as a string and use the raw_options as input of s.plt.free_echarts()

# https://echarts.apache.org/examples/en/editor.html?c=line-style
raw_options: str = """
    {
  xAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'tpyth
  },
  series: [
    {
      data: [120, 200, 150, 80, 70, 110, 130],
      type: 'line',
      symbol: 'triangle',
      symbolSize: 20,
      lineStyle: {
        color: '#5470C6',
        width: 4,
        type: 'dashed'
      },
      itemStyle: {
        borderWidth: 3,
        borderColor: '#EE6666',
        color: 'yellow'
      }
    }
  ]
};
"""

s.plt.free_echarts(
    raw_options=raw_options,
    menu_path='test/raw-free-echarts',
    order=2, rows_size=2, cols_size=12,
)

4. É Voila!

Note you cannot add eCharts functions such as from https://echarts.apache.org/examples/en/editor.html?c=line-aqi you must get rid of those for it to work!

xAxis: {
  data: data.map(function (item) {
    return item[0];
  })
},

You can also build it without copy pasting the data, just passing the rest of the options from eCharts. Use options and data as input of s.plt.free_echarts()

data = [
    {'product': 'Matcha Latte', '2015': 43.3, '2016': 85.8, '2017': 93.7},
    {'product': 'Milk Tea', '2015': 83.1, '2016': 73.4, '2017': 55.1},
    {'product': 'Cheese Cocoa', '2015': 86.4, '2016': 65.2, '2017': 82.5},
    {'product': 'Walnut Brownie', '2015': 72.4, '2016': 53.9, '2017': 39.1}
]
options = {
    'legend': {},
    'tooltip': {},
    'xAxis': {'type': 'category'},
    'yAxis': {},
    'series': [{'type': 'bar'}, {'type': 'bar'}, {'type': 'bar'}]
}
s.plt.free_echarts(
    data=data,
    options=options,
    menu_path='test/free-echarts',
    order=0, rows_size=2, cols_size=12,
)
  • Input Form. A game changer! Shimoku users can now introduce further inputs besides the filters and these can be linked to different logics to produce real time outcomes. The Input form allows a rich variety of input components. You can use a rich variety of inputs and combine them passing it to s.plt.input_form()

report_dataset_properties: Dict = {
  'fields': [
    {
      'title': 'Personal information',
      'fields': [
        {
            'mapping': 'name',
            'fieldName': 'name',
            'inputType': 'text',
          },
          {
            'mapping': 'surname',
            'fieldName': 'surname',
            'inputType': 'text',
          },
        {
          'mapping': 'age',
          'fieldName': 'apythge',
          'inputType': 'number',
        },
        {
            'mapping': 'tel',
            'fieldName': 'phone',
            'inputType': 'tel',
          },
          {
            'mapping': 'gender',
            'fieldName': 'Gender',
            'inputType': 'radio',
            'options': ['Male', 'Female', 'No-binary', 'Undefined'],
          },
        {
            'mapping': 'email',
            'fieldName': 'email',
            'inputType': 'email',
          },

      ],
    },
    {
      'title': 'Other data',
      'fields': [
        {
          'mapping': 'skills',
          'fieldName': 'Skills',
          'options': ['Backend', 'Frontend', 'UX/UI', 'Api Builder', 'DevOps'],
          'inputType': 'checkbox',
        },
        {
            'mapping': 'birthDay',
            'fieldName': 'Birthday',
            'inputType': 'date',
          },
          {
            'mapping': 'onCompany',
            'fieldName': 'Time on Shimoku',
            'inputType': 'dateRange',
          },
          {
            'mapping': 'hobbies',
            'fieldName': 'Hobbies',
            'inputType': 'select',
            'options': ['Make Strong Api', 'Sailing to Canarias', 'Send Abracitos'],
          },
          {
            'mapping': 'textField2',
            'fieldName': 'Test Text',
            'inputType': 'text',
          },
      ],
    },
  ],
}
s.plt.input_form(
    menu_path='test/input-form', order=0,
    report_dataset_properties=report_dataset_properties
)

That results in

  • File IO for Feature Store. Now users can store and retrieve datasets and models in Shimoku as part of our service. Every file is assigned to a business and app.

Example #1 You can store raw binary or string objects and retrieve them (they can be ML models or any other binary object)

file_name = 'helloworld'
app_name = 'test'
object_data = b''

file_metadata: Dict = s.file.post_object(
    business_id=business_id,
    app_name=app_name,
    file_name=file_name,
    object_data=object_data
)

object: binary = s.file.get_object(
    business_id=business_id,
    app_name=app_name,
    file_name=file_name,
)

Example #2 You can also store pandas dataframes (from any size) and retrieve them easily:

file_name: str = 'df-test'
d = {'a': [1, 2, 3], 'b': [1, 4, 9]}
df_ = pd.DataFrame(d)

# Post dataframe to Shimoku
file: Dict = s.file.post_dataframe(
    business_id=business_id,
    app_name='test',
    file_name=file_name,
    df=df_,
)

# Retrieve it from Shimoku
df: pd.DataFrame = s.file.get_dataframe(
    business_id=business_id,
    app_name='test',
    file_name=file_name,
)pyt

Example #3 You can retrieve binary objects and pandas dataframe by date:

yesterday: dt.date = dt.date.today() - dt.timedelta(1)
file: Dict = s.file.get_file_by_date(
    business_id=business_id,
    date=yesterday,
    file_name='helloworld',
    app_name='test',
)

Tricks

  • Combine reports hide / unhide with Input forms this allow users to see the components they want to.

  • Use eCharts console https://echarts.apache.org/examples/en/index.html to prepare your chart and when you have what you want you can just copy paste it to the Free eCharts with raw input

Last updated