This software is designed to automate the monitoring and updating of vendor assignments for product units within a corporate SQL database.
- Monitoring: Continuously monitors an internal SQL database for flags indicating units with new vendor assignments.
- Data Retrieval: Extracts the "parent case ID" for the unit and communicates with a third-party API using the SOAP protocol to retrieve the corresponding "child case ID" for the newly assigned vendor.
- Data Processing and Updating: Processes the XML data received from the third-party API and updates the SQL database accordingly.
This program ensures a corporate database remains up-to-date with the latest vendor assignments, streamlining the data management process and enhancing operational efficiency.
- Python: The primary programming language used for this project.
- Object-Oriented Programming (OOP): Emphasizes the use of classes and objects to create modular and reusable code.
- Asynchronous Programming: Utilized for handling I/O-bound operations efficiently.
- Data Classes: Used for creating classes that primarily store data with minimal boilerplate code.
- Exception Handling: Implemented to manage errors and ensure the robustness of the application.
- Logging: For tracking and debugging the process.
- SQL: For database interactions and queries.
- SOAP: For communication with the third-party API.
- XML Parsing: For processing the data format received from the API.
- Dependency Management: Managed using
pip
andrequirements.txt
.
- Automated monitoring of vendor assignments.
- Integration with third-party APIs using SOAP.
- XML data processing and conversion.
- Asynchronous operations for efficient data handling.
- Robust error handling and logging.
The project is organized into the following files:
config.py
: Configuration settings and constants.connect_sql.py
: Functions for connecting to the SQL database.defusedexpat.py
: A defused version of thepyexpat
and_elementtree
modules.exceptions.py
: Custom exception classes.handlers.py
: Handlers for SQL and XML operations.holders.py
: Data holder classes usingdataclasses
.interfaces.py
: Abstract base classes for various operations.interval_timer.py
: Utility for setting intervals.loggers.py
: Logging classes.main.py
: Main script to run the project.notify.py
: Functions for sending notifications via email.operations.py
: Classes for executing SQL and SOAP operations.processors.py
: Data processing classes.traceback_logger.py
: Utility for logging tracebacks.utilities.py
: Utility functions.xmltodict.py
: Module for converting XML to dictionary.__init__.py
: Initialization file for the package.
- Python 3.7 or higher
- Access to a corporate SQL database
- SendGrid API key for email notifications
-
Clone the repository:
git clone https://github.com/ryanlevee/vendor-assignment-automation.git
-
Navigate to the project directory:
cd vendor-assignment-automation
-
Install the dependencies:
pip install -r requirements.txt
To run the main script, use:
python src/main.py
Here's a brief example of how the software works:
- The program monitors the SQL database for units with new vendor assignments.
- When a new assignment is detected, it retrieves the parent case ID tied to the unit.
- The parent case ID is sent to the third-party API to get the corresponding child case ID tied to the newly assigned vendor.
- The XML data received from the API is processed and the SQL database is updated.
Contains configuration settings and constants used throughout the project.
Provides functions to connect to the SQL database and execute queries.
A defused version of the pyexpat
and _elementtree
modules to prevent XML vulnerabilities.
Defines custom exceptions used in the project.
Contains handler classes for SQL and XML operations.
Defines data holder classes using dataclasses
to store and manage data.
Abstract base classes for various operations, ensuring a consistent interface.
Utility for setting intervals to repeatedly execute functions.
Logging classes to log debug, info, and error messages.
The main script that orchestrates the execution of the project.
Functions for sending email notifications using SendGrid.
Classes for executing SQL and SOAP operations.
Data processing classes to normalize and process XML and SQL data.
Utility for logging tracebacks and sending notifications on errors.
Utility functions for various tasks such as list manipulation and SQL string creation.
Module for converting XML data to a dictionary format.
Contributions are welcome! Please open an issue or submit a pull request.
This project includes code from the following repositories:
xmltodict.py
: xmltodict by Martin Blech, licensed under the MIT License.defusedexpat.py
: defusedexpat by Christian Heimes, licensed under the PSF License.
Ryan Levee
This project is licensed under the MIT License. See the LICENSE
file for details.