usdm3 0.3.2__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 (236) hide show
  1. usdm3/__init__.py +20 -0
  2. usdm3/__version__.py +2 -0
  3. usdm3/api/__init__.py +116 -0
  4. usdm3/api/activity.py +14 -0
  5. usdm3/api/address.py +14 -0
  6. usdm3/api/administration_duration.py +11 -0
  7. usdm3/api/agent_administration.py +13 -0
  8. usdm3/api/alias_code.py +9 -0
  9. usdm3/api/analysis_population.py +7 -0
  10. usdm3/api/api_base_model.py +45 -0
  11. usdm3/api/biomedical_concept.py +12 -0
  12. usdm3/api/biomedical_concept_category.py +10 -0
  13. usdm3/api/biomedical_concept_property.py +13 -0
  14. usdm3/api/biomedical_concept_surrogate.py +7 -0
  15. usdm3/api/characteristic.py +6 -0
  16. usdm3/api/code.py +10 -0
  17. usdm3/api/condition.py +10 -0
  18. usdm3/api/eligibility_criterion.py +12 -0
  19. usdm3/api/encounter.py +16 -0
  20. usdm3/api/endpoint.py +9 -0
  21. usdm3/api/estimand.py +13 -0
  22. usdm3/api/geographic_scope.py +16 -0
  23. usdm3/api/governance_date.py +12 -0
  24. usdm3/api/indication.py +9 -0
  25. usdm3/api/intercurrent_event.py +7 -0
  26. usdm3/api/masking.py +8 -0
  27. usdm3/api/narrative_content.py +12 -0
  28. usdm3/api/objective.py +10 -0
  29. usdm3/api/organization.py +18 -0
  30. usdm3/api/population_definition.py +26 -0
  31. usdm3/api/procedure.py +10 -0
  32. usdm3/api/quantity.py +9 -0
  33. usdm3/api/range.py +11 -0
  34. usdm3/api/response_code.py +9 -0
  35. usdm3/api/schedule_timeline.py +15 -0
  36. usdm3/api/schedule_timeline_exit.py +6 -0
  37. usdm3/api/scheduled_instance.py +27 -0
  38. usdm3/api/study.py +16 -0
  39. usdm3/api/study_amendment.py +15 -0
  40. usdm3/api/study_amendment_reason.py +9 -0
  41. usdm3/api/study_arm.py +11 -0
  42. usdm3/api/study_cell.py +9 -0
  43. usdm3/api/study_design.py +54 -0
  44. usdm3/api/study_element.py +10 -0
  45. usdm3/api/study_epoch.py +10 -0
  46. usdm3/api/study_identifier.py +9 -0
  47. usdm3/api/study_intervention.py +16 -0
  48. usdm3/api/study_protocol_document.py +8 -0
  49. usdm3/api/study_protocol_document_version.py +14 -0
  50. usdm3/api/study_site.py +8 -0
  51. usdm3/api/study_title.py +9 -0
  52. usdm3/api/study_version.py +24 -0
  53. usdm3/api/syntax_template.py +8 -0
  54. usdm3/api/syntax_template_dictionary.py +13 -0
  55. usdm3/api/timing.py +16 -0
  56. usdm3/api/transition_rule.py +7 -0
  57. usdm3/api/wrapper.py +10 -0
  58. usdm3/base/__init__.py +0 -0
  59. usdm3/base/api_instance.py +26 -0
  60. usdm3/base/id_manager.py +15 -0
  61. usdm3/base/singleton.py +16 -0
  62. usdm3/ct/__init__.py +0 -0
  63. usdm3/ct/cdisc/__init__.py +0 -0
  64. usdm3/ct/cdisc/config/__init__.py +0 -0
  65. usdm3/ct/cdisc/config/config.py +37 -0
  66. usdm3/ct/cdisc/library.py +95 -0
  67. usdm3/ct/cdisc/library_api.py +81 -0
  68. usdm3/ct/cdisc/library_cache/__init__.py +0 -0
  69. usdm3/ct/cdisc/library_cache/library_cache.py +41 -0
  70. usdm3/ct/cdisc/library_cache/library_cache.yaml +25000 -0
  71. usdm3/ct/cdisc/missing/__init__.py +0 -0
  72. usdm3/ct/cdisc/missing/missing.py +12 -0
  73. usdm3/ct/cdisc/missing/missing_ct.yaml +494 -0
  74. usdm3/data_store/__init__.py +0 -0
  75. usdm3/data_store/data_store.py +130 -0
  76. usdm3/minimum/__init__.py +0 -0
  77. usdm3/minimum/minimum.py +137 -0
  78. usdm3/rules/__init__.py +1 -0
  79. usdm3/rules/library/__init__.py +1 -0
  80. usdm3/rules/library/rule_ddf00003.py +17 -0
  81. usdm3/rules/library/rule_ddf00004.py +17 -0
  82. usdm3/rules/library/rule_ddf00005.py +17 -0
  83. usdm3/rules/library/rule_ddf00006.py +17 -0
  84. usdm3/rules/library/rule_ddf00007.py +17 -0
  85. usdm3/rules/library/rule_ddf00008.py +33 -0
  86. usdm3/rules/library/rule_ddf00009.py +34 -0
  87. usdm3/rules/library/rule_ddf00010.py +17 -0
  88. usdm3/rules/library/rule_ddf00011.py +25 -0
  89. usdm3/rules/library/rule_ddf00012.py +17 -0
  90. usdm3/rules/library/rule_ddf00013.py +17 -0
  91. usdm3/rules/library/rule_ddf00014.py +17 -0
  92. usdm3/rules/library/rule_ddf00015.py +17 -0
  93. usdm3/rules/library/rule_ddf00016.py +17 -0
  94. usdm3/rules/library/rule_ddf00017.py +17 -0
  95. usdm3/rules/library/rule_ddf00018.py +17 -0
  96. usdm3/rules/library/rule_ddf00019.py +17 -0
  97. usdm3/rules/library/rule_ddf00021.py +17 -0
  98. usdm3/rules/library/rule_ddf00022.py +17 -0
  99. usdm3/rules/library/rule_ddf00023.py +17 -0
  100. usdm3/rules/library/rule_ddf00024.py +17 -0
  101. usdm3/rules/library/rule_ddf00025.py +40 -0
  102. usdm3/rules/library/rule_ddf00026.py +17 -0
  103. usdm3/rules/library/rule_ddf00027.py +17 -0
  104. usdm3/rules/library/rule_ddf00028.py +17 -0
  105. usdm3/rules/library/rule_ddf00029.py +17 -0
  106. usdm3/rules/library/rule_ddf00031.py +52 -0
  107. usdm3/rules/library/rule_ddf00032.py +17 -0
  108. usdm3/rules/library/rule_ddf00035.py +17 -0
  109. usdm3/rules/library/rule_ddf00036.py +31 -0
  110. usdm3/rules/library/rule_ddf00037.py +17 -0
  111. usdm3/rules/library/rule_ddf00040.py +17 -0
  112. usdm3/rules/library/rule_ddf00041.py +17 -0
  113. usdm3/rules/library/rule_ddf00042.py +17 -0
  114. usdm3/rules/library/rule_ddf00043.py +17 -0
  115. usdm3/rules/library/rule_ddf00044.py +17 -0
  116. usdm3/rules/library/rule_ddf00045.py +35 -0
  117. usdm3/rules/library/rule_ddf00046.py +17 -0
  118. usdm3/rules/library/rule_ddf00047.py +17 -0
  119. usdm3/rules/library/rule_ddf00048.py +17 -0
  120. usdm3/rules/library/rule_ddf00049.py +17 -0
  121. usdm3/rules/library/rule_ddf00050.py +17 -0
  122. usdm3/rules/library/rule_ddf00051.py +17 -0
  123. usdm3/rules/library/rule_ddf00052.py +17 -0
  124. usdm3/rules/library/rule_ddf00053.py +17 -0
  125. usdm3/rules/library/rule_ddf00054.py +17 -0
  126. usdm3/rules/library/rule_ddf00055.py +17 -0
  127. usdm3/rules/library/rule_ddf00056.py +17 -0
  128. usdm3/rules/library/rule_ddf00057.py +17 -0
  129. usdm3/rules/library/rule_ddf00058.py +17 -0
  130. usdm3/rules/library/rule_ddf00059.py +17 -0
  131. usdm3/rules/library/rule_ddf00060.py +17 -0
  132. usdm3/rules/library/rule_ddf00061.py +17 -0
  133. usdm3/rules/library/rule_ddf00062.py +17 -0
  134. usdm3/rules/library/rule_ddf00063.py +17 -0
  135. usdm3/rules/library/rule_ddf00064.py +17 -0
  136. usdm3/rules/library/rule_ddf00065.py +17 -0
  137. usdm3/rules/library/rule_ddf00066.py +17 -0
  138. usdm3/rules/library/rule_ddf00067.py +17 -0
  139. usdm3/rules/library/rule_ddf00068.py +17 -0
  140. usdm3/rules/library/rule_ddf00069.py +17 -0
  141. usdm3/rules/library/rule_ddf00070.py +17 -0
  142. usdm3/rules/library/rule_ddf00071.py +17 -0
  143. usdm3/rules/library/rule_ddf00072.py +17 -0
  144. usdm3/rules/library/rule_ddf00073.py +17 -0
  145. usdm3/rules/library/rule_ddf00074.py +17 -0
  146. usdm3/rules/library/rule_ddf00075.py +17 -0
  147. usdm3/rules/library/rule_ddf00076.py +17 -0
  148. usdm3/rules/library/rule_ddf00077.py +17 -0
  149. usdm3/rules/library/rule_ddf00078.py +17 -0
  150. usdm3/rules/library/rule_ddf00079.py +17 -0
  151. usdm3/rules/library/rule_ddf00080.py +17 -0
  152. usdm3/rules/library/rule_ddf00081.py +17 -0
  153. usdm3/rules/library/rule_ddf00082.py +40 -0
  154. usdm3/rules/library/rule_ddf00083.py +21 -0
  155. usdm3/rules/library/rule_ddf00084.py +17 -0
  156. usdm3/rules/library/rule_ddf00085.py +17 -0
  157. usdm3/rules/library/rule_ddf00086.py +17 -0
  158. usdm3/rules/library/rule_ddf00087.py +17 -0
  159. usdm3/rules/library/rule_ddf00088.py +17 -0
  160. usdm3/rules/library/rule_ddf00089.py +17 -0
  161. usdm3/rules/library/rule_ddf00090.py +17 -0
  162. usdm3/rules/library/rule_ddf00091.py +17 -0
  163. usdm3/rules/library/rule_ddf00092.py +17 -0
  164. usdm3/rules/library/rule_ddf00093.py +17 -0
  165. usdm3/rules/library/rule_ddf00094.py +17 -0
  166. usdm3/rules/library/rule_ddf00095.py +17 -0
  167. usdm3/rules/library/rule_ddf00096.py +17 -0
  168. usdm3/rules/library/rule_ddf00097.py +17 -0
  169. usdm3/rules/library/rule_ddf00098.py +17 -0
  170. usdm3/rules/library/rule_ddf00099.py +17 -0
  171. usdm3/rules/library/rule_ddf00100.py +17 -0
  172. usdm3/rules/library/rule_ddf00101.py +17 -0
  173. usdm3/rules/library/rule_ddf00102.py +17 -0
  174. usdm3/rules/library/rule_ddf00103.py +17 -0
  175. usdm3/rules/library/rule_ddf00104.py +20 -0
  176. usdm3/rules/library/rule_ddf00105.py +36 -0
  177. usdm3/rules/library/rule_ddf00106.py +37 -0
  178. usdm3/rules/library/rule_ddf00107.py +17 -0
  179. usdm3/rules/library/rule_ddf00108.py +38 -0
  180. usdm3/rules/library/rule_ddf00109.py +17 -0
  181. usdm3/rules/library/rule_ddf00110.py +17 -0
  182. usdm3/rules/library/rule_ddf00111.py +17 -0
  183. usdm3/rules/library/rule_ddf00112.py +17 -0
  184. usdm3/rules/library/rule_ddf00113.py +17 -0
  185. usdm3/rules/library/rule_ddf00114.py +17 -0
  186. usdm3/rules/library/rule_ddf00115.py +17 -0
  187. usdm3/rules/library/rule_ddf00116.py +17 -0
  188. usdm3/rules/library/rule_ddf00117.py +17 -0
  189. usdm3/rules/library/rule_ddf00118.py +17 -0
  190. usdm3/rules/library/rule_ddf00119.py +17 -0
  191. usdm3/rules/library/rule_ddf00120.py +17 -0
  192. usdm3/rules/library/rule_ddf00121.py +17 -0
  193. usdm3/rules/library/rule_ddf00122.py +17 -0
  194. usdm3/rules/library/rule_ddf00123.py +17 -0
  195. usdm3/rules/library/rule_ddf00124.py +17 -0
  196. usdm3/rules/library/rule_ddf00125.py +17 -0
  197. usdm3/rules/library/rule_ddf00126.py +17 -0
  198. usdm3/rules/library/rule_ddf00127.py +17 -0
  199. usdm3/rules/library/rule_ddf00128.py +17 -0
  200. usdm3/rules/library/rule_ddf00129.py +17 -0
  201. usdm3/rules/library/rule_ddf00130.py +17 -0
  202. usdm3/rules/library/rule_ddf00131.py +17 -0
  203. usdm3/rules/library/rule_ddf00132.py +17 -0
  204. usdm3/rules/library/rule_ddf00133.py +17 -0
  205. usdm3/rules/library/rule_ddf00134.py +17 -0
  206. usdm3/rules/library/rule_ddf00135.py +17 -0
  207. usdm3/rules/library/rule_ddf00136.py +17 -0
  208. usdm3/rules/library/rule_ddf00137.py +17 -0
  209. usdm3/rules/library/rule_ddf00138.py +17 -0
  210. usdm3/rules/library/rule_ddf00139.py +17 -0
  211. usdm3/rules/library/rule_ddf00140.py +20 -0
  212. usdm3/rules/library/rule_ddf00141.py +22 -0
  213. usdm3/rules/library/rule_ddf00142.py +20 -0
  214. usdm3/rules/library/rule_ddf00143.py +20 -0
  215. usdm3/rules/library/rule_ddf00144.py +20 -0
  216. usdm3/rules/library/rule_ddf00145.py +17 -0
  217. usdm3/rules/library/rule_ddf00146.py +20 -0
  218. usdm3/rules/library/rule_ddf00147.py +20 -0
  219. usdm3/rules/library/rule_ddf00148.py +20 -0
  220. usdm3/rules/library/rule_ddf00149.py +20 -0
  221. usdm3/rules/library/rule_ddf00150.py +20 -0
  222. usdm3/rules/library/rule_ddf00151.py +17 -0
  223. usdm3/rules/library/rule_ddf00152.py +17 -0
  224. usdm3/rules/library/rule_ddf00155.py +62 -0
  225. usdm3/rules/library/rule_ddfsdw001.py +38 -0
  226. usdm3/rules/library/rule_template.py +146 -0
  227. usdm3/rules/library/schema/__init__.py +1 -0
  228. usdm3/rules/library/schema/schema_location.py +13 -0
  229. usdm3/rules/library/schema/schema_validation.py +42 -0
  230. usdm3/rules/rules_validation.py +105 -0
  231. usdm3/rules/rules_validation_results.py +89 -0
  232. usdm3-0.3.2.dist-info/LICENSE +674 -0
  233. usdm3-0.3.2.dist-info/METADATA +39 -0
  234. usdm3-0.3.2.dist-info/RECORD +236 -0
  235. usdm3-0.3.2.dist-info/WHEEL +5 -0
  236. usdm3-0.3.2.dist-info/top_level.txt +1 -0
