groundworkers 0.8.0__tar.gz → 0.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. groundworkers-0.9.0/Makefile +29 -0
  2. {groundworkers-0.8.0 → groundworkers-0.9.0}/PKG-INFO +9 -1
  3. {groundworkers-0.8.0 → groundworkers-0.9.0}/README.md +8 -0
  4. {groundworkers-0.8.0 → groundworkers-0.9.0}/pyproject.toml +3 -0
  5. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/adapters/omop_graph.py +10 -0
  6. groundworkers-0.9.0/src/groundworkers/knowledge/packs/core/domain-routing/guidance.md +70 -0
  7. groundworkers-0.9.0/src/groundworkers/knowledge/packs/core/standard-concept-preference/guidance.md +149 -0
  8. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/knowledge/packs/core/standard-concept-preference/manifest.yaml +2 -3
  9. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/knowledge/packs/core/standard-concept-preference/rules.yaml +16 -9
  10. groundworkers-0.9.0/src/groundworkers/omop_domains.py +64 -0
  11. groundworkers-0.9.0/src/groundworkers/prompt_packs/__init__.py +8 -0
  12. groundworkers-0.9.0/src/groundworkers/prompt_packs/groundcrew-source-column-classification/classification-request.schema.json +86 -0
  13. groundworkers-0.9.0/src/groundworkers/prompt_packs/groundcrew-source-column-classification/classification-result.schema.json +76 -0
  14. groundworkers-0.9.0/src/groundworkers/prompt_packs/groundcrew-source-column-classification/examples.yaml +68 -0
  15. groundworkers-0.9.0/src/groundworkers/prompt_packs/groundcrew-source-column-classification/instructions.md +103 -0
  16. groundworkers-0.9.0/src/groundworkers/prompt_packs/groundcrew-source-column-classification/manifest.yaml +60 -0
  17. groundworkers-0.9.0/src/groundworkers/prompt_packs/groundcrew-source-column-classification/role-catalogue.yaml +20 -0
  18. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/domain.py +7 -18
  19. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/graph.py +4 -0
  20. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/grounding.py +22 -4
  21. groundworkers-0.9.0/src/groundworkers/services/text/prompts.py +86 -0
  22. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tools/domain_tools.py +1 -0
  23. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_grounding_constraints.py +95 -0
  24. groundworkers-0.9.0/tests/unit/test_omop_domains.py +78 -0
  25. groundworkers-0.9.0/tests/unit/test_prompt_packs.py +99 -0
  26. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_text_tools.py +1 -1
  27. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_tui_app.py +27 -16
  28. groundworkers-0.8.0/Makefile +0 -23
  29. groundworkers-0.8.0/src/groundworkers/knowledge/packs/core/domain-routing/guidance.md +0 -45
  30. groundworkers-0.8.0/src/groundworkers/knowledge/packs/core/standard-concept-preference/guidance.md +0 -55
  31. groundworkers-0.8.0/src/groundworkers/services/text/prompts.py +0 -79
  32. {groundworkers-0.8.0 → groundworkers-0.9.0}/.githooks/pre-commit +0 -0
  33. {groundworkers-0.8.0 → groundworkers-0.9.0}/.github/CONTRIBUTING.md +0 -0
  34. {groundworkers-0.8.0 → groundworkers-0.9.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  35. {groundworkers-0.8.0 → groundworkers-0.9.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  36. {groundworkers-0.8.0 → groundworkers-0.9.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  37. {groundworkers-0.8.0 → groundworkers-0.9.0}/.github/ISSUE_TEMPLATE/not_working.yml +0 -0
  38. {groundworkers-0.8.0 → groundworkers-0.9.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  39. {groundworkers-0.8.0 → groundworkers-0.9.0}/.github/release-drafter.yml +0 -0
  40. {groundworkers-0.8.0 → groundworkers-0.9.0}/.github/workflows/ci.yml +0 -0
  41. {groundworkers-0.8.0 → groundworkers-0.9.0}/.github/workflows/docs.yml +0 -0
  42. {groundworkers-0.8.0 → groundworkers-0.9.0}/.github/workflows/merge.yml +0 -0
  43. {groundworkers-0.8.0 → groundworkers-0.9.0}/.github/workflows/publish.yml +0 -0
  44. {groundworkers-0.8.0 → groundworkers-0.9.0}/.gitignore +0 -0
  45. {groundworkers-0.8.0 → groundworkers-0.9.0}/.python-version +0 -0
  46. {groundworkers-0.8.0 → groundworkers-0.9.0}/CHANGELOG.md +0 -0
  47. {groundworkers-0.8.0 → groundworkers-0.9.0}/config/docker-compose.yaml +0 -0
  48. {groundworkers-0.8.0 → groundworkers-0.9.0}/config/groundworkers.example.toml +0 -0
  49. {groundworkers-0.8.0 → groundworkers-0.9.0}/config/groundworkers_db.env +0 -0
  50. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/adapters/cdm.md +0 -0
  51. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/adapters/omop_emb.md +0 -0
  52. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/adapters/omop_graph.md +0 -0
  53. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/architecture.md +0 -0
  54. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/concepts.md +0 -0
  55. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/development/extending.md +0 -0
  56. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/development/integration.md +0 -0
  57. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/development/plugins.md +0 -0
  58. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/development/standard-resolution-packs.md +0 -0
  59. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/from-scratch.md +0 -0
  60. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/index.md +0 -0
  61. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/js/mermaid-init.js +0 -0
  62. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/plugins.md +0 -0
  63. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/reference/ref_adapters.md +0 -0
  64. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/reference/ref_base.md +0 -0
  65. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/reference/ref_config.md +0 -0
  66. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/reference/ref_services.md +0 -0
  67. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/reference/ref_tools.md +0 -0
  68. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/services/domain.md +0 -0
  69. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/services/graph.md +0 -0
  70. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/services/grounding.md +0 -0
  71. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/services/mapping.md +0 -0
  72. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/services/semantic_projection.md +0 -0
  73. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/services/source_planning.md +0 -0
  74. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/services/text.md +0 -0
  75. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/services/vocab.md +0 -0
  76. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/static/01_create_config.png +0 -0
  77. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/static/02_empty_config.png +0 -0
  78. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/static/03_config_wizard.png +0 -0
  79. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/static/04_test_cnx.png +0 -0
  80. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/static/04_warnings.png +0 -0
  81. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/static/05_graph_setup.png +0 -0
  82. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/static/06_load_predicates.png +0 -0
  83. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/static/07_vector_store.png +0 -0
  84. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/static/08_register_embedding.png +0 -0
  85. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/static/10_setup_complete.png +0 -0
  86. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/tools/concept.md +0 -0
  87. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/tools/domain.md +0 -0
  88. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/tools/embedding.md +0 -0
  89. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/tools/knowledge.md +0 -0
  90. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/tools/mapping.md +0 -0
  91. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/tools/overview.md +0 -0
  92. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/tools/resolver.md +0 -0
  93. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/tools/search.md +0 -0
  94. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/tools/semantic_projection.md +0 -0
  95. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/tools/source_planning.md +0 -0
  96. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/tools/system.md +0 -0
  97. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/tools/text.md +0 -0
  98. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/usage/configuration.md +0 -0
  99. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/usage/installation.md +0 -0
  100. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/usage/integrations.md +0 -0
  101. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/usage/prompt-handling.md +0 -0
  102. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/usage/setup_journey.md +0 -0
  103. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/usage/testing.md +0 -0
  104. {groundworkers-0.8.0 → groundworkers-0.9.0}/docs/usage/upgrading-from-0.6.md +0 -0
  105. {groundworkers-0.8.0 → groundworkers-0.9.0}/mkdocs.yaml +0 -0
  106. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/__init__.py +0 -0
  107. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/_env.py +0 -0
  108. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/adapters/__init__.py +0 -0
  109. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/adapters/cdm.py +0 -0
  110. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/adapters/llm.py +0 -0
  111. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/adapters/omop_emb.py +0 -0
  112. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/app.py +0 -0
  113. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/__init__.py +0 -0
  114. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/__init__.py +0 -0
  115. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/configuration.py +0 -0
  116. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/configuration_provider.py +0 -0
  117. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/databases.py +0 -0
  118. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/embedding_artifacts.py +0 -0
  119. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/embedding_capability.py +0 -0
  120. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/embedding_coverage.py +0 -0
  121. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/embedding_population.py +0 -0
  122. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/embedding_reconciliation.py +0 -0
  123. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/embedding_registry.py +0 -0
  124. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/embedding_setup.py +0 -0
  125. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/graph_maintenance.py +0 -0
  126. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/integration.py +0 -0
  127. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/maintenance_runs.py +0 -0
  128. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/model_inventory.py +0 -0
  129. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/models.py +0 -0
  130. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/performance_maintenance.py +0 -0
  131. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/plugin_configuration.py +0 -0
  132. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/application/setup/runtime_setup.py +0 -0
  133. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/base/__init__.py +0 -0
  134. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/base/concept_payload.py +0 -0
  135. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/base/domain_names.py +0 -0
  136. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/base/errors.py +0 -0
  137. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/base/results.py +0 -0
  138. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/base/server.py +0 -0
  139. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/base/sql.py +0 -0
  140. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/bootstrap.py +0 -0
  141. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/config/README +0 -0
  142. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/config/predicate_classification.csv +0 -0
  143. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/config/predicate_mapping.csv +0 -0
  144. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/config.py +0 -0
  145. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/knowledge/packs/core/criteria-gate-yesno/guidance.md +0 -0
  146. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/knowledge/packs/core/criteria-gate-yesno/manifest.yaml +0 -0
  147. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/knowledge/packs/core/diagnosis-role-modifier/guidance.md +0 -0
  148. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/knowledge/packs/core/diagnosis-role-modifier/manifest.yaml +0 -0
  149. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/knowledge/packs/core/domain-routing/manifest.yaml +0 -0
  150. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/knowledge/packs/core/domain-routing/rules.yaml +0 -0
  151. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/knowledge/packs/core/drug-concept-granularity/guidance.md +0 -0
  152. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/knowledge/packs/core/drug-concept-granularity/manifest.yaml +0 -0
  153. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/knowledge/packs/core/drug-concept-granularity/rules.yaml +0 -0
  154. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/knowledge/packs/core/history-of-event/guidance.md +0 -0
  155. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/knowledge/packs/core/history-of-event/manifest.yaml +0 -0
  156. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/plugins.py +0 -0
  157. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/server.py +0 -0
  158. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/__init__.py +0 -0
  159. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/knowledge/__init__.py +0 -0
  160. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/knowledge/catalogue.py +0 -0
  161. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/knowledge/models.py +0 -0
  162. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/mapping.py +0 -0
  163. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/semantic_projection/__init__.py +0 -0
  164. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/semantic_projection/definitions.py +0 -0
  165. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/semantic_projection/models.py +0 -0
  166. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/semantic_projection/service.py +0 -0
  167. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/__init__.py +0 -0
  168. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/assisted.py +0 -0
  169. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/canonical_headers.py +0 -0
  170. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/classifier.py +0 -0
  171. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/decomposer.py +0 -0
  172. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/decomposers/__init__.py +0 -0
  173. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/decomposers/csv_.py +0 -0
  174. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/decomposers/ddl_.py +0 -0
  175. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/decomposers/docx_.py +0 -0
  176. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/decomposers/json_.py +0 -0
  177. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/decomposers/pdf_.py +0 -0
  178. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/decomposers/xlsx_.py +0 -0
  179. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/decomposers/xml_.py +0 -0
  180. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/detector.py +0 -0
  181. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/models.py +0 -0
  182. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/normalisation.py +0 -0
  183. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/provenance.py +0 -0
  184. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/router.py +0 -0
  185. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/serialisation.py +0 -0
  186. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/service.py +0 -0
  187. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/source_profiles/__init__.py +0 -0
  188. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/source_profiles/base.py +0 -0
  189. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/source_profiles/redcap.py +0 -0
  190. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/source_profiles/registry.py +0 -0
  191. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/source_planning/warnings.py +0 -0
  192. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/text/__init__.py +0 -0
  193. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/text/models.py +0 -0
  194. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/text/service.py +0 -0
  195. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/services/vocab.py +0 -0
  196. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tools/__init__.py +0 -0
  197. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tools/concept_tools.py +0 -0
  198. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tools/embedding_tools.py +0 -0
  199. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tools/knowledge_tools.py +0 -0
  200. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tools/mapping_tools.py +0 -0
  201. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tools/resolver_tools.py +0 -0
  202. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tools/search_tools.py +0 -0
  203. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tools/semantic_projection_tools.py +0 -0
  204. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tools/source_planning_tools.py +0 -0
  205. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tools/system_tools.py +0 -0
  206. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tools/text_tools.py +0 -0
  207. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/transports/__init__.py +0 -0
  208. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/transports/rest/__init__.py +0 -0
  209. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/transports/rest/api.py +0 -0
  210. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/transports/rest/models.py +0 -0
  211. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/__init__.py +0 -0
  212. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/app.py +0 -0
  213. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/pages/__init__.py +0 -0
  214. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/pages/base.py +0 -0
  215. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/pages/plugin_config.py +0 -0
  216. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/pages/plugin_setup.py +0 -0
  217. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/pages/setup.py +0 -0
  218. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/presenters/__init__.py +0 -0
  219. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/presenters/base.py +0 -0
  220. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/presenters/chat.py +0 -0
  221. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/presenters/configuration.py +0 -0
  222. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/presenters/database.py +0 -0
  223. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/presenters/embeddings.py +0 -0
  224. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/presenters/graph.py +0 -0
  225. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/presenters/llm_provider.py +0 -0
  226. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/presenters/overview.py +0 -0
  227. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/presenters/performance.py +0 -0
  228. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/presenters/runs.py +0 -0
  229. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/routes.py +0 -0
  230. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/state.py +0 -0
  231. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/wizards/__init__.py +0 -0
  232. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/wizards/config_location.py +0 -0
  233. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/wizards/embedding_store.py +0 -0
  234. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/wizards/embeddings.py +0 -0
  235. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/wizards/graph_maintenance.py +0 -0
  236. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/wizards/performance_maintenance.py +0 -0
  237. {groundworkers-0.8.0 → groundworkers-0.9.0}/src/groundworkers/tui/wizards/plugin_setup.py +0 -0
  238. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/__init__.py +0 -0
  239. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/conftest.py +0 -0
  240. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/integration/__init__.py +0 -0
  241. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/integration/test_omop_emb_adapter.py +0 -0
  242. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/integration/test_omop_emb_contract.py +0 -0
  243. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/integration/test_omop_graph_adapter.py +0 -0
  244. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/integration/test_omop_postgres_runtime.py +0 -0
  245. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/support/__init__.py +0 -0
  246. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/support/embedding_contract_fixture.py +0 -0
  247. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/support/omop.py +0 -0
  248. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/support/postgres_ci_config.toml +0 -0
  249. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/support/seed_postgres_fixture.py +0 -0
  250. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/support/stack_config.py +0 -0
  251. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/support/wheel_smoke.py +0 -0
  252. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/test_bootstrap_config.py +0 -0
  253. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/test_rest_api.py +0 -0
  254. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/test_server_registry.py +0 -0
  255. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/__init__.py +0 -0
  256. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_concept_payload.py +0 -0
  257. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_concept_tools.py +0 -0
  258. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_config_location_wizard.py +0 -0
  259. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_configuration_provider.py +0 -0
  260. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_domain_names.py +0 -0
  261. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_domain_tools.py +0 -0
  262. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_embedding_population_scope.py +0 -0
  263. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_embedding_reconciliation.py +0 -0
  264. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_embedding_registry_step.py +0 -0
  265. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_embedding_tools.py +0 -0
  266. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_env_bootstrap.py +0 -0
  267. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_error_boundary.py +0 -0
  268. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_graph_maintenance.py +0 -0
  269. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_graph_maintenance_wizard.py +0 -0
  270. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_graph_service.py +0 -0
  271. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_graph_status.py +0 -0
  272. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_grounding_service.py +0 -0
  273. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_knowledge_catalogue.py +0 -0
  274. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_llm_adapter.py +0 -0
  275. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_maintenance_runs_phase2.py +0 -0
  276. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_mapping_context.py +0 -0
  277. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_mapping_service.py +0 -0
  278. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_mapping_tools.py +0 -0
  279. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_migration_boundaries.py +0 -0
  280. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_normalized_index.py +0 -0
  281. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_omop_emb_adapter.py +0 -0
  282. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_omop_emb_setup_config.py +0 -0
  283. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_omop_graph_adapter.py +0 -0
  284. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_performance.py +0 -0
  285. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_performance_maintenance_wizard.py +0 -0
  286. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_phase3_overview.py +0 -0
  287. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_plugin_configuration.py +0 -0
  288. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_plugin_lint_cli.py +0 -0
  289. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_plugins.py +0 -0
  290. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_predicate_mapping_classification.py +0 -0
  291. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_provider_fields.py +0 -0
  292. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_required_integration_preflight.py +0 -0
  293. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_required_test_gate.py +0 -0
  294. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_schema_resolution.py +0 -0
  295. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_semantic_projection_service.py +0 -0
  296. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_semantic_projection_tools.py +0 -0
  297. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_setup_artifacts_and_coverage.py +0 -0
  298. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_setup_configuration.py +0 -0
  299. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_setup_configuration_section.py +0 -0
  300. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_setup_databases.py +0 -0
  301. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_setup_embeddings.py +0 -0
  302. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_setup_provider_conformance.py +0 -0
  303. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_setup_runtime.py +0 -0
  304. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_setup_truth.py +0 -0
  305. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_setup_write_flows.py +0 -0
  306. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_source_planning_assisted_classifier.py +0 -0
  307. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_source_planning_classifier.py +0 -0
  308. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_source_planning_decomposer.py +0 -0
  309. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_source_planning_detector.py +0 -0
  310. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_source_planning_document_formats.py +0 -0
  311. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_source_planning_models.py +0 -0
  312. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_source_planning_normalisation.py +0 -0
  313. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_source_planning_router.py +0 -0
  314. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_source_planning_service.py +0 -0
  315. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_source_planning_tools.py +0 -0
  316. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_split_classified_edges.py +0 -0
  317. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_stack_config_fixtures.py +0 -0
  318. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_system_tools.py +0 -0
  319. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_text_service.py +0 -0
  320. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_tui_state.py +0 -0
  321. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_vector_store_setup.py +0 -0
  322. {groundworkers-0.8.0 → groundworkers-0.9.0}/tests/unit/test_vocab_service.py +0 -0
  323. {groundworkers-0.8.0 → groundworkers-0.9.0}/uv.lock +0 -0
@@ -0,0 +1,29 @@
1
+ .PHONY: setup test lint typecheck check describe inspector
2
+
3
+ PYTHON := .venv/bin/python3
4
+ # Empty = the server-specific lookup (OA_CONFIG_PATH, then ~/.config/omop/config.toml).
5
+ # Override per run, e.g. make describe CONFIG=config/groundworkers.example.toml
6
+ CONFIG ?=
7
+
8
+ # Mirrors the install CI performs, so a local run reproduces the pipeline exactly.
9
+ setup:
10
+ uv sync --all-extras --dev
11
+
12
+ describe:
13
+ $(PYTHON) -m groundworkers.server $(if $(CONFIG),--config-path $(CONFIG)) --describe
14
+
15
+ # Launch the official MCP Inspector against this checkout's stdio server.
16
+ inspector:
17
+ MCP_INSPECTOR_SECRET_STORE=memory npm_config_cache="$${TMPDIR:-/tmp}/groundworkers-inspector-npm-cache" npx --yes @modelcontextprotocol/inspector@2.12.0 uv run --project . groundworkers
18
+
19
+ lint:
20
+ uv run ruff check .
21
+
22
+ typecheck:
23
+ uv run ty check src/
24
+
25
+ test:
26
+ uv run pytest -q
27
+
28
+ # The three gates build-test.yml enforces on every pull request.
29
+ check: typecheck lint test
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: groundworkers
3
- Version: 0.8.0
3
+ Version: 0.9.0
4
4
  Summary: Groundworkers MCP server — read-only agentive access to OMOP vocabularies, concept graphs, and embeddings.
5
5
  Requires-Python: >=3.12
6
6
  Requires-Dist: fastapi<1.0,>=0.110
@@ -102,6 +102,14 @@ groundworkers
102
102
  groundworkers --transport streamable-http --host 127.0.0.1 --port 8000
103
103
  ```
104
104
 
105
+ Explore the configured MCP tools, prompts, and resources interactively with the official MCP Inspector:
106
+
107
+ ```bash
108
+ make inspector
109
+ ```
110
+
111
+ This launches Groundworkers over stdio using the active shared OMOP configuration and opens the Inspector UI. It requires Node.js 22.19 or newer and `uv`; the first run downloads the Inspector package through `npx`.
112
+
105
113
  REST is a separate, curated interface:
106
114
 
107
115
  ```bash
@@ -44,6 +44,14 @@ groundworkers
44
44
  groundworkers --transport streamable-http --host 127.0.0.1 --port 8000
45
45
  ```
46
46
 
47
+ Explore the configured MCP tools, prompts, and resources interactively with the official MCP Inspector:
48
+
49
+ ```bash
50
+ make inspector
51
+ ```
52
+
53
+ This launches Groundworkers over stdio using the active shared OMOP configuration and opens the Inspector UI. It requires Node.js 22.19 or newer and `uv`; the first run downloads the Inspector package through `npx`.
54
+
47
55
  REST is a separate, curated interface:
48
56
 
49
57
  ```bash
@@ -76,6 +76,9 @@ groundworkers = "groundworkers.server:main"
76
76
  [project.entry-points."omop.config"]
77
77
  groundworkers = "groundworkers.config:GroundworkersConfig"
78
78
 
79
+ [project.entry-points."ohdsi_prompt_registry.packs"]
80
+ groundworkers = "groundworkers.prompt_packs"
81
+
79
82
  [build-system]
80
83
  requires = ["hatchling", "hatch-vcs"]
81
84
  build-backend = "hatchling.build"
@@ -108,8 +108,18 @@ class OmopGraphAdapter:
108
108
  failure this property exists to prevent.
109
109
  """
110
110
 
111
+ try:
112
+ self._get_kg()
113
+ except GroundworkersError:
114
+ return False
111
115
  return self._embedding_configured and self._model_backend_factory is not None
112
116
 
117
+ @property
118
+ def embedding_configuration_error(self) -> str | None:
119
+ """Safe detail when embedding setup fell back to a lexical-only graph."""
120
+
121
+ return self._embedding_configuration_error
122
+
113
123
  def is_available(self) -> bool:
114
124
  try:
115
125
  self._get_kg()
@@ -0,0 +1,70 @@
1
+ # Domain Routing
2
+
3
+ ## The fundamental rule
4
+
5
+ For an entity concept field, route the record using the `domain_id` of the
6
+ selected, active standard mapping target. Do not infer the destination table
7
+ from the source vocabulary, source code, source table, or caller hint when a
8
+ valid standard target is available.
9
+
10
+ For example, if a source item coded as a procedure maps to an active standard
11
+ Drug concept, the entity belongs in `DRUG_EXPOSURE`. If an item that looks like
12
+ a diagnosis maps to an active standard Measurement concept, it belongs in
13
+ `MEASUREMENT`. The selected entity target's domain determines the table.
14
+
15
+ Check that a proposed target is both standard (`standard_concept = 'S'`) and
16
+ active before using its domain for routing. A target that is retired, updated,
17
+ or a classification concept (`standard_concept = 'C'`) is not a valid entity
18
+ target.
19
+
20
+ If mapping produces multiple targets, or no valid standard target, do not
21
+ silently choose a table based on one candidate. Preserve the source item and
22
+ mapping evidence, flag the unresolved or multi-target decision, and use the
23
+ fallback rule below only when a record still needs to be written.
24
+
25
+ ## Domain → CDM table mapping
26
+
27
+ | domain_id | Primary CDM table |
28
+ |-----------|-------------------|
29
+ | Condition | CONDITION_OCCURRENCE |
30
+ | Drug | DRUG_EXPOSURE |
31
+ | Measurement | MEASUREMENT |
32
+ | Observation | OBSERVATION |
33
+ | Procedure | PROCEDURE_OCCURRENCE |
34
+ | Device | DEVICE_EXPOSURE |
35
+ | Specimen | SPECIMEN |
36
+ | Visit | VISIT_OCCURRENCE |
37
+ | Provider | PROVIDER |
38
+
39
+ ## Scope: entity concepts versus value concepts
40
+
41
+ This routing rule applies to the entity concept field — the concept that
42
+ identifies the record, such as `condition_concept_id`,
43
+ `measurement_concept_id`, or `observation_concept_id`.
44
+
45
+ It does not route on `value_as_concept_id` or another subordinate value field.
46
+ A value concept may have a different domain from the entity and the CDM table.
47
+ For example, personal history may be represented by the Observation-domain
48
+ `History of event` concept in `observation_concept_id`, with a Condition- or
49
+ Procedure-domain concept in `value_as_concept_id`. Family history may instead
50
+ use a pre-coordinated family-history concept in `observation_concept_id`.
51
+
52
+ Do not create a Condition or Procedure row, or change the table, solely because
53
+ a history value has that domain. Preserve the history, family relationship,
54
+ negation, and temporal meaning represented by the source and mapping pattern.
55
+
56
+ ## Unmapped source items (concept_id = 0)
57
+
58
+ If no active standard target is available, use `*_concept_id = 0` rather than
59
+ NULL or an inactive/non-standard fallback. When a record must still be placed
60
+ in a CDM table, use the best available domain signal from the source vocabulary,
61
+ source table, and caller context. Treat that as a fallback decision, document
62
+ it, and preserve the original source value for review.
63
+
64
+ Do not omit a record solely because no mapping was found. The source value is preserved in `*_source_value` and the zero-mapped record remains queryable.
65
+
66
+ ## What not to do
67
+
68
+ - Do not route based on the source vocabulary (ICD codes are not always Condition; NDC codes are almost always Drug but verify the target concept's domain).
69
+ - Do not route based on the source table name or caller hint alone.
70
+ - Do not use concept_id = NULL — zero-mapping is the standard for unmapped concepts.
@@ -0,0 +1,149 @@
1
+ # Standard Concept Selection
2
+
3
+ ## Concepts must be active
4
+
5
+ Before selecting any standard concept as a mapping target, verify it is active:
6
+ - `INVALID_REASON IS NULL` (not deprecated, not updated, not deleted)
7
+ - `VALID_END_DATE = 2099-12-31` (OHDSI convention for currently active concepts)
8
+
9
+ Deprecated concepts (INVALID_REASON = 'D') and concepts that have been replaced
10
+ (INVALID_REASON = 'U') must not be used as mapping targets, even if they have
11
+ standard_concept = 'S'. For replaced concepts, follow the `Maps to` relationship
12
+ from the deprecated concept to find its active successor.
13
+
14
+ ## Standard concepts are required for entity fields
15
+
16
+ A concept is standard when standard_concept = 'S' in the CONCEPT table.
17
+ All entity concept fields (condition_concept_id, measurement_concept_id,
18
+ observation_concept_id, drug_concept_id, etc.) must be populated with
19
+ standard concepts only.
20
+
21
+ Non-standard concepts belong in source_concept_id, not entity concept fields.
22
+
23
+ ## Classification concepts are not valid mapping targets
24
+
25
+ Concepts with standard_concept = 'C' are classification nodes — they exist in
26
+ the hierarchy to support ancestor queries but are not intended as direct mapping
27
+ targets. If a candidate search returns a classification concept, look at its
28
+ standard descendants to find the appropriate specific concept.
29
+
30
+ ## Verify both ends of a mapping
31
+
32
+ Before using a relationship to select an entity target, check the target
33
+ concept itself:
34
+
35
+ - It must be standard (`standard_concept = 'S'`), not a classification concept.
36
+ - It must be active (`invalid_reason IS NULL` and
37
+ `valid_end_date = 2099-12-31`).
38
+
39
+ A valid relationship row does not guarantee a valid target concept. In
40
+ particular, `valid = true` describes the relationship row; it does not mean
41
+ the target concept is active or standard. If a `Maps to` target is retired or
42
+ updated, follow the replacement only when an active, standard successor is
43
+ available. Otherwise preserve the source and flag the mapping for review.
44
+
45
+ When a source maps to multiple targets, check whether the mapping is
46
+ one-to-many by design. Preserve all supported targets and their roles; do not
47
+ silently collapse them into one target or treat them as interchangeable.
48
+
49
+ ## Interpret relationship types narrowly
50
+
51
+ Use each relationship only for the claim it supports:
52
+
53
+ - `Maps to` identifies a mapping target. Verify that target before using it.
54
+ - `Maps to value` supplies a value for a mapped entity; it does not replace
55
+ the entity target or determine the record's CDM table.
56
+ - `Is a` expresses hierarchy. It may support ancestor or descendant queries,
57
+ but does not establish an exact mapping or equivalence.
58
+ - Attribute relationships describe properties of a concept. They do not, by
59
+ themselves, establish identity or a mapping.
60
+ - Equivalence-like or informational relationships such as `eq`, `cat`, and
61
+ `poss_eq` are evidence to inspect, not mapping instructions. Check their
62
+ meaning and specificity before using them.
63
+
64
+ Do not treat metadata relationships as clinical meaning. For example,
65
+ `Has status` describes SNOMED definition status, and `Has Module` identifies
66
+ a module; neither is a clinical attribute or an identity path.
67
+
68
+ ## Preserve source meaning and qualifiers
69
+
70
+ Keep the original source code and source value available when selecting or
71
+ reviewing a target. A mapping may lose detail that matters for analysis; do
72
+ not assume that laterality, approach, timing, status, negation, or other
73
+ qualifiers survive unless the target explicitly represents them.
74
+
75
+ For one-to-many mappings, preserve the role of each target. Do not assume the
76
+ targets are interchangeable or that they mean the source concepts occurred
77
+ together.
78
+
79
+ For disjunctive source items such as “A or B”, do not map to both A and B as
80
+ though both occurred. Prefer a target that preserves the disjunction; if none
81
+ is available, use the least specific faithful target or flag the item for
82
+ review.
83
+
84
+ Do not assume hierarchy-based concept sets preserve source meaning across
85
+ vocabularies. Check the relevant vocabulary and hierarchy before relying on
86
+ ancestors or descendants; where coverage or placement is unreliable, retain
87
+ the source code and document the limitation.
88
+
89
+ Preserve historical, family-history, negated, and status concepts as such.
90
+ Do not turn them into current diagnoses just because a related disease or
91
+ procedure appears as a target or value.
92
+
93
+ ## Vocabulary preference is conditional
94
+
95
+ Treat vocabulary preference as a tie-breaker between active standard concepts
96
+ that represent the same meaning at the required level of specificity. It is
97
+ not a rule to translate every source code into one preferred vocabulary.
98
+
99
+ First establish what the source item represents, the target field it will
100
+ populate, and the intended use. Then verify candidate meaning, domain,
101
+ standardness, and active status. Preserve an appropriate active standard
102
+ source concept when it already represents the recorded item. Do not prefer a
103
+ candidate from another vocabulary solely because its vocabulary is listed
104
+ below.
105
+
106
+ ### Condition
107
+
108
+ SNOMED is the main clinical Condition backbone. ICD10CM, ICD9CM, and ICD10
109
+ Condition concepts are generally non-standard and require an active `Maps to`
110
+ target. Check one-to-many mappings and preserve source detail that the targets
111
+ do not retain.
112
+
113
+ ICDO3 histology-by-site combinations are standard Condition concepts in their
114
+ own right. Do not replace them automatically with SNOMED or assume their
115
+ hierarchy reliably captures histology or behaviour.
116
+
117
+ ### Procedure
118
+
119
+ Do not default to SNOMED. CPT4, HCPCS, ICD10PCS, and ICD9Proc can contain active
120
+ standard Procedure concepts. Preserve the source standard concept when it is
121
+ the appropriate representation for the task, especially for claims or
122
+ administrative data. Use SNOMED when it is the appropriate clinical
123
+ representation, not as an automatic substitute.
124
+
125
+ Do not assume a hierarchy or an informational equivalence link proves an exact
126
+ mapping. In particular, verify that targets are active and treat
127
+ ICD10PCS-to-SNOMED ancestry as potentially incomplete or misleading.
128
+
129
+ ### Measurement and Observation
130
+
131
+ Choose based on what was recorded: an instrument, an administered procedure,
132
+ a question or survey item, or a score. Do not assume that concepts for the same
133
+ instrument in different vocabularies share a domain or an exact crosswalk.
134
+ For example, LOINC survey items are in Observation, while SNOMED assessment
135
+ scales are in Measurement. Keep instrument identity, administration, and score
136
+ distinct where the source data distinguishes them.
137
+
138
+ ### Other domains
139
+
140
+ Keep the existing Drug and other domain preferences as provisional defaults.
141
+ Apply them only when candidates are active and equivalent at the required
142
+ precision; revisit them when domain-specific audit evidence is available.
143
+
144
+ ## Zero concept
145
+
146
+ When no suitable standard concept exists, use concept_id = 0 (no matching concept).
147
+ Do not use a non-standard concept as a fallback for an entity concept field.
148
+ concept_id = 0 is the explicit signal that mapping was not possible; it is
149
+ preferable to a misleading non-standard concept.
@@ -1,12 +1,11 @@
1
1
  name: standard-concept-preference
2
2
  layer: core
3
- version: "1.0"
3
+ version: "1.1"
4
4
  shareability: public
5
5
  scope_summary: >
6
6
  Rules for selecting standard concepts as mapping targets: standard_concept='S'
7
7
  required for entity fields, classification concepts ('C') are not valid targets,
8
- and vocabulary precedence by domain (SNOMED for conditions, RxNorm over RxNorm
9
- Extension for drugs, LOINC for measurements).
8
+ with conditional, domain-specific vocabulary selection guidance.
10
9
 
11
10
  mechanisms:
12
11
  - context-inject
@@ -1,5 +1,5 @@
1
- # Standard concept preference rules
2
- # Consumed by the post-filter mechanism to rank or reject candidates.
1
+ # Standard concept eligibility rules and provisional domain preferences.
2
+ # These rules are currently declarative; see guidance.md for the resolution policy.
3
3
 
4
4
  active_concept_required:
5
5
  # Concepts must be active — not deprecated or replaced.
@@ -27,6 +27,10 @@ vocab_preference:
27
27
  - domain: Condition
28
28
  prefer: [SNOMED]
29
29
  over: [ICD10CM, ICD9CM, ICD10, MedDRA]
30
+ note: >
31
+ Tie-breaker only among active standard concepts representing the same
32
+ meaning at the required specificity. ICDO3 also has standard Condition
33
+ combinations; do not replace them automatically with SNOMED.
30
34
 
31
35
  - domain: Drug
32
36
  prefer: [RxNorm]
@@ -36,15 +40,18 @@ vocab_preference:
36
40
  RxNorm concept exists for the same clinical drug at the same precision level.
37
41
 
38
42
  - domain: Measurement
39
- prefer: [LOINC]
40
- secondary: [SNOMED]
43
+ note: >
44
+ No blanket ranking. Choose based on whether the source represents a
45
+ survey item, clinical assessment, finding, or score; verify the candidate
46
+ domain and preserve the source representation.
41
47
 
42
48
  - domain: Procedure
43
- prefer: [SNOMED]
44
- secondary: [CPT4]
45
49
  note: >
46
- CPT4 is preferred for US procedural billing/claims context.
47
- SNOMED preferred for clinical EHR data and non-US sources.
50
+ No blanket ranking. Standard source concepts in CPT4, HCPCS, ICD10PCS,
51
+ and ICD9Proc may map to themselves. Use SNOMED only when it is the
52
+ appropriate representation, not as an automatic replacement.
48
53
 
49
54
  - domain: Observation
50
- prefer: [SNOMED, LOINC]
55
+ note: >
56
+ No blanket ranking. Distinguish survey items, observations, history
57
+ patterns, and other recorded entities by their meaning and target field.
@@ -0,0 +1,64 @@
1
+ """Domain routing facts that groundworkers owns and other components import.
2
+
3
+ The full set of OMOP ``domain_id`` values comes from the vocabulary's ``domain``
4
+ table (see :class:`groundworkers.base.domain_names.DomainNameResolver`); this module
5
+ does not repeat it. It owns two smaller facts the vocabulary does not record:
6
+
7
+ ``DOMAIN_TO_TABLE``
8
+ The CDM event table a record is written to, keyed by the ``domain_id`` of its
9
+ selected standard target. The ``domain-routing`` knowledge pack publishes the
10
+ same mapping to agents; tests keep the pack identical to this table.
11
+
12
+ ``CLASSIFIABLE_DOMAINS`` and ``NON_CLINICAL``
13
+ The output vocabulary of the ``domain_classify`` tool. The clinical values are
14
+ a subset of the routed domains. The non-clinical values are *not* OMOP domains:
15
+ they label data-dictionary fields that describe how data was collected
16
+ (``Metadata``) or that only link records (``Identifier``). Callers decide what
17
+ to do with them; groundcrew, for example, skips such fields.
18
+
19
+ This is published API: import from here rather than copying the values.
20
+ """
21
+
22
+ from __future__ import annotations
23
+
24
+ from types import MappingProxyType
25
+ from typing import Final
26
+
27
+ DOMAIN_TO_TABLE: Final = MappingProxyType(
28
+ {
29
+ "Condition": "CONDITION_OCCURRENCE",
30
+ "Drug": "DRUG_EXPOSURE",
31
+ "Measurement": "MEASUREMENT",
32
+ "Observation": "OBSERVATION",
33
+ "Procedure": "PROCEDURE_OCCURRENCE",
34
+ "Device": "DEVICE_EXPOSURE",
35
+ "Specimen": "SPECIMEN",
36
+ "Visit": "VISIT_OCCURRENCE",
37
+ "Provider": "PROVIDER",
38
+ }
39
+ )
40
+
41
+ CLASSIFIABLE_DOMAINS: Final[tuple[str, ...]] = (
42
+ "Measurement",
43
+ "Condition",
44
+ "Observation",
45
+ "Procedure",
46
+ "Drug",
47
+ "Device",
48
+ )
49
+
50
+ NON_CLINICAL: Final[tuple[str, ...]] = ("Metadata", "Identifier")
51
+
52
+ DOMAIN_CLASSIFY_OUTPUTS: Final[frozenset[str]] = frozenset(CLASSIFIABLE_DOMAINS + NON_CLINICAL)
53
+
54
+
55
+ def table_for_domain(domain_id: str | None) -> str | None:
56
+ """The CDM table for a canonical ``domain_id``, or None when it is not routed.
57
+
58
+ Expects the canonical spelling (``"Condition"``); normalise loosely typed input
59
+ with ``DomainNameResolver.canonical`` first.
60
+ """
61
+
62
+ if domain_id is None:
63
+ return None
64
+ return DOMAIN_TO_TABLE.get(domain_id)
@@ -0,0 +1,8 @@
1
+ """Prompt packs for the OHDSI Prompt Registry that ship with Groundworkers.
2
+
3
+ Each direct child directory is one registry pack, published through the
4
+ ``ohdsi_prompt_registry.packs`` entry point. A pack lives here when Groundworkers
5
+ owns the contract it describes: ``groundcrew-source-column-classification``
6
+ reviews columns against Groundworkers' ``ColumnRole`` vocabulary. The name keeps
7
+ its ``groundcrew-`` prefix so existing prompt names and overrides stay stable.
8
+ """
@@ -0,0 +1,86 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://local.groundcrew/schemas/source-column-classification-request.schema.json",
4
+ "title": "Groundcrew source-column classification request",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "table_name",
9
+ "headers",
10
+ "original_headers",
11
+ "sample_rows",
12
+ "deterministic_annotations",
13
+ "candidate_headers"
14
+ ],
15
+ "properties": {
16
+ "table_name": {"type": "string", "minLength": 1},
17
+ "headers": {
18
+ "type": "array",
19
+ "minItems": 1,
20
+ "uniqueItems": true,
21
+ "items": {"type": "string", "minLength": 1}
22
+ },
23
+ "original_headers": {
24
+ "type": "array",
25
+ "uniqueItems": true,
26
+ "items": {"type": "string", "minLength": 1}
27
+ },
28
+ "sample_rows": {
29
+ "type": "array",
30
+ "maxItems": 5,
31
+ "items": {
32
+ "type": "object",
33
+ "additionalProperties": {"type": ["string", "null"]}
34
+ }
35
+ },
36
+ "deterministic_annotations": {
37
+ "type": "object",
38
+ "additionalProperties": {"$ref": "#/$defs/annotation"}
39
+ },
40
+ "candidate_headers": {
41
+ "type": "array",
42
+ "minItems": 1,
43
+ "uniqueItems": true,
44
+ "items": {"type": "string", "minLength": 1}
45
+ }
46
+ },
47
+ "$defs": {
48
+ "role": {
49
+ "enum": [
50
+ "label",
51
+ "codes",
52
+ "values",
53
+ "annotation",
54
+ "entity",
55
+ "attribute",
56
+ "section",
57
+ "subsection",
58
+ "source_vocab",
59
+ "description",
60
+ "mapping_context",
61
+ "data_type",
62
+ "field_type_ctrl",
63
+ "local_pk",
64
+ "pii_flag",
65
+ "required",
66
+ "frequency",
67
+ "pipeline_meta",
68
+ "irrelevant"
69
+ ]
70
+ },
71
+ "annotation": {
72
+ "type": "object",
73
+ "additionalProperties": false,
74
+ "required": ["role", "detection_tier", "confidence", "inferred_vocab", "packed_value", "notes"],
75
+ "properties": {
76
+ "role": {"$ref": "#/$defs/role"},
77
+ "detection_tier": {"enum": ["A", "B", "C", "D", "LLM"]},
78
+ "confidence": {"type": "number", "minimum": 0, "maximum": 1},
79
+ "inferred_vocab": {"type": ["string", "null"]},
80
+ "packed_value": {"type": "boolean"},
81
+ "notes": {"type": "string"}
82
+ }
83
+ }
84
+ }
85
+ }
86
+
@@ -0,0 +1,76 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://local.groundcrew/schemas/source-column-classification-result.schema.json",
4
+ "title": "Groundcrew source-column classification result",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["decisions"],
8
+ "properties": {
9
+ "decisions": {
10
+ "type": "array",
11
+ "minItems": 1,
12
+ "items": {"$ref": "#/$defs/decision"}
13
+ }
14
+ },
15
+ "$defs": {
16
+ "role": {
17
+ "enum": [
18
+ "label",
19
+ "codes",
20
+ "values",
21
+ "annotation",
22
+ "entity",
23
+ "attribute",
24
+ "section",
25
+ "subsection",
26
+ "source_vocab",
27
+ "description",
28
+ "mapping_context",
29
+ "data_type",
30
+ "field_type_ctrl",
31
+ "local_pk",
32
+ "pii_flag",
33
+ "required",
34
+ "frequency",
35
+ "pipeline_meta",
36
+ "irrelevant"
37
+ ]
38
+ },
39
+ "decision": {
40
+ "type": "object",
41
+ "additionalProperties": false,
42
+ "required": ["header", "role", "confidence", "inferred_vocab", "packed_value", "notes"],
43
+ "properties": {
44
+ "header": {"type": "string", "minLength": 1},
45
+ "role": {
46
+ "oneOf": [
47
+ {"$ref": "#/$defs/role"},
48
+ {"type": "null"}
49
+ ]
50
+ },
51
+ "confidence": {"type": "number", "minimum": 0, "maximum": 1},
52
+ "inferred_vocab": {"type": ["string", "null"]},
53
+ "packed_value": {"type": "boolean"},
54
+ "notes": {"type": "string", "minLength": 1}
55
+ },
56
+ "allOf": [
57
+ {
58
+ "if": {"properties": {"role": {"type": "null"}}, "required": ["role"]},
59
+ "then": {
60
+ "properties": {
61
+ "confidence": {"maximum": 0.79},
62
+ "inferred_vocab": {"type": "null"},
63
+ "packed_value": {"const": false}
64
+ }
65
+ }
66
+ },
67
+ {
68
+ "if": {"properties": {"role": {"const": "values"}}, "required": ["role"]},
69
+ "then": {},
70
+ "else": {"properties": {"packed_value": {"const": false}}}
71
+ }
72
+ ]
73
+ }
74
+ }
75
+ }
76
+