mbu-dev-shared-components 0.3.1__tar.gz → 0.3.3__tar.gz

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 (42) hide show
  1. mbu_dev_shared_components-0.3.3/PKG-INFO +79 -0
  2. mbu_dev_shared_components-0.3.3/README.md +60 -0
  3. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/solteqtand/db_handler.py +46 -15
  4. mbu_dev_shared_components-0.3.3/mbu_dev_shared_components.egg-info/PKG-INFO +79 -0
  5. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/pyproject.toml +1 -1
  6. mbu_dev_shared_components-0.3.1/PKG-INFO +0 -45
  7. mbu_dev_shared_components-0.3.1/README.md +0 -26
  8. mbu_dev_shared_components-0.3.1/mbu_dev_shared_components.egg-info/PKG-INFO +0 -45
  9. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/LICENSE +0 -0
  10. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/getorganized/__init__.py +0 -0
  11. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/getorganized/auth.py +0 -0
  12. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/getorganized/cases.py +0 -0
  13. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/getorganized/contacts.py +0 -0
  14. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/getorganized/documents.py +0 -0
  15. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/getorganized/objects.py +0 -0
  16. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/google/__init__.py +0 -0
  17. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/google/api/__init__.py +0 -0
  18. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/google/api/auth.py +0 -0
  19. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/google/workspace/__init__.py +0 -0
  20. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/google/workspace/alerts.py +0 -0
  21. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/msoffice365/__init__.py +0 -0
  22. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/msoffice365/excel/__init__.py +0 -0
  23. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/msoffice365/excel/excel_reader.py +0 -0
  24. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/msoffice365/sharepoint_api/__init__.py +0 -0
  25. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/msoffice365/sharepoint_api/files.py +0 -0
  26. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/os2forms/__init__.py +0 -0
  27. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/os2forms/documents.py +0 -0
  28. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/os2forms/forms.py +0 -0
  29. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/sap/__init__.py +0 -0
  30. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/sap/create_invoice.py +0 -0
  31. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/solteqtand/__init__.py +0 -0
  32. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/solteqtand/app_handler.py +0 -0
  33. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/utils/__init__.py +0 -0
  34. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/utils/db_stored_procedure_executor.py +0 -0
  35. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/utils/fernet_encryptor.py +0 -0
  36. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/utils/file_handler.py +0 -0
  37. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components/utils/json_handler.py +0 -0
  38. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components.egg-info/SOURCES.txt +0 -0
  39. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components.egg-info/dependency_links.txt +0 -0
  40. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components.egg-info/requires.txt +0 -0
  41. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/mbu_dev_shared_components.egg-info/top_level.txt +0 -0
  42. {mbu_dev_shared_components-0.3.1 → mbu_dev_shared_components-0.3.3}/setup.cfg +0 -0
