customeranalytics 0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. customeranalytics/__init__.py +319 -0
  2. customeranalytics/configs.py +480 -0
  3. customeranalytics/data_storage_configurations/__init__.py +245 -0
  4. customeranalytics/data_storage_configurations/data_access.py +165 -0
  5. customeranalytics/data_storage_configurations/data_works_pipeline.py +207 -0
  6. customeranalytics/data_storage_configurations/es_create_index.py +544 -0
  7. customeranalytics/data_storage_configurations/logger.py +36 -0
  8. customeranalytics/data_storage_configurations/query_es.py +157 -0
  9. customeranalytics/data_storage_configurations/reports.py +684 -0
  10. customeranalytics/data_storage_configurations/schedule_data_integration.py +355 -0
  11. customeranalytics/docs/queries.yaml +245 -0
  12. customeranalytics/docs/web_configs.yaml +2 -0
  13. customeranalytics/exploratory_analysis/__init__.py +109 -0
  14. customeranalytics/exploratory_analysis/churn.py +232 -0
  15. customeranalytics/exploratory_analysis/cohorts.py +535 -0
  16. customeranalytics/exploratory_analysis/descriptive_statistics.py +470 -0
  17. customeranalytics/exploratory_analysis/funnels.py +407 -0
  18. customeranalytics/exploratory_analysis/product_analytics.py +340 -0
  19. customeranalytics/exploratory_analysis/promotion_analytics.py +299 -0
  20. customeranalytics/exploratory_analysis/rfm.py +202 -0
  21. customeranalytics/exploratory_analysis/sample_data/sample_data_avg_order_count_per_promo_per_cust.csv +99 -0
  22. customeranalytics/exploratory_analysis/sample_data/sample_data_chart_1_search.csv +2 -0
  23. customeranalytics/exploratory_analysis/sample_data/sample_data_chart_2_search.csv +46 -0
  24. customeranalytics/exploratory_analysis/sample_data/sample_data_chart_3_search.csv +2 -0
  25. customeranalytics/exploratory_analysis/sample_data/sample_data_chart_4_search.csv +2 -0
  26. customeranalytics/exploratory_analysis/sample_data/sample_data_churn.csv +2 -0
  27. customeranalytics/exploratory_analysis/sample_data/sample_data_churn_weekly.csv +10 -0
  28. customeranalytics/exploratory_analysis/sample_data/sample_data_client_feature_predicted.csv +1590 -0
  29. customeranalytics/exploratory_analysis/sample_data/sample_data_client_kpis.csv +7060 -0
  30. customeranalytics/exploratory_analysis/sample_data/sample_data_clvrfm_anomaly.csv +561 -0
  31. customeranalytics/exploratory_analysis/sample_data/sample_data_clvsegments_amount.csv +8 -0
  32. customeranalytics/exploratory_analysis/sample_data/sample_data_customer_journey.csv +18 -0
  33. customeranalytics/exploratory_analysis/sample_data/sample_data_daily_clv.csv +103 -0
  34. customeranalytics/exploratory_analysis/sample_data/sample_data_daily_cohort_downloads.csv +68 -0
  35. customeranalytics/exploratory_analysis/sample_data/sample_data_daily_cohort_from_1_to_2.csv +66 -0
  36. customeranalytics/exploratory_analysis/sample_data/sample_data_daily_cohort_from_2_to_3.csv +64 -0
  37. customeranalytics/exploratory_analysis/sample_data/sample_data_daily_cohort_from_3_to_4.csv +55 -0
  38. customeranalytics/exploratory_analysis/sample_data/sample_data_daily_dimension_values.csv +199 -0
  39. customeranalytics/exploratory_analysis/sample_data/sample_data_daily_funnel.csv +36 -0
  40. customeranalytics/exploratory_analysis/sample_data/sample_data_daily_funnel_downloads.csv +68 -0
  41. customeranalytics/exploratory_analysis/sample_data/sample_data_daily_inorganic_ratio.csv +6070 -0
  42. customeranalytics/exploratory_analysis/sample_data/sample_data_daily_orders.csv +57 -0
  43. customeranalytics/exploratory_analysis/sample_data/sample_data_daily_organic_orders.csv +64 -0
  44. customeranalytics/exploratory_analysis/sample_data/sample_data_daily_products_of_sales.csv +12574 -0
  45. customeranalytics/exploratory_analysis/sample_data/sample_data_daily_promotion_discount.csv +64 -0
  46. customeranalytics/exploratory_analysis/sample_data/sample_data_daily_promotion_revenue.csv +6070 -0
  47. customeranalytics/exploratory_analysis/sample_data/sample_data_dcohort_anomaly.csv +6 -0
  48. customeranalytics/exploratory_analysis/sample_data/sample_data_dcohort_anomaly_2.csv +118 -0
  49. customeranalytics/exploratory_analysis/sample_data/sample_data_deliver.csv +47 -0
  50. customeranalytics/exploratory_analysis/sample_data/sample_data_deliver_kpis.csv +2 -0
  51. customeranalytics/exploratory_analysis/sample_data/sample_data_deliver_weekday_hour.csv +25 -0
  52. customeranalytics/exploratory_analysis/sample_data/sample_data_dfunnel_anomaly.csv +118 -0
  53. customeranalytics/exploratory_analysis/sample_data/sample_data_dimension_kpis.csv +199 -0
  54. customeranalytics/exploratory_analysis/sample_data/sample_data_dorders_anomaly.csv +85 -0
  55. customeranalytics/exploratory_analysis/sample_data/sample_data_frequency_clusters.csv +6 -0
  56. customeranalytics/exploratory_analysis/sample_data/sample_data_frequency_recency.csv +3740 -0
  57. customeranalytics/exploratory_analysis/sample_data/sample_data_hourly_funnel.csv +25 -0
  58. customeranalytics/exploratory_analysis/sample_data/sample_data_hourly_funnel_downloads.csv +25 -0
  59. customeranalytics/exploratory_analysis/sample_data/sample_data_hourly_inorganic_ratio.csv +2353 -0
  60. customeranalytics/exploratory_analysis/sample_data/sample_data_hourly_orders.csv +25 -0
  61. customeranalytics/exploratory_analysis/sample_data/sample_data_hourly_organic_orders.csv +2353 -0
  62. customeranalytics/exploratory_analysis/sample_data/sample_data_inorganic_orders_per_promotion_per_day.csv +6070 -0
  63. customeranalytics/exploratory_analysis/sample_data/sample_data_kpis.csv +2 -0
  64. customeranalytics/exploratory_analysis/sample_data/sample_data_monetary_clusters.csv +6 -0
  65. customeranalytics/exploratory_analysis/sample_data/sample_data_monetary_frequency.csv +3740 -0
  66. customeranalytics/exploratory_analysis/sample_data/sample_data_monthly_funnel.csv +5 -0
  67. customeranalytics/exploratory_analysis/sample_data/sample_data_monthly_funnel_downloads.csv +5 -0
  68. customeranalytics/exploratory_analysis/sample_data/sample_data_monthly_orders.csv +4 -0
  69. customeranalytics/exploratory_analysis/sample_data/sample_data_most_combined_products.csv +11 -0
  70. customeranalytics/exploratory_analysis/sample_data/sample_data_most_ordered_categories.csv +11 -0
  71. customeranalytics/exploratory_analysis/sample_data/sample_data_most_ordered_products.csv +11 -0
  72. customeranalytics/exploratory_analysis/sample_data/sample_data_order_and_payment_amount_differences.csv +91 -0
  73. customeranalytics/exploratory_analysis/sample_data/sample_data_prepare.csv +101 -0
  74. customeranalytics/exploratory_analysis/sample_data/sample_data_prepare_weekday_hour.csv +25 -0
  75. customeranalytics/exploratory_analysis/sample_data/sample_data_product_kpis.csv +201 -0
  76. customeranalytics/exploratory_analysis/sample_data/sample_data_product_usage_before_after_amount_accept.csv +11 -0
  77. customeranalytics/exploratory_analysis/sample_data/sample_data_product_usage_before_after_amount_reject.csv +7 -0
  78. customeranalytics/exploratory_analysis/sample_data/sample_data_product_usage_before_after_orders_accept.csv +11 -0
  79. customeranalytics/exploratory_analysis/sample_data/sample_data_product_usage_before_after_orders_reject.csv +11 -0
  80. customeranalytics/exploratory_analysis/sample_data/sample_data_promotion_comparison.csv +91 -0
  81. customeranalytics/exploratory_analysis/sample_data/sample_data_promotion_kpis.csv +99 -0
  82. customeranalytics/exploratory_analysis/sample_data/sample_data_promotion_number_of_customer.csv +99 -0
  83. customeranalytics/exploratory_analysis/sample_data/sample_data_promotion_usage_before_after_amount_accept.csv +81 -0
  84. customeranalytics/exploratory_analysis/sample_data/sample_data_promotion_usage_before_after_amount_reject.csv +11 -0
  85. customeranalytics/exploratory_analysis/sample_data/sample_data_promotion_usage_before_after_orders_accept.csv +55 -0
  86. customeranalytics/exploratory_analysis/sample_data/sample_data_promotion_usage_before_after_orders_reject.csv +37 -0
  87. customeranalytics/exploratory_analysis/sample_data/sample_data_purchase_amount_distribution.csv +22 -0
  88. customeranalytics/exploratory_analysis/sample_data/sample_data_recency_clusters.csv +6 -0
  89. customeranalytics/exploratory_analysis/sample_data/sample_data_recency_monetary.csv +3740 -0
  90. customeranalytics/exploratory_analysis/sample_data/sample_data_rfm.csv +2001 -0
  91. customeranalytics/exploratory_analysis/sample_data/sample_data_ride.csv +101 -0
  92. customeranalytics/exploratory_analysis/sample_data/sample_data_ride_weekday_hour.csv +25 -0
  93. customeranalytics/exploratory_analysis/sample_data/sample_data_segmentation.csv +11 -0
  94. customeranalytics/exploratory_analysis/sample_data/sample_data_segments_change_daily_before_after_amount.csv +10 -0
  95. customeranalytics/exploratory_analysis/sample_data/sample_data_segments_change_daily_before_after_orders.csv +9 -0
  96. customeranalytics/exploratory_analysis/sample_data/sample_data_segments_change_monthly_before_after_amount.csv +10 -0
  97. customeranalytics/exploratory_analysis/sample_data/sample_data_segments_change_monthly_before_after_orders.csv +11 -0
  98. customeranalytics/exploratory_analysis/sample_data/sample_data_segments_change_weekly_before_after_amount.csv +10 -0
  99. customeranalytics/exploratory_analysis/sample_data/sample_data_segments_change_weekly_before_after_orders.csv +10 -0
  100. customeranalytics/exploratory_analysis/sample_data/sample_data_user_counts_per_order_seq.csv +47 -0
  101. customeranalytics/exploratory_analysis/sample_data/sample_data_weekly_average_order_per_user.csv +13 -0
  102. customeranalytics/exploratory_analysis/sample_data/sample_data_weekly_average_payment_amount.csv +13 -0
  103. customeranalytics/exploratory_analysis/sample_data/sample_data_weekly_average_session_per_user.csv +13 -0
  104. customeranalytics/exploratory_analysis/sample_data/sample_data_weekly_cohort_downloads.csv +13 -0
  105. customeranalytics/exploratory_analysis/sample_data/sample_data_weekly_cohort_from_1_to_2.csv +13 -0
  106. customeranalytics/exploratory_analysis/sample_data/sample_data_weekly_cohort_from_2_to_3.csv +13 -0
  107. customeranalytics/exploratory_analysis/sample_data/sample_data_weekly_cohort_from_3_to_4.csv +12 -0
  108. customeranalytics/exploratory_analysis/sample_data/sample_data_weekly_funnel.csv +25 -0
  109. customeranalytics/exploratory_analysis/sample_data/sample_data_weekly_funnel_downloads.csv +25 -0
  110. customeranalytics/exploratory_analysis/sample_data/sample_data_weekly_orders.csv +10 -0
  111. customeranalytics/ml_process/__init__.py +64 -0
  112. customeranalytics/ml_process/ab_test.py +615 -0
  113. customeranalytics/ml_process/anomaly_detection.py +456 -0
  114. customeranalytics/ml_process/clv_prediction.py +301 -0
  115. customeranalytics/ml_process/customer_segmentation.py +354 -0
  116. customeranalytics/ml_process/delivery_analytics.py +754 -0
  117. customeranalytics/utils.py +186 -0
  118. customeranalytics/web/app/__init__.py +37 -0
  119. customeranalytics/web/app/base/__init__.py +9 -0
  120. customeranalytics/web/app/base/forms.py +16 -0
  121. customeranalytics/web/app/base/models.py +43 -0
  122. customeranalytics/web/app/base/routes.py +126 -0
  123. customeranalytics/web/app/base/static/assets/css/app.css +20 -0
  124. customeranalytics/web/app/base/static/assets/fonts/Inter-Black.woff +0 -0
  125. customeranalytics/web/app/base/static/assets/fonts/Inter-Black.woff2 +0 -0
  126. customeranalytics/web/app/base/static/assets/fonts/Inter-BlackItalic.woff +0 -0
  127. customeranalytics/web/app/base/static/assets/fonts/Inter-BlackItalic.woff2 +0 -0
  128. customeranalytics/web/app/base/static/assets/fonts/Inter-Bold.woff +0 -0
  129. customeranalytics/web/app/base/static/assets/fonts/Inter-Bold.woff2 +0 -0
  130. customeranalytics/web/app/base/static/assets/fonts/Inter-BoldItalic.woff +0 -0
  131. customeranalytics/web/app/base/static/assets/fonts/Inter-BoldItalic.woff2 +0 -0
  132. customeranalytics/web/app/base/static/assets/fonts/Inter-ExtraBold.woff +0 -0
  133. customeranalytics/web/app/base/static/assets/fonts/Inter-ExtraBold.woff2 +0 -0
  134. customeranalytics/web/app/base/static/assets/fonts/Inter-ExtraBoldItalic.woff +0 -0
  135. customeranalytics/web/app/base/static/assets/fonts/Inter-ExtraBoldItalic.woff2 +0 -0
  136. customeranalytics/web/app/base/static/assets/fonts/Inter-ExtraLight-BETA.woff +0 -0
  137. customeranalytics/web/app/base/static/assets/fonts/Inter-ExtraLight-BETA.woff2 +0 -0
  138. customeranalytics/web/app/base/static/assets/fonts/Inter-ExtraLightItalic-BETA.woff +0 -0
  139. customeranalytics/web/app/base/static/assets/fonts/Inter-ExtraLightItalic-BETA.woff2 +0 -0
  140. customeranalytics/web/app/base/static/assets/fonts/Inter-Italic.woff +0 -0
  141. customeranalytics/web/app/base/static/assets/fonts/Inter-Italic.woff2 +0 -0
  142. customeranalytics/web/app/base/static/assets/fonts/Inter-Light-BETA.woff +0 -0
  143. customeranalytics/web/app/base/static/assets/fonts/Inter-Light-BETA.woff2 +0 -0
  144. customeranalytics/web/app/base/static/assets/fonts/Inter-LightItalic-BETA.woff +0 -0
  145. customeranalytics/web/app/base/static/assets/fonts/Inter-LightItalic-BETA.woff2 +0 -0
  146. customeranalytics/web/app/base/static/assets/fonts/Inter-Medium.woff +0 -0
  147. customeranalytics/web/app/base/static/assets/fonts/Inter-Medium.woff2 +0 -0
  148. customeranalytics/web/app/base/static/assets/fonts/Inter-MediumItalic.woff +0 -0
  149. customeranalytics/web/app/base/static/assets/fonts/Inter-MediumItalic.woff2 +0 -0
  150. customeranalytics/web/app/base/static/assets/fonts/Inter-Regular.woff +0 -0
  151. customeranalytics/web/app/base/static/assets/fonts/Inter-Regular.woff2 +0 -0
  152. customeranalytics/web/app/base/static/assets/fonts/Inter-SemiBold.woff +0 -0
  153. customeranalytics/web/app/base/static/assets/fonts/Inter-SemiBold.woff2 +0 -0
  154. customeranalytics/web/app/base/static/assets/fonts/Inter-SemiBoldItalic.woff +0 -0
  155. customeranalytics/web/app/base/static/assets/fonts/Inter-SemiBoldItalic.woff2 +0 -0
  156. customeranalytics/web/app/base/static/assets/fonts/Inter-Thin-BETA.woff +0 -0
  157. customeranalytics/web/app/base/static/assets/fonts/Inter-Thin-BETA.woff2 +0 -0
  158. customeranalytics/web/app/base/static/assets/fonts/Inter-ThinItalic-BETA.woff +0 -0
  159. customeranalytics/web/app/base/static/assets/fonts/Inter-ThinItalic-BETA.woff2 +0 -0
  160. customeranalytics/web/app/base/static/assets/fonts/Inter-italic.var.woff2 +0 -0
  161. customeranalytics/web/app/base/static/assets/fonts/Inter-upright.var.woff2 +0 -0
  162. customeranalytics/web/app/base/static/assets/fonts/Inter.var.woff2 +0 -0
  163. customeranalytics/web/app/base/static/assets/fonts/fa-brands-400.eot +0 -0
  164. customeranalytics/web/app/base/static/assets/fonts/fa-brands-400.svg +3570 -0
  165. customeranalytics/web/app/base/static/assets/fonts/fa-brands-400.ttf +0 -0
  166. customeranalytics/web/app/base/static/assets/fonts/fa-brands-400.woff +0 -0
  167. customeranalytics/web/app/base/static/assets/fonts/fa-brands-400.woff2 +0 -0
  168. customeranalytics/web/app/base/static/assets/fonts/fa-regular-400.eot +0 -0
  169. customeranalytics/web/app/base/static/assets/fonts/fa-regular-400.svg +801 -0
  170. customeranalytics/web/app/base/static/assets/fonts/fa-regular-400.ttf +0 -0
  171. customeranalytics/web/app/base/static/assets/fonts/fa-regular-400.woff +0 -0
  172. customeranalytics/web/app/base/static/assets/fonts/fa-regular-400.woff2 +0 -0
  173. customeranalytics/web/app/base/static/assets/fonts/fa-solid-900.eot +0 -0
  174. customeranalytics/web/app/base/static/assets/fonts/fa-solid-900.svg +5028 -0
  175. customeranalytics/web/app/base/static/assets/fonts/fa-solid-900.ttf +0 -0
  176. customeranalytics/web/app/base/static/assets/fonts/fa-solid-900.woff +0 -0
  177. customeranalytics/web/app/base/static/assets/fonts/fa-solid-900.woff2 +0 -0
  178. customeranalytics/web/app/base/static/assets/img/avatars/avatar-1.png +0 -0
  179. customeranalytics/web/app/base/static/assets/img/avatars/avatar-2.png +0 -0
  180. customeranalytics/web/app/base/static/assets/img/avatars/avatar-3.png +0 -0
  181. customeranalytics/web/app/base/static/assets/img/avatars/avatar-4.png +0 -0
  182. customeranalytics/web/app/base/static/assets/img/avatars/avatar-5.png +0 -0
  183. customeranalytics/web/app/base/static/assets/img/avatars/info.jpeg +0 -0
  184. customeranalytics/web/app/base/static/assets/img/icons/customanality.png +0 -0
  185. customeranalytics/web/app/base/static/assets/img/icons/icon-48x48.png +0 -0
  186. customeranalytics/web/app/base/static/assets/js/app.js +2 -0
  187. customeranalytics/web/app/base/static/assets/js/app.js.LICENSE +566 -0
  188. customeranalytics/web/app/base/static/assets/js/app.js.LICENSE.txt +556 -0
  189. customeranalytics/web/app/base/static/assets/js/modules/bootstrap.js +15 -0
  190. customeranalytics/web/app/base/static/assets/js/modules/chartjs.js +4 -0
  191. customeranalytics/web/app/base/static/assets/js/modules/feather.js +8 -0
  192. customeranalytics/web/app/base/static/assets/js/modules/flatpickr.js +4 -0
  193. customeranalytics/web/app/base/static/assets/js/modules/moment.js +4 -0
  194. customeranalytics/web/app/base/static/assets/js/modules/sidebar.js +23 -0
  195. customeranalytics/web/app/base/static/assets/js/modules/theme.js +16 -0
  196. customeranalytics/web/app/base/templates/accounts/login.html +81 -0
  197. customeranalytics/web/app/base/templates/accounts/register.html +80 -0
  198. customeranalytics/web/app/base/templates/includes/footer.html +28 -0
  199. customeranalytics/web/app/base/templates/includes/navigation.html +51 -0
  200. customeranalytics/web/app/base/templates/includes/scripts.html +3 -0
  201. customeranalytics/web/app/base/templates/includes/sidebar.html +146 -0
  202. customeranalytics/web/app/base/templates/layouts/base-fullscreen.html +36 -0
  203. customeranalytics/web/app/base/templates/layouts/base.html +84 -0
  204. customeranalytics/web/app/base/util.py +30 -0
  205. customeranalytics/web/app/home/__init__.py +9 -0
  206. customeranalytics/web/app/home/forms.py +1039 -0
  207. customeranalytics/web/app/home/models.py +438 -0
  208. customeranalytics/web/app/home/profiles.py +310 -0
  209. customeranalytics/web/app/home/routes.py +386 -0
  210. customeranalytics/web/app/home/search.py +288 -0
  211. customeranalytics/web/app/home/static/assets/img/avatars/avatar-1.png +0 -0
  212. customeranalytics/web/app/home/static/assets/img/avatars/avatar-2.png +0 -0
  213. customeranalytics/web/app/home/static/assets/img/avatars/avatar-3.png +0 -0
  214. customeranalytics/web/app/home/static/assets/img/avatars/avatar-4.png +0 -0
  215. customeranalytics/web/app/home/static/assets/img/avatars/avatar-5.png +0 -0
  216. customeranalytics/web/app/home/static/assets/img/icons/customanality.png +0 -0
  217. customeranalytics/web/app/home/static/assets/img/icons/icon-48x48.png +0 -0
  218. customeranalytics/web/app/home/templates/abtest-product.html +280 -0
  219. customeranalytics/web/app/home/templates/abtest-promotion.html +362 -0
  220. customeranalytics/web/app/home/templates/abtest-segments.html +298 -0
  221. customeranalytics/web/app/home/templates/add-data-delivery.html +184 -0
  222. customeranalytics/web/app/home/templates/add-data-product.html +177 -0
  223. customeranalytics/web/app/home/templates/add-data-purchase.html +392 -0
  224. customeranalytics/web/app/home/templates/anomaly.html +261 -0
  225. customeranalytics/web/app/home/templates/clv.html +211 -0
  226. customeranalytics/web/app/home/templates/cohorts.html +308 -0
  227. customeranalytics/web/app/home/templates/customer-segmentation.html +308 -0
  228. customeranalytics/web/app/home/templates/data-es.html +152 -0
  229. customeranalytics/web/app/home/templates/data-execute.html +397 -0
  230. customeranalytics/web/app/home/templates/delivery.html +404 -0
  231. customeranalytics/web/app/home/templates/funnel-customer.html +240 -0
  232. customeranalytics/web/app/home/templates/funnel-session.html +236 -0
  233. customeranalytics/web/app/home/templates/index.html +524 -0
  234. customeranalytics/web/app/home/templates/index2.html +515 -0
  235. customeranalytics/web/app/home/templates/page-403.html +46 -0
  236. customeranalytics/web/app/home/templates/page-404.html +45 -0
  237. customeranalytics/web/app/home/templates/page-500.html +45 -0
  238. customeranalytics/web/app/home/templates/pages-blank.html +33 -0
  239. customeranalytics/web/app/home/templates/pages-sign-in.html +67 -0
  240. customeranalytics/web/app/home/templates/pages-sign-up.html +61 -0
  241. customeranalytics/web/app/home/templates/product.html +203 -0
  242. customeranalytics/web/app/home/templates/profile.html +1009 -0
  243. customeranalytics/web/app/home/templates/rfm.html +254 -0
  244. customeranalytics/web/app/home/templates/search.html +167 -0
  245. customeranalytics/web/app/home/templates/settings.html +205 -0
  246. customeranalytics/web/app/home/templates/stats-desc.html +230 -0
  247. customeranalytics/web/app/home/templates/stats-purchase.html +221 -0
  248. customeranalytics/web/config.py +30 -0
  249. customeranalytics/web/db.sqlite3 +0 -0
  250. customeranalytics/web/run.py +30 -0
  251. customeranalytics-0.1.dist-info/METADATA +1102 -0
  252. customeranalytics-0.1.dist-info/RECORD +254 -0
  253. customeranalytics-0.1.dist-info/WHEEL +4 -0
  254. customeranalytics-0.1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,245 @@
