Skip to content

Commit

Permalink
Remove Module structure-definition
Browse files Browse the repository at this point in the history
The FHIR structure definitions hold by this module and used by the
module rest-api did become redundant, because we use the same FHIR
structure definitions in the module fhir-structure. Having everything
duplicated caused a 3 MB bigger JAR file and increased startup time.
  • Loading branch information
alexanderkiel committed Feb 10, 2022
1 parent 71b93d3 commit 5978fec
Show file tree
Hide file tree
Showing 63 changed files with 2,708 additions and 419,577 deletions.
4 changes: 0 additions & 4 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
blaze/server
{:local/root "modules/server"}

blaze/structure-definition
{:local/root "modules/structure-definition"}

blaze/thread-pool-executor-collector
{:local/root "modules/thread-pool-executor-collector"}

Expand Down Expand Up @@ -124,7 +121,6 @@
"-d" "modules/search-param-registry"
"-d" "modules/server"
"-d" "modules/spec"
"-d" "modules/structure-definition"
"-d" "modules/terminology-service"
"-d" "modules/test-util"
"-d" "modules/thread-pool-executor-collector"]}}}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[blaze.fhir.hash-spec]
[blaze.fhir.spec :as fhir-spec]
[blaze.log]
[blaze.test-util :refer [given-failed-future given-thrown with-system]]
[blaze.test-util :as tu :refer [given-failed-future given-thrown with-system]]
[clojure.spec.alpha :as s]
[clojure.spec.test.alpha :as st]
[clojure.test :as test :refer [deftest is testing]]
Expand All @@ -35,6 +35,7 @@


(st/instrument)
(tu/init-fhir-specs)
(log/set-level! :trace)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[blaze.fhir.hash-spec]
[blaze.fhir.spec :as fhir-spec]
[blaze.metrics.spec]
[blaze.test-util :refer [given-failed-future given-thrown with-system]]
[blaze.test-util :as tu :refer [given-failed-future given-thrown with-system]]
[clojure.spec.alpha :as s]
[clojure.spec.test.alpha :as st]
[clojure.test :as test :refer [deftest is testing]]
Expand All @@ -28,6 +28,7 @@


(st/instrument)
(tu/init-fhir-specs)
(log/set-level! :trace)


Expand Down
6 changes: 5 additions & 1 deletion modules/db-stub/src/blaze/db/api_stub.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
[blaze.db.tx-log :as tx-log]
[blaze.db.tx-log-spec]
[blaze.db.tx-log.local]
[blaze.fhir.structure-definition-repo]
[blaze.test-util :refer [with-system]]
[integrant.core :as ig]
[java-time :as time]))
Expand Down Expand Up @@ -69,7 +70,10 @@
{:column-families {}}
::rs-kv/executor {}

:blaze.db/search-param-registry {}})
:blaze.db/search-param-registry
{:structure-definition-repo (ig/ref :blaze.fhir/structure-definition-repo)}

:blaze.fhir/structure-definition-repo {}})


(def mem-node-system
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[blaze.db.tx-log.kafka.util :as u]
[blaze.fhir.hash :as hash]
[blaze.fhir.hash-spec]
[blaze.test-util :as tu]
[clojure.spec.test.alpha :as st]
[clojure.test :as test :refer [deftest is testing]]
[juxt.iota :refer [given]]
Expand All @@ -16,6 +17,7 @@


(st/instrument)
(tu/init-fhir-specs)
(log/set-level! :trace)


Expand Down
3 changes: 2 additions & 1 deletion modules/db-tx-log-kafka/test/blaze/db/tx_log/kafka_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[blaze.fhir.hash :as hash]
[blaze.fhir.hash-spec]
[blaze.metrics.spec]
[blaze.test-util :refer [given-failed-future given-thrown with-system]]
[blaze.test-util :as tu :refer [given-failed-future given-thrown with-system]]
[clojure.spec.alpha :as s]
[clojure.spec.test.alpha :as st]
[clojure.test :as test :refer [deftest is testing]]
Expand All @@ -26,6 +26,7 @@


(st/instrument)
(tu/init-fhir-specs)
(log/set-level! :trace)


Expand Down
10 changes: 8 additions & 2 deletions modules/db-tx-log/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
{:extra-paths ["test"]

:extra-deps
{lambdaisland/kaocha
{blaze/test-util
{:local/root "../test-util"}

lambdaisland/kaocha
{:mvn/version "1.62.993"}}

:main-opts ["-m" "kaocha.runner"]}
Expand All @@ -25,7 +28,10 @@
{:extra-paths ["test"]

:extra-deps
{cloverage/cloverage
{blaze/test-util
{:local/root "../test-util"}

cloverage/cloverage
{:mvn/version "1.2.2"}}

:main-opts ["-m" "cloverage.coverage" "--codecov" "-p" "src" "-s" "test"]}}}
3 changes: 2 additions & 1 deletion modules/db-tx-log/test/blaze/db/tx_log/spec_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
[blaze.db.tx-log.spec]
[blaze.fhir.hash :as hash]
[blaze.fhir.hash-spec]
[blaze.test-util :as tu]
[clojure.spec.alpha :as s]
[clojure.spec.test.alpha :as st]
[clojure.test :as test :refer [are deftest]]
[taoensso.timbre :as log]))


