Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev processpiper v.0.8.0 #55

Merged
merged 61 commits into from
Jul 28, 2024
Merged

Dev processpiper v.0.8.0 #55

merged 61 commits into from
Jul 28, 2024

Conversation

csgoh
Copy link
Owner

@csgoh csgoh commented Jul 28, 2024

No description provided.

csgoh and others added 30 commits June 3, 2024 18:24
Enhanced Lane elements by introducing a unique BPMN identifier, utilizing the first 7 characters of a UUID4 string. This modification facilitates the distinct identification of each element within a BPMN diagram, improving traceability and support for complex processes. By assigning a concise yet unique identifier, we ensure compatibility with BPMN standards and enhance the interoperability with other tools and systems involved in process management.

This change not only aligns with best practices for BPMN modeling but also lays a foundational step towards future features that may require element-level identification, such as advanced analytics, reporting, and element-specific customizations.
Introduced unique identifiers for Pool and Lane instances to better support tracing and management within the system. A sequential integer ID is now assigned to each Pool instance, improving the enumeration and tracking process. Additionally, Lane instances within a Pool are now assigned a short UUID during creation, enhancing their traceability and uniqueness across different pools. This change aids in avoiding conflicts and simplifying debugging and logging mechanisms, particularly in complex scenarios involving multiple pools and lanes. Simplifying the __exit__ method definition enhances code readability without altering its functionality.

These enhancements contribute to a more robust and maintainable codebase by facilitating easier identification and manipulation of pool and lane entities within the system.
Enhanced the ProcessMap class by importing the uuid library to generate unique BPMN IDs for pools, ensuring each pool in the process map has a distinct identifier. Additionally, introduced the capability to export process maps to BPMN XML format, facilitating integration with other software and tools that use or process BPMN diagrams. This new export feature expands the versatility of the ProcessMap, allowing for better data interchange and analysis opportunities in workflows that leverage BPMN standards.

This upgrade addresses the need for standardized process documentation and interoperability with BPMN-compliant systems, potentially opening up new avenues for automation and optimization in process management.
Introduced a new field `bpmn_id` to the Shape class to uniquely identify shapes according to BPMN (Business Process Model and Notation) standards. This enhancement facilitates better integration with BPMN tools and workflows, ensuring that each shape can be directly mapped to its BPMN counterpart. This change is pivotal for future features that require BPMN compliance and interoperability.

Refs: #None
Added a newline at the end of test_bpmn.py, setting up the file structure to accommodate future test case implementations. This change ensures consistent formatting and readability for upcoming test additions.
Refactored the BPMN class to encapsulate XML namespace registration and element creation within the __post_init__ method, enhancing organization and readability. Removed redundant class attributes for process state tracking, streamlining class definition. Implemented new methods to add various BPMN elements like pools, lanes, and flows, providing a structured approach to element addition. These changes increase the maintainability of the XML generation process and prepare the groundwork for future features. The restructured code also simplifies the export_to_xml method by leveraging the new instance-level `definitions` element.
Centralize UUID generation into a dedicated Helper method to ensure consistent creation of BPMN IDs across Pool, Lane, and ProcessMap classes. This change enhances maintainability by abstracting UUID logic and potentially simplifying future adjustments to the ID generation process.
Added a static method to the Helper class for generating prefixed unique identifiers. Utilizing the uuid module, the method returns a new UUID with each call, prefixed with "PIPER_" to facilitate tracking and identification of processpiper-related objects or processes. This enhancement promotes better traceability and debugging capabilities.
Improved the BPMN class to better categorize elements related to collaborations. Connections are now distinguished by whether they are between pools or within a single pool. Additionally, a clear distinction is established between processes and pools, enhancing the clarity and accuracy of BPMN diagram parsing. This update lays the groundwork for more robust BPMN model analysis and manipulation in future developments.
Commented out the line saving a PNG image in the test for BPMN export functionality. This change streamlines the test execution by removing unnecessary file output, which wasn't being utilized for assert conditions or further processing. It simplifies maintenance and accelerates test runs.

# Note: No issue reference included as none was provided. If there's an issue number associated with this change, please include it at the end of the commit message.
Removed the unutilized `uuid` import in `pool.py` to streamline the code and eliminate any unnecessary dependencies. This helps maintain cleaner and more efficient code. No functional changes were made.
Refactor BPMN class structure to improve modularity

Refactored imports to align with new modular structure, promoting better organization by separating event, activity, gateway, and helper functions into their respective modules. Updated namespace handling and improved XML export functionality. Added a sample rendering method and included detailed element structures to support various BPMN elements such as tasks, gateway and events.