usdm3/__init__.py ADDED
@@ -0,0 +1,20 @@
1
+ import pathlib
2
+ from usdm3.rules.rules_validation import RulesValidation3
3
+ from usdm3.rules.rules_validation_results import RulesValidationResults
4
+ from usdm3.minimum.minimum import Minimum
5
+ from usdm3.api.wrapper import Wrapper
6
+
7
+
8
+ class USDM3:
9
+ def __init__(self):
10
+ self.root = self._root_path()
11
+ self.validator = RulesValidation3(self.root, "usdm3.rules.library")
12
+
13
+ def validate(self, file_path: str) -> RulesValidationResults:
14
+ return self.validator.validate(file_path)
15
+
16
+ def minimum(self, study_name: str, sponsor_id: str, version: str) -> Wrapper:
17
+ return Minimum.minimum(study_name, sponsor_id, version)
18
+
19
+ def _root_path(self) -> str:
20
+ return pathlib.Path(__file__).parent.resolve()
usdm3/__version__.py ADDED
@@ -0,0 +1,2 @@
1
+ __package_version__ = "0.3.2"
2
+ __model_version__ = "3.0.0"
usdm3/api/__init__.py ADDED
@@ -0,0 +1,116 @@
1
+ from .activity import Activity
2
+ from .address import Address
3
+ from .administration_duration import AdministrationDuration
4
+ from .agent_administration import AgentAdministration
5
+ from .alias_code import AliasCode
6
+ from .analysis_population import AnalysisPopulation
7
+ from .biomedical_concept_category import BiomedicalConceptCategory
8
+ from .biomedical_concept_property import BiomedicalConceptProperty
9
+ from .biomedical_concept_surrogate import BiomedicalConceptSurrogate
10
+ from .biomedical_concept import BiomedicalConcept
11
+ from .code import Code
12
+ from .condition import Condition
13
+ from .eligibility_criterion import EligibilityCriterion
14
+ from .encounter import Encounter
15
+ from .endpoint import Endpoint
16
+ from .estimand import Estimand
17
+ from .geographic_scope import GeographicScope
18
+ from .governance_date import GovernanceDate
19
+ from .indication import Indication
20
+ from .intercurrent_event import IntercurrentEvent
21
+ from .masking import Masking
22
+ from .narrative_content import NarrativeContent
23
+ from .objective import Objective
24
+ from .organization import Organization
25
+ from .population_definition import PopulationDefinition
26
+ from .procedure import Procedure
27
+ from .quantity import Quantity
28
+ from .range import Range
29
+ from .response_code import ResponseCode
30
+ from .schedule_timeline_exit import ScheduleTimelineExit
31
+ from .schedule_timeline import ScheduleTimeline
32
+ from .scheduled_instance import ScheduledInstance
33
+ from .study_amendment import StudyAmendment
34
+ from .study_amendment_reason import StudyAmendmentReason
35
+ from .study_arm import StudyArm
36
+ from .study_cell import StudyCell
37
+ from .study_design import StudyDesign
38
+ from .study_element import StudyElement
39
+ from .study_epoch import StudyEpoch
40
+ from .study_identifier import StudyIdentifier
41
+ from .study_intervention import StudyIntervention
42
+ from .study_protocol_document_version import StudyProtocolDocumentVersion
43
+ from .study_protocol_document import StudyProtocolDocument
44
+ from .study_site import StudySite
45
+ from .study_title import StudyTitle
46
+ from .study_version import StudyVersion
47
+ from .study import Study
48
+ from .syntax_template import SyntaxTemplate
49
+ from .syntax_template_dictionary import SyntaxTemplateDictionary
50
+ from .timing import Timing
51
+ from .transition_rule import TransitionRule
52
+ from .wrapper import Wrapper
53
+
54
+ __all__ = [
55
+ "Activity",
56
+ "Address",
57
+ "AdministrationDuration",
58
+ "AgentAdministration",
59
+ "AliasCode",
60
+ "AnalysisPopulation",
61
+ "BiomedicalConceptCategory",
62
+ "BiomedicalConceptProperty",
63
+ "BiomedicalConceptSurrogate",
64
+ "BiomedicalConcept",
65
+ "Code",
66
+ "Condition",
67
+ "EligibilityCriterion",
68
+ "Encounter",
69
+ "Endpoint",
70
+ "Enrollment",
71
+ "Estimand",
72
+ "GeographicScope",
73
+ "GovernanceDate",
74
+ "Indication",
75
+ "IntercurrentEvent",
76
+ "InvestigationalIntervention",
77
+ "Masking",
78
+ "NarrativeContent",
79
+ "Objective",
80
+ "Organization",
81
+ "PopulationDefinition",
82
+ "Procedure",
83
+ "Quality",
84
+ "Range",
85
+ "ResponseCode",
86
+ "ResearchOrganization",
87
+ "ScheduleTimelineExit",
88
+ "ScheduleTimeline",
89
+ "ScheduledInstance",
90
+ "ScheduledActivityInstance",
91
+ "ScheduledDecisionInstance",
92
+ "StudyAmendment",
93
+ "StudyAmendmentReason",
94
+ "StudyArm",
95
+ "StudyCell",
96
+ "StudyCohort",
97
+ "StudyDesignPopulation",
98
+ "StudyDesign",
99
+ "StudyElement",
100
+ "StudyEpoch",
101
+ "StudyIdentifier",
102
+ "StudyProtocolDocumentVersion",
103
+ "StudyProtocolDocument",
104
+ "StudySite",
105
+ "StudyTitle",
106
+ "StudyVersion",
107
+ "Study",
108
+ "SubjectEnrollment",
109
+ "SyntaxTemplate",
110
+ "SyntaxTemplateDictionary",
111
+ "Timing",
112
+ "TransitionRule",
113
+ "StudyIntervention",
114
+ "Quantity",
115
+ "Wrapper",
116
+ ]
usdm3/api/activity.py ADDED
@@ -0,0 +1,14 @@
1
+ from typing import List, Literal, Union
2
+ from .api_base_model import ApiBaseModelNameLabelDesc
3
+ from .procedure import Procedure
4
+
5
+
6
+ class Activity(ApiBaseModelNameLabelDesc):
7
+ previousId: Union[str, None] = None
8
+ nextId: Union[str, None] = None
9
+ definedProcedures: List[Procedure] = []
10
+ biomedicalConceptIds: List[str] = []
11
+ bcCategoryIds: List[str] = []
12
+ bcSurrogateIds: List[str] = []
13
+ timelineId: Union[str, None] = None
14
+ instanceType: Literal["Activity"]
usdm3/api/address.py ADDED
@@ -0,0 +1,14 @@
1
+ from typing import Literal, Union
2
+ from .api_base_model import ApiBaseModel
3
+ from .code import Code
4
+
5
+
6
+ class Address(ApiBaseModel):
7
+ text: Union[str, None] = None
8
+ line: Union[str, None] = None
9
+ city: Union[str, None] = None
10
+ district: Union[str, None] = None
11
+ state: Union[str, None] = None
12
+ postalCode: Union[str, None] = None
13
+ country: Union[Code, None] = None
14
+ instanceType: Literal["Address"]
@@ -0,0 +1,11 @@
1
+ from typing import Literal, Union
2
+ from .api_base_model import ApiBaseModel
3
+ from .quantity import Quantity
4
+
5
+
6
+ class AdministrationDuration(ApiBaseModel):
7
+ quantity: Union[Quantity, None] = None
8
+ description: str
9
+ durationWillVary: bool
10
+ reasonDurationWillVary: str
11
+ instanceType: Literal["AdministrationDuration"]
@@ -0,0 +1,13 @@
1
+ from typing import Literal
2
+ from .api_base_model import ApiBaseModelNameLabelDesc
3
+ from .quantity import Quantity
4
+ from .administration_duration import AdministrationDuration
5
+ from .alias_code import AliasCode
6
+
7
+
8
+ class AgentAdministration(ApiBaseModelNameLabelDesc):
9
+ duration: AdministrationDuration
10
+ dose: Quantity
11
+ route: AliasCode
12
+ frequency: AliasCode
13
+ instanceType: Literal["AgentAdministration"]
@@ -0,0 +1,9 @@
1
+ from typing import List, Literal
2
+ from .api_base_model import ApiBaseModel
3
+ from .code import Code
4
+
5
+
6
+ class AliasCode(ApiBaseModel):
7
+ standardCode: Code
8
+ standardCodeAliases: List[Code] = []
9
+ instanceType: Literal["AliasCode"]
@@ -0,0 +1,7 @@
1
+ from .api_base_model import ApiBaseModelNameLabelDesc
2
+ from typing import Literal
3
+
4
+
5
+ class AnalysisPopulation(ApiBaseModelNameLabelDesc):
6
+ text: str
7
+ instanceType: Literal["AnalysisPopulation"]
@@ -0,0 +1,45 @@
1
+ import json
2
+ import enum
3
+ import datetime
4
+ from typing import Union
5
+ from pydantic import BaseModel, Field
6
+ from uuid import UUID
7
+
8
+
9
+ def _serialize_as_json(obj):
10
+ if isinstance(obj, enum.Enum):
11
+ return obj.value
12
+ elif isinstance(obj, datetime.date):
13
+ return obj.isoformat()
14
+ elif isinstance(obj, UUID):
15
+ return str(obj)
16
+ else:
17
+ return obj.__dict__
18
+
19
+
20
+ class ApiBaseModel(BaseModel):
21
+ id: str = Field(min_length=1)
22
+
23
+ def to_json(self):
24
+ return json.dumps(self, default=_serialize_as_json)
25
+
26
+
27
+ class ApiBaseModelAndDesc(ApiBaseModel):
28
+ description: Union[str, None] = None
29
+
30
+
31
+ class ApiBaseModelName(ApiBaseModel):
32
+ name: str = Field(min_length=1)
33
+
34
+
35
+ class ApiBaseModelNameLabelDesc(ApiBaseModelName):
36
+ label: Union[str, None] = None
37
+ description: Union[str, None] = None
38
+
39
+
40
+ class ApiBaseModelNameLabel(ApiBaseModelName):
41
+ label: Union[str, None] = None
42
+
43
+
44
+ class ApiBaseModelNameDesc(ApiBaseModelName):
45
+ description: Union[str, None] = None
@@ -0,0 +1,12 @@
1
+ from typing import List, Literal
2
+ from .alias_code import AliasCode
3
+ from .api_base_model import ApiBaseModelNameLabel
4
+ from .biomedical_concept_property import BiomedicalConceptProperty
5
+
6
+
7
+ class BiomedicalConcept(ApiBaseModelNameLabel):
8
+ synonyms: List[str] = []
9
+ reference: str
10
+ properties: List[BiomedicalConceptProperty] = []
11
+ code: AliasCode
12
+ instanceType: Literal["BiomedicalConcept"]
@@ -0,0 +1,10 @@
1
+ from typing import List, Literal, Union
2
+ from .api_base_model import ApiBaseModelNameLabelDesc
3
+ from .alias_code import AliasCode
4
+
5
+
6
+ class BiomedicalConceptCategory(ApiBaseModelNameLabelDesc):
7
+ childIds: List[str] = []
8
+ memberIds: List[str] = []
9
+ code: Union[AliasCode, None] = None
10
+ instanceType: Literal["BiomedicalConceptCategory"]
@@ -0,0 +1,13 @@
1
+ from typing import List, Literal
2
+ from .alias_code import AliasCode
3
+ from .api_base_model import ApiBaseModelNameLabel
4
+ from .response_code import ResponseCode
5
+
6
+
7
+ class BiomedicalConceptProperty(ApiBaseModelNameLabel):
8
+ isRequired: bool
9
+ isEnabled: bool
10
+ datatype: str
11
+ responseCodes: List[ResponseCode] = []
12
+ code: AliasCode
13
+ instanceType: Literal["BiomedicalConceptProperty"]
@@ -0,0 +1,7 @@
1
+ from typing import Literal, Union
2
+ from .api_base_model import ApiBaseModelNameLabelDesc
3
+
4
+
5
+ class BiomedicalConceptSurrogate(ApiBaseModelNameLabelDesc):
6
+ reference: Union[str, None] = None
7
+ instanceType: Literal["BiomedicalConceptSurrogate"]
@@ -0,0 +1,6 @@
1
+ from typing import Literal
2
+ from .syntax_template import SyntaxTemplate
3
+
4
+
5
+ class Characteristic(SyntaxTemplate):
6
+ instanceType: Literal["Characteristic"]
usdm3/api/code.py ADDED
@@ -0,0 +1,10 @@
1
+ from typing import Literal
2
+ from .api_base_model import ApiBaseModel
3
+
4
+
5
+ class Code(ApiBaseModel):
6
+ code: str
7
+ codeSystem: str
8
+ codeSystemVersion: str
9
+ decode: str
10
+ instanceType: Literal["Code"]
usdm3/api/condition.py ADDED
@@ -0,0 +1,10 @@
1
+ from typing import List, Literal, Union
2
+ from .api_base_model import ApiBaseModelNameLabelDesc
3
+
4
+
5
+ class Condition(ApiBaseModelNameLabelDesc):
6
+ text: str
7
+ dictionaryId: Union[str, None] = None
8
+ contextIds: List[str] = []
9
+ appliesToIds: List[str] = []
10
+ instanceType: Literal["Condition"]
@@ -0,0 +1,12 @@
1
+ from typing import Literal, Union
2
+ from .syntax_template import SyntaxTemplate
3
+ from .code import Code
4
+
5
+
6
+ class EligibilityCriterion(SyntaxTemplate):
7
+ category: Code
8
+ identifier: str
9
+ nextId: Union[str, None] = None
10
+ previousId: Union[str, None] = None
11
+ contextId: Union[str, None] = None
12
+ instanceType: Literal["EligibilityCriterion"]
usdm3/api/encounter.py ADDED
@@ -0,0 +1,16 @@
1
+ from typing import List, Literal, Union
2
+ from .api_base_model import ApiBaseModelNameLabelDesc
3
+ from .code import Code
4
+ from .transition_rule import TransitionRule
5
+
6
+
7
+ class Encounter(ApiBaseModelNameLabelDesc):
8
+ type: Code
9
+ previousId: Union[str, None] = None
10
+ nextId: Union[str, None] = None
11
+ scheduledAtId: Union[str, None] = None
12
+ environmentalSetting: List[Code] = []
13
+ contactModes: List[Code] = []
14
+ transitionStartRule: Union[TransitionRule, None] = None
15
+ transitionEndRule: Union[TransitionRule, None] = None
16
+ instanceType: Literal["Encounter"]
usdm3/api/endpoint.py ADDED
@@ -0,0 +1,9 @@
1
+ from .syntax_template import SyntaxTemplate
2
+ from .code import Code
3
+ from typing import Literal
4
+
5
+
6
+ class Endpoint(SyntaxTemplate):
7
+ purpose: str
8
+ level: Code
9
+ instanceType: Literal["Endpoint"]
usdm3/api/estimand.py ADDED
@@ -0,0 +1,13 @@
1
+ from typing import List, Literal
2
+ from .api_base_model import ApiBaseModel
3
+ from .analysis_population import AnalysisPopulation
4
+ from .intercurrent_event import IntercurrentEvent
5
+
6
+
7
+ class Estimand(ApiBaseModel):
8
+ summaryMeasure: str
9
+ analysisPopulation: AnalysisPopulation
10
+ interventionId: str
11
+ variableOfInterestId: str
12
+ intercurrentEvents: List[IntercurrentEvent]
13
+ instanceType: Literal["Estimand"]
@@ -0,0 +1,16 @@
1
+ from typing import Literal, Union
2
+ from .api_base_model import ApiBaseModel
3
+ from .code import Code
4
+ from .alias_code import AliasCode
5
+ from .quantity import Quantity
6
+
7
+
8
+ class GeographicScope(ApiBaseModel):
9
+ type: Code
10
+ code: Union[AliasCode, None] = None
11
+ instanceType: Literal["GeographicScope"]
12
+
13
+
14
+ class SubjectEnrollment(GeographicScope):
15
+ quantity: Quantity
16
+ instanceType: Literal["SubjectEnrollment"]
@@ -0,0 +1,12 @@
1
+ from typing import List, Literal
2
+ from .api_base_model import ApiBaseModelNameLabelDesc
3
+ from datetime import date
4
+ from .code import Code
5
+ from .geographic_scope import GeographicScope
6
+
7
+
8
+ class GovernanceDate(ApiBaseModelNameLabelDesc):
9
+ type: Code
10
+ dateValue: date
11
+ geographicScopes: List[GeographicScope]
12
+ instanceType: Literal["GovernanceDate"]
@@ -0,0 +1,9 @@
1
+ from typing import List, Literal
2
+ from .api_base_model import ApiBaseModelNameLabelDesc
3
+ from .code import Code
4
+
5
+
6
+ class Indication(ApiBaseModelNameLabelDesc):
7
+ codes: List[Code] = []
8
+ isRareDisease: bool
9
+ instanceType: Literal["Indication"]
@@ -0,0 +1,7 @@
1
+ from typing import Literal
2
+ from .api_base_model import ApiBaseModelNameLabelDesc
3
+
4
+
5
+ class IntercurrentEvent(ApiBaseModelNameLabelDesc):
6
+ strategy: str
7
+ instanceType: Literal["IntercurrentEvent"]
usdm3/api/masking.py ADDED
@@ -0,0 +1,8 @@
1
+ from .api_base_model import ApiBaseModelAndDesc
2
+ from .code import Code
3
+ from typing import Literal
4
+
5
+
6
+ class Masking(ApiBaseModelAndDesc):
7
+ role: Code
8
+ instanceType: Literal["Masking"]
@@ -0,0 +1,12 @@
1
+ from typing import List, Literal, Union
2
+ from .api_base_model import ApiBaseModelName
3
+
4
+
5
+ class NarrativeContent(ApiBaseModelName):
6
+ sectionNumber: str
7
+ sectionTitle: str
8
+ text: Union[str, None] = None
9
+ childIds: List[str] = []
10
+ previousId: Union[str, None] = None
11
+ nextId: Union[str, None] = None
12
+ instanceType: Literal["NarrativeContent"]
usdm3/api/objective.py ADDED
@@ -0,0 +1,10 @@
1
+ from typing import List, Literal
2
+ from .syntax_template import SyntaxTemplate
3
+ from .code import Code
4
+ from .endpoint import Endpoint
5
+
6
+
7
+ class Objective(SyntaxTemplate):
8
+ level: Code
9
+ endpoints: List[Endpoint] = []
10
+ instanceType: Literal["Objective"]
@@ -0,0 +1,18 @@
1
+ from typing import List, Literal, Union
2
+ from .api_base_model import ApiBaseModelNameLabel
3
+ from .code import Code
4
+ from .address import Address
5
+ from .study_site import StudySite
6
+
7
+
8
+ class Organization(ApiBaseModelNameLabel):
9
+ organizationType: Code
10
+ identifierScheme: str
11
+ identifier: str
12
+ legalAddress: Union[Address, None] = None
13
+ instanceType: Literal["Organization"]
14
+
15
+
16
+ class ResearchOrganization(Organization):
17
+ manages: List[StudySite]
18
+ instanceType: Literal["ResearchOrganization"]
@@ -0,0 +1,26 @@
1
+ from typing import Union, List, Literal
2
+ from .api_base_model import ApiBaseModelNameLabelDesc
3
+ from .code import Code
4
+ from .range import Range
5
+ from .eligibility_criterion import EligibilityCriterion
6
+ from .characteristic import Characteristic
7
+
8
+
9
+ class PopulationDefinition(ApiBaseModelNameLabelDesc):
10
+ includesHealthySubjects: bool
11
+ plannedEnrollmentNumber: Union[Range, None] = None
12
+ plannedCompletionNumber: Union[Range, None] = None
13
+ plannedSex: List[Code] = []
14
+ criteria: List[EligibilityCriterion]
15
+ plannedAge: Union[Range, None] = None
16
+ instanceType: Literal["PopulationDefinition"]
17
+
18
+
19
+ class StudyCohort(PopulationDefinition):
20
+ characteristics: List[Characteristic] = []
21
+ instanceType: Literal["StudyCohort"]
22
+
23
+
24
+ class StudyDesignPopulation(PopulationDefinition):
25
+ cohorts: List[StudyCohort] = []
26
+ instanceType: Literal["StudyDesignPopulation"]
usdm3/api/procedure.py ADDED
@@ -0,0 +1,10 @@
1
+ from typing import Literal, Union
2
+ from .api_base_model import ApiBaseModelNameLabelDesc
3
+ from .code import Code
4
+
5
+
6
+ class Procedure(ApiBaseModelNameLabelDesc):
7
+ procedureType: str
8
+ code: Code
9
+ studyInterventionId: Union[str, None] = None
10
+ instanceType: Literal["Procedure"]
usdm3/api/quantity.py ADDED
@@ -0,0 +1,9 @@
1
+ from typing import Literal, Union
2
+ from .api_base_model import ApiBaseModel
3
+ from .alias_code import AliasCode
4
+
5
+
6
+ class Quantity(ApiBaseModel):
7
+ value: float
8
+ unit: Union[AliasCode, None] = None
9
+ instanceType: Literal["Quantity"]
usdm3/api/range.py ADDED
@@ -0,0 +1,11 @@
1
+ from typing import Literal, Union
2
+ from .api_base_model import ApiBaseModel
3
+ from .code import Code
4
+
5
+
6
+ class Range(ApiBaseModel):
7
+ minValue: float
8
+ maxValue: float
9
+ unit: Union[Code, None] = None
10
+ isApproximate: bool
11
+ instanceType: Literal["Range"]
@@ -0,0 +1,9 @@
1
+ from typing import Literal
2
+ from .api_base_model import ApiBaseModel
3
+ from .code import Code
4
+
5
+
6
+ class ResponseCode(ApiBaseModel):
7
+ isEnabled: bool
8
+ code: Code
9
+ instanceType: Literal["ResponseCode"]
@@ -0,0 +1,15 @@
1
+ from typing import List, Literal, Union
2
+ from .api_base_model import ApiBaseModelNameLabelDesc
3
+ from .schedule_timeline_exit import ScheduleTimelineExit
4
+ from .scheduled_instance import ScheduledActivityInstance, ScheduledDecisionInstance
5
+ from .timing import Timing
6
+
7
+
8
+ class ScheduleTimeline(ApiBaseModelNameLabelDesc):
9
+ mainTimeline: bool
10
+ entryCondition: str
11
+ entryId: str
12
+ exits: List[ScheduleTimelineExit] = []
13
+ timings: List[Timing] = []
14
+ instances: List[Union[ScheduledActivityInstance, ScheduledDecisionInstance]] = []
15
+ instanceType: Literal["ScheduleTimeline"]
@@ -0,0 +1,6 @@
1
+ from .api_base_model import ApiBaseModel
2
+ from typing import Literal
3
+
4
+
5
+ class ScheduleTimelineExit(ApiBaseModel):
6
+ instanceType: Literal["ScheduleTimelineExit"]
@@ -0,0 +1,27 @@
1
+ from typing import List, Literal, Union
2
+ from .api_base_model import ApiBaseModelNameLabelDesc, ApiBaseModel
3
+
4
+
5
+ class ConditionAssignment(ApiBaseModel):
6
+ condition: str
7
+ conditionTargetId: str
8
+ instanceType: Literal["ConditionAssignment"]
9
+
10
+
11
+ class ScheduledInstance(ApiBaseModelNameLabelDesc):
12
+ timelineId: Union[str, None] = None
13
+ timelineExitId: Union[str, None] = None
14
+ defaultConditionId: Union[str, None] = None
15
+ epochId: Union[str, None] = None
16
+ instanceType: Literal["ScheduledInstance"]
17
+
18
+
19
+ class ScheduledActivityInstance(ScheduledInstance):
20
+ activityIds: List[str] = []
21
+ encounterId: Union[str, None] = None
22
+ instanceType: Literal["ScheduledActivityInstance"]
23
+
24
+
25
+ class ScheduledDecisionInstance(ScheduledInstance):
26
+ conditionAssignments: List[ConditionAssignment]
27
+ instanceType: Literal["ScheduledDecisionInstance"]
usdm3/api/study.py ADDED
@@ -0,0 +1,16 @@
1
+ from typing import List, Literal, Union
2
+ from pydantic import Field
3
+ from .api_base_model import ApiBaseModel
4
+ from .study_protocol_document import StudyProtocolDocument
5
+ from .study_version import StudyVersion
6
+ from uuid import UUID
7
+
8
+
9
+ class Study(ApiBaseModel):
10
+ id: Union[UUID, None] = None
11
+ name: str = Field(min_length=1)
12
+ description: Union[str, None] = None
13
+ label: Union[str, None] = None
14
+ versions: List[StudyVersion] = []
15
+ documentedBy: Union[StudyProtocolDocument, None] = None
16
+ instanceType: Literal["Study"]
@@ -0,0 +1,15 @@
1
+ from typing import Union, List, Literal
2
+ from .api_base_model import ApiBaseModel
3
+ from .study_amendment_reason import StudyAmendmentReason
4
+ from .geographic_scope import SubjectEnrollment
5
+
6
+
7
+ class StudyAmendment(ApiBaseModel):
8
+ number: str
9
+ summary: str
10
+ substantialImpact: bool
11
+ primaryReason: StudyAmendmentReason
12
+ secondaryReasons: List[StudyAmendmentReason] = []
13
+ enrollments: List[SubjectEnrollment]
14
+ previousId: Union[str, None] = None
15
+ instanceType: Literal["StudyAmendment"]