(st/instrument)
(tu/init-fhir-specs)
(log/set-level! :trace)


Expand All @@ -21,7 +23,6 @@

(test/use-fixtures :each fixture)


(deftest t-test
(are [x] (s/valid? :blaze.db/t x)
0
Expand Down
2 changes: 2 additions & 0 deletions modules/db-tx-log/test/blaze/db/tx_log_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[blaze.db.tx-log :as tx-log]
[blaze.fhir.hash :as hash]
[blaze.fhir.hash-spec]
[blaze.test-util :as tu]
[clojure.spec.test.alpha :as st]
[clojure.test :as test :refer [is deftest]]
[java-time :as time])
Expand All @@ -13,6 +14,7 @@


(st/instrument)
(tu/init-fhir-specs)


(defn- fixture [f]
Expand Down
11 changes: 6 additions & 5 deletions modules/db/src/blaze/db/impl/batch_db.clj
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
[blaze.db.impl.index.type-stats :as type-stats]
[blaze.db.impl.protocols :as p]
[blaze.db.impl.search-param.util :as u]
[blaze.db.kv :as kv])
[blaze.db.kv :as kv]
[blaze.fhir.spec.type :as type])
(:import
[clojure.lang IReduceInit]
[java.io Writer]
[java.lang AutoCloseable]
[clojure.lang IReduceInit]))
[java.lang AutoCloseable]))


(set! *warn-on-reflection* true)
Expand Down Expand Up @@ -175,9 +176,9 @@


