Skip to content

Commit

Permalink
Fix internal name of do-query-for-concept-ids
Browse files Browse the repository at this point in the history
  • Loading branch information
wardle committed Mar 16, 2023
1 parent a1b2c6b commit 6e73236
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/com/eldrix/hermes/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@
[^Svc svc concept-ids ^String ecl]
(let [q1 (search/q-concept-ids concept-ids)
q2 (ecl/parse svc ecl)]
(search/do-query-for-concepts (.-searcher svc) (search/q-and [q1 q2]))))
(search/do-query-for-concept-ids (.-searcher svc) (search/q-and [q1 q2]))))

(s/fdef ecl-contains?
:args (s/cat :svc ::svc
Expand All @@ -500,7 +500,7 @@
[^Svc svc ^String ecl]
(let [q1 (ecl/parse svc ecl)
q2 (search/q-not q1 (search/q-fsn))
base-concept-ids (search/do-query-for-concepts (.-searcher svc) q2)
base-concept-ids (search/do-query-for-concept-ids (.-searcher svc) q2)
historic-concept-ids (->> base-concept-ids
(mapcat #(vals (source-historical-associations svc %)))
(apply set/union))
Expand Down Expand Up @@ -976,8 +976,8 @@
(def q2 (search/q-and [ecl-q (#'search/make-search-query {:inactive-concepts? false})]))
q1
q2
(count (#'search/do-query-for-concepts (.-searcher svc) q1))
(count (#'search/do-query-for-concepts (.-searcher svc) q2))
(count (#'search/do-query-for-concept-ids (.-searcher svc) q1))
(count (#'search/do-query-for-concepts-ids (.-searcher svc) q2))
q2

(search svc {:constraint "< 404684003 |Clinical finding| :\n [0..0] { [2..*] 363698007 |Finding site| = < 91723000 |Anatomical structure| }"})
Expand Down
2 changes: 1 addition & 1 deletion src/com/eldrix/hermes/impl/ecl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
(defn- realise-concept-ids
"Realise a query as a set of concept identifiers."
[{:keys [searcher]} ^Query q]
(search/do-query-for-concepts searcher q))
(search/do-query-for-concept-ids searcher q))

(defn- parse-conjunction-expression-constraint
"conjunctionExpressionConstraint = subExpressionConstraint 1*(ws conjunction ws subExpressionConstraint)"
Expand Down
6 changes: 3 additions & 3 deletions src/com/eldrix/hermes/impl/search.clj
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ items."
(->> (seq (.-scoreDocs (.search searcher q (int max-hits))))
(map #(doc->result (.document stored-fields (.-doc ^ScoreDoc %))))))))

(defn do-query-for-concepts
(defn do-query-for-concept-ids
"Perform the query, returning results as a set of concept identifiers"
([^IndexSearcher searcher ^Query query]
(let [stored-fields (.storedFields searcher)]
Expand Down Expand Up @@ -584,7 +584,7 @@ items."

(defn test-query [store ^IndexSearcher searcher ^Query q ^long max-hits]
(when q
(->> (do-query-for-concepts searcher q max-hits)
(->> (do-query-for-concept-ids searcher q max-hits)
(map (partial store/get-fully-specified-name store))
(map #(select-keys % [:conceptId :term])))))

Expand All @@ -597,7 +597,7 @@ items."
(count (do-search searcher {:properties {snomed/IsA 24700007} :inactive-concepts? true}))
(do-query-for-results searcher (make-search-query {:properties {snomed/IsA 24700007} :inactive-concepts? true}))
(q-or [(make-search-query {:inactive-concepts? true})])
(do-query-for-concepts searcher (q-or [(make-search-query {:inactive-concepts? true})]))
(do-query-for-concept-ids searcher (q-or [(make-search-query {:inactive-concepts? true})]))
(.clauses (make-search-query {:inactive-concepts? true}))
(do-search searcher {:s "bendroflumethiatide" :fuzzy 3})
(do-query-for-results searcher (q-attribute-count snomed/HasActiveIngredient 0 0)))
2 changes: 1 addition & 1 deletion test/com/eldrix/hermes/search_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
(deftest ^:live search
(with-open [svc (hermes/open "snomed.db")]
(let [q (search/q-descendantOrSelfOf 24700007)]
(is (= (search/do-query-for-concepts (:searcher svc) q)
(is (= (search/do-query-for-concept-ids (:searcher svc) q)
(into #{} (map :conceptId) (search/do-query-for-results (:searcher svc) q)))))))

0 comments on commit 6e73236

Please sign in to comment.