This enhances maintainability and allows easier extension in the future.
```
- Replace hardcoded exporter version with imported `__version__`.
- Add logic for generating `bpmn:collaboration` and `bpmn:messageFlow` elements for multiple pools, enhancing inter-pool connectivity support.
- Ensure generation of `bpmn:laneSet`, `bpmn:lane`, and `bpmn:flowNodeRef` elements to maintain a hierarchical structure within pools.
- Introduce `bpmndi:BPMNDiagram` and `bpmndi:BPMNPlane` elements to support BPMN diagram representation.

These changes streamline the code, making it more maintainable and extensible, and enhance BPMN XML export functionality.
Shorten and sanitize UUIDs in get_uuid()

UUID generation now replaces hyphens with underscores and shortens the string to 8 characters. This ensures consistency and compactness in the produced IDs, addressing formatting requirements for easier handling.
```
Introduced a new field `bpmn_collaboration_id` to the Lane class to support tracking of collaboration IDs within the BPMN standard. This enhances the ability to handle BPMN data in collaborative environments more effectively. No immediate impact on existing functionalities.
Introduced `bpmn_collaboration_id` to the Pool class for better tracking and identification of BPMN collaboration entities. This addition supports enhanced mapping and data integrity within the modeling framework, aligning with requirements for comprehensive process identification.
Fixed the `Default Pool` handling logic in BPMN generation:
- Skip creating a `<bpmn:process>` element for `Default Pool`
- Add `<bpmn:process>` elements for lanes within `Default Pool`
- Adjust handling of `bpmn:flowNodeRef` and `bpmn:participant`
- Ensure correct BPMN diagram elements reference IDs only for non-default pools

These changes improve how the system ignores or includes default pools and their lanes in the BPMN model, ensuring cleaner and more accurate BPMN representations. This addresses handling issues arising when default pools were being processed incorrectly.
Uncommented the line to allow saving the process map as an image during test_case03. This change facilitates visual verification of the process map, aiding in debugging and ensuring the correctness of the process representation.
Improved internal handling by assigning IDs to `sequenceFlow` and `bpmn:shape` elements to ensure proper ID association. Added logic to generate `BPMNEdge` elements with corresponding waypoints, facilitating accurate visual representation of connections. Enhanced debug output for shape properties to assist in diagnostics and validation.

This change addresses correct association and visualization of BPMN elements, crucial for accurate BPMN diagram generation.
Switched logging level to DEBUG to capture more detailed information during execution, aiding in troubleshooting and development. This change aims to enhance visibility into the application's behavior for better diagnostics and debugging.
Fix Circle coordinate mutation issue and add logging

Prevented mutating the original 'coord' by using a shallow copy for 'origin_coord' in Circle's 'set_draw_position' method. This ensures subsequent manipulations of 'coord' do not affect the original. Added debug statements to verify coordinate copying. Also introduced a 'bpmn_id' attribute in Connection for better identification.

```
Update BPMN IDs to ensure uniqueness

Updated all BPMN element IDs to new unique identifiers within the XML schema. This maintains the integrity of the BPMN definitions and prevents conflicts during processing and collaboration. This change doesn't alter the BPMN logic or flow, only the technical identifiers.

```
chengsoongoh and others added 28 commits July 5, 2024 16:08
Fix connection points handling and update Circle debug info

Added a default factory for Connection's connection_points to ensure it is initialized properly. Updated code to assign connection_points to connection objects, addressing an issue with undefined points. Enhanced Circle's debug print statements to include the shape's name for better traceability.

```
Refined how `dc:Bounds` elements are generated for BPMN shapes. Specifically, `Start` and `End` shapes now have their coordinates adjusted based on their radius, enhancing their positioning accuracy.

Moreover, consolidated handling of connection points by using a unified list `connection_points`, streamlining waypoint generation and improving readability.

Fixes issue #45 regarding incorrect diagram renderings.
Enhanced test cases to include export of process maps to BPMN XML format. This ensures compatibility with BPMN tools and improves the reproducibility and shareability of test results.
Add BPMN export functionality to test cases

Updated test cases to include exporting process maps to BPMN XML files in addition to saving as .png images. This enhances test coverage by validating the BPMN export feature of the process map. Fixed module imports for better compatibility and simplified future maintenance.

```
Add background color attributes to BPMN shapes

Enhanced BPMN generation by including "color:background-color" attributes for pool and shape elements. This improvement allows for better visual differentiation of elements within the BPMN diagrams. Also modified file output to use the specified filename instead of a hardcoded one, allowing greater flexibility.

