conceptql 0.2.0 → 0.4.0
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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +226 -117
- data/LICENSE +21 -0
- data/README.md +35 -83
- data/bin/conceptql +2 -1
- data/bin/conceptql_utils +6 -0
- data/config/multiple_vocabularies.csv +4 -0
- data/config/provenance.yml +489 -0
- data/config/race.yml +50 -0
- data/config/vocabularies.csv +87 -0
- data/lib/conceptql/behaviors/code_lister.rb +23 -0
- data/lib/conceptql/behaviors/drugish.rb +17 -0
- data/lib/conceptql/behaviors/labish.rb +19 -0
- data/lib/conceptql/behaviors/metadatable.rb +226 -73
- data/lib/conceptql/behaviors/provenanceable.rb +26 -0
- data/lib/conceptql/behaviors/single_event.rb +11 -0
- data/lib/conceptql/behaviors/timeless.rb +11 -0
- data/lib/conceptql/behaviors/utilizable.rb +206 -0
- data/lib/conceptql/behaviors/windowable.rb +27 -0
- data/lib/conceptql/cli.rb +117 -108
- data/lib/conceptql/columnizer.rb +75 -0
- data/lib/conceptql/data_model/base.rb +462 -0
- data/lib/conceptql/data_model/gdm.rb +155 -0
- data/lib/conceptql/data_model/gdm_wide.rb +42 -0
- data/lib/conceptql/data_model/omopv4_plus.rb +12 -0
- data/lib/conceptql/data_model.rb +30 -0
- data/lib/conceptql/database.rb +214 -0
- data/lib/conceptql/date_adjuster.rb +66 -18
- data/lib/conceptql/diagram.rb +243 -0
- data/lib/conceptql/lexicon/lexicon_gdm.rb +47 -0
- data/lib/conceptql/lexicon/lexicon_no_db.rb +49 -0
- data/lib/conceptql/lexicon/lexicon_ohdsi.rb +63 -0
- data/lib/conceptql/lexicon/lexicon_strategy.rb +116 -0
- data/lib/conceptql/lexicon.rb +111 -0
- data/lib/conceptql/nodifier.rb +65 -24
- data/lib/conceptql/operators/after.rb +34 -14
- data/lib/conceptql/operators/any_overlap.rb +8 -6
- data/lib/conceptql/operators/before.rb +34 -10
- data/lib/conceptql/operators/binary_operator_operator.rb +66 -23
- data/lib/conceptql/operators/casting_operator.rb +51 -36
- data/lib/conceptql/operators/co_reported.rb +111 -0
- data/lib/conceptql/operators/concurrent_within.rb +69 -0
- data/lib/conceptql/operators/contains.rb +12 -8
- data/lib/conceptql/operators/count.rb +17 -9
- data/lib/conceptql/operators/date_range.rb +48 -14
- data/lib/conceptql/operators/death.rb +14 -4
- data/lib/conceptql/operators/dedup.rb +31 -0
- data/lib/conceptql/operators/during.rb +7 -12
- data/lib/conceptql/operators/episode.rb +146 -0
- data/lib/conceptql/operators/equal.rb +9 -3
- data/lib/conceptql/operators/ethnicity.rb +49 -0
- data/lib/conceptql/operators/except.rb +19 -12
- data/lib/conceptql/operators/filter.rb +23 -8
- data/lib/conceptql/operators/first.rb +16 -3
- data/lib/conceptql/operators/from.rb +52 -4
- data/lib/conceptql/operators/gender.rb +34 -11
- data/lib/conceptql/operators/hospice.rb +19 -0
- data/lib/conceptql/operators/hospitalization.rb +19 -0
- data/lib/conceptql/operators/information_periods.rb +36 -0
- data/lib/conceptql/operators/invalid.rb +35 -0
- data/lib/conceptql/operators/last.rb +16 -3
- data/lib/conceptql/operators/match.rb +91 -0
- data/lib/conceptql/operators/multiple_vocabularies.rb +172 -0
- data/lib/conceptql/operators/numeric.rb +65 -23
- data/lib/conceptql/operators/numeric_filter.rb +68 -0
- data/lib/conceptql/operators/occurrence.rb +153 -32
- data/lib/conceptql/operators/one_in_two_out.rb +237 -38
- data/lib/conceptql/operators/operator.rb +624 -178
- data/lib/conceptql/operators/pass_thru.rb +17 -3
- data/lib/conceptql/operators/person.rb +18 -6
- data/lib/conceptql/operators/person_filter.rb +9 -3
- data/lib/conceptql/operators/place_of_service_filter.rb +43 -0
- data/lib/conceptql/operators/provenance.rb +55 -0
- data/lib/conceptql/operators/provider_filter.rb +62 -0
- data/lib/conceptql/operators/race.rb +55 -7
- data/lib/conceptql/operators/read.rb +168 -0
- data/lib/conceptql/operators/recall.rb +49 -14
- data/lib/conceptql/operators/snf.rb +19 -0
- data/lib/conceptql/operators/sum.rb +29 -12
- data/lib/conceptql/operators/temporal_operator.rb +108 -16
- data/lib/conceptql/operators/time_window.rb +20 -32
- data/lib/conceptql/operators/trim_date.rb +71 -0
- data/lib/conceptql/operators/trim_date_end.rb +28 -40
- data/lib/conceptql/operators/trim_date_start.rb +28 -41
- data/lib/conceptql/operators/union.rb +67 -6
- data/lib/conceptql/operators/vocabulary.rb +151 -0
- data/lib/conceptql/paths.rb +41 -0
- data/lib/conceptql/query.rb +191 -26
- data/lib/conceptql/query_modifiers/gdm/admission_date_query_modifier.rb +46 -0
- data/lib/conceptql/query_modifiers/gdm/drug_query_modifier.rb +54 -0
- data/lib/conceptql/query_modifiers/gdm/lab_query_modifier.rb +57 -0
- data/lib/conceptql/query_modifiers/gdm/pos_query_modifier.rb +46 -0
- data/lib/conceptql/query_modifiers/gdm/provenance_query_modifier.rb +45 -0
- data/lib/conceptql/query_modifiers/gdm/provider_query_modifier.rb +53 -0
- data/lib/conceptql/query_modifiers/gdm_wide/admission_date_query_modifier.rb +42 -0
- data/lib/conceptql/query_modifiers/gdm_wide/drug_query_modifier.rb +52 -0
- data/lib/conceptql/query_modifiers/gdm_wide/lab_query_modifier.rb +55 -0
- data/lib/conceptql/query_modifiers/gdm_wide/pos_query_modifier.rb +37 -0
- data/lib/conceptql/query_modifiers/gdm_wide/provenance_query_modifier.rb +38 -0
- data/lib/conceptql/query_modifiers/omopv4_plus/admission_date_query_modifier.rb +45 -0
- data/lib/conceptql/query_modifiers/omopv4_plus/drug_query_modifier.rb +80 -0
- data/lib/conceptql/query_modifiers/omopv4_plus/pos_query_modifier.rb +47 -0
- data/lib/conceptql/query_modifiers/omopv4_plus/provenance_query_modifier.rb +45 -0
- data/lib/conceptql/query_modifiers/omopv4_plus/provider_query_modifier.rb +26 -0
- data/lib/conceptql/query_modifiers/query_modifier.rb +20 -0
- data/lib/conceptql/rdbms/duckdb.rb +25 -0
- data/lib/conceptql/rdbms/generic.rb +120 -0
- data/lib/conceptql/rdbms/postgres.rb +51 -0
- data/lib/conceptql/rdbms/spark.rb +22 -0
- data/lib/conceptql/rdbms.rb +22 -0
- data/lib/conceptql/scope.rb +481 -31
- data/lib/conceptql/sql_formatters/formatter.rb +25 -0
- data/lib/conceptql/sql_formatters.rb +22 -0
- data/lib/conceptql/utils.rb +113 -0
- data/lib/conceptql/utils_cli.rb +17 -0
- data/lib/conceptql/version.rb +3 -1
- data/lib/conceptql/visitors/metadata_extractor.rb +54 -0
- data/lib/conceptql/vocabularies/behaviors/costish.rb +24 -0
- data/lib/conceptql/vocabularies/behaviors/gdmish.rb +19 -0
- data/lib/conceptql/vocabularies/behaviors/omopish.rb +32 -0
- data/lib/conceptql/vocabularies/dynamic_vocabularies.rb +63 -0
- data/lib/conceptql/vocabularies/entry.rb +138 -0
- data/lib/conceptql/vocabularies/vocabulary_class_factory.rb +85 -0
- data/lib/conceptql/window/base.rb +26 -0
- data/lib/conceptql/window/date_range.rb +25 -0
- data/lib/conceptql/window/table.rb +116 -0
- data/lib/conceptql/window.rb +72 -0
- data/lib/conceptql.rb +65 -2
- data/lib/sequel/extensions/pg_ctas_explain.rb +22 -0
- data/lib/sequel/extensions/pg_vacuum_table.rb +23 -0
- data/schemas/gdm.yml +882 -0
- data/schemas/gdm_wide.yml +757 -0
- data/schemas/ohdsi_vocabs.yml +143 -0
- data/schemas/omopv4_plus.yml +729 -0
- data/schemas/omopv4_plus_more_ignorables.tsv +13 -0
- metadata +267 -207
- data/.gitignore +0 -23
- data/Gemfile +0 -4
- data/Guardfile +0 -56
- data/LICENSE.txt +0 -22
- data/Rakefile +0 -1
- data/conceptql.gemspec +0 -32
- data/doc/ConceptQL Specification (alpha).pdf +0 -0
- data/doc/diagram_0.png +0 -0
- data/doc/implementation_notes.md +0 -39
- data/doc/spec.md +0 -1344
- data/lib/conceptql/behaviors/debuggable.rb +0 -70
- data/lib/conceptql/behaviors/dottable.rb +0 -103
- data/lib/conceptql/behaviors/preppable.rb +0 -20
- data/lib/conceptql/converter.rb +0 -65
- data/lib/conceptql/debugger.rb +0 -48
- data/lib/conceptql/fake_grapher.rb +0 -20
- data/lib/conceptql/graph.rb +0 -52
- data/lib/conceptql/graph_nodifier.rb +0 -203
- data/lib/conceptql/logger.rb +0 -10
- data/lib/conceptql/operators/complement.rb +0 -38
- data/lib/conceptql/operators/concept.rb +0 -70
- data/lib/conceptql/operators/condition_type.rb +0 -71
- data/lib/conceptql/operators/cpt.rb +0 -25
- data/lib/conceptql/operators/drug_type_concept.rb +0 -21
- data/lib/conceptql/operators/from_seer_visits.rb +0 -23
- data/lib/conceptql/operators/hcpcs.rb +0 -25
- data/lib/conceptql/operators/icd10.rb +0 -28
- data/lib/conceptql/operators/icd9.rb +0 -28
- data/lib/conceptql/operators/icd9_procedure.rb +0 -25
- data/lib/conceptql/operators/intersect.rb +0 -34
- data/lib/conceptql/operators/loinc.rb +0 -25
- data/lib/conceptql/operators/medcode.rb +0 -28
- data/lib/conceptql/operators/medcode_procedure.rb +0 -27
- data/lib/conceptql/operators/ndc.rb +0 -29
- data/lib/conceptql/operators/observation_by_enttype.rb +0 -29
- data/lib/conceptql/operators/observation_period.rb +0 -30
- data/lib/conceptql/operators/overlapped_by.rb +0 -23
- data/lib/conceptql/operators/overlaps.rb +0 -19
- data/lib/conceptql/operators/place_of_service_code.rb +0 -24
- data/lib/conceptql/operators/procedure_occurrence.rb +0 -25
- data/lib/conceptql/operators/prodcode.rb +0 -29
- data/lib/conceptql/operators/rxnorm.rb +0 -24
- data/lib/conceptql/operators/snomed.rb +0 -24
- data/lib/conceptql/operators/snomed_condition.rb +0 -26
- data/lib/conceptql/operators/source_vocabulary_operator.rb +0 -58
- data/lib/conceptql/operators/standard_vocabulary_operator.rb +0 -45
- data/lib/conceptql/operators/started_by.rb +0 -22
- data/lib/conceptql/operators/to_seer_visits.rb +0 -24
- data/lib/conceptql/operators/visit.rb +0 -15
- data/lib/conceptql/operators/visit_occurrence.rb +0 -30
- data/lib/conceptql/tree.rb +0 -53
- data/lib/conceptql/utils/temp_table.rb +0 -72
- data/spec/conceptql/behaviors/dottable_spec.rb +0 -99
- data/spec/conceptql/converter_spec.rb +0 -51
- data/spec/conceptql/date_adjuster_spec.rb +0 -68
- data/spec/conceptql/operators/after_spec.rb +0 -16
- data/spec/conceptql/operators/before_spec.rb +0 -16
- data/spec/conceptql/operators/casting_operator_spec.rb +0 -68
- data/spec/conceptql/operators/complement_spec.rb +0 -15
- data/spec/conceptql/operators/concept_spec.rb +0 -40
- data/spec/conceptql/operators/condition_type_spec.rb +0 -128
- data/spec/conceptql/operators/contains_spec.rb +0 -19
- data/spec/conceptql/operators/cpt_spec.rb +0 -29
- data/spec/conceptql/operators/date_range_spec.rb +0 -33
- data/spec/conceptql/operators/death_spec.rb +0 -10
- data/spec/conceptql/operators/during_spec.rb +0 -30
- data/spec/conceptql/operators/except_spec.rb +0 -15
- data/spec/conceptql/operators/first_spec.rb +0 -35
- data/spec/conceptql/operators/from_spec.rb +0 -13
- data/spec/conceptql/operators/gender_spec.rb +0 -27
- data/spec/conceptql/operators/hcpcs_spec.rb +0 -29
- data/spec/conceptql/operators/icd10_spec.rb +0 -34
- data/spec/conceptql/operators/icd9_procedure_spec.rb +0 -29
- data/spec/conceptql/operators/icd9_spec.rb +0 -34
- data/spec/conceptql/operators/intersect_spec.rb +0 -28
- data/spec/conceptql/operators/last_spec.rb +0 -36
- data/spec/conceptql/operators/loinc_spec.rb +0 -29
- data/spec/conceptql/operators/medcode_procedure_spec.rb +0 -34
- data/spec/conceptql/operators/medcode_spec.rb +0 -34
- data/spec/conceptql/operators/observation_period_spec.rb +0 -10
- data/spec/conceptql/operators/occurrence_spec.rb +0 -87
- data/spec/conceptql/operators/overlapped_by_spec.rb +0 -32
- data/spec/conceptql/operators/overlaps_spec.rb +0 -21
- data/spec/conceptql/operators/person_filter_spec.rb +0 -15
- data/spec/conceptql/operators/person_spec.rb +0 -10
- data/spec/conceptql/operators/place_of_service_code_spec.rb +0 -24
- data/spec/conceptql/operators/procedure_occurrence_spec.rb +0 -10
- data/spec/conceptql/operators/prodcode_spec.rb +0 -35
- data/spec/conceptql/operators/query_double.rb +0 -20
- data/spec/conceptql/operators/query_double_spec.rb +0 -7
- data/spec/conceptql/operators/race_spec.rb +0 -21
- data/spec/conceptql/operators/rxnorm_spec.rb +0 -29
- data/spec/conceptql/operators/snomed_spec.rb +0 -29
- data/spec/conceptql/operators/source_vocabulary_operator_spec.rb +0 -35
- data/spec/conceptql/operators/standard_vocabulary_operator_spec.rb +0 -35
- data/spec/conceptql/operators/started_by_spec.rb +0 -22
- data/spec/conceptql/operators/temporal_operator_spec.rb +0 -51
- data/spec/conceptql/operators/time_window_spec.rb +0 -77
- data/spec/conceptql/operators/union_spec.rb +0 -21
- data/spec/conceptql/operators/visit_occurrence_spec.rb +0 -10
- data/spec/conceptql/query_spec.rb +0 -22
- data/spec/conceptql/tree_spec.rb +0 -50
- data/spec/doubles/stream_for_casting_double.rb +0 -9
- data/spec/doubles/stream_for_occurrence_double.rb +0 -25
- data/spec/doubles/stream_for_temporal_double.rb +0 -6
- data/spec/spec_helper.rb +0 -102
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 5201b0144372677675ffcd8abea73662b8e79544ffacfbbd1a61e39a9923d2da
|
|
4
|
+
data.tar.gz: b81fc6806c7aae55562b073e33b2f6704f36fd6cd57266ffe6b8055df6c6baa0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2a49e99ec315bac889401893e68a83de444ab6ac3307e3ae08897a07f7cd59f9a60e3f4f712cff0d43e4d50394d6ff921900e7c23f06f86fdd6134f691fd1d1f
|
|
7
|
+
data.tar.gz: bf260ffadecac3a5e0dbd8aeb6eb932258fdebcc709363be34704b8f74abde9bd092be0f5710208b4a84d362758087c0c7fb4bf72871f2bafce8fb9496d5fbf9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,30 +1,202 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
|
|
2
3
|
All notable changes to this project will be documented in this file.
|
|
3
4
|
|
|
4
|
-
## Unreleased
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.4.0] - 2026-10-26
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `conceptql render_json STATEMENT_FILE [--counts] [--data-model=...]` prints statements as a
|
|
12
|
+
`conceptql-diagram/v1` render tree for the diagram renderer (`ConceptQL::Diagram`), plus
|
|
13
|
+
`ConceptQL::Diagram::JigsawTree`, a port of the diagram editor's ConceptqlAdapter
|
|
14
|
+
- `ConceptQL::Database#operators(data_model = own)`: each Database's own operator registry, with
|
|
15
|
+
vocabulary operators built from that Database's lexicon and the built-in operators merged over
|
|
16
|
+
them. Every operator lookup goes through it.
|
|
17
|
+
- `ConceptQL::Database.new(db, name_concepts_table: name)` and
|
|
18
|
+
`ConceptQL::Database#create_name_concepts_table`: the display-name joins (drug name and dose
|
|
19
|
+
units, lab units and result concept, admission source and discharge location) read a table of
|
|
20
|
+
only the concept rows that the data references, instead of the whole concept table. The caller
|
|
21
|
+
builds the table once, before its queries run, and drops it afterwards. Off by default.
|
|
22
|
+
- `ConceptQL::Database.new(db, share_utilization: true)` and `ConceptQL::Database#shared_tables`:
|
|
23
|
+
the statements of one Database share each hospitalization, SNF and hospice list (the
|
|
24
|
+
`Utilizable` operators) as a table named `<table_prefix>_util_<hash>`, in `scratch_database`
|
|
25
|
+
when that is set. While the table does not exist, `Query#sql_statements` lists it as an entry
|
|
26
|
+
before the entries that read it, so a caller that runs the entries in order (as CREATE TABLE AS,
|
|
27
|
+
then the query) creates it first. A caller that reads rows through conceptql gets the table
|
|
28
|
+
created at the first read. Building SQL creates no table. Two threads that generate SQL on one
|
|
29
|
+
Database at the same time can both list the same table: this is not handled. The key is the SQL
|
|
30
|
+
of the list, so each window gets its own table, and a list shares only when its lookup ids come
|
|
31
|
+
in one order: use the option with `cache_lookups: true`. The option needs a `table_prefix` in
|
|
32
|
+
`scope_opts`. conceptql never drops these tables: the caller drops `shared_tables`. Off by
|
|
33
|
+
default. On DuckDB, a t_shank prototype of this change cut one export with 40 hospitalization
|
|
34
|
+
criteria from 6.85 to 5.10 minutes. Spark and Postgres timing are not measured.
|
|
35
|
+
- `ConceptQL::Database.new(db, cache_lookups: true)`: each vocabulary lookup reaches the database
|
|
36
|
+
once per distinct argument list for the life of the Database. This includes the empty-vocabulary
|
|
37
|
+
check behind the unknown-code warnings, the Race operator's name lookup, the Provenance
|
|
38
|
+
operator's keyword check, and the checks that the data model's source tables and the concept
|
|
39
|
+
table exist (once per table and database). Off by default.
|
|
40
|
+
- Tag-based releases: pushing a `v*` tag runs `.github/workflows/release.yml`, which publishes the
|
|
41
|
+
gem to rubygems.org through RubyGems trusted publishing (no stored API key). It refuses unless the
|
|
42
|
+
tag equals `v` + `ConceptQL::VERSION`, the commit is on `main`, and the `Run Tests` workflow passed
|
|
43
|
+
on a push to `main` for that commit. Before publishing, it installs the built gem into an empty
|
|
44
|
+
`GEM_HOME` and checks that it loads and ships `config/` and `schemas/`. After publishing, it checks
|
|
45
|
+
that rubygems.org lists the version. See "Releasing" in `CLAUDE.md`.
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
- `ConceptQL.metadata` marks every option that an operator requires as `required`, not only the
|
|
50
|
+
first. `right` on each two-stream operator, `end` on `date_range` and `roles` on
|
|
51
|
+
`provider_filter` were not marked. Marking a subclass's options no longer changes its parent
|
|
52
|
+
class's option hashes
|
|
53
|
+
- `trim_date_end` and `trim_date_start` accept `join_columns` from a JSON statement. The column
|
|
54
|
+
names arrived as strings and became string literals in the SQL, so the query failed
|
|
55
|
+
- `Query#code_list` on a statement with validation errors raises `Query::InvalidStatementError`
|
|
56
|
+
(a `Query::QueryError` that names the errors) instead of NoMethodError or a partial code list
|
|
57
|
+
- `require 'conceptql'` no longer connects to a database. It used to connect to whatever
|
|
58
|
+
Sequelizer was configured for, to register an operator per vocabulary, so it crashed with no
|
|
59
|
+
database configured and, on DuckDB, a second process could not load the library while another
|
|
60
|
+
held the file
|
|
61
|
+
- Bug with PlaceOfServiceFilter and other procedure_cost-based operators (#84)
|
|
62
|
+
- Spark CI downloads its test data from the repo variable `SPARK_TEST_DATA_URL` and checks it
|
|
63
|
+
against `.github/synpuf_test_data.tgz.sha256` before it extracts it. The hardcoded Dropbox link
|
|
64
|
+
it used was dead
|
|
65
|
+
- CLI: `conceptql metadata` raised ArgumentError when it wrote metadata.json, and
|
|
66
|
+
`CONCEPTQL_PARQUET_TEST_DIR` raised NoMethodError (`String#glob`) for every command that
|
|
67
|
+
connects to a database. It now makes the parquet files of each directory in its glob ready.
|
|
68
|
+
`conceptql scope_annotate` ignored the connection options, and `conceptql help` listed
|
|
69
|
+
`simple_visit` as `extract_metadata`
|
|
70
|
+
- A vocabulary statement with `*` no longer warns about the format of its other codes. The check
|
|
71
|
+
for `*` never ran, because `Vocabulary#select_all?` is private
|
|
72
|
+
- `occurrence` with a blank or whitespace-only `at_least` or `within` (as an editor can send for
|
|
73
|
+
an empty field) gives the same rows as without the option. It used to take the timed query,
|
|
74
|
+
which returns other rows
|
|
75
|
+
- `match` without `only_columns` compared every column with `=`, so two NULL values never matched
|
|
76
|
+
and a stream matched with itself kept nothing. It now compares the key columns (`person_id`,
|
|
77
|
+
`criterion_id`, `criterion_table`, `criterion_domain`, `start_date`, `uuid`, `window_id`) with
|
|
78
|
+
`=` and the other columns NULL-safe (`IS NOT DISTINCT FROM`, `<=>` on Spark). `match` also
|
|
79
|
+
ignored `join_columns`. It now compares only the person and the listed columns, as the other
|
|
80
|
+
two-stream operators do, and rejects `join_columns` next to `only_columns` or `except_columns`
|
|
81
|
+
- An option that lists columns (`only_columns`, `except_columns` and `join_columns` on `match`,
|
|
82
|
+
and `join_columns` on the temporal operators and `trim_date_start`/`trim_date_end`) also
|
|
83
|
+
accepts a comma-separated string, such as `"uuid, start_date"`. A blank string is an unset
|
|
84
|
+
option. Before, a string raised NoMethodError
|
|
85
|
+
- `match` with `invert_match` set to the string `"false"` (in any case), or to an empty string,
|
|
86
|
+
no longer inverts the match. Before, any value other than `false` and `nil` inverted it
|
|
87
|
+
|
|
88
|
+
### Changed
|
|
89
|
+
|
|
90
|
+
- Set RUNTIME_FILTER_MODE only if asked
|
|
91
|
+
- `ConceptQL::Operators.operators` is removed. Built-in operators are in
|
|
92
|
+
`ConceptQL::Operators.static_operators`; vocabulary operators come from each Database
|
|
93
|
+
(`ConceptQL::Database#operators`). `ConceptQL::Database.lexicon` (class method) is removed;
|
|
94
|
+
use `Database#lexicon`
|
|
95
|
+
- The sequelizer dependency now admits 0.4.x (`>= 0.3.0, < 0.5`). The previous `< 0.4` bound
|
|
96
|
+
rejected the released sequelizer 0.4.0. Gemfile.lock now resolves sequelizer 0.4.0.
|
|
97
|
+
- Development dependencies are updated to their newest releases (2026-10-26), including the
|
|
98
|
+
duckdb gem 2.0.0.1, pg 1.7.0, rubocop 1.92.1, and the newest sequelizer, sequel-duckdb 0.4.1
|
|
99
|
+
and sequel-hexspace 2.1.0. The test suites pass on Postgres and DuckDB. `just test-duckdb`
|
|
100
|
+
pins the libduckdb library to 1.5.6 (override with `LIBDUCKDB_VERSION`). GitHub CI runs the
|
|
101
|
+
DuckDB suite against libduckdb 1.5.6 and 2.0.0
|
|
102
|
+
- `just release-check` fails when a dependency is behind its newest allowed release. The release
|
|
103
|
+
procedure runs it first
|
|
104
|
+
- Docker test runs use the ghcr `test_data.jumper` image pinned by digest, the same one as CI, and
|
|
105
|
+
run as the calling user, so they leave no root-owned files. The runner image drops Chrome's libraries
|
|
106
|
+
- On DuckDB, operator CTEs are now `AS MATERIALIZED`, as on Postgres
|
|
107
|
+
(`ConceptQL::Rdbms::DuckDB#supports_materialized?` is true). DuckDB accepts the keyword since
|
|
108
|
+
v0.8.0. `just test-duckdb` passes against libduckdb 1.5.6
|
|
109
|
+
- The provenance and utilization operators (`provenance`, `one_in_two_out`, `hospitalization`,
|
|
110
|
+
`hospice`, `snf`) are now GDM-only. On omopv4_plus they fail validation as an invalid operator
|
|
111
|
+
instead of raising NoMethodError, and they are not in its metadata
|
|
112
|
+
- Code format checks ("improperly formatted code") use the vocabulary_formats validator patterns.
|
|
113
|
+
CPT4, CPT4_HCPCS, HCPCS, ICD10, ICD10CM and ICD9Proc changed: CPT4 now accepts M0201, HCPCS
|
|
114
|
+
needs a leading letter, and the ICD patterns need a real dot. ATC, DRG, ICD03_Morphology,
|
|
115
|
+
ICD03_Topography, NDC, RxNorm and SNOMED are checked for the first time. ICD10PCS accepts only 7-character billable codes
|
|
116
|
+
with a real section character first (row ICD10PCS.BILLABLE), so Z561123 is now improperly
|
|
117
|
+
formatted
|
|
118
|
+
- A `cpt_or_hcpcs` code gets a warning when every vocabulary rejects it, for any reason. It is
|
|
119
|
+
"improperly formatted" only when every vocabulary says so, and otherwise "unknown"
|
|
120
|
+
- `first` and `last` reject the `at_least` and `within` options with the validation error
|
|
121
|
+
"unsupported option". With either option they returned every upstream row instead of one row
|
|
122
|
+
per person. The two options are no longer in the `first` and `last` metadata. A blank value
|
|
123
|
+
counts as not set. `occurrence` keeps both options
|
|
124
|
+
|
|
125
|
+
### Removed
|
|
126
|
+
|
|
127
|
+
- Presto support (breaking). `ConceptQL::Rdbms::Presto` and `database_type: :presto` are gone, so
|
|
128
|
+
`ConceptQL::Rdbms.generate(:presto)` raises "Unknown database_type". Its `primary_concepts`
|
|
129
|
+
emitted `DISTINCT ON`, which Presto does not support. The Rakefile's Presto scaffolding
|
|
130
|
+
(`test_script` and `driftr_script` namespaces, `convert`, `prestofy`, the Presto `cdb`) is
|
|
131
|
+
removed too. The default rake task is now `test` instead of `test_omopv4_plus`
|
|
132
|
+
- The `conceptql selection_operators` command, which had raised NameError since 2016.
|
|
133
|
+
- The unused query optimizer (breaking for a caller of these methods). `Query#optimized`,
|
|
134
|
+
`Operator#optimized`, `Operator#unionable?`, `Operator#dup_values` and the
|
|
135
|
+
`ConceptQL::Vocabularies::Behaviors::Sourcish` module are gone. Nothing in conceptql called
|
|
136
|
+
`optimized`, so its union merging never ran, and the generated SQL does not change.
|
|
137
|
+
- The `pass_thru` operator name, which never worked. `PassThru` had no query method, so a
|
|
138
|
+
statement that used it failed to generate SQL. A `pass_thru` statement is now an invalid
|
|
139
|
+
operator. The `PassThru` class stays as the base class of union, count, sum, numeric, dedup,
|
|
140
|
+
episode, time_window and co_reported.
|
|
141
|
+
- `ConceptQL::Vocabularies::Entry#is_source?`, `Entry#is_standard?` and `Entry::STANDARD_VOCABS`
|
|
142
|
+
(breaking for a caller of these). Their only use was the `Sourcish` include removed with the
|
|
143
|
+
query optimizer. Neither t_shank nor jigsaw-diagram-editor calls them.
|
|
144
|
+
- The `only_columns`, `except_columns` and `query_columns` options of `dedup` (breaking). No
|
|
145
|
+
statement could use them: with any column left out, the query failed, and from JSON they did
|
|
146
|
+
nothing or broke the SQL. Like any option an operator does not read, they are now ignored, and
|
|
147
|
+
dedup groups by every column.
|
|
148
|
+
|
|
149
|
+
## [0.3.0] - 2016-11-08
|
|
150
|
+
|
|
151
|
+
### Added
|
|
152
|
+
|
|
153
|
+
- New operators
|
|
154
|
+
- PlaceOfServiceFilter
|
|
155
|
+
- Provenance
|
|
156
|
+
- ProviderFilter
|
|
157
|
+
- CoReported
|
|
158
|
+
- Support for :impala_mem_limit option
|
|
159
|
+
- Initial support for dynamic columns
|
|
160
|
+
- Additional columns for observation domains and drug domains
|
|
161
|
+
- Support for :within, :occurrences, :at_least
|
|
162
|
+
|
|
163
|
+
### Changed
|
|
164
|
+
|
|
165
|
+
- Format of this [CHANGELOG](http://keepachangelog.com/en/0.3.0/)
|
|
166
|
+
- Read searches Condition, Procedure, Drug, Observation
|
|
167
|
+
- Rewrote OneInTwoOut to produce faster queries
|
|
168
|
+
- Except operator uses different strategy under Impala
|
|
169
|
+
|
|
170
|
+
### Fixed
|
|
171
|
+
|
|
172
|
+
- Fixed date casting and other issues for Impala compatibility.
|
|
173
|
+
- Fixed ConditionType to accept concept_ids
|
|
174
|
+
|
|
175
|
+
## [0.2.0] - 2015-12-11
|
|
5
176
|
|
|
6
177
|
### Added
|
|
178
|
+
|
|
7
179
|
- Optimized After/Before nodes when multi-person results are in the right stream.
|
|
8
180
|
- Set end_date as coalesce(end_date, start_date) to make range if end_date missing.
|
|
9
181
|
- Nodes
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
182
|
+
- AnyOverlap
|
|
183
|
+
- Contains
|
|
184
|
+
- Filter
|
|
185
|
+
- Ndc
|
|
186
|
+
- ObservationPeriod
|
|
187
|
+
- OneInTwoOut
|
|
188
|
+
- OverlappedBy
|
|
189
|
+
- Overlaps
|
|
190
|
+
- TrimDateEnd
|
|
191
|
+
- TrimDateStart
|
|
20
192
|
- Nodes for CPRD
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
193
|
+
- Medcode
|
|
194
|
+
- MedcodeProcedure
|
|
195
|
+
- ObservationByEnttype
|
|
196
|
+
- Prodcode
|
|
25
197
|
- Nodes for SEER
|
|
26
|
-
|
|
27
|
-
|
|
198
|
+
- FromSeerVisits
|
|
199
|
+
- ToSeerVisits
|
|
28
200
|
- Ability to limit results to a set of patients by setting Tree#person_ids
|
|
29
201
|
- "units_source_value" and "source_value" columns in results
|
|
30
202
|
- TimeWindow supports date literals
|
|
@@ -32,197 +204,134 @@ All notable changes to this project will be documented in this file.
|
|
|
32
204
|
- Nodifier#to_metadata
|
|
33
205
|
|
|
34
206
|
### Changed
|
|
207
|
+
|
|
35
208
|
- Except now allows :ignore_date option
|
|
36
|
-
|
|
209
|
+
- Comparison is only done on criterion_id/type
|
|
37
210
|
- DateRange START/END use observation_period instead of visit_occurrence
|
|
38
211
|
- Operator#columns value_as_numeric => value_as_number
|
|
39
212
|
- Syntax is now more "lispy"
|
|
40
213
|
- Recall now uses any labeled operator as if that operator was fed to "Define" operator
|
|
41
214
|
- Nodes now called Operators
|
|
42
215
|
|
|
43
|
-
### Deprecated
|
|
44
|
-
- Nothing.
|
|
45
|
-
|
|
46
216
|
### Removed
|
|
217
|
+
|
|
47
218
|
- Let/Define operators
|
|
48
219
|
|
|
49
220
|
### Fixed
|
|
221
|
+
|
|
50
222
|
- Many broken specs.
|
|
51
223
|
- Union calls #from_self on incoming streams to avoid column issues
|
|
52
224
|
- Concept node now works again
|
|
53
225
|
- Define ensures tables are built
|
|
54
226
|
|
|
55
|
-
|
|
56
|
-
## 0.1.1 - 2014-09-18
|
|
57
|
-
|
|
58
|
-
### Added
|
|
59
|
-
- Nothing.
|
|
60
|
-
|
|
61
|
-
### Deprecated
|
|
62
|
-
- Nothing.
|
|
63
|
-
|
|
64
|
-
### Removed
|
|
65
|
-
- Nothing.
|
|
227
|
+
## [0.1.1] - 2014-09-18
|
|
66
228
|
|
|
67
229
|
### Fixed
|
|
68
|
-
- Calling Query#sql no longer creates a bunch of temporary tables.
|
|
69
230
|
|
|
231
|
+
- Calling Query#sql no longer creates a bunch of temporary tables.
|
|
70
232
|
|
|
71
|
-
## 0.1.0 - 2014-09-04
|
|
233
|
+
## [0.1.0] - 2014-09-04
|
|
72
234
|
|
|
73
235
|
### Added
|
|
236
|
+
|
|
74
237
|
- Support for numeric, string, and concept_ids returned in results.
|
|
75
238
|
- Many updates to the ConceptQL Specification document.
|
|
76
239
|
- Added doc/implementation_notes.md to capture thoughts and bad ideas.
|
|
77
240
|
|
|
78
|
-
### Deprecated
|
|
79
|
-
- Nothing.
|
|
80
|
-
|
|
81
|
-
### Removed
|
|
82
|
-
- Nothing.
|
|
83
|
-
|
|
84
241
|
### Fixed
|
|
242
|
+
|
|
85
243
|
- "Fake" graphs are now drawn correctly.
|
|
86
244
|
- bin/conceptql doesn't bomb out drawing "fake" graphs
|
|
87
245
|
|
|
88
|
-
|
|
89
|
-
## 0.0.9 - 2014-09-03
|
|
246
|
+
## [0.0.9] - 2014-09-03
|
|
90
247
|
|
|
91
248
|
### Added
|
|
92
|
-
- Support for MSSQL (SQL Server).
|
|
93
|
-
|
|
94
|
-
### Deprecated
|
|
95
|
-
- Nothing.
|
|
96
249
|
|
|
97
|
-
|
|
98
|
-
- Nothing.
|
|
250
|
+
- Support for MSSQL (SQL Server).
|
|
99
251
|
|
|
100
252
|
### Fixed
|
|
101
|
-
- Removed debug output from Node#namify
|
|
102
253
|
|
|
254
|
+
- Removed debug output from Node#namify
|
|
103
255
|
|
|
104
|
-
## 0.0.8 - 2014-08-28
|
|
256
|
+
## [0.0.8] - 2014-08-28
|
|
105
257
|
|
|
106
258
|
### Added
|
|
107
|
-
- Support for Oracle.
|
|
108
259
|
|
|
109
|
-
|
|
110
|
-
- Nothing.
|
|
111
|
-
|
|
112
|
-
### Removed
|
|
113
|
-
- Nothing.
|
|
260
|
+
- Support for Oracle.
|
|
114
261
|
|
|
115
262
|
### Fixed
|
|
263
|
+
|
|
116
264
|
- DateAdjuster/TimeWindow use Sequel's date_arithmetic extension to produce database agnostic date manipulation.
|
|
117
265
|
- Breakage from Node#tree in GraphNodifier.
|
|
118
266
|
- All tests are back to passing.
|
|
119
267
|
- Changed from SHA1 to CRC32 hash since Oracle can't handle table names longer than 30 characters.
|
|
120
268
|
|
|
121
|
-
|
|
122
|
-
## 0.0.6 - 2014-08-23
|
|
269
|
+
## [0.0.6] - 2014-08-23
|
|
123
270
|
|
|
124
271
|
### Added
|
|
272
|
+
|
|
125
273
|
- Support for Oracle
|
|
126
274
|
- Tree#defined to pass type information between Define and Recall.
|
|
127
275
|
- Node#sql to produce SQL for each node.
|
|
128
276
|
- Graph includes row count on each edge in the diagram.
|
|
129
277
|
|
|
130
|
-
### Deprecated
|
|
131
|
-
- Nothing.
|
|
132
|
-
|
|
133
|
-
### Removed
|
|
134
|
-
- Nothing.
|
|
135
|
-
|
|
136
278
|
### Fixed
|
|
279
|
+
|
|
137
280
|
- Bug in CastingNode that generate SQL returning multiple columns in a subquery.
|
|
138
281
|
- Made ruby-graphviz a dependency so calling programs don't bomb out.
|
|
139
282
|
- Define now passes rows on through like any other node!
|
|
140
283
|
- DateAdjuster/TimeWindow use Sequel's date_arithmetic extension to produce database agnostic date manipulation.
|
|
141
284
|
- All tests are back to passing.
|
|
142
285
|
|
|
143
|
-
|
|
144
|
-
## 0.0.5 - 2014-08-19
|
|
145
|
-
|
|
146
|
-
### Added
|
|
147
|
-
- Nothing.
|
|
148
|
-
|
|
149
|
-
### Deprecated
|
|
150
|
-
- Nothing.
|
|
151
|
-
|
|
152
|
-
### Removed
|
|
153
|
-
- Nothing.
|
|
286
|
+
## [0.0.5] - 2014-08-19
|
|
154
287
|
|
|
155
288
|
### Fixed
|
|
156
|
-
- Bug in GraphNodifier not displaying types for `recall` nodes.
|
|
157
289
|
|
|
290
|
+
- Bug in GraphNodifier not displaying types for `recall` nodes.
|
|
158
291
|
|
|
159
|
-
## 0.0.4 - 2014-08-19
|
|
292
|
+
## [0.0.4] - 2014-08-19
|
|
160
293
|
|
|
161
294
|
### Added
|
|
295
|
+
|
|
162
296
|
- Support for 5 instead of 13 column internal representation of results.
|
|
163
297
|
- `define` node, used to create "variables" in ConceptQL.
|
|
164
298
|
- `recall` node, used to pull results from "variables" in ConceptQL.
|
|
165
299
|
|
|
166
|
-
### Deprecated
|
|
167
|
-
- Nothing.
|
|
168
|
-
|
|
169
300
|
### Removed
|
|
301
|
+
|
|
170
302
|
- Support for 13 column results.
|
|
171
303
|
- Dependency on a set of views to run SQL queries.
|
|
172
304
|
|
|
173
305
|
### Fixed
|
|
174
|
-
- Bug where `place_of_service_code` wasn't limited to vocabulary_id 14
|
|
175
306
|
|
|
307
|
+
- Bug where `place_of_service_code` wasn't limited to vocabulary_id 14
|
|
176
308
|
|
|
177
|
-
## 0.0.3 - 2014-08-12
|
|
309
|
+
## [0.0.3] - 2014-08-12
|
|
178
310
|
|
|
179
311
|
### Added
|
|
312
|
+
|
|
180
313
|
- FakeGrapher class to make it easier to generate diagrams with experimental nodes
|
|
181
314
|
- fake_graph command has returned to the `conceptql` program
|
|
182
315
|
- GraphNodifier now supports:
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
### Deprecated
|
|
188
|
-
- Nothing.
|
|
189
|
-
|
|
190
|
-
### Removed
|
|
191
|
-
- Nothing.
|
|
316
|
+
- condition_type as condition_occurrence
|
|
317
|
+
- drg as procedure_occurrence
|
|
318
|
+
- vsac as misc
|
|
192
319
|
|
|
193
320
|
### Fixed
|
|
194
|
-
- Tree now runs #deep_symbolize_keys on incoming statements
|
|
195
|
-
|
|
196
321
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
### Added
|
|
200
|
-
- Nothing.
|
|
322
|
+
- Tree now runs #deep_symbolize_keys on incoming statements
|
|
201
323
|
|
|
202
|
-
|
|
203
|
-
- Nothing.
|
|
324
|
+
## [0.0.2] - 2014-07-11
|
|
204
325
|
|
|
205
326
|
### Removed
|
|
206
|
-
- Several commands from `conceptql` program
|
|
207
|
-
- fake_graph
|
|
208
|
-
- show_db_graph
|
|
209
|
-
- show_and_tell_db
|
|
210
|
-
|
|
211
|
-
### Fixed
|
|
212
|
-
- Nothing.
|
|
213
327
|
|
|
328
|
+
- Several commands from `conceptql` program
|
|
329
|
+
- fake_graph
|
|
330
|
+
- show_db_graph
|
|
331
|
+
- show_and_tell_db
|
|
214
332
|
|
|
215
|
-
## 0.0.1 - 2014-07-11
|
|
333
|
+
## [0.0.1] - 2014-07-11
|
|
216
334
|
|
|
217
335
|
### Added
|
|
218
|
-
- This project.
|
|
219
|
-
|
|
220
|
-
### Deprecated
|
|
221
|
-
- Nothing.
|
|
222
|
-
|
|
223
|
-
### Removed
|
|
224
|
-
- Nothing.
|
|
225
|
-
|
|
226
|
-
### Fixed
|
|
227
|
-
- Nothing.
|
|
228
336
|
|
|
337
|
+
- This project.
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-2026 Outcomes Insights, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
# ConceptQL
|
|
1
|
+
# ConceptQL [](https://github.com/outcomesinsights/conceptql/actions/workflows/run_tests.yml)
|
|
2
2
|
|
|
3
3
|
ConceptQL (pronounced concept-Q-L) is a high-level language that allows researchers to unambiguously define their research algorithms.
|
|
4
4
|
|
|
5
|
-
This gem interprets the ConceptQL language and translates it into SQL queries compatible with
|
|
5
|
+
This gem interprets the ConceptQL language and translates it into SQL queries compatible with [Generalized Data Model (GDM)](https://github.com/outcomesinsights/generalized_data_model#contexts)-structured data. The ConceptQL "language" is a set of nested arrays and hashes representing search criteria with some set operations and temporal operations to glue those criteria together.
|
|
6
|
+
|
|
7
|
+
## Further Reading
|
|
8
|
+
|
|
9
|
+
If you're interested in reading up on ConceptQL, a the specifications document is [available in markdown format](https://github.com/outcomesinsights/conceptql_spec).
|
|
6
10
|
|
|
7
11
|
## Motivation for ConceptQL
|
|
8
|
-
|
|
12
|
+
|
|
13
|
+
Outcomes Insights has built a vast library of research algorithms and applied those algorithms to large databases of claims data. Early into building the library, we realized we had to overcome two major issues:
|
|
9
14
|
|
|
10
15
|
1. Methods sections of research papers commonly use natural language to specify the criteria used to build cohorts from a claims database.
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
- Algorithms defined in natural language are often imprecise, open to multiple interpretations, and generally difficult to reproduce.
|
|
17
|
+
- Researchers could benefit from a language that removes the ambiguity of natural language while increasing the reproducibility of their research algorithms.
|
|
13
18
|
2. Querying against claims databases is often difficult.
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
- Hand-coding algorithms to extract cohorts from datasets is time-consuming, error-prone, and opaque.
|
|
20
|
+
- Researchers could benefit from a language that allows algorithms to be defined at a high-level and then gets translated into the appropriate queries against a database.
|
|
16
21
|
|
|
17
22
|
We developed ConceptQL to address these two issues.
|
|
18
23
|
|
|
19
|
-
We
|
|
24
|
+
We have written a tool that can read research algorithms defined in ConceptQL. The tool can create a diagram for the algorithm which makes it easy to visualize and understand. The tool can also translate the algorithm into a SQL query which runs against data structured in the [Generalized Data Model (GDM)](https://github.com/outcomesinsights/generalized_data_model). The purpose of the GDM is to standardize the format and content of observational data, so standardized applications, tools and methods can be applied to them.
|
|
20
25
|
|
|
21
26
|
For instance, using ConceptQL we can take a statement that looks like this:
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
|
|
28
|
+
```JSON
|
|
29
|
+
[ "icd9", "412" ]
|
|
24
30
|
```
|
|
25
31
|
|
|
26
32
|
And generate a diagram that looks like this:
|
|
@@ -28,88 +34,34 @@ And generate a diagram that looks like this:
|
|
|
28
34
|

|
|
29
35
|
|
|
30
36
|
And generate SQL that looks like this:
|
|
37
|
+
|
|
31
38
|
```SQL
|
|
32
39
|
SELECT *
|
|
33
|
-
FROM
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
FROM gdm_data.clinical_codes AS cc
|
|
41
|
+
WHERE cc.clinical_code_concept_id IN (
|
|
42
|
+
SELECT id
|
|
43
|
+
FROM concepts
|
|
44
|
+
WHERE vocabulary_id = 'ICD9CM'
|
|
45
|
+
AND concept_code = '412'
|
|
46
|
+
)
|
|
38
47
|
```
|
|
39
48
|
|
|
40
|
-
As stated above, one of the goals of
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## Further Reading
|
|
44
|
-
|
|
45
|
-
If you're interested in reading more about ConceptQL, a rought draft of the specifications document is [available as a PDF](https://github.com/outcomesinsights/conceptql/blob/master/doc/ConceptQL%20Specification%20(alpha).pdf?raw=true) in this repository.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
## Try Before You Buy
|
|
49
|
-
|
|
50
|
-
If you'd like to interact with ConceptQL a bit before deciding to dive in, head over to the [ConceptQL Sandbox](http://sandbox.cohortjigsaw.com) for an online demonstration of the language and its features.
|
|
51
|
-
|
|
49
|
+
As stated above, one of the goals of ConceptQL is to make it easy to assemble fairly complex queries without having to roll up our sleeves and write raw SQL. We believe ConceptQL will help researchers define, hone, and share their research algorithms.
|
|
52
50
|
|
|
53
51
|
## Requirements
|
|
54
52
|
|
|
55
|
-
ConceptQL
|
|
56
|
-
|
|
57
|
-
Specifically, ConceptQL needs:
|
|
58
|
-
|
|
59
|
-
- Ruby 2.0+
|
|
60
|
-
- PostgresQL 9.3+
|
|
61
|
-
- Ruby's [Bundler](http://bundler.io/) gem
|
|
62
|
-
- A PostgreSQL database with
|
|
63
|
-
- OMOP CDM-structured data stored in the public schema
|
|
64
|
-
- The OMOP Vocabularies stored in a schema named 'vocabulary'
|
|
65
|
-
- You may want to use [loadmop](http://github.com/outcomesinsights/loadmop) to quickly create the OMOP vocabulary schema
|
|
66
|
-
|
|
67
|
-
## Installation
|
|
68
|
-
|
|
69
|
-
Add this line to your application's Gemfile:
|
|
53
|
+
ConceptQL works best with data stored in the [GDM](https://github.com/outcomesinsights/generalized_data_model#contexts) using [PostgreSQL](http://www.postgresql.org/) as the RDBMS engine. It has been tested under [Ubuntu Linux](http://www.ubuntu.com/). The interpreter is written in Ruby and theoretically should be platform independent, but your mileage may vary.
|
|
70
54
|
|
|
71
|
-
|
|
55
|
+
Specifically, ConceptQL is tested against:
|
|
72
56
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
$ bundle
|
|
76
|
-
|
|
77
|
-
Or install it yourself as:
|
|
78
|
-
|
|
79
|
-
$ gem install conceptql
|
|
80
|
-
|
|
81
|
-
## Usage
|
|
82
|
-
|
|
83
|
-
The easiest way to try out ConceptQL locally is to use the [conceptql-dev-box](http://github.com/outcomesinsights/conceptql-dev-box)
|
|
84
|
-
|
|
85
|
-
ConceptQL comes with a [Thor](http://whatisthor.com/)-based command-line program: `conceptql`
|
|
86
|
-
|
|
87
|
-
`conceptql` allows you to translate a ConceptQL statement into a SQL statement or a graph depicting the ConceptQL statement.
|
|
88
|
-
|
|
89
|
-
`conceptql` will print a basic help menu for each command if you run `conceptql`
|
|
90
|
-
|
|
91
|
-
See [conceptql-dev-box](http://github.com/outcomesinsights/conceptql-dev-box) for more examples on how to play with ConceptQL
|
|
92
|
-
|
|
93
|
-
## Writing Your Own ConceptQL
|
|
94
|
-
|
|
95
|
-
Right now, the only way to create a new ConceptQL statement is to write it out by hand in either Ruby, JSON, or YAML.
|
|
96
|
-
|
|
97
|
-
If you're feeling bold, feel free to try your hand at authoring a ConceptQL statement.
|
|
98
|
-
|
|
99
|
-
You might want to just take an existing statement from the statements in [test_conceptql](https://github.com/outcomesinsights/test_conceptql) and modify that.
|
|
100
|
-
|
|
101
|
-
## Contributing
|
|
102
|
-
|
|
103
|
-
1. Fork it ( http://github.com/outcomesinsights/conceptql/fork )
|
|
104
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
105
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
106
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
|
107
|
-
5. Create new Pull Request
|
|
108
|
-
|
|
109
|
-
Or, use the [conceptql-dev-box](https://github.com/outcomesinsights/conceptql-dev-box) to get yourself setup and hack on ConceptQL that way.
|
|
57
|
+
- Ruby 3.2
|
|
58
|
+
- PostgresQL 14
|
|
110
59
|
|
|
111
60
|
## Thanks
|
|
61
|
+
|
|
112
62
|
- [Outcomes Insights, Inc.](http://outins.com)
|
|
113
|
-
|
|
114
|
-
- [
|
|
115
|
-
|
|
63
|
+
- Many thanks for allowing me to release a portion of my work as Open Source Software!
|
|
64
|
+
- [OHDSI](http://www.ohdsi.org/)
|
|
65
|
+
- Thank you for providing the original inspiration for ConceptQL.
|
|
66
|
+
- [Jeremy Evans](http://code.jeremyevans.net/)
|
|
67
|
+
- Thank you for the great contributions, ideas, and commits.
|
data/bin/conceptql
CHANGED
data/bin/conceptql_utils
ADDED