1
+ import sys, os, inspect
2
+ from os.path import join, dirname, abspath, exists
3
+ from sqlalchemy import create_engine, MetaData
4
+ from pandas import read_sql, DataFrame
5
+ import subprocess
6
+ import requests
7
+ from dateutil.parser import parse
8
+
9
+ currentdir = dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
10
+ parentdir = dirname(currentdir)
11
+ sys.path.insert(0, parentdir)
12
+
13
+ from customeranalytics.data_storage_configurations.query_es import QueryES
14
+ from customeranalytics.data_storage_configurations.data_access import GetData
15
+ from customeranalytics.data_storage_configurations.es_create_index import CreateIndex
16
+ from customeranalytics.data_storage_configurations.schedule_data_integration import Scheduler
17
+ from customeranalytics.configs import elasticsearch_connection_refused_comment, query_path, acception_column_count
18
+ from customeranalytics.utils import read_yaml, sqlite_string_converter, abspath_for_sample_data
19
+
20
+
21
+ engine = create_engine('sqlite://///' + join(abspath_for_sample_data(), "web", 'db.sqlite3'), connect_args={'check_same_thread': False})
22
+ metadata = MetaData()
23
+ con = engine.connect()
24
+
25
+
26
+ sample_data_columns = read_yaml(query_path, "queries.yaml")['columns']
27
+
28
+
29
+ def create_connection_columns(index='orders'):
30
+ return [index + i for i in ['_data_source_tag', '_data_source_type',
31
+ '_data_query_path', '_password', '_user', '_port', '_host', '_db']]
32
+
33
+
34
+ def create_data_access_parameters(connection, index='orders', date=None, test=False):
35
+ _ds = {'data_source': connection[index + '_data_source_type'],
36
+ 'date': date,
37
+ 'data_query_path': sqlite_string_converter(connection[index + '_data_query_path'], back_to_normal=True),
38
+ 'test': test,
39
+ 'config': {'host': connection[index + '_host'],
40
+ 'port': connection[index + '_port'],
41
+ 'password': connection[index + '_password'],
42
+ 'user': connection[index + '_user'], 'db': connection[index + '_db']}}
43
+ return _ds
44
+
45
+
46
+ def get_data_connection_arguments():
47
+ conn = read_sql("SELECT * FROM data_connection ", con).to_dict('resutls')[-1]
48
+ columns = read_sql("SELECT * FROM data_columns_integration", con).to_dict('records')[-1]
49
+
50
+ data_configs = {'orders': create_data_access_parameters(conn, index='orders', date=None, test=False),
51
+ 'downloads': create_data_access_parameters(conn, index='downloads', date=None, test=False),
52
+ 'products': create_data_access_parameters(conn, index='products', date=None, test=False),
53
+ 'deliveries': create_data_access_parameters(conn, index='deliveries', date=None, test=False)
54
+ }
55
+ return conn, columns, data_configs
56
+
57
+
58
+ def get_action_name():
59
+ actions = read_sql("SELECT * FROM actions ", con)
60
+ a_orders, a_downloads = actions.query("data_type == 'orders'"), actions.query("data_type == 'downloads'")
61
+ check_actions = lambda a: list(a['action_name']) if len(a) != 0 else []
62
+ return {'orders': check_actions(a_orders), 'downloads': check_actions(a_downloads)}
63
+
64
+
65
+ def get_ea_and_ml_config(ea_configs, ml_configs, has_product_conn, has_promotion_conn, has_delivery_connection):
66
+ """
67
+ ea_configs = {"date": None,
68
+ "funnel": {"actions": ["download", "signup"],
69
+ "purchase_actions": ["has_basket", "order_screen"],
70
+ "host": 'localhost',
71
+ "port": '9200',
72
+ 'download_index': 'downloads',
73
+ 'order_index': 'orders'},
74
+ "cohort": {"has_download": True, "host": 'localhost', "port": '9200',
75
+ 'download_index': 'downloads', 'order_index': 'orders'},
76
+ "product": {"has_product_connection": True, "has_download": True,
77
+ "host": 'localhost', "port": '9200'},
78
+ "promotions": {"has_promotion_connection": True,
79
+ "host": 'localhost', "port": '9200',
80
+ "download_index": 'downloads', "order_index": 'orders'},
81
+ "rfm": {"host": 'localhost', "port": '9200',
82
+ 'download_index': 'downloads', 'order_index': 'orders'},
83
+ "stats": {"host": 'localhost', "port": '9200',
84
+ 'download_index': 'downloads', 'order_index': 'orders'}
85
+ }
86
+
87
+ ml_configs = {"date": None,
88
+ 'time_period': 'weekly',
89
+ "segmentation": {"host": 'localhost', "port": '9200',
90
+ 'download_index': 'downloads', 'order_index': 'orders'},
91
+ "clv_prediction": {"temporary_export_path": None,
92
+ "host": 'localhost', "port": '9200',
93
+ 'download_index': 'downloads', 'order_index': 'orders', 'time_period': 'weekly'},
94
+ "abtest": {"has_product_connection": True, "temporary_export_path": None,
95
+ "host": 'localhost', "port": '9200', 'download_index': 'downloads', 'order_index': 'orders'}
96
+ }
97
+
98
+ """
99
+ es_tag_conn = read_sql(" SELECT * FROM es_connection ", con)
100
+ port, host, directory = [list(es_tag_conn[i])[0] for i in ['port', 'host', 'directory']]
101
+ actions = get_action_name()
102
+
103
+ configs = []
104
+ for conf in [ea_configs, ml_configs]:
105
+ for ea in conf:
106
+ if ea not in ['date', 'time_period']:
107
+ conf[ea]['host'] = host
108
+ conf[ea]['port'] = port
109
+ if ea == 'funnel':
110
+ conf[ea]['actions'] = actions['downloads']
111
+ conf[ea]['purchase_actions'] = actions['orders']
112
+ if ea in ['abtest', 'clv_prediction', 'delivery_anomaly']:
113
+ conf[ea]['temporary_export_path'] = directory
114
+ if not has_product_conn:
115
+ if ea in ['products', 'abtest']:
116
+ conf[ea]['has_product_connection'] = False
117
+ if not has_promotion_conn:
118
+ if ea in ['abtest', 'promotions']:
119
+ conf[ea]['has_promotion_connection'] = False
120
+ if not has_delivery_connection:
121
+ if ea == 'delivery_anomaly':
122
+ conf[ea]['has_delivery_connection'] = False
123
+
124
+ configs += [conf]
125
+ return configs + [actions]
126
+
127
+
128
+ def decision_for_product_conn(data_configs):
129
+ return True if data_configs['products']['data_source'] not in [None, 'None'] else False
130
+
131
+
132
+ def decision_for_delivery_conn(data_configs):
133
+ return True if data_configs['deliveries']['data_source'] not in [None, 'None'] else False
134
+
135
+
136
+ def decision_for_promotion_conn(columns):
137
+ return True if columns['promotion_id'] not in [None, 'None'] else False
138
+
139
+
140
+ def create_index(tag, ea_configs, ml_configs):
141
+ """
142
+
143
+ :return:
144
+ """
145
+ columns, data_configs = get_data_connection_arguments()[1:]
146
+ has_product_connection = decision_for_product_conn(data_configs)
147
+ has_delivery_connection = decision_for_delivery_conn(data_configs)
148
+ has_promotion_connection = decision_for_promotion_conn(columns)
149
+ _ea_configs, _ml_configs, _actions = get_ea_and_ml_config(ea_configs, ml_configs,
150
+ has_product_connection,
151
+ has_promotion_connection, has_delivery_connection)
152
+ s = Scheduler(es_tag=tag,
153
+ data_connection_structure=data_configs,
154
+ ea_connection_structure=_ea_configs,
155
+ ml_connection_structure=_ml_configs, data_columns=columns, actions=_actions)
156
+ s.run_schedule_on_thread(function=s.execute_schedule)
157
+
158
+
159
+ def get_columns_condition(request, _columns, index):
160
+ desire_column_count = 0
161
+ if index == 'orders':
162
+ a_col_count, p_col_count, d_col_count = 0, 0, 0
163
+ if request.get('actions', None) is not None:
164
+ a_col_count = len(request['actions'].split(","))
165
+ if request.get('dimension', None) is not None:
166
+ d_col_count = 1
167
+ if request.get('promotion', None) is not None:
168
+ p_col_count = 1
169
+ desire_column_count = p_col_count + a_col_count + d_col_count + acception_column_count['orders']
170
+
171
+ if index == 'downloads':
172
+ a_col_count = 0
173
+ if request.get('actions', None) is not None:
174
+ a_col_count = len(request['actions'].split(","))
175
+ desire_column_count = a_col_count + acception_column_count['downloads']
176
+
177
+ if index == 'products':
178
+ desire_column_count = acception_column_count['products']
179
+
180
+ if index == 'deliveries':
181
+ desire_column_count = acception_column_count['deliveries']
182
+
183
+ if len(_columns) >= desire_column_count:
184
+ return True
185
+ else:
186
+ return False
187
+
188
+
189
+ def connection_check(request, index='orders', type=''):
190
+ """
191
+
192
+ :param tag: elasticsearch connected tag name
193
+ :return:
194
+ """
195
+ accept, message, data, raw_columns = False, "Connection Failed", None, []
196
+ try:
197
+ args = create_data_access_parameters(request, index=index, date=None, test=5)
198
+ gd = GetData(**args)
199
+ gd.query_data_source()
200
+ if gd.data is not None:
201
+ if len(gd.data) != 0:
202
+ _columns = list(gd.data.columns)
203
+ _df = gd.data
204
+ # required list; order_id, client, s_start_date, amount, has_purchased
205
+ if get_columns_condition(request, _columns, index):
206
+ accept, message, data, raw_columns = True, 'Connected', _df.to_dict('records'), gd.data.columns.values
207
+ except Exception as e:
208
+ print(e)
209
+ return accept, message, data, raw_columns
210
+
211
+
212
+ def check_data_integration(data, index):
213
+ columns = list(data.columns)
214
+ for col in sample_data_columns[index + '_sample_data'][1:]:
215
+ if col not in columns:
216
+ data[col] = '....'
217
+ data = data[sample_data_columns[index + '_sample_data'][1:]]
218
+
219
+ return data
220
+
221
+
222
+ def check_elasticsearch(port, host, directory):
223
+ """
224
+
225
+ :return:
226
+ """
227
+ message = 'connected'
228
+ connection = True
229
+ if exists(directory):
230
+ es = QueryES(port=port, host=host)
231
+ if not es.es.ping():
232
+ message = 'pls check the ElasticSearch connection.'
233
+ connection = False
234
+
235
+ else:
236
+ message = 'pls check the directory.'
237
+ connection = False
238
+ return connection, message
239
+
240
+
241
+
242
+
243
+
244
+
245
+
@@ -0,0 +1,165 @@
1
+ import pandas as pd
2
+ from dateutil.parser import parse
3
+ from os.path import join, dirname
4
+ from os import listdir
5
+ import sys, os, inspect
6
+ from os.path import abspath
7
+ import glob
8
+
9
+ currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
10
+ parentdir = os.path.dirname(currentdir)
11
+ sys.path.insert(0, parentdir)
12
+
13
+ from customeranalytics.configs import default_dask_partitions
14
+
15
+
16
+ class GetData:
17
+ """
18
+ Collecting data for storing Into Orders & Downloads Index
19
+ """
20
+ def __init__(self,
21
+ config=None,
22
+ data_source=None,
23
+ date=None,
24
+ data_query_path=None,
25
+ test=None,
26
+ dask=False):
27
+ self.data_source = data_source if data_source is not None else 'csv'
28
+ self.data_query_path = data_query_path
29
+ self.dask = dask
30
+ self.conn = None
31
+ self.data = pd.DataFrame()
32
+ self.nrows = test
33
+ self.date = date
34
+ self.n_partitions = default_dask_partitions
35
+ self.config = config
36
+
37
+ def get_connection(self):
38
+ if self.data_source in ['postgresql', 'awsredshift', 'mysql']:
39
+ server, db, user, pw, port = str(self.config['host']), str(self.config['db']), \
40
+ str(self.config['user']), str(self.config['password']),\
41
+ int(self.config['port'])
42
+ if self.data_source == 'mysql':
43
+ from mysql import connector
44
+ self.conn = connector.connect(host=server, database=db, user=user, password=pw)
45
+ if self.data_source in ['postgresql', 'awsredshift']:
46
+ import psycopg2
47
+ self.conn = psycopg2.connect(user=user, password=pw, host=server, port=port, database=db)
48
+ if self.data_source == 'googlebigquery':
49
+ from google.cloud.bigquery.client import Client
50
+ os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = self.config['db']
51
+ self.conn = Client()
52
+ print("db connection is done!")
53
+
54
+ def read_csv(self, f, partition=False):
55
+ _data = pd.DataFrame()
56
+ try:
57
+ for sep in [',', ';', ':', '|']:
58
+ print(sep)
59
+ _data = pd.read_csv(filepath_or_buffer=f,
60
+ error_bad_lines=False,
61
+ encoding="ISO-8859-1",
62
+ sep=sep,
63
+ nrows=self.nrows)
64
+ if partition:
65
+ _data = pd.read_csv(filepath_or_buffer=f,
66
+ error_bad_lines=False,
67
+ encoding="ISO-8859-1",
68
+ sep=sep,
69
+ nrows=self.nrows, index_col=None, header=0)
70
+ print(_data.head())
71
+ print(len(_data.columns))
72
+ if len(_data.columns) >= 2:
73
+ break
74
+ except Exception as e:
75
+ print(e)
76
+ print("yeeee")
77
+ return _data
78
+
79
+ def query_data_source(self):
80
+ # import data via pandas
81
+ if self.data_source in ['mysql', 'postgresql', 'awsredshift']:
82
+ self.get_connection()
83
+ counter = 0
84
+ try_count = 10 if self.nrows else 100
85
+ while counter < try_count:
86
+ try:
87
+ self.data = pd.read_sql(self.data_query_path + " LIMIT " + str(self.nrows) if self.nrows else self.data_query_path, self.conn)
88
+ except Exception as e:
89
+ print(e)
90
+ if len(self.data) > 0:
91
+ counter = try_count
92
+ counter += 1
93
+ # import data via google
94
+ if self.data_source == 'googlebigquery':
95
+ self.get_connection()
96
+ self.data = self.conn.query(self.data_query_path + " LIMIT " + str(self.nrows) if self.nrows else self.data_query_path).to_dataframe()
97
+
98
+ # import via pandas
99
+ if self.data_source == 'csv':
100
+ li = []
101
+ if self.data_query_path.split(".")[-1] != 'csv':
102
+ _files = glob.glob(join(self.data_query_path, "*.csv"))
103
+ if self.nrows:
104
+ self.data = self.read_csv(self.data_query_path)
105
+ else:
106
+ for f in _files:
107
+ li.append(self.read_csv(f, partition=True))
108
+ self.data = pd.concat(li, axis=0, ignore_index=True)
109
+ else:
110
+ self.data = self.read_csv(self.data_query_path)
111
+
112
+ # import data via pyarrow
113
+ if self.data_source == 'parquet':
114
+ if self.data_query_path.split(".")[-1] == 'parquet':
115
+ if self.nrows:
116
+ self.data = pd.read_parquet(self.data_query_path).iloc[:self.nrows]
117
+ else:
118
+ self.data = pd.read_parquet(self.data_query_path)
119
+ else:
120
+ _files = glob.glob(join(self.data_query_path, "*.parquet"))
121
+ if self.nrows:
122
+ self.data = pd.read_parquet(_files[0]).iloc[:self.nrows]
123
+ else:
124
+ self.data = pd.read_parquet(_files)
125
+
126
+ if self.data_source == 'hdf5':
127
+ if self.data_query_path.split(".")[-1] == 'hdf5':
128
+ if self.nrows:
129
+ self.data = pd.read_hdf(self.data_query_path).iloc[:self.nrows]
130
+ else:
131
+ self.data = pd.read_hdf(self.data_query_path)
132
+ else:
133
+ _files = glob.glob(join(self.data_query_path, "*.h5"))
134
+ if self.nrows:
135
+ self.data = pd.read_hdf(_files[0]).iloc[:self.nrows]
136
+ else:
137
+ self.data = pd.read_hdf(_files)
138
+
139
+ def n_partitions_decision(self):
140
+ if self.data_source == 'dask':
141
+ total_usage_mb = sum(self.data.memory_usage()) / 100000000
142
+ if total_usage_mb < 2:
143
+ self.n_partitions = 3
144
+ else: self.n_partitions = int(total_usage_mb) + 1
145
+
146
+ def use_dask(self):
147
+ self.n_partitions_decision()
148
+ if self.dask:
149
+ if self.nrows is not None:
150
+ self.data = dd.from_pandas(self.data, npartitions=self.n_partitions)
151
+
152
+ def data_execute(self):
153
+ self.query_data_source()
154
+ self.use_dask()
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
@@ -0,0 +1,207 @@
1
+ import sys, os, inspect, logging
2
+ currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
3
+ parentdir = os.path.dirname(currentdir)
4
+ sys.path.insert(0, parentdir)
5
+ import schedule
6
+ import threading
7
+ import time
8
+ import pandas as pd
9
+ from numpy import unique
10
+ from sqlalchemy import create_engine, MetaData
11
+ from os.path import abspath, join
12
+ from flask_login import current_user
13
+
14
+ try:
15
+ from exploratory_analysis.__init__ import create_exploratory_analysis, create_exploratory_analyse
16
+ except Exception as e:
17
+ from customeranalytics.exploratory_analysis import create_exploratory_analysis, create_exploratory_analyse
18
+ try:
19
+ from ml_process.__init__ import create_ml
20
+ except Exception as e:
21
+ from customeranalytics.ml_process import create_ml
22
+
23
+ from customeranalytics.utils import current_date_to_day, convert_to_day, abspath_for_sample_data, read_yaml
24
+ from customeranalytics.configs import query_path, DATA_WORKS_READABLE_FORM
25
+ from customeranalytics.data_storage_configurations.es_create_index import CreateIndex
26
+ from customeranalytics.data_storage_configurations.query_es import QueryES
27
+
28
+
29
+ engine = create_engine('sqlite://///' + join(abspath_for_sample_data(), "web", 'db.sqlite3'), connect_args={'check_same_thread': False})
30
+ metadata = MetaData()
31
+ con = engine.connect()
32
+
33
+
34
+ class DataPipelines:
35
+ def __init__(self,
36
+ es_tag,
37
+ data_connection_structure,
38
+ ea_connection_structure,
39
+ ml_connection_structure,
40
+ data_columns,
41
+ actions):
42
+ """
43
+ :param es_tag: elasticsearch tag name that is created on web interface 'ElasticSearch Configuration' page
44
+ :param data_connection_structure: check :data_configs above
45
+ :param ea_connection_structure: check :ea_configs above
46
+ :param ml_connection_structure: check :ml_configs above
47
+ :param data_columns: check :data_columns above
48
+ :param actions: whole actions which are stored into the actions table in sqlite
49
+ """
50
+ self.es_tag = es_tag
51
+ self.data_connection_structure = data_connection_structure
52
+ self.ea_connection_structure = ea_connection_structure
53
+ self.ml_connection_structure = ml_connection_structure
54
+ self.actions = actions
55
+ self.data_columns = data_columns
56
+ self.es_con = pd.read_sql("select * from es_connection", con).to_dict('records')[-1]
57
+ self.create_index = CreateIndex(data_connection_structure=data_connection_structure,
58
+ data_columns=data_columns, actions=actions)
59
+ self.query_es = QueryES(host=self.es_con['host'], port=self.es_con['port'])
60
+ self.unique_dimensions = []
61
+ self.schedule = True
62
+ self.sqlite_queries = read_yaml(query_path, "queries.yaml")
63
+ self.tables = pd.read_sql(self.sqlite_queries['tables'], con)
64
+ self.separator = lambda dim: [print("*" * 20) for i in range(3)] + [
65
+ print("*" * 10, " ", " DIMENSION : ", dim, "*" * 10)]
66
+ self.info_logs_for_chat = lambda info: {'user': 'info',
67
+ 'date': str(current_date_to_day())[0:19],
68
+ 'user_logo': 'info.jpeg',
69
+ 'chat_type': 'info', 'chart': '',
70
+ 'general_message': info, 'message': ''}
71
+ self.suc_log_for_ea = """
72
+ Exploratory Analysis are Created! Check Funnel, Cohort,
73
+ Descriptive Stats sections.
74
+ """
75
+ self.suc_log_for_data_works = lambda x: " {0} is created! Check {0} sections. ".format(
76
+ DATA_WORKS_READABLE_FORM[x])
77
+ self.fail_log_for_data_works = lambda x, e: " {0} is failed! Check {0} sections. - {1}".format(
78
+ DATA_WORKS_READABLE_FORM[x], e)
79
+
80
+ def check_for_table_exits(self, table):
81
+ """
82
+ checking sqlite if table is created before. If it not, table is created.
83
+ :params table: checking table name in sqlite
84
+ """
85
+
86
+ try:
87
+ if table not in list(self.tables['name']):
88
+ con.execute(self.sqlite_queries[table])
89
+ except Exception as e: print(e)
90
+
91
+ def insert_query(self, table, columns, values):
92
+ """
93
+ insert sqlite tables with given table column and values
94
+
95
+ :param table: tables to be inserted the row
96
+ :param columns: tables of columns (all columns)
97
+ :param values: values for each column in the table
98
+ """
99
+ values = [values[col] for col in columns]
100
+ _query = "INSERT INTO " + table + " "
101
+ _query += " (" + ", ".join(columns) + ") "
102
+ _query += " VALUES (" + ", ".join([" '{}' ".format(v) for v in values]) + ") "
103
+ _query = _query.replace("\\", "")
104
+ return _query
105
+
106
+ def logs_update(self, logs):
107
+ """
108
+ logs table in sqlite table is updated.
109
+ chats table in sqlite table is updated.
110
+ """
111
+ try: self.check_for_table_exits(table='logs')
112
+ except Exception as e: print(e)
113
+
114
+ try: self.check_for_table_exits(table='chat')
115
+ except Exception as e: print(e)
116
+
117
+ try:
118
+ logs['login_user'] = current_user
119
+ logs['log_time'] = str(current_date_to_day())[0:19]
120
+ con.execute(self.insert_query(table='logs',
121
+ columns=self.sqlite_queries['columns']['logs'][1:],
122
+ values=logs
123
+ ))
124
+ except Exception as e: print(e)
125
+
126
+ try:
127
+ con.execute(self.insert_query(table='chat', columns=self.sqlite_queries['columns']['chat'][1:],
128
+ values=self.info_logs_for_chat(logs['info'])))
129
+ except Exception as e: print(e)
130
+
131
+ def info_log_create(self, type, dim=None):
132
+ """
133
+ Logging system on creating E.A. or ML Works. This print processes are also shown at profile.html activities.
134
+ This gives the information of the process are done.
135
+ """
136
+ _info = self.suc_log_for_data_works(type)
137
+ if dim is not None:
138
+ _info += " || dimension : " + dim
139
+ print("-- Process Info --")
140
+ print(_info)
141
+ self.logs_update(logs={"page": "data-execute", "info": _info, "color": "green"})
142
+
143
+ def fail_log_create(self, e, type, dim=None):
144
+ """
145
+ Logging system on creating E.A. or ML Works. This print processes are also shown at profile.html activities.
146
+ This gives the information of the process are failed.
147
+ """
148
+ e_str = ''
149
+ if e is not None:
150
+ e_str = str(e)
151
+ e_str = e_str[:min(len(e_str), 100)]
152
+ fail_message = self.fail_log_for_data_works(type, e_str)
153
+ if dim is not None:
154
+ fail_message += " || dimension : " + dim
155
+ print(" FAIL ---- !!!!!!!!")
156
+ print("-- message :", fail_message)
157
+ print(" ----- description ::::::", e_str)
158
+ self.logs_update(logs={"page": "data-execute",
159
+ "info": fail_message.replace("'", " "),
160
+ "color": "red"})
161
+
162
+ def execute_pipe(self, _conf, execution, type, dim=None):
163
+ try:
164
+ execution(_conf, type)
165
+ self.info_log_create(type=type)
166
+ except Exception as e:
167
+ print(e)
168
+ self.fail_log_create(e=e, type=type, dim=dim)
169
+
170
+ def pipe_1(self, ml_connection_structure, ea_connection_structure, dim=None):
171
+ self.execute_pipe(ml_connection_structure, create_ml, 'clv_prediction')
172
+
173
+ def pipe_2(self, ml_connection_structure, ea_connection_structure, dim=None):
174
+ self.execute_pipe(ea_connection_structure, create_exploratory_analyse, 'rfm', dim=dim)
175
+ self.execute_pipe(ml_connection_structure, create_ml, 'segmentation', dim=dim)
176
+
177
+ def pipe_3(self, ml_connection_structure, ea_connection_structure, dim=None):
178
+ self.execute_pipe(ea_connection_structure, create_exploratory_analyse, 'funnel', dim=dim)
179
+ self.execute_pipe(ea_connection_structure, create_exploratory_analyse, 'cohort', dim=dim)
180
+
181
+ def pipe_4(self, ml_connection_structure, ea_connection_structure, dim=None):
182
+ self.execute_pipe(ea_connection_structure, create_exploratory_analyse, 'stats', dim=dim)
183
+ self.execute_pipe(ea_connection_structure, create_exploratory_analyse, 'churn', dim=dim)
184
+
185
+ def pipe_5(self, ml_connection_structure, ea_connection_structure, dim=None):
186
+ self.execute_pipe(ml_connection_structure, create_ml, 'abtest', dim=dim)
187
+ self.execute_pipe(ea_connection_structure, create_exploratory_analyse, 'products', dim=dim)
188
+ self.execute_pipe(ea_connection_structure, create_exploratory_analyse, 'promotions', dim=dim)
189
+
190
+ def pipe_6(self, ml_connection_structure, ea_connection_structure, dim=None):
191
+ self.execute_pipe(ml_connection_structure, create_ml, 'anomaly', dim=dim)
192
+ self.execute_pipe(ml_connection_structure, create_ml, 'delivery_anomaly', dim=dim)
193
+
194
+ def data_work_pipelines_execution(self, ml_connection_structure, ea_connection_structure, dim=None):
195
+ _kwargs = {"ml_connection_structure": ml_connection_structure,
196
+ 'ea_connection_structure': ea_connection_structure, 'dim': dim}
197
+ if dim is None:
198
+ self.pipe_1(**_kwargs)
199
+ self.pipe_2(**_kwargs)
200
+ pipes = [self.pipe_3, self.pipe_4]
201
+ for pipe in pipes:
202
+ process = threading.Thread(target=pipe, kwargs=_kwargs)
203
+ process.daemon = True
204
+ process.start()
205
+ process.join()
206
+ self.pipe_5(**_kwargs)
207
+ self.pipe_6(**_kwargs)