remake-dpp 0.1.0__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Anmol Kumar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,188 @@
1
+ Metadata-Version: 2.1
2
+ Name: remake_dpp
3
+ Version: 0.1.0
4
+ Summary: A modular Python package for Digital Product Passport modeling with identity, structure, lifecycle, risk, sustainability, provenance layers, and universal part classes.
5
+ Author-email: Anmol Kumar <anmol.kumar@starth.ac.uk>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Anmol Kumar
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Requires-Python: >=3.7
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE.txt
31
+ Requires-Dist: PyYAML
32
+ Requires-Dist: mintlify
33
+
34
+ # Digital Product Passport
35
+
36
+ [![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
37
+ ![Stars](https://img.shields.io/github/stars/nmis-group/remake_dpp.svg?style=flat&label=Star&maxAge=86400)
38
+ [![GitHub open issues](https://img.shields.io/github/issues-raw/nmis-group/remake_dpp.svg)](https://github.com/nmis-group/remake_dpp/issues)
39
+ [![GitHub open pull requests](https://img.shields.io/github/issues-pr-raw/nmis-group/remake_dpp.svg)](https://github.com/nmis-group/remake_dpp/pulls)
40
+ ![Repo Size](https://img.shields.io/github/repo-size/nmis-group/remake_dpp.svg?label=Repo%20size&style=flat-square)
41
+ ![Contributors](https://img.shields.io/github/contributors/nmis-group/remake_dpp.svg?style=flat&label=Contributors&maxAge=86400)
42
+
43
+ ## Contents
44
+
45
+ - [Description](#description)
46
+ - [Package Layout](#package-layout)
47
+ - [Requirements](#requirements)
48
+ - [Installation](#installation)
49
+ - [Usage Example](#usage-example)
50
+
51
+ ---
52
+ ## Description
53
+
54
+ A modular Python package that enables manufacturing companies to create interoperable Digital Product Passports (DPPs) by mapping their existing business data to standardized DPP data models using automated semantic matching and intuitive configuration tools.
55
+
56
+ ---
57
+ ## Package Layout
58
+
59
+ ```text
60
+ remake_dpp/
61
+ ├── docs/
62
+ │ ├── api-model.md
63
+ │ ├── api-schema-registry.md
64
+ │ ├── concepts-gas.md
65
+ │ ├── docs.json
66
+ │ ├── intro.md
67
+ │ ├── quickstart.md
68
+ │ ├── schemas-eclass.md
69
+ │ ├── schemas-isa95.md
70
+ │ └── usage-python.md
71
+ ├── nmis_dpp/
72
+ │ ├── mappers/
73
+ │ │ ├── __init__.py
74
+ │ │ ├── eclass_mapper.py
75
+ │ │ └── isa95_mapper.py
76
+ │ ├── ontology_data/
77
+ │ │ ├── eclass_16/
78
+ │ │ │ ├── dictionary_assets_en/
79
+ │ │ │ │ ├── ECLASS16_0_ASSET_EN_SG_13.xml
80
+ │ │ │ │ ├── ...
81
+ │ │ │ │ └── ECLASS16_0_ASSET_EN_SG_90.xml
82
+ │ │ │ ├── unitsml_en/
83
+ │ │ │ │ └── ECLASS16_0_UNITSML_EN.xml
84
+ │ │ │ └── ECLASS_ASSET_XML_Read_Me_EN_v1.pdf
85
+ │ │ ├── isa95/
86
+ │ │ │ ├── Documentation/
87
+ │ │ │ │ ├── B2MML-BatchML-CodeGeneration.docx
88
+ │ │ │ │ ├── B2MML-Documentation.pdf
89
+ │ │ │ │ ├── B2MML-JSON-Documentation.pdf
90
+ │ │ │ │ ├── BatchML-BatchInformation.docx
91
+ │ │ │ │ ├── BatchML-BatchProductionRecord.docx
92
+ │ │ │ │ └── BatchML-GeneralRecipe.docx
93
+ │ │ │ ├── Examples/
94
+ │ │ │ │ ├── BatchML v02 Cough Syrup Example Files.zip
95
+ │ │ │ │ ├── BatchML v0401 Example with extensions.zip
96
+ │ │ │ │ ├── Courbon B2MML v0401 Example XML Files.zip
97
+ │ │ │ │ ├── Readme.txt
98
+ │ │ │ │ └── ReportAboutUseOfB2MMLinARTISAN.pdf
99
+ │ │ │ ├── Schema/
100
+ │ │ │ │ ├── AllSchemas.json
101
+ │ │ │ │ ├── B2MML-AllExtensions.xsd
102
+ │ │ │ │ ├── B2MML-Common.xsd
103
+ │ │ │ │ ├── B2MML-CommonExtensions.xsd
104
+ │ │ │ │ ├── ...
105
+ │ │ │ │ └── BatchML-GeneralRecipeExtensions.xsd
106
+ │ │ │ └── README.md
107
+ │ │ └── README.md
108
+ │ ├── __init__.py # Package initialization
109
+ │ ├── cli.py # Command line interface
110
+ │ ├── eclass_build_mapping.py # ECLASS build mapping
111
+ │ ├── isa95_build_mapping.py # ISA95 build mapping
112
+ │ ├── model.py # Core models for DPP layers
113
+ │ ├── part_class.py # Universal part class set
114
+ │ ├── schema_base.py # Base schema for DPP layers
115
+ │ ├── schema_registry.py # Schema registry
116
+ │ └── utils.py # Any helper functions
117
+ ├── tests/
118
+ │ ├── test_mappers.py # Test mappers
119
+ │ ├── test_model.py # Test models
120
+ │ ├── test_part_class.py # Test part classes
121
+ │ ├── test_registry_extended.py # Test registry extended
122
+ │ ├── test_schema_registry.py # Test schema registry
123
+ │ └── test_schema_registry_second.py # Test schema registry second
124
+ ├── .gitignore # Git ignore
125
+ ├── .gitattributes # Git attributes
126
+ ├── coffee_machine.json # Coffee machine DPP
127
+ ├── eclass_part_class_mapping.yaml # ECLASS part class mapping
128
+ ├── generate_dpp_json.py # Generate Coffee Machine DPP JSON
129
+ ├── isa95_part_class_mapping.yaml # ISA95 part class mapping
130
+ ├── LICENSE.txt # License
131
+ ├── package.json # Package configuration
132
+ ├── PRD_DPP.md # Product requirements document
133
+ ├── pyproject.toml # Project configuration
134
+ ├── README.md # README
135
+ └── usage.py # Usage example
136
+ ```
137
+ ---
138
+
139
+ ## Requirements
140
+ - Python 3.7+
141
+ - No external dependencies (uses Python dataclasses and standard library)
142
+
143
+ ---
144
+
145
+ ## Installation
146
+ ### From PyPI
147
+ ```shell
148
+ pip install nmis_dpp_test
149
+ ```
150
+ ### From Source
151
+ ```shell
152
+ git clone https://github.com/nmis-group/nmis_dpp_test.git
153
+ cd nmis_dpp_test
154
+ pip install .
155
+ ```
156
+
157
+
158
+ ---
159
+
160
+ ## Usage Example
161
+
162
+ We have created a simple python file to showcase the usage.
163
+ ```shell
164
+ cd nmis_dpp_test
165
+
166
+ # 1. Generate a sample DPP JSON file (using helper script or usage_test logic)
167
+ python generate_dpp_json.py
168
+
169
+ # 2. Run the main usage script with input file and target schema
170
+ python usage.py coffee_machine.json ECLASS
171
+ # python usage.py coffee_machine.json ISA-95
172
+ ```
173
+
174
+ ---
175
+
176
+ ## Quick Start Steps
177
+ 1. Install with `pip` or from source.
178
+ 2. Import model layers and part classes.
179
+ 3. Create instances and assemble your passport.
180
+
181
+ ---
182
+
183
+ ## License
184
+ Distributed under the MIT License. See `LICENSE.txt` for details.
185
+
186
+ ---
187
+
188
+
@@ -0,0 +1,155 @@
1
+ # Digital Product Passport
2
+
3
+ [![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
4
+ ![Stars](https://img.shields.io/github/stars/nmis-group/remake_dpp.svg?style=flat&label=Star&maxAge=86400)
5
+ [![GitHub open issues](https://img.shields.io/github/issues-raw/nmis-group/remake_dpp.svg)](https://github.com/nmis-group/remake_dpp/issues)
6
+ [![GitHub open pull requests](https://img.shields.io/github/issues-pr-raw/nmis-group/remake_dpp.svg)](https://github.com/nmis-group/remake_dpp/pulls)
7
+ ![Repo Size](https://img.shields.io/github/repo-size/nmis-group/remake_dpp.svg?label=Repo%20size&style=flat-square)
8
+ ![Contributors](https://img.shields.io/github/contributors/nmis-group/remake_dpp.svg?style=flat&label=Contributors&maxAge=86400)
9
+
10
+ ## Contents
11
+
12
+ - [Description](#description)
13
+ - [Package Layout](#package-layout)
14
+ - [Requirements](#requirements)
15
+ - [Installation](#installation)
16
+ - [Usage Example](#usage-example)
17
+
18
+ ---
19
+ ## Description
20
+
21
+ A modular Python package that enables manufacturing companies to create interoperable Digital Product Passports (DPPs) by mapping their existing business data to standardized DPP data models using automated semantic matching and intuitive configuration tools.
22
+
23
+ ---
24
+ ## Package Layout
25
+
26
+ ```text
27
+ remake_dpp/
28
+ ├── docs/
29
+ │ ├── api-model.md
30
+ │ ├── api-schema-registry.md
31
+ │ ├── concepts-gas.md
32
+ │ ├── docs.json
33
+ │ ├── intro.md
34
+ │ ├── quickstart.md
35
+ │ ├── schemas-eclass.md
36
+ │ ├── schemas-isa95.md
37
+ │ └── usage-python.md
38
+ ├── nmis_dpp/
39
+ │ ├── mappers/
40
+ │ │ ├── __init__.py
41
+ │ │ ├── eclass_mapper.py
42
+ │ │ └── isa95_mapper.py
43
+ │ ├── ontology_data/
44
+ │ │ ├── eclass_16/
45
+ │ │ │ ├── dictionary_assets_en/
46
+ │ │ │ │ ├── ECLASS16_0_ASSET_EN_SG_13.xml
47
+ │ │ │ │ ├── ...
48
+ │ │ │ │ └── ECLASS16_0_ASSET_EN_SG_90.xml
49
+ │ │ │ ├── unitsml_en/
50
+ │ │ │ │ └── ECLASS16_0_UNITSML_EN.xml
51
+ │ │ │ └── ECLASS_ASSET_XML_Read_Me_EN_v1.pdf
52
+ │ │ ├── isa95/
53
+ │ │ │ ├── Documentation/
54
+ │ │ │ │ ├── B2MML-BatchML-CodeGeneration.docx
55
+ │ │ │ │ ├── B2MML-Documentation.pdf
56
+ │ │ │ │ ├── B2MML-JSON-Documentation.pdf
57
+ │ │ │ │ ├── BatchML-BatchInformation.docx
58
+ │ │ │ │ ├── BatchML-BatchProductionRecord.docx
59
+ │ │ │ │ └── BatchML-GeneralRecipe.docx
60
+ │ │ │ ├── Examples/
61
+ │ │ │ │ ├── BatchML v02 Cough Syrup Example Files.zip
62
+ │ │ │ │ ├── BatchML v0401 Example with extensions.zip
63
+ │ │ │ │ ├── Courbon B2MML v0401 Example XML Files.zip
64
+ │ │ │ │ ├── Readme.txt
65
+ │ │ │ │ └── ReportAboutUseOfB2MMLinARTISAN.pdf
66
+ │ │ │ ├── Schema/
67
+ │ │ │ │ ├── AllSchemas.json
68
+ │ │ │ │ ├── B2MML-AllExtensions.xsd
69
+ │ │ │ │ ├── B2MML-Common.xsd
70
+ │ │ │ │ ├── B2MML-CommonExtensions.xsd
71
+ │ │ │ │ ├── ...
72
+ │ │ │ │ └── BatchML-GeneralRecipeExtensions.xsd
73
+ │ │ │ └── README.md
74
+ │ │ └── README.md
75
+ │ ├── __init__.py # Package initialization
76
+ │ ├── cli.py # Command line interface
77
+ │ ├── eclass_build_mapping.py # ECLASS build mapping
78
+ │ ├── isa95_build_mapping.py # ISA95 build mapping
79
+ │ ├── model.py # Core models for DPP layers
80
+ │ ├── part_class.py # Universal part class set
81
+ │ ├── schema_base.py # Base schema for DPP layers
82
+ │ ├── schema_registry.py # Schema registry
83
+ │ └── utils.py # Any helper functions
84
+ ├── tests/
85
+ │ ├── test_mappers.py # Test mappers
86
+ │ ├── test_model.py # Test models
87
+ │ ├── test_part_class.py # Test part classes
88
+ │ ├── test_registry_extended.py # Test registry extended
89
+ │ ├── test_schema_registry.py # Test schema registry
90
+ │ └── test_schema_registry_second.py # Test schema registry second
91
+ ├── .gitignore # Git ignore
92
+ ├── .gitattributes # Git attributes
93
+ ├── coffee_machine.json # Coffee machine DPP
94
+ ├── eclass_part_class_mapping.yaml # ECLASS part class mapping
95
+ ├── generate_dpp_json.py # Generate Coffee Machine DPP JSON
96
+ ├── isa95_part_class_mapping.yaml # ISA95 part class mapping
97
+ ├── LICENSE.txt # License
98
+ ├── package.json # Package configuration
99
+ ├── PRD_DPP.md # Product requirements document
100
+ ├── pyproject.toml # Project configuration
101
+ ├── README.md # README
102
+ └── usage.py # Usage example
103
+ ```
104
+ ---
105
+
106
+ ## Requirements
107
+ - Python 3.7+
108
+ - No external dependencies (uses Python dataclasses and standard library)
109
+
110
+ ---
111
+
112
+ ## Installation
113
+ ### From PyPI
114
+ ```shell
115
+ pip install nmis_dpp_test
116
+ ```
117
+ ### From Source
118
+ ```shell
119
+ git clone https://github.com/nmis-group/nmis_dpp_test.git
120
+ cd nmis_dpp_test
121
+ pip install .
122
+ ```
123
+
124
+
125
+ ---
126
+
127
+ ## Usage Example
128
+
129
+ We have created a simple python file to showcase the usage.
130
+ ```shell
131
+ cd nmis_dpp_test
132
+
133
+ # 1. Generate a sample DPP JSON file (using helper script or usage_test logic)
134
+ python generate_dpp_json.py
135
+
136
+ # 2. Run the main usage script with input file and target schema
137
+ python usage.py coffee_machine.json ECLASS
138
+ # python usage.py coffee_machine.json ISA-95
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Quick Start Steps
144
+ 1. Install with `pip` or from source.
145
+ 2. Import model layers and part classes.
146
+ 3. Create instances and assemble your passport.
147
+
148
+ ---
149
+
150
+ ## License
151
+ Distributed under the MIT License. See `LICENSE.txt` for details.
152
+
153
+ ---
154
+
155
+
@@ -0,0 +1,47 @@
1
+ """
2
+ nmis_dpp package initializer.
3
+
4
+ This module exposes key Digital Product Passport layers and universal part classes
5
+ for easy import, along with serialization utilities and the schema registry.
6
+ """
7
+
8
+ from .model import (
9
+ IdentityLayer, StructureLayer, LifecycleLayer, RiskLayer,
10
+ SustainabilityLayer, ProvenanceLayer, DigitalProductPassport
11
+ )
12
+ from .part_class import (
13
+ PartClass, PowerConversion, EnergyStorage, Actuator, Sensor,
14
+ ControlUnit, UserInterface, Thermal, Fluidics, Structural,
15
+ Transmission, Protection, Connectivity, SoftwareModule,
16
+ Consumable, Fastener
17
+ )
18
+ from .utils import to_dict, to_json, validate_part_class
19
+
20
+ # Import registry and default registration
21
+ from .schema_registry import (
22
+ SchemaRegistry, get_global_registry, register_default_mappers
23
+ )
24
+
25
+ # Import build mapping modules (requested to be available)
26
+ from . import eclass_build_mapping
27
+ from . import isa95_build_mapping
28
+
29
+ # Register built-in mappers by default
30
+ register_default_mappers()
31
+
32
+ __all__ = [
33
+ # Layers
34
+ "IdentityLayer", "StructureLayer", "LifecycleLayer", "RiskLayer",
35
+ "SustainabilityLayer", "ProvenanceLayer", "DigitalProductPassport",
36
+ # Part classes
37
+ "PartClass", "PowerConversion", "EnergyStorage", "Actuator", "Sensor",
38
+ "ControlUnit", "UserInterface", "Thermal", "Fluidics", "Structural",
39
+ "Transmission", "Protection", "Connectivity", "SoftwareModule",
40
+ "Consumable", "Fastener",
41
+ # Utils
42
+ "to_dict", "to_json", "validate_part_class",
43
+ # Registry
44
+ "SchemaRegistry", "get_global_registry", "register_default_mappers",
45
+ # Build mappings
46
+ "eclass_build_mapping", "isa95_build_mapping"
47
+ ]
@@ -0,0 +1,159 @@
1
+ """
2
+ cli.py
3
+
4
+ Command-line interface for the nmis_dpp package.
5
+ Allows users to generate sample Digital Product Passports mapped to available schemas.
6
+ """
7
+
8
+ import json
9
+ import logging
10
+ import sys
11
+ from typing import Dict, Any
12
+
13
+ from nmis_dpp import get_global_registry
14
+ from nmis_dpp.model import (
15
+ IdentityLayer, StructureLayer, LifecycleLayer, RiskLayer,
16
+ SustainabilityLayer, ProvenanceLayer, DigitalProductPassport
17
+ )
18
+ from nmis_dpp.part_class import (
19
+ Actuator, Sensor, PowerConversion
20
+ )
21
+ from nmis_dpp.utils import to_dict
22
+
23
+ # Configure basic logging to avoid noise but show important info
24
+ logging.basicConfig(level=logging.WARNING, format='%(levelname)s: %(message)s')
25
+
26
+ def create_sample_dpp() -> DigitalProductPassport:
27
+ """
28
+ Create a dummy DigitalProductPassport for demonstration purposes.
29
+ Reused from usage.py example logic.
30
+ """
31
+ # 1. Define parts
32
+ motor = Actuator(
33
+ part_id="A001",
34
+ name="Drive Motor",
35
+ type="Actuator",
36
+ torque=2.1,
37
+ speed=1750,
38
+ duty_cycle=0.7,
39
+ voltage=48,
40
+ actuation_type="electric"
41
+ )
42
+ temperature_sensor = Sensor(
43
+ part_id="S003",
44
+ name="Temp Sensor",
45
+ type="Sensor",
46
+ sensor_type="temperature",
47
+ range_min=-40,
48
+ range_max=120,
49
+ accuracy=0.25,
50
+ drift=0.01,
51
+ response_time=7
52
+ )
53
+ psu = PowerConversion(
54
+ part_id="P001",
55
+ name="PSU",
56
+ type="PowerConversion",
57
+ input_voltage=230,
58
+ output_voltage=48,
59
+ power_rating=350,
60
+ efficiency=0.92
61
+ )
62
+
63
+ # 2. Build layers
64
+ identity = IdentityLayer(
65
+ global_ids={"gtin": "987654321", "serial": "SN1245"},
66
+ make_model={"brand": "Acme", "model": "UnitX", "hw_rev": "A", "fw_rev": "2.0"},
67
+ ownership={"manufacturer": "Acme Ltd", "owner": "BuyerOrg", "operator": "MaintainerX", "location": "Berlin"},
68
+ conformity=["CE", "RoHS", "UKCA"]
69
+ )
70
+ structure = StructureLayer(
71
+ hierarchy={
72
+ "product": "UnitX",
73
+ "components": ["A001", "S003", "P001"] # Simplified referencing
74
+ },
75
+ parts=[motor, temperature_sensor, psu],
76
+ interfaces=[
77
+ {"type": "electrical", "details": {"voltage": 48, "connector": "XT60"}},
78
+ {"type": "data", "details": {"protocol": "CAN"}}
79
+ ],
80
+ materials=[{"cas": "7439-89-6", "%mass": 70, "recyclable": "yes"}],
81
+ bom_refs=["XWZ-002"]
82
+ )
83
+ lifecycle = LifecycleLayer(
84
+ manufacture={"lot": "Batch77", "factory": "ACMEPlant", "date": "2025-03-18", "process": "injection", "co2e": 27.3},
85
+ use={"counters": {"hours": 143}, "telemetry": {}},
86
+ serviceability={"schedule": {"interval": "1Y"}, "repair_steps": ["Open housing", "Replace motor"], "repairability_score": 6},
87
+ events=[{"event_type": "install", "timestamp": "2025-04-01"}],
88
+ end_of_life={"disassembly": ["Unplug connectors"], "hazards": ["None"], "recovery_routes": ["Recycle", "Landfill"]}
89
+ )
90
+ risk = RiskLayer(
91
+ criticality={"levels": "Safety", "llp": False, "mtbf": 20000},
92
+ fmea=[{"failure_mode": "overheat", "effect": "shutdown", "mitigation": "cooling upgrade"}],
93
+ security={"sbom": "link", "vulnerabilities": [], "signing_keys": ["pubkey-xyz"], "update_policy": "signed-only"}
94
+ )
95
+ sustainability = SustainabilityLayer(
96
+ mass=5.0,
97
+ energy={"standby": 2.0, "active": 15.0, "water_use": 0.0},
98
+ recycled_content={"pcr_percent": 39, "bio": 2},
99
+ remanufacture={"eligible": True, "grading_criteria": {"condition": "A"}},
100
+ )
101
+ provenance = ProvenanceLayer(
102
+ signatures=[{"type": "manufacturer", "certificate": "certABC"}],
103
+ trace_links=["EPCIS:event1", "NFC:TAG773"]
104
+ )
105
+
106
+ # 3. Create passport
107
+ return DigitalProductPassport(
108
+ identity=identity,
109
+ structure=structure,
110
+ lifecycle=lifecycle,
111
+ risk=risk,
112
+ sustainability=sustainability,
113
+ provenance=provenance
114
+ )
115
+
116
+ def main():
117
+ print("--- NMIS DPP Generator CLI ---")
118
+
119
+ registry = get_global_registry()
120
+ schemas = registry.list_schemas()
121
+
122
+ if not schemas:
123
+ print("No schemas registered. Please check your installation.")
124
+ return
125
+
126
+ print("Available schemas:")
127
+ for i, s in enumerate(schemas, 1):
128
+ print(f" {i}. {s}")
129
+
130
+ schema_choice = input("\nEnter the name of the schema to use (or 'q' to quit): ").strip()
131
+
132
+ if schema_choice.lower() == 'q':
133
+ return
134
+
135
+ # Basic alias resolution fallback if they typed a number (optional enhancement)
136
+ # but sticking to name as per plan
137
+
138
+ try:
139
+ mapper = registry.get_mapper(schema_choice)
140
+ except KeyError:
141
+ print(f"Error: Schema '{schema_choice}' not found.")
142
+ print(f"Available: {', '.join(schemas)}")
143
+ sys.exit(1)
144
+
145
+ print(f"\nGenerating sample DPP and mapping to {mapper.get_schema_name()}...")
146
+
147
+ dpp = create_sample_dpp()
148
+
149
+ try:
150
+ mapped_data = mapper.map_dpp(dpp)
151
+ print("\n--- Mapped Result (JSON-LD) ---")
152
+ print(json.dumps(mapped_data, indent=2))
153
+ print("\nSuccess.")
154
+ except Exception as e:
155
+ print(f"Error during mapping: {e}")
156
+ sys.exit(1)
157
+
158
+ if __name__ == "__main__":
159
+ main()