@@ -0,0 +1,79 @@
1
+ Metadata-Version: 2.2
2
+ Name: mbu_dev_shared_components
3
+ Version: 0.3.3
4
+ Summary: Shared components to use in RPA projects
5
+ Author-email: MBU <rpa@mbu.aarhus.dk>
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: Microsoft :: Windows
9
+ Requires-Python: >=3.7
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: openpyxl>=3.1.2
13
+ Requires-Dist: pyodbc>=5.1.0
14
+ Requires-Dist: requests_ntlm>=1.2.0
15
+ Requires-Dist: python-dateutil==2.9.*
16
+ Requires-Dist: cryptography>=43.0.0
17
+ Requires-Dist: office365-rest-python-client
18
+ Requires-Dist: uiautomation
19
+
20
+ # MBU Dev Shared Components
21
+
22
+ [![PyPI version](https://badge.fury.io/py/mbu-dev-shared-components.svg)](https://badge.fury.io/py/mbu-dev-shared-components)
23
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
24
+
25
+ ## Overview
26
+
27
+ MBU Dev Shared Components is a Python library that provides helper modules to streamline Robotic Process Automation (RPA) development.
28
+
29
+ ## Features
30
+
31
+ - **Office365 Integration**:
32
+ - SharePoint
33
+ - Excel
34
+ - **SAP Integration**
35
+ - **Solteq Tand Integration**
36
+ - **Utility Modules**:
37
+ - JSON handling
38
+ - Fernet encryption
39
+
40
+ ## Installation
41
+
42
+ Install the package using pip:
43
+
44
+ ```bash
45
+ pip install mbu-dev-shared-components
46
+
47
+
48
+ # Dynamic SQL Query Builder
49
+
50
+ This repository provides a **generic function** to dynamically build SQL `WHERE` clauses using filters. It supports:
51
+
52
+ - **Equality (`=`)**
53
+ - **LIKE (`%search%`)**
54
+ - **IN (`column IN (value1, value2, ...)`)**
55
+ - **BETWEEN (`column BETWEEN value1 AND value2`)**
56
+ - **AND & OR Conditions**
57
+ - **ORDER BY (`ORDER BY column ASC/DESC`)**
58
+
59
+ ---
60
+
61
+ ## 📌 How to Use the `check_if_event_exists` Function
62
+
63
+ | **Usage Type** | **Example Function Call** | **Generated SQL WHERE Clause** |
64
+ |--------------|--------------------------------------|--------------------------------------------|
65
+ | **1. Basic Equality Filtering** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_name": "Some Clinic"}) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_name = ?` |
66
+ | **2. LIKE Filtering** (Partial Match) | ```python self.check_if_event_exists(filters={"e.event_name": "%Clinic%"}) ``` | `WHERE 1=1 AND e.event_name LIKE ?` |
67
+ | **3. IN Filtering** (Multiple Values) | ```python self.check_if_event_exists(filters={"e.event_message": ["Scheduled", "Pending"]}) ``` | `WHERE 1=1 AND e.event_message IN (?, ?)` |
68
+ | **4. BETWEEN Filtering** (Range) | ```python self.check_if_event_exists(filters={"e.eventTriggerDate": ("2024-01-01", "2024-12-31")}) ``` | `WHERE 1=1 AND e.eventTriggerDate BETWEEN ? AND ?` |
69
+ | **5. Multiple AND Conditions** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_message": "Scheduled", "e.archived": 0}) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_message = ? AND e.archived = ?` |
70
+ | **6. OR Conditions (Single Group)** | ```python self.check_if_event_exists(or_filters=[{"e.event_name": "Clinic A"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND (e.event_name = ? OR e.event_name = ?)` |
71
+ | **7. OR with Multiple Conditions** | ```python self.check_if_event_exists(or_filters=[{"e.event_name": "Clinic A", "e.event_message": "Scheduled"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND ((e.event_name = ? AND e.event_message = ?) OR (e.event_name = ?))` |
72
+ | **8. AND & OR Combined** | ```python self.check_if_event_exists(filters={"e.archived": 0}, or_filters=[{"e.event_name": "Clinic A"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND e.archived = ? AND (e.event_name = ? OR e.event_name = ?)` |
73
+ | **9. LIKE with OR** | ```python self.check_if_event_exists(or_filters=[{"e.event_message": "%Scheduled%"}, {"e.event_message": "%Pending%"}]) ``` | `WHERE 1=1 AND (e.event_message LIKE ? OR e.event_message LIKE ?)` |
74
+ | **10. Complex AND, OR, LIKE, IN Combined** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_message": ["Scheduled", "Pending"]}, or_filters=[{"e.event_name": "%Hospital%"}, {"e.event_name": "%Clinic%"}]) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_message IN (?, ?) AND (e.event_name LIKE ? OR e.event_name LIKE ?)` |
75
+ | **11. ORDER BY (Ascending)** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890"}, order_by="e.timestamp", order_direction="ASC") ``` | `WHERE 1=1 AND p.cpr = ? ORDER BY e.timestamp ASC` |
76
+ | **12. ORDER BY (Descending)** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890"}, order_by="e.timestamp", order_direction="DESC") ``` | `WHERE 1=1 AND p.cpr = ? ORDER BY e.timestamp DESC` |
77
+ | **13. ORDER BY with Multiple Filters** | ```python self.check_if_event_exists(filters={"e.event_message": "Scheduled"}, order_by="e.eventTriggerDate", order_direction="DESC") ``` | `WHERE 1=1 AND e.event_message = ? ORDER BY e.eventTriggerDate DESC` |
78
+
79
+ ---
@@ -0,0 +1,60 @@
1
+ # MBU Dev Shared Components
2
+
3
+ [![PyPI version](https://badge.fury.io/py/mbu-dev-shared-components.svg)](https://badge.fury.io/py/mbu-dev-shared-components)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ ## Overview
7
+
8
+ MBU Dev Shared Components is a Python library that provides helper modules to streamline Robotic Process Automation (RPA) development.
9
+
10
+ ## Features
11
+
12
+ - **Office365 Integration**:
13
+ - SharePoint
14
+ - Excel
15
+ - **SAP Integration**
16
+ - **Solteq Tand Integration**
17
+ - **Utility Modules**:
18
+ - JSON handling
19
+ - Fernet encryption
20
+
21
+ ## Installation
22
+
23
+ Install the package using pip:
24
+
25
+ ```bash
26
+ pip install mbu-dev-shared-components
27
+
28
+
29
+ # Dynamic SQL Query Builder
30
+
31
+ This repository provides a **generic function** to dynamically build SQL `WHERE` clauses using filters. It supports:
32
+
33
+ - **Equality (`=`)**
34
+ - **LIKE (`%search%`)**
35
+ - **IN (`column IN (value1, value2, ...)`)**
36
+ - **BETWEEN (`column BETWEEN value1 AND value2`)**
37
+ - **AND & OR Conditions**
38
+ - **ORDER BY (`ORDER BY column ASC/DESC`)**
39
+
40
+ ---
41
+
42
+ ## 📌 How to Use the `check_if_event_exists` Function
43
+
44
+ | **Usage Type** | **Example Function Call** | **Generated SQL WHERE Clause** |
45
+ |--------------|--------------------------------------|--------------------------------------------|
46
+ | **1. Basic Equality Filtering** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_name": "Some Clinic"}) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_name = ?` |
47
+ | **2. LIKE Filtering** (Partial Match) | ```python self.check_if_event_exists(filters={"e.event_name": "%Clinic%"}) ``` | `WHERE 1=1 AND e.event_name LIKE ?` |
48
+ | **3. IN Filtering** (Multiple Values) | ```python self.check_if_event_exists(filters={"e.event_message": ["Scheduled", "Pending"]}) ``` | `WHERE 1=1 AND e.event_message IN (?, ?)` |
49
+ | **4. BETWEEN Filtering** (Range) | ```python self.check_if_event_exists(filters={"e.eventTriggerDate": ("2024-01-01", "2024-12-31")}) ``` | `WHERE 1=1 AND e.eventTriggerDate BETWEEN ? AND ?` |
50
+ | **5. Multiple AND Conditions** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_message": "Scheduled", "e.archived": 0}) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_message = ? AND e.archived = ?` |
51
+ | **6. OR Conditions (Single Group)** | ```python self.check_if_event_exists(or_filters=[{"e.event_name": "Clinic A"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND (e.event_name = ? OR e.event_name = ?)` |
52
+ | **7. OR with Multiple Conditions** | ```python self.check_if_event_exists(or_filters=[{"e.event_name": "Clinic A", "e.event_message": "Scheduled"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND ((e.event_name = ? AND e.event_message = ?) OR (e.event_name = ?))` |
53
+ | **8. AND & OR Combined** | ```python self.check_if_event_exists(filters={"e.archived": 0}, or_filters=[{"e.event_name": "Clinic A"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND e.archived = ? AND (e.event_name = ? OR e.event_name = ?)` |
54
+ | **9. LIKE with OR** | ```python self.check_if_event_exists(or_filters=[{"e.event_message": "%Scheduled%"}, {"e.event_message": "%Pending%"}]) ``` | `WHERE 1=1 AND (e.event_message LIKE ? OR e.event_message LIKE ?)` |
55
+ | **10. Complex AND, OR, LIKE, IN Combined** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_message": ["Scheduled", "Pending"]}, or_filters=[{"e.event_name": "%Hospital%"}, {"e.event_name": "%Clinic%"}]) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_message IN (?, ?) AND (e.event_name LIKE ? OR e.event_name LIKE ?)` |
56
+ | **11. ORDER BY (Ascending)** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890"}, order_by="e.timestamp", order_direction="ASC") ``` | `WHERE 1=1 AND p.cpr = ? ORDER BY e.timestamp ASC` |
57
+ | **12. ORDER BY (Descending)** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890"}, order_by="e.timestamp", order_direction="DESC") ``` | `WHERE 1=1 AND p.cpr = ? ORDER BY e.timestamp DESC` |
58
+ | **13. ORDER BY with Multiple Filters** | ```python self.check_if_event_exists(filters={"e.event_message": "Scheduled"}, order_by="e.eventTriggerDate", order_direction="DESC") ``` | `WHERE 1=1 AND e.event_message = ? ORDER BY e.eventTriggerDate DESC` |
59
+
60
+ ---
@@ -5,8 +5,6 @@ an interface to interact with the Solteq Tand database.
5
5
  import pyodbc
6
6
 
7
7
 
8
- HUSK ORDER BY!!!!!
9
-
10
8
  class SolteqTandDatabase:
11
9
  """Handles database operations related to the Solteq Tand system."""
12
10
 
@@ -40,7 +38,7 @@ class SolteqTandDatabase:
40
38
 
41
39
  return result
42
40
 
43
- def _construct_sql_statement(self, base_query, filters=None, or_filters=None): # noqa
41
+ def _construct_sql_statement(self, base_query, filters=None, or_filters=None, order_by=None, order_direction="ASC"): # noqa
44
42
  """
45
43
  Dynamically constructs a SQL query by applying filters.
46
44
 
@@ -102,9 +100,14 @@ class SolteqTandDatabase:
102
100
  if or_clauses:
103
101
  base_query += " AND (" + " OR ".join(or_clauses) + ")"
104
102
 
103
+ # Adding ORDER BY clause
104
+ if order_by:
105
+ order_direction = "ASC" if order_direction.upper() not in ["ASC", "DESC"] else order_direction.upper()
106
+ base_query += f" ORDER BY {order_by} {order_direction}"
107
+
105
108
  return base_query, params
106
109
 
107
- def get_list_of_documents(self, filters=None, or_filters=None):
110
+ def get_list_of_documents(self, filters=None, or_filters=None, order_by=None, order_direction="ASC"):
108
111
  """
109
112
  Retrieves a list of documents based on the specified filters.
110
113
 
@@ -153,10 +156,10 @@ class SolteqTandDatabase:
153
156
  JOIN LatestActiveDocuments ds ON ds.entityId = p.patientId
154
157
  WHERE 1=1
155
158
  """
156
- final_query, params = self._construct_sql_statement(base_query, filters, or_filters)
159
+ final_query, params = self._construct_sql_statement(base_query, filters, or_filters, order_by, order_direction)
157
160
  return self._execute_query(final_query, params)
158
161
 
159
- def get_list_of_extern_dentist(self, filters=None, or_filters=None):
162
+ def get_list_of_extern_dentist(self, filters=None, or_filters=None, order_by=None, order_direction="ASC"):
160
163
  """
161
164
  Retrieves a list of external dentists associated with the patient.
162
165
 
@@ -181,10 +184,10 @@ class SolteqTandDatabase:
181
184
  JOIN [CLINIC] c on c.clinicId = p.privateClinicId
182
185
  WHERE 1=1
183
186
  """
184
- final_query, params = self._construct_sql_statement(base_query, filters, or_filters)
187
+ final_query, params = self._construct_sql_statement(base_query, filters, or_filters, order_by, order_direction)
185
188
  return self._execute_query(final_query, params)
186
189
 
187
- def get_list_of_bookings(self, filters=None, or_filters=None):
190
+ def get_list_of_bookings(self, filters=None, or_filters=None, order_by=None, order_direction="ASC"):
188
191
  """
189
192
  Retrieves a list of bookings for the specified patient.
190
193
 
@@ -211,10 +214,10 @@ class SolteqTandDatabase:
211
214
  JOIN BOOKINGTYPE bt on bt.BookingTypeID = b.BookingTypeID
212
215
  WHERE 1=1
213
216
  """
214
- final_query, params = self._construct_sql_statement(base_query, filters, or_filters)
217
+ final_query, params = self._construct_sql_statement(base_query, filters, or_filters, order_by, order_direction)
215
218
  return self._execute_query(final_query, params)
216
219
 
217
- def get_list_of_events(self, filters=None, or_filters=None):
220
+ def get_list_of_events(self, filters=None, or_filters=None, order_by=None, order_direction="ASC"):
218
221
  """
219
222
  Retrieves a list of events related to the patient.
220
223
 
@@ -242,10 +245,10 @@ class SolteqTandDatabase:
242
245
  JOIN [CLINIC] c ON c.clinicId = e.clinicId
243
246
  WHERE 1=1
244
247
  """
245
- final_query, params = self._construct_sql_statement(base_query, filters, or_filters)
248
+ final_query, params = self._construct_sql_statement(base_query, filters, or_filters, order_by, order_direction)
246
249
  return self._execute_query(final_query, params)
247
250
 
248
- def get_list_of_primary_dental_clinics(self, filters=None, or_filters=None):
251
+ def get_list_of_primary_dental_clinics(self, filters=None, or_filters=None, order_by=None, order_direction="ASC"):
249
252
  """
250
253
  Retrieves details of the primary dental clinics associated with the patient.
251
254
 
@@ -268,10 +271,10 @@ class SolteqTandDatabase:
268
271
  JOIN [CLINIC] c ON c.clinicId = p.preferredDentalClinicId
269
272
  WHERE 1=1
270
273
  """
271
- final_query, params = self._construct_sql_statement(base_query, filters, or_filters)
274
+ final_query, params = self._construct_sql_statement(base_query, filters, or_filters, order_by, order_direction)
272
275
  return self._execute_query(final_query, params)
273
276
 
274
- def get_list_of_journal_notes(self, filters=None, or_filters=None):
277
+ def get_list_of_journal_notes(self, filters=None, or_filters=None, order_by=None, order_direction="ASC"):
275
278
  """
276
279
  Retrieves journal notes associated with the specified patient.
277
280
 
@@ -301,5 +304,33 @@ class SolteqTandDatabase:
301
304
  PATIENT p ON p.patientId = f.patientId
302
305
  WHERE 1=1
303
306
  """
304
- final_query, params = self._construct_sql_statement(base_query, filters, or_filters)
307
+ final_query, params = self._construct_sql_statement(base_query, filters, or_filters, order_by, order_direction)
308
+ return self._execute_query(final_query, params)
309
+
310
+ def get_list_of_clinict(self, filters=None, or_filters=None, order_by=None, order_direction="ASC"):
311
+ """
312
+ Retrieves a list of clinics.
313
+
314
+ Args:
315
+ filters (dict, optional): Filtering criteria for external dentists.
316
+ or_filters (list of dict, optional): OR conditions for filtering.
317
+
318
+ Returns:
319
+ list: A list of external dentist records.
320
+ """
321
+ base_query = """
322
+ SELECT
323
+ clinicId
324
+ ,name
325
+ ,type
326
+ ,streetAddress
327
+ ,countyCode
328
+ ,zip
329
+ ,phoneNumber
330
+ ,contractorId
331
+ FROM
332
+ [tmtdata_prod].[dbo].[CLINIC]
333
+ WHERE 1=1
334
+ """
335
+ final_query, params = self._construct_sql_statement(base_query, filters, or_filters, order_by, order_direction)
305
336
  return self._execute_query(final_query, params)
@@ -0,0 +1,79 @@
1
+ Metadata-Version: 2.2
2
+ Name: mbu_dev_shared_components
3
+ Version: 0.3.3
4
+ Summary: Shared components to use in RPA projects
5
+ Author-email: MBU <rpa@mbu.aarhus.dk>
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: Microsoft :: Windows
9
+ Requires-Python: >=3.7
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: openpyxl>=3.1.2
13
+ Requires-Dist: pyodbc>=5.1.0
14
+ Requires-Dist: requests_ntlm>=1.2.0
15
+ Requires-Dist: python-dateutil==2.9.*
16
+ Requires-Dist: cryptography>=43.0.0
17
+ Requires-Dist: office365-rest-python-client
18
+ Requires-Dist: uiautomation
19
+
20
+ # MBU Dev Shared Components
21
+
22
+ [![PyPI version](https://badge.fury.io/py/mbu-dev-shared-components.svg)](https://badge.fury.io/py/mbu-dev-shared-components)
23
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
24
+
25
+ ## Overview
26
+
27
+ MBU Dev Shared Components is a Python library that provides helper modules to streamline Robotic Process Automation (RPA) development.
28
+
29
+ ## Features
30
+
31
+ - **Office365 Integration**:
32
+ - SharePoint
33
+ - Excel
34
+ - **SAP Integration**
35
+ - **Solteq Tand Integration**
36
+ - **Utility Modules**:
37
+ - JSON handling
38
+ - Fernet encryption
39
+
40
+ ## Installation
41
+
42
+ Install the package using pip:
43
+
44
+ ```bash
45
+ pip install mbu-dev-shared-components
46
+
47
+
48
+ # Dynamic SQL Query Builder
49
+
50
+ This repository provides a **generic function** to dynamically build SQL `WHERE` clauses using filters. It supports:
51
+
52
+ - **Equality (`=`)**
53
+ - **LIKE (`%search%`)**
54
+ - **IN (`column IN (value1, value2, ...)`)**
55
+ - **BETWEEN (`column BETWEEN value1 AND value2`)**
56
+ - **AND & OR Conditions**
57
+ - **ORDER BY (`ORDER BY column ASC/DESC`)**
58
+
59
+ ---
60
+
61
+ ## 📌 How to Use the `check_if_event_exists` Function
62
+
63
+ | **Usage Type** | **Example Function Call** | **Generated SQL WHERE Clause** |
64
+ |--------------|--------------------------------------|--------------------------------------------|
65
+ | **1. Basic Equality Filtering** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_name": "Some Clinic"}) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_name = ?` |
66
+ | **2. LIKE Filtering** (Partial Match) | ```python self.check_if_event_exists(filters={"e.event_name": "%Clinic%"}) ``` | `WHERE 1=1 AND e.event_name LIKE ?` |
67
+ | **3. IN Filtering** (Multiple Values) | ```python self.check_if_event_exists(filters={"e.event_message": ["Scheduled", "Pending"]}) ``` | `WHERE 1=1 AND e.event_message IN (?, ?)` |
68
+ | **4. BETWEEN Filtering** (Range) | ```python self.check_if_event_exists(filters={"e.eventTriggerDate": ("2024-01-01", "2024-12-31")}) ``` | `WHERE 1=1 AND e.eventTriggerDate BETWEEN ? AND ?` |
69
+ | **5. Multiple AND Conditions** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_message": "Scheduled", "e.archived": 0}) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_message = ? AND e.archived = ?` |
70
+ | **6. OR Conditions (Single Group)** | ```python self.check_if_event_exists(or_filters=[{"e.event_name": "Clinic A"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND (e.event_name = ? OR e.event_name = ?)` |
71
+ | **7. OR with Multiple Conditions** | ```python self.check_if_event_exists(or_filters=[{"e.event_name": "Clinic A", "e.event_message": "Scheduled"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND ((e.event_name = ? AND e.event_message = ?) OR (e.event_name = ?))` |
72
+ | **8. AND & OR Combined** | ```python self.check_if_event_exists(filters={"e.archived": 0}, or_filters=[{"e.event_name": "Clinic A"}, {"e.event_name": "Clinic B"}]) ``` | `WHERE 1=1 AND e.archived = ? AND (e.event_name = ? OR e.event_name = ?)` |
73
+ | **9. LIKE with OR** | ```python self.check_if_event_exists(or_filters=[{"e.event_message": "%Scheduled%"}, {"e.event_message": "%Pending%"}]) ``` | `WHERE 1=1 AND (e.event_message LIKE ? OR e.event_message LIKE ?)` |
74
+ | **10. Complex AND, OR, LIKE, IN Combined** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890", "e.event_message": ["Scheduled", "Pending"]}, or_filters=[{"e.event_name": "%Hospital%"}, {"e.event_name": "%Clinic%"}]) ``` | `WHERE 1=1 AND p.cpr = ? AND e.event_message IN (?, ?) AND (e.event_name LIKE ? OR e.event_name LIKE ?)` |
75
+ | **11. ORDER BY (Ascending)** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890"}, order_by="e.timestamp", order_direction="ASC") ``` | `WHERE 1=1 AND p.cpr = ? ORDER BY e.timestamp ASC` |
76
+ | **12. ORDER BY (Descending)** | ```python self.check_if_event_exists(filters={"p.cpr": "123456-7890"}, order_by="e.timestamp", order_direction="DESC") ``` | `WHERE 1=1 AND p.cpr = ? ORDER BY e.timestamp DESC` |
77
+ | **13. ORDER BY with Multiple Filters** | ```python self.check_if_event_exists(filters={"e.event_message": "Scheduled"}, order_by="e.eventTriggerDate", order_direction="DESC") ``` | `WHERE 1=1 AND e.event_message = ? ORDER BY e.eventTriggerDate DESC` |
78
+
79
+ ---
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mbu_dev_shared_components"
7
- version = "0.3.1" # Specify the version manually here
7
+ version = "0.3.3" # Specify the version manually here
8
8
  authors = [
9
9
  { name="MBU", email="rpa@mbu.aarhus.dk" },
10
10
  ]
@@ -1,45 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: mbu_dev_shared_components
3
- Version: 0.3.1
4
- Summary: Shared components to use in RPA projects
5
- Author-email: MBU <rpa@mbu.aarhus.dk>
6
- Classifier: Programming Language :: Python :: 3
7
- Classifier: License :: OSI Approved :: MIT License
8
- Classifier: Operating System :: Microsoft :: Windows
9
- Requires-Python: >=3.7
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- Requires-Dist: openpyxl>=3.1.2
13
- Requires-Dist: pyodbc>=5.1.0
14
- Requires-Dist: requests_ntlm>=1.2.0
15
- Requires-Dist: python-dateutil==2.9.*
16
- Requires-Dist: cryptography>=43.0.0
17
- Requires-Dist: office365-rest-python-client
18
- Requires-Dist: uiautomation
19
-
20
- # MBU Dev Shared Components
21
-
22
- [![PyPI version](https://badge.fury.io/py/mbu-dev-shared-components.svg)](https://badge.fury.io/py/mbu-dev-shared-components)
23
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
24
-
25
- ## Overview
26
-
27
- MBU Dev Shared Components is a Python library that provides helper modules to streamline Robotic Process Automation (RPA) development.
28
-
29
- ## Features
30
-
31
- - **Office365 Integration**:
32
- - SharePoint
33
- - Excel
34
- - **SAP Integration**
35
- - **Solteq Tand Integration**
36
- - **Utility Modules**:
37
- - JSON handling
38
- - Fernet encryption
39
-
40
- ## Installation
41
-
42
- Install the package using pip:
43
-
44
- ```bash
45
- pip install mbu-dev-shared-components
@@ -1,26 +0,0 @@
1
- # MBU Dev Shared Components
2
-
3
- [![PyPI version](https://badge.fury.io/py/mbu-dev-shared-components.svg)](https://badge.fury.io/py/mbu-dev-shared-components)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
-
6
- ## Overview
7
-
8
- MBU Dev Shared Components is a Python library that provides helper modules to streamline Robotic Process Automation (RPA) development.
9
-
10
- ## Features
11
-
12
- - **Office365 Integration**:
13
- - SharePoint
14
- - Excel
15
- - **SAP Integration**
16
- - **Solteq Tand Integration**
17
- - **Utility Modules**:
18
- - JSON handling
19
- - Fernet encryption
20
-
21
- ## Installation
22
-
23
- Install the package using pip:
24
-
25
- ```bash
26
- pip install mbu-dev-shared-components
@@ -1,45 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: mbu_dev_shared_components
3
- Version: 0.3.1
4
- Summary: Shared components to use in RPA projects
5
- Author-email: MBU <rpa@mbu.aarhus.dk>
6
- Classifier: Programming Language :: Python :: 3
7
- Classifier: License :: OSI Approved :: MIT License
8
- Classifier: Operating System :: Microsoft :: Windows
9
- Requires-Python: >=3.7
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- Requires-Dist: openpyxl>=3.1.2
13
- Requires-Dist: pyodbc>=5.1.0
14
- Requires-Dist: requests_ntlm>=1.2.0
15
- Requires-Dist: python-dateutil==2.9.*
16
- Requires-Dist: cryptography>=43.0.0
17
- Requires-Dist: office365-rest-python-client
18
- Requires-Dist: uiautomation
19
-
20
- # MBU Dev Shared Components
21
-
22
- [![PyPI version](https://badge.fury.io/py/mbu-dev-shared-components.svg)](https://badge.fury.io/py/mbu-dev-shared-components)
23
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
24
-
25
- ## Overview
26
-
27
- MBU Dev Shared Components is a Python library that provides helper modules to streamline Robotic Process Automation (RPA) development.
28
-
29
- ## Features
30
-
31
- - **Office365 Integration**:
32
- - SharePoint
33
- - Excel
34
- - **SAP Integration**
35
- - **Solteq Tand Integration**
36
- - **Utility Modules**:
37
- - JSON handling
38
- - Fernet encryption
39
-
40
- ## Installation
41
-
42
- Install the package using pip:
43
-
44
- ```bash
45
- pip install mbu-dev-shared-components