{
  "meta": {
    "version": "4.000.9103",
    "fileFormatVersion": "0.4",
    "date": "2024-12-02T22:04:17.764Z",
    "name": "rest-pandas-pyodide-covid-js-py",
    "description": "",
    "groupName": "Mixed",
    "tags": [
      {
        "text": "pyodide"
      },
      {
        "text": "Pandas"
      },
      {
        "text": "rest-api"
      },
      {
        "text": "echarts"
      },
      {
        "text": "python"
      }
    ],
    "schedulerLogOff": true
  },
  "data": {
    "datanodes": [
      {
        "name": "countriesList",
        "type": "Python_plugin",
        "settings": {
          "name": "countriesList",
          "autoStart": true,
          "explicitTrig": false,
          "content": "covid = dataNodes[\"covidDataFrame\"]\nreturn covid.index.tolist()\n",
          "dockerImage": {
            "name": "Pyodide",
            "id": "__PYODIDE__"
          }
        }
      },
      {
        "name": "covidDataFrame",
        "type": "Python_plugin",
        "settings": {
          "name": "covidDataFrame",
          "autoStart": true,
          "explicitTrig": false,
          "dockerImage": {
            "name": "Pyodide",
            "id": "__PYODIDE__"
          },
          "content": "from io import StringIO\nimport pandas as pd\n\ncovid = pd.read_csv(StringIO(dataNodes[\"covidDataJohnHopkins\"][\"content\"]))\n\ncovid = covid.drop(columns=['Lat', 'Long']).groupby('Country/Region').sum()\n\nreturn chalkit.as_python(covid)"
        }
      },
      {
        "name": "covidDataJohnHopkins",
        "type": "REST_web-service_from_datasource",
        "settings": {
          "name": "covidDataJohnHopkins",
          "url": "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv",
          "use_xproxy": true,
          "sampleTime": 0,
          "autoStart": true,
          "explicitTrig": false,
          "req_data_type": "JSON",
          "resp_data_type": "JSON",
          "method": "GET",
          "body": "",
          "headers": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ],
          "proxyHash": "eyJBZGRyZXNzIjoiaHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL0NTU0VHSVNhbmREYXRhL0NPVklELTE5L21hc3Rlci9jc3NlX2NvdmlkXzE5X2RhdGEvY3NzZV9jb3ZpZF8xOV90aW1lX3Nlcmllcy90aW1lX3Nlcmllc19jb3ZpZDE5X2NvbmZpcm1lZF9nbG9iYWwuY3N2IiwiSG9zdCI6InhkYXNoIn0=",
          "proxySig": "5TM10MtZYvnW/sf2ZrpNxn/fpTeOoUHXzV23CzlL95mni7uOrscQQSlcUagf1btXos2wf1ZA+eGBSZhc1/bPlk5lyaqX3oHfc4Sq0kUugOLuSZa8ZHH9jyGOBNVXZpzZLBXBrEJXDUTQjJP4Ff5kbg3nxePCRPPNVb6JmHC0QC+UgImzwqbGWkZOxL545KsxsXmCKlOkGYDu2jd6zmLHnShUZI8ODQReB+wKMAnJVWc65KlTBF/sQDDGihpnyjzd"
        }
      },
      {
        "name": "covidFiltered",
        "type": "Python_plugin",
        "settings": {
          "name": "covidFiltered",
          "autoStart": true,
          "explicitTrig": false,
          "content": "covid = dataNodes[\"covidDataFrame\"]\n\nsel = covid.loc[dataNodes[\"selectedCountry\"]]\n\nreturn sel.to_dict('split')\n",
          "dockerImage": {
            "name": "Pyodide",
            "id": "__PYODIDE__"
          }
        }
      },
      {
        "name": "option",
        "type": "JSON_formula_plugin",
        "settings": {
          "name": "option",
          "autoStart": true,
          "explicitTrig": false,
          "json_var_formula": "var series = [];\n\nvar yAxisName = '';\n\n\nvar countries = [];\n\nfor (let k=0; k < dataNodes[\"selectedCountry\"].length; k++) {\n    selectedCountry = dataNodes[\"selectedCountry\"][k];\n\tseries.push(        {\n            name: 'Death ' + ' for ' + selectedCountry, \n            type: 'line',\n            animation: false,\n            areaStyle: {},\n            lineStyle: {\n                width: 1\n            },\n            markArea: {\n                silent: true\n            },\n            data:  dataNodes[\"covidFiltered\"][\"data\"][k] \n        });\n    \n    countries.push(selectedCountry);\n}\n\nvar option = {\n    title: {\n        text: 'Covid data for ' + countries,\n        subtext: 'CSSE at Johns Hopkins University',\n        left: 'center',\n        align: 'right'\n    },\n    grid: {\n        bottom: 80\n    },\n    toolbox: {\n        feature: {\n            dataZoom: {\n                yAxisIndex: 'none'\n            },\n            restore: {},\n            saveAsImage: {}\n        }\n    },\n    tooltip: {\n        trigger: 'axis',\n        axisPointer: {\n            type: 'cross',\n            animation: false,\n            label: {\n                backgroundColor: '#505765'\n            }\n        }\n    },\n    dataZoom: [\n        {\n            show: true,\n            realtime: true,\n            start: 80,\n            end: 100\n        },\n        {\n            type: 'inside',\n            realtime: true,\n            start: 80,\n            end: 100\n        }\n    ],\n    xAxis: [\n        {\n            type: 'category',\n            boundaryGap: false,\n            axisLine: {onZero: false},\n            data:  dataNodes[\"covidFiltered\"][\"columns\"] \n        }\n    ],\n    yAxis: [\n        {\n            name: yAxisName,\n            type: 'value',\n        }\n    ],\n    series: series\n};\n\nreturn option;\n"
        }
      },
      {
        "name": "selectedCountry",
        "type": "JSON_var_plugin",
        "settings": {
          "name": "selectedCountry",
          "json_var": "[\"France\",\"Germany\",\"United Kingdom\"]"
        }
      }
    ]
  },
  "libraries": {
    "pyodideStandard": [
      "numpy",
      "pandas"
    ],
    "pyodideMicropip": []
  },
  "dashboard": {
    "flatUiListC": {
      "layout": {
        "top": 0,
        "left": 5,
        "height": 577,
        "width": 311,
        "z-index": "1"
      },
      "container": {
        "instanceId": "flatUiListC",
        "modelJsonId": "flatUiList"
      },
      "modelParameters": {
        "addControls": false,
        "listValueFontSize": 0.5,
        "listValueColor": "#34495e",
        "listBackgroundColor": "#ffffff",
        "selectValueColor": "#34495e",
        "selectValueBackgroundColor": "#cecece",
        "valueFontFamily": "Helvetica Neue",
        "borderColor": "#447bdc",
        "displayBorder": true,
        "maxSelected": "*",
        "showWidget": true,
        "enableWidget": true,
        "borderWidth": "2px"
      },
      "modelHiddenParams": {
        "value": [],
        "selectedValue": ""
      }
    },
    "echartsGenericK": {
      "layout": {
        "top": 0,
        "left": 338,
        "height": 577,
        "width": 901,
        "z-index": "2"
      },
      "container": {
        "instanceId": "echartsGenericK",
        "modelJsonId": "echartsGeneric"
      },
      "modelParameters": {
        "showWidget": true,
        "enableWidget": true
      },
      "modelHiddenParams": {
        "option": {
          "color": [
            "var(--widget-color-2)",
            "var(--widget-color-5)",
            "var(--widget-color-6)",
            "var(--widget-color-7)",
            "var(--widget-color-8)",
            "var(--widget-color-9)",
            "var(--widget-color-10)",
            "var(--widget-color-11)",
            "var(--widget-color-12)",
            "var(--widget-color-13)"
          ]
        },
        "selection": {}
      }
    }
  },
  "connections": {
    "flatUiListC": {
      "value": {
        "name": "value",
        "dataFields": [],
        "dataNode": "countriesList",
        "dataNodeIndex": 0
      },
      "selectedValue": {
        "name": "selectedValue",
        "dataFields": [],
        "dataNode": "selectedCountry",
        "dataNodeIndex": 5
      }
    },
    "echartsGenericK": {
      "option": {
        "name": "option",
        "dataFields": [],
        "dataNode": "option",
        "dataNodeIndex": 4
      },
      "selection": {
        "name": "selection",
        "dataFields": [],
        "dataNode": "None",
        "dataNodeIndex": -1
      }
    }
  },
  "display": {
    "theme": "default",
    "backgroundColor": "var(--widget-color-0)",
    "inheritThemeBackgroundColor": true,
    "marginX": 10,
    "marginY": 10,
    "width": 1256,
    "height": 577,
    "enforceHeightLimit": false
  },
  "navBarNotification": false
}