Python library for generating Proligent™ XML files.
Project description
Proligent™ XML Generator for Python™
Python™ library for generating Proligent™ XML files. It provides a simple, structured API for building valid import files, reducing manual XML writing and ensuring consistent data formatting. These files are used to import data into Proligent™ Cloud and Proligent™ Analytics.
Tip: Refer to the Proligent™ Manufacturing Information Model to learn how to structure and map your data in Proligent™.
Proligent™ software are designed for Operations Managers, Quality Engineers, Manufacturing Engineers and Test Engineers. This easy-to-use software solution monitors test stations and provides valuable insight into your product line.
Installation instructions
First, install a compatible python version from Python.org.
Then, to install the package in your (virtual) environment, run the following command:
pip install proligent-xml-generator
Getting started
Each layer of the Proligent™ Manufacturing Information Model is represented in the package by an equivalent class. Typing hints are used to indicate what data types are accepted by the objects.
Example 1
from proligent.model import (
DataWareHouse,
ExecutionStatusKind,
Limit,
LimitExpression,
Measure,
OperationRun,
ProcessRun,
ProductUnit,
SequenceRun,
StepRun,
)
import datetime
if __name__ == "__main__":
limit = Limit(
LimitExpression.LOWERBOUND_LEQ_X_LE_HIGHER_BOUND,
lower_bound=10,
higher_bound=25,
)
measure = Measure(
value=15,
status=ExecutionStatusKind.PASS,
limit=limit,
time=datetime.datetime.now(),
)
step = StepRun(
name="Step1",
status=ExecutionStatusKind.PASS,
measure=measure
)
# Create sequence run: remember to keep track of start and end time
sequence = SequenceRun(
name="Sequence1",
status=ExecutionStatusKind.PASS,
steps=[step],
)
# Create operation run: remember to keep track of start and end time
operation = OperationRun(
name="Operation1",
station="Station/readme_example",
status=ExecutionStatusKind.PASS,
sequences=[sequence],
)
# Create process run: remember to keep track of start and end time
process = ProcessRun(
product_unit_identifier="DutSerialNumber",
product_full_name="Product/readme_example",
operations=[operation],
name="Process/readme_example",
process_mode="PROD",
status=ExecutionStatusKind.PASS,
)
product = ProductUnit(
product_unit_identifier="DutSerialNumber",
product_full_name="Product/readme_example",
manufacturer="Averna",
)
warehouse = DataWareHouse(top_process=process, product_unit=product)
warehouse.save_xml()
Note: For simplicity this example omits the start and end times, so they default to datetime.now. It is highly recommended to set these values with real timestamps when used in the real world.
You can also provide the output path for the XML:
from proligent.model import DataWareHouse
warehouse = DataWareHouse()
warehouse.save_xml(destination=r'C:\path_to\Proligent_file_name.xml')
Example 2
This example shows a second way of ordering calls and constructors, from top to bottom.
from proligent.model import (
DataWareHouse,
ExecutionStatusKind,
Limit,
LimitExpression,
Measure,
OperationRun,
ProcessRun,
ProductUnit,
SequenceRun,
StepRun,
)
import datetime
if __name__ == "__main__":
warehouse = DataWareHouse()
product = warehouse.set_product_unit(
ProductUnit(
product_unit_identifier="UutSerialNumber",
product_full_name="Product/readme_example",
manufacturer="Averna",
)
)
process = warehouse.set_process_run(
ProcessRun(
name="Process/readme_example",
process_mode="PROD",
product_unit_identifier="DutSerialNumber",
product_full_name="Product/readme_example",
)
)
operation = process.add_operation_run(
OperationRun(
name="Operation1",
station="Station/readme_example",
)
)
sequence = operation.add_sequence_run(
SequenceRun(
name="Sequence1",
)
)
sequence.add_step_run(
StepRun(
name="Step1",
status=ExecutionStatusKind.PASS,
measure=Measure(
value=15,
time=datetime.datetime.now(),
status=ExecutionStatusKind.PASS,
limit=Limit(
LimitExpression.LOWERBOUND_LEQ_X_LE_HIGHER_BOUND,
lower_bound=10,
higher_bound=25,
),
),
)
)
sequence.complete(status=ExecutionStatusKind.PASS)
operation.complete(status=ExecutionStatusKind.PASS)
process.complete(status=ExecutionStatusKind.PASS)
warehouse.save_xml()
XML Validation
Generated XML can be validated for safety.
from proligent.xml_validate import validate_xml
# This raises an exception if the XML is invalid
validate_xml(r"C:\path_to\Proligent_file_name.xml")
# This safe call returns the status and meta-data about a failure, if any
is_valid, metadata = validate_xml_safe(r"C:\path_to\Proligent_file_name.xml")
if not is_valid:
print(metadata.path)
print(metadata.reason)
Configuration
A few parameters are configurable in the package through the use of the UTIL object.
destination_dir: Specify a different destination directory for the XML files, aside from the defaultC:\Proligent\IntegrationService\Acquisition.timezone: Specify a different timezone for the provided datetimes (default is the TZ of the local machine).pytzis used for timezone handling. It providespytz.all_timezonesandpytz.common_timezonesto list all possible timezones. Alternatively, you can look at this list on Wikipedia.
from src.proligent.model import UTIL
if __name__ == '__main__':
UTIL.destination_dir = r'\\NETWORK_SHARE\Acquisition'
UTIL.timezone = 'America/New_York'
Trademarks
Proligent is a registered trademark, and Averna is a trademark, of Averna Technologies Inc.
Python is a trademark of the Python Software Foundation.
Other product and company names mentioned herein are trademarks or trade names of their respective companies.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file proligent_xml_generator-1.0.0.tar.gz.
File metadata
- Download URL: proligent_xml_generator-1.0.0.tar.gz
- Upload date:
- Size: 57.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06f8dbd6f766870ceb99945029268850b006d5d2375e5ac54f636defd7a5dc46
|
|
| MD5 |
45fc9cccefb96b6f57c40b7372338401
|
|
| BLAKE2b-256 |
13b0257e0e21201939917b752b147ce01fa7bcdebde4b2b285ae40d2ad9f8c48
|
File details
Details for the file proligent_xml_generator-1.0.0-py3-none-any.whl.
File metadata
- Download URL: proligent_xml_generator-1.0.0-py3-none-any.whl
- Upload date:
- Size: 80.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e08bcc97163e8b307de6ea0da390edb46f44df774929216e30a24336a05ee6d4
|
|
| MD5 |
148925cd60b468637ed675bdb3c3f40f
|
|
| BLAKE2b-256 |
c978c9e2b340d092a93d45a7033330d9e1c745bed5c4c6a035cb815078ed8b06
|