Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
First commit of clojure terminology service.
  • Loading branch information
wardle committed Sep 6, 2020
0 parents commit 3efb8fc
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.cpcache/
.idea/
1 change: 1 addition & 0 deletions .nrepl-port
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
50469
1 change: 1 addition & 0 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
36 changes: 36 additions & 0 deletions src/com/eldrix/hermes/import.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
(ns com.eldrix.hermes.import
"Provides import functionality for processing directories of files")

(def ^:private snomed-files
[#"sct2_Concept_Snapshot_\S+_\S+.txt"
#"sct2_Description_Snapshot-\S+_\S+.txt"])

(defn is-snomed-file? [filename]
(not-empty (filter #(re-find % filename) snomed-files)))

(defn snomed-file-seq
"A tree sequence for SNOMED CT data files"
[dir]
(->> dir
clojure.java.io/file
file-seq
(filter #(.isFile %))
(filter #(is-snomed-file? (.getName %)))))

(defn -main [x]
(let [ff (snomed-file-seq x)]
(println "Found" (count ff) "files in" x)))



(comment
(require '[clojure.reflect :as reflect])
(clojure.pprint/pprint (reflect/reflect (java.util.Date.)))
(def f (first (file-seq (clojure.java.io/file "."))))
(reflect/reflect f)
(def patterns (vals snomed-files))


(is-snomed-file? "sct2_Concept_Snapshot_INT_20190731.txt")
(re-find (:snomed/concept snomed-files) "sct2_Concept_Snapshot_INT_20190731.txt")
)

0 comments on commit 3efb8fc

Please sign in to comment.