planar 0.9.3__py3-none-any.whl → 0.11.0__py3-none-any.whl

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.
Files changed (76) hide show
  1. planar/ai/agent.py +2 -1
  2. planar/ai/agent_base.py +24 -5
  3. planar/ai/state.py +17 -0
  4. planar/app.py +18 -1
  5. planar/data/connection.py +108 -0
  6. planar/data/dataset.py +11 -104
  7. planar/data/utils.py +89 -0
  8. planar/db/alembic/env.py +25 -1
  9. planar/files/storage/azure_blob.py +1 -1
  10. planar/registry_items.py +2 -0
  11. planar/routers/dataset_router.py +213 -0
  12. planar/routers/info.py +79 -36
  13. planar/routers/models.py +1 -0
  14. planar/routers/workflow.py +2 -0
  15. planar/scaffold_templates/pyproject.toml.j2 +1 -1
  16. planar/security/authorization.py +31 -3
  17. planar/security/default_policies.cedar +25 -0
  18. planar/testing/fixtures.py +34 -1
  19. planar/testing/planar_test_client.py +1 -1
  20. planar/workflows/decorators.py +2 -1
  21. planar/workflows/wrappers.py +1 -0
  22. {planar-0.9.3.dist-info → planar-0.11.0.dist-info}/METADATA +9 -1
  23. {planar-0.9.3.dist-info → planar-0.11.0.dist-info}/RECORD +25 -72
  24. {planar-0.9.3.dist-info → planar-0.11.0.dist-info}/WHEEL +1 -1
  25. planar/ai/test_agent_serialization.py +0 -229
  26. planar/ai/test_agent_tool_step_display.py +0 -78
  27. planar/data/test_dataset.py +0 -354
  28. planar/files/storage/test_azure_blob.py +0 -435
  29. planar/files/storage/test_local_directory.py +0 -162
  30. planar/files/storage/test_s3.py +0 -299
  31. planar/files/test_files.py +0 -282
  32. planar/human/test_human.py +0 -385
  33. planar/logging/test_formatter.py +0 -327
  34. planar/modeling/mixins/test_auditable.py +0 -97
  35. planar/modeling/mixins/test_timestamp.py +0 -134
  36. planar/modeling/mixins/test_uuid_primary_key.py +0 -52
  37. planar/routers/test_agents_router.py +0 -174
  38. planar/routers/test_files_router.py +0 -49
  39. planar/routers/test_object_config_router.py +0 -367
  40. planar/routers/test_routes_security.py +0 -168
  41. planar/routers/test_rule_router.py +0 -470
  42. planar/routers/test_workflow_router.py +0 -539
  43. planar/rules/test_data/account_dormancy_management.json +0 -223
  44. planar/rules/test_data/airline_loyalty_points_calculator.json +0 -262
  45. planar/rules/test_data/applicant_risk_assessment.json +0 -435
  46. planar/rules/test_data/booking_fraud_detection.json +0 -407
  47. planar/rules/test_data/cellular_data_rollover_system.json +0 -258
  48. planar/rules/test_data/clinical_trial_eligibility_screener.json +0 -437
  49. planar/rules/test_data/customer_lifetime_value.json +0 -143
  50. planar/rules/test_data/import_duties_calculator.json +0 -289
  51. planar/rules/test_data/insurance_prior_authorization.json +0 -443
  52. planar/rules/test_data/online_check_in_eligibility_system.json +0 -254
  53. planar/rules/test_data/order_consolidation_system.json +0 -375
  54. planar/rules/test_data/portfolio_risk_monitor.json +0 -471
  55. planar/rules/test_data/supply_chain_risk.json +0 -253
  56. planar/rules/test_data/warehouse_cross_docking.json +0 -237
  57. planar/rules/test_rules.py +0 -1494
  58. planar/security/tests/test_auth_middleware.py +0 -162
  59. planar/security/tests/test_authorization_context.py +0 -78
  60. planar/security/tests/test_cedar_basics.py +0 -41
  61. planar/security/tests/test_cedar_policies.py +0 -158
  62. planar/security/tests/test_jwt_principal_context.py +0 -179
  63. planar/test_app.py +0 -142
  64. planar/test_cli.py +0 -394
  65. planar/test_config.py +0 -515
  66. planar/test_object_config.py +0 -527
  67. planar/test_object_registry.py +0 -14
  68. planar/test_sqlalchemy.py +0 -193
  69. planar/test_utils.py +0 -105
  70. planar/testing/test_memory_storage.py +0 -143
  71. planar/workflows/test_concurrency_detection.py +0 -120
  72. planar/workflows/test_lock_timeout.py +0 -140
  73. planar/workflows/test_serialization.py +0 -1203
  74. planar/workflows/test_suspend_deserialization.py +0 -231
  75. planar/workflows/test_workflow.py +0 -2005
  76. {planar-0.9.3.dist-info → planar-0.11.0.dist-info}/entry_points.txt +0 -0
