Commit 1dbbe212 authored by Douglas's avatar Douglas

Fixes typos and export inventory as csv snippet

parent 7e9f1202
......@@ -6,22 +6,22 @@
"source": [
"# Introduction\n",
"\n",
"This tutorial will guide your through predicting orders in ERP5 using an ARIMA model. The orders will be exported by ERP5 in CSV format (comma-sepparated values), and accessed and processed localy in a Jupyter Notebok.\n",
"This tutorial will guide your through predicting orders in ERP5 using an ARIMA model. The orders will be exported by ERP5 in CSV format (comma-sepparated values), and accessed and processed localy in a Jupyter Notebook.\n",
"\n",
"Please note that pandas and numpy can also be used inside ERP5 Wendelin software release, but Jupyter notebook adds more convenient. Soon ERP5 integration with Jupyter will be released and merged into Wendelin software release, which will make everything much easier."
"Please note that **Pandas** and **NumPy** can also be used inside ERP5 Wendelin software release, but Jupyter notebook adds more convenient. Soon ERP5 integration with Jupyter will be released and merged into Wendelin software release, which will make everything much easier."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# A simple sales order\n",
"# A simple sale order\n",
"\n",
"The first step in our experimentation is to create a sample data which will be used to generate the batch of data on which the statistic method will be applied. \n",
"\n",
"So first go to Product Module and create one product named 'Test Product'. Then go to the Organisation Module and create two different organisations: Test Company and Demo Clothes. Now go to Sales Order Module and fill an order as it is shown in the example below. Keep the order very simple and use the product and organisations you just created.\n",
"\n",
"Once the order has been created, you must change the workflow status to planned. \n",
"Once the order has been created, you must change the workflow status to 'planned'. \n",
"\n",
"![Sample Order](http://img.erp5.cn/osoe-simple.sales.order-screenshot?format=png)\n"
]
......@@ -32,7 +32,7 @@
"source": [
"# Create script to clone data\n",
"\n",
"Once the sample order has been created we can now create the script to duplicate it and modify the quantity according to the cosinus function we will use. \n",
"Once the sample order has been created we can now create the script to duplicate it and modify the quantity according to the cosinus function. \n",
"\n",
"The custom script must be created in the 'custom' folder within the 'portal_skins' folder. In order to do so you must go to `https://<your_instance_url/portal_skins/custom/manage`. \n",
"\n",
......@@ -64,7 +64,7 @@
"source": [
"# Check the sample data\n",
"\n",
"Now you can go to the Sales Order module and take a look at the generated sale orders. If you don't see any Sale Order there add a filter to see orders with the 'planned' status by writting in the first row of the table in the 'Status' column: '%planned%'. You should have something like the picture below.\n",
"Now you can go to the Sales Order Module and take a look at the generated sale orders. If you don't see any Sale Order there add a filter to see orders with the 'planned' status by writting in the first row of the table in the 'Status' column: '%planned%'. You should have something like the picture below.\n",
"\n",
"![Sample data](http://img.erp5.cn/osoe-watch.sample.data-screenshot?format=png)\n",
"\n",
......@@ -77,7 +77,7 @@
"source": [
"# Extract order data from database\n",
"\n",
"In order to create a time series of orders we must create the report of the past orders to be used by the method. SO we need to create a new Z SQL Method. You must go to the 'custom' folder in 'portal_skins' (`https://<your_instance_url>/portal_skins/custom/manage`), click in 'Add' and then in 'Z SQL Method'. User 'SaleOrderModule_zGetStock' as SQL Method ID.\n",
"In order to create a time series of orders we must create the report of the past orders to be used by the method. So we need to create a new Z SQL Method. You must go to the 'custom' folder in 'portal_skins' (`https://<your_instance_url>/portal_skins/custom/manage`), click in 'Add' and then in 'Z SQL Method'. Use 'SaleOrderModule_zGetStock' as SQL Method ID.\n",
"\n",
"Then you will type the following query:\n",
"\n",
......@@ -108,7 +108,8 @@
" \n",
" product = self.portal_catalog(title='Test Product', portal_type=\"Product\")[0]\n",
" nexedi = self.portal_catalog(title='Demo Clothes', portal_type='Organisation')[0]\n",
" result = self.portal_simulation.getInventoryList() \n",
" columns = ['date', 'quantity']\n",
" quantity_list = ([item['date'], item['total_quantity']] for item in self.portal_simulation.getInventoryList()) \n",
" \n",
" csv_file = StringIO.StringIO()\n",
" writer = csv.writer(csv_file, delimiter=';')\n",
......@@ -126,7 +127,7 @@
"source": [
"# Exporting the sample data as CSV (external method)\n",
"\n",
"Then you will need to create an external method to call your extension and run the export code. Navigate again to the 'custom folder' inside 'portal_skins', click 'Add' and choose 'External Method'. Now choose 'getInventoryCsv' as ID, 'InventoryCsv' as 'Module Name' and 'inventory_gsv' as 'Function Name'. Click 'Save changes'."
"Then you will need to create an external method to call your extension and run the export code. Navigate again to the 'custom folder' inside 'portal_skins', click 'Add' and choose 'External Method'. Now choose 'getInventoryCsv' as ID, 'InventoryCsv' as 'Module Name' and 'inventory_csv' as 'Function Name'. Click 'Save changes'."
]
},
{
......@@ -190,7 +191,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 24,
"metadata": {
"collapsed": false,
"scrolled": true
......@@ -199,10 +200,10 @@
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7fda251625d0>"
"<matplotlib.axes._subplots.AxesSubplot at 0x7fda2396b150>"
]
},
"execution_count": 14,
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
},
......@@ -210,7 +211,7 @@
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAEiCAYAAADgX4nDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XlAlNX+P/D352ERgQFE0cQ0lywNxShxyRLUrt+yUirF\nXMqt1TZt00yvltnNjMgKl6uWaanRIlm3W11LrbTMrUXKDJcScUPZFRGe8/uD5KeJMMDMnGdm3q+/\nYJh5nvfM0Q+Hc57nHFFKKRARkdsxdAcgIqLaYQEnInJTLOBERG6KBZyIyE2xgBMRuSkWcCIiN+Vr\nz5OKioowb948ZGZmAgDGjh2Lpk2bIjk5GdnZ2YiIiMD48eMRFBTk1LBERPT/2dUDf+ONNxATE4Pk\n5GS8+OKLaNasGdLS0hAdHY3Zs2ejQ4cOSEtLq/Y46enpdQ5MzsP2sRa2h7W5sn3Od65qC/jx48ex\nY8cO9O7dGwDg4+ODwMBAbN68GXFxcQCA+Ph4bNq0qdYhyBrYPtbC9rA2tyjghw8fRkhICObMmYMJ\nEyZg3rx5KC4uRl5eHsLCwgAAoaGhyMvLc3pYqx/b2cd35//Q7vy5MLvrj+3s47vrsf+u2gJeVlaG\nPXv2oG/fvpg5cyYCAgLOGS4REYeGcucP152zO5M7fy7M7vpjO/v47nrsv5Pq1kLJz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ZGBsrKynDppZfi7rvvRnh4OJYvX45ff/0VO3fuxOLFiyt2\njdq/fz9ef/117NmzByEhIRg8eDC6d++u8d0RlWMPnDxOaWkpZs2ahbi4OLzxxhvo1q0bNm7cCBGB\nUgq9e/fGnDlzMHfuXPj7+2PRokUAgCFDhqB9+/YYM2YMlixZgtGjR6O4uBjPPvssrrnmGixcuBDj\nxo3DwoULkZmZqfldErGAkwfauXMnysrK0K9fPxiGgW7duuHiiy8GAAQHB6NLly7w9/dHQEAAbrnl\nFvzyyy/nPdbWrVvRuHFjxMfHwzAMtGzZEl27dsV3333nqrdDdF4cQiGPk5OTU7G+/GmNGjUCAJSU\nlGDx4sX48ccfUVhYCKB8QxKlVKXj30eOHMHvv/+OUaNGVTxWVlbGzUbIEljAyeM0aNAAx44dO+ux\n7OxsNGnSBKtWrcKBAwfw3HPPITQ0FHv37sWECRPOW8AbNWqEyy67DJMnT3ZVfCK7cQiFPM4ll1wC\nHx8ffPLJJygtLcXGjRsrdngqLi6Gv78/AgMDUVhYiHffffes14aGhuLQoUMV31955ZU4cOAAvvrq\nK5SWlqK0tBQZGRnYv3+/S98TUWW4Hjh5pN27d2P+/PlnXYXStGlT9O3bF6+88gp27dqF8PBw3Hjj\njViwYAGWL18OwzCwc+dOpKSkID8/H3FxcRg5ciSysrKwZMkSZGRkQCmFli1b4o477sBFF12k+V2S\nt2MBJyJyUxxCISJyUyzgRERuigWciMhNsYATEbkpFnAiIjfFAk5E5KZYwImI3BQLOBGRm2IBJyJy\nU/8PaSACu+MwelEAAAAASUVORK5CYII=\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7fda32cf9a90>"
"<matplotlib.figure.Figure at 0x7fda2397ee10>"
]
},
"metadata": {},
......@@ -219,8 +220,8 @@
],
"source": [
"# need ssh tunnel to use this url\n",
"url = 'http://localhost:2200/erp5/portal_skins/erp5_r_order_prediction_tutorial/SaleOrderModule_getArimaPredictionList'\n",
"response = requests.get(url, auth=('zope', 'insecure'))\n",
"url = 'https://<your_instance_url>/portal_skins/custom/getInventoryCsv'\n",
"response = requests.get(url, auth=('<your_instance_user>', '<your_instance_user_password'))\n",
"csv_file = StringIO()\n",
"csv_file.write(response.text)\n",
"csv_file.seek(0)\n",
......@@ -239,14 +240,14 @@
"source": [
"# Check if series is stationary\n",
"\n",
"ARIMA models requires that the time series is stationary to give good predictions. A data series is stationary when its statiscal properties, like mean, variance, autocorrelation, and etc are all constant over time. You can check it just be looking at the plotted data, but you can also use the Augmented Dicker-Fuller test to have a more precise analysis. \n",
"ARIMA models requires that the time series is stationary to give good predictions. A data series is stationary when its statiscal properties, like mean, variance, autocorrelation, and etc are all constant over time. You can check it just be looking at the plotted data, but you can also use the **Augmented Dicker-Fuller** test to have a more precise analysis. \n",
"\n",
"Using the Augmented Dicker-Fuller test we can check if out data is stationary. For this, we need to get an **adf statistic** value __smaller__ (more negative) than the critical value at 5% for regression **c** (constant), **ct** (constant and trend), **ctt** (constant and quadratic trend)."
"Using the Augmented Dicker-Fuller you need to get an **adf statistic** value __smaller__ (more negative) than the critical value at 5% for regression **c** (constant), **ct** (constant and trend), **ctt** (constant and quadratic trend)."
]
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 25,
"metadata": {
"collapsed": false
},
......@@ -260,11 +261,7 @@
"Time series is stationary with regression constant and trend! :D\n",
"\n",
"Time series is stationary with regression constant, linear and quadratic trend! :D\n",
"\n",
"Time series is not stationary with no constant, no trend. See data below:\n",
" - adf statistics: 0.770156930328\n",
" - p-value: 0.879767773183\n",
" - critical values: {'5%': -1.9444409856898011, '1%': -2.5916151807851238, '10%': -1.6141150636269721}\n"
"\n"
]
}
],
......@@ -287,7 +284,7 @@
" print 'Time series is stationary with regression %s! :D\\n' % regressions[regression]\n",
" return True\n",
"\n",
"stationarity_tests = [check_stationarity(ts, regression) for regression in ['c', 'ct', 'ctt', 'nc']]\n",
"stationarity_tests = [check_stationarity(ts, regression) for regression in ['c', 'ct', 'ctt']]\n",
" "
]
},
......@@ -297,14 +294,15 @@
"source": [
"# Statistical analysis (auto correlation and partial auto correlation)\n",
"\n",
"Now you need to idenfity which ARIMA model order fits better your data. So you will need to plot both the auto correlation and partial correlation graphs and make an analysis on them. 'statsmodels' provide easy to use method to plat both these graphs. Use the snippet below to plot them."
"Now you need to idenfity which ARIMA model order fits better your data. So you will need to plot both the auto correlation and partial correlation graphs and make an analysis on them. 'statsmodels' provide easy to use method to plot both these graphs. Use the snippet below to do it."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
"collapsed": false,
"scrolled": false
},
"outputs": [
{
......@@ -350,7 +348,7 @@
"source": [
"# Minimum order sugestion for ARMA modelling\n",
"\n",
"'statsmodels' also have methods to give mathmetical suggestions for ARMA models order. This method can use different information criteria to make its decision. You will use the Akaike Information Criteria (aic) for this tutorial."
"'statsmodels' also has useful methods to give mathmetical suggestions for ARMA models order. This method can use different information criteria to make its decision. You will use the Akaike Information Criteria (aic) for this tutorial."
]
},
{
......@@ -491,7 +489,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# ARIMA forecast for orders\n",
"# ARIMA prediction for orders\n",
"\n",
"Finally, you can plot the prediction for your model. And inspect the prediction series values if you like."
]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment