cudag 0.3.10__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 (69) hide show
  1. cudag/__init__.py +334 -0
  2. cudag/annotation/__init__.py +77 -0
  3. cudag/annotation/codegen.py +648 -0
  4. cudag/annotation/config.py +545 -0
  5. cudag/annotation/loader.py +342 -0
  6. cudag/annotation/scaffold.py +121 -0
  7. cudag/annotation/transcription.py +296 -0
  8. cudag/cli/__init__.py +5 -0
  9. cudag/cli/main.py +315 -0
  10. cudag/cli/new.py +873 -0
  11. cudag/core/__init__.py +364 -0
  12. cudag/core/button.py +137 -0
  13. cudag/core/canvas.py +222 -0
  14. cudag/core/config.py +70 -0
  15. cudag/core/coords.py +233 -0
  16. cudag/core/data_grid.py +804 -0
  17. cudag/core/dataset.py +678 -0
  18. cudag/core/distribution.py +136 -0
  19. cudag/core/drawing.py +75 -0
  20. cudag/core/fonts.py +156 -0
  21. cudag/core/generator.py +163 -0
  22. cudag/core/grid.py +367 -0
  23. cudag/core/grounding_task.py +247 -0
  24. cudag/core/icon.py +207 -0
  25. cudag/core/iconlist_task.py +301 -0
  26. cudag/core/models.py +1251 -0
  27. cudag/core/random.py +130 -0
  28. cudag/core/renderer.py +190 -0
  29. cudag/core/screen.py +402 -0
  30. cudag/core/scroll_task.py +254 -0
  31. cudag/core/scrollable_grid.py +447 -0
  32. cudag/core/state.py +110 -0
  33. cudag/core/task.py +293 -0
  34. cudag/core/taskbar.py +350 -0
  35. cudag/core/text.py +212 -0
  36. cudag/core/utils.py +82 -0
  37. cudag/data/surnames.txt +5000 -0
  38. cudag/modal_apps/__init__.py +4 -0
  39. cudag/modal_apps/archive.py +103 -0
  40. cudag/modal_apps/extract.py +138 -0
  41. cudag/modal_apps/preprocess.py +529 -0
  42. cudag/modal_apps/upload.py +317 -0
  43. cudag/prompts/SYSTEM_PROMPT.txt +104 -0
  44. cudag/prompts/__init__.py +33 -0
  45. cudag/prompts/system.py +43 -0
  46. cudag/prompts/tools.py +382 -0
  47. cudag/py.typed +0 -0
  48. cudag/schemas/filesystem.json +90 -0
  49. cudag/schemas/test_record.schema.json +113 -0
  50. cudag/schemas/train_record.schema.json +90 -0
  51. cudag/server/__init__.py +21 -0
  52. cudag/server/app.py +232 -0
  53. cudag/server/services/__init__.py +9 -0
  54. cudag/server/services/generator.py +128 -0
  55. cudag/templates/scripts/archive.sh +35 -0
  56. cudag/templates/scripts/build.sh +13 -0
  57. cudag/templates/scripts/extract.sh +54 -0
  58. cudag/templates/scripts/generate.sh +116 -0
  59. cudag/templates/scripts/pre-commit.sh +44 -0
  60. cudag/templates/scripts/preprocess.sh +46 -0
  61. cudag/templates/scripts/upload.sh +63 -0
  62. cudag/templates/scripts/verify.py +428 -0
  63. cudag/validation/__init__.py +35 -0
  64. cudag/validation/validate.py +508 -0
  65. cudag-0.3.10.dist-info/METADATA +570 -0
  66. cudag-0.3.10.dist-info/RECORD +69 -0
  67. cudag-0.3.10.dist-info/WHEEL +4 -0
  68. cudag-0.3.10.dist-info/entry_points.txt +2 -0
  69. cudag-0.3.10.dist-info/licenses/LICENSE +66 -0
