How aws-solutions-library-samples/guidance-for-piping-and-instrumentation-diagrams-digitization-on-aws works
This is an AWS P&ID digitization solution: users submit engineering drawings, which are validated, cleaned, analyzed for text, symbols, and connecting lines, then converted into graph and visualization outputs. Step Functions coordinates the processing stages and S3 stores execution-scoped inputs and results. The repository also includes symbol-model training and inference code. Workflow sequencing and major capabilities follow the README; source excerpts confirm selected Lambda, S3, and graph behaviors, while unsampled modules are represented only where documented.
Main entry points: orchestration.ts Step Functions · app.py Line detection · document_processor.py Graph generation · config_validator.py Input validation
Components 20
Diagram processing
- Input validation
cdk/lambda/input_validator/config_validator.py - Notes processing
cdk/lambda/notes_processor/notes_section_detector.py - Frame detection
cdk/lambda/notes_processor/frame_detector.py - Text detection
cdk/lambda/text_detection/index.py - Symbol detection
cdk/lambda/symbol_detection/index.py - Line detection
cdk/lambda/line_detection/app.py - Line processing
cdk/lambda/line_detection/line_detection.py
Graph and visualization
- Graph generation
cdk/lambda/graph_generator/document_processor.py - Graph service
cdk/lambda/graph_generator/graph_service.py - DEXPI export
cdk/lambda/graph_generator/dexpi_converter.py - Visualization
cdk/lambda/graph_visualization/visualization.py
AWS platform
- Bedrock Data Automation
- SageMaker endpoint
- S3 buckets
cdk/lib/constructs/storage.ts - Step Functions
cdk/lib/constructs/orchestration.ts
Symbol models
- Synthetic data generation
training/data_generator/synthetic_data_generator/generator.py - Detector training
training/frcnn/train.py - Similarity training
training/siamese_network/train.py - Symbol inference
inference/inference.py
Other components
- Diagram submitter
Connections 25
- Diagram submitter → Input validation: submits drawing
- Input validation → Notes processing: validated input
- Notes processing → Text detection: processed image
- Notes processing → Symbol detection: processed image
- Text detection → Bedrock Data Automation: requests OCR
cdk/lambda/text_detection/index.py - Symbol detection → SageMaker endpoint: requests detection
- Text detection → Line detection: results via S3
cdk/lambda/line_detection/app.py - Symbol detection → Line detection: results via S3
cdk/lambda/line_detection/app.py - Line detection → Line processing: runs detection
cdk/lambda/line_detection/app.py - Line detection → Graph generation: line results
- Graph generation → Graph service: builds graph
- Graph generation → DEXPI export: exports DEXPI
- Graph generation → Visualization: graph results
- Input validation → S3 buckets: stores configuration
- Diagram submitter → S3 buckets: uploads drawing
- Step Functions → Input validation: invokes
- Step Functions → Notes processing: invokes
cdk/lib/constructs/orchestration.ts - Step Functions → Symbol detection: invokes
cdk/lib/constructs/orchestration.ts - Step Functions → Text detection: invokes
- Step Functions → Line detection: invokes
- Synthetic data generation → Detector training: training data
- Synthetic data generation → Similarity training: training data
- Detector training → Symbol inference: trained detector
- Similarity training → Symbol inference: trained embeddings
- Symbol inference → SageMaker endpoint: deployed model