omop-constructs 0.4.2__tar.gz → 0.4.5__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.
Files changed (82) hide show
  1. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/PKG-INFO +1 -1
  2. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/pyproject.toml +1 -1
  3. omop_constructs-0.4.5/src/omop_constructs/__init__.py +11 -0
  4. omop_constructs-0.4.5/src/omop_constructs/_lazy_imports.py +32 -0
  5. omop_constructs-0.4.5/src/omop_constructs/alchemy/demography/__init__.py +15 -0
  6. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/demography/demography_matview.py +2 -2
  7. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/demography/demography_queries.py +1 -2
  8. omop_constructs-0.4.5/src/omop_constructs/alchemy/episodes/__init__.py +45 -0
  9. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/condition_episode_objects.py +1 -1
  10. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/course_joins.py +2 -2
  11. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/fraction_joins.py +2 -2
  12. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/fraction_mv.py +2 -2
  13. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/systemic_treatment_joins.py +1 -1
  14. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/treatment_envelope_mv.py +2 -2
  15. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/treatment_envelope_query.py +2 -2
  16. omop_constructs-0.4.5/src/omop_constructs/alchemy/events/__init__.py +43 -0
  17. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/events/dx_linked_event_mv.py +0 -1
  18. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/events/dx_linked_obs_mv.py +1 -2
  19. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/events/dx_linked_procedure_mv.py +1 -2
  20. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/events/event_factories.py +1 -1
  21. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/events/observation_queries.py +2 -0
  22. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/events/procedure_queries.py +5 -1
  23. omop_constructs-0.4.5/src/omop_constructs/alchemy/modifiers/__init__.py +39 -0
  24. omop_constructs-0.4.5/src/omop_constructs/bootstrap.py +61 -0
  25. omop_constructs-0.4.5/src/omop_constructs/bootstrap_modules.py +51 -0
  26. omop_constructs-0.4.2/src/omop_constructs/__init__.py +0 -0
  27. omop_constructs-0.4.2/src/omop_constructs/alchemy/demography/__init__.py +0 -3
  28. omop_constructs-0.4.2/src/omop_constructs/alchemy/episodes/__init__.py +0 -29
  29. omop_constructs-0.4.2/src/omop_constructs/alchemy/events/__init__.py +0 -40
  30. omop_constructs-0.4.2/src/omop_constructs/alchemy/modifiers/__init__.py +0 -30
  31. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/README.md +0 -0
  32. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/__init__.py +0 -0
  33. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/adapters.py +0 -0
  34. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/concepts/__init__.py +0 -0
  35. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/concepts/concept_mappers.py +0 -0
  36. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/concepts/concept_standardisation.py +0 -0
  37. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/conditions/__init__.py +0 -0
  38. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/conditions/condition_joins.py +0 -0
  39. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/conditions/condition_mappers.py +0 -0
  40. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/condition_episode_mv.py +0 -0
  41. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/consult_window_mv.py +0 -0
  42. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/consult_window_query.py +0 -0
  43. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/course_mv.py +0 -0
  44. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/cycle_join.py +0 -0
  45. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/cycle_mv.py +0 -0
  46. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/episode_factories.py +0 -0
  47. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/episode_joins.py +0 -0
  48. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/modality_intent_join.py +0 -0
  49. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/modality_intent_mv.py +0 -0
  50. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/surgical_joins.py +0 -0
  51. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/surgical_procedure_mv.py +0 -0
  52. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/systemic_treatment_mv.py +0 -0
  53. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/treatment_summary_joins.py +0 -0
  54. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/episodes/treatment_summary_mv.py +0 -0
  55. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/events/dx_linked_visit_mv.py +0 -0
  56. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/events/event_queries.py +0 -0
  57. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/events/visit_queries.py +0 -0
  58. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/modifiers/condition_modifier_join.py +0 -0
  59. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/modifiers/condition_modifier_mv.py +0 -0
  60. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/modifiers/modifier_factories.py +0 -0
  61. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/modifiers/modifier_joins.py +0 -0
  62. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/modifiers/modifier_mappers.py +0 -0
  63. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/modifiers/procedure_modifier_joins.py +0 -0
  64. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/modifiers/procedure_modifier_mv.py +0 -0
  65. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/alchemy/source_factories.py +0 -0
  66. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/core/__init__.py +0 -0
  67. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/core/base.py +0 -0
  68. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/core/constructs.py +0 -0
  69. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/core/ddl.py +0 -0
  70. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/core/errors.py +0 -0
  71. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/core/materialized.py +0 -0
  72. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/core/plan.py +0 -0
  73. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/core/registry.py +0 -0
  74. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/py.typed +0 -0
  75. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/semantics/__init__.py +0 -0
  76. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/semantics/adapters.py +0 -0
  77. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/semantics/lookups.py +0 -0
  78. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/semantics/runtime_lookups.py +0 -0
  79. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/services/__init__.py +0 -0
  80. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/services/concept.py +0 -0
  81. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/services/person.py +0 -0
  82. {omop_constructs-0.4.2 → omop_constructs-0.4.5}/src/omop_constructs/typing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: omop-constructs
