DataOpsHub 6.6.12__tar.gz → 6.6.14__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.
- {dataopshub-6.6.12 → dataopshub-6.6.14}/DataOpsHub/__init__.py +1 -1
- dataopshub-6.6.14/DataOpsHub/constants/__init__.py +29 -0
- dataopshub-6.6.14/DataOpsHub/constants/error_messages.py +30 -0
- dataopshub-6.6.14/DataOpsHub/constants/table_mappings.py +15 -0
- dataopshub-6.6.14/DataOpsHub/data_entry_forms/__init__.py +34 -0
- dataopshub-6.6.14/DataOpsHub/data_entry_forms/forms/__init__.py +13 -0
- dataopshub-6.6.14/DataOpsHub/data_entry_forms/forms/forms.py +138 -0
- dataopshub-6.6.14/DataOpsHub/data_entry_forms/validators/__init__.py +53 -0
- dataopshub-6.6.14/DataOpsHub/data_entry_forms/validators/form_field_validations.py +621 -0
- dataopshub-6.6.14/DataOpsHub/databases/__init__.py +10 -0
- dataopshub-6.6.14/DataOpsHub/databases/database_handler.py +986 -0
- dataopshub-6.6.14/DataOpsHub/databases/database_import_workflow.py +356 -0
- dataopshub-6.6.14/DataOpsHub/databases/deprecated_hardcoded_import_workflow.py +703 -0
- dataopshub-6.6.14/DataOpsHub/models/__init__.py +17 -0
- dataopshub-6.6.14/DataOpsHub/models/base.py +204 -0
- dataopshub-6.6.14/DataOpsHub/models/user.py +344 -0
- dataopshub-6.6.14/DataOpsHub/security/__init__.py +15 -0
- dataopshub-6.6.14/DataOpsHub/security/automated_passwords.py +144 -0
- dataopshub-6.6.14/DataOpsHub/security/config.py +158 -0
- dataopshub-6.6.14/DataOpsHub/security/exceptions.py +322 -0
- dataopshub-6.6.14/DataOpsHub/services/__init__.py +14 -0
- dataopshub-6.6.14/DataOpsHub/services/user_service.py +349 -0
- dataopshub-6.6.14/DataOpsHub/web_automation/webdriver_Firefox-Chrome_setup_test.py +179 -0
- {dataopshub-6.6.12 → dataopshub-6.6.14}/DataOpsHub.egg-info/PKG-INFO +7 -27
- dataopshub-6.6.14/DataOpsHub.egg-info/SOURCES.txt +32 -0
- {dataopshub-6.6.12 → dataopshub-6.6.14}/LICENSE +1 -1
- {dataopshub-6.6.12 → dataopshub-6.6.14}/PKG-INFO +7 -27
- {dataopshub-6.6.12 → dataopshub-6.6.14}/README.md +5 -5
- {dataopshub-6.6.12 → dataopshub-6.6.14}/pyproject.toml +8 -5
- dataopshub-6.6.12/DataOpsHub.egg-info/SOURCES.txt +0 -11
- dataopshub-6.6.12/MANIFEST.in +0 -7
- {dataopshub-6.6.12 → dataopshub-6.6.14}/DataOpsHub.egg-info/dependency_links.txt +0 -0
- {dataopshub-6.6.12 → dataopshub-6.6.14}/DataOpsHub.egg-info/requires.txt +0 -0
- {dataopshub-6.6.12 → dataopshub-6.6.14}/DataOpsHub.egg-info/top_level.txt +0 -0
- {dataopshub-6.6.12 → dataopshub-6.6.14}/setup.cfg +0 -0
- {dataopshub-6.6.12 → dataopshub-6.6.14}/setup.py +0 -0
|
@@ -6,7 +6,7 @@ DataOpsHub is a comprehensive Python package for data operations in healthcare a
|
|
|
6
6
|
It provides a set of tools for database operations, form validation, security, and web automation.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
-
__version__ = '6.6.
|
|
9
|
+
__version__ = '6.6.14'
|
|
10
10
|
|
|
11
11
|
# Define what should be available when using 'from DataOpsHub import *'
|
|
12
12
|
__all__ = [
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Constants Package
|
|
6
|
+
|
|
7
|
+
This package contains constants used across the DataOpsHub application.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
# Define what should be available when using 'from DataOpsHub.constants import *'
|
|
11
|
+
__all__ = [
|
|
12
|
+
'INVALID_AGE_ERROR',
|
|
13
|
+
'INVALID_DATE_FORMAT_ERROR',
|
|
14
|
+
'INVALID_DATE_RANGE_ERROR',
|
|
15
|
+
'INVALID_DATE_RANGE_FORMAT_ERROR',
|
|
16
|
+
'INVALID_EMAIL_ERROR',
|
|
17
|
+
'INVALID_FIELD_ERROR',
|
|
18
|
+
'INVALID_FIRST_NAME_ERROR',
|
|
19
|
+
'INVALID_FIRST_SURNAME_ERROR',
|
|
20
|
+
'INVALID_ID_FORMAT_ERROR',
|
|
21
|
+
'INVALID_ID_TYPE_ERROR',
|
|
22
|
+
'INVALID_PASSWORD_ERROR',
|
|
23
|
+
'INVALID_SECOND_SURNAME_ERROR',
|
|
24
|
+
'INVALID_TEL_ERROR',
|
|
25
|
+
'INVALID_TEL_SEARCH_VALUE',
|
|
26
|
+
'MISSING_DATE_VALUES_ERROR',
|
|
27
|
+
'TABLE_FIELD_MAPPING',
|
|
28
|
+
'USER_EXISTS_ERROR'
|
|
29
|
+
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Error Messages Module
|
|
6
|
+
|
|
7
|
+
This module contains error messages used across the DataOpsHub application.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
# ID validation errors
|
|
11
|
+
INVALID_ID_FORMAT_ERROR = "Invalid ID format. ID must be 3-10 characters long and contain only alphanumeric characters and hyphens."
|
|
12
|
+
INVALID_ID_TYPE_ERROR = "Invalid ID type. ID must be a string."
|
|
13
|
+
|
|
14
|
+
# Date validation errors
|
|
15
|
+
INVALID_DATE_FORMAT_ERROR = "Invalid date format. Date must be in the format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM'."
|
|
16
|
+
INVALID_DATE_RANGE_ERROR = "Invalid date range. The start date must be before the end date."
|
|
17
|
+
INVALID_DATE_RANGE_FORMAT_ERROR = "Invalid date range format. Date range must be in the format {'min_value': 'YYYY-MM-DD', 'max_value': 'YYYY-MM-DD'}."
|
|
18
|
+
MISSING_DATE_VALUES_ERROR = "Missing date values. Both 'min_value' and 'max_value' must be provided."
|
|
19
|
+
|
|
20
|
+
# Field validation errors
|
|
21
|
+
INVALID_FIELD_ERROR = "Invalid field. The field does not exist in the model."
|
|
22
|
+
INVALID_EMAIL_ERROR = "Invalid email format. Please provide a valid email address."
|
|
23
|
+
INVALID_FIRST_NAME_ERROR = "Invalid first name. First name must be 2-50 characters long and contain only letters and spaces."
|
|
24
|
+
INVALID_FIRST_SURNAME_ERROR = "Invalid first surname. First surname must be 2-50 characters long and contain only letters and spaces."
|
|
25
|
+
INVALID_SECOND_SURNAME_ERROR = "Invalid second surname. Second surname must be 2-50 characters long and contain only letters and spaces."
|
|
26
|
+
INVALID_PASSWORD_ERROR = "Invalid password. Password must be at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one number, and one special character."
|
|
27
|
+
INVALID_TEL_ERROR = "Invalid telephone number. Telephone number must be 9-15 digits long and contain only numbers, spaces, and hyphens."
|
|
28
|
+
INVALID_AGE_ERROR = "Invalid age. Age must be between 14 and 120 years."
|
|
29
|
+
USER_EXISTS_ERROR = "User already exists. Please choose a different username or email."
|
|
30
|
+
INVALID_TEL_SEARCH_VALUE = "Invalid telephone search value. Telephone number must be 9-15 digits long and contain only numbers, spaces, and hyphens."
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Table Mappings Module
|
|
6
|
+
|
|
7
|
+
This module contains mappings between table names and their field names.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
TABLE_FIELD_MAPPING = {
|
|
11
|
+
'user': {
|
|
12
|
+
'id_field': 'user_id',
|
|
13
|
+
'date_field': 'created_at'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Data Entry Forms package for DataOpsHub.
|
|
6
|
+
|
|
7
|
+
This package provides tools for managing, validating, and processing user data entries.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
# Define what should be available when using 'from DataOpsHub.data_entry_forms import *'
|
|
11
|
+
__all__ = [
|
|
12
|
+
# Uppercase constants
|
|
13
|
+
'INVALID_AGE_ERROR',
|
|
14
|
+
'INVALID_DATE_FORMAT_ERROR',
|
|
15
|
+
'INVALID_DATE_RANGE_ERROR',
|
|
16
|
+
'INVALID_EMAIL_ERROR',
|
|
17
|
+
'INVALID_FIRST_NAME_ERROR',
|
|
18
|
+
'INVALID_FIRST_SURNAME_ERROR',
|
|
19
|
+
'INVALID_ID_FORMAT_ERROR',
|
|
20
|
+
'INVALID_ID_TYPE_ERROR',
|
|
21
|
+
'INVALID_PASSWORD_ERROR',
|
|
22
|
+
'INVALID_SECOND_SURNAME_ERROR',
|
|
23
|
+
'INVALID_TEL_ERROR',
|
|
24
|
+
'MISSING_DATE_VALUES_ERROR',
|
|
25
|
+
'USER_EXISTS_ERROR',
|
|
26
|
+
|
|
27
|
+
# PascalCase classes
|
|
28
|
+
'RegistrationForm',
|
|
29
|
+
|
|
30
|
+
# snake_case functions
|
|
31
|
+
'generate_json_validation_response',
|
|
32
|
+
'validate_date_range',
|
|
33
|
+
'validate_id_field'
|
|
34
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Forms package for DataOpsHub.
|
|
6
|
+
|
|
7
|
+
This package contains form classes used for data entry validation.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
# Define what should be available when using 'from DataOpsHub.data_entry_forms.forms import *'
|
|
11
|
+
__all__ = [
|
|
12
|
+
'RegistrationForm'
|
|
13
|
+
]
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Data Entry Forms Module
|
|
6
|
+
|
|
7
|
+
This module defines WTForms-based form classes for data entry validation in the DataOpsHub application.
|
|
8
|
+
It provides structured form validation for user registration and other data collection purposes.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
#----------------#
|
|
12
|
+
# Import modules #
|
|
13
|
+
#----------------#
|
|
14
|
+
|
|
15
|
+
# from flask_ngrok import run_with_ngrok
|
|
16
|
+
# from flask import Flask,request, url_for
|
|
17
|
+
from wtforms import Form, StringField, validators
|
|
18
|
+
from wtforms.fields import EmailField
|
|
19
|
+
|
|
20
|
+
# Import project modules #
|
|
21
|
+
#------------------------#
|
|
22
|
+
|
|
23
|
+
#----------------#
|
|
24
|
+
# Define classes #
|
|
25
|
+
#----------------#
|
|
26
|
+
|
|
27
|
+
class RegistrationForm(Form):
|
|
28
|
+
"""
|
|
29
|
+
User registration form with comprehensive field validation.
|
|
30
|
+
|
|
31
|
+
This form class provides structured validation for user registration data
|
|
32
|
+
using WTForms validators. It ensures data integrity and proper formatting
|
|
33
|
+
for user information before database storage.
|
|
34
|
+
|
|
35
|
+
Attributes
|
|
36
|
+
----------
|
|
37
|
+
email : EmailField
|
|
38
|
+
User's email address with email format validation and required field check.
|
|
39
|
+
Uses built-in email validator for RFC-compliant email validation.
|
|
40
|
+
first_name : StringField
|
|
41
|
+
User's first name with length validation (2-50 characters) and required field check.
|
|
42
|
+
Ensures meaningful name entries while preventing excessively long inputs.
|
|
43
|
+
last_name : StringField
|
|
44
|
+
User's last name with length validation (2-50 characters) and required field check.
|
|
45
|
+
Maintains consistency with first_name validation requirements.
|
|
46
|
+
|
|
47
|
+
Notes
|
|
48
|
+
-----
|
|
49
|
+
**Validation Strategy**
|
|
50
|
+
- Email field uses dedicated EmailField for enhanced email validation
|
|
51
|
+
- Name fields enforce reasonable length constraints for data quality
|
|
52
|
+
- All fields are required to ensure complete user profiles
|
|
53
|
+
|
|
54
|
+
**Integration**
|
|
55
|
+
Designed for integration with Flask applications and database models.
|
|
56
|
+
Can be extended with additional fields as registration requirements evolve.
|
|
57
|
+
|
|
58
|
+
**Field Constraints**
|
|
59
|
+
- Email: Must be valid email format, required
|
|
60
|
+
- First Name: 2-50 characters, required
|
|
61
|
+
- Last Name: 2-50 characters, required
|
|
62
|
+
|
|
63
|
+
Examples
|
|
64
|
+
--------
|
|
65
|
+
>>> # Basic form validation
|
|
66
|
+
>>> form_data = {
|
|
67
|
+
... 'email': 'user@example.com',
|
|
68
|
+
... 'first_name': 'John',
|
|
69
|
+
... 'last_name': 'Doe'
|
|
70
|
+
... }
|
|
71
|
+
>>> form = RegistrationForm(data=form_data)
|
|
72
|
+
>>> if form.validate():
|
|
73
|
+
... print("Form validation successful!")
|
|
74
|
+
... else:
|
|
75
|
+
... print("Validation errors:", form.errors)
|
|
76
|
+
|
|
77
|
+
>>> # Flask integration example
|
|
78
|
+
>>> @app.route('/register', methods=['POST'])
|
|
79
|
+
>>> def register():
|
|
80
|
+
... form = RegistrationForm(request.form)
|
|
81
|
+
... if form.validate():
|
|
82
|
+
... # Process valid form data
|
|
83
|
+
... user = User(
|
|
84
|
+
... email=form.email.data,
|
|
85
|
+
... first_name=form.first_name.data,
|
|
86
|
+
... last_name=form.last_name.data
|
|
87
|
+
... )
|
|
88
|
+
... # Save to database
|
|
89
|
+
... return render_template('register.html', form=form)
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
email = EmailField('Email', [validators.Email(), validators.DataRequired()])
|
|
93
|
+
first_name = StringField('First Name', [validators.Length(min=2, max=50), validators.DataRequired()])
|
|
94
|
+
last_name = StringField('Last Name', [validators.Length(min=2, max=50), validators.DataRequired()])
|
|
95
|
+
|
|
96
|
+
#------------------#
|
|
97
|
+
# Define functions #
|
|
98
|
+
#------------------#
|
|
99
|
+
|
|
100
|
+
def validate_registration_form(form_data: dict) -> tuple[bool, dict]:
|
|
101
|
+
"""
|
|
102
|
+
Validate registration form data and return validation results.
|
|
103
|
+
|
|
104
|
+
This convenience function provides a simple interface for validating
|
|
105
|
+
registration form data without directly instantiating the form class.
|
|
106
|
+
It returns both validation status and any error messages.
|
|
107
|
+
|
|
108
|
+
Parameters
|
|
109
|
+
----------
|
|
110
|
+
form_data : dict
|
|
111
|
+
Dictionary containing form field data with keys matching form field names.
|
|
112
|
+
Expected keys: 'email', 'first_name', 'last_name'.
|
|
113
|
+
|
|
114
|
+
Returns
|
|
115
|
+
-------
|
|
116
|
+
tuple[bool, dict]
|
|
117
|
+
A tuple containing:
|
|
118
|
+
- bool: True if validation passed, False if validation failed
|
|
119
|
+
- dict: Dictionary of field errors (empty if validation passed)
|
|
120
|
+
|
|
121
|
+
Examples
|
|
122
|
+
--------
|
|
123
|
+
>>> form_data = {
|
|
124
|
+
... 'email': 'invalid-email',
|
|
125
|
+
... 'first_name': 'J',
|
|
126
|
+
... 'last_name': 'Doe'
|
|
127
|
+
... }
|
|
128
|
+
>>> is_valid, errors = validate_registration_form(form_data)
|
|
129
|
+
>>> print(f"Valid: {is_valid}")
|
|
130
|
+
>>> print(f"Errors: {errors}")
|
|
131
|
+
Valid: False
|
|
132
|
+
Errors: {'email': ['Invalid email address.'], 'first_name': ['Field must be at least 2 characters long.']}
|
|
133
|
+
"""
|
|
134
|
+
form = RegistrationForm(data=form_data)
|
|
135
|
+
is_valid = form.validate()
|
|
136
|
+
errors = form.errors if not is_valid else {}
|
|
137
|
+
return is_valid, errors
|
|
138
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Form Field Validators Package
|
|
6
|
+
|
|
7
|
+
This package provides validation functionality for form fields in various contexts.
|
|
8
|
+
It includes utilities for validating different types of data such as dates, IDs, and other fields.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
# Define what should be available when using 'from DataOpsHub.data_entry_forms.validators import *'
|
|
12
|
+
__all__ = [
|
|
13
|
+
# Backend validation functions
|
|
14
|
+
'generate_json_validation_response',
|
|
15
|
+
'validate_date_range',
|
|
16
|
+
'validate_id_field',
|
|
17
|
+
'verify_spanish_dni',
|
|
18
|
+
|
|
19
|
+
# Backend error messages
|
|
20
|
+
'INVALID_DATE_FORMAT_ERROR',
|
|
21
|
+
'INVALID_DATE_RANGE_ERROR',
|
|
22
|
+
'INVALID_DATE_RANGE_FORMAT_ERROR',
|
|
23
|
+
'INVALID_FIELD_ERROR',
|
|
24
|
+
'INVALID_ID_FORMAT_ERROR',
|
|
25
|
+
'INVALID_ID_TYPE_ERROR',
|
|
26
|
+
'MISSING_DATE_VALUES_ERROR',
|
|
27
|
+
|
|
28
|
+
# Backend constants
|
|
29
|
+
'DISPLAYABLE_FIELDS',
|
|
30
|
+
'FIELD_NAME_LIST_PRETTY',
|
|
31
|
+
'FIELD_VALIDATORS',
|
|
32
|
+
'FILTERABLE_FIELDS',
|
|
33
|
+
'ID_PATTERN',
|
|
34
|
+
|
|
35
|
+
# Full-stack validation functions
|
|
36
|
+
'generate_error_dict',
|
|
37
|
+
'generate_error_dict_nonempty',
|
|
38
|
+
'validate_age_field',
|
|
39
|
+
'validate_email_field',
|
|
40
|
+
'validate_field',
|
|
41
|
+
'validate_form_with_json',
|
|
42
|
+
|
|
43
|
+
# Full-stack constants
|
|
44
|
+
'DROPDOWN_ID_LIST',
|
|
45
|
+
'ERR_STR_LIST',
|
|
46
|
+
'ERR_STR_LIST_SEARCH',
|
|
47
|
+
'FIELD_NAME_LIST_ENG',
|
|
48
|
+
'FIELD_NAME_LIST_ESP',
|
|
49
|
+
'FIELD_NAME_SEARCH_LIST',
|
|
50
|
+
'INVALID_TEL_SEARCH_VALUE',
|
|
51
|
+
'REG_EXP_DICT',
|
|
52
|
+
'REG_EXP_DICT_SEARCH'
|
|
53
|
+
]
|