@@ -1,253 +0,0 @@
1
- {
2
- "nodes": [
3
- {
4
- "type": "inputNode",
5
- "content": {
6
- "schema": ""
7
- },
8
- "id": "input",
9
- "name": "request",
10
- "position": {
11
- "x": 110,
12
- "y": 114
13
- }
14
- },
15
- {
16
- "type": "decisionTableNode",
17
- "content": {
18
- "hitPolicy": "first",
19
- "rules": [
20
- {
21
- "_id": "rule1",
22
- "supplierLocation": "'high_risk_region'",
23
- "historicalPerformance": "< 70",
24
- "alternativeSources": "< 2",
25
- "riskScore": "80",
26
- "riskCategory": "'critical'",
27
- "mitigation": "'Immediate action required: Identify alternative suppliers'"
28
- },
29
- {
30
- "_id": "rule2",
31
- "supplierLocation": "'high_risk_region'",
32
- "historicalPerformance": ">= 70",
33
- "alternativeSources": "",
34
- "riskScore": "65",
35
- "riskCategory": "'high'",
36
- "mitigation": "'Develop backup suppliers and increase safety stock'"
37
- },
38
- {
39
- "_id": "rule3",
40
- "supplierLocation": "'medium_risk_region'",
41
- "historicalPerformance": "< 80",
42
- "alternativeSources": "< 3",
43
- "riskScore": "60",
44
- "riskCategory": "'high'",
45
- "mitigation": "'Implement dual-sourcing strategy'"
46
- },
47
- {
48
- "_id": "rule4",
49
- "supplierLocation": "'medium_risk_region'",
50
- "historicalPerformance": ">= 80",
51
- "alternativeSources": "",
52
- "riskScore": "40",
53
- "riskCategory": "'medium'",
54
- "mitigation": "'Monitor supplier performance and conduct quarterly reviews'"
55
- },
56
- {
57
- "_id": "rule5",
58
- "supplierLocation": "'low_risk_region'",
59
- "historicalPerformance": "< 75",
60
- "alternativeSources": "",
61
- "riskScore": "35",
62
- "riskCategory": "'medium'",
63
- "mitigation": "'Schedule regular performance reviews'"
64
- },
65
- {
66
- "_id": "rule6",
67
- "supplierLocation": "'low_risk_region'",
68
- "historicalPerformance": ">= 75",
69
- "alternativeSources": ">= 3",
70
- "riskScore": "15",
71
- "riskCategory": "'low'",
72
- "mitigation": "'Standard monitoring procedures'"
73
- },
74
- {
75
- "_id": "rule7",
76
- "supplierLocation": "",
77
- "historicalPerformance": "",
78
- "alternativeSources": "",
79
- "riskScore": "50",
80
- "riskCategory": "'medium'",
81
- "mitigation": "'Conduct detailed supplier assessment'"
82
- }
83
- ],
84
- "inputs": [
85
- {
86
- "id": "supplierLocation",
87
- "name": "Supplier Location",
88
- "field": "supplier.location"
89
- },
90
- {
91
- "id": "historicalPerformance",
92
- "name": "Historical Performance Score",
93
- "field": "supplier.performanceScore"
94
- },
95
- {
96
- "id": "alternativeSources",
97
- "name": "Alternative Sources Count",
98
- "field": "supplier.alternateSourcesCount"
99
- }
100
- ],
101
- "outputs": [
102
- {
103
- "id": "riskScore",
104
- "name": "Risk Score",
105
- "field": "assessment.baseRiskScore"
106
- },
107
- {
108
- "id": "riskCategory",
109
- "name": "Risk Category",
110
- "field": "assessment.baseRiskCategory"
111
- },
112
- {
113
- "id": "mitigation",
114
- "name": "Recommended Mitigation",
115
- "field": "assessment.recommendedAction"
116
- }
117
- ],
118
- "passThrough": true,
119
- "inputField": null,
120
- "outputPath": null,
121
- "executionMode": "single"
122
- },
123
- "id": "supplierRiskEvaluation",
124
- "name": "supplierRiskEvaluation",
125
- "position": {
126
- "x": 430,
127
- "y": 114
128
- }
129
- },
130
- {
131
- "type": "expressionNode",
132
- "content": {
133
- "expressions": [
134
- {
135
- "id": "expr1",
136
- "key": "geopoliticalFactor",
137
- "value": "geopoliticalTensions == true ? 1.3 : 1.0"
138
- },
139
- {
140
- "id": "expr2",
141
- "key": "marketVolatilityFactor",
142
- "value": "marketVolatility == 'high' ? 1.2 : (marketVolatility == 'medium' ? 1.1 : 1.0)"
143
- },
144
- {
145
- "id": "expr3",
146
- "key": "adjustedRiskScore",
147
- "value": "min([round(assessment.baseRiskScore * $.geopoliticalFactor * $.marketVolatilityFactor), 100])"
148
- }
149
- ],
150
- "passThrough": true,
151
- "inputField": null,
152
- "outputPath": null,
153
- "executionMode": "single"
154
- },
155
- "id": "geopoliticalRiskCalculation",
156
- "name": "geopoliticalRiskCalculation",
157
- "position": {
158
- "x": 750,
159
- "y": 114
160
- }
161
- },
162
- {
163
- "type": "decisionTableNode",
164
- "content": {
165
- "hitPolicy": "first",
166
- "rules": [
167
- {
168
- "_id": "finalRule1",
169
- "adjustedRiskScore": ">= 75",
170
- "finalCategory": "'critical'",
171
- "leadTimeImpact": "'significant'",
172
- "priorityLevel": "'immediate'"
173
- },
174
- {
175
- "_id": "finalRule2",
176
- "adjustedRiskScore": ">= 60",
177
- "finalCategory": "'high'",
178
- "leadTimeImpact": "'moderate'",
179
- "priorityLevel": "'high'"
180
- },
181
- {
182
- "_id": "finalRule3",
183
- "adjustedRiskScore": ">= 40",
184
- "finalCategory": "'medium'",
185
- "leadTimeImpact": "'minor'",
186
- "priorityLevel": "'medium'"
187
- },
188
- {
189
- "_id": "finalRule4",
190
- "adjustedRiskScore": "",
191
- "finalCategory": "'low'",
192
- "leadTimeImpact": "'minimal'",
193
- "priorityLevel": "'routine'"
194
- }
195
- ],
196
- "inputs": [
197
- {
198
- "id": "adjustedRiskScore",
199
- "name": "Adjusted Risk Score",
200
- "field": "adjustedRiskScore"
201
- }
202
- ],
203
- "outputs": [
204
- {
205
- "id": "finalCategory",
206
- "name": "Final Risk Category",
207
- "field": "finalAssessment.riskCategory"
208
- },
209
- {
210
- "id": "leadTimeImpact",
211
- "name": "Lead Time Impact",
212
- "field": "finalAssessment.leadTimeImpact"
213
- },
214
- {
215
- "id": "priorityLevel",
216
- "name": "Priority Level",
217
- "field": "finalAssessment.priorityLevel"
218
- }
219
- ],
220
- "passThrough": true,
221
- "inputField": null,
222
- "outputPath": null,
223
- "executionMode": "single"
224
- },
225
- "id": "overallRiskAssessment",
226
- "name": "overallRiskAssessment",
227
- "position": {
228
- "x": 1070,
229
- "y": 114
230
- }
231
- }
232
- ],
233
- "edges": [
234
- {
235
- "id": "edge1",
236
- "sourceId": "input",
237
- "targetId": "supplierRiskEvaluation",
238
- "type": "edge"
239
- },
240
- {
241
- "id": "edge2",
242
- "sourceId": "supplierRiskEvaluation",
243
- "targetId": "geopoliticalRiskCalculation",
244
- "type": "edge"
245
- },
246
- {
247
- "id": "edge3",
248
- "sourceId": "geopoliticalRiskCalculation",
249
- "targetId": "overallRiskAssessment",
250
- "type": "edge"
251
- }
252
- ]
253
- }
@@ -1,237 +0,0 @@
1
- {
2
- "nodes": [
3
- {
4
- "type": "inputNode",
5
- "content": {
6
- "schema": ""
7
- },
8
- "id": "ip1",
9
- "name": "shipmentRequest",
10
- "position": {
11
- "x": 110,
12
- "y": 173.5
13
- }
14
- },
15
- {
16
- "type": "expressionNode",
17
- "content": {
18
- "expressions": [
19
- {
20
- "id": "e1-1",
21
- "key": "hasMatchingOutboundOrders",
22
- "value": "len(matchingOutboundOrders) > 0"
23
- },
24
- {
25
- "id": "e1-2",
26
- "key": "timeDifferenceHours",
27
- "value": "(date(outboundShipmentTime) - date(inboundShipmentTime)) / 3600"
28
- },
29
- {
30
- "id": "e1-3",
31
- "key": "warehouseCapacityPercentage",
32
- "value": "(currentStorageUsed / totalStorageCapacity) * 100"
33
- }
34
- ],
35
- "passThrough": true,
36
- "inputField": null,
37
- "outputPath": null,
38
- "executionMode": "single"
39
- },
40
- "id": "ex1",
41
- "name": "calculateMetrics",
42
- "position": {
43
- "x": 430,
44
- "y": 173.5
45
- }
46
- },
47
- {
48
- "type": "decisionTableNode",
49
- "content": {
50
- "hitPolicy": "first",
51
- "rules": [
52
- {
53
- "_id": "r1-1",
54
- "i1-1": "true",
55
- "i1-2": "[0..24]",
56
- "i1-3": "<= 36",
57
- "o1-1": "'cross-dock'",
58
- "o1-2": "'Matching orders available within 24 hours with sufficient capacity'"
59
- },
60
- {
61
- "_id": "r1-2",
62
- "i1-1": "true",
63
- "i1-2": "[0..48]",
64
- "i1-3": "<= 80",
65
- "o1-1": "'cross-dock'",
66
- "o1-2": "'Matching orders available within 48 hours'"
67
- },
68
- {
69
- "_id": "r1-3",
70
- "i1-1": "true",
71
- "i1-2": "> 48",
72
- "i1-3": ">= 90",
73
- "o1-1": "'cross-dock'",
74
- "o1-2": "'High warehouse capacity, cross-dock to save space'"
75
- },
76
- {
77
- "_id": "r1-4",
78
- "i1-1": "true",
79
- "i1-2": "> 72",
80
- "i1-3": "",
81
- "o1-1": "'store'",
82
- "o1-2": "'Matching orders but time difference too large'"
83
- },
84
- {
85
- "_id": "r1-5",
86
- "i1-1": "false",
87
- "i1-2": "",
88
- "i1-3": "",
89
- "o1-1": "'store'",
90
- "o1-2": "'No matching outbound orders'"
91
- }
92
- ],
93
- "inputs": [
94
- {
95
- "id": "i1-1",
96
- "name": "Has Matching Orders",
97
- "field": "hasMatchingOutboundOrders"
98
- },
99
- {
100
- "id": "i1-2",
101
- "name": "Time Difference (hours)",
102
- "field": "timeDifferenceHours"
103
- },
104
- {
105
- "id": "i1-3",
106
- "name": "Warehouse Capacity (%)",
107
- "field": "warehouseCapacityPercentage"
108
- }
109
- ],
110
- "outputs": [
111
- {
112
- "id": "o1-1",
113
- "name": "Decision",
114
- "field": "crossDockDecision"
115
- },
116
- {
117
- "id": "o1-2",
118
- "name": "Reason",
119
- "field": "decisionReason"
120
- }
121
- ],
122
- "passThrough": true,
123
- "inputField": null,
124
- "outputPath": null,
125
- "executionMode": "single"
126
- },
127
- "id": "dt1",
128
- "name": "crossDockingDecision",
129
- "position": {
130
- "x": 750,
131
- "y": 173.5
132
- }
133
- },
134
- {
135
- "type": "switchNode",
136
- "content": {
137
- "hitPolicy": "first",
138
- "statements": [
139
- {
140
- "id": "s1-1",
141
- "condition": "crossDockDecision == 'cross-dock'",
142
- "isDefault": false
143
- },
144
- {
145
- "id": "s1-2",
146
- "condition": "",
147
- "isDefault": true
148
- }
149
- ]
150
- },
151
- "id": "sw1",
152
- "name": "handleCrossDocking",
153
- "position": {
154
- "x": 1070,
155
- "y": 173.5
156
- }
157
- },
158
- {
159
- "type": "expressionNode",
160
- "content": {
161
- "expressions": [
162
- {
163
- "id": "e2-1",
164
- "key": "dockingBay",
165
- "value": "crossDockingBayAssignment"
166
- },
167
- {
168
- "id": "e2-2",
169
- "key": "estimatedProcessingTime",
170
- "value": "30"
171
- },
172
- {
173
- "id": "e2-3",
174
- "key": "priority",
175
- "value": "timeDifferenceHours < 12 ? 'high' : 'normal'"
176
- }
177
- ],
178
- "passThrough": true,
179
- "inputField": null,
180
- "outputPath": null,
181
- "executionMode": "single"
182
- },
183
- "id": "ex2",
184
- "name": "assignCrossDockingDetails",
185
- "position": {
186
- "x": 1390,
187
- "y": 173.5
188
- }
189
- },
190
- {
191
- "type": "outputNode",
192
- "content": {
193
- "schema": ""
194
- },
195
- "id": "e1a7d99b-255e-47a2-929f-642fc0e7efc5",
196
- "name": "response",
197
- "position": {
198
- "x": 1390,
199
- "y": 305
200
- }
201
- }
202
- ],
203
- "edges": [
204
- {
205
- "id": "ed1",
206
- "sourceId": "ip1",
207
- "targetId": "ex1",
208
- "type": "edge"
209
- },
210
- {
211
- "id": "ed2",
212
- "sourceId": "ex1",
213
- "targetId": "dt1",
214
- "type": "edge"
215
- },
216
- {
217
- "id": "ed3",
218
- "sourceId": "dt1",
219
- "targetId": "sw1",
220
- "type": "edge"
221
- },
222
- {
223
- "id": "ed4",
224
- "sourceId": "sw1",
225
- "targetId": "ex2",
226
- "sourceHandle": "s1-1",
227
- "type": "edge"
228
- },
229
- {
230
- "id": "7d282229-bce6-47a6-a68d-ed867787a674",
231
- "sourceId": "sw1",
232
- "type": "edge",
233
- "targetId": "e1a7d99b-255e-47a2-929f-642fc0e7efc5",
234
- "sourceHandle": "s1-2"
235
- }
236
- ]
237
- }