cudag/__init__.py ADDED
@@ -0,0 +1,334 @@
1
+ # Copyright (c) 2025 Tylt LLC. All rights reserved.
2
+ # CONFIDENTIAL AND PROPRIETARY. Unauthorized use, copying, or distribution
3
+ # is strictly prohibited. For licensing inquiries: hello@claimhawk.app
4
+
5
+ """CUDAG - ComputerUseDataAugmentedGeneration framework.
6
+
7
+ A Rails-like DSL for generating VLM training data.
8
+
9
+ Example model:
10
+ class Patient(Model):
11
+ first_name = string(faker="first_name")
12
+ last_name = string(faker="last_name")
13
+ dob = date_field(min_year=1940, max_year=2010)
14
+
15
+ full_name = computed("first_name", "last_name")
16
+ appointments = has_many("Appointment")
17
+
18
+ Example screen:
19
+ class CalendarScreen(Screen):
20
+ name = "calendar"
21
+ base_image = "calendar.png"
22
+ size = (224, 208)
23
+
24
+ day_grid = grid((10, 50, 210, 150), rows=6, cols=7)
25
+ back_month = button((7, 192, 20, 12), label="Back")
26
+
27
+ CLI:
28
+ cudag new <project-name>
29
+ cudag generate --config config/dataset.yaml
30
+ """
31
+
32
+ __version__ = "0.1.0"
33
+
34
+ # Core classes and DSL functions
35
+ from cudag.core import (
36
+ # Coordinates
37
+ RU_MAX,
38
+ bounds_to_tolerance,
39
+ calculate_tolerance_ru,
40
+ tolerance_to_ru,
41
+ # Model DSL - classes
42
+ Attachment,
43
+ # Renderer
44
+ BaseRenderer,
45
+ # State
46
+ BaseState,
47
+ # Task
48
+ BaseTask,
49
+ # Utils
50
+ check_script_invocation,
51
+ get_researcher_name,
52
+ # Generator
53
+ run_generator,
54
+ # Fonts
55
+ load_font,
56
+ load_font_family,
57
+ SYSTEM_FONTS,
58
+ # Random utilities
59
+ choose,
60
+ date_in_range,
61
+ amount,
62
+ weighted_choice,
63
+ # Text utilities
64
+ measure_text,
65
+ center_text_position,
66
+ draw_centered_text,
67
+ wrap_text,
68
+ truncate_text,
69
+ ordinal_suffix,
70
+ # Drawing utilities
71
+ render_scrollbar,
72
+ # Config utilities
73
+ load_yaml_config,
74
+ get_config_path,
75
+ BelongsToRel,
76
+ BoolField,
77
+ # Screen DSL - classes
78
+ Bounds,
79
+ ButtonRegion,
80
+ ChoiceField,
81
+ Claim,
82
+ ClickRegion,
83
+ ComputedField,
84
+ # Dataset
85
+ DatasetBuilder,
86
+ DatasetConfig,
87
+ # Distribution
88
+ DistributionSampler,
89
+ # Scroll Tasks
90
+ ScrollTaskBase,
91
+ ScrollTaskConfig,
92
+ # Grounding Tasks
93
+ GroundingTaskBase,
94
+ bbox_to_ru,
95
+ scale_bbox,
96
+ DateField,
97
+ DropdownRegion,
98
+ TestCase,
99
+ Field,
100
+ FloatField,
101
+ GridRegion,
102
+ HasManyRel,
103
+ HasOneRel,
104
+ IntField,
105
+ ListField,
106
+ Model,
107
+ ModelGenerator,
108
+ MoneyField,
109
+ Patient,
110
+ Procedure,
111
+ Provider,
112
+ Region,
113
+ Relationship,
114
+ Screen,
115
+ ScreenBase,
116
+ ScreenMeta,
117
+ ScrollRegion,
118
+ ScrollState,
119
+ StringField,
120
+ TaskContext,
121
+ TaskSample,
122
+ TimeField,
123
+ # Model DSL - functions
124
+ attribute,
125
+ belongs_to,
126
+ boolean,
127
+ # Screen DSL - functions
128
+ button,
129
+ choice,
130
+ clamp_coord,
131
+ computed,
132
+ coord_distance,
133
+ coord_within_tolerance,
134
+ date_field,
135
+ decimal,
136
+ dropdown,
137
+ grid,
138
+ has_many,
139
+ has_one,
140
+ integer,
141
+ list_of,
142
+ money,
143
+ normalize_coord,
144
+ pixel_from_normalized,
145
+ region,
146
+ scrollable,
147
+ string,
148
+ time_field,
149
+ years_since,
150
+ # Semantic field types
151
+ City,
152
+ ClaimNumber,
153
+ ClaimStatus,
154
+ DOB,
155
+ Email,
156
+ Fee,
157
+ FirstName,
158
+ FullName,
159
+ LastName,
160
+ LicenseNumber,
161
+ MemberID,
162
+ NPI,
163
+ Phone,
164
+ ProcedureCode,
165
+ SSN,
166
+ Specialty,
167
+ State,
168
+ Street,
169
+ ZipCode,
170
+ )
171
+
172
+ # Prompts
173
+ from cudag.prompts import (
174
+ COMPUTER_USE_TOOL,
175
+ CUA_SYSTEM_PROMPT,
176
+ TOOL_ACTIONS,
177
+ BboxCall,
178
+ ToolCall,
179
+ format_tool_call,
180
+ get_system_prompt,
181
+ parse_tool_call,
182
+ validate_tool_call,
183
+ )
184
+
185
+ __all__ = [
186
+ # Version
187
+ "__version__",
188
+ # Coordinates
189
+ "RU_MAX",
190
+ "normalize_coord",
191
+ "pixel_from_normalized",
192
+ "clamp_coord",
193
+ "coord_distance",
194
+ "coord_within_tolerance",
195
+ "tolerance_to_ru",
196
+ "bounds_to_tolerance",
197
+ "calculate_tolerance_ru",
198
+ # Screen DSL - classes
199
+ "Screen",
200
+ "ScreenBase",
201
+ "ScreenMeta",
202
+ "Region",
203
+ "Bounds",
204
+ "ClickRegion",
205
+ "ButtonRegion",
206
+ "GridRegion",
207
+ "ScrollRegion",
208
+ "DropdownRegion",
209
+ # Screen DSL - functions
210
+ "region",
211
+ "button",
212
+ "grid",
213
+ "scrollable",
214
+ "dropdown",
215
+ # State
216
+ "BaseState",
217
+ "ScrollState",
218
+ # Renderer
219
+ "BaseRenderer",
220
+ # Task
221
+ "BaseTask",
222
+ "TaskSample",
223
+ "TaskContext",
224
+ "TestCase",
225
+ # Dataset
226
+ "DatasetBuilder",
227
+ "DatasetConfig",
228
+ # Distribution
229
+ "DistributionSampler",
230
+ # Scroll Tasks
231
+ "ScrollTaskBase",
232
+ "ScrollTaskConfig",
233
+ # Grounding Tasks
234
+ "GroundingTaskBase",
235
+ "bbox_to_ru",
236
+ "scale_bbox",
237
+ # Model DSL - classes
238
+ "Model",
239
+ "ModelGenerator",
240
+ "Field",
241
+ "StringField",
242
+ "IntField",
243
+ "FloatField",
244
+ "BoolField",
245
+ "DateField",
246
+ "TimeField",
247
+ "ChoiceField",
248
+ "ListField",
249
+ "MoneyField",
250
+ "ComputedField",
251
+ # Model DSL - functions
252
+ "string",
253
+ "integer",
254
+ "decimal",
255
+ "money",
256
+ "date_field",
257
+ "time_field",
258
+ "boolean",
259
+ "choice",
260
+ "list_of",
261
+ "computed",
262
+ "years_since",
263
+ # Relationship DSL - classes
264
+ "Relationship",
265
+ "HasManyRel",
266
+ "BelongsToRel",
267
+ "HasOneRel",
268
+ # Relationship DSL - functions
269
+ "has_many",
270
+ "belongs_to",
271
+ "has_one",
272
+ # Common healthcare models
273
+ "Patient",
274
+ "Provider",
275
+ "Procedure",
276
+ "Claim",
277
+ "Attachment",
278
+ # Semantic field types
279
+ "FirstName",
280
+ "LastName",
281
+ "FullName",
282
+ "DOB",
283
+ "NPI",
284
+ "SSN",
285
+ "Phone",
286
+ "Email",
287
+ "Street",
288
+ "City",
289
+ "State",
290
+ "ZipCode",
291
+ "MemberID",
292
+ "ClaimNumber",
293
+ "ProcedureCode",
294
+ "LicenseNumber",
295
+ "Specialty",
296
+ "ClaimStatus",
297
+ "Fee",
298
+ # Prompts
299
+ "COMPUTER_USE_TOOL",
300
+ "TOOL_ACTIONS",
301
+ "BboxCall",
302
+ "ToolCall",
303
+ "format_tool_call",
304
+ "parse_tool_call",
305
+ "validate_tool_call",
306
+ "CUA_SYSTEM_PROMPT",
307
+ "get_system_prompt",
308
+ # Utils
309
+ "check_script_invocation",
310
+ "get_researcher_name",
311
+ # Generator
312
+ "run_generator",
313
+ # Fonts
314
+ "load_font",
315
+ "load_font_family",
316
+ "SYSTEM_FONTS",
317
+ # Random utilities
318
+ "choose",
319
+ "date_in_range",
320
+ "amount",
321
+ "weighted_choice",
322
+ # Text utilities
323
+ "measure_text",
324
+ "center_text_position",
325
+ "draw_centered_text",
326
+ "wrap_text",
327
+ "truncate_text",
328
+ "ordinal_suffix",
329
+ # Drawing utilities
330
+ "render_scrollbar",
331
+ # Config utilities
332
+ "load_yaml_config",
333
+ "get_config_path",
334
+ ]
@@ -0,0 +1,77 @@
1
+ # Copyright (c) 2025 Tylt LLC. All rights reserved.
2
+ # CONFIDENTIAL AND PROPRIETARY. Unauthorized use, copying, or distribution
3
+ # is strictly prohibited. For licensing inquiries: hello@claimhawk.app
4
+
5
+ """Annotation parsing and code generation for CUDAG.
6
+
7
+ This module provides utilities for parsing Annotator exports and
8
+ generating CUDAG project code from them.
9
+
10
+ Example:
11
+ from cudag.annotation import AnnotationLoader, scaffold_generator
12
+
13
+ loader = AnnotationLoader()
14
+ parsed = loader.load("annotation.zip")
15
+
16
+ scaffold_generator(
17
+ name="my-generator",
18
+ annotation=parsed,
19
+ output_dir=Path("./projects"),
20
+ )
21
+
22
+ For runtime data-driven generation:
23
+ from cudag.annotation import AnnotationConfig
24
+
25
+ config = AnnotationConfig.load(Path("assets/annotations"))
26
+ for icon in config.get_labeled_icons("desktop"):
27
+ print(f"{icon.label} at {icon.absolute_center}")
28
+
29
+ For parsing grid transcriptions:
30
+ from cudag.annotation import parse_transcription
31
+
32
+ grid = config.get_element_by_label("patient-account")
33
+ if grid and grid.transcription:
34
+ for row in grid.transcription.rows:
35
+ print([cell.text for cell in row.cells])
36
+ """
37
+
38
+ from cudag.annotation.config import (
39
+ AnnotatedElement,
40
+ AnnotatedIcon,
41
+ AnnotatedTask,
42
+ AnnotationConfig,
43
+ )
44
+ from cudag.annotation.loader import (
45
+ AnnotationLoader,
46
+ ParsedAnnotation,
47
+ ParsedElement,
48
+ ParsedTask,
49
+ )
50
+ from cudag.annotation.scaffold import scaffold_generator
51
+ from cudag.annotation.transcription import (
52
+ ParsedTranscription,
53
+ TranscriptionCell,
54
+ TranscriptionRow,
55
+ parse_text_transcription,
56
+ parse_transcription,
57
+ )
58
+
59
+ __all__ = [
60
+ # Runtime config (for data-driven generators)
61
+ "AnnotationConfig",
62
+ "AnnotatedElement",
63
+ "AnnotatedIcon",
64
+ "AnnotatedTask",
65
+ # Transcription parsing (for grid data extraction)
66
+ "ParsedTranscription",
67
+ "TranscriptionCell",
68
+ "TranscriptionRow",
69
+ "parse_transcription",
70
+ "parse_text_transcription",
71
+ # Code generation (for scaffolding new generators)
72
+ "AnnotationLoader",
73
+ "ParsedAnnotation",
74
+ "ParsedElement",
75
+ "ParsedTask",
76
+ "scaffold_generator",
77
+ ]