3
- Version: 0.4.2
3
+ Version: 0.4.5
4
4
  Summary: For building complex constructs on top of the omop-alchemy library.
5
5
  Author: Georgie Kennedy
6
6
  Author-email: Georgie Kennedy <georgina.kennedy@unsw.edu.au>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "omop-constructs"
3
- version = "0.4.2"
3
+ version = "0.4.5"
4
4
  description = "For building complex constructs on top of the omop-alchemy library."
5
5
  readme = "README.md"
6
6
  authors = [
@@ -0,0 +1,11 @@
1
+ from .bootstrap import (
2
+ get_complete_construct_registry,
3
+ list_cdm_matview_names,
4
+ load_construct_families,
5
+ )
6
+
7
+ __all__ = [
8
+ "get_complete_construct_registry",
9
+ "list_cdm_matview_names",
10
+ "load_construct_families",
11
+ ]
@@ -0,0 +1,32 @@
1
+ """
2
+ Small helpers for lazy package re-exports.
3
+
4
+ The alchemy family ``__init__`` modules use this helper so they can remain
5
+ pleasant to import from while avoiding eager import fanout during package
6
+ initialization.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from importlib import import_module
12
+ from typing import Any
13
+
14
+
15
+ def load_export(name: str, export_map: dict[str, str]) -> Any:
16
+ """
17
+ Resolve an exported attribute on first access.
18
+
19
+ Parameters
20
+ ----------
21
+ name:
22
+ The attribute requested from a package ``__init__`` module.
23
+ export_map:
24
+ Mapping from exported attribute name to the leaf module that defines it.
25
+ """
26
+ try:
27
+ module_name = export_map[name]
28
+ except KeyError as exc:
29
+ raise AttributeError(name) from exc
30
+
31
+ module = import_module(module_name)
32
+ return getattr(module, name)
@@ -0,0 +1,15 @@
1
+ from ..._lazy_imports import load_export
2
+
3
+ _EXPORTS: dict[str, str] = {
4
+ "PersonDemography": "omop_constructs.alchemy.demography.demography_matview",
5
+ }
6
+
7
+ __all__ = ["PersonDemography"]
8
+
9
+
10
+ def __getattr__(name: str):
11
+ return load_export(name, _EXPORTS)
12
+
13
+
14
+ def __dir__() -> list[str]:
15
+ return sorted(__all__)
@@ -4,7 +4,7 @@ from orm_loader.helpers import Base
4
4
  from ...core.materialized import MaterializedViewMixin
5
5
  from ...core.constructs import register_construct
6
6
  from .demography_queries import demographics_join
7
- from ..episodes import ConditionEpisodeMV
7
+ from ..episodes.condition_episode_mv import ConditionEpisodeMV
8
8
  from sqlalchemy.orm import Mapped, mapped_column
9
9
  from datetime import date, datetime
10
10
 
@@ -38,4 +38,4 @@ class PersonDemography(MaterializedViewMixin, Base):
38
38
 
39
39
  language_spoken: Mapped[str | None] = mapped_column(sa.String)
40
40
  country_of_birth: Mapped[str | None] = mapped_column(sa.String)
41
- post_code: Mapped[int | None] = mapped_column(sa.Integer)
41
+ post_code: Mapped[int | None] = mapped_column(sa.Integer)
@@ -1,7 +1,7 @@
1
1
  import sqlalchemy as sa
2
2
  from omop_alchemy.cdm.model.clinical import Person, Observation, Death
3
3
  from omop_alchemy.cdm.model.vocabulary import Concept
4
- from ..episodes import ConditionEpisodeMV
4
+ from ..episodes.condition_episode_mv import ConditionEpisodeMV
5
5
  from ...semantics import registry
6
6
 
7
7
 
@@ -68,4 +68,3 @@ demographics_join = (
68
68
  .join(person_cob, person_cob.c.person_id == Person.person_id, isouter=True)
69
69
  .join(person_postcode, person_postcode.c.person_id == Person.person_id, isouter=True)
70
70
  )
71
-
@@ -0,0 +1,45 @@
1
+ from ..._lazy_imports import load_export
2
+
3
+ _EXPORTS: dict[str, str] = {
4
+ "OverarchingDiseaseEpisodeMV": "omop_constructs.alchemy.episodes.condition_episode_mv",
5
+ "TreatmentRegimenCycleMV": "omop_constructs.alchemy.episodes.condition_episode_mv",
6
+ "ConditionEpisodeMV": "omop_constructs.alchemy.episodes.condition_episode_mv",
7
+ "DxTreatStartMV": "omop_constructs.alchemy.episodes.condition_episode_mv",
8
+ "ConditionEpisodeObject": "omop_constructs.alchemy.episodes.condition_episode_objects",
9
+ "SurgicalProcedureMV": "omop_constructs.alchemy.episodes.surgical_procedure_mv",
10
+ "SACTRegimenMV": "omop_constructs.alchemy.episodes.systemic_treatment_mv",
11
+ "CycleMV": "omop_constructs.alchemy.episodes.cycle_mv",
12
+ "RTCourseMV": "omop_constructs.alchemy.episodes.course_mv",
13
+ "FractionMV": "omop_constructs.alchemy.episodes.fraction_mv",
14
+ "ConditionTreatmentEpisode": "omop_constructs.alchemy.episodes.treatment_summary_mv",
15
+ "TreatmentEnvelopeMV": "omop_constructs.alchemy.episodes.treatment_envelope_mv",
16
+ "TreatmentIntentMV": "omop_constructs.alchemy.episodes.modality_intent_mv",
17
+ "ConditionTreatmentIntentMV": "omop_constructs.alchemy.episodes.modality_intent_mv",
18
+ "ConsultWindowMV": "omop_constructs.alchemy.episodes.consult_window_mv",
19
+ }
20
+
21
+ __all__ = [
22
+ "OverarchingDiseaseEpisodeMV",
23
+ "TreatmentRegimenCycleMV",
24
+ "ConditionEpisodeMV",
25
+ "ConditionEpisodeObject",
26
+ "SurgicalProcedureMV",
27
+ "DxTreatStartMV",
28
+ "SACTRegimenMV",
29
+ "CycleMV",
30
+ "RTCourseMV",
31
+ "FractionMV",
32
+ "ConditionTreatmentEpisode",
33
+ "TreatmentEnvelopeMV",
34
+ "TreatmentIntentMV",
35
+ "ConditionTreatmentIntentMV",
36
+ "ConsultWindowMV",
37
+ ]
38
+
39
+
40
+ def __getattr__(name: str):
41
+ return load_export(name, _EXPORTS)
42
+
43
+
44
+ def __dir__() -> list[str]:
45
+ return sorted(__all__)
@@ -3,7 +3,7 @@ import sqlalchemy.orm as so
3
3
  from typing import List
4
4
 
5
5
  from omop_alchemy.cdm.model.structural import Episode_Event
6
- from ..modifiers import ModifiedCondition
6
+ from ..modifiers.condition_modifier_mv import ModifiedCondition
7
7
  from .condition_episode_mv import ConditionEpisodeMV # wherever you defined it
8
8
  from omop_semantics.runtime.default_valuesets import runtime # type: ignore
9
9
 
@@ -2,7 +2,7 @@ import sqlalchemy as sa
2
2
  import sqlalchemy.orm as so
3
3
  from omop_alchemy.cdm.model import Episode, Episode_Event, Concept
4
4
  from omop_semantics.runtime.default_valuesets import runtime
5
- from ..modifiers import ModifiedProcedure
5
+ from ..modifiers.procedure_modifier_mv import ModifiedProcedure
6
6
  from .fraction_mv import FractionMV
7
7
 
8
8
 
@@ -53,4 +53,4 @@ course_join = (
53
53
  isouter=True
54
54
  )
55
55
  .join(ModifiedProcedure, ModifiedProcedure.procedure_occurrence_id==Episode_Event.event_id, isouter=True)
56
- )
56
+ )
@@ -2,7 +2,7 @@ import sqlalchemy as sa
2
2
  import sqlalchemy.orm as so
3
3
  from omop_alchemy.cdm.model import Episode, Episode_Event, Concept
4
4
  from omop_semantics.runtime.default_valuesets import runtime
5
- from ..modifiers import ModifiedProcedure
5
+ from ..modifiers.procedure_modifier_mv import ModifiedProcedure
6
6
  from ...semantics import registry
7
7
 
8
8
  rt_proc_concept = so.aliased(Concept, name='rt_proc_concept')
@@ -34,4 +34,4 @@ fraction_join = (
34
34
  .join(Episode, Episode.episode_id==Episode_Event.episode_id)
35
35
  .join(fraction_concept, fraction_concept.concept_id==Episode.episode_object_concept_id)
36
36
  .filter(ModifiedProcedure.procedure_concept_id.in_(list(registry['rt_procedures'].all_concepts)))
37
- )
37
+ )
@@ -3,7 +3,7 @@ import sqlalchemy.orm as so
3
3
  from orm_loader.helpers import Base
4
4
  from datetime import date
5
5
  from .fraction_joins import fraction_join
6
- from ..modifiers import ModifiedProcedure
6
+ from ..modifiers.procedure_modifier_mv import ModifiedProcedure
7
7
  from ...core.materialized import MaterializedViewMixin
8
8
  from ...core.constructs import register_construct
9
9
 
@@ -31,4 +31,4 @@ class FractionMV(
31
31
  fraction_id: so.Mapped[int] = so.mapped_column(sa.Integer)
32
32
  fraction_number: so.Mapped[int] = so.mapped_column(sa.Integer)
33
33
  course_id: so.Mapped[int] = so.mapped_column(sa.Integer)
34
- fraction_name: so.Mapped[str] = so.mapped_column(sa.String)
34
+ fraction_name: so.Mapped[str] = so.mapped_column(sa.String)
@@ -1,7 +1,7 @@
1
1
  import sqlalchemy as sa
2
2
  from omop_alchemy.cdm.model import Episode, Episode_Event
3
3
  from omop_semantics.runtime.default_valuesets import runtime
4
- from ..modifiers import ModifiedProcedure
4
+ from ..modifiers.procedure_modifier_mv import ModifiedProcedure
5
5
  from .cycle_mv import CycleMV
6
6
 
7
7
 
@@ -7,7 +7,7 @@ from .treatment_envelope_query import treatment_envelope_with_scalars
7
7
  from ...core.materialized import MaterializedViewMixin
8
8
  from ...core.constructs import register_construct
9
9
 
10
- from ..modifiers import ModifiedCondition
10
+ from ..modifiers.condition_modifier_mv import ModifiedCondition
11
11
  from .surgical_procedure_mv import SurgicalProcedureMV
12
12
  from .systemic_treatment_mv import SACTRegimenMV
13
13
  from .course_mv import RTCourseMV
@@ -39,4 +39,4 @@ class TreatmentEnvelopeMV(
39
39
  death_datetime = sa.Column(sa.DateTime)
40
40
  treatment_days_before_death = sa.Column(sa.Float)
41
41
  days_from_dx_to_treatment = sa.Column(sa.Float)
42
- concurrent_chemort = sa.Column(sa.Boolean)
42
+ concurrent_chemort = sa.Column(sa.Boolean)
@@ -1,6 +1,6 @@
1
1
  import sqlalchemy as sa
2
2
  from omop_alchemy.cdm.model import Death
3
- from ..modifiers import ModifiedCondition
3
+ from ..modifiers.condition_modifier_mv import ModifiedCondition
4
4
  from .surgical_procedure_mv import SurgicalProcedureMV
5
5
  from .systemic_treatment_mv import SACTRegimenMV
6
6
  from .course_mv import RTCourseMV
@@ -111,4 +111,4 @@ treatment_envelope_with_scalars = (
111
111
  ).label('days_from_dx_to_treatment')
112
112
  )
113
113
  )
114
-
114
+
@@ -0,0 +1,43 @@
1
+ from ..._lazy_imports import load_export
2
+
3
+ _EXPORTS: dict[str, str] = {
4
+ "WeightDxMV": "omop_constructs.alchemy.events.dx_linked_event_mv",
5
+ "WeightChangeDxMV": "omop_constructs.alchemy.events.dx_linked_event_mv",
6
+ "HeightDxMV": "omop_constructs.alchemy.events.dx_linked_event_mv",
7
+ "BSADxMV": "omop_constructs.alchemy.events.dx_linked_event_mv",
8
+ "CreatinineClearanceDxMV": "omop_constructs.alchemy.events.dx_linked_event_mv",
9
+ "EGFRDxMV": "omop_constructs.alchemy.events.dx_linked_event_mv",
10
+ "FEV1DxMV": "omop_constructs.alchemy.events.dx_linked_event_mv",
11
+ "DistressThermometerDxMV": "omop_constructs.alchemy.events.dx_linked_event_mv",
12
+ "ECOGDxMV": "omop_constructs.alchemy.events.dx_linked_event_mv",
13
+ "SmokingPYHDxMV": "omop_constructs.alchemy.events.dx_linked_event_mv",
14
+ "DxMeasurementMV": "omop_constructs.alchemy.events.dx_linked_event_mv",
15
+ "DxProcedureMV": "omop_constructs.alchemy.events.dx_linked_procedure_mv",
16
+ "DxObservationMV": "omop_constructs.alchemy.events.dx_linked_obs_mv",
17
+ "DxRelevantVisitMV": "omop_constructs.alchemy.events.dx_linked_visit_mv",
18
+ }
19
+
20
+ __all__ = [
21
+ "WeightDxMV",
22
+ "WeightChangeDxMV",
23
+ "HeightDxMV",
24
+ "BSADxMV",
25
+ "CreatinineClearanceDxMV",
26
+ "EGFRDxMV",
27
+ "FEV1DxMV",
28
+ "DistressThermometerDxMV",
29
+ "ECOGDxMV",
30
+ "SmokingPYHDxMV",
31
+ "DxMeasurementMV",
32
+ "DxProcedureMV",
33
+ "DxObservationMV",
34
+ "DxRelevantVisitMV",
35
+ ]
36
+
37
+
38
+ def __getattr__(name: str):
39
+ return load_export(name, _EXPORTS)
40
+
41
+
42
+ def __dir__() -> list[str]:
43
+ return sorted(__all__)
@@ -7,7 +7,6 @@ from orm_loader.helpers import Base
7
7
  from omop_constructs.alchemy.episodes.condition_episode_mv import ConditionEpisodeMV
8
8
  from ...core.materialized import MaterializedViewMixin
9
9
  from ...core.constructs import register_construct
10
- from ..episodes import ConditionEpisodeMV
11
10
  from .event_queries import (
12
11
  weight_change_dx,
13
12
  weight_dx,
@@ -7,7 +7,6 @@ from orm_loader.helpers import Base
7
7
  from omop_constructs.alchemy.episodes.condition_episode_mv import ConditionEpisodeMV
8
8
  from ...core.materialized import MaterializedViewMixin
9
9
  from ...core.constructs import register_construct
10
- from ..episodes import ConditionEpisodeMV
11
10
  from .observation_queries import (
12
11
  dx_all_observations
13
12
  )
@@ -48,4 +47,4 @@ class DxObservationMV(ConditionEpisodeObservationCols, MaterializedViewMixin, Ba
48
47
  observation_concept_id: so.Mapped[int] = so.mapped_column(sa.Integer)
49
48
  observation_date: so.Mapped[Optional[date]] = so.mapped_column(sa.DateTime)
50
49
  value_concept_id: so.Mapped[Optional[int]] = so.mapped_column(sa.Integer, nullable=True)
51
- qualifier_concept_id: so.Mapped[Optional[int]] = so.mapped_column(sa.Integer, nullable=True)
50
+ qualifier_concept_id: so.Mapped[Optional[int]] = so.mapped_column(sa.Integer, nullable=True)
@@ -7,7 +7,6 @@ from orm_loader.helpers import Base
7
7
  from omop_constructs.alchemy.episodes.condition_episode_mv import ConditionEpisodeMV
8
8
  from ...core.materialized import MaterializedViewMixin
9
9
  from ...core.constructs import register_construct
10
- from ..episodes import ConditionEpisodeMV
11
10
  from .procedure_queries import (
12
11
  dx_all_procedures
13
12
  )
@@ -41,4 +40,4 @@ class DxProcedureMV(ConditionEpisodeProcedureCols, MaterializedViewMixin, Base):
41
40
  __tablename__ = __mv_name__
42
41
 
43
42
  procedure_concept_id: so.Mapped[int] = so.mapped_column(sa.Integer)
44
- procedure_datetime: so.Mapped[Optional[date]] = so.mapped_column(sa.DateTime)
43
+ procedure_datetime: so.Mapped[Optional[date]] = so.mapped_column(sa.DateTime)
@@ -2,7 +2,7 @@ import sqlalchemy as sa
2
2
  import sqlalchemy.orm as so
3
3
  from sqlalchemy.sql import ColumnElement
4
4
  from typing import Iterable, Any, Sequence, Union
5
- from omop_constructs.alchemy.episodes import ConditionEpisodeMV
5
+ from omop_constructs.alchemy.episodes.condition_episode_mv import ConditionEpisodeMV
6
6
  from omop_alchemy.cdm.model.structural import Episode_Event
7
7
  from omop_semantics.runtime.default_valuesets import runtime # type: ignore
8
8
  from omop_alchemy.cdm.model import Measurement, Concept, Procedure_Occurrence, Observation
@@ -6,6 +6,8 @@ dx_all_observations = episode_relevant_window(
6
6
  include_cols=[
7
7
  Observation.value_as_number,
8
8
  Observation.qualifier_concept_id,
9
+ Observation.observation_concept_id.label("observation_concept_id"),
10
+ Observation.observation_date.label("observation_date"),
9
11
  ],
10
12
  name="dx_all_observations",
11
13
  unlinked_only=False,
@@ -1,9 +1,13 @@
1
1
  from .event_factories import procedure_attached_to_condition_episode, episode_relevant_window
2
+ from omop_alchemy.cdm.model import Procedure_Occurrence
2
3
 
3
4
  dx_all_procedures = episode_relevant_window(
4
5
  procedure_attached_to_condition_episode(
5
6
  concept_ids=None,
6
- include_cols=[],
7
+ include_cols=[
8
+ Procedure_Occurrence.procedure_concept_id.label("procedure_concept_id"),
9
+ Procedure_Occurrence.procedure_datetime.label("procedure_datetime"),
10
+ ],
7
11
  name="dx_all_procedures",
8
12
  ),
9
13
  name="dx_all_procedures_windowed",
@@ -0,0 +1,39 @@
1
+ from ..._lazy_imports import load_export
2
+
3
+ _EXPORTS: dict[str, str] = {
4
+ "TStageMV": "omop_constructs.alchemy.modifiers.modifier_mappers",
5
+ "NStageMV": "omop_constructs.alchemy.modifiers.modifier_mappers",
6
+ "MStageMV": "omop_constructs.alchemy.modifiers.modifier_mappers",
7
+ "GroupStageMV": "omop_constructs.alchemy.modifiers.modifier_mappers",
8
+ "GradeModifierMV": "omop_constructs.alchemy.modifiers.modifier_mappers",
9
+ "LateralityModifierMV": "omop_constructs.alchemy.modifiers.modifier_mappers",
10
+ "SizeModifierMV": "omop_constructs.alchemy.modifiers.modifier_mappers",
11
+ "MetastaticDiseaseModifierMV": "omop_constructs.alchemy.modifiers.modifier_mappers",
12
+ "AllStageModifierMV": "omop_constructs.alchemy.modifiers.modifier_mappers",
13
+ "ModifiedCondition": "omop_constructs.alchemy.modifiers.condition_modifier_mv",
14
+ "StageModifier": "omop_constructs.alchemy.modifiers.condition_modifier_mv",
15
+ "ModifiedProcedure": "omop_constructs.alchemy.modifiers.procedure_modifier_mv",
16
+ }
17
+
18
+ __all__ = [
19
+ "TStageMV",
20
+ "NStageMV",
21
+ "MStageMV",
22
+ "GroupStageMV",
23
+ "GradeModifierMV",
24
+ "LateralityModifierMV",
25
+ "SizeModifierMV",
26
+ "ModifiedCondition",
27
+ "MetastaticDiseaseModifierMV",
28
+ "AllStageModifierMV",
29
+ "StageModifier",
30
+ "ModifiedProcedure"
31
+ ]
32
+
33
+
34
+ def __getattr__(name: str):
35
+ return load_export(name, _EXPORTS)
36
+
37
+
38
+ def __dir__() -> list[str]:
39
+ return sorted(__all__)
@@ -0,0 +1,61 @@
1
+ """
2
+ Helpers for loading the complete construct registry.
3
+
4
+ This module exists to give callers a single "load everything" entrypoint
5
+ without relying on the broad re-export behavior of package ``__init__`` files.
6
+ The bootstrap path imports construct-defining modules directly from the
7
+ declarative manifest in :mod:`omop_constructs.bootstrap_modules`, which keeps
8
+ registry assembly separate from the public import ergonomics of the alchemy
9
+ packages.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ from importlib import import_module
15
+ from typing import TYPE_CHECKING
16
+
17
+ from .bootstrap_modules import CDM_CONSTRUCT_MODULES
18
+
19
+ if TYPE_CHECKING:
20
+ from .core.registry import ConstructRegistry
21
+
22
+ def _load_construct_modules(module_names: tuple[str, ...]) -> None:
23
+ """
24
+ Import each construct module in order.
25
+
26
+ Python's normal module caching makes repeated calls effectively idempotent
27
+ at the import layer, so this helper intentionally avoids adding a second
28
+ caching mechanism here.
29
+ """
30
+ for module_name in module_names:
31
+ import_module(module_name)
32
+
33
+ def load_construct_families() -> None:
34
+ """
35
+ Import every construct module required for the full CDM registry.
36
+
37
+ This performs registration as a side effect because construct classes attach
38
+ themselves to the global registry when their modules are imported.
39
+ """
40
+ _load_construct_modules(CDM_CONSTRUCT_MODULES)
41
+
42
+ def get_complete_construct_registry() -> ConstructRegistry:
43
+ """
44
+ Return a registry containing the full shipped construct surface.
45
+
46
+ Unlike ``omop_constructs.core.get_construct_registry()``, this helper first
47
+ ensures that the full construct manifest has been imported in the current
48
+ process.
49
+ """
50
+ load_construct_families()
51
+ constructs_module = import_module("omop_constructs.core.constructs")
52
+ return constructs_module.get_construct_registry()
53
+
54
+ def list_cdm_matview_names() -> list[str]:
55
+ """
56
+ Return every registered materialized view name in dependency order.
57
+
58
+ This is a convenience wrapper for callers that only need the planned MV
59
+ names and do not need direct access to the registry instance.
60
+ """
61
+ return [item.name for item in get_complete_construct_registry().plan()]
@@ -0,0 +1,51 @@
1
+ """
2
+ Declarative manifest of construct-defining modules.
3
+
4
+ The tuples in this module are intentionally simple data rather than loader
5
+ functions. Keeping the manifest separate from import execution makes the full
6
+ registry bootstrap path easier to inspect, test, and reuse.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ MODIFIER_CONSTRUCT_MODULES: tuple[str, ...] = (
12
+ "omop_constructs.alchemy.modifiers.modifier_mappers",
13
+ "omop_constructs.alchemy.modifiers.condition_modifier_mv",
14
+ "omop_constructs.alchemy.modifiers.procedure_modifier_mv",
15
+ )
16
+ """Construct modules that make up the modifier family."""
17
+
18
+ EPISODE_CONSTRUCT_MODULES: tuple[str, ...] = (
19
+ "omop_constructs.alchemy.episodes.condition_episode_mv",
20
+ "omop_constructs.alchemy.episodes.surgical_procedure_mv",
21
+ "omop_constructs.alchemy.episodes.systemic_treatment_mv",
22
+ "omop_constructs.alchemy.episodes.cycle_mv",
23
+ "omop_constructs.alchemy.episodes.course_mv",
24
+ "omop_constructs.alchemy.episodes.fraction_mv",
25
+ "omop_constructs.alchemy.episodes.treatment_summary_mv",
26
+ "omop_constructs.alchemy.episodes.treatment_envelope_mv",
27
+ "omop_constructs.alchemy.episodes.modality_intent_mv",
28
+ "omop_constructs.alchemy.episodes.consult_window_mv",
29
+ )
30
+ """Construct modules that make up the episode family."""
31
+
32
+ EVENT_CONSTRUCT_MODULES: tuple[str, ...] = (
33
+ "omop_constructs.alchemy.events.dx_linked_event_mv",
34
+ "omop_constructs.alchemy.events.dx_linked_obs_mv",
35
+ "omop_constructs.alchemy.events.dx_linked_procedure_mv",
36
+ "omop_constructs.alchemy.events.dx_linked_visit_mv",
37
+ )
38
+ """Construct modules that make up the event family."""
39
+
40
+ DEMOGRAPHY_CONSTRUCT_MODULES: tuple[str, ...] = (
41
+ "omop_constructs.alchemy.demography.demography_matview",
42
+ )
43
+ """Construct modules that make up the demography family."""
44
+
45
+ CDM_CONSTRUCT_MODULES: tuple[str, ...] = (
46
+ *MODIFIER_CONSTRUCT_MODULES,
47
+ *EPISODE_CONSTRUCT_MODULES,
48
+ *EVENT_CONSTRUCT_MODULES,
49
+ *DEMOGRAPHY_CONSTRUCT_MODULES,
50
+ )
51
+ """Full ordered manifest for loading the shipped construct registry."""
File without changes
@@ -1,3 +0,0 @@
1
- from .demography_matview import PersonDemography
2
-
3
- __all__ = ["PersonDemography"]
@@ -1,29 +0,0 @@
1
- from .condition_episode_mv import OverarchingDiseaseEpisodeMV, TreatmentRegimenCycleMV, ConditionEpisodeMV, DxTreatStartMV
2
- from .condition_episode_objects import ConditionEpisodeObject
3
- from .surgical_procedure_mv import SurgicalProcedureMV
4
- from .systemic_treatment_mv import SACTRegimenMV
5
- from .cycle_mv import CycleMV
6
- from .course_mv import RTCourseMV
7
- from .fraction_mv import FractionMV
8
- from .treatment_summary_mv import ConditionTreatmentEpisode
9
- from .treatment_envelope_mv import TreatmentEnvelopeMV
10
- from .modality_intent_mv import TreatmentIntentMV, ConditionTreatmentIntentMV
11
- from .consult_window_mv import ConsultWindowMV
12
-
13
- __all__ = [
14
- "OverarchingDiseaseEpisodeMV",
15
- "TreatmentRegimenCycleMV",
16
- "ConditionEpisodeMV",
17
- "ConditionEpisodeObject",
18
- "SurgicalProcedureMV",
19
- "DxTreatStartMV",
20
- "SACTRegimenMV",
21
- "CycleMV",
22
- "RTCourseMV",
23
- "FractionMV",
24
- "ConditionTreatmentEpisode",
25
- "TreatmentEnvelopeMV",
26
- "TreatmentIntentMV",
27
- "ConditionTreatmentIntentMV",
28
- "ConsultWindowMV",
29
- ]
@@ -1,40 +0,0 @@
1
- from .dx_linked_event_mv import (
2
- WeightDxMV,
3
- WeightChangeDxMV,
4
- HeightDxMV,
5
- BSADxMV,
6
- CreatinineClearanceDxMV,
7
- EGFRDxMV,
8
- FEV1DxMV,
9
- DistressThermometerDxMV,
10
- ECOGDxMV,
11
- SmokingPYHDxMV,
12
- DxMeasurementMV
13
- )
14
-
15
- from .dx_linked_procedure_mv import (
16
- DxProcedureMV,
17
- )
18
- from .dx_linked_obs_mv import (
19
- DxObservationMV,
20
- )
21
- from .dx_linked_visit_mv import (
22
- DxRelevantVisitMV,
23
- )
24
-
25
- __all__ = [
26
- "WeightDxMV",
27
- "WeightChangeDxMV",
28
- "HeightDxMV",
29
- "BSADxMV",
30
- "CreatinineClearanceDxMV",
31
- "EGFRDxMV",
32
- "FEV1DxMV",
33
- "DistressThermometerDxMV",
34
- "ECOGDxMV",
35
- "SmokingPYHDxMV",
36
- "DxMeasurementMV",
37
- "DxProcedureMV",
38
- "DxObservationMV",
39
- "DxRelevantVisitMV",
40
- ]
@@ -1,30 +0,0 @@
1
- from .modifier_mappers import (
2
- TStageMV,
3
- NStageMV,
4
- MStageMV,
5
- GroupStageMV,
6
- GradeModifierMV,
7
- LateralityModifierMV,
8
- SizeModifierMV,
9
- MetastaticDiseaseModifierMV,
10
- AllStageModifierMV
11
- )
12
- from .condition_modifier_mv import ModifiedCondition, StageModifier
13
- from .procedure_modifier_mv import (
14
- ModifiedProcedure,
15
- )
16
-
17
- __all__ = [
18
- "TStageMV",
19
- "NStageMV",
20
- "MStageMV",
21
- "GroupStageMV",
22
- "GradeModifierMV",
23
- "LateralityModifierMV",
24
- "SizeModifierMV",
25
- "ModifiedCondition",
26
- "MetastaticDiseaseModifierMV",
27
- "AllStageModifierMV",
28
- "StageModifier",
29
- "ModifiedProcedure"
30
- ]