From 12b3e067209d0ca1053666e58e70c851ddcf26e0 Mon Sep 17 00:00:00 2001 From: Khor Kean Teng Date: Mon, 11 Sep 2023 11:10:03 +0800 Subject: [PATCH] version 1.0 fix --- .../__pycache__/__init__.cpython-311.pyc | Bin 180 -> 553 bytes .../automation_report.cpython-311.pyc | Bin 12643 -> 22992 bytes .../__pycache__/batch_export.cpython-311.pyc | Bin 1918 -> 1918 bytes .../data_compilation.cpython-311.pyc | Bin 13849 -> 13570 bytes .../__pycache__/inconsistency.cpython-311.pyc | Bin 8954 -> 8954 bytes .../__pycache__/system_cube.cpython-311.pyc | Bin 1731 -> 1731 bytes .../__pycache__/to_vba.cpython-311.pyc | Bin 1865 -> 1865 bytes blueautomata/automation_report.py | 553 +++++++++--------- function_draft.ipynb | 430 -------------- mkdocs.yml | 2 + pilot_test2.ipynb | 87 ++- setup.py | 4 +- 12 files changed, 351 insertions(+), 725 deletions(-) delete mode 100644 function_draft.ipynb diff --git a/blueautomata/__pycache__/__init__.cpython-311.pyc b/blueautomata/__pycache__/__init__.cpython-311.pyc index f1e90f4d58a70868c343d516a1def4ea3d07af08..03e6469348b91716a983ccdccf3247aba09115e0 100644 GIT binary patch literal 553 zcmaKoze~eF6vyA?x3(1p7ZtQ?K>Pz#go5Bu5JBq@0>>pe+CXwwl2q;H59mh#siZz{Bgi_>jUT_gkaif(_ky9E@0*k z*UEJ4lo`rQWtK8qnS*xiIy3mcWM)&!l7!MvSl|g*UWKRrAm>@`_eV18_Bj*XJ1&O) zrF;~LWKr(-1~=W_-(<`Wk_lgp$$Uy<5f_x6jHgTIJeAQT;TPE!-m88je?gn;gpdl3 p%BCvVFPp01uxzS=gR-d#_R6Lz*e#oy8+J>Z!`hy0wX!xobTo8!(q}T?i?ckmZ_k$)=%6SmPN;0vI@BLWl;j zs#0mYO1G1om6omY;8wJSwhyVSNUgN3wyLymZ83ElWEGWawW?NqVVkNCR=e%_$0R^5 zYO8i+fBw&Z{&V{;XZ-QRR)W@lFE39^k!NP%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`M-;fX>5O!u!~rR3vub(cJge&h^WdBb738 z=~Rl`VX-CWb<@x(Y2gDy9K3AL-2Et z&?%(oZ|Fa0J4Sy&orIuyYf%I9+3$Pv=FNO(uN&tF(OZ{m!oo+)`lVJCi{%Z2-(md` zAH}O^K~#mZMYi2P>V(KFAe5{kUuHGIGw2Hy|I!?fAc*iFrV)NbfI}V|W&aX_A=2&+ z)jHr~j*w1b>?q_V61xnY5;wDkUquIQwzK!}CRt$l$R3dfH<1S^>#!q)@R7{D#L>3LZqNuH1MS*Q>Cbnx$wMI@!{ zHl7HH2Qw$WfQouC#KeOKKY{Trv00B^Jl4p;aB`k4#epVbwBkZ^itgRS(Ge^H`H@7 zMwHAUU3tA+#(0l^!TBiEVlto$08N>)pCSwW7yCgc08v03a0Z|W=qK9Ve-7eG_WE7h za@cA9PAkV!B5RMhByG5amTV$SO=BT`DY1oB{x;_op|j_U0kZuwG&6m|cU=AirRY^g(^*VMwUs`rys*2gZ1h0TOE6WPO5qgyr}L zBR=D;oQL3~fGb-yYHw7Wa(np+2n+)hKzl||Q-CW1y265>7Xi2UNOn|=U(IS_{Kwf- zL@f6_mx_iVS^;=7dOL;q&)iJVlRgotkLLLpNk3%f1~nbCo;VVjNo&ny&WcrYw0zkr z-m6w@$9og?lbsaXF-xUmzZqa>iqZlF-0tHnZri602L(wbSLrp=TNAMe&cF$NMyY0nSLK%>V!Z diff --git a/blueautomata/__pycache__/inconsistency.cpython-311.pyc b/blueautomata/__pycache__/inconsistency.cpython-311.pyc index 01cf6e3de6af10d966b281cbc140acbbe4eeb5af..597d3db996b96a2aba0a8aa08ac4c1cc94db0621 100644 GIT binary patch delta 19 Zcmez6`pcDTIWI340}$l5Zshu)1OP$j1{DAR delta 19 Zcmez6`pcDTIWI340}$9-Zshu)1OPuv1(^T< diff --git a/blueautomata/__pycache__/system_cube.cpython-311.pyc b/blueautomata/__pycache__/system_cube.cpython-311.pyc index bb3a94936e433dbaf67b4679b6bb43c65e9576c3..4d535fe6e0bd8f8530124d814d13eb7a3a1218c8 100644 GIT binary patch delta 19 ZcmX@idzhDNIWI340}$l5Zsgj@1^_ZK1mpk! delta 19 ZcmX@idzhDNIWI340}yPs+sL((4FED`1mOSx diff --git a/blueautomata/__pycache__/to_vba.cpython-311.pyc b/blueautomata/__pycache__/to_vba.cpython-311.pyc index 5a422abb937635cf0fb7a3dbe7a7a22fbbaa1e25..3edb376e9671707f60761bd1b37b2ee0278be2e3 100644 GIT binary patch delta 20 acmX@fcao2LIWI340}$l5{@loI#|{8Go&|FN delta 20 acmX@fcao2LIWI340}w 3653\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_engine\u001b[39m.\u001b[39;49mget_loc(casted_key)\n\u001b[0;32m 3654\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mKeyError\u001b[39;00m \u001b[39mas\u001b[39;00m err:\n", - "File \u001b[1;32mc:\\Users\\Khor Kean Teng\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\pandas\\_libs\\index.pyx:147\u001b[0m, in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[1;34m()\u001b[0m\n", - "File \u001b[1;32mc:\\Users\\Khor Kean Teng\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\pandas\\_libs\\index.pyx:176\u001b[0m, in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[1;34m()\u001b[0m\n", - "File \u001b[1;32mpandas\\_libs\\hashtable_class_helper.pxi:7080\u001b[0m, in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[1;34m()\u001b[0m\n", - "File \u001b[1;32mpandas\\_libs\\hashtable_class_helper.pxi:7088\u001b[0m, in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[1;34m()\u001b[0m\n", - "\u001b[1;31mKeyError\u001b[0m: 'Department'", - "\nThe above exception was the direct cause of the following exception:\n", - "\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn[4], line 17\u001b[0m\n\u001b[0;32m 14\u001b[0m df \u001b[39m=\u001b[39m pd\u001b[39m.\u001b[39mread_excel(file_path)\n\u001b[0;32m 16\u001b[0m \u001b[39mfor\u001b[39;00m i \u001b[39min\u001b[39;00m \u001b[39mrange\u001b[39m(\u001b[39mlen\u001b[39m(df)):\n\u001b[1;32m---> 17\u001b[0m Department\u001b[39m.\u001b[39mappend(df[\u001b[39m'\u001b[39;49m\u001b[39mDepartment\u001b[39;49m\u001b[39m'\u001b[39;49m][i])\n\u001b[0;32m 18\u001b[0m Dept\u001b[39m.\u001b[39mappend(df[\u001b[39m'\u001b[39m\u001b[39mDept\u001b[39m\u001b[39m'\u001b[39m][i])\n\u001b[0;32m 19\u001b[0m UserID\u001b[39m.\u001b[39mappend(df[\u001b[39m'\u001b[39m\u001b[39mUser ID\u001b[39m\u001b[39m'\u001b[39m][i])\n", - "File \u001b[1;32mc:\\Users\\Khor Kean Teng\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\pandas\\core\\frame.py:3761\u001b[0m, in \u001b[0;36mDataFrame.__getitem__\u001b[1;34m(self, key)\u001b[0m\n\u001b[0;32m 3759\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mcolumns\u001b[39m.\u001b[39mnlevels \u001b[39m>\u001b[39m \u001b[39m1\u001b[39m:\n\u001b[0;32m 3760\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_getitem_multilevel(key)\n\u001b[1;32m-> 3761\u001b[0m indexer \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mcolumns\u001b[39m.\u001b[39;49mget_loc(key)\n\u001b[0;32m 3762\u001b[0m \u001b[39mif\u001b[39;00m is_integer(indexer):\n\u001b[0;32m 3763\u001b[0m indexer \u001b[39m=\u001b[39m [indexer]\n", - "File \u001b[1;32mc:\\Users\\Khor Kean Teng\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\pandas\\core\\indexes\\base.py:3655\u001b[0m, in \u001b[0;36mIndex.get_loc\u001b[1;34m(self, key)\u001b[0m\n\u001b[0;32m 3653\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_engine\u001b[39m.\u001b[39mget_loc(casted_key)\n\u001b[0;32m 3654\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mKeyError\u001b[39;00m \u001b[39mas\u001b[39;00m err:\n\u001b[1;32m-> 3655\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mKeyError\u001b[39;00m(key) \u001b[39mfrom\u001b[39;00m \u001b[39merr\u001b[39;00m\n\u001b[0;32m 3656\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mTypeError\u001b[39;00m:\n\u001b[0;32m 3657\u001b[0m \u001b[39m# If we have a listlike key, _check_indexing_error will raise\u001b[39;00m\n\u001b[0;32m 3658\u001b[0m \u001b[39m# InvalidIndexError. Otherwise we fall through and re-raise\u001b[39;00m\n\u001b[0;32m 3659\u001b[0m \u001b[39m# the TypeError.\u001b[39;00m\n\u001b[0;32m 3660\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_check_indexing_error(key)\n", - "\u001b[1;31mKeyError\u001b[0m: 'Department'" - ] - } - ], - "source": [ - "folder_path = r\"C:\\\\Users\\\\Khor Kean Teng\\\\Downloads\\\\AUP Automata\\\\Data\"\n", - " \n", - "Department = []\n", - "Dept = []\n", - "UserID = []\n", - "Fullname = []\n", - "System1 = []\n", - "Cube = []\n", - "\n", - "\n", - "for filename in os.listdir(folder_path):\n", - " if filename.endswith(\".xlsx\"):\n", - " file_path = os.path.join(folder_path, filename)\n", - " df = pd.read_excel(file_path)\n", - "\n", - " for i in range(len(df)):\n", - " Department.append(df['Department'][i])\n", - " Dept.append(df['Dept'][i])\n", - " UserID.append(df['User ID'][i])\n", - " Fullname.append(df['Fullname'][i])\n", - " System1.append(df['System1'][i])\n", - " Cube.append(df['Cube'][i])\n", - "\n", - "dataframes = pd.DataFrame({'Department': Department,\n", - " 'Dept': Dept,\n", - " 'UserID': UserID,\n", - " 'Fullname': Fullname,\n", - " 'System1': System1,\n", - " 'Cube': Cube})\n", - "\n", - "dataframes.head()" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'apple'" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "key = ['APPlE']\n", - "key[0].lower()" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
DepartmentDeptUser IDFullnameSystem1Cube
0GoogleGOOGWN1ZKDTK5EWDFDWKGEric BlakeKLSE791745.0
1GoogleGOOGWN1ZKDTK5EWDFDWKGEric BlakeNASDAQ692791.0
2GoogleGOOGWN1ZKDTK5EWDFDWKGEric BlakeNYSE568621.0
3GoogleGOOGWN1ZKDTK5EWDFDWKGEric BlakeSGX580051.0
4GoogleGOOGM7H0N6B55GG62ESX4Teresa YoungKLSE476799.0
\n", - "
" - ], - "text/plain": [ - " Department Dept User ID Fullname System1 Cube\n", - "0 Google GOOG WN1ZKDTK5EWDFDWKG Eric Blake KLSE 791745.0\n", - "1 Google GOOG WN1ZKDTK5EWDFDWKG Eric Blake NASDAQ 692791.0\n", - "2 Google GOOG WN1ZKDTK5EWDFDWKG Eric Blake NYSE 568621.0\n", - "3 Google GOOG WN1ZKDTK5EWDFDWKG Eric Blake SGX 580051.0\n", - "4 Google GOOG M7H0N6B55GG62ESX4 Teresa Young KLSE 476799.0" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "data = pd.ExcelFile('data/fakedata.xlsx')\n", - "data2 = pd.read_excel(data)\n", - "data2.head()" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['Sheet1']" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "data.sheet_names" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
keykey_name
0GOOGGoogle
1AAPLApple
2MSFTMicrosoft
3AMZNAmazon
4FBFacebook
\n", - "
" - ], - "text/plain": [ - " key key_name\n", - "0 GOOG Google\n", - "1 AAPL Apple\n", - "2 MSFT Microsoft\n", - "3 AMZN Amazon\n", - "4 FB Facebook" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "data = pd.read_excel('data/keylibrary.xlsx')\n", - "data.head()" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": {}, - "outputs": [], - "source": [ - "var = pd.DataFrame({'key': 'AAPL'}, index=[0])" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "0 Apple\n", - "Name: key_name, dtype: object" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "var['key_name'] = var['key'].map(data.set_index('key')['key_name'])\n", - "var['key_name']" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " key\n", - "0 a\n", - " key\n", - "0 b\n", - " key\n", - "0 c\n" - ] - } - ], - "source": [ - "test = ['a', 'b', 'c']\n", - "for i in range(len(test)):\n", - " var = pd.DataFrame({'key': test[i]}, index=[0])\n", - " print(var)" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Hello my name is John\n" - ] - } - ], - "source": [ - "class Person:\n", - " def __init__(self, name, age):\n", - " self.name = name\n", - " self.age = age\n", - "\n", - " def myfunc(self):\n", - " print(\"Hello my name is \" + self.name)\n", - "\n", - "p1 = Person(\"John\", 36)\n", - "p1.myfunc()" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "ename": "OSError", - "evalue": "[Errno 22] Invalid argument: 'data/*hr*.xlsx'", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mOSError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn[1], line 3\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mpandas\u001b[39;00m \u001b[39mas\u001b[39;00m \u001b[39mpd\u001b[39;00m\n\u001b[0;32m 2\u001b[0m file \u001b[39m=\u001b[39m \u001b[39m'\u001b[39m\u001b[39mdata/*hr*.xlsx\u001b[39m\u001b[39m'\u001b[39m\n\u001b[1;32m----> 3\u001b[0m df \u001b[39m=\u001b[39m pd\u001b[39m.\u001b[39;49mread_excel(file)\n", - "File \u001b[1;32mc:\\Users\\Khor Kean Teng\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\pandas\\io\\excel\\_base.py:478\u001b[0m, in \u001b[0;36mread_excel\u001b[1;34m(io, sheet_name, header, names, index_col, usecols, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, parse_dates, date_parser, date_format, thousands, decimal, comment, skipfooter, storage_options, dtype_backend)\u001b[0m\n\u001b[0;32m 476\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39misinstance\u001b[39m(io, ExcelFile):\n\u001b[0;32m 477\u001b[0m should_close \u001b[39m=\u001b[39m \u001b[39mTrue\u001b[39;00m\n\u001b[1;32m--> 478\u001b[0m io \u001b[39m=\u001b[39m ExcelFile(io, storage_options\u001b[39m=\u001b[39;49mstorage_options, engine\u001b[39m=\u001b[39;49mengine)\n\u001b[0;32m 479\u001b[0m \u001b[39melif\u001b[39;00m engine \u001b[39mand\u001b[39;00m engine \u001b[39m!=\u001b[39m io\u001b[39m.\u001b[39mengine:\n\u001b[0;32m 480\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\n\u001b[0;32m 481\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mEngine should not be specified when passing \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 482\u001b[0m \u001b[39m\"\u001b[39m\u001b[39man ExcelFile - ExcelFile already has the engine set\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 483\u001b[0m )\n", - "File \u001b[1;32mc:\\Users\\Khor Kean Teng\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\pandas\\io\\excel\\_base.py:1496\u001b[0m, in \u001b[0;36mExcelFile.__init__\u001b[1;34m(self, path_or_buffer, engine, storage_options)\u001b[0m\n\u001b[0;32m 1494\u001b[0m ext \u001b[39m=\u001b[39m \u001b[39m\"\u001b[39m\u001b[39mxls\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 1495\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[1;32m-> 1496\u001b[0m ext \u001b[39m=\u001b[39m inspect_excel_format(\n\u001b[0;32m 1497\u001b[0m content_or_path\u001b[39m=\u001b[39;49mpath_or_buffer, storage_options\u001b[39m=\u001b[39;49mstorage_options\n\u001b[0;32m 1498\u001b[0m )\n\u001b[0;32m 1499\u001b[0m \u001b[39mif\u001b[39;00m ext \u001b[39mis\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[0;32m 1500\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\n\u001b[0;32m 1501\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mExcel file format cannot be determined, you must specify \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 1502\u001b[0m \u001b[39m\"\u001b[39m\u001b[39man engine manually.\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 1503\u001b[0m )\n", - "File \u001b[1;32mc:\\Users\\Khor Kean Teng\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\pandas\\io\\excel\\_base.py:1371\u001b[0m, in \u001b[0;36minspect_excel_format\u001b[1;34m(content_or_path, storage_options)\u001b[0m\n\u001b[0;32m 1368\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39misinstance\u001b[39m(content_or_path, \u001b[39mbytes\u001b[39m):\n\u001b[0;32m 1369\u001b[0m content_or_path \u001b[39m=\u001b[39m BytesIO(content_or_path)\n\u001b[1;32m-> 1371\u001b[0m \u001b[39mwith\u001b[39;00m get_handle(\n\u001b[0;32m 1372\u001b[0m content_or_path, \u001b[39m\"\u001b[39;49m\u001b[39mrb\u001b[39;49m\u001b[39m\"\u001b[39;49m, storage_options\u001b[39m=\u001b[39;49mstorage_options, is_text\u001b[39m=\u001b[39;49m\u001b[39mFalse\u001b[39;49;00m\n\u001b[0;32m 1373\u001b[0m ) \u001b[39mas\u001b[39;00m handle:\n\u001b[0;32m 1374\u001b[0m stream \u001b[39m=\u001b[39m handle\u001b[39m.\u001b[39mhandle\n\u001b[0;32m 1375\u001b[0m stream\u001b[39m.\u001b[39mseek(\u001b[39m0\u001b[39m)\n", - "File \u001b[1;32mc:\\Users\\Khor Kean Teng\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\pandas\\io\\common.py:868\u001b[0m, in \u001b[0;36mget_handle\u001b[1;34m(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)\u001b[0m\n\u001b[0;32m 859\u001b[0m handle \u001b[39m=\u001b[39m \u001b[39mopen\u001b[39m(\n\u001b[0;32m 860\u001b[0m handle,\n\u001b[0;32m 861\u001b[0m ioargs\u001b[39m.\u001b[39mmode,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 864\u001b[0m newline\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m\"\u001b[39m,\n\u001b[0;32m 865\u001b[0m )\n\u001b[0;32m 866\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m 867\u001b[0m \u001b[39m# Binary mode\u001b[39;00m\n\u001b[1;32m--> 868\u001b[0m handle \u001b[39m=\u001b[39m \u001b[39mopen\u001b[39;49m(handle, ioargs\u001b[39m.\u001b[39;49mmode)\n\u001b[0;32m 869\u001b[0m handles\u001b[39m.\u001b[39mappend(handle)\n\u001b[0;32m 871\u001b[0m \u001b[39m# Convert BytesIO or file objects passed with an encoding\u001b[39;00m\n", - "\u001b[1;31mOSError\u001b[0m: [Errno 22] Invalid argument: 'data/*hr*.xlsx'" - ] - } - ], - "source": [ - "import pandas as pd\n", - "file = 'data/*hr*.xlsx'\n", - "df = pd.read_excel(file)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - }, - "orig_nbformat": 4 - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/mkdocs.yml b/mkdocs.yml index 2b9c0a9..d79100f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -43,6 +43,7 @@ theme: - content.code.copy - content.code.select - content.action.edit + - content.action.view logo: assets/logo.png favicon: assets/favicon.png @@ -113,6 +114,7 @@ markdown_extensions: plugins: - git-revision-date - git-revision-date-localized: + fallback_to_build_date: true enable_creation_date: true type: timeago - mkdocs-jupyter: diff --git a/pilot_test2.ipynb b/pilot_test2.ipynb index 9db2f28..2b88d1f 100644 --- a/pilot_test2.ipynb +++ b/pilot_test2.ipynb @@ -11,7 +11,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -25,6 +25,7 @@ "source": [ "import pandas as pd\n", "import time\n", + "\n", "start_time = time.time()\n", "print(\"🚀Execution time: {:.15f}\".format(start_time - time.time()))\n", "del start_time" @@ -74,15 +75,15 @@ "\n", "test = BlueAutomata(\n", " folder_path=r\"C:\\Users\\Khor Kean Teng\\Downloads\\AUP Automata\\data\\fakesystem\",\n", - " checklist = 'data/checklist.xlsx',\n", - " staff_data = 'data/fake_hr_data.xlsx',\n", - " name_key= ['BSE', 'HKEX', 'KLSE', 'LSE1', 'NASDAQ', 'NYSE', 'SGX', 'SSE', 'TSE'],\n", - " name_code= [1, 1, 1, 1, 1, 1, 1, 1, 1],\n", + " checklist=\"data/checklist.xlsx\",\n", + " staff_data=\"data/fake_hr_data.xlsx\",\n", + " name_key=[\"BSE\", \"HKEX\", \"KLSE\", \"LSE1\", \"NASDAQ\", \"NYSE\", \"SGX\", \"SSE\", \"TSE\"],\n", + " name_code=[1, 1, 1, 1, 1, 1, 1, 1, 1],\n", ")\n", "df = test.automata_execution()\n", "\n", "print(df.head().to_markdown())\n", - "print('\\n Total number of rows: ', df.shape[0])\n", + "print(\"\\n Total number of rows: \", df.shape[0])\n", "print(\"\\n🚀Execution time: {:.15f}\".format(time.time() - start_time))\n", "del start_time" ] @@ -93,7 +94,7 @@ "metadata": {}, "outputs": [], "source": [ - "df.to_excel('data/output.xlsx', index=False)" + "df.to_excel(\"data/output.xlsx\", index=False)" ] }, { @@ -137,15 +138,65 @@ "\n", "test = AutomataReport(\n", " folder_path=r\"C:\\Users\\Khor Kean Teng\\Downloads\\AUP Automata\\data\\fakesystem\",\n", - " checklist = 'data/checklist.xlsx',\n", - " staff_data = 'data/fake_hr_data.xlsx',\n", - " name_key= ['BSE', 'HKEX', 'KLSE', 'LSE1', 'NASDAQ', 'NYSE', 'SGX', 'SSE', 'TSE'],\n", - " name_code= [1, 1, 1, 1, 1, 1, 1, 1, 1],\n", + " checklist=\"data/checklist.xlsx\",\n", + " staff_data=\"data/fake_hr_data.xlsx\",\n", + " name_key=[\"BSE\", \"HKEX\", \"KLSE\", \"LSE1\", \"NASDAQ\", \"NYSE\", \"SGX\", \"SSE\", \"TSE\"],\n", + " name_code=[1, 1, 1, 1, 1, 1, 1, 1, 1],\n", ")\n", "df = test.automata_report_summary()\n", "\n", - "print(df.head(n = len(df)).to_markdown())\n", - "print('\\n Total number of matched: ', df['Match IDs'].sum())\n", + "print(df.head(n=len(df)).to_markdown())\n", + "print(\"\\n Total number of matched: \", df[\"Match IDs\"].sum())\n", + "print(\"\\n🚀Execution time: {:.15f}\".format(time.time() - start_time))\n", + "del start_time" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "| | User ID | check | System1 | Name |\n", + "|---:|:------------------|:--------|:----------|:-------------------|\n", + "| 0 | chgzsprz5pwc0mnx7 | False | BSE | Jennifer Sandoval |\n", + "| 1 | l3ur5zaf6eefpvslw | False | BSE | Jessica Evans |\n", + "| 2 | r31p76vr2f5n3x1e8 | False | BSE | William Robinson |\n", + "| 3 | 0dnjw78m083l0e0p7 | False | BSE | Lisa Brown |\n", + "| 4 | 84vmzt0j5ev4z4pta | False | BSE | Dr. Nichole Thomas |\n", + "| 5 | g7jvd2nb55b88hdbu | False | BSE | Carlos Walls |\n", + "| 6 | 3a1wukpcxkxah6d05 | False | BSE | William Morgan |\n", + "| 7 | 41u8tlyj6nm1scwvx | False | BSE | David Wilson |\n", + "| 8 | g7h6efjk5z4xlhwzu | False | BSE | Maria Watson |\n", + "| 9 | 8b2t34bvxburnjc5b | False | BSE | Nicholas Burton |\n", + "| 10 | 57s8x0bext7v1hhkx | False | BSE | Sean Ramirez |\n", + "| 11 | jk0g4vfbx83a256lg | False | BSE | Alexis Vang |\n", + "| 12 | 2zh9mag3x6ph2n5ee | False | BSE | Debra Nelson |\n", + "| 13 | 53rgf9kh8zddv0kxr | False | BSE | Stacy Johnson |\n", + "| 14 | kket7v5u14cz618u5 | False | BSE | Dillon Aguirre |\n", + "\n", + "🚀Execution time: 1.007138967514038\n" + ] + } + ], + "source": [ + "from blueautomata.automation_report import AutomataReport\n", + "\n", + "start_time = time.time()\n", + "\n", + "test = AutomataReport(\n", + " folder_path=r\"C:\\Users\\Khor Kean Teng\\Downloads\\AUP Automata\\data\\fakesystem\",\n", + " checklist=\"data/checklist.xlsx\",\n", + " staff_data=\"data/fake_hr_data.xlsx\",\n", + " name_key=[\"BSE\", \"HKEX\", \"KLSE\", \"LSE1\", \"NASDAQ\", \"NYSE\", \"SGX\", \"SSE\", \"TSE\"],\n", + " name_code=[1, 1, 1, 1, 1, 1, 1, 1, 1],\n", + ")\n", + "df = test.automata_report_unmatch()\n", + "\n", + "print(df.head(n=15).to_markdown())\n", "print(\"\\n🚀Execution time: {:.15f}\".format(time.time() - start_time))\n", "del start_time" ] @@ -185,11 +236,11 @@ "\n", "start_time = time.time()\n", "\n", - "df = pd.read_excel('data/output.xlsx')\n", + "df = pd.read_excel(\"data/output.xlsx\")\n", "\n", "temp = BatchExport(\n", - " destination='data/dept',\n", - " masterlist= df,\n", + " destination=\"data/dept\",\n", + " masterlist=df,\n", ")\n", "\n", "temp.batch_export()\n", @@ -226,8 +277,8 @@ "start_time = time.time()\n", "\n", "temp = automate_vba(\n", - " filepath=r'C:\\\\Users\\\\Khor Kean Teng\\\\Downloads\\\\AUP Automata\\\\vbanew.xlsm',\n", - " macro = 'vbanew.xlsm!Module1.kt_template' \n", + " filepath=r\"C:\\\\Users\\\\Khor Kean Teng\\\\Downloads\\\\AUP Automata\\\\vbanew.xlsm\",\n", + " macro=\"vbanew.xlsm!Module1.kt_template\",\n", ")\n", "temp.templatetize()\n", "\n", diff --git a/setup.py b/setup.py index dc173a6..5e13c7d 100644 --- a/setup.py +++ b/setup.py @@ -5,13 +5,13 @@ setup( name = 'blueautomata', # How you named your package folder (MyLib) packages = ['blueautomata'], # Chose the same as "name" - version = '0.9', # Start with a small number and increase it with every change you make + version = '1.0', # Start with a small number and increase it with every change you make license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository description = 'A package to ease the workflow for reporting in a company', # Give a short description about your library author = 'keanteng', # Type in your name author_email = 'u2004763@siswa.um.edu.my', # Type in your E-Mail url = 'https://github.com/keanteng/blueautomata', # Provide either the link to your github or to your website - download_url = 'https://github.com/keanteng/blueautomata/archive/refs/tags/v_0.8.tar.gz', # I explain this later on + download_url = 'https://github.com/keanteng/blueautomata/archive/refs/tags/v_0.9.tar.gz', # I explain this later on keywords = ['automation', 'vba', 'reporting', 'automate'], # Keywords that define your package best install_requires=['pandas','pywin32','fuzzywuzzy','python-Levenshtein'], classifiers=[