(-rev-include [_ resource-handle source-type code]
(let [{:keys [tid id]} resource-handle
(let [{:keys [id]} resource-handle
{:keys [svri]} context
reference (codec/v-hash (str (codec/tid->type tid) "/" id))
reference (codec/v-hash (str (name (type/type resource-handle)) "/" id))
source-tid (codec/tid source-type)]
(coll/eduction
(u/resource-handle-mapper context source-tid)
Expand Down
154 changes: 148 additions & 6 deletions modules/db/src/blaze/db/impl/codec.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
(:require
[blaze.byte-string :as bs]
[blaze.db.impl.byte-buffer :as bb]
[blaze.fhir.spec.type.system]
[blaze.fhir.util :as fhir-util])
[blaze.fhir.spec.type.system])
(:import
[blaze.fhir.spec.type.system DateTimeYear DateTimeYearMonth
DateTimeYearMonthDay]
Expand Down Expand Up @@ -58,13 +57,156 @@
(.asInt)))))


(let [kvs (->> (fhir-util/resources)
(map (fn [{:keys [type]}] [(tid type) type]))
(sort-by first))
(let [kvs [[-2146857976 "ClinicalImpression"]
[-2144887593 "ImmunizationEvaluation"]
[-2122495190 "Goal"]
[-2117596305 "MedicinalProductAuthorization"]
[-2109411663 "ConceptMap"]
[-2064947246 "MedicationAdministration"]
[-1955425438 "Media"]
[-1938470528 "Encounter"]
[-1930074818 "Schedule"]
[-1921582492 "HealthcareService"]
[-1907033276 "ServiceRequest"]
[-1841175362 "Endpoint"]
[-1823859526 "PaymentReconciliation"]
[-1806190491 "Immunization"]
[-1792712657 "CommunicationRequest"]
[-1785826783 "ObservationDefinition"]
[-1766148779 "Slot"]
[-1698980665 "MedicinalProductPackaged"]
[-1679546398 "Contract"]
[-1664243521 "VisionPrescription"]
[-1662021626 "NutritionOrder"]
[-1619531880 "Linkage"]
[-1616119630 "SubstancePolymer"]
[-1607765974 "Appointment"]
[-1582808583 "Consent"]
[-1563860828 "BiologicallyDerivedProduct"]
[-1535597530 "MedicinalProductPharmaceutical"]
[-1508652135 "Patient"]
[-1498775595 "ImmunizationRecommendation"]
[-1486145234 "CompartmentDefinition"]
[-1416327690 "BodyStructure"]
[-1408495925 "CatalogEntry"]
[-1395884574 "MedicinalProductContraindication"]
[-1392896153 "VerificationResult"]
[-1348145880 "DeviceUseStatement"]
[-1317855574 "DeviceRequest"]
[-1253457572 "MessageHeader"]
[-1234412843 "Library"]
[-1234037851 "StructureMap"]
[-1211692102 "AllergyIntolerance"]
[-1197972665 "CapabilityStatement"]
[-1178333639 "Medication"]
[-1096874819 "Account"]
[-1061667662 "ResearchSubject"]
[-1043762161 "DocumentReference"]
[-1016280475 "SubstanceSourceMaterial"]
[-987069264 "RelatedPerson"]
[-981868869 "DetectedIssue"]
[-906567409 "OperationOutcome"]
[-857961912 "CareTeam"]
[-836123537 "Substance"]
[-821386881 "Location"]
[-793756482 "FamilyMemberHistory"]
[-775340144 "MedicationRequest"]
[-762550806 "CarePlan"]
[-759227186 "GuidanceResponse"]
[-714079149 "Flag"]
[-705018099 "Invoice"]
[-620329769 "Specimen"]
[-612809062 "Basic"]
[-609334916 "ImagingStudy"]
[-566801226 "MedicinalProductInteraction"]
[-550263178 "Procedure"]
[-533734493 "EventDefinition"]
[-519892160 "Device"]
[-465150864 "Organization"]
[-456861287 "ExampleScenario"]
[-449453287 "ChargeItem"]
[-440388670 "MedicinalProduct"]
[-424110863 "MedicationKnowledge"]
[-409108303 "ResearchStudy"]
[-399002016 "CodeSystem"]
[-350610588 "EvidenceVariable"]
[-346477310 "MolecularSequence"]
[-290604778 "RiskEvidenceSynthesis"]
[-288511436 "InsurancePlan"]
[-275369827 "DeviceDefinition"]
[-270384781 "Practitioner"]
[-225603577 "SpecimenDefinition"]
[-210768418 "Subscription"]
[-192619824 "SupplyDelivery"]
[-135173301 "EnrollmentResponse"]
[-49254658 "Group"]
[-15728338 "ExplanationOfBenefit"]
[18499055 "Questionnaire"]
[34688446 "ResearchDefinition"]
[59162178 "QuestionnaireResponse"]
[144907839 "CoverageEligibilityRequest"]
[176172729 "Provenance"]
[179601186 "List"]
[193554741 "MedicinalProductIngredient"]
[196435039 "Claim"]
[418673785 "RiskAssessment"]
[495401834 "Communication"]
[554526871 "PaymentNotice"]
[588083121 "ChargeItemDefinition"]
[633737238 "MedicinalProductUndesirableEffect"]
[699823978 "ImplementationGuide"]
[816904812 "ClaimResponse"]
[862114136 "ResearchElementDefinition"]
[956349679 "DiagnosticReport"]
[1008623651 "TerminologyCapabilities"]
[1144476312 "CoverageEligibilityResponse"]
[1157731871 "StructureDefinition"]
[1160573513 "GraphDefinition"]
[1165649445 "SupplyRequest"]
[1197875005 "AuditEvent"]
[1225883824 "Person"]
[1280418335 "Coverage"]
[1320002914 "MedicationStatement"]
[1358819624 "RequestGroup"]
[1366361718 "NamingSystem"]
[1407925398 "Composition"]
[1423604526 "EffectEvidenceSynthesis"]
[1433732083 "EpisodeOfCare"]
[1445362758 "Evidence"]
[1446512298 "SubstanceNucleicAcid"]
[1460414728 "Bundle"]
[1495153489 "Condition"]
[1499933762 "PlanDefinition"]
[1501000637 "SubstanceSpecification"]
[1503725773 "ActivityDefinition"]
[1519703768 "AdverseEvent"]
[1525596137 "OperationDefinition"]
[1543762679 "Observation"]
[1577883550 "MessageDefinition"]
[1582079864 "PractitionerRole"]
[1597447080 "DeviceMetric"]
[1603452656 "SearchParameter"]
[1622961479 "MedicationDispense"]
[1634078999 "ValueSet"]
[1654143066 "OrganizationAffiliation"]
[1692854872 "MeasureReport"]
[1732559825 "Parameters"]
[1732874191 "Task"]
[1745455705 "EnrollmentRequest"]
[1768958495 "SubstanceReferenceInformation"]
[1811233589 "Measure"]
[1861004142 "Binary"]
[1872042716 "AppointmentResponse"]
[2009306008 "TestScript"]
[2013764019 "MedicinalProductIndication"]
[2027550310 "SubstanceProtein"]
[2081142363 "TestReport"]
[2100353352 "DocumentManifest"]
[2121669939 "MedicinalProductManufactured"]]
tid->idx (int-array (map first kvs))
idx->type (object-array (map second kvs))]
(defn tid->type [tid]
(let [idx (Arrays/binarySearch tid->idx ^long tid)]
(let [idx (Arrays/binarySearch tid->idx ^int tid)]
(when (nat-int? idx)
(aget idx->type idx)))))

Expand Down
6 changes: 5 additions & 1 deletion modules/db/test-perf/blaze/db/api_test_perf.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
[blaze.db.tx-cache]
[blaze.db.tx-log :as tx-log]
[blaze.db.tx-log.local]
[blaze.fhir.structure-definition-repo]
[blaze.log]
[blaze.test-util :refer [with-system]]
[clojure.test :refer [deftest is testing]]
Expand Down Expand Up @@ -72,7 +73,10 @@
{:column-families {}}
::rs-kv/executor {}

:blaze.db/search-param-registry {}})
:blaze.db/search-param-registry
{:structure-definition-repo (ig/ref :blaze.fhir/structure-definition-repo)}

:blaze.fhir/structure-definition-repo {}})


(deftest transact-test
Expand Down
Loading

0 comments on commit 5978fec

Please sign in to comment.