uks-sdk 1.0.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.
- uks_sdk-1.0.0/PKG-INFO +137 -0
- uks_sdk-1.0.0/README_PYPI.md +111 -0
- uks_sdk-1.0.0/pyproject.toml +42 -0
- uks_sdk-1.0.0/setup.cfg +4 -0
- uks_sdk-1.0.0/tests/test_conformance.py +109 -0
- uks_sdk-1.0.0/uks_sdk/__init__.py +73 -0
- uks_sdk-1.0.0/uks_sdk/schema/UKS.v3.schema.json +545 -0
- uks_sdk-1.0.0/uks_sdk/types.py +255 -0
- uks_sdk-1.0.0/uks_sdk/validate.py +143 -0
- uks_sdk-1.0.0/uks_sdk.egg-info/PKG-INFO +137 -0
- uks_sdk-1.0.0/uks_sdk.egg-info/SOURCES.txt +12 -0
- uks_sdk-1.0.0/uks_sdk.egg-info/dependency_links.txt +1 -0
- uks_sdk-1.0.0/uks_sdk.egg-info/requires.txt +2 -0
- uks_sdk-1.0.0/uks_sdk.egg-info/top_level.txt +1 -0
uks_sdk-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: uks-sdk
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python SDK for Universal Knowledge & Action Schema (UKS) v3.0
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/Vybecode-LTD/SaberTools/tree/main/packages/uks-sdk-py#readme
|
|
7
|
+
Project-URL: Specification, https://github.com/Vybecode-LTD/SaberTools/tree/main/spec
|
|
8
|
+
Project-URL: Source, https://github.com/Vybecode-LTD/SaberTools
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/Vybecode-LTD/SaberTools/issues
|
|
10
|
+
Keywords: uks,universal-knowledge-schema,pydantic,json-schema,knowledge,ai-agent
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
Requires-Dist: pydantic>=2.7
|
|
25
|
+
Requires-Dist: jsonschema>=4.22
|
|
26
|
+
|
|
27
|
+
# uks-sdk (Python)
|
|
28
|
+
|
|
29
|
+
Python SDK for building and validating
|
|
30
|
+
[Universal Knowledge & Action Schema (UKS)](https://uks.dev) v3.0 packets.
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
pip install uks-sdk
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
### Validate a packet
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from uks_sdk import validate, validate_file
|
|
42
|
+
|
|
43
|
+
# From a dict
|
|
44
|
+
result = validate(packet_dict)
|
|
45
|
+
print(result.valid, result.inferred_level, result.level_match)
|
|
46
|
+
if not result.valid:
|
|
47
|
+
for err in result.errors:
|
|
48
|
+
print(err)
|
|
49
|
+
|
|
50
|
+
# From a file
|
|
51
|
+
result = validate_file("my-packet.uks.json")
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Build a packet with Pydantic models
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from uks_sdk import UKSPacket, Source, Topic
|
|
58
|
+
|
|
59
|
+
packet = UKSPacket(
|
|
60
|
+
packet_id="uks-omega3-v1",
|
|
61
|
+
schema_version="3.0",
|
|
62
|
+
conformance_level="L1",
|
|
63
|
+
created_at="2026-06-16T00:00:00Z",
|
|
64
|
+
topic=Topic(title="Omega-3 Fatty Acids"), # topic is an object, not a bare string
|
|
65
|
+
sources=[
|
|
66
|
+
Source(
|
|
67
|
+
id="src_001",
|
|
68
|
+
title="Effect of EPA and DHA on cardiovascular risk",
|
|
69
|
+
source_type="research_paper",
|
|
70
|
+
credibility_score=9,
|
|
71
|
+
evidence_grade="high",
|
|
72
|
+
clinical_status="validated",
|
|
73
|
+
doi="10.1000/example",
|
|
74
|
+
license_label="CC BY 4.0",
|
|
75
|
+
rights_url="https://creativecommons.org/licenses/by/4.0/",
|
|
76
|
+
)
|
|
77
|
+
],
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
import json
|
|
81
|
+
# by_alias=True so `_extensions` (not `extensions`) is emitted
|
|
82
|
+
print(json.dumps(packet.model_dump(by_alias=True, exclude_none=True), indent=2))
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Validate a built packet
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
result = validate(packet.model_dump(by_alias=True, exclude_none=True))
|
|
89
|
+
assert result.valid
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Types
|
|
93
|
+
|
|
94
|
+
All UKS v3.0 types are available as Pydantic v2 models:
|
|
95
|
+
|
|
96
|
+
| Model | Description |
|
|
97
|
+
|-------|-------------|
|
|
98
|
+
| `UKSPacket` | Root packet object |
|
|
99
|
+
| `Source` | Research source |
|
|
100
|
+
| `DataContract` | Layer A contract |
|
|
101
|
+
| `ScrapeTarget` | Layer B acquisition target |
|
|
102
|
+
| `ExtractionRule` | Layer C parsing rule |
|
|
103
|
+
| `Directive` | Layer D processing rule |
|
|
104
|
+
| `Action` | Layer E action |
|
|
105
|
+
| `ActionStep` | Individual action step |
|
|
106
|
+
| `AgentInstructions` | Agent behavior configuration |
|
|
107
|
+
| `KnowledgeNode` | Entity in the knowledge graph |
|
|
108
|
+
|
|
109
|
+
## Evidence Grades
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
from uks_sdk import EvidenceGrade
|
|
113
|
+
|
|
114
|
+
EvidenceGrade.HIGH # "high" — meta-analyses of RCTs
|
|
115
|
+
EvidenceGrade.MODERATE # "moderate" — individual RCTs
|
|
116
|
+
EvidenceGrade.LOW # "low" — observational studies
|
|
117
|
+
EvidenceGrade.VERY_LOW # "very_low" — expert opinion
|
|
118
|
+
EvidenceGrade.NA # "n_a" — datasets, non-clinical
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Requirements
|
|
122
|
+
|
|
123
|
+
- Python 3.10+
|
|
124
|
+
- pydantic >= 2.7
|
|
125
|
+
- jsonschema >= 4.22
|
|
126
|
+
|
|
127
|
+
## Links
|
|
128
|
+
|
|
129
|
+
- [Specification](https://uks.dev/spec/)
|
|
130
|
+
- [CLI (uks-cli)](https://www.npmjs.com/package/uks-cli)
|
|
131
|
+
- [TypeScript SDK (@uks/sdk)](https://www.npmjs.com/package/@uks/sdk)
|
|
132
|
+
- [MCP Server (@uks/mcp-server)](https://www.npmjs.com/package/@uks/mcp-server)
|
|
133
|
+
- [GitHub](https://github.com/UKS-Standard/uks-spec)
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
MIT
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# uks-sdk (Python)
|
|
2
|
+
|
|
3
|
+
Python SDK for building and validating
|
|
4
|
+
[Universal Knowledge & Action Schema (UKS)](https://uks.dev) v3.0 packets.
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
pip install uks-sdk
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
### Validate a packet
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
from uks_sdk import validate, validate_file
|
|
16
|
+
|
|
17
|
+
# From a dict
|
|
18
|
+
result = validate(packet_dict)
|
|
19
|
+
print(result.valid, result.inferred_level, result.level_match)
|
|
20
|
+
if not result.valid:
|
|
21
|
+
for err in result.errors:
|
|
22
|
+
print(err)
|
|
23
|
+
|
|
24
|
+
# From a file
|
|
25
|
+
result = validate_file("my-packet.uks.json")
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Build a packet with Pydantic models
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from uks_sdk import UKSPacket, Source, Topic
|
|
32
|
+
|
|
33
|
+
packet = UKSPacket(
|
|
34
|
+
packet_id="uks-omega3-v1",
|
|
35
|
+
schema_version="3.0",
|
|
36
|
+
conformance_level="L1",
|
|
37
|
+
created_at="2026-06-16T00:00:00Z",
|
|
38
|
+
topic=Topic(title="Omega-3 Fatty Acids"), # topic is an object, not a bare string
|
|
39
|
+
sources=[
|
|
40
|
+
Source(
|
|
41
|
+
id="src_001",
|
|
42
|
+
title="Effect of EPA and DHA on cardiovascular risk",
|
|
43
|
+
source_type="research_paper",
|
|
44
|
+
credibility_score=9,
|
|
45
|
+
evidence_grade="high",
|
|
46
|
+
clinical_status="validated",
|
|
47
|
+
doi="10.1000/example",
|
|
48
|
+
license_label="CC BY 4.0",
|
|
49
|
+
rights_url="https://creativecommons.org/licenses/by/4.0/",
|
|
50
|
+
)
|
|
51
|
+
],
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
import json
|
|
55
|
+
# by_alias=True so `_extensions` (not `extensions`) is emitted
|
|
56
|
+
print(json.dumps(packet.model_dump(by_alias=True, exclude_none=True), indent=2))
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Validate a built packet
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
result = validate(packet.model_dump(by_alias=True, exclude_none=True))
|
|
63
|
+
assert result.valid
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Types
|
|
67
|
+
|
|
68
|
+
All UKS v3.0 types are available as Pydantic v2 models:
|
|
69
|
+
|
|
70
|
+
| Model | Description |
|
|
71
|
+
|-------|-------------|
|
|
72
|
+
| `UKSPacket` | Root packet object |
|
|
73
|
+
| `Source` | Research source |
|
|
74
|
+
| `DataContract` | Layer A contract |
|
|
75
|
+
| `ScrapeTarget` | Layer B acquisition target |
|
|
76
|
+
| `ExtractionRule` | Layer C parsing rule |
|
|
77
|
+
| `Directive` | Layer D processing rule |
|
|
78
|
+
| `Action` | Layer E action |
|
|
79
|
+
| `ActionStep` | Individual action step |
|
|
80
|
+
| `AgentInstructions` | Agent behavior configuration |
|
|
81
|
+
| `KnowledgeNode` | Entity in the knowledge graph |
|
|
82
|
+
|
|
83
|
+
## Evidence Grades
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from uks_sdk import EvidenceGrade
|
|
87
|
+
|
|
88
|
+
EvidenceGrade.HIGH # "high" — meta-analyses of RCTs
|
|
89
|
+
EvidenceGrade.MODERATE # "moderate" — individual RCTs
|
|
90
|
+
EvidenceGrade.LOW # "low" — observational studies
|
|
91
|
+
EvidenceGrade.VERY_LOW # "very_low" — expert opinion
|
|
92
|
+
EvidenceGrade.NA # "n_a" — datasets, non-clinical
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Requirements
|
|
96
|
+
|
|
97
|
+
- Python 3.10+
|
|
98
|
+
- pydantic >= 2.7
|
|
99
|
+
- jsonschema >= 4.22
|
|
100
|
+
|
|
101
|
+
## Links
|
|
102
|
+
|
|
103
|
+
- [Specification](https://uks.dev/spec/)
|
|
104
|
+
- [CLI (uks-cli)](https://www.npmjs.com/package/uks-cli)
|
|
105
|
+
- [TypeScript SDK (@uks/sdk)](https://www.npmjs.com/package/@uks/sdk)
|
|
106
|
+
- [MCP Server (@uks/mcp-server)](https://www.npmjs.com/package/@uks/mcp-server)
|
|
107
|
+
- [GitHub](https://github.com/UKS-Standard/uks-spec)
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
MIT
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "uks-sdk"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Python SDK for Universal Knowledge & Action Schema (UKS) v3.0"
|
|
9
|
+
license = { text = "MIT" }
|
|
10
|
+
readme = "README_PYPI.md"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"pydantic>=2.7",
|
|
14
|
+
"jsonschema>=4.22",
|
|
15
|
+
]
|
|
16
|
+
keywords = ["uks", "universal-knowledge-schema", "pydantic", "json-schema", "knowledge", "ai-agent"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Intended Audience :: Science/Research",
|
|
21
|
+
"License :: OSI Approved :: MIT License",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
27
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
28
|
+
"Typing :: Typed",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
"Homepage" = "https://github.com/Vybecode-LTD/SaberTools/tree/main/packages/uks-sdk-py#readme"
|
|
33
|
+
"Specification" = "https://github.com/Vybecode-LTD/SaberTools/tree/main/spec"
|
|
34
|
+
"Source" = "https://github.com/Vybecode-LTD/SaberTools"
|
|
35
|
+
"Bug Tracker" = "https://github.com/Vybecode-LTD/SaberTools/issues"
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.packages.find]
|
|
38
|
+
where = ["."]
|
|
39
|
+
include = ["uks_sdk*"]
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.package-data]
|
|
42
|
+
uks_sdk = ["schema/*.json"]
|
uks_sdk-1.0.0/setup.cfg
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Cross-implementation conformance parity harness for uks-sdk (Python).
|
|
3
|
+
Runs validate_file() over the canonical spec corpus (examples + valid/ + invalid/)
|
|
4
|
+
so the Python SDK is proven to agree with the CLI and the TypeScript SDK.
|
|
5
|
+
|
|
6
|
+
Run from anywhere: python packages/uks-sdk-py/tests/test_conformance.py
|
|
7
|
+
Exits non-zero on any mismatch.
|
|
8
|
+
"""
|
|
9
|
+
import pathlib
|
|
10
|
+
import sys
|
|
11
|
+
|
|
12
|
+
# Make the local uks_sdk importable without installing.
|
|
13
|
+
_PKG_ROOT = pathlib.Path(__file__).resolve().parents[1]
|
|
14
|
+
sys.path.insert(0, str(_PKG_ROOT))
|
|
15
|
+
|
|
16
|
+
from uks_sdk import validate, validate_file, UKSPacket # noqa: E402
|
|
17
|
+
|
|
18
|
+
_REPO_ROOT = pathlib.Path(__file__).resolve().parents[3]
|
|
19
|
+
_SPEC = _REPO_ROOT / "spec"
|
|
20
|
+
|
|
21
|
+
passed = 0
|
|
22
|
+
failed = 0
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _check(directory: pathlib.Path, want_valid: bool, label: str) -> None:
|
|
26
|
+
global passed, failed
|
|
27
|
+
print(f"{label}:")
|
|
28
|
+
for f in sorted(directory.glob("*.json")):
|
|
29
|
+
result = validate_file(f)
|
|
30
|
+
ok = result.valid == want_valid
|
|
31
|
+
if ok:
|
|
32
|
+
print(f" OK {f.name}")
|
|
33
|
+
passed += 1
|
|
34
|
+
else:
|
|
35
|
+
why = (
|
|
36
|
+
f"expected valid, got: {result.errors[0].path} {result.errors[0].message}"
|
|
37
|
+
if want_valid else "expected invalid but passed"
|
|
38
|
+
)
|
|
39
|
+
print(f" XX {f.name} — {why}")
|
|
40
|
+
failed += 1
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _check_level_mismatch(directory: pathlib.Path, label: str) -> None:
|
|
44
|
+
"""Schema-valid packets whose declared conformance_level != inferred level:
|
|
45
|
+
must be valid AND flag level_match=False (parity guard for level inference)."""
|
|
46
|
+
global passed, failed
|
|
47
|
+
print(f"{label}:")
|
|
48
|
+
for f in sorted(directory.glob("*.json")):
|
|
49
|
+
result = validate_file(f)
|
|
50
|
+
if result.valid is True and result.level_match is False:
|
|
51
|
+
print(f" OK {f.name} (declared {result.declared_level} != inferred {result.inferred_level})")
|
|
52
|
+
passed += 1
|
|
53
|
+
else:
|
|
54
|
+
print(f" XX {f.name} — expected valid + level_match=False, "
|
|
55
|
+
f"got valid={result.valid} level_match={result.level_match}")
|
|
56
|
+
failed += 1
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _check_model_parity() -> None:
|
|
60
|
+
"""SDK-2: the Pydantic model must agree with the JSON Schema. It must NOT
|
|
61
|
+
accept a root ``description``/``tags`` (the schema root is
|
|
62
|
+
additionalProperties:false and defines neither), and a valid model must
|
|
63
|
+
round-trip to a schema-valid dict."""
|
|
64
|
+
global passed, failed
|
|
65
|
+
print("Model/schema parity (SDK-2):")
|
|
66
|
+
|
|
67
|
+
minimal_source = dict(id="src_001", title="t", source_type="meta_analysis",
|
|
68
|
+
credibility_score=9, evidence_grade="high",
|
|
69
|
+
clinical_status="validated")
|
|
70
|
+
base = dict(packet_id="pkt_model", conformance_level="L1",
|
|
71
|
+
created_at="2026-06-18T00:00:00Z", topic={"title": "t"},
|
|
72
|
+
sources=[minimal_source])
|
|
73
|
+
|
|
74
|
+
# 1. A root field the JSON Schema forbids must be rejected by the model too.
|
|
75
|
+
rejected = False
|
|
76
|
+
try:
|
|
77
|
+
UKSPacket(**base, description="not a root field")
|
|
78
|
+
except Exception:
|
|
79
|
+
rejected = True
|
|
80
|
+
|
|
81
|
+
# 2. A valid model round-trips to a schema-valid dict.
|
|
82
|
+
pkt = UKSPacket(**base)
|
|
83
|
+
rt = validate(pkt.model_dump(mode="json", by_alias=True, exclude_none=True))
|
|
84
|
+
|
|
85
|
+
if rejected and rt.valid:
|
|
86
|
+
print(" OK model rejects root description; valid model round-trips schema-valid")
|
|
87
|
+
passed += 1
|
|
88
|
+
else:
|
|
89
|
+
why = f"rejected_root_description={rejected} roundtrip_valid={rt.valid}"
|
|
90
|
+
if not rt.valid:
|
|
91
|
+
why += f" errors={[e.message for e in rt.errors]}"
|
|
92
|
+
print(f" XX model/schema drift — {why}")
|
|
93
|
+
failed += 1
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def main() -> int:
|
|
97
|
+
print("\nuks-sdk conformance parity (Python implementation)\n")
|
|
98
|
+
_check(_SPEC / "examples", True, "Canonical examples (must pass)")
|
|
99
|
+
_check(_SPEC / "tests" / "valid", True, "Valid packets (must pass)")
|
|
100
|
+
_check(_SPEC / "tests" / "invalid", False, "Invalid packets (must fail)")
|
|
101
|
+
_check_level_mismatch(_SPEC / "tests" / "level-mismatch", "Level mismatch (valid but declared != inferred)")
|
|
102
|
+
_check_model_parity()
|
|
103
|
+
total = passed + failed
|
|
104
|
+
print(f"\n{total} checks: {passed} passed, {failed} failed\n")
|
|
105
|
+
return 1 if failed else 0
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
if __name__ == "__main__":
|
|
109
|
+
sys.exit(main())
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""
|
|
2
|
+
uks-sdk — Python SDK for Universal Knowledge & Action Schema v3.0
|
|
3
|
+
|
|
4
|
+
Usage::
|
|
5
|
+
|
|
6
|
+
from uks_sdk import UKSPacket, Topic, Source, EvidenceGrade, ClinicalStatus, validate
|
|
7
|
+
|
|
8
|
+
source = Source(
|
|
9
|
+
id='src_001',
|
|
10
|
+
title='Vitamin D meta-analysis',
|
|
11
|
+
source_type='meta_analysis',
|
|
12
|
+
credibility_score=9,
|
|
13
|
+
evidence_grade=EvidenceGrade.high,
|
|
14
|
+
clinical_status=ClinicalStatus.validated,
|
|
15
|
+
license_label='CC BY 4.0',
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
packet = UKSPacket(
|
|
19
|
+
packet_id='pkt_001',
|
|
20
|
+
schema_version='3.0',
|
|
21
|
+
conformance_level='L1',
|
|
22
|
+
created_at='2026-06-16T00:00:00Z',
|
|
23
|
+
topic=Topic(title='Vitamin D supplementation'),
|
|
24
|
+
sources=[source],
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
result = validate(packet.model_dump(by_alias=True, exclude_none=True))
|
|
28
|
+
assert result.valid
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
from .types import (
|
|
33
|
+
UKSPacket,
|
|
34
|
+
Topic,
|
|
35
|
+
Source,
|
|
36
|
+
DataContract,
|
|
37
|
+
ScrapeTarget,
|
|
38
|
+
ExtractionRule,
|
|
39
|
+
Directive,
|
|
40
|
+
Action,
|
|
41
|
+
ActionStep,
|
|
42
|
+
Trigger,
|
|
43
|
+
AgentInstructions,
|
|
44
|
+
ConformanceLevel,
|
|
45
|
+
SourceDomain,
|
|
46
|
+
EvidenceGrade,
|
|
47
|
+
ClinicalStatus,
|
|
48
|
+
SourceType,
|
|
49
|
+
)
|
|
50
|
+
from .validate import validate, validate_file, ValidationResult, ValidationError
|
|
51
|
+
|
|
52
|
+
__all__ = [
|
|
53
|
+
'UKSPacket',
|
|
54
|
+
'Topic',
|
|
55
|
+
'Source',
|
|
56
|
+
'DataContract',
|
|
57
|
+
'ScrapeTarget',
|
|
58
|
+
'ExtractionRule',
|
|
59
|
+
'Directive',
|
|
60
|
+
'Action',
|
|
61
|
+
'ActionStep',
|
|
62
|
+
'Trigger',
|
|
63
|
+
'AgentInstructions',
|
|
64
|
+
'ConformanceLevel',
|
|
65
|
+
'SourceDomain',
|
|
66
|
+
'EvidenceGrade',
|
|
67
|
+
'ClinicalStatus',
|
|
68
|
+
'SourceType',
|
|
69
|
+
'validate',
|
|
70
|
+
'validate_file',
|
|
71
|
+
'ValidationResult',
|
|
72
|
+
'ValidationError',
|
|
73
|
+
]
|