```
Add new BPMN test case and update process map image

- Introduced a new BPMN test case to improve coverage of end-user and system search flow in the process.
- Updated process map image to reflect recent changes and ensure consistency with the new test case.

These changes enhance test accuracy and maintain up-to-date visual documentation.
```
- Separated XML export responsibilities into `XMLExporter` and `BPMNElementCreator` classes, enhancing modularity and readability.
- Introduced namespace constants for cleaner code.
- Replaced monolithic methods with smaller, more focused ones for managing BPMN elements and attributes.
- Simplified the export process by moving common tasks into helper functions.
- Updated BPMN class to leverage new structure, ensuring consistent XML output.

These changes improve code organization, making future maintenance and feature additions easier.
Introduced `has_lane_only` and `has_pool` methods in the Pool class. These methods provide a clear way to check the state of the pool, enhancing readability and maintainability by encapsulating state checks related to the pool's name, specifically distinguishing the "Default Pool". This change facilitates more intuitive conditional logic based on the pool’s name, simplifying the codebase.
Remove debug print statements in Circle class

### Body:
Eliminated redundant print statements used for debugging in the Circle class constructor. This cleanup enhances readability and maintains a cleaner codebase, ensuring that output is not cluttered with unnecessary log messages.
Support inclusive and parallel gateways, optimize ID generation

Added support for inclusive and parallel gateways to enhance BPMN modeling capabilities. Optimized ID generation for shapes, pools, and connections to include contextual information, improving traceability. Refactored participant element creation to utilize existing pool and lane IDs, promoting consistency and reducing redundancy. Cleaned up debug print statements and comments for better readability.
```
Enhanced the `get_uuid` method to accept an optional `prefix` argument, allowing more flexibility in UUID generation. The prefix is sanitized to include only alphanumeric characters and underscores, and is converted to uppercase. This change provides more control over the UUID format, accommodating various integration needs.
Enhanced lane identification by generating and assigning a new BPMN collaboration ID in addition to the existing BPMN ID. This inclusion helps in distinguishing collaboration contexts more explicitly, contributing to better tracking and management of lane data in collaborative BPMN diagrams.
Add unique collaboration ID to pool creation

Enhanced pool creation in ProcessMap by adding a unique BPMN collaboration ID in addition to the pool's BPMN ID. This change improves the identification and management of pool collaborations in BPMN diagrams.

```
Enhanced the test_case01 function to export the process map to a BPMN file, improving test coverage and ensuring export functionality works as expected. This helps in verifying the generated process map's integrity in BPMN format.
Refactor export functions and clean up imports

Replaced 'export_to_bpmn_xml' with 'export_to_bpmn' across tests for consistency and improved readability. Removed unused and verbose imports to streamline test files' dependency management. Also updated 'text2diagram' to support BPMN exports directly.

```
Added comprehensive support for various BPMN event types including conditional, timer, intermediate, message, signal, and link events. Improved the helper methods to handle these new event types, ensuring correct XML element generation based on event context (start, intermediate, end).

Refined the use of isinstance() over type() for better type checking, ensuring robustness against inheritance.

Enhanced logging with Helper.printc for better visibility of the export process, replacing print statements for consistency and clarity.

Addresses issues with handling complex BPMN diagrams, improving both functionality and maintainability.
Remove superfluous newline for cleaner code

### Body:
Eliminated an unnecessary newline in the `Conditional` class to enhance code readability. No functionality changes were made.
Add conditional export_to_bpmn display logic

### Body:
Introduced a new flag `show_export_to_bpmn` to control the export-to-BPMN display logic. This provides finer granularity over display settings, ensuring more customizable and maintainable code.
Refactor element replacement to include pool context

### Body:
Updated element replacement methods to include the pool context for better handling of element transformations, fixing missed attributes, and ensuring accurate data propagation. Improved import readability by explicitly listing imported items from the event module. Renamed the `export_to_bpmn_xml` method to `export_to_bpmn` for consistency.
Removed commented-out debug print statements to clean up the code. Added `is_first_shape` and `is_last_shape` methods to conveniently check if a shape has no incoming or outgoing connections, respectively. These changes improve readability and maintainability of the shape processing logic.
Add support for exporting diagrams to BPMN format

Extended the diagram rendering functionality to optionally export diagrams to BPMN format in addition to PNG. This change enhances interoperability with BPMN-compliant tools. Updated the render function and error messaging to handle the new BMPN format option.
```
Merge branch 'main' into dev-processpiper
@csgoh csgoh merged commit 5e5e9d7 into main Jul 28, 2024
6 of 7 checks passed
@csgoh csgoh deleted the dev-processpiper branch July 28, 2024 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants